code_text
stringlengths
604
999k
repo_name
stringlengths
4
100
file_path
stringlengths
4
873
language
stringclasses
23 values
license
stringclasses
15 values
size
int32
1.02k
999k
""" Utility functions for generating "lorem ipsum" Latin text. """ import random COMMON_P = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' WORDS = ('exercitationem', 'perferendis', 'perspiciatis', 'laborum', 'eveniet', 'sunt', 'iure', 'nam', 'nobis', 'eum', 'cum', 'officiis', 'excepturi', 'odio', 'consectetur', 'quasi', 'aut', 'quisquam', 'vel', 'eligendi', 'itaque', 'non', 'odit', 'tempore', 'quaerat', 'dignissimos', 'facilis', 'neque', 'nihil', 'expedita', 'vitae', 'vero', 'ipsum', 'nisi', 'animi', 'cumque', 'pariatur', 'velit', 'modi', 'natus', 'iusto', 'eaque', 'sequi', 'illo', 'sed', 'ex', 'et', 'voluptatibus', 'tempora', 'veritatis', 'ratione', 'assumenda', 'incidunt', 'nostrum', 'placeat', 'aliquid', 'fuga', 'provident', 'praesentium', 'rem', 'necessitatibus', 'suscipit', 'adipisci', 'quidem', 'possimus', 'voluptas', 'debitis', 'sint', 'accusantium', 'unde', 'sapiente', 'voluptate', 'qui', 'aspernatur', 'laudantium', 'soluta', 'amet', 'quo', 'aliquam', 'saepe', 'culpa', 'libero', 'ipsa', 'dicta', 'reiciendis', 'nesciunt', 'doloribus', 'autem', 'impedit', 'minima', 'maiores', 'repudiandae', 'ipsam', 'obcaecati', 'ullam', 'enim', 'totam', 'delectus', 'ducimus', 'quis', 'voluptates', 'dolores', 'molestiae', 'harum', 'dolorem', 'quia', 'voluptatem', 'molestias', 'magni', 'distinctio', 'omnis', 'illum', 'dolorum', 'voluptatum', 'ea', 'quas', 'quam', 'corporis', 'quae', 'blanditiis', 'atque', 'deserunt', 'laboriosam', 'earum', 'consequuntur', 'hic', 'cupiditate', 'quibusdam', 'accusamus', 'ut', 'rerum', 'error', 'minus', 'eius', 'ab', 'ad', 'nemo', 'fugit', 'officia', 'at', 'in', 'id', 'quos', 'reprehenderit', 'numquam', 'iste', 'fugiat', 'sit', 'inventore', 'beatae', 'repellendus', 'magnam', 'recusandae', 'quod', 'explicabo', 'doloremque', 'aperiam', 'consequatur', 'asperiores', 'commodi', 'optio', 'dolor', 'labore', 'temporibus', 'repellat', 'veniam', 'architecto', 'est', 'esse', 'mollitia', 'nulla', 'a', 'similique', 'eos', 'alias', 'dolore', 'tenetur', 'deleniti', 'porro', 'facere', 'maxime', 'corrupti') COMMON_WORDS = ('lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipisicing', 'elit', 'sed', 'do', 'eiusmod', 'tempor', 'incididunt', 'ut', 'labore', 'et', 'dolore', 'magna', 'aliqua') def sentence(): """ Returns a randomly generated sentence of lorem ipsum text. The first word is capitalized, and the sentence ends in either a period or question mark. Commas are added at random. """ # Determine the number of comma-separated sections and number of words in # each section for this sentence. sections = [u' '.join(random.sample(WORDS, random.randint(3, 12))) for i in range(random.randint(1, 5))] s = u', '.join(sections) # Convert to sentence case and add end punctuation. return u'%s%s%s' % (s[0].upper(), s[1:], random.choice('?.')) def paragraph(): """ Returns a randomly generated paragraph of lorem ipsum text. The paragraph consists of between 1 and 4 sentences, inclusive. """ return u' '.join([sentence() for i in range(random.randint(1, 4))]) def paragraphs(count, common=True): """ Returns a list of paragraphs as returned by paragraph(). If `common` is True, then the first paragraph will be the standard 'lorem ipsum' paragraph. Otherwise, the first paragraph will be random Latin text. Either way, subsequent paragraphs will be random Latin text. """ paras = [] for i in range(count): if common and i == 0: paras.append(COMMON_P) else: paras.append(paragraph()) return paras def words(count, common=True): """ Returns a string of `count` lorem ipsum words separated by a single space. If `common` is True, then the first 19 words will be the standard 'lorem ipsum' words. Otherwise, all words will be selected randomly. """ if common: word_list = list(COMMON_WORDS) else: word_list = [] c = len(word_list) if count > c: count -= c while count > 0: c = min(count, len(WORDS)) count -= c word_list += random.sample(WORDS, c) else: word_list = word_list[:count] return u' '.join(word_list)
writefaruq/lionface-app
django/contrib/webdesign/lorem_ipsum.py
Python
bsd-3-clause
4,973
/* Copyright (C) 2007 Eric Seidel <eric@webkit.org> Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" #include "core/css/CSSComputedStyleDeclaration.h" #include "core/CSSPropertyNames.h" #include "core/css/CSSPrimitiveValueMappings.h" #include "core/dom/Document.h" #include "core/rendering/style/RenderStyle.h" namespace blink { static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> glyphOrientationToCSSPrimitiveValue(EGlyphOrientation orientation) { switch (orientation) { case GO_0DEG: return CSSPrimitiveValue::create(0.0f, CSSPrimitiveValue::CSS_DEG); case GO_90DEG: return CSSPrimitiveValue::create(90.0f, CSSPrimitiveValue::CSS_DEG); case GO_180DEG: return CSSPrimitiveValue::create(180.0f, CSSPrimitiveValue::CSS_DEG); case GO_270DEG: return CSSPrimitiveValue::create(270.0f, CSSPrimitiveValue::CSS_DEG); default: return nullptr; } } static PassRefPtrWillBeRawPtr<CSSValue> strokeDashArrayToCSSValueList(PassRefPtr<SVGLengthList> passDashes) { RefPtr<SVGLengthList> dashes = passDashes; if (dashes->isEmpty()) return CSSPrimitiveValue::createIdentifier(CSSValueNone); RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); SVGLengthList::ConstIterator it = dashes->begin(); SVGLengthList::ConstIterator itEnd = dashes->end(); for (; it != itEnd; ++it) list->append(SVGLength::toCSSPrimitiveValue(*it)); return list.release(); } static PassRefPtrWillBeRawPtr<CSSValue> paintOrderToCSSValueList(EPaintOrder paintorder) { RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); do { EPaintOrderType paintOrderType = (EPaintOrderType)(paintorder & ((1 << kPaintOrderBitwidth) - 1)); switch (paintOrderType) { case PT_FILL: case PT_STROKE: case PT_MARKERS: list->append(CSSPrimitiveValue::create(paintOrderType)); break; case PT_NONE: default: ASSERT_NOT_REACHED(); break; } } while (paintorder >>= kPaintOrderBitwidth); return list.release(); } static PassRefPtrWillBeRawPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaintType paintType, const String& url, const Color& color, const Color& currentColor) { if (paintType >= SVG_PAINTTYPE_URI_NONE) { RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated(); values->append(CSSPrimitiveValue::create(url, CSSPrimitiveValue::CSS_URI)); if (paintType == SVG_PAINTTYPE_URI_NONE) values->append(CSSPrimitiveValue::create(CSSValueNone)); else if (paintType == SVG_PAINTTYPE_URI_CURRENTCOLOR) values->append(CSSPrimitiveValue::createColor(currentColor.rgb())); else if (paintType == SVG_PAINTTYPE_URI_RGBCOLOR) values->append(CSSPrimitiveValue::createColor(color.rgb())); return values.release(); } if (paintType == SVG_PAINTTYPE_NONE) return CSSPrimitiveValue::create(CSSValueNone); if (paintType == SVG_PAINTTYPE_CURRENTCOLOR) return CSSPrimitiveValue::createColor(currentColor.rgb()); return CSSPrimitiveValue::createColor(color.rgb()); } static inline String serializeAsFragmentIdentifier(const AtomicString& resource) { return "#" + resource; } PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSValue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const { Node* node = m_node.get(); if (!node) return nullptr; // Make sure our layout is up to date before we allow a query on these attributes. if (updateLayout) node->document().updateLayout(); RenderStyle* style = node->computedStyle(); if (!style) return nullptr; const SVGRenderStyle& svgStyle = style->svgStyle(); switch (propertyID) { case CSSPropertyClipRule: return CSSPrimitiveValue::create(svgStyle.clipRule()); case CSSPropertyFloodOpacity: return CSSPrimitiveValue::create(svgStyle.floodOpacity(), CSSPrimitiveValue::CSS_NUMBER); case CSSPropertyStopOpacity: return CSSPrimitiveValue::create(svgStyle.stopOpacity(), CSSPrimitiveValue::CSS_NUMBER); case CSSPropertyColorInterpolation: return CSSPrimitiveValue::create(svgStyle.colorInterpolation()); case CSSPropertyColorInterpolationFilters: return CSSPrimitiveValue::create(svgStyle.colorInterpolationFilters()); case CSSPropertyFillOpacity: return CSSPrimitiveValue::create(svgStyle.fillOpacity(), CSSPrimitiveValue::CSS_NUMBER); case CSSPropertyFillRule: return CSSPrimitiveValue::create(svgStyle.fillRule()); case CSSPropertyColorRendering: return CSSPrimitiveValue::create(svgStyle.colorRendering()); case CSSPropertyShapeRendering: return CSSPrimitiveValue::create(svgStyle.shapeRendering()); case CSSPropertyStrokeLinecap: return CSSPrimitiveValue::create(svgStyle.capStyle()); case CSSPropertyStrokeLinejoin: return CSSPrimitiveValue::create(svgStyle.joinStyle()); case CSSPropertyStrokeMiterlimit: return CSSPrimitiveValue::create(svgStyle.strokeMiterLimit(), CSSPrimitiveValue::CSS_NUMBER); case CSSPropertyStrokeOpacity: return CSSPrimitiveValue::create(svgStyle.strokeOpacity(), CSSPrimitiveValue::CSS_NUMBER); case CSSPropertyAlignmentBaseline: return CSSPrimitiveValue::create(svgStyle.alignmentBaseline()); case CSSPropertyDominantBaseline: return CSSPrimitiveValue::create(svgStyle.dominantBaseline()); case CSSPropertyTextAnchor: return CSSPrimitiveValue::create(svgStyle.textAnchor()); case CSSPropertyWritingMode: return CSSPrimitiveValue::create(svgStyle.writingMode()); case CSSPropertyClipPath: if (!svgStyle.clipperResource().isEmpty()) return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgStyle.clipperResource()), CSSPrimitiveValue::CSS_URI); return CSSPrimitiveValue::createIdentifier(CSSValueNone); case CSSPropertyMask: if (!svgStyle.maskerResource().isEmpty()) return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgStyle.maskerResource()), CSSPrimitiveValue::CSS_URI); return CSSPrimitiveValue::createIdentifier(CSSValueNone); case CSSPropertyFilter: if (!svgStyle.filterResource().isEmpty()) return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgStyle.filterResource()), CSSPrimitiveValue::CSS_URI); return CSSPrimitiveValue::createIdentifier(CSSValueNone); case CSSPropertyFloodColor: return currentColorOrValidColor(*style, svgStyle.floodColor()); case CSSPropertyLightingColor: return currentColorOrValidColor(*style, svgStyle.lightingColor()); case CSSPropertyStopColor: return currentColorOrValidColor(*style, svgStyle.stopColor()); case CSSPropertyFill: return adjustSVGPaintForCurrentColor(svgStyle.fillPaintType(), svgStyle.fillPaintUri(), svgStyle.fillPaintColor(), style->color()); case CSSPropertyMarkerEnd: if (!svgStyle.markerEndResource().isEmpty()) return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgStyle.markerEndResource()), CSSPrimitiveValue::CSS_URI); return CSSPrimitiveValue::createIdentifier(CSSValueNone); case CSSPropertyMarkerMid: if (!svgStyle.markerMidResource().isEmpty()) return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgStyle.markerMidResource()), CSSPrimitiveValue::CSS_URI); return CSSPrimitiveValue::createIdentifier(CSSValueNone); case CSSPropertyMarkerStart: if (!svgStyle.markerStartResource().isEmpty()) return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgStyle.markerStartResource()), CSSPrimitiveValue::CSS_URI); return CSSPrimitiveValue::createIdentifier(CSSValueNone); case CSSPropertyStroke: return adjustSVGPaintForCurrentColor(svgStyle.strokePaintType(), svgStyle.strokePaintUri(), svgStyle.strokePaintColor(), style->color()); case CSSPropertyStrokeDasharray: return strokeDashArrayToCSSValueList(svgStyle.strokeDashArray()); case CSSPropertyStrokeDashoffset: return SVGLength::toCSSPrimitiveValue(svgStyle.strokeDashOffset()); case CSSPropertyStrokeWidth: return SVGLength::toCSSPrimitiveValue(svgStyle.strokeWidth()); case CSSPropertyBaselineShift: { switch (svgStyle.baselineShift()) { case BS_BASELINE: return CSSPrimitiveValue::createIdentifier(CSSValueBaseline); case BS_SUPER: return CSSPrimitiveValue::createIdentifier(CSSValueSuper); case BS_SUB: return CSSPrimitiveValue::createIdentifier(CSSValueSub); case BS_LENGTH: return SVGLength::toCSSPrimitiveValue(svgStyle.baselineShiftValue()); } ASSERT_NOT_REACHED(); return nullptr; } case CSSPropertyBufferedRendering: return CSSPrimitiveValue::create(svgStyle.bufferedRendering()); case CSSPropertyGlyphOrientationHorizontal: return glyphOrientationToCSSPrimitiveValue(svgStyle.glyphOrientationHorizontal()); case CSSPropertyGlyphOrientationVertical: { if (RefPtrWillBeRawPtr<CSSPrimitiveValue> value = glyphOrientationToCSSPrimitiveValue(svgStyle.glyphOrientationVertical())) return value.release(); if (svgStyle.glyphOrientationVertical() == GO_AUTO) return CSSPrimitiveValue::createIdentifier(CSSValueAuto); return nullptr; } case CSSPropertyPaintOrder: return paintOrderToCSSValueList(svgStyle.paintOrder()); case CSSPropertyVectorEffect: return CSSPrimitiveValue::create(svgStyle.vectorEffect()); case CSSPropertyMaskType: return CSSPrimitiveValue::create(svgStyle.maskType()); case CSSPropertyMarker: case CSSPropertyEnableBackground: // the above properties are not yet implemented in the engine break; default: // If you crash here, it's because you added a css property and are not handling it // in either this switch statement or the one in CSSComputedStyleDelcaration::getPropertyCSSValue ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propertyID); } WTF_LOG_ERROR("unimplemented propertyID: %d", propertyID); return nullptr; } }
android-ia/platform_external_chromium_org_third_party_WebKit
Source/core/css/SVGCSSComputedStyleDeclaration.cpp
C++
bsd-3-clause
11,789
// Copyright 2013 The Flutter 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 identical to ../../../../ui/channel_buffers.dart with the // following exceptions: // // * All comments except this one are removed. // * _invokeX is replaced with engine.invokeX (X=1,2) // * _printDebug is replaced with print in an assert. part of ui; typedef DrainChannelCallback = Future<void> Function(ByteData? data, PlatformMessageResponseCallback callback); typedef ChannelCallback = void Function(ByteData? data, PlatformMessageResponseCallback callback); class _ChannelCallbackRecord { _ChannelCallbackRecord(this._callback) : _zone = Zone.current; final ChannelCallback _callback; final Zone _zone; void invoke(ByteData? dataArg, PlatformMessageResponseCallback callbackArg) { engine.invoke2<ByteData?, PlatformMessageResponseCallback>(_callback, _zone, dataArg, callbackArg); } } class _StoredMessage { _StoredMessage(this.data, this._callback) : _zone = Zone.current; final ByteData? data; final PlatformMessageResponseCallback _callback; final Zone _zone; void invoke(ByteData? dataArg) { engine.invoke1(_callback, _zone, dataArg); } } class _Channel { _Channel([ this._capacity = ChannelBuffers.kDefaultBufferSize ]) : _queue = collection.ListQueue<_StoredMessage>(_capacity); final collection.ListQueue<_StoredMessage> _queue; int get length => _queue.length; bool debugEnableDiscardWarnings = true; int get capacity => _capacity; int _capacity; set capacity(int newSize) { _capacity = newSize; _dropOverflowMessages(newSize); } bool _draining = false; bool push(_StoredMessage message) { if (!_draining && _channelCallbackRecord != null) { assert(_queue.isEmpty); _channelCallbackRecord!.invoke(message.data, message.invoke); return false; } if (_capacity <= 0) { return debugEnableDiscardWarnings; } final bool result = _dropOverflowMessages(_capacity - 1); _queue.addLast(message); return result; } _StoredMessage pop() => _queue.removeFirst(); bool _dropOverflowMessages(int lengthLimit) { bool result = false; while (_queue.length > lengthLimit) { final _StoredMessage message = _queue.removeFirst(); message.invoke(null); // send empty reply to the plugin side result = true; } return result; } _ChannelCallbackRecord? _channelCallbackRecord; void setListener(ChannelCallback callback) { final bool needDrain = _channelCallbackRecord == null; _channelCallbackRecord = _ChannelCallbackRecord(callback); if (needDrain && !_draining) _drain(); } void clearListener() { _channelCallbackRecord = null; } void _drain() { assert(!_draining); _draining = true; scheduleMicrotask(_drainStep); } void _drainStep() { assert(_draining); if (_queue.isNotEmpty && _channelCallbackRecord != null) { final _StoredMessage message = pop(); _channelCallbackRecord!.invoke(message.data, message.invoke); scheduleMicrotask(_drainStep); } else { _draining = false; } } } class ChannelBuffers { ChannelBuffers(); static const int kDefaultBufferSize = 1; static const String kControlChannelName = 'dev.flutter/channel-buffers'; final Map<String, _Channel> _channels = <String, _Channel>{}; void push(String name, ByteData? data, PlatformMessageResponseCallback callback) { final _Channel channel = _channels.putIfAbsent(name, () => _Channel()); if (channel.push(_StoredMessage(data, callback))) { assert(() { print( 'A message on the $name channel was discarded before it could be handled.\n' 'This happens when a plugin sends messages to the framework side before the ' 'framework has had an opportunity to register a listener. See the ChannelBuffers ' 'API documentation for details on how to configure the channel to expect more ' 'messages, or to expect messages to get discarded:\n' ' https://api.flutter.dev/flutter/dart-ui/ChannelBuffers-class.html' ); return true; }()); } } void setListener(String name, ChannelCallback callback) { final _Channel channel = _channels.putIfAbsent(name, () => _Channel()); channel.setListener(callback); } void clearListener(String name) { final _Channel? channel = _channels[name]; if (channel != null) channel.clearListener(); } Future<void> drain(String name, DrainChannelCallback callback) async { final _Channel? channel = _channels[name]; while (channel != null && !channel._queue.isEmpty) { final _StoredMessage message = channel.pop(); await callback(message.data, message.invoke); } } void handleMessage(ByteData data) { final Uint8List bytes = data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes); if (bytes[0] == 0x07) { // 7 = value code for string final int methodNameLength = bytes[1]; if (methodNameLength >= 254) // lengths greater than 253 have more elaborate encoding throw Exception('Unrecognized message sent to $kControlChannelName (method name too long)'); int index = 2; // where we are in reading the bytes final String methodName = utf8.decode(bytes.sublist(index, index + methodNameLength)); index += methodNameLength; switch (methodName) { case 'resize': if (bytes[index] != 0x0C) // 12 = value code for list throw Exception('Invalid arguments for \'resize\' method sent to $kControlChannelName (arguments must be a two-element list, channel name and new capacity)'); index += 1; if (bytes[index] < 0x02) // We ignore extra arguments, in case we need to support them in the future, hence <2 rather than !=2. throw Exception('Invalid arguments for \'resize\' method sent to $kControlChannelName (arguments must be a two-element list, channel name and new capacity)'); index += 1; if (bytes[index] != 0x07) // 7 = value code for string throw Exception('Invalid arguments for \'resize\' method sent to $kControlChannelName (first argument must be a string)'); index += 1; final int channelNameLength = bytes[index]; if (channelNameLength >= 254) // lengths greater than 253 have more elaborate encoding throw Exception('Invalid arguments for \'resize\' method sent to $kControlChannelName (channel name must be less than 254 characters long)'); index += 1; final String channelName = utf8.decode(bytes.sublist(index, index + channelNameLength)); index += channelNameLength; if (bytes[index] != 0x03) // 3 = value code for uint32 throw Exception('Invalid arguments for \'resize\' method sent to $kControlChannelName (second argument must be an integer in the range 0 to 2147483647)'); index += 1; resize(channelName, data.getUint32(index, Endian.host)); break; case 'overflow': if (bytes[index] != 0x0C) // 12 = value code for list throw Exception('Invalid arguments for \'overflow\' method sent to $kControlChannelName (arguments must be a two-element list, channel name and flag state)'); index += 1; if (bytes[index] < 0x02) // We ignore extra arguments, in case we need to support them in the future, hence <2 rather than !=2. throw Exception('Invalid arguments for \'overflow\' method sent to $kControlChannelName (arguments must be a two-element list, channel name and flag state)'); index += 1; if (bytes[index] != 0x07) // 7 = value code for string throw Exception('Invalid arguments for \'overflow\' method sent to $kControlChannelName (first argument must be a string)'); index += 1; final int channelNameLength = bytes[index]; if (channelNameLength >= 254) // lengths greater than 253 have more elaborate encoding throw Exception('Invalid arguments for \'overflow\' method sent to $kControlChannelName (channel name must be less than 254 characters long)'); index += 1; final String channelName = utf8.decode(bytes.sublist(index, index + channelNameLength)); index += channelNameLength; if (bytes[index] != 0x01 && bytes[index] != 0x02) // 1 = value code for true, 2 = value code for false throw Exception('Invalid arguments for \'overflow\' method sent to $kControlChannelName (second argument must be a boolean)'); allowOverflow(channelName, bytes[index] == 0x01); break; default: throw Exception('Unrecognized method \'$methodName\' sent to $kControlChannelName'); } } else { final List<String> parts = utf8.decode(bytes).split('\r'); if (parts.length == 1 + /*arity=*/2 && parts[0] == 'resize') { resize(parts[1], int.parse(parts[2])); } else { throw Exception('Unrecognized message $parts sent to $kControlChannelName.'); } } } void resize(String name, int newSize) { _Channel? channel = _channels[name]; if (channel == null) { channel = _Channel(newSize); _channels[name] = channel; } else { channel.capacity = newSize; } } void allowOverflow(String name, bool allowed) { assert(() { _Channel? channel = _channels[name]; if (channel == null && allowed) { channel = _Channel(); _channels[name] = channel; } channel?.debugEnableDiscardWarnings = !allowed; return true; }()); } } final ChannelBuffers channelBuffers = ChannelBuffers();
aam/engine
lib/web_ui/lib/src/ui/channel_buffers.dart
Dart
bsd-3-clause
9,814
# Copyright (C) 2012 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. """A keyring based Storage. A Storage for Credentials that uses the keyring module. """ __author__ = 'jcgregorio@google.com (Joe Gregorio)' import keyring import threading from client import Storage as BaseStorage from client import Credentials class Storage(BaseStorage): """Store and retrieve a single credential to and from the keyring. To use this module you must have the keyring module installed. See <http://pypi.python.org/pypi/keyring/>. This is an optional module and is not installed with oauth2client by default because it does not work on all the platforms that oauth2client supports, such as Google App Engine. The keyring module <http://pypi.python.org/pypi/keyring/> is a cross-platform library for access the keyring capabilities of the local system. The user will be prompted for their keyring password when this module is used, and the manner in which the user is prompted will vary per platform. Usage: from oauth2client.keyring_storage import Storage s = Storage('name_of_application', 'user1') credentials = s.get() """ def __init__(self, service_name, user_name): """Constructor. Args: service_name: string, The name of the service under which the credentials are stored. user_name: string, The name of the user to store credentials for. """ self._service_name = service_name self._user_name = user_name self._lock = threading.Lock() def acquire_lock(self): """Acquires any lock necessary to access this Storage. This lock is not reentrant.""" self._lock.acquire() def release_lock(self): """Release the Storage lock. Trying to release a lock that isn't held will result in a RuntimeError. """ self._lock.release() def locked_get(self): """Retrieve Credential from file. Returns: oauth2client.client.Credentials """ credentials = None content = keyring.get_password(self._service_name, self._user_name) if content is not None: try: credentials = Credentials.new_from_json(content) credentials.set_store(self) except ValueError: pass return credentials def locked_put(self, credentials): """Write Credentials to file. Args: credentials: Credentials, the credentials to store. """ keyring.set_password(self._service_name, self._user_name, credentials.to_json()) def locked_delete(self): """Delete Credentials file. Args: credentials: Credentials, the credentials to store. """ keyring.set_password(self._service_name, self._user_name, '')
smadhusu/AppRTC
src/third_party/oauth2client/keyring_storage.py
Python
bsd-3-clause
3,227
<?php $form = $this->beginWidget( 'bootstrap.widgets.TbActiveForm', [ 'action' => Yii::app()->createUrl($this->route), 'method' => 'get', 'type' => 'vertical', 'htmlOptions' => ['class' => 'well'], ] ); ?> <fieldset> <div class="row"> <div class="col-sm-3"> <?php echo $form->textFieldGroup($model, 'name'); ?> </div> <div class="col-sm-3"> <?php echo $form->textFieldGroup($model, 'slug'); ?> </div> <div class="col-sm-3"> <?php echo $form->dropDownListGroup( $model, 'status', [ 'widgetOptions' => [ 'data' => $model->getStatusList(), 'htmlOptions' => [ 'empty' => '---', ], ] ] );?> </div> </div> <div class="row"> <div class="col-sm-3"> <?php echo $form->textFieldGroup($model, 'short_description'); ?> </div> <div class="col-sm-3"> <?php echo $form->textFieldGroup($model, 'description'); ?> </div> <div class="col-sm-3"> <?php echo $form->dropDownListGroup( $model, 'parent_id', [ 'widgetOptions' => [ 'data' => Category::model()->getFormattedList(), 'htmlOptions' => [ 'empty' => '---', ], ] ] );?> </div> </div> </fieldset> <?php $this->widget( 'bootstrap.widgets.TbButton', [ 'context' => 'primary', 'encodeLabel' => false, 'buttonType' => 'submit', 'label' => '<i class="fa fa-search">&nbsp;</i> ' . Yii::t( 'CategoryModule.category', 'Find category' ), ] ); ?> <?php $this->endWidget(); ?>
tchernobyl/yupe
protected/modules/category/views/categoryBackend/_search.php
PHP
bsd-3-clause
2,094
<?php /** * @link http://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license http://www.yiiframework.com/license/ */ namespace yiiunit\framework\widgets; use Yii; use yii\base\DynamicModel; use yii\web\AssetManager; use yii\web\View; use yii\widgets\ActiveField; use yii\widgets\ActiveForm; use yii\widgets\InputWidget; use yii\widgets\MaskedInput; /** * @author Nelson J Morais <njmorais@gmail.com> * * @group widgets */ class ActiveFieldTest extends \yiiunit\TestCase { /** * @var ActiveFieldExtend */ private $activeField; /** * @var DynamicModel */ private $helperModel; /** * @var ActiveForm */ private $helperForm; private $attributeName = 'attributeName'; protected function setUp() { parent::setUp(); // dirty way to have Request object not throwing exception when running testHomeLinkNull() $_SERVER['SCRIPT_FILENAME'] = 'index.php'; $_SERVER['SCRIPT_NAME'] = 'index.php'; $this->mockWebApplication(); Yii::setAlias('@testWeb', '/'); Yii::setAlias('@testWebRoot', '@yiiunit/data/web'); $this->helperModel = new ActiveFieldTestModel(['attributeName']); ob_start(); $this->helperForm = ActiveForm::begin(['action' => '/something', 'enableClientScript' => false]); ActiveForm::end(); ob_end_clean(); $this->activeField = new ActiveFieldExtend(true); $this->activeField->form = $this->helperForm; $this->activeField->form->setView($this->getView()); $this->activeField->model = $this->helperModel; $this->activeField->attribute = $this->attributeName; } public function testRenderNoContent() { $expectedValue = <<<EOD <div class="form-group field-activefieldtestmodel-attributename"> <label class="control-label" for="activefieldtestmodel-attributename">Attribute Name</label> <input type="text" id="activefieldtestmodel-attributename" class="form-control" name="ActiveFieldTestModel[{$this->attributeName}]"> <div class="hint-block">Hint for attributeName attribute</div> <div class="help-block"></div> </div> EOD; $actualValue = $this->activeField->render(); $this->assertEqualsWithoutLE($expectedValue, $actualValue); } /** * @todo discuss|review Expected HTML shouldn't be wrapped only by the $content? */ public function testRenderWithCallableContent() { // field will be the html of the model's attribute wrapped with the return string below. $field = $this->attributeName; $content = function ($field) { return "<div class=\"custom-container\"> $field </div>"; }; $expectedValue = <<<EOD <div class="form-group field-activefieldtestmodel-attributename"> <div class="custom-container"> <div class="form-group field-activefieldtestmodel-attributename"> <label class="control-label" for="activefieldtestmodel-attributename">Attribute Name</label> <input type="text" id="activefieldtestmodel-attributename" class="form-control" name="ActiveFieldTestModel[{$this->attributeName}]"> <div class="hint-block">Hint for attributeName attribute</div> <div class="help-block"></div> </div> </div> </div> EOD; $actualValue = $this->activeField->render($content); $this->assertEqualsWithoutLE($expectedValue, $actualValue); } /** * @link https://github.com/yiisoft/yii2/issues/7627 */ public function testRenderWithCustomInputId() { $expectedValue = <<<EOD <div class="form-group field-custom-input-id"> <label class="control-label" for="custom-input-id">Attribute Name</label> <input type="text" id="custom-input-id" class="form-control" name="ActiveFieldTestModel[{$this->attributeName}]"> <div class="hint-block">Hint for attributeName attribute</div> <div class="help-block"></div> </div> EOD; $this->activeField->inputOptions['id'] = 'custom-input-id'; $actualValue = $this->activeField->render(); $this->assertEqualsWithoutLE($expectedValue, $actualValue); } public function testBeginHasErrors() { $this->helperModel->addError($this->attributeName, 'Error Message'); $expectedValue = '<div class="form-group field-activefieldtestmodel-attributename has-error">'; $actualValue = $this->activeField->begin(); $this->assertEquals($expectedValue, $actualValue); } public function testBeginAttributeIsRequired() { $this->helperModel->addRule($this->attributeName, 'required'); $expectedValue = '<div class="form-group field-activefieldtestmodel-attributename required">'; $actualValue = $this->activeField->begin(); $this->assertEquals($expectedValue, $actualValue); } public function testBeginHasErrorAndRequired() { $this->helperModel->addError($this->attributeName, 'Error Message'); $this->helperModel->addRule($this->attributeName, 'required'); $expectedValue = '<div class="form-group field-activefieldtestmodel-attributename required has-error">'; $actualValue = $this->activeField->begin(); $this->assertEquals($expectedValue, $actualValue); } public function testBegin() { $expectedValue = '<article class="form-group field-activefieldtestmodel-attributename">'; $this->activeField->options['tag'] = 'article'; $actualValue = $this->activeField->begin(); $this->assertEquals($expectedValue, $actualValue); $expectedValue = ''; $this->activeField->options['tag'] = null; $actualValue = $this->activeField->begin(); $this->assertEquals($expectedValue, $actualValue); $expectedValue = ''; $this->activeField->options['tag'] = false; $actualValue = $this->activeField->begin(); $this->assertEquals($expectedValue, $actualValue); } public function testEnd() { $expectedValue = '</div>'; $actualValue = $this->activeField->end(); $this->assertEquals($expectedValue, $actualValue); // other tag $expectedValue = '</article>'; $this->activeField->options['tag'] = 'article'; $actualValue = $this->activeField->end(); $this->assertEquals($expectedValue, $actualValue); $expectedValue = ''; $this->activeField->options['tag'] = false; $actualValue = $this->activeField->end(); $this->assertEquals($expectedValue, $actualValue); $expectedValue = ''; $this->activeField->options['tag'] = null; $actualValue = $this->activeField->end(); $this->assertEquals($expectedValue, $actualValue); } public function testLabel() { $expectedValue = '<label class="control-label" for="activefieldtestmodel-attributename">Attribute Name</label>'; $this->activeField->label(); $this->assertEquals($expectedValue, $this->activeField->parts['{label}']); // label = false $expectedValue = ''; $this->activeField->label(false); $this->assertEquals($expectedValue, $this->activeField->parts['{label}']); // $label = 'Label Name' $label = 'Label Name'; $expectedValue = <<<EOT <label class="control-label" for="activefieldtestmodel-attributename">{$label}</label> EOT; $this->activeField->label($label); $this->assertEquals($expectedValue, $this->activeField->parts['{label}']); } public function testError() { $expectedValue = '<label class="control-label" for="activefieldtestmodel-attributename">Attribute Name</label>'; $this->activeField->label(); $this->assertEquals($expectedValue, $this->activeField->parts['{label}']); // label = false $expectedValue = ''; $this->activeField->label(false); $this->assertEquals($expectedValue, $this->activeField->parts['{label}']); // $label = 'Label Name' $label = 'Label Name'; $expectedValue = <<<EOT <label class="control-label" for="activefieldtestmodel-attributename">{$label}</label> EOT; $this->activeField->label($label); $this->assertEquals($expectedValue, $this->activeField->parts['{label}']); } public function testTabularInputErrors() { $this->activeField->attribute = '[0]'.$this->attributeName; $this->helperModel->addError($this->attributeName, 'Error Message'); $expectedValue = '<div class="form-group field-activefieldtestmodel-0-attributename has-error">'; $actualValue = $this->activeField->begin(); $this->assertEquals($expectedValue, $actualValue); } public function hintDataProvider() { return [ ['Hint Content', '<div class="hint-block">Hint Content</div>'], [false, ''], [null, '<div class="hint-block">Hint for attributeName attribute</div>'], ]; } /** * @dataProvider hintDataProvider * @param mixed $hint * @param string $expectedHtml */ public function testHint($hint, $expectedHtml) { $this->activeField->hint($hint); $this->assertEquals($expectedHtml, $this->activeField->parts['{hint}']); } public function testInput() { $expectedValue = <<<'EOD' <input type="password" id="activefieldtestmodel-attributename" class="form-control" name="ActiveFieldTestModel[attributeName]"> EOD; $this->activeField->input('password'); $this->assertEquals($expectedValue, $this->activeField->parts['{input}']); // with options $expectedValue = <<<'EOD' <input type="password" id="activefieldtestmodel-attributename" class="form-control" name="ActiveFieldTestModel[attributeName]" weird="value"> EOD; $this->activeField->input('password', ['weird' => 'value']); $this->assertEquals($expectedValue, $this->activeField->parts['{input}']); } public function testTextInput() { $expectedValue = <<<'EOD' <input type="text" id="activefieldtestmodel-attributename" class="form-control" name="ActiveFieldTestModel[attributeName]"> EOD; $this->activeField->textInput(); $this->assertEquals($expectedValue, $this->activeField->parts['{input}']); } public function testHiddenInput() { $expectedValue = <<<'EOD' <input type="hidden" id="activefieldtestmodel-attributename" class="form-control" name="ActiveFieldTestModel[attributeName]"> EOD; $this->activeField->hiddenInput(); $this->assertEquals($expectedValue, $this->activeField->parts['{input}']); } public function testListBox() { $expectedValue = <<<'EOD' <input type="hidden" name="ActiveFieldTestModel[attributeName]" value=""><select id="activefieldtestmodel-attributename" class="form-control" name="ActiveFieldTestModel[attributeName]" size="4"> <option value="1">Item One</option> <option value="2">Item 2</option> </select> EOD; $this->activeField->listBox(['1' => 'Item One', '2' => 'Item 2']); $this->assertEqualsWithoutLE($expectedValue, $this->activeField->parts['{input}']); // https://github.com/yiisoft/yii2/issues/8848 $expectedValue = <<<'EOD' <input type="hidden" name="ActiveFieldTestModel[attributeName]" value=""><select id="activefieldtestmodel-attributename" class="form-control" name="ActiveFieldTestModel[attributeName]" size="4"> <option value="value1" disabled>Item One</option> <option value="value2" label="value 2">Item 2</option> </select> EOD; $this->activeField->listBox(['value1' => 'Item One', 'value2' => 'Item 2'], ['options' => [ 'value1' => ['disabled' => true], 'value2' => ['label' => 'value 2'], ]]); $this->assertEqualsWithoutLE($expectedValue, $this->activeField->parts['{input}']); $expectedValue = <<<'EOD' <input type="hidden" name="ActiveFieldTestModel[attributeName]" value=""><select id="activefieldtestmodel-attributename" class="form-control" name="ActiveFieldTestModel[attributeName]" size="4"> <option value="value1" disabled>Item One</option> <option value="value2" selected label="value 2">Item 2</option> </select> EOD; $this->activeField->model->{$this->attributeName} = 'value2'; $this->activeField->listBox(['value1' => 'Item One', 'value2' => 'Item 2'], ['options' => [ 'value1' => ['disabled' => true], 'value2' => ['label' => 'value 2'], ]]); $this->assertEqualsWithoutLE($expectedValue, $this->activeField->parts['{input}']); } public function testRadioList() { $expectedValue = <<<'EOD' <div class="form-group field-activefieldtestmodel-attributename"> <label class="control-label">Attribute Name</label> <input type="hidden" name="ActiveFieldTestModel[attributeName]" value=""><div id="activefieldtestmodel-attributename" role="radiogroup"><label><input type="radio" name="ActiveFieldTestModel[attributeName]" value="1"> Item One</label></div> <div class="hint-block">Hint for attributeName attribute</div> <div class="help-block"></div> </div> EOD; $this->activeField->radioList(['1' => 'Item One']); $this->assertEqualsWithoutLE($expectedValue, $this->activeField->render()); } public function testGetClientOptionsReturnEmpty() { // setup: we want the real deal here! $this->activeField->setClientOptionsEmpty(false); // expected empty $actualValue = $this->activeField->getClientOptions(); $this->assertEmpty($actualValue); } public function testGetClientOptionsWithActiveAttributeInScenario() { $this->activeField->setClientOptionsEmpty(false); $this->activeField->model->addRule($this->attributeName, 'yiiunit\framework\widgets\TestValidator'); $this->activeField->form->enableClientValidation = false; // expected empty $actualValue = $this->activeField->getClientOptions(); $this->assertEmpty($actualValue); } public function testGetClientOptionsClientValidation() { $this->activeField->setClientOptionsEmpty(false); $this->activeField->model->addRule($this->attributeName, 'yiiunit\framework\widgets\TestValidator'); $this->activeField->enableClientValidation = true; $actualValue = $this->activeField->getClientOptions(); $expectedJsExpression = 'function (attribute, value, messages, deferred, $form) {return true;}'; $this->assertEquals($expectedJsExpression, $actualValue['validate']); $this->assertNotTrue(isset($actualValue['validateOnChange'])); $this->assertNotTrue(isset($actualValue['validateOnBlur'])); $this->assertNotTrue(isset($actualValue['validateOnType'])); $this->assertNotTrue(isset($actualValue['validationDelay'])); $this->assertNotTrue(isset($actualValue['enableAjaxValidation'])); $this->activeField->validateOnChange = $expectedValidateOnChange = false; $this->activeField->validateOnBlur = $expectedValidateOnBlur = false; $this->activeField->validateOnType = $expectedValidateOnType = true; $this->activeField->validationDelay = $expectedValidationDelay = 100; $this->activeField->enableAjaxValidation = $expectedEnableAjaxValidation = true; $actualValue = $this->activeField->getClientOptions(); $this->assertSame($expectedValidateOnChange, $actualValue['validateOnChange']); $this->assertSame($expectedValidateOnBlur, $actualValue['validateOnBlur']); $this->assertSame($expectedValidateOnType, $actualValue['validateOnType']); $this->assertSame($expectedValidationDelay, $actualValue['validationDelay']); $this->assertSame($expectedEnableAjaxValidation, $actualValue['enableAjaxValidation']); } public function testGetClientOptionsValidatorWhenClientSet() { $this->activeField->setClientOptionsEmpty(false); $this->activeField->enableAjaxValidation = true; $this->activeField->model->addRule($this->attributeName, 'yiiunit\framework\widgets\TestValidator'); foreach ($this->activeField->model->validators as $validator) { $validator->whenClient = "function (attribute, value) { return 'yii2' == 'yii2'; }"; // js } $actualValue = $this->activeField->getClientOptions(); $expectedJsExpression = 'function (attribute, value, messages, deferred, $form) {if ((function (attribute, value) ' . "{ return 'yii2' == 'yii2'; })(attribute, value)) { return true; }}"; $this->assertEquals($expectedJsExpression, $actualValue['validate']->expression); } /** * @see https://github.com/yiisoft/yii2/issues/8779 */ public function testEnctype() { $this->activeField->fileInput(); $this->assertEquals('multipart/form-data', $this->activeField->form->options['enctype']); } /** * @link https://github.com/yiisoft/yii2/issues/7627 */ public function testGetClientOptionsWithCustomInputId() { $this->activeField->setClientOptionsEmpty(false); $this->activeField->model->addRule($this->attributeName, 'yiiunit\framework\widgets\TestValidator'); $this->activeField->inputOptions['id'] = 'custom-input-id'; $this->activeField->textInput(); $actualValue = $this->activeField->getClientOptions(); $this->assertArraySubset([ 'id' => 'activefieldtestmodel-attributename', 'name' => $this->attributeName, 'container' => '.field-custom-input-id', 'input' => '#custom-input-id', ], $actualValue); $this->activeField->textInput(['id' => 'custom-textinput-id']); $actualValue = $this->activeField->getClientOptions(); $this->assertArraySubset([ 'id' => 'activefieldtestmodel-attributename', 'name' => $this->attributeName, 'container' => '.field-custom-textinput-id', 'input' => '#custom-textinput-id', ], $actualValue); } public function testAriaAttributes() { $this->activeField->addAriaAttributes = true; $expectedValue = <<<'EOD' <div class="form-group field-activefieldtestmodel-attributename"> <label class="control-label" for="activefieldtestmodel-attributename">Attribute Name</label> <input type="text" id="activefieldtestmodel-attributename" class="form-control" name="ActiveFieldTestModel[attributeName]"> <div class="hint-block">Hint for attributeName attribute</div> <div class="help-block"></div> </div> EOD; $actualValue = $this->activeField->render(); $this->assertEqualsWithoutLE($expectedValue, $actualValue); } public function testAriaRequiredAttribute() { $this->activeField->addAriaAttributes = true; $this->helperModel->addRule([$this->attributeName], 'required'); $expectedValue = <<<'EOD' <div class="form-group field-activefieldtestmodel-attributename required"> <label class="control-label" for="activefieldtestmodel-attributename">Attribute Name</label> <input type="text" id="activefieldtestmodel-attributename" class="form-control" name="ActiveFieldTestModel[attributeName]" aria-required="true"> <div class="hint-block">Hint for attributeName attribute</div> <div class="help-block"></div> </div> EOD; $actualValue = $this->activeField->render(); $this->assertEqualsWithoutLE($expectedValue, $actualValue); } public function testAriaInvalidAttribute() { $this->activeField->addAriaAttributes = true; $this->helperModel->addError($this->attributeName, 'Some error'); $expectedValue = <<<'EOD' <div class="form-group field-activefieldtestmodel-attributename has-error"> <label class="control-label" for="activefieldtestmodel-attributename">Attribute Name</label> <input type="text" id="activefieldtestmodel-attributename" class="form-control" name="ActiveFieldTestModel[attributeName]" aria-invalid="true"> <div class="hint-block">Hint for attributeName attribute</div> <div class="help-block">Some error</div> </div> EOD; $actualValue = $this->activeField->render(); $this->assertEqualsWithoutLE($expectedValue, $actualValue); } public function testEmptyTag() { $this->activeField->options = ['tag' => false]; $expectedValue = '<input type="hidden" id="activefieldtestmodel-attributename" class="form-control" name="ActiveFieldTestModel[attributeName]">'; $actualValue = $this->activeField->hiddenInput()->label(false)->error(false)->hint(false)->render(); $this->assertEqualsWithoutLE($expectedValue, trim($actualValue)); } public function testWidget() { $this->activeField->widget(TestInputWidget::className()); $this->assertEquals('Render: ' . TestInputWidget::className(), $this->activeField->parts['{input}']); $widget = TestInputWidget::$lastInstance; $this->assertSame($this->activeField->model, $widget->model); $this->assertEquals($this->activeField->attribute, $widget->attribute); $this->assertSame($this->activeField->form->view, $widget->view); $this->assertSame($this->activeField, $widget->field); $this->activeField->widget(TestInputWidget::className(), ['options' => ['id' => 'test-id']]); $this->assertEquals('test-id', $this->activeField->labelOptions['for']); } public function testWidgetOptions() { $this->activeField->form->validationStateOn = ActiveForm::VALIDATION_STATE_ON_INPUT; $this->activeField->model->addError('attributeName', 'error'); $this->activeField->widget(TestInputWidget::className()); $widget = TestInputWidget::$lastInstance; $expectedOptions = [ 'class' => 'form-control has-error', 'aria-invalid' => 'true', 'id' => 'activefieldtestmodel-attributename', ]; $this->assertEquals($expectedOptions, $widget->options); $this->activeField->inputOptions = []; $this->activeField->widget(TestInputWidget::className()); $widget = TestInputWidget::$lastInstance; $expectedOptions = [ 'class' => 'has-error', 'aria-invalid' => 'true', 'id' => 'activefieldtestmodel-attributename', ]; $this->assertEquals($expectedOptions, $widget->options); } /** * @depends testHiddenInput * * @see https://github.com/yiisoft/yii2/issues/14773 */ public function testOptionsClass() { $this->activeField->options = ['class' => 'test-wrapper']; $expectedValue = <<<'HTML' <div class="test-wrapper field-activefieldtestmodel-attributename"> <input type="hidden" id="activefieldtestmodel-attributename" class="form-control" name="ActiveFieldTestModel[attributeName]"> </div> HTML; $actualValue = $this->activeField->hiddenInput()->label(false)->error(false)->hint(false)->render(); $this->assertEqualsWithoutLE($expectedValue, trim($actualValue)); $this->activeField->options = ['class' => ['test-wrapper', 'test-add']]; $expectedValue = <<<'HTML' <div class="test-wrapper test-add field-activefieldtestmodel-attributename"> <input type="hidden" id="activefieldtestmodel-attributename" class="form-control" name="ActiveFieldTestModel[attributeName]"> </div> HTML; $actualValue = $this->activeField->hiddenInput()->label(false)->error(false)->hint(false)->render(); $this->assertEqualsWithoutLE($expectedValue, trim($actualValue)); } public function testInputOptionsTransferToWidget() { $widget = $this->activeField->widget(TestMaskedInput::className(), [ 'mask' => '999-999-9999', 'options' => ['placeholder' => 'pholder_direct'], ]); $this->assertContains('placeholder="pholder_direct"', (string) $widget); // transfer options from ActiveField to widget $this->activeField->inputOptions = ['placeholder' => 'pholder_input']; $widget = $this->activeField->widget(TestMaskedInput::className(), [ 'mask' => '999-999-9999', ]); $this->assertContains('placeholder="pholder_input"', (string) $widget); // set both AF and widget options (second one takes precedence) $this->activeField->inputOptions = ['placeholder' => 'pholder_both_input']; $widget = $this->activeField->widget(TestMaskedInput::className(), [ 'mask' => '999-999-9999', 'options' => ['placeholder' => 'pholder_both_direct'] ]); $this->assertContains('placeholder="pholder_both_direct"', (string) $widget); } /** * Helper methods. */ protected function getView() { $view = new View(); $view->setAssetManager(new AssetManager([ 'basePath' => '@testWebRoot/assets', 'baseUrl' => '@testWeb/assets', ])); return $view; } } class ActiveFieldTestModel extends DynamicModel { public function attributeHints() { return [ 'attributeName' => 'Hint for attributeName attribute', ]; } } /** * Helper Classes. */ class ActiveFieldExtend extends ActiveField { private $getClientOptionsEmpty; public function __construct($getClientOptionsEmpty = true) { $this->getClientOptionsEmpty = $getClientOptionsEmpty; } public function setClientOptionsEmpty($value) { $this->getClientOptionsEmpty = (bool) $value; } /** * Useful to test other methods from ActiveField, that call ActiveField::getClientOptions() * but it's return value is not relevant for the test being run. */ public function getClientOptions() { return ($this->getClientOptionsEmpty) ? [] : parent::getClientOptions(); } } class TestValidator extends \yii\validators\Validator { public function clientValidateAttribute($object, $attribute, $view) { return 'return true;'; } public function setWhenClient($js) { $this->whenClient = $js; } } class TestInputWidget extends InputWidget { /** * @var static */ public static $lastInstance; public function init() { parent::init(); self::$lastInstance = $this; } public function run() { return 'Render: ' . get_class($this); } } class TestMaskedInput extends MaskedInput { /** * @var static */ public static $lastInstance; public function init() { parent::init(); self::$lastInstance = $this; } public function getOptions() { return $this->options; } public function run() { return 'Options: ' . implode(', ', array_map( function ($v, $k) { return sprintf('%s="%s"', $k, $v); }, $this->options, array_keys($this->options) )); } }
rob006/yii2-dev
tests/framework/widgets/ActiveFieldTest.php
PHP
bsd-3-clause
27,080
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ #import "RCTRootView.h" #import "RCTRootViewDelegate.h" #import "RCTRootViewInternal.h" #import <objc/runtime.h> #import "RCTAssert.h" #import "RCTBridge+Private.h" #import "RCTEventDispatcher.h" #import "RCTKeyCommands.h" #import "RCTLog.h" #import "RCTPerformanceLogger.h" #import "RCTSourceCode.h" #import "RCTTouchHandler.h" #import "RCTUIManager.h" #import "RCTUtils.h" #import "RCTView.h" #import "UIView+React.h" #import "RCTProfile.h" NSString *const RCTContentDidAppearNotification = @"RCTContentDidAppearNotification"; @interface RCTUIManager (RCTRootView) - (NSNumber *)allocateRootTag; @end @interface RCTRootContentView : RCTView <RCTInvalidating> @property (nonatomic, readonly) BOOL contentHasAppeared; @property (nonatomic, readonly, strong) RCTTouchHandler *touchHandler; - (instancetype)initWithFrame:(CGRect)frame bridge:(RCTBridge *)bridge reactTag:(NSNumber *)reactTag NS_DESIGNATED_INITIALIZER; @end @implementation RCTRootView { RCTBridge *_bridge; NSString *_moduleName; NSDictionary *_launchOptions; RCTRootContentView *_contentView; } - (instancetype)initWithBridge:(RCTBridge *)bridge moduleName:(NSString *)moduleName initialProperties:(NSDictionary *)initialProperties { RCTAssertMainThread(); RCTAssert(bridge, @"A bridge instance is required to create an RCTRootView"); RCTAssert(moduleName, @"A moduleName is required to create an RCTRootView"); RCT_PROFILE_BEGIN_EVENT(0, @"-[RCTRootView init]", nil); if ((self = [super initWithFrame:CGRectZero])) { self.backgroundColor = [UIColor whiteColor]; _bridge = bridge; _moduleName = moduleName; _appProperties = [initialProperties copy]; _loadingViewFadeDelay = 0.25; _loadingViewFadeDuration = 0.25; _sizeFlexibility = RCTRootViewSizeFlexibilityNone; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(bridgeDidReload) name:RCTJavaScriptWillStartLoadingNotification object:_bridge]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(javaScriptDidLoad:) name:RCTJavaScriptDidLoadNotification object:_bridge]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(hideLoadingView) name:RCTContentDidAppearNotification object:self]; if (!_bridge.loading) { [self bundleFinishedLoading:_bridge.batchedBridge]; } [self showLoadingView]; } RCT_PROFILE_END_EVENT(0, @"", nil); return self; } - (instancetype)initWithBundleURL:(NSURL *)bundleURL moduleName:(NSString *)moduleName initialProperties:(NSDictionary *)initialProperties launchOptions:(NSDictionary *)launchOptions { RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:bundleURL moduleProvider:nil launchOptions:launchOptions]; return [self initWithBridge:bridge moduleName:moduleName initialProperties:initialProperties]; } RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame) RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) - (void)setBackgroundColor:(UIColor *)backgroundColor { super.backgroundColor = backgroundColor; _contentView.backgroundColor = backgroundColor; } - (UIViewController *)reactViewController { return _reactViewController ?: [super reactViewController]; } - (BOOL)canBecomeFirstResponder { return YES; } - (void)setLoadingView:(UIView *)loadingView { _loadingView = loadingView; if (!_contentView.contentHasAppeared) { [self showLoadingView]; } } - (void)showLoadingView { if (_loadingView && !_contentView.contentHasAppeared) { _loadingView.hidden = NO; [self addSubview:_loadingView]; } } - (void)hideLoadingView { if (_loadingView.superview == self && _contentView.contentHasAppeared) { if (_loadingViewFadeDuration > 0) { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(_loadingViewFadeDelay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [UIView transitionWithView:self duration:_loadingViewFadeDuration options:UIViewAnimationOptionTransitionCrossDissolve animations:^{ _loadingView.hidden = YES; } completion:^(__unused BOOL finished) { [_loadingView removeFromSuperview]; }]; }); } else { _loadingView.hidden = YES; [_loadingView removeFromSuperview]; } } } - (NSNumber *)reactTag { RCTAssertMainThread(); if (!super.reactTag) { /** * Every root view that is created must have a unique react tag. * Numbering of these tags goes from 1, 11, 21, 31, etc * * NOTE: Since the bridge persists, the RootViews might be reused, so the * react tag must be re-assigned every time a new UIManager is created. */ self.reactTag = [_bridge.uiManager allocateRootTag]; } return super.reactTag; } - (void)bridgeDidReload { RCTAssertMainThread(); // Clear the reactTag so it can be re-assigned self.reactTag = nil; } - (void)javaScriptDidLoad:(NSNotification *)notification { RCTAssertMainThread(); RCTBridge *bridge = notification.userInfo[@"bridge"]; [self bundleFinishedLoading:bridge]; } - (void)bundleFinishedLoading:(RCTBridge *)bridge { if (!bridge.valid) { return; } [_contentView removeFromSuperview]; _contentView = [[RCTRootContentView alloc] initWithFrame:self.bounds bridge:bridge reactTag:self.reactTag]; [self runApplication:bridge]; _contentView.backgroundColor = self.backgroundColor; [self insertSubview:_contentView atIndex:0]; } - (void)runApplication:(RCTBridge *)bridge { NSString *moduleName = _moduleName ?: @""; NSDictionary *appParameters = @{ @"rootTag": _contentView.reactTag, @"initialProps": _appProperties ?: @{}, }; [bridge enqueueJSCall:@"AppRegistry.runApplication" args:@[moduleName, appParameters]]; } - (void)setSizeFlexibility:(RCTRootViewSizeFlexibility)sizeFlexibility { _sizeFlexibility = sizeFlexibility; [self setNeedsLayout]; } - (void)layoutSubviews { [super layoutSubviews]; _contentView.frame = self.bounds; _loadingView.center = (CGPoint){ CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds) }; } - (void)setAppProperties:(NSDictionary *)appProperties { RCTAssertMainThread(); if ([_appProperties isEqualToDictionary:appProperties]) { return; } _appProperties = [appProperties copy]; if (_contentView && _bridge.valid && !_bridge.loading) { [self runApplication:_bridge.batchedBridge]; } } - (void)setIntrinsicSize:(CGSize)intrinsicSize { BOOL oldSizeHasAZeroDimension = _intrinsicSize.height == 0 || _intrinsicSize.width == 0; BOOL newSizeHasAZeroDimension = intrinsicSize.height == 0 || intrinsicSize.width == 0; BOOL bothSizesHaveAZeroDimension = oldSizeHasAZeroDimension && newSizeHasAZeroDimension; BOOL sizesAreEqual = CGSizeEqualToSize(_intrinsicSize, intrinsicSize); _intrinsicSize = intrinsicSize; // Don't notify the delegate if the content remains invisible or its size has not changed if (bothSizesHaveAZeroDimension || sizesAreEqual) { return; } [_delegate rootViewDidChangeIntrinsicSize:self]; } - (void)contentViewInvalidated { [_contentView removeFromSuperview]; _contentView = nil; [self showLoadingView]; } - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; [_contentView invalidate]; } - (void)cancelTouches { [[_contentView touchHandler] cancel]; } @end @implementation RCTUIManager (RCTRootView) - (NSNumber *)allocateRootTag { NSNumber *rootTag = objc_getAssociatedObject(self, _cmd) ?: @1; objc_setAssociatedObject(self, _cmd, @(rootTag.integerValue + 10), OBJC_ASSOCIATION_RETAIN_NONATOMIC); return rootTag; } @end @implementation RCTRootContentView { __weak RCTBridge *_bridge; UIColor *_backgroundColor; } - (instancetype)initWithFrame:(CGRect)frame bridge:(RCTBridge *)bridge reactTag:(NSNumber *)reactTag { if ((self = [super initWithFrame:frame])) { _bridge = bridge; self.reactTag = reactTag; _touchHandler = [[RCTTouchHandler alloc] initWithBridge:_bridge]; [self addGestureRecognizer:_touchHandler]; [_bridge.uiManager registerRootView:self]; self.layer.backgroundColor = NULL; } return self; } RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame:(CGRect)frame) RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder:(nonnull NSCoder *)aDecoder) - (void)insertReactSubview:(id<RCTComponent>)subview atIndex:(NSInteger)atIndex { [super insertReactSubview:subview atIndex:atIndex]; RCTPerformanceLoggerEnd(RCTPLTTI); dispatch_async(dispatch_get_main_queue(), ^{ if (!_contentHasAppeared) { _contentHasAppeared = YES; [[NSNotificationCenter defaultCenter] postNotificationName:RCTContentDidAppearNotification object:self.superview]; } }); } - (void)setFrame:(CGRect)frame { super.frame = frame; if (self.reactTag && _bridge.isValid) { [_bridge.uiManager setFrame:frame forView:self]; } } - (void)setBackgroundColor:(UIColor *)backgroundColor { _backgroundColor = backgroundColor; if (self.reactTag && _bridge.isValid) { [_bridge.uiManager setBackgroundColor:backgroundColor forRootView:self]; } } - (UIColor *)backgroundColor { return _backgroundColor; } - (void)invalidate { if (self.userInteractionEnabled) { self.userInteractionEnabled = NO; [(RCTRootView *)self.superview contentViewInvalidated]; [_bridge enqueueJSCall:@"AppRegistry.unmountApplicationComponentAtRootTag" args:@[self.reactTag]]; } } @end
dabit3/react-native
React/Base/RCTRootView.m
Matlab
bsd-3-clause
10,911
module Spree class PaymentMethod::StoreCredit < PaymentMethod def payment_source_class ::Spree::StoreCredit end def can_capture?(payment) ['checkout', 'pending'].include?(payment.state) end def can_void?(payment) payment.pending? end def authorize(amount_in_cents, store_credit, gateway_options = {}) if store_credit.nil? ActiveMerchant::Billing::Response.new(false, Spree.t('store_credit_payment_method.unable_to_find'), {}, {}) else action = -> (store_credit) do store_credit.authorize( amount_in_cents / 100.0.to_d, gateway_options[:currency], action_originator: gateway_options[:originator] ) end handle_action_call(store_credit, action, :authorize) end end def capture(amount_in_cents, auth_code, gateway_options = {}) action = -> (store_credit) do store_credit.capture( amount_in_cents / 100.0.to_d, auth_code, gateway_options[:currency], action_originator: gateway_options[:originator] ) end handle_action(action, :capture, auth_code) end def purchase(amount_in_cents, store_credit, gateway_options = {}) eligible_events = store_credit.store_credit_events.where( amount: amount_in_cents / 100.0.to_d, action: Spree::StoreCredit::ELIGIBLE_ACTION ) event = eligible_events.detect do |eligible_event| store_credit.store_credit_events.where(authorization_code: eligible_event.authorization_code). where.not(action: Spree::StoreCredit::ELIGIBLE_ACTION).empty? end if event.blank? ActiveMerchant::Billing::Response.new(false, Spree.t('store_credit_payment_method.unable_to_find'), {}, {}) else capture(amount_in_cents, event.authorization_code, gateway_options) end end def void(auth_code, gateway_options = {}) action = -> (store_credit) do store_credit.void(auth_code, action_originator: gateway_options[:originator]) end handle_action(action, :void, auth_code) end def credit(amount_in_cents, auth_code, gateway_options) action = -> (store_credit) do currency = gateway_options[:currency] || store_credit.currency originator = gateway_options[:originator] store_credit.credit(amount_in_cents / 100.0.to_d, auth_code, currency, action_originator: originator) end handle_action(action, :credit, auth_code) end def cancel(auth_code) store_credit_event = StoreCreditEvent.find_by(authorization_code: auth_code, action: Spree::StoreCredit::CAPTURE_ACTION) store_credit = store_credit_event.try(:store_credit) if !store_credit_event || !store_credit handle_action(nil, :cancel, false) else action = -> (store_credit) do store_credit.credit(store_credit_event.amount, auth_code, store_credit.currency) end handle_action(action, :cancel, auth_code) end end def source_required? true end private def handle_action_call(store_credit, action, action_name, auth_code = nil) store_credit.with_lock do if response = action.call(store_credit) # note that we only need to return the auth code on an 'auth', but it's innocuous to always return ActiveMerchant::Billing::Response.new( true, Spree.t('store_credit_payment_method.successful_action', action: action_name), {}, authorization: auth_code || response ) else ActiveMerchant::Billing::Response.new(false, store_credit.errors.full_messages.join, {}, {}) end end end def handle_action(action, action_name, auth_code) # Find first event with provided auth_code store_credit = StoreCreditEvent.find_by_authorization_code(auth_code).try(:store_credit) if store_credit.nil? ActiveMerchant::Billing::Response.new( false, Spree.t('store_credit_payment_method.unable_to_find_for_action', auth_code: auth_code, action: action_name), {}, {} ) else handle_action_call(store_credit, action, action_name, auth_code) end end end end
berkes/spree
core/app/models/spree/payment_method/store_credit.rb
Ruby
bsd-3-clause
4,388
#main .features h2 { margin-top:0; } #main .features h3 { padding:0 3em 0 0; } html.dyn #main ul.features button { display:none; } .pageStatus { clear: both; } .features.detail-view .category > ul { border:1px solid #EAEAEA; margin-bottom:2em; } .features.summary-view .category { overflow:hidden; padding-bottom:1em; } .features.summary-view .feature { border:1px solid #EAEAEA; display:block; float:left; height:6em; margin:0 .5% 1% .5%; position:relative; width:31.95%; } .features.summary-view .feature:nth-child(3n+1), .features.summary-view .feature:nth-child(3n+2), .features.summary-view .feature:nth-child(3n) { width:32.3%; } .features.summary-view .feature:nth-child(3n+1) { margin-left:0; } .features.summary-view .feature:nth-child(3n+2) { } .features.summary-view .feature:nth-child(3n) { margin-right:0; } .features.detail-view .feature { padding:.25em 0; } .features .enabled.feature { background:#FFF; } .features.summary-view .enabled.feature, .features.summary-view .disabled.feature { border-color:#cfe493; overflow:hidden; } .features .disabled.feature { background:#f3f3f3; } .features.summary-view .disabled.feature { border-color:#eaeaea; } .features .update.feature { background:#ECC; } .features.summary-view .update.feature { border-color:#E77; } .features.detail-view .feature { border-bottom:1px solid #CCC; } .features.detail-view .last.feature { border:0; } .features .feature .summary { overflow:hidden; padding:.4em .5em; position:relative; } .features.detail-view .feature .summary { overflow:visible; } #main .features.detail-view .feature { padding-right:5.5em; } #main .features.detail-view h3 { display:inline; font-size:1.4em; padding-right:0; } #main .features.summary-view .description { display:none; } #main .features.detail-view .description { display:inline; margin:0 0 1em .5ex; } .features.detail-view .description::before { content:" - "; } .features .dependencies { font-size:.9em; margin:.44em 0 0; } .features .dependencies>* { display:inline; } .features .dependencies li { display:inline; margin-left:.5em; } .features .dependencies li::after { content:", "; } .features .dependencies li:last-child::after { content:""; } .features .missingdependencies { font-size:.9em; color:Red; margin:.44em 0 0; } .features .missingdependencies>* { display:inline; } .features .missingdependencies li { display:inline; margin-left:.5em; } .features .missingdependencies li::after { content:", "; } .features .missingdependencies li:last-child::after { content:""; } .features .feature .actions { position:absolute; right:.4em; top:.4em; } .features.detail-view .feature .actions { right:-3.5em; } .features .feature .actions form.inline.link, .features .feature .actions a { margin-left:.5em; } /***Recently installed**/ .recentlyInstalledFeature { } .recentlyInstalledModule {background:#fff url(images/new.gif) no-repeat 0px 5px;} h2.recentlyInstalledModule {padding:0 0 0 40px;} .updateAvailable {background-color: #f1f0cb;} .search-actions { float: right; height: auto; padding:0 0 0 0; } .manage { float: right; }
BankNotes/Web
src/Orchard.Azure/Orchard.Azure.Web/Modules/Orchard.Modules/styles/orchard-modules-admin.css
CSS
bsd-3-clause
3,461
import os import threading import time import warnings from django.core.signals import setting_changed from django.db import connections, router from django.db.utils import ConnectionRouter from django.dispatch import Signal, receiver from django.utils import timezone from django.utils.functional import empty template_rendered = Signal(providing_args=["template", "context"]) # Most setting_changed receivers are supposed to be added below, # except for cases where the receiver is related to a contrib app. # Settings that may not work well when using 'override_settings' (#19031) COMPLEX_OVERRIDE_SETTINGS = {'DATABASES'} @receiver(setting_changed) def clear_cache_handlers(**kwargs): if kwargs['setting'] == 'CACHES': from django.core.cache import caches caches._caches = threading.local() @receiver(setting_changed) def update_installed_apps(**kwargs): if kwargs['setting'] == 'INSTALLED_APPS': # Rebuild any AppDirectoriesFinder instance. from django.contrib.staticfiles.finders import get_finder get_finder.cache_clear() # Rebuild management commands cache from django.core.management import get_commands get_commands.cache_clear() # Rebuild get_app_template_dirs cache. from django.template.utils import get_app_template_dirs get_app_template_dirs.cache_clear() # Rebuild translations cache. from django.utils.translation import trans_real trans_real._translations = {} @receiver(setting_changed) def update_connections_time_zone(**kwargs): if kwargs['setting'] == 'TIME_ZONE': # Reset process time zone if hasattr(time, 'tzset'): if kwargs['value']: os.environ['TZ'] = kwargs['value'] else: os.environ.pop('TZ', None) time.tzset() # Reset local time zone cache timezone.get_default_timezone.cache_clear() # Reset the database connections' time zone if kwargs['setting'] in {'TIME_ZONE', 'USE_TZ'}: for conn in connections.all(): try: del conn.timezone except AttributeError: pass try: del conn.timezone_name except AttributeError: pass tz_sql = conn.ops.set_time_zone_sql() if tz_sql and conn.timezone_name: with conn.cursor() as cursor: cursor.execute(tz_sql, [conn.timezone_name]) @receiver(setting_changed) def clear_routers_cache(**kwargs): if kwargs['setting'] == 'DATABASE_ROUTERS': router.routers = ConnectionRouter().routers @receiver(setting_changed) def reset_template_engines(**kwargs): if kwargs['setting'] in { 'TEMPLATES', 'DEBUG', 'FILE_CHARSET', 'INSTALLED_APPS', }: from django.template import engines try: del engines.templates except AttributeError: pass engines._templates = None engines._engines = {} from django.template.engine import Engine Engine.get_default.cache_clear() @receiver(setting_changed) def clear_serializers_cache(**kwargs): if kwargs['setting'] == 'SERIALIZATION_MODULES': from django.core import serializers serializers._serializers = {} @receiver(setting_changed) def language_changed(**kwargs): if kwargs['setting'] in {'LANGUAGES', 'LANGUAGE_CODE', 'LOCALE_PATHS'}: from django.utils.translation import trans_real trans_real._default = None trans_real._active = threading.local() if kwargs['setting'] in {'LANGUAGES', 'LOCALE_PATHS'}: from django.utils.translation import trans_real trans_real._translations = {} trans_real.check_for_language.cache_clear() @receiver(setting_changed) def file_storage_changed(**kwargs): if kwargs['setting'] == 'DEFAULT_FILE_STORAGE': from django.core.files.storage import default_storage default_storage._wrapped = empty @receiver(setting_changed) def complex_setting_changed(**kwargs): if kwargs['enter'] and kwargs['setting'] in COMPLEX_OVERRIDE_SETTINGS: # Considering the current implementation of the signals framework, # stacklevel=5 shows the line containing the override_settings call. warnings.warn("Overriding setting %s can lead to unexpected behavior." % kwargs['setting'], stacklevel=5) @receiver(setting_changed) def root_urlconf_changed(**kwargs): if kwargs['setting'] == 'ROOT_URLCONF': from django.urls import clear_url_caches, set_urlconf clear_url_caches() set_urlconf(None) @receiver(setting_changed) def static_storage_changed(**kwargs): if kwargs['setting'] in { 'STATICFILES_STORAGE', 'STATIC_ROOT', 'STATIC_URL', }: from django.contrib.staticfiles.storage import staticfiles_storage staticfiles_storage._wrapped = empty @receiver(setting_changed) def static_finders_changed(**kwargs): if kwargs['setting'] in { 'STATICFILES_DIRS', 'STATIC_ROOT', }: from django.contrib.staticfiles.finders import get_finder get_finder.cache_clear() @receiver(setting_changed) def auth_password_validators_changed(**kwargs): if kwargs['setting'] == 'AUTH_PASSWORD_VALIDATORS': from django.contrib.auth.password_validation import get_default_password_validators get_default_password_validators.cache_clear()
indevgr/django
django/test/signals.py
Python
bsd-3-clause
5,558
/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */ package org.antlr.v4.test.runtime.java; import org.junit.Ignore; import org.junit.Test; import static org.junit.Assert.*; public class TestLexerExec extends BaseTest { /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testActionPlacement() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(323); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("I : ({System.out.println(\"stuff fail: \" + this.getText());} 'a'\n"); grammarBuilder.append("| {System.out.println(\"stuff0: \" + this.getText());}\n"); grammarBuilder.append(" 'a' {System.out.println(\"stuff1: \" + this.getText());}\n"); grammarBuilder.append(" 'b' {System.out.println(\"stuff2: \" + this.getText());})\n"); grammarBuilder.append(" {System.out.println(this.getText());} ;\n"); grammarBuilder.append("WS : (' '|'\\n') -> skip ;\n"); grammarBuilder.append("J : .;"); String grammar = grammarBuilder.toString(); String input ="ab"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "stuff0: \n" + "stuff1: a\n" + "stuff2: ab\n" + "ab\n" + "[@0,0:1='ab',<1>,1:0]\n" + "[@1,2:1='<EOF>',<-1>,1:2]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testCharSet() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(86); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("I : '0'..'9'+ {System.out.println(\"I\");} ;\n"); grammarBuilder.append("WS : [ \\n\\u000D] -> skip ;"); String grammar = grammarBuilder.toString(); String input = "34\n" + " 34"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "I\n" + "I\n" + "[@0,0:1='34',<1>,1:0]\n" + "[@1,4:5='34',<1>,2:1]\n" + "[@2,6:5='<EOF>',<-1>,2:3]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testCharSetInSet() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(93); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("I : (~[ab \\n]|'a') {System.out.println(\"I\");} ;\n"); grammarBuilder.append("WS : [ \\n\\u000D]+ -> skip ;"); String grammar = grammarBuilder.toString(); String input ="a x"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "I\n" + "I\n" + "[@0,0:0='a',<1>,1:0]\n" + "[@1,2:2='x',<1>,1:2]\n" + "[@2,3:2='<EOF>',<-1>,1:3]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testCharSetNot() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(96); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("I : ~[ab \\n] ~[ \\ncd]* {System.out.println(\"I\");} ;\n"); grammarBuilder.append("WS : [ \\n\\u000D]+ -> skip ;"); String grammar = grammarBuilder.toString(); String input ="xaf"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "I\n" + "[@0,0:2='xaf',<1>,1:0]\n" + "[@1,3:2='<EOF>',<-1>,1:3]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testCharSetPlus() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(87); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("I : '0'..'9'+ {System.out.println(\"I\");} ;\n"); grammarBuilder.append("WS : [ \\n\\u000D]+ -> skip ;"); String grammar = grammarBuilder.toString(); String input = "34\n" + " 34"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "I\n" + "I\n" + "[@0,0:1='34',<1>,1:0]\n" + "[@1,4:5='34',<1>,2:1]\n" + "[@2,6:5='<EOF>',<-1>,2:3]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testCharSetRange() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(143); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("I : [0-9]+ {System.out.println(\"I\");} ;\n"); grammarBuilder.append("ID : [a-zA-Z] [a-zA-Z0-9]* {System.out.println(\"ID\");} ;\n"); grammarBuilder.append("WS : [ \\n\\u0009\\r]+ -> skip ;"); String grammar = grammarBuilder.toString(); String input = "34\n" + " 34 a2 abc \n" + " "; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "I\n" + "I\n" + "ID\n" + "ID\n" + "[@0,0:1='34',<1>,1:0]\n" + "[@1,4:5='34',<1>,2:1]\n" + "[@2,7:8='a2',<2>,2:4]\n" + "[@3,10:12='abc',<2>,2:7]\n" + "[@4,18:17='<EOF>',<-1>,3:3]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testCharSetWithEscapedChar() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(95); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("DASHBRACK : [\\-\\]]+ {System.out.println(\"DASHBRACK\");} ;\n"); grammarBuilder.append("WS : [ \\u]+ -> skip ;"); String grammar = grammarBuilder.toString(); String input ="- ] "; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "DASHBRACK\n" + "DASHBRACK\n" + "[@0,0:0='-',<1>,1:0]\n" + "[@1,2:2=']',<1>,1:2]\n" + "[@2,4:3='<EOF>',<-1>,1:4]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testCharSetWithMissingEndRange() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(83); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("I : [0-]+ {System.out.println(\"I\");} ;\n"); grammarBuilder.append("WS : [ \\n\\u000D]+ -> skip ;"); String grammar = grammarBuilder.toString(); String input ="00\n"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "I\n" + "[@0,0:1='00',<1>,1:0]\n" + "[@1,3:2='<EOF>',<-1>,2:0]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testCharSetWithMissingEscapeChar() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(78); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("I : [0-9]+ {System.out.println(\"I\");} ;\n"); grammarBuilder.append("WS : [ \\u]+ -> skip ;"); String grammar = grammarBuilder.toString(); String input ="34 "; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "I\n" + "[@0,0:1='34',<1>,1:0]\n" + "[@1,3:2='<EOF>',<-1>,1:3]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testCharSetWithQuote1() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(81); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("A : [\"a-z]+ {System.out.println(\"A\");} ;\n"); grammarBuilder.append("WS : [ \\n\\t]+ -> skip ;"); String grammar = grammarBuilder.toString(); String input ="b\"a"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "A\n" + "[@0,0:2='b\"a',<1>,1:0]\n" + "[@1,3:2='<EOF>',<-1>,1:3]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testCharSetWithQuote2() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(82); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("A : [\"\\\\ab]+ {System.out.println(\"A\");} ;\n"); grammarBuilder.append("WS : [ \\n\\t]+ -> skip ;"); String grammar = grammarBuilder.toString(); String input ="b\"\\a"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "A\n" + "[@0,0:3='b\"\\a',<1>,1:0]\n" + "[@1,4:3='<EOF>',<-1>,1:4]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testCharSetWithReversedRange() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(79); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("A : [z-a9]+ {System.out.println(\"A\");} ;\n"); grammarBuilder.append("WS : [ \\u]+ -> skip ;"); String grammar = grammarBuilder.toString(); String input ="9"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "A\n" + "[@0,0:0='9',<1>,1:0]\n" + "[@1,1:0='<EOF>',<-1>,1:1]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testEOFByItself() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(38); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("DONE : EOF ;\n"); grammarBuilder.append("A : 'a';"); String grammar = grammarBuilder.toString(); String input =""; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "[@0,0:-1='<EOF>',<1>,1:0]\n" + "[@1,0:-1='<EOF>',<-1>,1:0]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testEOFSuffixInFirstRule_1() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(48); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("A : 'a' EOF ;\n"); grammarBuilder.append("B : 'a';\n"); grammarBuilder.append("C : 'c';"); String grammar = grammarBuilder.toString(); String input =""; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals("[@0,0:-1='<EOF>',<-1>,1:0]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testEOFSuffixInFirstRule_2() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(48); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("A : 'a' EOF ;\n"); grammarBuilder.append("B : 'a';\n"); grammarBuilder.append("C : 'c';"); String grammar = grammarBuilder.toString(); String input ="a"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "[@0,0:0='a',<1>,1:0]\n" + "[@1,1:0='<EOF>',<-1>,1:1]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testGreedyClosure() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(60); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("CMT : '//' .*? '\\n' CMT*;\n"); grammarBuilder.append("WS : (' '|'\\t')+;"); String grammar = grammarBuilder.toString(); String input = "//blah\n" + "//blah\n"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "[@0,0:13='//blah\\n//blah\\n',<1>,1:0]\n" + "[@1,14:13='<EOF>',<-1>,3:0]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testGreedyConfigs() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(106); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("I : ('a' | 'ab') {System.out.println(this.getText());} ;\n"); grammarBuilder.append("WS : (' '|'\\n') -> skip ;\n"); grammarBuilder.append("J : .;"); String grammar = grammarBuilder.toString(); String input ="ab"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "ab\n" + "[@0,0:1='ab',<1>,1:0]\n" + "[@1,2:1='<EOF>',<-1>,1:2]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testGreedyOptional() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(60); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("CMT : '//' .*? '\\n' CMT?;\n"); grammarBuilder.append("WS : (' '|'\\t')+;"); String grammar = grammarBuilder.toString(); String input = "//blah\n" + "//blah\n"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "[@0,0:13='//blah\\n//blah\\n',<1>,1:0]\n" + "[@1,14:13='<EOF>',<-1>,3:0]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testGreedyPositiveClosure() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(58); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("CMT : ('//' .*? '\\n')+;\n"); grammarBuilder.append("WS : (' '|'\\t')+;"); String grammar = grammarBuilder.toString(); String input = "//blah\n" + "//blah\n"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "[@0,0:13='//blah\\n//blah\\n',<1>,1:0]\n" + "[@1,14:13='<EOF>',<-1>,3:0]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testHexVsID() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(265); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("HexLiteral : '0' ('x'|'X') HexDigit+ ;\n"); grammarBuilder.append("DecimalLiteral : ('0' | '1'..'9' '0'..'9'*) ;\n"); grammarBuilder.append("FloatingPointLiteral : ('0x' | '0X') HexDigit* ('.' HexDigit*)? ;\n"); grammarBuilder.append("DOT : '.' ;\n"); grammarBuilder.append("ID : 'a'..'z'+ ;\n"); grammarBuilder.append("fragment HexDigit : ('0'..'9'|'a'..'f'|'A'..'F') ;\n"); grammarBuilder.append("WS : (' '|'\\n')+;"); String grammar = grammarBuilder.toString(); String input ="x 0 1 a.b a.l"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "[@0,0:0='x',<5>,1:0]\n" + "[@1,1:1=' ',<6>,1:1]\n" + "[@2,2:2='0',<2>,1:2]\n" + "[@3,3:3=' ',<6>,1:3]\n" + "[@4,4:4='1',<2>,1:4]\n" + "[@5,5:5=' ',<6>,1:5]\n" + "[@6,6:6='a',<5>,1:6]\n" + "[@7,7:7='.',<4>,1:7]\n" + "[@8,8:8='b',<5>,1:8]\n" + "[@9,9:9=' ',<6>,1:9]\n" + "[@10,10:10='a',<5>,1:10]\n" + "[@11,11:11='.',<4>,1:11]\n" + "[@12,12:12='l',<5>,1:12]\n" + "[@13,13:12='<EOF>',<-1>,1:13]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testKeywordID() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(82); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("KEND : 'end' ; // has priority\n"); grammarBuilder.append("ID : 'a'..'z'+ ;\n"); grammarBuilder.append("WS : (' '|'\\n')+;"); String grammar = grammarBuilder.toString(); String input ="end eend ending a"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "[@0,0:2='end',<1>,1:0]\n" + "[@1,3:3=' ',<3>,1:3]\n" + "[@2,4:7='eend',<2>,1:4]\n" + "[@3,8:8=' ',<3>,1:8]\n" + "[@4,9:14='ending',<2>,1:9]\n" + "[@5,15:15=' ',<3>,1:15]\n" + "[@6,16:16='a',<2>,1:16]\n" + "[@7,17:16='<EOF>',<-1>,1:17]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testLargeLexer() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(85821); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("WS : [ \\t\\r\\n]+ -> skip;\n"); grammarBuilder.append("KW0 : 'KW' '0';\n"); grammarBuilder.append("KW1 : 'KW' '1';\n"); grammarBuilder.append("KW2 : 'KW' '2';\n"); grammarBuilder.append("KW3 : 'KW' '3';\n"); grammarBuilder.append("KW4 : 'KW' '4';\n"); grammarBuilder.append("KW5 : 'KW' '5';\n"); grammarBuilder.append("KW6 : 'KW' '6';\n"); grammarBuilder.append("KW7 : 'KW' '7';\n"); grammarBuilder.append("KW8 : 'KW' '8';\n"); grammarBuilder.append("KW9 : 'KW' '9';\n"); grammarBuilder.append("KW10 : 'KW' '10';\n"); grammarBuilder.append("KW11 : 'KW' '11';\n"); grammarBuilder.append("KW12 : 'KW' '12';\n"); grammarBuilder.append("KW13 : 'KW' '13';\n"); grammarBuilder.append("KW14 : 'KW' '14';\n"); grammarBuilder.append("KW15 : 'KW' '15';\n"); grammarBuilder.append("KW16 : 'KW' '16';\n"); grammarBuilder.append("KW17 : 'KW' '17';\n"); grammarBuilder.append("KW18 : 'KW' '18';\n"); grammarBuilder.append("KW19 : 'KW' '19';\n"); grammarBuilder.append("KW20 : 'KW' '20';\n"); grammarBuilder.append("KW21 : 'KW' '21';\n"); grammarBuilder.append("KW22 : 'KW' '22';\n"); grammarBuilder.append("KW23 : 'KW' '23';\n"); grammarBuilder.append("KW24 : 'KW' '24';\n"); grammarBuilder.append("KW25 : 'KW' '25';\n"); grammarBuilder.append("KW26 : 'KW' '26';\n"); grammarBuilder.append("KW27 : 'KW' '27';\n"); grammarBuilder.append("KW28 : 'KW' '28';\n"); grammarBuilder.append("KW29 : 'KW' '29';\n"); grammarBuilder.append("KW30 : 'KW' '30';\n"); grammarBuilder.append("KW31 : 'KW' '31';\n"); grammarBuilder.append("KW32 : 'KW' '32';\n"); grammarBuilder.append("KW33 : 'KW' '33';\n"); grammarBuilder.append("KW34 : 'KW' '34';\n"); grammarBuilder.append("KW35 : 'KW' '35';\n"); grammarBuilder.append("KW36 : 'KW' '36';\n"); grammarBuilder.append("KW37 : 'KW' '37';\n"); grammarBuilder.append("KW38 : 'KW' '38';\n"); grammarBuilder.append("KW39 : 'KW' '39';\n"); grammarBuilder.append("KW40 : 'KW' '40';\n"); grammarBuilder.append("KW41 : 'KW' '41';\n"); grammarBuilder.append("KW42 : 'KW' '42';\n"); grammarBuilder.append("KW43 : 'KW' '43';\n"); grammarBuilder.append("KW44 : 'KW' '44';\n"); grammarBuilder.append("KW45 : 'KW' '45';\n"); grammarBuilder.append("KW46 : 'KW' '46';\n"); grammarBuilder.append("KW47 : 'KW' '47';\n"); grammarBuilder.append("KW48 : 'KW' '48';\n"); grammarBuilder.append("KW49 : 'KW' '49';\n"); grammarBuilder.append("KW50 : 'KW' '50';\n"); grammarBuilder.append("KW51 : 'KW' '51';\n"); grammarBuilder.append("KW52 : 'KW' '52';\n"); grammarBuilder.append("KW53 : 'KW' '53';\n"); grammarBuilder.append("KW54 : 'KW' '54';\n"); grammarBuilder.append("KW55 : 'KW' '55';\n"); grammarBuilder.append("KW56 : 'KW' '56';\n"); grammarBuilder.append("KW57 : 'KW' '57';\n"); grammarBuilder.append("KW58 : 'KW' '58';\n"); grammarBuilder.append("KW59 : 'KW' '59';\n"); grammarBuilder.append("KW60 : 'KW' '60';\n"); grammarBuilder.append("KW61 : 'KW' '61';\n"); grammarBuilder.append("KW62 : 'KW' '62';\n"); grammarBuilder.append("KW63 : 'KW' '63';\n"); grammarBuilder.append("KW64 : 'KW' '64';\n"); grammarBuilder.append("KW65 : 'KW' '65';\n"); grammarBuilder.append("KW66 : 'KW' '66';\n"); grammarBuilder.append("KW67 : 'KW' '67';\n"); grammarBuilder.append("KW68 : 'KW' '68';\n"); grammarBuilder.append("KW69 : 'KW' '69';\n"); grammarBuilder.append("KW70 : 'KW' '70';\n"); grammarBuilder.append("KW71 : 'KW' '71';\n"); grammarBuilder.append("KW72 : 'KW' '72';\n"); grammarBuilder.append("KW73 : 'KW' '73';\n"); grammarBuilder.append("KW74 : 'KW' '74';\n"); grammarBuilder.append("KW75 : 'KW' '75';\n"); grammarBuilder.append("KW76 : 'KW' '76';\n"); grammarBuilder.append("KW77 : 'KW' '77';\n"); grammarBuilder.append("KW78 : 'KW' '78';\n"); grammarBuilder.append("KW79 : 'KW' '79';\n"); grammarBuilder.append("KW80 : 'KW' '80';\n"); grammarBuilder.append("KW81 : 'KW' '81';\n"); grammarBuilder.append("KW82 : 'KW' '82';\n"); grammarBuilder.append("KW83 : 'KW' '83';\n"); grammarBuilder.append("KW84 : 'KW' '84';\n"); grammarBuilder.append("KW85 : 'KW' '85';\n"); grammarBuilder.append("KW86 : 'KW' '86';\n"); grammarBuilder.append("KW87 : 'KW' '87';\n"); grammarBuilder.append("KW88 : 'KW' '88';\n"); grammarBuilder.append("KW89 : 'KW' '89';\n"); grammarBuilder.append("KW90 : 'KW' '90';\n"); grammarBuilder.append("KW91 : 'KW' '91';\n"); grammarBuilder.append("KW92 : 'KW' '92';\n"); grammarBuilder.append("KW93 : 'KW' '93';\n"); grammarBuilder.append("KW94 : 'KW' '94';\n"); grammarBuilder.append("KW95 : 'KW' '95';\n"); grammarBuilder.append("KW96 : 'KW' '96';\n"); grammarBuilder.append("KW97 : 'KW' '97';\n"); grammarBuilder.append("KW98 : 'KW' '98';\n"); grammarBuilder.append("KW99 : 'KW' '99';\n"); grammarBuilder.append("KW100 : 'KW' '100';\n"); grammarBuilder.append("KW101 : 'KW' '101';\n"); grammarBuilder.append("KW102 : 'KW' '102';\n"); grammarBuilder.append("KW103 : 'KW' '103';\n"); grammarBuilder.append("KW104 : 'KW' '104';\n"); grammarBuilder.append("KW105 : 'KW' '105';\n"); grammarBuilder.append("KW106 : 'KW' '106';\n"); grammarBuilder.append("KW107 : 'KW' '107';\n"); grammarBuilder.append("KW108 : 'KW' '108';\n"); grammarBuilder.append("KW109 : 'KW' '109';\n"); grammarBuilder.append("KW110 : 'KW' '110';\n"); grammarBuilder.append("KW111 : 'KW' '111';\n"); grammarBuilder.append("KW112 : 'KW' '112';\n"); grammarBuilder.append("KW113 : 'KW' '113';\n"); grammarBuilder.append("KW114 : 'KW' '114';\n"); grammarBuilder.append("KW115 : 'KW' '115';\n"); grammarBuilder.append("KW116 : 'KW' '116';\n"); grammarBuilder.append("KW117 : 'KW' '117';\n"); grammarBuilder.append("KW118 : 'KW' '118';\n"); grammarBuilder.append("KW119 : 'KW' '119';\n"); grammarBuilder.append("KW120 : 'KW' '120';\n"); grammarBuilder.append("KW121 : 'KW' '121';\n"); grammarBuilder.append("KW122 : 'KW' '122';\n"); grammarBuilder.append("KW123 : 'KW' '123';\n"); grammarBuilder.append("KW124 : 'KW' '124';\n"); grammarBuilder.append("KW125 : 'KW' '125';\n"); grammarBuilder.append("KW126 : 'KW' '126';\n"); grammarBuilder.append("KW127 : 'KW' '127';\n"); grammarBuilder.append("KW128 : 'KW' '128';\n"); grammarBuilder.append("KW129 : 'KW' '129';\n"); grammarBuilder.append("KW130 : 'KW' '130';\n"); grammarBuilder.append("KW131 : 'KW' '131';\n"); grammarBuilder.append("KW132 : 'KW' '132';\n"); grammarBuilder.append("KW133 : 'KW' '133';\n"); grammarBuilder.append("KW134 : 'KW' '134';\n"); grammarBuilder.append("KW135 : 'KW' '135';\n"); grammarBuilder.append("KW136 : 'KW' '136';\n"); grammarBuilder.append("KW137 : 'KW' '137';\n"); grammarBuilder.append("KW138 : 'KW' '138';\n"); grammarBuilder.append("KW139 : 'KW' '139';\n"); grammarBuilder.append("KW140 : 'KW' '140';\n"); grammarBuilder.append("KW141 : 'KW' '141';\n"); grammarBuilder.append("KW142 : 'KW' '142';\n"); grammarBuilder.append("KW143 : 'KW' '143';\n"); grammarBuilder.append("KW144 : 'KW' '144';\n"); grammarBuilder.append("KW145 : 'KW' '145';\n"); grammarBuilder.append("KW146 : 'KW' '146';\n"); grammarBuilder.append("KW147 : 'KW' '147';\n"); grammarBuilder.append("KW148 : 'KW' '148';\n"); grammarBuilder.append("KW149 : 'KW' '149';\n"); grammarBuilder.append("KW150 : 'KW' '150';\n"); grammarBuilder.append("KW151 : 'KW' '151';\n"); grammarBuilder.append("KW152 : 'KW' '152';\n"); grammarBuilder.append("KW153 : 'KW' '153';\n"); grammarBuilder.append("KW154 : 'KW' '154';\n"); grammarBuilder.append("KW155 : 'KW' '155';\n"); grammarBuilder.append("KW156 : 'KW' '156';\n"); grammarBuilder.append("KW157 : 'KW' '157';\n"); grammarBuilder.append("KW158 : 'KW' '158';\n"); grammarBuilder.append("KW159 : 'KW' '159';\n"); grammarBuilder.append("KW160 : 'KW' '160';\n"); grammarBuilder.append("KW161 : 'KW' '161';\n"); grammarBuilder.append("KW162 : 'KW' '162';\n"); grammarBuilder.append("KW163 : 'KW' '163';\n"); grammarBuilder.append("KW164 : 'KW' '164';\n"); grammarBuilder.append("KW165 : 'KW' '165';\n"); grammarBuilder.append("KW166 : 'KW' '166';\n"); grammarBuilder.append("KW167 : 'KW' '167';\n"); grammarBuilder.append("KW168 : 'KW' '168';\n"); grammarBuilder.append("KW169 : 'KW' '169';\n"); grammarBuilder.append("KW170 : 'KW' '170';\n"); grammarBuilder.append("KW171 : 'KW' '171';\n"); grammarBuilder.append("KW172 : 'KW' '172';\n"); grammarBuilder.append("KW173 : 'KW' '173';\n"); grammarBuilder.append("KW174 : 'KW' '174';\n"); grammarBuilder.append("KW175 : 'KW' '175';\n"); grammarBuilder.append("KW176 : 'KW' '176';\n"); grammarBuilder.append("KW177 : 'KW' '177';\n"); grammarBuilder.append("KW178 : 'KW' '178';\n"); grammarBuilder.append("KW179 : 'KW' '179';\n"); grammarBuilder.append("KW180 : 'KW' '180';\n"); grammarBuilder.append("KW181 : 'KW' '181';\n"); grammarBuilder.append("KW182 : 'KW' '182';\n"); grammarBuilder.append("KW183 : 'KW' '183';\n"); grammarBuilder.append("KW184 : 'KW' '184';\n"); grammarBuilder.append("KW185 : 'KW' '185';\n"); grammarBuilder.append("KW186 : 'KW' '186';\n"); grammarBuilder.append("KW187 : 'KW' '187';\n"); grammarBuilder.append("KW188 : 'KW' '188';\n"); grammarBuilder.append("KW189 : 'KW' '189';\n"); grammarBuilder.append("KW190 : 'KW' '190';\n"); grammarBuilder.append("KW191 : 'KW' '191';\n"); grammarBuilder.append("KW192 : 'KW' '192';\n"); grammarBuilder.append("KW193 : 'KW' '193';\n"); grammarBuilder.append("KW194 : 'KW' '194';\n"); grammarBuilder.append("KW195 : 'KW' '195';\n"); grammarBuilder.append("KW196 : 'KW' '196';\n"); grammarBuilder.append("KW197 : 'KW' '197';\n"); grammarBuilder.append("KW198 : 'KW' '198';\n"); grammarBuilder.append("KW199 : 'KW' '199';\n"); grammarBuilder.append("KW200 : 'KW' '200';\n"); grammarBuilder.append("KW201 : 'KW' '201';\n"); grammarBuilder.append("KW202 : 'KW' '202';\n"); grammarBuilder.append("KW203 : 'KW' '203';\n"); grammarBuilder.append("KW204 : 'KW' '204';\n"); grammarBuilder.append("KW205 : 'KW' '205';\n"); grammarBuilder.append("KW206 : 'KW' '206';\n"); grammarBuilder.append("KW207 : 'KW' '207';\n"); grammarBuilder.append("KW208 : 'KW' '208';\n"); grammarBuilder.append("KW209 : 'KW' '209';\n"); grammarBuilder.append("KW210 : 'KW' '210';\n"); grammarBuilder.append("KW211 : 'KW' '211';\n"); grammarBuilder.append("KW212 : 'KW' '212';\n"); grammarBuilder.append("KW213 : 'KW' '213';\n"); grammarBuilder.append("KW214 : 'KW' '214';\n"); grammarBuilder.append("KW215 : 'KW' '215';\n"); grammarBuilder.append("KW216 : 'KW' '216';\n"); grammarBuilder.append("KW217 : 'KW' '217';\n"); grammarBuilder.append("KW218 : 'KW' '218';\n"); grammarBuilder.append("KW219 : 'KW' '219';\n"); grammarBuilder.append("KW220 : 'KW' '220';\n"); grammarBuilder.append("KW221 : 'KW' '221';\n"); grammarBuilder.append("KW222 : 'KW' '222';\n"); grammarBuilder.append("KW223 : 'KW' '223';\n"); grammarBuilder.append("KW224 : 'KW' '224';\n"); grammarBuilder.append("KW225 : 'KW' '225';\n"); grammarBuilder.append("KW226 : 'KW' '226';\n"); grammarBuilder.append("KW227 : 'KW' '227';\n"); grammarBuilder.append("KW228 : 'KW' '228';\n"); grammarBuilder.append("KW229 : 'KW' '229';\n"); grammarBuilder.append("KW230 : 'KW' '230';\n"); grammarBuilder.append("KW231 : 'KW' '231';\n"); grammarBuilder.append("KW232 : 'KW' '232';\n"); grammarBuilder.append("KW233 : 'KW' '233';\n"); grammarBuilder.append("KW234 : 'KW' '234';\n"); grammarBuilder.append("KW235 : 'KW' '235';\n"); grammarBuilder.append("KW236 : 'KW' '236';\n"); grammarBuilder.append("KW237 : 'KW' '237';\n"); grammarBuilder.append("KW238 : 'KW' '238';\n"); grammarBuilder.append("KW239 : 'KW' '239';\n"); grammarBuilder.append("KW240 : 'KW' '240';\n"); grammarBuilder.append("KW241 : 'KW' '241';\n"); grammarBuilder.append("KW242 : 'KW' '242';\n"); grammarBuilder.append("KW243 : 'KW' '243';\n"); grammarBuilder.append("KW244 : 'KW' '244';\n"); grammarBuilder.append("KW245 : 'KW' '245';\n"); grammarBuilder.append("KW246 : 'KW' '246';\n"); grammarBuilder.append("KW247 : 'KW' '247';\n"); grammarBuilder.append("KW248 : 'KW' '248';\n"); grammarBuilder.append("KW249 : 'KW' '249';\n"); grammarBuilder.append("KW250 : 'KW' '250';\n"); grammarBuilder.append("KW251 : 'KW' '251';\n"); grammarBuilder.append("KW252 : 'KW' '252';\n"); grammarBuilder.append("KW253 : 'KW' '253';\n"); grammarBuilder.append("KW254 : 'KW' '254';\n"); grammarBuilder.append("KW255 : 'KW' '255';\n"); grammarBuilder.append("KW256 : 'KW' '256';\n"); grammarBuilder.append("KW257 : 'KW' '257';\n"); grammarBuilder.append("KW258 : 'KW' '258';\n"); grammarBuilder.append("KW259 : 'KW' '259';\n"); grammarBuilder.append("KW260 : 'KW' '260';\n"); grammarBuilder.append("KW261 : 'KW' '261';\n"); grammarBuilder.append("KW262 : 'KW' '262';\n"); grammarBuilder.append("KW263 : 'KW' '263';\n"); grammarBuilder.append("KW264 : 'KW' '264';\n"); grammarBuilder.append("KW265 : 'KW' '265';\n"); grammarBuilder.append("KW266 : 'KW' '266';\n"); grammarBuilder.append("KW267 : 'KW' '267';\n"); grammarBuilder.append("KW268 : 'KW' '268';\n"); grammarBuilder.append("KW269 : 'KW' '269';\n"); grammarBuilder.append("KW270 : 'KW' '270';\n"); grammarBuilder.append("KW271 : 'KW' '271';\n"); grammarBuilder.append("KW272 : 'KW' '272';\n"); grammarBuilder.append("KW273 : 'KW' '273';\n"); grammarBuilder.append("KW274 : 'KW' '274';\n"); grammarBuilder.append("KW275 : 'KW' '275';\n"); grammarBuilder.append("KW276 : 'KW' '276';\n"); grammarBuilder.append("KW277 : 'KW' '277';\n"); grammarBuilder.append("KW278 : 'KW' '278';\n"); grammarBuilder.append("KW279 : 'KW' '279';\n"); grammarBuilder.append("KW280 : 'KW' '280';\n"); grammarBuilder.append("KW281 : 'KW' '281';\n"); grammarBuilder.append("KW282 : 'KW' '282';\n"); grammarBuilder.append("KW283 : 'KW' '283';\n"); grammarBuilder.append("KW284 : 'KW' '284';\n"); grammarBuilder.append("KW285 : 'KW' '285';\n"); grammarBuilder.append("KW286 : 'KW' '286';\n"); grammarBuilder.append("KW287 : 'KW' '287';\n"); grammarBuilder.append("KW288 : 'KW' '288';\n"); grammarBuilder.append("KW289 : 'KW' '289';\n"); grammarBuilder.append("KW290 : 'KW' '290';\n"); grammarBuilder.append("KW291 : 'KW' '291';\n"); grammarBuilder.append("KW292 : 'KW' '292';\n"); grammarBuilder.append("KW293 : 'KW' '293';\n"); grammarBuilder.append("KW294 : 'KW' '294';\n"); grammarBuilder.append("KW295 : 'KW' '295';\n"); grammarBuilder.append("KW296 : 'KW' '296';\n"); grammarBuilder.append("KW297 : 'KW' '297';\n"); grammarBuilder.append("KW298 : 'KW' '298';\n"); grammarBuilder.append("KW299 : 'KW' '299';\n"); grammarBuilder.append("KW300 : 'KW' '300';\n"); grammarBuilder.append("KW301 : 'KW' '301';\n"); grammarBuilder.append("KW302 : 'KW' '302';\n"); grammarBuilder.append("KW303 : 'KW' '303';\n"); grammarBuilder.append("KW304 : 'KW' '304';\n"); grammarBuilder.append("KW305 : 'KW' '305';\n"); grammarBuilder.append("KW306 : 'KW' '306';\n"); grammarBuilder.append("KW307 : 'KW' '307';\n"); grammarBuilder.append("KW308 : 'KW' '308';\n"); grammarBuilder.append("KW309 : 'KW' '309';\n"); grammarBuilder.append("KW310 : 'KW' '310';\n"); grammarBuilder.append("KW311 : 'KW' '311';\n"); grammarBuilder.append("KW312 : 'KW' '312';\n"); grammarBuilder.append("KW313 : 'KW' '313';\n"); grammarBuilder.append("KW314 : 'KW' '314';\n"); grammarBuilder.append("KW315 : 'KW' '315';\n"); grammarBuilder.append("KW316 : 'KW' '316';\n"); grammarBuilder.append("KW317 : 'KW' '317';\n"); grammarBuilder.append("KW318 : 'KW' '318';\n"); grammarBuilder.append("KW319 : 'KW' '319';\n"); grammarBuilder.append("KW320 : 'KW' '320';\n"); grammarBuilder.append("KW321 : 'KW' '321';\n"); grammarBuilder.append("KW322 : 'KW' '322';\n"); grammarBuilder.append("KW323 : 'KW' '323';\n"); grammarBuilder.append("KW324 : 'KW' '324';\n"); grammarBuilder.append("KW325 : 'KW' '325';\n"); grammarBuilder.append("KW326 : 'KW' '326';\n"); grammarBuilder.append("KW327 : 'KW' '327';\n"); grammarBuilder.append("KW328 : 'KW' '328';\n"); grammarBuilder.append("KW329 : 'KW' '329';\n"); grammarBuilder.append("KW330 : 'KW' '330';\n"); grammarBuilder.append("KW331 : 'KW' '331';\n"); grammarBuilder.append("KW332 : 'KW' '332';\n"); grammarBuilder.append("KW333 : 'KW' '333';\n"); grammarBuilder.append("KW334 : 'KW' '334';\n"); grammarBuilder.append("KW335 : 'KW' '335';\n"); grammarBuilder.append("KW336 : 'KW' '336';\n"); grammarBuilder.append("KW337 : 'KW' '337';\n"); grammarBuilder.append("KW338 : 'KW' '338';\n"); grammarBuilder.append("KW339 : 'KW' '339';\n"); grammarBuilder.append("KW340 : 'KW' '340';\n"); grammarBuilder.append("KW341 : 'KW' '341';\n"); grammarBuilder.append("KW342 : 'KW' '342';\n"); grammarBuilder.append("KW343 : 'KW' '343';\n"); grammarBuilder.append("KW344 : 'KW' '344';\n"); grammarBuilder.append("KW345 : 'KW' '345';\n"); grammarBuilder.append("KW346 : 'KW' '346';\n"); grammarBuilder.append("KW347 : 'KW' '347';\n"); grammarBuilder.append("KW348 : 'KW' '348';\n"); grammarBuilder.append("KW349 : 'KW' '349';\n"); grammarBuilder.append("KW350 : 'KW' '350';\n"); grammarBuilder.append("KW351 : 'KW' '351';\n"); grammarBuilder.append("KW352 : 'KW' '352';\n"); grammarBuilder.append("KW353 : 'KW' '353';\n"); grammarBuilder.append("KW354 : 'KW' '354';\n"); grammarBuilder.append("KW355 : 'KW' '355';\n"); grammarBuilder.append("KW356 : 'KW' '356';\n"); grammarBuilder.append("KW357 : 'KW' '357';\n"); grammarBuilder.append("KW358 : 'KW' '358';\n"); grammarBuilder.append("KW359 : 'KW' '359';\n"); grammarBuilder.append("KW360 : 'KW' '360';\n"); grammarBuilder.append("KW361 : 'KW' '361';\n"); grammarBuilder.append("KW362 : 'KW' '362';\n"); grammarBuilder.append("KW363 : 'KW' '363';\n"); grammarBuilder.append("KW364 : 'KW' '364';\n"); grammarBuilder.append("KW365 : 'KW' '365';\n"); grammarBuilder.append("KW366 : 'KW' '366';\n"); grammarBuilder.append("KW367 : 'KW' '367';\n"); grammarBuilder.append("KW368 : 'KW' '368';\n"); grammarBuilder.append("KW369 : 'KW' '369';\n"); grammarBuilder.append("KW370 : 'KW' '370';\n"); grammarBuilder.append("KW371 : 'KW' '371';\n"); grammarBuilder.append("KW372 : 'KW' '372';\n"); grammarBuilder.append("KW373 : 'KW' '373';\n"); grammarBuilder.append("KW374 : 'KW' '374';\n"); grammarBuilder.append("KW375 : 'KW' '375';\n"); grammarBuilder.append("KW376 : 'KW' '376';\n"); grammarBuilder.append("KW377 : 'KW' '377';\n"); grammarBuilder.append("KW378 : 'KW' '378';\n"); grammarBuilder.append("KW379 : 'KW' '379';\n"); grammarBuilder.append("KW380 : 'KW' '380';\n"); grammarBuilder.append("KW381 : 'KW' '381';\n"); grammarBuilder.append("KW382 : 'KW' '382';\n"); grammarBuilder.append("KW383 : 'KW' '383';\n"); grammarBuilder.append("KW384 : 'KW' '384';\n"); grammarBuilder.append("KW385 : 'KW' '385';\n"); grammarBuilder.append("KW386 : 'KW' '386';\n"); grammarBuilder.append("KW387 : 'KW' '387';\n"); grammarBuilder.append("KW388 : 'KW' '388';\n"); grammarBuilder.append("KW389 : 'KW' '389';\n"); grammarBuilder.append("KW390 : 'KW' '390';\n"); grammarBuilder.append("KW391 : 'KW' '391';\n"); grammarBuilder.append("KW392 : 'KW' '392';\n"); grammarBuilder.append("KW393 : 'KW' '393';\n"); grammarBuilder.append("KW394 : 'KW' '394';\n"); grammarBuilder.append("KW395 : 'KW' '395';\n"); grammarBuilder.append("KW396 : 'KW' '396';\n"); grammarBuilder.append("KW397 : 'KW' '397';\n"); grammarBuilder.append("KW398 : 'KW' '398';\n"); grammarBuilder.append("KW399 : 'KW' '399';\n"); grammarBuilder.append("KW400 : 'KW' '400';\n"); grammarBuilder.append("KW401 : 'KW' '401';\n"); grammarBuilder.append("KW402 : 'KW' '402';\n"); grammarBuilder.append("KW403 : 'KW' '403';\n"); grammarBuilder.append("KW404 : 'KW' '404';\n"); grammarBuilder.append("KW405 : 'KW' '405';\n"); grammarBuilder.append("KW406 : 'KW' '406';\n"); grammarBuilder.append("KW407 : 'KW' '407';\n"); grammarBuilder.append("KW408 : 'KW' '408';\n"); grammarBuilder.append("KW409 : 'KW' '409';\n"); grammarBuilder.append("KW410 : 'KW' '410';\n"); grammarBuilder.append("KW411 : 'KW' '411';\n"); grammarBuilder.append("KW412 : 'KW' '412';\n"); grammarBuilder.append("KW413 : 'KW' '413';\n"); grammarBuilder.append("KW414 : 'KW' '414';\n"); grammarBuilder.append("KW415 : 'KW' '415';\n"); grammarBuilder.append("KW416 : 'KW' '416';\n"); grammarBuilder.append("KW417 : 'KW' '417';\n"); grammarBuilder.append("KW418 : 'KW' '418';\n"); grammarBuilder.append("KW419 : 'KW' '419';\n"); grammarBuilder.append("KW420 : 'KW' '420';\n"); grammarBuilder.append("KW421 : 'KW' '421';\n"); grammarBuilder.append("KW422 : 'KW' '422';\n"); grammarBuilder.append("KW423 : 'KW' '423';\n"); grammarBuilder.append("KW424 : 'KW' '424';\n"); grammarBuilder.append("KW425 : 'KW' '425';\n"); grammarBuilder.append("KW426 : 'KW' '426';\n"); grammarBuilder.append("KW427 : 'KW' '427';\n"); grammarBuilder.append("KW428 : 'KW' '428';\n"); grammarBuilder.append("KW429 : 'KW' '429';\n"); grammarBuilder.append("KW430 : 'KW' '430';\n"); grammarBuilder.append("KW431 : 'KW' '431';\n"); grammarBuilder.append("KW432 : 'KW' '432';\n"); grammarBuilder.append("KW433 : 'KW' '433';\n"); grammarBuilder.append("KW434 : 'KW' '434';\n"); grammarBuilder.append("KW435 : 'KW' '435';\n"); grammarBuilder.append("KW436 : 'KW' '436';\n"); grammarBuilder.append("KW437 : 'KW' '437';\n"); grammarBuilder.append("KW438 : 'KW' '438';\n"); grammarBuilder.append("KW439 : 'KW' '439';\n"); grammarBuilder.append("KW440 : 'KW' '440';\n"); grammarBuilder.append("KW441 : 'KW' '441';\n"); grammarBuilder.append("KW442 : 'KW' '442';\n"); grammarBuilder.append("KW443 : 'KW' '443';\n"); grammarBuilder.append("KW444 : 'KW' '444';\n"); grammarBuilder.append("KW445 : 'KW' '445';\n"); grammarBuilder.append("KW446 : 'KW' '446';\n"); grammarBuilder.append("KW447 : 'KW' '447';\n"); grammarBuilder.append("KW448 : 'KW' '448';\n"); grammarBuilder.append("KW449 : 'KW' '449';\n"); grammarBuilder.append("KW450 : 'KW' '450';\n"); grammarBuilder.append("KW451 : 'KW' '451';\n"); grammarBuilder.append("KW452 : 'KW' '452';\n"); grammarBuilder.append("KW453 : 'KW' '453';\n"); grammarBuilder.append("KW454 : 'KW' '454';\n"); grammarBuilder.append("KW455 : 'KW' '455';\n"); grammarBuilder.append("KW456 : 'KW' '456';\n"); grammarBuilder.append("KW457 : 'KW' '457';\n"); grammarBuilder.append("KW458 : 'KW' '458';\n"); grammarBuilder.append("KW459 : 'KW' '459';\n"); grammarBuilder.append("KW460 : 'KW' '460';\n"); grammarBuilder.append("KW461 : 'KW' '461';\n"); grammarBuilder.append("KW462 : 'KW' '462';\n"); grammarBuilder.append("KW463 : 'KW' '463';\n"); grammarBuilder.append("KW464 : 'KW' '464';\n"); grammarBuilder.append("KW465 : 'KW' '465';\n"); grammarBuilder.append("KW466 : 'KW' '466';\n"); grammarBuilder.append("KW467 : 'KW' '467';\n"); grammarBuilder.append("KW468 : 'KW' '468';\n"); grammarBuilder.append("KW469 : 'KW' '469';\n"); grammarBuilder.append("KW470 : 'KW' '470';\n"); grammarBuilder.append("KW471 : 'KW' '471';\n"); grammarBuilder.append("KW472 : 'KW' '472';\n"); grammarBuilder.append("KW473 : 'KW' '473';\n"); grammarBuilder.append("KW474 : 'KW' '474';\n"); grammarBuilder.append("KW475 : 'KW' '475';\n"); grammarBuilder.append("KW476 : 'KW' '476';\n"); grammarBuilder.append("KW477 : 'KW' '477';\n"); grammarBuilder.append("KW478 : 'KW' '478';\n"); grammarBuilder.append("KW479 : 'KW' '479';\n"); grammarBuilder.append("KW480 : 'KW' '480';\n"); grammarBuilder.append("KW481 : 'KW' '481';\n"); grammarBuilder.append("KW482 : 'KW' '482';\n"); grammarBuilder.append("KW483 : 'KW' '483';\n"); grammarBuilder.append("KW484 : 'KW' '484';\n"); grammarBuilder.append("KW485 : 'KW' '485';\n"); grammarBuilder.append("KW486 : 'KW' '486';\n"); grammarBuilder.append("KW487 : 'KW' '487';\n"); grammarBuilder.append("KW488 : 'KW' '488';\n"); grammarBuilder.append("KW489 : 'KW' '489';\n"); grammarBuilder.append("KW490 : 'KW' '490';\n"); grammarBuilder.append("KW491 : 'KW' '491';\n"); grammarBuilder.append("KW492 : 'KW' '492';\n"); grammarBuilder.append("KW493 : 'KW' '493';\n"); grammarBuilder.append("KW494 : 'KW' '494';\n"); grammarBuilder.append("KW495 : 'KW' '495';\n"); grammarBuilder.append("KW496 : 'KW' '496';\n"); grammarBuilder.append("KW497 : 'KW' '497';\n"); grammarBuilder.append("KW498 : 'KW' '498';\n"); grammarBuilder.append("KW499 : 'KW' '499';\n"); grammarBuilder.append("KW500 : 'KW' '500';\n"); grammarBuilder.append("KW501 : 'KW' '501';\n"); grammarBuilder.append("KW502 : 'KW' '502';\n"); grammarBuilder.append("KW503 : 'KW' '503';\n"); grammarBuilder.append("KW504 : 'KW' '504';\n"); grammarBuilder.append("KW505 : 'KW' '505';\n"); grammarBuilder.append("KW506 : 'KW' '506';\n"); grammarBuilder.append("KW507 : 'KW' '507';\n"); grammarBuilder.append("KW508 : 'KW' '508';\n"); grammarBuilder.append("KW509 : 'KW' '509';\n"); grammarBuilder.append("KW510 : 'KW' '510';\n"); grammarBuilder.append("KW511 : 'KW' '511';\n"); grammarBuilder.append("KW512 : 'KW' '512';\n"); grammarBuilder.append("KW513 : 'KW' '513';\n"); grammarBuilder.append("KW514 : 'KW' '514';\n"); grammarBuilder.append("KW515 : 'KW' '515';\n"); grammarBuilder.append("KW516 : 'KW' '516';\n"); grammarBuilder.append("KW517 : 'KW' '517';\n"); grammarBuilder.append("KW518 : 'KW' '518';\n"); grammarBuilder.append("KW519 : 'KW' '519';\n"); grammarBuilder.append("KW520 : 'KW' '520';\n"); grammarBuilder.append("KW521 : 'KW' '521';\n"); grammarBuilder.append("KW522 : 'KW' '522';\n"); grammarBuilder.append("KW523 : 'KW' '523';\n"); grammarBuilder.append("KW524 : 'KW' '524';\n"); grammarBuilder.append("KW525 : 'KW' '525';\n"); grammarBuilder.append("KW526 : 'KW' '526';\n"); grammarBuilder.append("KW527 : 'KW' '527';\n"); grammarBuilder.append("KW528 : 'KW' '528';\n"); grammarBuilder.append("KW529 : 'KW' '529';\n"); grammarBuilder.append("KW530 : 'KW' '530';\n"); grammarBuilder.append("KW531 : 'KW' '531';\n"); grammarBuilder.append("KW532 : 'KW' '532';\n"); grammarBuilder.append("KW533 : 'KW' '533';\n"); grammarBuilder.append("KW534 : 'KW' '534';\n"); grammarBuilder.append("KW535 : 'KW' '535';\n"); grammarBuilder.append("KW536 : 'KW' '536';\n"); grammarBuilder.append("KW537 : 'KW' '537';\n"); grammarBuilder.append("KW538 : 'KW' '538';\n"); grammarBuilder.append("KW539 : 'KW' '539';\n"); grammarBuilder.append("KW540 : 'KW' '540';\n"); grammarBuilder.append("KW541 : 'KW' '541';\n"); grammarBuilder.append("KW542 : 'KW' '542';\n"); grammarBuilder.append("KW543 : 'KW' '543';\n"); grammarBuilder.append("KW544 : 'KW' '544';\n"); grammarBuilder.append("KW545 : 'KW' '545';\n"); grammarBuilder.append("KW546 : 'KW' '546';\n"); grammarBuilder.append("KW547 : 'KW' '547';\n"); grammarBuilder.append("KW548 : 'KW' '548';\n"); grammarBuilder.append("KW549 : 'KW' '549';\n"); grammarBuilder.append("KW550 : 'KW' '550';\n"); grammarBuilder.append("KW551 : 'KW' '551';\n"); grammarBuilder.append("KW552 : 'KW' '552';\n"); grammarBuilder.append("KW553 : 'KW' '553';\n"); grammarBuilder.append("KW554 : 'KW' '554';\n"); grammarBuilder.append("KW555 : 'KW' '555';\n"); grammarBuilder.append("KW556 : 'KW' '556';\n"); grammarBuilder.append("KW557 : 'KW' '557';\n"); grammarBuilder.append("KW558 : 'KW' '558';\n"); grammarBuilder.append("KW559 : 'KW' '559';\n"); grammarBuilder.append("KW560 : 'KW' '560';\n"); grammarBuilder.append("KW561 : 'KW' '561';\n"); grammarBuilder.append("KW562 : 'KW' '562';\n"); grammarBuilder.append("KW563 : 'KW' '563';\n"); grammarBuilder.append("KW564 : 'KW' '564';\n"); grammarBuilder.append("KW565 : 'KW' '565';\n"); grammarBuilder.append("KW566 : 'KW' '566';\n"); grammarBuilder.append("KW567 : 'KW' '567';\n"); grammarBuilder.append("KW568 : 'KW' '568';\n"); grammarBuilder.append("KW569 : 'KW' '569';\n"); grammarBuilder.append("KW570 : 'KW' '570';\n"); grammarBuilder.append("KW571 : 'KW' '571';\n"); grammarBuilder.append("KW572 : 'KW' '572';\n"); grammarBuilder.append("KW573 : 'KW' '573';\n"); grammarBuilder.append("KW574 : 'KW' '574';\n"); grammarBuilder.append("KW575 : 'KW' '575';\n"); grammarBuilder.append("KW576 : 'KW' '576';\n"); grammarBuilder.append("KW577 : 'KW' '577';\n"); grammarBuilder.append("KW578 : 'KW' '578';\n"); grammarBuilder.append("KW579 : 'KW' '579';\n"); grammarBuilder.append("KW580 : 'KW' '580';\n"); grammarBuilder.append("KW581 : 'KW' '581';\n"); grammarBuilder.append("KW582 : 'KW' '582';\n"); grammarBuilder.append("KW583 : 'KW' '583';\n"); grammarBuilder.append("KW584 : 'KW' '584';\n"); grammarBuilder.append("KW585 : 'KW' '585';\n"); grammarBuilder.append("KW586 : 'KW' '586';\n"); grammarBuilder.append("KW587 : 'KW' '587';\n"); grammarBuilder.append("KW588 : 'KW' '588';\n"); grammarBuilder.append("KW589 : 'KW' '589';\n"); grammarBuilder.append("KW590 : 'KW' '590';\n"); grammarBuilder.append("KW591 : 'KW' '591';\n"); grammarBuilder.append("KW592 : 'KW' '592';\n"); grammarBuilder.append("KW593 : 'KW' '593';\n"); grammarBuilder.append("KW594 : 'KW' '594';\n"); grammarBuilder.append("KW595 : 'KW' '595';\n"); grammarBuilder.append("KW596 : 'KW' '596';\n"); grammarBuilder.append("KW597 : 'KW' '597';\n"); grammarBuilder.append("KW598 : 'KW' '598';\n"); grammarBuilder.append("KW599 : 'KW' '599';\n"); grammarBuilder.append("KW600 : 'KW' '600';\n"); grammarBuilder.append("KW601 : 'KW' '601';\n"); grammarBuilder.append("KW602 : 'KW' '602';\n"); grammarBuilder.append("KW603 : 'KW' '603';\n"); grammarBuilder.append("KW604 : 'KW' '604';\n"); grammarBuilder.append("KW605 : 'KW' '605';\n"); grammarBuilder.append("KW606 : 'KW' '606';\n"); grammarBuilder.append("KW607 : 'KW' '607';\n"); grammarBuilder.append("KW608 : 'KW' '608';\n"); grammarBuilder.append("KW609 : 'KW' '609';\n"); grammarBuilder.append("KW610 : 'KW' '610';\n"); grammarBuilder.append("KW611 : 'KW' '611';\n"); grammarBuilder.append("KW612 : 'KW' '612';\n"); grammarBuilder.append("KW613 : 'KW' '613';\n"); grammarBuilder.append("KW614 : 'KW' '614';\n"); grammarBuilder.append("KW615 : 'KW' '615';\n"); grammarBuilder.append("KW616 : 'KW' '616';\n"); grammarBuilder.append("KW617 : 'KW' '617';\n"); grammarBuilder.append("KW618 : 'KW' '618';\n"); grammarBuilder.append("KW619 : 'KW' '619';\n"); grammarBuilder.append("KW620 : 'KW' '620';\n"); grammarBuilder.append("KW621 : 'KW' '621';\n"); grammarBuilder.append("KW622 : 'KW' '622';\n"); grammarBuilder.append("KW623 : 'KW' '623';\n"); grammarBuilder.append("KW624 : 'KW' '624';\n"); grammarBuilder.append("KW625 : 'KW' '625';\n"); grammarBuilder.append("KW626 : 'KW' '626';\n"); grammarBuilder.append("KW627 : 'KW' '627';\n"); grammarBuilder.append("KW628 : 'KW' '628';\n"); grammarBuilder.append("KW629 : 'KW' '629';\n"); grammarBuilder.append("KW630 : 'KW' '630';\n"); grammarBuilder.append("KW631 : 'KW' '631';\n"); grammarBuilder.append("KW632 : 'KW' '632';\n"); grammarBuilder.append("KW633 : 'KW' '633';\n"); grammarBuilder.append("KW634 : 'KW' '634';\n"); grammarBuilder.append("KW635 : 'KW' '635';\n"); grammarBuilder.append("KW636 : 'KW' '636';\n"); grammarBuilder.append("KW637 : 'KW' '637';\n"); grammarBuilder.append("KW638 : 'KW' '638';\n"); grammarBuilder.append("KW639 : 'KW' '639';\n"); grammarBuilder.append("KW640 : 'KW' '640';\n"); grammarBuilder.append("KW641 : 'KW' '641';\n"); grammarBuilder.append("KW642 : 'KW' '642';\n"); grammarBuilder.append("KW643 : 'KW' '643';\n"); grammarBuilder.append("KW644 : 'KW' '644';\n"); grammarBuilder.append("KW645 : 'KW' '645';\n"); grammarBuilder.append("KW646 : 'KW' '646';\n"); grammarBuilder.append("KW647 : 'KW' '647';\n"); grammarBuilder.append("KW648 : 'KW' '648';\n"); grammarBuilder.append("KW649 : 'KW' '649';\n"); grammarBuilder.append("KW650 : 'KW' '650';\n"); grammarBuilder.append("KW651 : 'KW' '651';\n"); grammarBuilder.append("KW652 : 'KW' '652';\n"); grammarBuilder.append("KW653 : 'KW' '653';\n"); grammarBuilder.append("KW654 : 'KW' '654';\n"); grammarBuilder.append("KW655 : 'KW' '655';\n"); grammarBuilder.append("KW656 : 'KW' '656';\n"); grammarBuilder.append("KW657 : 'KW' '657';\n"); grammarBuilder.append("KW658 : 'KW' '658';\n"); grammarBuilder.append("KW659 : 'KW' '659';\n"); grammarBuilder.append("KW660 : 'KW' '660';\n"); grammarBuilder.append("KW661 : 'KW' '661';\n"); grammarBuilder.append("KW662 : 'KW' '662';\n"); grammarBuilder.append("KW663 : 'KW' '663';\n"); grammarBuilder.append("KW664 : 'KW' '664';\n"); grammarBuilder.append("KW665 : 'KW' '665';\n"); grammarBuilder.append("KW666 : 'KW' '666';\n"); grammarBuilder.append("KW667 : 'KW' '667';\n"); grammarBuilder.append("KW668 : 'KW' '668';\n"); grammarBuilder.append("KW669 : 'KW' '669';\n"); grammarBuilder.append("KW670 : 'KW' '670';\n"); grammarBuilder.append("KW671 : 'KW' '671';\n"); grammarBuilder.append("KW672 : 'KW' '672';\n"); grammarBuilder.append("KW673 : 'KW' '673';\n"); grammarBuilder.append("KW674 : 'KW' '674';\n"); grammarBuilder.append("KW675 : 'KW' '675';\n"); grammarBuilder.append("KW676 : 'KW' '676';\n"); grammarBuilder.append("KW677 : 'KW' '677';\n"); grammarBuilder.append("KW678 : 'KW' '678';\n"); grammarBuilder.append("KW679 : 'KW' '679';\n"); grammarBuilder.append("KW680 : 'KW' '680';\n"); grammarBuilder.append("KW681 : 'KW' '681';\n"); grammarBuilder.append("KW682 : 'KW' '682';\n"); grammarBuilder.append("KW683 : 'KW' '683';\n"); grammarBuilder.append("KW684 : 'KW' '684';\n"); grammarBuilder.append("KW685 : 'KW' '685';\n"); grammarBuilder.append("KW686 : 'KW' '686';\n"); grammarBuilder.append("KW687 : 'KW' '687';\n"); grammarBuilder.append("KW688 : 'KW' '688';\n"); grammarBuilder.append("KW689 : 'KW' '689';\n"); grammarBuilder.append("KW690 : 'KW' '690';\n"); grammarBuilder.append("KW691 : 'KW' '691';\n"); grammarBuilder.append("KW692 : 'KW' '692';\n"); grammarBuilder.append("KW693 : 'KW' '693';\n"); grammarBuilder.append("KW694 : 'KW' '694';\n"); grammarBuilder.append("KW695 : 'KW' '695';\n"); grammarBuilder.append("KW696 : 'KW' '696';\n"); grammarBuilder.append("KW697 : 'KW' '697';\n"); grammarBuilder.append("KW698 : 'KW' '698';\n"); grammarBuilder.append("KW699 : 'KW' '699';\n"); grammarBuilder.append("KW700 : 'KW' '700';\n"); grammarBuilder.append("KW701 : 'KW' '701';\n"); grammarBuilder.append("KW702 : 'KW' '702';\n"); grammarBuilder.append("KW703 : 'KW' '703';\n"); grammarBuilder.append("KW704 : 'KW' '704';\n"); grammarBuilder.append("KW705 : 'KW' '705';\n"); grammarBuilder.append("KW706 : 'KW' '706';\n"); grammarBuilder.append("KW707 : 'KW' '707';\n"); grammarBuilder.append("KW708 : 'KW' '708';\n"); grammarBuilder.append("KW709 : 'KW' '709';\n"); grammarBuilder.append("KW710 : 'KW' '710';\n"); grammarBuilder.append("KW711 : 'KW' '711';\n"); grammarBuilder.append("KW712 : 'KW' '712';\n"); grammarBuilder.append("KW713 : 'KW' '713';\n"); grammarBuilder.append("KW714 : 'KW' '714';\n"); grammarBuilder.append("KW715 : 'KW' '715';\n"); grammarBuilder.append("KW716 : 'KW' '716';\n"); grammarBuilder.append("KW717 : 'KW' '717';\n"); grammarBuilder.append("KW718 : 'KW' '718';\n"); grammarBuilder.append("KW719 : 'KW' '719';\n"); grammarBuilder.append("KW720 : 'KW' '720';\n"); grammarBuilder.append("KW721 : 'KW' '721';\n"); grammarBuilder.append("KW722 : 'KW' '722';\n"); grammarBuilder.append("KW723 : 'KW' '723';\n"); grammarBuilder.append("KW724 : 'KW' '724';\n"); grammarBuilder.append("KW725 : 'KW' '725';\n"); grammarBuilder.append("KW726 : 'KW' '726';\n"); grammarBuilder.append("KW727 : 'KW' '727';\n"); grammarBuilder.append("KW728 : 'KW' '728';\n"); grammarBuilder.append("KW729 : 'KW' '729';\n"); grammarBuilder.append("KW730 : 'KW' '730';\n"); grammarBuilder.append("KW731 : 'KW' '731';\n"); grammarBuilder.append("KW732 : 'KW' '732';\n"); grammarBuilder.append("KW733 : 'KW' '733';\n"); grammarBuilder.append("KW734 : 'KW' '734';\n"); grammarBuilder.append("KW735 : 'KW' '735';\n"); grammarBuilder.append("KW736 : 'KW' '736';\n"); grammarBuilder.append("KW737 : 'KW' '737';\n"); grammarBuilder.append("KW738 : 'KW' '738';\n"); grammarBuilder.append("KW739 : 'KW' '739';\n"); grammarBuilder.append("KW740 : 'KW' '740';\n"); grammarBuilder.append("KW741 : 'KW' '741';\n"); grammarBuilder.append("KW742 : 'KW' '742';\n"); grammarBuilder.append("KW743 : 'KW' '743';\n"); grammarBuilder.append("KW744 : 'KW' '744';\n"); grammarBuilder.append("KW745 : 'KW' '745';\n"); grammarBuilder.append("KW746 : 'KW' '746';\n"); grammarBuilder.append("KW747 : 'KW' '747';\n"); grammarBuilder.append("KW748 : 'KW' '748';\n"); grammarBuilder.append("KW749 : 'KW' '749';\n"); grammarBuilder.append("KW750 : 'KW' '750';\n"); grammarBuilder.append("KW751 : 'KW' '751';\n"); grammarBuilder.append("KW752 : 'KW' '752';\n"); grammarBuilder.append("KW753 : 'KW' '753';\n"); grammarBuilder.append("KW754 : 'KW' '754';\n"); grammarBuilder.append("KW755 : 'KW' '755';\n"); grammarBuilder.append("KW756 : 'KW' '756';\n"); grammarBuilder.append("KW757 : 'KW' '757';\n"); grammarBuilder.append("KW758 : 'KW' '758';\n"); grammarBuilder.append("KW759 : 'KW' '759';\n"); grammarBuilder.append("KW760 : 'KW' '760';\n"); grammarBuilder.append("KW761 : 'KW' '761';\n"); grammarBuilder.append("KW762 : 'KW' '762';\n"); grammarBuilder.append("KW763 : 'KW' '763';\n"); grammarBuilder.append("KW764 : 'KW' '764';\n"); grammarBuilder.append("KW765 : 'KW' '765';\n"); grammarBuilder.append("KW766 : 'KW' '766';\n"); grammarBuilder.append("KW767 : 'KW' '767';\n"); grammarBuilder.append("KW768 : 'KW' '768';\n"); grammarBuilder.append("KW769 : 'KW' '769';\n"); grammarBuilder.append("KW770 : 'KW' '770';\n"); grammarBuilder.append("KW771 : 'KW' '771';\n"); grammarBuilder.append("KW772 : 'KW' '772';\n"); grammarBuilder.append("KW773 : 'KW' '773';\n"); grammarBuilder.append("KW774 : 'KW' '774';\n"); grammarBuilder.append("KW775 : 'KW' '775';\n"); grammarBuilder.append("KW776 : 'KW' '776';\n"); grammarBuilder.append("KW777 : 'KW' '777';\n"); grammarBuilder.append("KW778 : 'KW' '778';\n"); grammarBuilder.append("KW779 : 'KW' '779';\n"); grammarBuilder.append("KW780 : 'KW' '780';\n"); grammarBuilder.append("KW781 : 'KW' '781';\n"); grammarBuilder.append("KW782 : 'KW' '782';\n"); grammarBuilder.append("KW783 : 'KW' '783';\n"); grammarBuilder.append("KW784 : 'KW' '784';\n"); grammarBuilder.append("KW785 : 'KW' '785';\n"); grammarBuilder.append("KW786 : 'KW' '786';\n"); grammarBuilder.append("KW787 : 'KW' '787';\n"); grammarBuilder.append("KW788 : 'KW' '788';\n"); grammarBuilder.append("KW789 : 'KW' '789';\n"); grammarBuilder.append("KW790 : 'KW' '790';\n"); grammarBuilder.append("KW791 : 'KW' '791';\n"); grammarBuilder.append("KW792 : 'KW' '792';\n"); grammarBuilder.append("KW793 : 'KW' '793';\n"); grammarBuilder.append("KW794 : 'KW' '794';\n"); grammarBuilder.append("KW795 : 'KW' '795';\n"); grammarBuilder.append("KW796 : 'KW' '796';\n"); grammarBuilder.append("KW797 : 'KW' '797';\n"); grammarBuilder.append("KW798 : 'KW' '798';\n"); grammarBuilder.append("KW799 : 'KW' '799';\n"); grammarBuilder.append("KW800 : 'KW' '800';\n"); grammarBuilder.append("KW801 : 'KW' '801';\n"); grammarBuilder.append("KW802 : 'KW' '802';\n"); grammarBuilder.append("KW803 : 'KW' '803';\n"); grammarBuilder.append("KW804 : 'KW' '804';\n"); grammarBuilder.append("KW805 : 'KW' '805';\n"); grammarBuilder.append("KW806 : 'KW' '806';\n"); grammarBuilder.append("KW807 : 'KW' '807';\n"); grammarBuilder.append("KW808 : 'KW' '808';\n"); grammarBuilder.append("KW809 : 'KW' '809';\n"); grammarBuilder.append("KW810 : 'KW' '810';\n"); grammarBuilder.append("KW811 : 'KW' '811';\n"); grammarBuilder.append("KW812 : 'KW' '812';\n"); grammarBuilder.append("KW813 : 'KW' '813';\n"); grammarBuilder.append("KW814 : 'KW' '814';\n"); grammarBuilder.append("KW815 : 'KW' '815';\n"); grammarBuilder.append("KW816 : 'KW' '816';\n"); grammarBuilder.append("KW817 : 'KW' '817';\n"); grammarBuilder.append("KW818 : 'KW' '818';\n"); grammarBuilder.append("KW819 : 'KW' '819';\n"); grammarBuilder.append("KW820 : 'KW' '820';\n"); grammarBuilder.append("KW821 : 'KW' '821';\n"); grammarBuilder.append("KW822 : 'KW' '822';\n"); grammarBuilder.append("KW823 : 'KW' '823';\n"); grammarBuilder.append("KW824 : 'KW' '824';\n"); grammarBuilder.append("KW825 : 'KW' '825';\n"); grammarBuilder.append("KW826 : 'KW' '826';\n"); grammarBuilder.append("KW827 : 'KW' '827';\n"); grammarBuilder.append("KW828 : 'KW' '828';\n"); grammarBuilder.append("KW829 : 'KW' '829';\n"); grammarBuilder.append("KW830 : 'KW' '830';\n"); grammarBuilder.append("KW831 : 'KW' '831';\n"); grammarBuilder.append("KW832 : 'KW' '832';\n"); grammarBuilder.append("KW833 : 'KW' '833';\n"); grammarBuilder.append("KW834 : 'KW' '834';\n"); grammarBuilder.append("KW835 : 'KW' '835';\n"); grammarBuilder.append("KW836 : 'KW' '836';\n"); grammarBuilder.append("KW837 : 'KW' '837';\n"); grammarBuilder.append("KW838 : 'KW' '838';\n"); grammarBuilder.append("KW839 : 'KW' '839';\n"); grammarBuilder.append("KW840 : 'KW' '840';\n"); grammarBuilder.append("KW841 : 'KW' '841';\n"); grammarBuilder.append("KW842 : 'KW' '842';\n"); grammarBuilder.append("KW843 : 'KW' '843';\n"); grammarBuilder.append("KW844 : 'KW' '844';\n"); grammarBuilder.append("KW845 : 'KW' '845';\n"); grammarBuilder.append("KW846 : 'KW' '846';\n"); grammarBuilder.append("KW847 : 'KW' '847';\n"); grammarBuilder.append("KW848 : 'KW' '848';\n"); grammarBuilder.append("KW849 : 'KW' '849';\n"); grammarBuilder.append("KW850 : 'KW' '850';\n"); grammarBuilder.append("KW851 : 'KW' '851';\n"); grammarBuilder.append("KW852 : 'KW' '852';\n"); grammarBuilder.append("KW853 : 'KW' '853';\n"); grammarBuilder.append("KW854 : 'KW' '854';\n"); grammarBuilder.append("KW855 : 'KW' '855';\n"); grammarBuilder.append("KW856 : 'KW' '856';\n"); grammarBuilder.append("KW857 : 'KW' '857';\n"); grammarBuilder.append("KW858 : 'KW' '858';\n"); grammarBuilder.append("KW859 : 'KW' '859';\n"); grammarBuilder.append("KW860 : 'KW' '860';\n"); grammarBuilder.append("KW861 : 'KW' '861';\n"); grammarBuilder.append("KW862 : 'KW' '862';\n"); grammarBuilder.append("KW863 : 'KW' '863';\n"); grammarBuilder.append("KW864 : 'KW' '864';\n"); grammarBuilder.append("KW865 : 'KW' '865';\n"); grammarBuilder.append("KW866 : 'KW' '866';\n"); grammarBuilder.append("KW867 : 'KW' '867';\n"); grammarBuilder.append("KW868 : 'KW' '868';\n"); grammarBuilder.append("KW869 : 'KW' '869';\n"); grammarBuilder.append("KW870 : 'KW' '870';\n"); grammarBuilder.append("KW871 : 'KW' '871';\n"); grammarBuilder.append("KW872 : 'KW' '872';\n"); grammarBuilder.append("KW873 : 'KW' '873';\n"); grammarBuilder.append("KW874 : 'KW' '874';\n"); grammarBuilder.append("KW875 : 'KW' '875';\n"); grammarBuilder.append("KW876 : 'KW' '876';\n"); grammarBuilder.append("KW877 : 'KW' '877';\n"); grammarBuilder.append("KW878 : 'KW' '878';\n"); grammarBuilder.append("KW879 : 'KW' '879';\n"); grammarBuilder.append("KW880 : 'KW' '880';\n"); grammarBuilder.append("KW881 : 'KW' '881';\n"); grammarBuilder.append("KW882 : 'KW' '882';\n"); grammarBuilder.append("KW883 : 'KW' '883';\n"); grammarBuilder.append("KW884 : 'KW' '884';\n"); grammarBuilder.append("KW885 : 'KW' '885';\n"); grammarBuilder.append("KW886 : 'KW' '886';\n"); grammarBuilder.append("KW887 : 'KW' '887';\n"); grammarBuilder.append("KW888 : 'KW' '888';\n"); grammarBuilder.append("KW889 : 'KW' '889';\n"); grammarBuilder.append("KW890 : 'KW' '890';\n"); grammarBuilder.append("KW891 : 'KW' '891';\n"); grammarBuilder.append("KW892 : 'KW' '892';\n"); grammarBuilder.append("KW893 : 'KW' '893';\n"); grammarBuilder.append("KW894 : 'KW' '894';\n"); grammarBuilder.append("KW895 : 'KW' '895';\n"); grammarBuilder.append("KW896 : 'KW' '896';\n"); grammarBuilder.append("KW897 : 'KW' '897';\n"); grammarBuilder.append("KW898 : 'KW' '898';\n"); grammarBuilder.append("KW899 : 'KW' '899';\n"); grammarBuilder.append("KW900 : 'KW' '900';\n"); grammarBuilder.append("KW901 : 'KW' '901';\n"); grammarBuilder.append("KW902 : 'KW' '902';\n"); grammarBuilder.append("KW903 : 'KW' '903';\n"); grammarBuilder.append("KW904 : 'KW' '904';\n"); grammarBuilder.append("KW905 : 'KW' '905';\n"); grammarBuilder.append("KW906 : 'KW' '906';\n"); grammarBuilder.append("KW907 : 'KW' '907';\n"); grammarBuilder.append("KW908 : 'KW' '908';\n"); grammarBuilder.append("KW909 : 'KW' '909';\n"); grammarBuilder.append("KW910 : 'KW' '910';\n"); grammarBuilder.append("KW911 : 'KW' '911';\n"); grammarBuilder.append("KW912 : 'KW' '912';\n"); grammarBuilder.append("KW913 : 'KW' '913';\n"); grammarBuilder.append("KW914 : 'KW' '914';\n"); grammarBuilder.append("KW915 : 'KW' '915';\n"); grammarBuilder.append("KW916 : 'KW' '916';\n"); grammarBuilder.append("KW917 : 'KW' '917';\n"); grammarBuilder.append("KW918 : 'KW' '918';\n"); grammarBuilder.append("KW919 : 'KW' '919';\n"); grammarBuilder.append("KW920 : 'KW' '920';\n"); grammarBuilder.append("KW921 : 'KW' '921';\n"); grammarBuilder.append("KW922 : 'KW' '922';\n"); grammarBuilder.append("KW923 : 'KW' '923';\n"); grammarBuilder.append("KW924 : 'KW' '924';\n"); grammarBuilder.append("KW925 : 'KW' '925';\n"); grammarBuilder.append("KW926 : 'KW' '926';\n"); grammarBuilder.append("KW927 : 'KW' '927';\n"); grammarBuilder.append("KW928 : 'KW' '928';\n"); grammarBuilder.append("KW929 : 'KW' '929';\n"); grammarBuilder.append("KW930 : 'KW' '930';\n"); grammarBuilder.append("KW931 : 'KW' '931';\n"); grammarBuilder.append("KW932 : 'KW' '932';\n"); grammarBuilder.append("KW933 : 'KW' '933';\n"); grammarBuilder.append("KW934 : 'KW' '934';\n"); grammarBuilder.append("KW935 : 'KW' '935';\n"); grammarBuilder.append("KW936 : 'KW' '936';\n"); grammarBuilder.append("KW937 : 'KW' '937';\n"); grammarBuilder.append("KW938 : 'KW' '938';\n"); grammarBuilder.append("KW939 : 'KW' '939';\n"); grammarBuilder.append("KW940 : 'KW' '940';\n"); grammarBuilder.append("KW941 : 'KW' '941';\n"); grammarBuilder.append("KW942 : 'KW' '942';\n"); grammarBuilder.append("KW943 : 'KW' '943';\n"); grammarBuilder.append("KW944 : 'KW' '944';\n"); grammarBuilder.append("KW945 : 'KW' '945';\n"); grammarBuilder.append("KW946 : 'KW' '946';\n"); grammarBuilder.append("KW947 : 'KW' '947';\n"); grammarBuilder.append("KW948 : 'KW' '948';\n"); grammarBuilder.append("KW949 : 'KW' '949';\n"); grammarBuilder.append("KW950 : 'KW' '950';\n"); grammarBuilder.append("KW951 : 'KW' '951';\n"); grammarBuilder.append("KW952 : 'KW' '952';\n"); grammarBuilder.append("KW953 : 'KW' '953';\n"); grammarBuilder.append("KW954 : 'KW' '954';\n"); grammarBuilder.append("KW955 : 'KW' '955';\n"); grammarBuilder.append("KW956 : 'KW' '956';\n"); grammarBuilder.append("KW957 : 'KW' '957';\n"); grammarBuilder.append("KW958 : 'KW' '958';\n"); grammarBuilder.append("KW959 : 'KW' '959';\n"); grammarBuilder.append("KW960 : 'KW' '960';\n"); grammarBuilder.append("KW961 : 'KW' '961';\n"); grammarBuilder.append("KW962 : 'KW' '962';\n"); grammarBuilder.append("KW963 : 'KW' '963';\n"); grammarBuilder.append("KW964 : 'KW' '964';\n"); grammarBuilder.append("KW965 : 'KW' '965';\n"); grammarBuilder.append("KW966 : 'KW' '966';\n"); grammarBuilder.append("KW967 : 'KW' '967';\n"); grammarBuilder.append("KW968 : 'KW' '968';\n"); grammarBuilder.append("KW969 : 'KW' '969';\n"); grammarBuilder.append("KW970 : 'KW' '970';\n"); grammarBuilder.append("KW971 : 'KW' '971';\n"); grammarBuilder.append("KW972 : 'KW' '972';\n"); grammarBuilder.append("KW973 : 'KW' '973';\n"); grammarBuilder.append("KW974 : 'KW' '974';\n"); grammarBuilder.append("KW975 : 'KW' '975';\n"); grammarBuilder.append("KW976 : 'KW' '976';\n"); grammarBuilder.append("KW977 : 'KW' '977';\n"); grammarBuilder.append("KW978 : 'KW' '978';\n"); grammarBuilder.append("KW979 : 'KW' '979';\n"); grammarBuilder.append("KW980 : 'KW' '980';\n"); grammarBuilder.append("KW981 : 'KW' '981';\n"); grammarBuilder.append("KW982 : 'KW' '982';\n"); grammarBuilder.append("KW983 : 'KW' '983';\n"); grammarBuilder.append("KW984 : 'KW' '984';\n"); grammarBuilder.append("KW985 : 'KW' '985';\n"); grammarBuilder.append("KW986 : 'KW' '986';\n"); grammarBuilder.append("KW987 : 'KW' '987';\n"); grammarBuilder.append("KW988 : 'KW' '988';\n"); grammarBuilder.append("KW989 : 'KW' '989';\n"); grammarBuilder.append("KW990 : 'KW' '990';\n"); grammarBuilder.append("KW991 : 'KW' '991';\n"); grammarBuilder.append("KW992 : 'KW' '992';\n"); grammarBuilder.append("KW993 : 'KW' '993';\n"); grammarBuilder.append("KW994 : 'KW' '994';\n"); grammarBuilder.append("KW995 : 'KW' '995';\n"); grammarBuilder.append("KW996 : 'KW' '996';\n"); grammarBuilder.append("KW997 : 'KW' '997';\n"); grammarBuilder.append("KW998 : 'KW' '998';\n"); grammarBuilder.append("KW999 : 'KW' '999';\n"); grammarBuilder.append("KW1000 : 'KW' '1000';\n"); grammarBuilder.append("KW1001 : 'KW' '1001';\n"); grammarBuilder.append("KW1002 : 'KW' '1002';\n"); grammarBuilder.append("KW1003 : 'KW' '1003';\n"); grammarBuilder.append("KW1004 : 'KW' '1004';\n"); grammarBuilder.append("KW1005 : 'KW' '1005';\n"); grammarBuilder.append("KW1006 : 'KW' '1006';\n"); grammarBuilder.append("KW1007 : 'KW' '1007';\n"); grammarBuilder.append("KW1008 : 'KW' '1008';\n"); grammarBuilder.append("KW1009 : 'KW' '1009';\n"); grammarBuilder.append("KW1010 : 'KW' '1010';\n"); grammarBuilder.append("KW1011 : 'KW' '1011';\n"); grammarBuilder.append("KW1012 : 'KW' '1012';\n"); grammarBuilder.append("KW1013 : 'KW' '1013';\n"); grammarBuilder.append("KW1014 : 'KW' '1014';\n"); grammarBuilder.append("KW1015 : 'KW' '1015';\n"); grammarBuilder.append("KW1016 : 'KW' '1016';\n"); grammarBuilder.append("KW1017 : 'KW' '1017';\n"); grammarBuilder.append("KW1018 : 'KW' '1018';\n"); grammarBuilder.append("KW1019 : 'KW' '1019';\n"); grammarBuilder.append("KW1020 : 'KW' '1020';\n"); grammarBuilder.append("KW1021 : 'KW' '1021';\n"); grammarBuilder.append("KW1022 : 'KW' '1022';\n"); grammarBuilder.append("KW1023 : 'KW' '1023';\n"); grammarBuilder.append("KW1024 : 'KW' '1024';\n"); grammarBuilder.append("KW1025 : 'KW' '1025';\n"); grammarBuilder.append("KW1026 : 'KW' '1026';\n"); grammarBuilder.append("KW1027 : 'KW' '1027';\n"); grammarBuilder.append("KW1028 : 'KW' '1028';\n"); grammarBuilder.append("KW1029 : 'KW' '1029';\n"); grammarBuilder.append("KW1030 : 'KW' '1030';\n"); grammarBuilder.append("KW1031 : 'KW' '1031';\n"); grammarBuilder.append("KW1032 : 'KW' '1032';\n"); grammarBuilder.append("KW1033 : 'KW' '1033';\n"); grammarBuilder.append("KW1034 : 'KW' '1034';\n"); grammarBuilder.append("KW1035 : 'KW' '1035';\n"); grammarBuilder.append("KW1036 : 'KW' '1036';\n"); grammarBuilder.append("KW1037 : 'KW' '1037';\n"); grammarBuilder.append("KW1038 : 'KW' '1038';\n"); grammarBuilder.append("KW1039 : 'KW' '1039';\n"); grammarBuilder.append("KW1040 : 'KW' '1040';\n"); grammarBuilder.append("KW1041 : 'KW' '1041';\n"); grammarBuilder.append("KW1042 : 'KW' '1042';\n"); grammarBuilder.append("KW1043 : 'KW' '1043';\n"); grammarBuilder.append("KW1044 : 'KW' '1044';\n"); grammarBuilder.append("KW1045 : 'KW' '1045';\n"); grammarBuilder.append("KW1046 : 'KW' '1046';\n"); grammarBuilder.append("KW1047 : 'KW' '1047';\n"); grammarBuilder.append("KW1048 : 'KW' '1048';\n"); grammarBuilder.append("KW1049 : 'KW' '1049';\n"); grammarBuilder.append("KW1050 : 'KW' '1050';\n"); grammarBuilder.append("KW1051 : 'KW' '1051';\n"); grammarBuilder.append("KW1052 : 'KW' '1052';\n"); grammarBuilder.append("KW1053 : 'KW' '1053';\n"); grammarBuilder.append("KW1054 : 'KW' '1054';\n"); grammarBuilder.append("KW1055 : 'KW' '1055';\n"); grammarBuilder.append("KW1056 : 'KW' '1056';\n"); grammarBuilder.append("KW1057 : 'KW' '1057';\n"); grammarBuilder.append("KW1058 : 'KW' '1058';\n"); grammarBuilder.append("KW1059 : 'KW' '1059';\n"); grammarBuilder.append("KW1060 : 'KW' '1060';\n"); grammarBuilder.append("KW1061 : 'KW' '1061';\n"); grammarBuilder.append("KW1062 : 'KW' '1062';\n"); grammarBuilder.append("KW1063 : 'KW' '1063';\n"); grammarBuilder.append("KW1064 : 'KW' '1064';\n"); grammarBuilder.append("KW1065 : 'KW' '1065';\n"); grammarBuilder.append("KW1066 : 'KW' '1066';\n"); grammarBuilder.append("KW1067 : 'KW' '1067';\n"); grammarBuilder.append("KW1068 : 'KW' '1068';\n"); grammarBuilder.append("KW1069 : 'KW' '1069';\n"); grammarBuilder.append("KW1070 : 'KW' '1070';\n"); grammarBuilder.append("KW1071 : 'KW' '1071';\n"); grammarBuilder.append("KW1072 : 'KW' '1072';\n"); grammarBuilder.append("KW1073 : 'KW' '1073';\n"); grammarBuilder.append("KW1074 : 'KW' '1074';\n"); grammarBuilder.append("KW1075 : 'KW' '1075';\n"); grammarBuilder.append("KW1076 : 'KW' '1076';\n"); grammarBuilder.append("KW1077 : 'KW' '1077';\n"); grammarBuilder.append("KW1078 : 'KW' '1078';\n"); grammarBuilder.append("KW1079 : 'KW' '1079';\n"); grammarBuilder.append("KW1080 : 'KW' '1080';\n"); grammarBuilder.append("KW1081 : 'KW' '1081';\n"); grammarBuilder.append("KW1082 : 'KW' '1082';\n"); grammarBuilder.append("KW1083 : 'KW' '1083';\n"); grammarBuilder.append("KW1084 : 'KW' '1084';\n"); grammarBuilder.append("KW1085 : 'KW' '1085';\n"); grammarBuilder.append("KW1086 : 'KW' '1086';\n"); grammarBuilder.append("KW1087 : 'KW' '1087';\n"); grammarBuilder.append("KW1088 : 'KW' '1088';\n"); grammarBuilder.append("KW1089 : 'KW' '1089';\n"); grammarBuilder.append("KW1090 : 'KW' '1090';\n"); grammarBuilder.append("KW1091 : 'KW' '1091';\n"); grammarBuilder.append("KW1092 : 'KW' '1092';\n"); grammarBuilder.append("KW1093 : 'KW' '1093';\n"); grammarBuilder.append("KW1094 : 'KW' '1094';\n"); grammarBuilder.append("KW1095 : 'KW' '1095';\n"); grammarBuilder.append("KW1096 : 'KW' '1096';\n"); grammarBuilder.append("KW1097 : 'KW' '1097';\n"); grammarBuilder.append("KW1098 : 'KW' '1098';\n"); grammarBuilder.append("KW1099 : 'KW' '1099';\n"); grammarBuilder.append("KW1100 : 'KW' '1100';\n"); grammarBuilder.append("KW1101 : 'KW' '1101';\n"); grammarBuilder.append("KW1102 : 'KW' '1102';\n"); grammarBuilder.append("KW1103 : 'KW' '1103';\n"); grammarBuilder.append("KW1104 : 'KW' '1104';\n"); grammarBuilder.append("KW1105 : 'KW' '1105';\n"); grammarBuilder.append("KW1106 : 'KW' '1106';\n"); grammarBuilder.append("KW1107 : 'KW' '1107';\n"); grammarBuilder.append("KW1108 : 'KW' '1108';\n"); grammarBuilder.append("KW1109 : 'KW' '1109';\n"); grammarBuilder.append("KW1110 : 'KW' '1110';\n"); grammarBuilder.append("KW1111 : 'KW' '1111';\n"); grammarBuilder.append("KW1112 : 'KW' '1112';\n"); grammarBuilder.append("KW1113 : 'KW' '1113';\n"); grammarBuilder.append("KW1114 : 'KW' '1114';\n"); grammarBuilder.append("KW1115 : 'KW' '1115';\n"); grammarBuilder.append("KW1116 : 'KW' '1116';\n"); grammarBuilder.append("KW1117 : 'KW' '1117';\n"); grammarBuilder.append("KW1118 : 'KW' '1118';\n"); grammarBuilder.append("KW1119 : 'KW' '1119';\n"); grammarBuilder.append("KW1120 : 'KW' '1120';\n"); grammarBuilder.append("KW1121 : 'KW' '1121';\n"); grammarBuilder.append("KW1122 : 'KW' '1122';\n"); grammarBuilder.append("KW1123 : 'KW' '1123';\n"); grammarBuilder.append("KW1124 : 'KW' '1124';\n"); grammarBuilder.append("KW1125 : 'KW' '1125';\n"); grammarBuilder.append("KW1126 : 'KW' '1126';\n"); grammarBuilder.append("KW1127 : 'KW' '1127';\n"); grammarBuilder.append("KW1128 : 'KW' '1128';\n"); grammarBuilder.append("KW1129 : 'KW' '1129';\n"); grammarBuilder.append("KW1130 : 'KW' '1130';\n"); grammarBuilder.append("KW1131 : 'KW' '1131';\n"); grammarBuilder.append("KW1132 : 'KW' '1132';\n"); grammarBuilder.append("KW1133 : 'KW' '1133';\n"); grammarBuilder.append("KW1134 : 'KW' '1134';\n"); grammarBuilder.append("KW1135 : 'KW' '1135';\n"); grammarBuilder.append("KW1136 : 'KW' '1136';\n"); grammarBuilder.append("KW1137 : 'KW' '1137';\n"); grammarBuilder.append("KW1138 : 'KW' '1138';\n"); grammarBuilder.append("KW1139 : 'KW' '1139';\n"); grammarBuilder.append("KW1140 : 'KW' '1140';\n"); grammarBuilder.append("KW1141 : 'KW' '1141';\n"); grammarBuilder.append("KW1142 : 'KW' '1142';\n"); grammarBuilder.append("KW1143 : 'KW' '1143';\n"); grammarBuilder.append("KW1144 : 'KW' '1144';\n"); grammarBuilder.append("KW1145 : 'KW' '1145';\n"); grammarBuilder.append("KW1146 : 'KW' '1146';\n"); grammarBuilder.append("KW1147 : 'KW' '1147';\n"); grammarBuilder.append("KW1148 : 'KW' '1148';\n"); grammarBuilder.append("KW1149 : 'KW' '1149';\n"); grammarBuilder.append("KW1150 : 'KW' '1150';\n"); grammarBuilder.append("KW1151 : 'KW' '1151';\n"); grammarBuilder.append("KW1152 : 'KW' '1152';\n"); grammarBuilder.append("KW1153 : 'KW' '1153';\n"); grammarBuilder.append("KW1154 : 'KW' '1154';\n"); grammarBuilder.append("KW1155 : 'KW' '1155';\n"); grammarBuilder.append("KW1156 : 'KW' '1156';\n"); grammarBuilder.append("KW1157 : 'KW' '1157';\n"); grammarBuilder.append("KW1158 : 'KW' '1158';\n"); grammarBuilder.append("KW1159 : 'KW' '1159';\n"); grammarBuilder.append("KW1160 : 'KW' '1160';\n"); grammarBuilder.append("KW1161 : 'KW' '1161';\n"); grammarBuilder.append("KW1162 : 'KW' '1162';\n"); grammarBuilder.append("KW1163 : 'KW' '1163';\n"); grammarBuilder.append("KW1164 : 'KW' '1164';\n"); grammarBuilder.append("KW1165 : 'KW' '1165';\n"); grammarBuilder.append("KW1166 : 'KW' '1166';\n"); grammarBuilder.append("KW1167 : 'KW' '1167';\n"); grammarBuilder.append("KW1168 : 'KW' '1168';\n"); grammarBuilder.append("KW1169 : 'KW' '1169';\n"); grammarBuilder.append("KW1170 : 'KW' '1170';\n"); grammarBuilder.append("KW1171 : 'KW' '1171';\n"); grammarBuilder.append("KW1172 : 'KW' '1172';\n"); grammarBuilder.append("KW1173 : 'KW' '1173';\n"); grammarBuilder.append("KW1174 : 'KW' '1174';\n"); grammarBuilder.append("KW1175 : 'KW' '1175';\n"); grammarBuilder.append("KW1176 : 'KW' '1176';\n"); grammarBuilder.append("KW1177 : 'KW' '1177';\n"); grammarBuilder.append("KW1178 : 'KW' '1178';\n"); grammarBuilder.append("KW1179 : 'KW' '1179';\n"); grammarBuilder.append("KW1180 : 'KW' '1180';\n"); grammarBuilder.append("KW1181 : 'KW' '1181';\n"); grammarBuilder.append("KW1182 : 'KW' '1182';\n"); grammarBuilder.append("KW1183 : 'KW' '1183';\n"); grammarBuilder.append("KW1184 : 'KW' '1184';\n"); grammarBuilder.append("KW1185 : 'KW' '1185';\n"); grammarBuilder.append("KW1186 : 'KW' '1186';\n"); grammarBuilder.append("KW1187 : 'KW' '1187';\n"); grammarBuilder.append("KW1188 : 'KW' '1188';\n"); grammarBuilder.append("KW1189 : 'KW' '1189';\n"); grammarBuilder.append("KW1190 : 'KW' '1190';\n"); grammarBuilder.append("KW1191 : 'KW' '1191';\n"); grammarBuilder.append("KW1192 : 'KW' '1192';\n"); grammarBuilder.append("KW1193 : 'KW' '1193';\n"); grammarBuilder.append("KW1194 : 'KW' '1194';\n"); grammarBuilder.append("KW1195 : 'KW' '1195';\n"); grammarBuilder.append("KW1196 : 'KW' '1196';\n"); grammarBuilder.append("KW1197 : 'KW' '1197';\n"); grammarBuilder.append("KW1198 : 'KW' '1198';\n"); grammarBuilder.append("KW1199 : 'KW' '1199';\n"); grammarBuilder.append("KW1200 : 'KW' '1200';\n"); grammarBuilder.append("KW1201 : 'KW' '1201';\n"); grammarBuilder.append("KW1202 : 'KW' '1202';\n"); grammarBuilder.append("KW1203 : 'KW' '1203';\n"); grammarBuilder.append("KW1204 : 'KW' '1204';\n"); grammarBuilder.append("KW1205 : 'KW' '1205';\n"); grammarBuilder.append("KW1206 : 'KW' '1206';\n"); grammarBuilder.append("KW1207 : 'KW' '1207';\n"); grammarBuilder.append("KW1208 : 'KW' '1208';\n"); grammarBuilder.append("KW1209 : 'KW' '1209';\n"); grammarBuilder.append("KW1210 : 'KW' '1210';\n"); grammarBuilder.append("KW1211 : 'KW' '1211';\n"); grammarBuilder.append("KW1212 : 'KW' '1212';\n"); grammarBuilder.append("KW1213 : 'KW' '1213';\n"); grammarBuilder.append("KW1214 : 'KW' '1214';\n"); grammarBuilder.append("KW1215 : 'KW' '1215';\n"); grammarBuilder.append("KW1216 : 'KW' '1216';\n"); grammarBuilder.append("KW1217 : 'KW' '1217';\n"); grammarBuilder.append("KW1218 : 'KW' '1218';\n"); grammarBuilder.append("KW1219 : 'KW' '1219';\n"); grammarBuilder.append("KW1220 : 'KW' '1220';\n"); grammarBuilder.append("KW1221 : 'KW' '1221';\n"); grammarBuilder.append("KW1222 : 'KW' '1222';\n"); grammarBuilder.append("KW1223 : 'KW' '1223';\n"); grammarBuilder.append("KW1224 : 'KW' '1224';\n"); grammarBuilder.append("KW1225 : 'KW' '1225';\n"); grammarBuilder.append("KW1226 : 'KW' '1226';\n"); grammarBuilder.append("KW1227 : 'KW' '1227';\n"); grammarBuilder.append("KW1228 : 'KW' '1228';\n"); grammarBuilder.append("KW1229 : 'KW' '1229';\n"); grammarBuilder.append("KW1230 : 'KW' '1230';\n"); grammarBuilder.append("KW1231 : 'KW' '1231';\n"); grammarBuilder.append("KW1232 : 'KW' '1232';\n"); grammarBuilder.append("KW1233 : 'KW' '1233';\n"); grammarBuilder.append("KW1234 : 'KW' '1234';\n"); grammarBuilder.append("KW1235 : 'KW' '1235';\n"); grammarBuilder.append("KW1236 : 'KW' '1236';\n"); grammarBuilder.append("KW1237 : 'KW' '1237';\n"); grammarBuilder.append("KW1238 : 'KW' '1238';\n"); grammarBuilder.append("KW1239 : 'KW' '1239';\n"); grammarBuilder.append("KW1240 : 'KW' '1240';\n"); grammarBuilder.append("KW1241 : 'KW' '1241';\n"); grammarBuilder.append("KW1242 : 'KW' '1242';\n"); grammarBuilder.append("KW1243 : 'KW' '1243';\n"); grammarBuilder.append("KW1244 : 'KW' '1244';\n"); grammarBuilder.append("KW1245 : 'KW' '1245';\n"); grammarBuilder.append("KW1246 : 'KW' '1246';\n"); grammarBuilder.append("KW1247 : 'KW' '1247';\n"); grammarBuilder.append("KW1248 : 'KW' '1248';\n"); grammarBuilder.append("KW1249 : 'KW' '1249';\n"); grammarBuilder.append("KW1250 : 'KW' '1250';\n"); grammarBuilder.append("KW1251 : 'KW' '1251';\n"); grammarBuilder.append("KW1252 : 'KW' '1252';\n"); grammarBuilder.append("KW1253 : 'KW' '1253';\n"); grammarBuilder.append("KW1254 : 'KW' '1254';\n"); grammarBuilder.append("KW1255 : 'KW' '1255';\n"); grammarBuilder.append("KW1256 : 'KW' '1256';\n"); grammarBuilder.append("KW1257 : 'KW' '1257';\n"); grammarBuilder.append("KW1258 : 'KW' '1258';\n"); grammarBuilder.append("KW1259 : 'KW' '1259';\n"); grammarBuilder.append("KW1260 : 'KW' '1260';\n"); grammarBuilder.append("KW1261 : 'KW' '1261';\n"); grammarBuilder.append("KW1262 : 'KW' '1262';\n"); grammarBuilder.append("KW1263 : 'KW' '1263';\n"); grammarBuilder.append("KW1264 : 'KW' '1264';\n"); grammarBuilder.append("KW1265 : 'KW' '1265';\n"); grammarBuilder.append("KW1266 : 'KW' '1266';\n"); grammarBuilder.append("KW1267 : 'KW' '1267';\n"); grammarBuilder.append("KW1268 : 'KW' '1268';\n"); grammarBuilder.append("KW1269 : 'KW' '1269';\n"); grammarBuilder.append("KW1270 : 'KW' '1270';\n"); grammarBuilder.append("KW1271 : 'KW' '1271';\n"); grammarBuilder.append("KW1272 : 'KW' '1272';\n"); grammarBuilder.append("KW1273 : 'KW' '1273';\n"); grammarBuilder.append("KW1274 : 'KW' '1274';\n"); grammarBuilder.append("KW1275 : 'KW' '1275';\n"); grammarBuilder.append("KW1276 : 'KW' '1276';\n"); grammarBuilder.append("KW1277 : 'KW' '1277';\n"); grammarBuilder.append("KW1278 : 'KW' '1278';\n"); grammarBuilder.append("KW1279 : 'KW' '1279';\n"); grammarBuilder.append("KW1280 : 'KW' '1280';\n"); grammarBuilder.append("KW1281 : 'KW' '1281';\n"); grammarBuilder.append("KW1282 : 'KW' '1282';\n"); grammarBuilder.append("KW1283 : 'KW' '1283';\n"); grammarBuilder.append("KW1284 : 'KW' '1284';\n"); grammarBuilder.append("KW1285 : 'KW' '1285';\n"); grammarBuilder.append("KW1286 : 'KW' '1286';\n"); grammarBuilder.append("KW1287 : 'KW' '1287';\n"); grammarBuilder.append("KW1288 : 'KW' '1288';\n"); grammarBuilder.append("KW1289 : 'KW' '1289';\n"); grammarBuilder.append("KW1290 : 'KW' '1290';\n"); grammarBuilder.append("KW1291 : 'KW' '1291';\n"); grammarBuilder.append("KW1292 : 'KW' '1292';\n"); grammarBuilder.append("KW1293 : 'KW' '1293';\n"); grammarBuilder.append("KW1294 : 'KW' '1294';\n"); grammarBuilder.append("KW1295 : 'KW' '1295';\n"); grammarBuilder.append("KW1296 : 'KW' '1296';\n"); grammarBuilder.append("KW1297 : 'KW' '1297';\n"); grammarBuilder.append("KW1298 : 'KW' '1298';\n"); grammarBuilder.append("KW1299 : 'KW' '1299';\n"); grammarBuilder.append("KW1300 : 'KW' '1300';\n"); grammarBuilder.append("KW1301 : 'KW' '1301';\n"); grammarBuilder.append("KW1302 : 'KW' '1302';\n"); grammarBuilder.append("KW1303 : 'KW' '1303';\n"); grammarBuilder.append("KW1304 : 'KW' '1304';\n"); grammarBuilder.append("KW1305 : 'KW' '1305';\n"); grammarBuilder.append("KW1306 : 'KW' '1306';\n"); grammarBuilder.append("KW1307 : 'KW' '1307';\n"); grammarBuilder.append("KW1308 : 'KW' '1308';\n"); grammarBuilder.append("KW1309 : 'KW' '1309';\n"); grammarBuilder.append("KW1310 : 'KW' '1310';\n"); grammarBuilder.append("KW1311 : 'KW' '1311';\n"); grammarBuilder.append("KW1312 : 'KW' '1312';\n"); grammarBuilder.append("KW1313 : 'KW' '1313';\n"); grammarBuilder.append("KW1314 : 'KW' '1314';\n"); grammarBuilder.append("KW1315 : 'KW' '1315';\n"); grammarBuilder.append("KW1316 : 'KW' '1316';\n"); grammarBuilder.append("KW1317 : 'KW' '1317';\n"); grammarBuilder.append("KW1318 : 'KW' '1318';\n"); grammarBuilder.append("KW1319 : 'KW' '1319';\n"); grammarBuilder.append("KW1320 : 'KW' '1320';\n"); grammarBuilder.append("KW1321 : 'KW' '1321';\n"); grammarBuilder.append("KW1322 : 'KW' '1322';\n"); grammarBuilder.append("KW1323 : 'KW' '1323';\n"); grammarBuilder.append("KW1324 : 'KW' '1324';\n"); grammarBuilder.append("KW1325 : 'KW' '1325';\n"); grammarBuilder.append("KW1326 : 'KW' '1326';\n"); grammarBuilder.append("KW1327 : 'KW' '1327';\n"); grammarBuilder.append("KW1328 : 'KW' '1328';\n"); grammarBuilder.append("KW1329 : 'KW' '1329';\n"); grammarBuilder.append("KW1330 : 'KW' '1330';\n"); grammarBuilder.append("KW1331 : 'KW' '1331';\n"); grammarBuilder.append("KW1332 : 'KW' '1332';\n"); grammarBuilder.append("KW1333 : 'KW' '1333';\n"); grammarBuilder.append("KW1334 : 'KW' '1334';\n"); grammarBuilder.append("KW1335 : 'KW' '1335';\n"); grammarBuilder.append("KW1336 : 'KW' '1336';\n"); grammarBuilder.append("KW1337 : 'KW' '1337';\n"); grammarBuilder.append("KW1338 : 'KW' '1338';\n"); grammarBuilder.append("KW1339 : 'KW' '1339';\n"); grammarBuilder.append("KW1340 : 'KW' '1340';\n"); grammarBuilder.append("KW1341 : 'KW' '1341';\n"); grammarBuilder.append("KW1342 : 'KW' '1342';\n"); grammarBuilder.append("KW1343 : 'KW' '1343';\n"); grammarBuilder.append("KW1344 : 'KW' '1344';\n"); grammarBuilder.append("KW1345 : 'KW' '1345';\n"); grammarBuilder.append("KW1346 : 'KW' '1346';\n"); grammarBuilder.append("KW1347 : 'KW' '1347';\n"); grammarBuilder.append("KW1348 : 'KW' '1348';\n"); grammarBuilder.append("KW1349 : 'KW' '1349';\n"); grammarBuilder.append("KW1350 : 'KW' '1350';\n"); grammarBuilder.append("KW1351 : 'KW' '1351';\n"); grammarBuilder.append("KW1352 : 'KW' '1352';\n"); grammarBuilder.append("KW1353 : 'KW' '1353';\n"); grammarBuilder.append("KW1354 : 'KW' '1354';\n"); grammarBuilder.append("KW1355 : 'KW' '1355';\n"); grammarBuilder.append("KW1356 : 'KW' '1356';\n"); grammarBuilder.append("KW1357 : 'KW' '1357';\n"); grammarBuilder.append("KW1358 : 'KW' '1358';\n"); grammarBuilder.append("KW1359 : 'KW' '1359';\n"); grammarBuilder.append("KW1360 : 'KW' '1360';\n"); grammarBuilder.append("KW1361 : 'KW' '1361';\n"); grammarBuilder.append("KW1362 : 'KW' '1362';\n"); grammarBuilder.append("KW1363 : 'KW' '1363';\n"); grammarBuilder.append("KW1364 : 'KW' '1364';\n"); grammarBuilder.append("KW1365 : 'KW' '1365';\n"); grammarBuilder.append("KW1366 : 'KW' '1366';\n"); grammarBuilder.append("KW1367 : 'KW' '1367';\n"); grammarBuilder.append("KW1368 : 'KW' '1368';\n"); grammarBuilder.append("KW1369 : 'KW' '1369';\n"); grammarBuilder.append("KW1370 : 'KW' '1370';\n"); grammarBuilder.append("KW1371 : 'KW' '1371';\n"); grammarBuilder.append("KW1372 : 'KW' '1372';\n"); grammarBuilder.append("KW1373 : 'KW' '1373';\n"); grammarBuilder.append("KW1374 : 'KW' '1374';\n"); grammarBuilder.append("KW1375 : 'KW' '1375';\n"); grammarBuilder.append("KW1376 : 'KW' '1376';\n"); grammarBuilder.append("KW1377 : 'KW' '1377';\n"); grammarBuilder.append("KW1378 : 'KW' '1378';\n"); grammarBuilder.append("KW1379 : 'KW' '1379';\n"); grammarBuilder.append("KW1380 : 'KW' '1380';\n"); grammarBuilder.append("KW1381 : 'KW' '1381';\n"); grammarBuilder.append("KW1382 : 'KW' '1382';\n"); grammarBuilder.append("KW1383 : 'KW' '1383';\n"); grammarBuilder.append("KW1384 : 'KW' '1384';\n"); grammarBuilder.append("KW1385 : 'KW' '1385';\n"); grammarBuilder.append("KW1386 : 'KW' '1386';\n"); grammarBuilder.append("KW1387 : 'KW' '1387';\n"); grammarBuilder.append("KW1388 : 'KW' '1388';\n"); grammarBuilder.append("KW1389 : 'KW' '1389';\n"); grammarBuilder.append("KW1390 : 'KW' '1390';\n"); grammarBuilder.append("KW1391 : 'KW' '1391';\n"); grammarBuilder.append("KW1392 : 'KW' '1392';\n"); grammarBuilder.append("KW1393 : 'KW' '1393';\n"); grammarBuilder.append("KW1394 : 'KW' '1394';\n"); grammarBuilder.append("KW1395 : 'KW' '1395';\n"); grammarBuilder.append("KW1396 : 'KW' '1396';\n"); grammarBuilder.append("KW1397 : 'KW' '1397';\n"); grammarBuilder.append("KW1398 : 'KW' '1398';\n"); grammarBuilder.append("KW1399 : 'KW' '1399';\n"); grammarBuilder.append("KW1400 : 'KW' '1400';\n"); grammarBuilder.append("KW1401 : 'KW' '1401';\n"); grammarBuilder.append("KW1402 : 'KW' '1402';\n"); grammarBuilder.append("KW1403 : 'KW' '1403';\n"); grammarBuilder.append("KW1404 : 'KW' '1404';\n"); grammarBuilder.append("KW1405 : 'KW' '1405';\n"); grammarBuilder.append("KW1406 : 'KW' '1406';\n"); grammarBuilder.append("KW1407 : 'KW' '1407';\n"); grammarBuilder.append("KW1408 : 'KW' '1408';\n"); grammarBuilder.append("KW1409 : 'KW' '1409';\n"); grammarBuilder.append("KW1410 : 'KW' '1410';\n"); grammarBuilder.append("KW1411 : 'KW' '1411';\n"); grammarBuilder.append("KW1412 : 'KW' '1412';\n"); grammarBuilder.append("KW1413 : 'KW' '1413';\n"); grammarBuilder.append("KW1414 : 'KW' '1414';\n"); grammarBuilder.append("KW1415 : 'KW' '1415';\n"); grammarBuilder.append("KW1416 : 'KW' '1416';\n"); grammarBuilder.append("KW1417 : 'KW' '1417';\n"); grammarBuilder.append("KW1418 : 'KW' '1418';\n"); grammarBuilder.append("KW1419 : 'KW' '1419';\n"); grammarBuilder.append("KW1420 : 'KW' '1420';\n"); grammarBuilder.append("KW1421 : 'KW' '1421';\n"); grammarBuilder.append("KW1422 : 'KW' '1422';\n"); grammarBuilder.append("KW1423 : 'KW' '1423';\n"); grammarBuilder.append("KW1424 : 'KW' '1424';\n"); grammarBuilder.append("KW1425 : 'KW' '1425';\n"); grammarBuilder.append("KW1426 : 'KW' '1426';\n"); grammarBuilder.append("KW1427 : 'KW' '1427';\n"); grammarBuilder.append("KW1428 : 'KW' '1428';\n"); grammarBuilder.append("KW1429 : 'KW' '1429';\n"); grammarBuilder.append("KW1430 : 'KW' '1430';\n"); grammarBuilder.append("KW1431 : 'KW' '1431';\n"); grammarBuilder.append("KW1432 : 'KW' '1432';\n"); grammarBuilder.append("KW1433 : 'KW' '1433';\n"); grammarBuilder.append("KW1434 : 'KW' '1434';\n"); grammarBuilder.append("KW1435 : 'KW' '1435';\n"); grammarBuilder.append("KW1436 : 'KW' '1436';\n"); grammarBuilder.append("KW1437 : 'KW' '1437';\n"); grammarBuilder.append("KW1438 : 'KW' '1438';\n"); grammarBuilder.append("KW1439 : 'KW' '1439';\n"); grammarBuilder.append("KW1440 : 'KW' '1440';\n"); grammarBuilder.append("KW1441 : 'KW' '1441';\n"); grammarBuilder.append("KW1442 : 'KW' '1442';\n"); grammarBuilder.append("KW1443 : 'KW' '1443';\n"); grammarBuilder.append("KW1444 : 'KW' '1444';\n"); grammarBuilder.append("KW1445 : 'KW' '1445';\n"); grammarBuilder.append("KW1446 : 'KW' '1446';\n"); grammarBuilder.append("KW1447 : 'KW' '1447';\n"); grammarBuilder.append("KW1448 : 'KW' '1448';\n"); grammarBuilder.append("KW1449 : 'KW' '1449';\n"); grammarBuilder.append("KW1450 : 'KW' '1450';\n"); grammarBuilder.append("KW1451 : 'KW' '1451';\n"); grammarBuilder.append("KW1452 : 'KW' '1452';\n"); grammarBuilder.append("KW1453 : 'KW' '1453';\n"); grammarBuilder.append("KW1454 : 'KW' '1454';\n"); grammarBuilder.append("KW1455 : 'KW' '1455';\n"); grammarBuilder.append("KW1456 : 'KW' '1456';\n"); grammarBuilder.append("KW1457 : 'KW' '1457';\n"); grammarBuilder.append("KW1458 : 'KW' '1458';\n"); grammarBuilder.append("KW1459 : 'KW' '1459';\n"); grammarBuilder.append("KW1460 : 'KW' '1460';\n"); grammarBuilder.append("KW1461 : 'KW' '1461';\n"); grammarBuilder.append("KW1462 : 'KW' '1462';\n"); grammarBuilder.append("KW1463 : 'KW' '1463';\n"); grammarBuilder.append("KW1464 : 'KW' '1464';\n"); grammarBuilder.append("KW1465 : 'KW' '1465';\n"); grammarBuilder.append("KW1466 : 'KW' '1466';\n"); grammarBuilder.append("KW1467 : 'KW' '1467';\n"); grammarBuilder.append("KW1468 : 'KW' '1468';\n"); grammarBuilder.append("KW1469 : 'KW' '1469';\n"); grammarBuilder.append("KW1470 : 'KW' '1470';\n"); grammarBuilder.append("KW1471 : 'KW' '1471';\n"); grammarBuilder.append("KW1472 : 'KW' '1472';\n"); grammarBuilder.append("KW1473 : 'KW' '1473';\n"); grammarBuilder.append("KW1474 : 'KW' '1474';\n"); grammarBuilder.append("KW1475 : 'KW' '1475';\n"); grammarBuilder.append("KW1476 : 'KW' '1476';\n"); grammarBuilder.append("KW1477 : 'KW' '1477';\n"); grammarBuilder.append("KW1478 : 'KW' '1478';\n"); grammarBuilder.append("KW1479 : 'KW' '1479';\n"); grammarBuilder.append("KW1480 : 'KW' '1480';\n"); grammarBuilder.append("KW1481 : 'KW' '1481';\n"); grammarBuilder.append("KW1482 : 'KW' '1482';\n"); grammarBuilder.append("KW1483 : 'KW' '1483';\n"); grammarBuilder.append("KW1484 : 'KW' '1484';\n"); grammarBuilder.append("KW1485 : 'KW' '1485';\n"); grammarBuilder.append("KW1486 : 'KW' '1486';\n"); grammarBuilder.append("KW1487 : 'KW' '1487';\n"); grammarBuilder.append("KW1488 : 'KW' '1488';\n"); grammarBuilder.append("KW1489 : 'KW' '1489';\n"); grammarBuilder.append("KW1490 : 'KW' '1490';\n"); grammarBuilder.append("KW1491 : 'KW' '1491';\n"); grammarBuilder.append("KW1492 : 'KW' '1492';\n"); grammarBuilder.append("KW1493 : 'KW' '1493';\n"); grammarBuilder.append("KW1494 : 'KW' '1494';\n"); grammarBuilder.append("KW1495 : 'KW' '1495';\n"); grammarBuilder.append("KW1496 : 'KW' '1496';\n"); grammarBuilder.append("KW1497 : 'KW' '1497';\n"); grammarBuilder.append("KW1498 : 'KW' '1498';\n"); grammarBuilder.append("KW1499 : 'KW' '1499';\n"); grammarBuilder.append("KW1500 : 'KW' '1500';\n"); grammarBuilder.append("KW1501 : 'KW' '1501';\n"); grammarBuilder.append("KW1502 : 'KW' '1502';\n"); grammarBuilder.append("KW1503 : 'KW' '1503';\n"); grammarBuilder.append("KW1504 : 'KW' '1504';\n"); grammarBuilder.append("KW1505 : 'KW' '1505';\n"); grammarBuilder.append("KW1506 : 'KW' '1506';\n"); grammarBuilder.append("KW1507 : 'KW' '1507';\n"); grammarBuilder.append("KW1508 : 'KW' '1508';\n"); grammarBuilder.append("KW1509 : 'KW' '1509';\n"); grammarBuilder.append("KW1510 : 'KW' '1510';\n"); grammarBuilder.append("KW1511 : 'KW' '1511';\n"); grammarBuilder.append("KW1512 : 'KW' '1512';\n"); grammarBuilder.append("KW1513 : 'KW' '1513';\n"); grammarBuilder.append("KW1514 : 'KW' '1514';\n"); grammarBuilder.append("KW1515 : 'KW' '1515';\n"); grammarBuilder.append("KW1516 : 'KW' '1516';\n"); grammarBuilder.append("KW1517 : 'KW' '1517';\n"); grammarBuilder.append("KW1518 : 'KW' '1518';\n"); grammarBuilder.append("KW1519 : 'KW' '1519';\n"); grammarBuilder.append("KW1520 : 'KW' '1520';\n"); grammarBuilder.append("KW1521 : 'KW' '1521';\n"); grammarBuilder.append("KW1522 : 'KW' '1522';\n"); grammarBuilder.append("KW1523 : 'KW' '1523';\n"); grammarBuilder.append("KW1524 : 'KW' '1524';\n"); grammarBuilder.append("KW1525 : 'KW' '1525';\n"); grammarBuilder.append("KW1526 : 'KW' '1526';\n"); grammarBuilder.append("KW1527 : 'KW' '1527';\n"); grammarBuilder.append("KW1528 : 'KW' '1528';\n"); grammarBuilder.append("KW1529 : 'KW' '1529';\n"); grammarBuilder.append("KW1530 : 'KW' '1530';\n"); grammarBuilder.append("KW1531 : 'KW' '1531';\n"); grammarBuilder.append("KW1532 : 'KW' '1532';\n"); grammarBuilder.append("KW1533 : 'KW' '1533';\n"); grammarBuilder.append("KW1534 : 'KW' '1534';\n"); grammarBuilder.append("KW1535 : 'KW' '1535';\n"); grammarBuilder.append("KW1536 : 'KW' '1536';\n"); grammarBuilder.append("KW1537 : 'KW' '1537';\n"); grammarBuilder.append("KW1538 : 'KW' '1538';\n"); grammarBuilder.append("KW1539 : 'KW' '1539';\n"); grammarBuilder.append("KW1540 : 'KW' '1540';\n"); grammarBuilder.append("KW1541 : 'KW' '1541';\n"); grammarBuilder.append("KW1542 : 'KW' '1542';\n"); grammarBuilder.append("KW1543 : 'KW' '1543';\n"); grammarBuilder.append("KW1544 : 'KW' '1544';\n"); grammarBuilder.append("KW1545 : 'KW' '1545';\n"); grammarBuilder.append("KW1546 : 'KW' '1546';\n"); grammarBuilder.append("KW1547 : 'KW' '1547';\n"); grammarBuilder.append("KW1548 : 'KW' '1548';\n"); grammarBuilder.append("KW1549 : 'KW' '1549';\n"); grammarBuilder.append("KW1550 : 'KW' '1550';\n"); grammarBuilder.append("KW1551 : 'KW' '1551';\n"); grammarBuilder.append("KW1552 : 'KW' '1552';\n"); grammarBuilder.append("KW1553 : 'KW' '1553';\n"); grammarBuilder.append("KW1554 : 'KW' '1554';\n"); grammarBuilder.append("KW1555 : 'KW' '1555';\n"); grammarBuilder.append("KW1556 : 'KW' '1556';\n"); grammarBuilder.append("KW1557 : 'KW' '1557';\n"); grammarBuilder.append("KW1558 : 'KW' '1558';\n"); grammarBuilder.append("KW1559 : 'KW' '1559';\n"); grammarBuilder.append("KW1560 : 'KW' '1560';\n"); grammarBuilder.append("KW1561 : 'KW' '1561';\n"); grammarBuilder.append("KW1562 : 'KW' '1562';\n"); grammarBuilder.append("KW1563 : 'KW' '1563';\n"); grammarBuilder.append("KW1564 : 'KW' '1564';\n"); grammarBuilder.append("KW1565 : 'KW' '1565';\n"); grammarBuilder.append("KW1566 : 'KW' '1566';\n"); grammarBuilder.append("KW1567 : 'KW' '1567';\n"); grammarBuilder.append("KW1568 : 'KW' '1568';\n"); grammarBuilder.append("KW1569 : 'KW' '1569';\n"); grammarBuilder.append("KW1570 : 'KW' '1570';\n"); grammarBuilder.append("KW1571 : 'KW' '1571';\n"); grammarBuilder.append("KW1572 : 'KW' '1572';\n"); grammarBuilder.append("KW1573 : 'KW' '1573';\n"); grammarBuilder.append("KW1574 : 'KW' '1574';\n"); grammarBuilder.append("KW1575 : 'KW' '1575';\n"); grammarBuilder.append("KW1576 : 'KW' '1576';\n"); grammarBuilder.append("KW1577 : 'KW' '1577';\n"); grammarBuilder.append("KW1578 : 'KW' '1578';\n"); grammarBuilder.append("KW1579 : 'KW' '1579';\n"); grammarBuilder.append("KW1580 : 'KW' '1580';\n"); grammarBuilder.append("KW1581 : 'KW' '1581';\n"); grammarBuilder.append("KW1582 : 'KW' '1582';\n"); grammarBuilder.append("KW1583 : 'KW' '1583';\n"); grammarBuilder.append("KW1584 : 'KW' '1584';\n"); grammarBuilder.append("KW1585 : 'KW' '1585';\n"); grammarBuilder.append("KW1586 : 'KW' '1586';\n"); grammarBuilder.append("KW1587 : 'KW' '1587';\n"); grammarBuilder.append("KW1588 : 'KW' '1588';\n"); grammarBuilder.append("KW1589 : 'KW' '1589';\n"); grammarBuilder.append("KW1590 : 'KW' '1590';\n"); grammarBuilder.append("KW1591 : 'KW' '1591';\n"); grammarBuilder.append("KW1592 : 'KW' '1592';\n"); grammarBuilder.append("KW1593 : 'KW' '1593';\n"); grammarBuilder.append("KW1594 : 'KW' '1594';\n"); grammarBuilder.append("KW1595 : 'KW' '1595';\n"); grammarBuilder.append("KW1596 : 'KW' '1596';\n"); grammarBuilder.append("KW1597 : 'KW' '1597';\n"); grammarBuilder.append("KW1598 : 'KW' '1598';\n"); grammarBuilder.append("KW1599 : 'KW' '1599';\n"); grammarBuilder.append("KW1600 : 'KW' '1600';\n"); grammarBuilder.append("KW1601 : 'KW' '1601';\n"); grammarBuilder.append("KW1602 : 'KW' '1602';\n"); grammarBuilder.append("KW1603 : 'KW' '1603';\n"); grammarBuilder.append("KW1604 : 'KW' '1604';\n"); grammarBuilder.append("KW1605 : 'KW' '1605';\n"); grammarBuilder.append("KW1606 : 'KW' '1606';\n"); grammarBuilder.append("KW1607 : 'KW' '1607';\n"); grammarBuilder.append("KW1608 : 'KW' '1608';\n"); grammarBuilder.append("KW1609 : 'KW' '1609';\n"); grammarBuilder.append("KW1610 : 'KW' '1610';\n"); grammarBuilder.append("KW1611 : 'KW' '1611';\n"); grammarBuilder.append("KW1612 : 'KW' '1612';\n"); grammarBuilder.append("KW1613 : 'KW' '1613';\n"); grammarBuilder.append("KW1614 : 'KW' '1614';\n"); grammarBuilder.append("KW1615 : 'KW' '1615';\n"); grammarBuilder.append("KW1616 : 'KW' '1616';\n"); grammarBuilder.append("KW1617 : 'KW' '1617';\n"); grammarBuilder.append("KW1618 : 'KW' '1618';\n"); grammarBuilder.append("KW1619 : 'KW' '1619';\n"); grammarBuilder.append("KW1620 : 'KW' '1620';\n"); grammarBuilder.append("KW1621 : 'KW' '1621';\n"); grammarBuilder.append("KW1622 : 'KW' '1622';\n"); grammarBuilder.append("KW1623 : 'KW' '1623';\n"); grammarBuilder.append("KW1624 : 'KW' '1624';\n"); grammarBuilder.append("KW1625 : 'KW' '1625';\n"); grammarBuilder.append("KW1626 : 'KW' '1626';\n"); grammarBuilder.append("KW1627 : 'KW' '1627';\n"); grammarBuilder.append("KW1628 : 'KW' '1628';\n"); grammarBuilder.append("KW1629 : 'KW' '1629';\n"); grammarBuilder.append("KW1630 : 'KW' '1630';\n"); grammarBuilder.append("KW1631 : 'KW' '1631';\n"); grammarBuilder.append("KW1632 : 'KW' '1632';\n"); grammarBuilder.append("KW1633 : 'KW' '1633';\n"); grammarBuilder.append("KW1634 : 'KW' '1634';\n"); grammarBuilder.append("KW1635 : 'KW' '1635';\n"); grammarBuilder.append("KW1636 : 'KW' '1636';\n"); grammarBuilder.append("KW1637 : 'KW' '1637';\n"); grammarBuilder.append("KW1638 : 'KW' '1638';\n"); grammarBuilder.append("KW1639 : 'KW' '1639';\n"); grammarBuilder.append("KW1640 : 'KW' '1640';\n"); grammarBuilder.append("KW1641 : 'KW' '1641';\n"); grammarBuilder.append("KW1642 : 'KW' '1642';\n"); grammarBuilder.append("KW1643 : 'KW' '1643';\n"); grammarBuilder.append("KW1644 : 'KW' '1644';\n"); grammarBuilder.append("KW1645 : 'KW' '1645';\n"); grammarBuilder.append("KW1646 : 'KW' '1646';\n"); grammarBuilder.append("KW1647 : 'KW' '1647';\n"); grammarBuilder.append("KW1648 : 'KW' '1648';\n"); grammarBuilder.append("KW1649 : 'KW' '1649';\n"); grammarBuilder.append("KW1650 : 'KW' '1650';\n"); grammarBuilder.append("KW1651 : 'KW' '1651';\n"); grammarBuilder.append("KW1652 : 'KW' '1652';\n"); grammarBuilder.append("KW1653 : 'KW' '1653';\n"); grammarBuilder.append("KW1654 : 'KW' '1654';\n"); grammarBuilder.append("KW1655 : 'KW' '1655';\n"); grammarBuilder.append("KW1656 : 'KW' '1656';\n"); grammarBuilder.append("KW1657 : 'KW' '1657';\n"); grammarBuilder.append("KW1658 : 'KW' '1658';\n"); grammarBuilder.append("KW1659 : 'KW' '1659';\n"); grammarBuilder.append("KW1660 : 'KW' '1660';\n"); grammarBuilder.append("KW1661 : 'KW' '1661';\n"); grammarBuilder.append("KW1662 : 'KW' '1662';\n"); grammarBuilder.append("KW1663 : 'KW' '1663';\n"); grammarBuilder.append("KW1664 : 'KW' '1664';\n"); grammarBuilder.append("KW1665 : 'KW' '1665';\n"); grammarBuilder.append("KW1666 : 'KW' '1666';\n"); grammarBuilder.append("KW1667 : 'KW' '1667';\n"); grammarBuilder.append("KW1668 : 'KW' '1668';\n"); grammarBuilder.append("KW1669 : 'KW' '1669';\n"); grammarBuilder.append("KW1670 : 'KW' '1670';\n"); grammarBuilder.append("KW1671 : 'KW' '1671';\n"); grammarBuilder.append("KW1672 : 'KW' '1672';\n"); grammarBuilder.append("KW1673 : 'KW' '1673';\n"); grammarBuilder.append("KW1674 : 'KW' '1674';\n"); grammarBuilder.append("KW1675 : 'KW' '1675';\n"); grammarBuilder.append("KW1676 : 'KW' '1676';\n"); grammarBuilder.append("KW1677 : 'KW' '1677';\n"); grammarBuilder.append("KW1678 : 'KW' '1678';\n"); grammarBuilder.append("KW1679 : 'KW' '1679';\n"); grammarBuilder.append("KW1680 : 'KW' '1680';\n"); grammarBuilder.append("KW1681 : 'KW' '1681';\n"); grammarBuilder.append("KW1682 : 'KW' '1682';\n"); grammarBuilder.append("KW1683 : 'KW' '1683';\n"); grammarBuilder.append("KW1684 : 'KW' '1684';\n"); grammarBuilder.append("KW1685 : 'KW' '1685';\n"); grammarBuilder.append("KW1686 : 'KW' '1686';\n"); grammarBuilder.append("KW1687 : 'KW' '1687';\n"); grammarBuilder.append("KW1688 : 'KW' '1688';\n"); grammarBuilder.append("KW1689 : 'KW' '1689';\n"); grammarBuilder.append("KW1690 : 'KW' '1690';\n"); grammarBuilder.append("KW1691 : 'KW' '1691';\n"); grammarBuilder.append("KW1692 : 'KW' '1692';\n"); grammarBuilder.append("KW1693 : 'KW' '1693';\n"); grammarBuilder.append("KW1694 : 'KW' '1694';\n"); grammarBuilder.append("KW1695 : 'KW' '1695';\n"); grammarBuilder.append("KW1696 : 'KW' '1696';\n"); grammarBuilder.append("KW1697 : 'KW' '1697';\n"); grammarBuilder.append("KW1698 : 'KW' '1698';\n"); grammarBuilder.append("KW1699 : 'KW' '1699';\n"); grammarBuilder.append("KW1700 : 'KW' '1700';\n"); grammarBuilder.append("KW1701 : 'KW' '1701';\n"); grammarBuilder.append("KW1702 : 'KW' '1702';\n"); grammarBuilder.append("KW1703 : 'KW' '1703';\n"); grammarBuilder.append("KW1704 : 'KW' '1704';\n"); grammarBuilder.append("KW1705 : 'KW' '1705';\n"); grammarBuilder.append("KW1706 : 'KW' '1706';\n"); grammarBuilder.append("KW1707 : 'KW' '1707';\n"); grammarBuilder.append("KW1708 : 'KW' '1708';\n"); grammarBuilder.append("KW1709 : 'KW' '1709';\n"); grammarBuilder.append("KW1710 : 'KW' '1710';\n"); grammarBuilder.append("KW1711 : 'KW' '1711';\n"); grammarBuilder.append("KW1712 : 'KW' '1712';\n"); grammarBuilder.append("KW1713 : 'KW' '1713';\n"); grammarBuilder.append("KW1714 : 'KW' '1714';\n"); grammarBuilder.append("KW1715 : 'KW' '1715';\n"); grammarBuilder.append("KW1716 : 'KW' '1716';\n"); grammarBuilder.append("KW1717 : 'KW' '1717';\n"); grammarBuilder.append("KW1718 : 'KW' '1718';\n"); grammarBuilder.append("KW1719 : 'KW' '1719';\n"); grammarBuilder.append("KW1720 : 'KW' '1720';\n"); grammarBuilder.append("KW1721 : 'KW' '1721';\n"); grammarBuilder.append("KW1722 : 'KW' '1722';\n"); grammarBuilder.append("KW1723 : 'KW' '1723';\n"); grammarBuilder.append("KW1724 : 'KW' '1724';\n"); grammarBuilder.append("KW1725 : 'KW' '1725';\n"); grammarBuilder.append("KW1726 : 'KW' '1726';\n"); grammarBuilder.append("KW1727 : 'KW' '1727';\n"); grammarBuilder.append("KW1728 : 'KW' '1728';\n"); grammarBuilder.append("KW1729 : 'KW' '1729';\n"); grammarBuilder.append("KW1730 : 'KW' '1730';\n"); grammarBuilder.append("KW1731 : 'KW' '1731';\n"); grammarBuilder.append("KW1732 : 'KW' '1732';\n"); grammarBuilder.append("KW1733 : 'KW' '1733';\n"); grammarBuilder.append("KW1734 : 'KW' '1734';\n"); grammarBuilder.append("KW1735 : 'KW' '1735';\n"); grammarBuilder.append("KW1736 : 'KW' '1736';\n"); grammarBuilder.append("KW1737 : 'KW' '1737';\n"); grammarBuilder.append("KW1738 : 'KW' '1738';\n"); grammarBuilder.append("KW1739 : 'KW' '1739';\n"); grammarBuilder.append("KW1740 : 'KW' '1740';\n"); grammarBuilder.append("KW1741 : 'KW' '1741';\n"); grammarBuilder.append("KW1742 : 'KW' '1742';\n"); grammarBuilder.append("KW1743 : 'KW' '1743';\n"); grammarBuilder.append("KW1744 : 'KW' '1744';\n"); grammarBuilder.append("KW1745 : 'KW' '1745';\n"); grammarBuilder.append("KW1746 : 'KW' '1746';\n"); grammarBuilder.append("KW1747 : 'KW' '1747';\n"); grammarBuilder.append("KW1748 : 'KW' '1748';\n"); grammarBuilder.append("KW1749 : 'KW' '1749';\n"); grammarBuilder.append("KW1750 : 'KW' '1750';\n"); grammarBuilder.append("KW1751 : 'KW' '1751';\n"); grammarBuilder.append("KW1752 : 'KW' '1752';\n"); grammarBuilder.append("KW1753 : 'KW' '1753';\n"); grammarBuilder.append("KW1754 : 'KW' '1754';\n"); grammarBuilder.append("KW1755 : 'KW' '1755';\n"); grammarBuilder.append("KW1756 : 'KW' '1756';\n"); grammarBuilder.append("KW1757 : 'KW' '1757';\n"); grammarBuilder.append("KW1758 : 'KW' '1758';\n"); grammarBuilder.append("KW1759 : 'KW' '1759';\n"); grammarBuilder.append("KW1760 : 'KW' '1760';\n"); grammarBuilder.append("KW1761 : 'KW' '1761';\n"); grammarBuilder.append("KW1762 : 'KW' '1762';\n"); grammarBuilder.append("KW1763 : 'KW' '1763';\n"); grammarBuilder.append("KW1764 : 'KW' '1764';\n"); grammarBuilder.append("KW1765 : 'KW' '1765';\n"); grammarBuilder.append("KW1766 : 'KW' '1766';\n"); grammarBuilder.append("KW1767 : 'KW' '1767';\n"); grammarBuilder.append("KW1768 : 'KW' '1768';\n"); grammarBuilder.append("KW1769 : 'KW' '1769';\n"); grammarBuilder.append("KW1770 : 'KW' '1770';\n"); grammarBuilder.append("KW1771 : 'KW' '1771';\n"); grammarBuilder.append("KW1772 : 'KW' '1772';\n"); grammarBuilder.append("KW1773 : 'KW' '1773';\n"); grammarBuilder.append("KW1774 : 'KW' '1774';\n"); grammarBuilder.append("KW1775 : 'KW' '1775';\n"); grammarBuilder.append("KW1776 : 'KW' '1776';\n"); grammarBuilder.append("KW1777 : 'KW' '1777';\n"); grammarBuilder.append("KW1778 : 'KW' '1778';\n"); grammarBuilder.append("KW1779 : 'KW' '1779';\n"); grammarBuilder.append("KW1780 : 'KW' '1780';\n"); grammarBuilder.append("KW1781 : 'KW' '1781';\n"); grammarBuilder.append("KW1782 : 'KW' '1782';\n"); grammarBuilder.append("KW1783 : 'KW' '1783';\n"); grammarBuilder.append("KW1784 : 'KW' '1784';\n"); grammarBuilder.append("KW1785 : 'KW' '1785';\n"); grammarBuilder.append("KW1786 : 'KW' '1786';\n"); grammarBuilder.append("KW1787 : 'KW' '1787';\n"); grammarBuilder.append("KW1788 : 'KW' '1788';\n"); grammarBuilder.append("KW1789 : 'KW' '1789';\n"); grammarBuilder.append("KW1790 : 'KW' '1790';\n"); grammarBuilder.append("KW1791 : 'KW' '1791';\n"); grammarBuilder.append("KW1792 : 'KW' '1792';\n"); grammarBuilder.append("KW1793 : 'KW' '1793';\n"); grammarBuilder.append("KW1794 : 'KW' '1794';\n"); grammarBuilder.append("KW1795 : 'KW' '1795';\n"); grammarBuilder.append("KW1796 : 'KW' '1796';\n"); grammarBuilder.append("KW1797 : 'KW' '1797';\n"); grammarBuilder.append("KW1798 : 'KW' '1798';\n"); grammarBuilder.append("KW1799 : 'KW' '1799';\n"); grammarBuilder.append("KW1800 : 'KW' '1800';\n"); grammarBuilder.append("KW1801 : 'KW' '1801';\n"); grammarBuilder.append("KW1802 : 'KW' '1802';\n"); grammarBuilder.append("KW1803 : 'KW' '1803';\n"); grammarBuilder.append("KW1804 : 'KW' '1804';\n"); grammarBuilder.append("KW1805 : 'KW' '1805';\n"); grammarBuilder.append("KW1806 : 'KW' '1806';\n"); grammarBuilder.append("KW1807 : 'KW' '1807';\n"); grammarBuilder.append("KW1808 : 'KW' '1808';\n"); grammarBuilder.append("KW1809 : 'KW' '1809';\n"); grammarBuilder.append("KW1810 : 'KW' '1810';\n"); grammarBuilder.append("KW1811 : 'KW' '1811';\n"); grammarBuilder.append("KW1812 : 'KW' '1812';\n"); grammarBuilder.append("KW1813 : 'KW' '1813';\n"); grammarBuilder.append("KW1814 : 'KW' '1814';\n"); grammarBuilder.append("KW1815 : 'KW' '1815';\n"); grammarBuilder.append("KW1816 : 'KW' '1816';\n"); grammarBuilder.append("KW1817 : 'KW' '1817';\n"); grammarBuilder.append("KW1818 : 'KW' '1818';\n"); grammarBuilder.append("KW1819 : 'KW' '1819';\n"); grammarBuilder.append("KW1820 : 'KW' '1820';\n"); grammarBuilder.append("KW1821 : 'KW' '1821';\n"); grammarBuilder.append("KW1822 : 'KW' '1822';\n"); grammarBuilder.append("KW1823 : 'KW' '1823';\n"); grammarBuilder.append("KW1824 : 'KW' '1824';\n"); grammarBuilder.append("KW1825 : 'KW' '1825';\n"); grammarBuilder.append("KW1826 : 'KW' '1826';\n"); grammarBuilder.append("KW1827 : 'KW' '1827';\n"); grammarBuilder.append("KW1828 : 'KW' '1828';\n"); grammarBuilder.append("KW1829 : 'KW' '1829';\n"); grammarBuilder.append("KW1830 : 'KW' '1830';\n"); grammarBuilder.append("KW1831 : 'KW' '1831';\n"); grammarBuilder.append("KW1832 : 'KW' '1832';\n"); grammarBuilder.append("KW1833 : 'KW' '1833';\n"); grammarBuilder.append("KW1834 : 'KW' '1834';\n"); grammarBuilder.append("KW1835 : 'KW' '1835';\n"); grammarBuilder.append("KW1836 : 'KW' '1836';\n"); grammarBuilder.append("KW1837 : 'KW' '1837';\n"); grammarBuilder.append("KW1838 : 'KW' '1838';\n"); grammarBuilder.append("KW1839 : 'KW' '1839';\n"); grammarBuilder.append("KW1840 : 'KW' '1840';\n"); grammarBuilder.append("KW1841 : 'KW' '1841';\n"); grammarBuilder.append("KW1842 : 'KW' '1842';\n"); grammarBuilder.append("KW1843 : 'KW' '1843';\n"); grammarBuilder.append("KW1844 : 'KW' '1844';\n"); grammarBuilder.append("KW1845 : 'KW' '1845';\n"); grammarBuilder.append("KW1846 : 'KW' '1846';\n"); grammarBuilder.append("KW1847 : 'KW' '1847';\n"); grammarBuilder.append("KW1848 : 'KW' '1848';\n"); grammarBuilder.append("KW1849 : 'KW' '1849';\n"); grammarBuilder.append("KW1850 : 'KW' '1850';\n"); grammarBuilder.append("KW1851 : 'KW' '1851';\n"); grammarBuilder.append("KW1852 : 'KW' '1852';\n"); grammarBuilder.append("KW1853 : 'KW' '1853';\n"); grammarBuilder.append("KW1854 : 'KW' '1854';\n"); grammarBuilder.append("KW1855 : 'KW' '1855';\n"); grammarBuilder.append("KW1856 : 'KW' '1856';\n"); grammarBuilder.append("KW1857 : 'KW' '1857';\n"); grammarBuilder.append("KW1858 : 'KW' '1858';\n"); grammarBuilder.append("KW1859 : 'KW' '1859';\n"); grammarBuilder.append("KW1860 : 'KW' '1860';\n"); grammarBuilder.append("KW1861 : 'KW' '1861';\n"); grammarBuilder.append("KW1862 : 'KW' '1862';\n"); grammarBuilder.append("KW1863 : 'KW' '1863';\n"); grammarBuilder.append("KW1864 : 'KW' '1864';\n"); grammarBuilder.append("KW1865 : 'KW' '1865';\n"); grammarBuilder.append("KW1866 : 'KW' '1866';\n"); grammarBuilder.append("KW1867 : 'KW' '1867';\n"); grammarBuilder.append("KW1868 : 'KW' '1868';\n"); grammarBuilder.append("KW1869 : 'KW' '1869';\n"); grammarBuilder.append("KW1870 : 'KW' '1870';\n"); grammarBuilder.append("KW1871 : 'KW' '1871';\n"); grammarBuilder.append("KW1872 : 'KW' '1872';\n"); grammarBuilder.append("KW1873 : 'KW' '1873';\n"); grammarBuilder.append("KW1874 : 'KW' '1874';\n"); grammarBuilder.append("KW1875 : 'KW' '1875';\n"); grammarBuilder.append("KW1876 : 'KW' '1876';\n"); grammarBuilder.append("KW1877 : 'KW' '1877';\n"); grammarBuilder.append("KW1878 : 'KW' '1878';\n"); grammarBuilder.append("KW1879 : 'KW' '1879';\n"); grammarBuilder.append("KW1880 : 'KW' '1880';\n"); grammarBuilder.append("KW1881 : 'KW' '1881';\n"); grammarBuilder.append("KW1882 : 'KW' '1882';\n"); grammarBuilder.append("KW1883 : 'KW' '1883';\n"); grammarBuilder.append("KW1884 : 'KW' '1884';\n"); grammarBuilder.append("KW1885 : 'KW' '1885';\n"); grammarBuilder.append("KW1886 : 'KW' '1886';\n"); grammarBuilder.append("KW1887 : 'KW' '1887';\n"); grammarBuilder.append("KW1888 : 'KW' '1888';\n"); grammarBuilder.append("KW1889 : 'KW' '1889';\n"); grammarBuilder.append("KW1890 : 'KW' '1890';\n"); grammarBuilder.append("KW1891 : 'KW' '1891';\n"); grammarBuilder.append("KW1892 : 'KW' '1892';\n"); grammarBuilder.append("KW1893 : 'KW' '1893';\n"); grammarBuilder.append("KW1894 : 'KW' '1894';\n"); grammarBuilder.append("KW1895 : 'KW' '1895';\n"); grammarBuilder.append("KW1896 : 'KW' '1896';\n"); grammarBuilder.append("KW1897 : 'KW' '1897';\n"); grammarBuilder.append("KW1898 : 'KW' '1898';\n"); grammarBuilder.append("KW1899 : 'KW' '1899';\n"); grammarBuilder.append("KW1900 : 'KW' '1900';\n"); grammarBuilder.append("KW1901 : 'KW' '1901';\n"); grammarBuilder.append("KW1902 : 'KW' '1902';\n"); grammarBuilder.append("KW1903 : 'KW' '1903';\n"); grammarBuilder.append("KW1904 : 'KW' '1904';\n"); grammarBuilder.append("KW1905 : 'KW' '1905';\n"); grammarBuilder.append("KW1906 : 'KW' '1906';\n"); grammarBuilder.append("KW1907 : 'KW' '1907';\n"); grammarBuilder.append("KW1908 : 'KW' '1908';\n"); grammarBuilder.append("KW1909 : 'KW' '1909';\n"); grammarBuilder.append("KW1910 : 'KW' '1910';\n"); grammarBuilder.append("KW1911 : 'KW' '1911';\n"); grammarBuilder.append("KW1912 : 'KW' '1912';\n"); grammarBuilder.append("KW1913 : 'KW' '1913';\n"); grammarBuilder.append("KW1914 : 'KW' '1914';\n"); grammarBuilder.append("KW1915 : 'KW' '1915';\n"); grammarBuilder.append("KW1916 : 'KW' '1916';\n"); grammarBuilder.append("KW1917 : 'KW' '1917';\n"); grammarBuilder.append("KW1918 : 'KW' '1918';\n"); grammarBuilder.append("KW1919 : 'KW' '1919';\n"); grammarBuilder.append("KW1920 : 'KW' '1920';\n"); grammarBuilder.append("KW1921 : 'KW' '1921';\n"); grammarBuilder.append("KW1922 : 'KW' '1922';\n"); grammarBuilder.append("KW1923 : 'KW' '1923';\n"); grammarBuilder.append("KW1924 : 'KW' '1924';\n"); grammarBuilder.append("KW1925 : 'KW' '1925';\n"); grammarBuilder.append("KW1926 : 'KW' '1926';\n"); grammarBuilder.append("KW1927 : 'KW' '1927';\n"); grammarBuilder.append("KW1928 : 'KW' '1928';\n"); grammarBuilder.append("KW1929 : 'KW' '1929';\n"); grammarBuilder.append("KW1930 : 'KW' '1930';\n"); grammarBuilder.append("KW1931 : 'KW' '1931';\n"); grammarBuilder.append("KW1932 : 'KW' '1932';\n"); grammarBuilder.append("KW1933 : 'KW' '1933';\n"); grammarBuilder.append("KW1934 : 'KW' '1934';\n"); grammarBuilder.append("KW1935 : 'KW' '1935';\n"); grammarBuilder.append("KW1936 : 'KW' '1936';\n"); grammarBuilder.append("KW1937 : 'KW' '1937';\n"); grammarBuilder.append("KW1938 : 'KW' '1938';\n"); grammarBuilder.append("KW1939 : 'KW' '1939';\n"); grammarBuilder.append("KW1940 : 'KW' '1940';\n"); grammarBuilder.append("KW1941 : 'KW' '1941';\n"); grammarBuilder.append("KW1942 : 'KW' '1942';\n"); grammarBuilder.append("KW1943 : 'KW' '1943';\n"); grammarBuilder.append("KW1944 : 'KW' '1944';\n"); grammarBuilder.append("KW1945 : 'KW' '1945';\n"); grammarBuilder.append("KW1946 : 'KW' '1946';\n"); grammarBuilder.append("KW1947 : 'KW' '1947';\n"); grammarBuilder.append("KW1948 : 'KW' '1948';\n"); grammarBuilder.append("KW1949 : 'KW' '1949';\n"); grammarBuilder.append("KW1950 : 'KW' '1950';\n"); grammarBuilder.append("KW1951 : 'KW' '1951';\n"); grammarBuilder.append("KW1952 : 'KW' '1952';\n"); grammarBuilder.append("KW1953 : 'KW' '1953';\n"); grammarBuilder.append("KW1954 : 'KW' '1954';\n"); grammarBuilder.append("KW1955 : 'KW' '1955';\n"); grammarBuilder.append("KW1956 : 'KW' '1956';\n"); grammarBuilder.append("KW1957 : 'KW' '1957';\n"); grammarBuilder.append("KW1958 : 'KW' '1958';\n"); grammarBuilder.append("KW1959 : 'KW' '1959';\n"); grammarBuilder.append("KW1960 : 'KW' '1960';\n"); grammarBuilder.append("KW1961 : 'KW' '1961';\n"); grammarBuilder.append("KW1962 : 'KW' '1962';\n"); grammarBuilder.append("KW1963 : 'KW' '1963';\n"); grammarBuilder.append("KW1964 : 'KW' '1964';\n"); grammarBuilder.append("KW1965 : 'KW' '1965';\n"); grammarBuilder.append("KW1966 : 'KW' '1966';\n"); grammarBuilder.append("KW1967 : 'KW' '1967';\n"); grammarBuilder.append("KW1968 : 'KW' '1968';\n"); grammarBuilder.append("KW1969 : 'KW' '1969';\n"); grammarBuilder.append("KW1970 : 'KW' '1970';\n"); grammarBuilder.append("KW1971 : 'KW' '1971';\n"); grammarBuilder.append("KW1972 : 'KW' '1972';\n"); grammarBuilder.append("KW1973 : 'KW' '1973';\n"); grammarBuilder.append("KW1974 : 'KW' '1974';\n"); grammarBuilder.append("KW1975 : 'KW' '1975';\n"); grammarBuilder.append("KW1976 : 'KW' '1976';\n"); grammarBuilder.append("KW1977 : 'KW' '1977';\n"); grammarBuilder.append("KW1978 : 'KW' '1978';\n"); grammarBuilder.append("KW1979 : 'KW' '1979';\n"); grammarBuilder.append("KW1980 : 'KW' '1980';\n"); grammarBuilder.append("KW1981 : 'KW' '1981';\n"); grammarBuilder.append("KW1982 : 'KW' '1982';\n"); grammarBuilder.append("KW1983 : 'KW' '1983';\n"); grammarBuilder.append("KW1984 : 'KW' '1984';\n"); grammarBuilder.append("KW1985 : 'KW' '1985';\n"); grammarBuilder.append("KW1986 : 'KW' '1986';\n"); grammarBuilder.append("KW1987 : 'KW' '1987';\n"); grammarBuilder.append("KW1988 : 'KW' '1988';\n"); grammarBuilder.append("KW1989 : 'KW' '1989';\n"); grammarBuilder.append("KW1990 : 'KW' '1990';\n"); grammarBuilder.append("KW1991 : 'KW' '1991';\n"); grammarBuilder.append("KW1992 : 'KW' '1992';\n"); grammarBuilder.append("KW1993 : 'KW' '1993';\n"); grammarBuilder.append("KW1994 : 'KW' '1994';\n"); grammarBuilder.append("KW1995 : 'KW' '1995';\n"); grammarBuilder.append("KW1996 : 'KW' '1996';\n"); grammarBuilder.append("KW1997 : 'KW' '1997';\n"); grammarBuilder.append("KW1998 : 'KW' '1998';\n"); grammarBuilder.append("KW1999 : 'KW' '1999';\n"); grammarBuilder.append("KW2000 : 'KW' '2000';\n"); grammarBuilder.append("KW2001 : 'KW' '2001';\n"); grammarBuilder.append("KW2002 : 'KW' '2002';\n"); grammarBuilder.append("KW2003 : 'KW' '2003';\n"); grammarBuilder.append("KW2004 : 'KW' '2004';\n"); grammarBuilder.append("KW2005 : 'KW' '2005';\n"); grammarBuilder.append("KW2006 : 'KW' '2006';\n"); grammarBuilder.append("KW2007 : 'KW' '2007';\n"); grammarBuilder.append("KW2008 : 'KW' '2008';\n"); grammarBuilder.append("KW2009 : 'KW' '2009';\n"); grammarBuilder.append("KW2010 : 'KW' '2010';\n"); grammarBuilder.append("KW2011 : 'KW' '2011';\n"); grammarBuilder.append("KW2012 : 'KW' '2012';\n"); grammarBuilder.append("KW2013 : 'KW' '2013';\n"); grammarBuilder.append("KW2014 : 'KW' '2014';\n"); grammarBuilder.append("KW2015 : 'KW' '2015';\n"); grammarBuilder.append("KW2016 : 'KW' '2016';\n"); grammarBuilder.append("KW2017 : 'KW' '2017';\n"); grammarBuilder.append("KW2018 : 'KW' '2018';\n"); grammarBuilder.append("KW2019 : 'KW' '2019';\n"); grammarBuilder.append("KW2020 : 'KW' '2020';\n"); grammarBuilder.append("KW2021 : 'KW' '2021';\n"); grammarBuilder.append("KW2022 : 'KW' '2022';\n"); grammarBuilder.append("KW2023 : 'KW' '2023';\n"); grammarBuilder.append("KW2024 : 'KW' '2024';\n"); grammarBuilder.append("KW2025 : 'KW' '2025';\n"); grammarBuilder.append("KW2026 : 'KW' '2026';\n"); grammarBuilder.append("KW2027 : 'KW' '2027';\n"); grammarBuilder.append("KW2028 : 'KW' '2028';\n"); grammarBuilder.append("KW2029 : 'KW' '2029';\n"); grammarBuilder.append("KW2030 : 'KW' '2030';\n"); grammarBuilder.append("KW2031 : 'KW' '2031';\n"); grammarBuilder.append("KW2032 : 'KW' '2032';\n"); grammarBuilder.append("KW2033 : 'KW' '2033';\n"); grammarBuilder.append("KW2034 : 'KW' '2034';\n"); grammarBuilder.append("KW2035 : 'KW' '2035';\n"); grammarBuilder.append("KW2036 : 'KW' '2036';\n"); grammarBuilder.append("KW2037 : 'KW' '2037';\n"); grammarBuilder.append("KW2038 : 'KW' '2038';\n"); grammarBuilder.append("KW2039 : 'KW' '2039';\n"); grammarBuilder.append("KW2040 : 'KW' '2040';\n"); grammarBuilder.append("KW2041 : 'KW' '2041';\n"); grammarBuilder.append("KW2042 : 'KW' '2042';\n"); grammarBuilder.append("KW2043 : 'KW' '2043';\n"); grammarBuilder.append("KW2044 : 'KW' '2044';\n"); grammarBuilder.append("KW2045 : 'KW' '2045';\n"); grammarBuilder.append("KW2046 : 'KW' '2046';\n"); grammarBuilder.append("KW2047 : 'KW' '2047';\n"); grammarBuilder.append("KW2048 : 'KW' '2048';\n"); grammarBuilder.append("KW2049 : 'KW' '2049';\n"); grammarBuilder.append("KW2050 : 'KW' '2050';\n"); grammarBuilder.append("KW2051 : 'KW' '2051';\n"); grammarBuilder.append("KW2052 : 'KW' '2052';\n"); grammarBuilder.append("KW2053 : 'KW' '2053';\n"); grammarBuilder.append("KW2054 : 'KW' '2054';\n"); grammarBuilder.append("KW2055 : 'KW' '2055';\n"); grammarBuilder.append("KW2056 : 'KW' '2056';\n"); grammarBuilder.append("KW2057 : 'KW' '2057';\n"); grammarBuilder.append("KW2058 : 'KW' '2058';\n"); grammarBuilder.append("KW2059 : 'KW' '2059';\n"); grammarBuilder.append("KW2060 : 'KW' '2060';\n"); grammarBuilder.append("KW2061 : 'KW' '2061';\n"); grammarBuilder.append("KW2062 : 'KW' '2062';\n"); grammarBuilder.append("KW2063 : 'KW' '2063';\n"); grammarBuilder.append("KW2064 : 'KW' '2064';\n"); grammarBuilder.append("KW2065 : 'KW' '2065';\n"); grammarBuilder.append("KW2066 : 'KW' '2066';\n"); grammarBuilder.append("KW2067 : 'KW' '2067';\n"); grammarBuilder.append("KW2068 : 'KW' '2068';\n"); grammarBuilder.append("KW2069 : 'KW' '2069';\n"); grammarBuilder.append("KW2070 : 'KW' '2070';\n"); grammarBuilder.append("KW2071 : 'KW' '2071';\n"); grammarBuilder.append("KW2072 : 'KW' '2072';\n"); grammarBuilder.append("KW2073 : 'KW' '2073';\n"); grammarBuilder.append("KW2074 : 'KW' '2074';\n"); grammarBuilder.append("KW2075 : 'KW' '2075';\n"); grammarBuilder.append("KW2076 : 'KW' '2076';\n"); grammarBuilder.append("KW2077 : 'KW' '2077';\n"); grammarBuilder.append("KW2078 : 'KW' '2078';\n"); grammarBuilder.append("KW2079 : 'KW' '2079';\n"); grammarBuilder.append("KW2080 : 'KW' '2080';\n"); grammarBuilder.append("KW2081 : 'KW' '2081';\n"); grammarBuilder.append("KW2082 : 'KW' '2082';\n"); grammarBuilder.append("KW2083 : 'KW' '2083';\n"); grammarBuilder.append("KW2084 : 'KW' '2084';\n"); grammarBuilder.append("KW2085 : 'KW' '2085';\n"); grammarBuilder.append("KW2086 : 'KW' '2086';\n"); grammarBuilder.append("KW2087 : 'KW' '2087';\n"); grammarBuilder.append("KW2088 : 'KW' '2088';\n"); grammarBuilder.append("KW2089 : 'KW' '2089';\n"); grammarBuilder.append("KW2090 : 'KW' '2090';\n"); grammarBuilder.append("KW2091 : 'KW' '2091';\n"); grammarBuilder.append("KW2092 : 'KW' '2092';\n"); grammarBuilder.append("KW2093 : 'KW' '2093';\n"); grammarBuilder.append("KW2094 : 'KW' '2094';\n"); grammarBuilder.append("KW2095 : 'KW' '2095';\n"); grammarBuilder.append("KW2096 : 'KW' '2096';\n"); grammarBuilder.append("KW2097 : 'KW' '2097';\n"); grammarBuilder.append("KW2098 : 'KW' '2098';\n"); grammarBuilder.append("KW2099 : 'KW' '2099';\n"); grammarBuilder.append("KW2100 : 'KW' '2100';\n"); grammarBuilder.append("KW2101 : 'KW' '2101';\n"); grammarBuilder.append("KW2102 : 'KW' '2102';\n"); grammarBuilder.append("KW2103 : 'KW' '2103';\n"); grammarBuilder.append("KW2104 : 'KW' '2104';\n"); grammarBuilder.append("KW2105 : 'KW' '2105';\n"); grammarBuilder.append("KW2106 : 'KW' '2106';\n"); grammarBuilder.append("KW2107 : 'KW' '2107';\n"); grammarBuilder.append("KW2108 : 'KW' '2108';\n"); grammarBuilder.append("KW2109 : 'KW' '2109';\n"); grammarBuilder.append("KW2110 : 'KW' '2110';\n"); grammarBuilder.append("KW2111 : 'KW' '2111';\n"); grammarBuilder.append("KW2112 : 'KW' '2112';\n"); grammarBuilder.append("KW2113 : 'KW' '2113';\n"); grammarBuilder.append("KW2114 : 'KW' '2114';\n"); grammarBuilder.append("KW2115 : 'KW' '2115';\n"); grammarBuilder.append("KW2116 : 'KW' '2116';\n"); grammarBuilder.append("KW2117 : 'KW' '2117';\n"); grammarBuilder.append("KW2118 : 'KW' '2118';\n"); grammarBuilder.append("KW2119 : 'KW' '2119';\n"); grammarBuilder.append("KW2120 : 'KW' '2120';\n"); grammarBuilder.append("KW2121 : 'KW' '2121';\n"); grammarBuilder.append("KW2122 : 'KW' '2122';\n"); grammarBuilder.append("KW2123 : 'KW' '2123';\n"); grammarBuilder.append("KW2124 : 'KW' '2124';\n"); grammarBuilder.append("KW2125 : 'KW' '2125';\n"); grammarBuilder.append("KW2126 : 'KW' '2126';\n"); grammarBuilder.append("KW2127 : 'KW' '2127';\n"); grammarBuilder.append("KW2128 : 'KW' '2128';\n"); grammarBuilder.append("KW2129 : 'KW' '2129';\n"); grammarBuilder.append("KW2130 : 'KW' '2130';\n"); grammarBuilder.append("KW2131 : 'KW' '2131';\n"); grammarBuilder.append("KW2132 : 'KW' '2132';\n"); grammarBuilder.append("KW2133 : 'KW' '2133';\n"); grammarBuilder.append("KW2134 : 'KW' '2134';\n"); grammarBuilder.append("KW2135 : 'KW' '2135';\n"); grammarBuilder.append("KW2136 : 'KW' '2136';\n"); grammarBuilder.append("KW2137 : 'KW' '2137';\n"); grammarBuilder.append("KW2138 : 'KW' '2138';\n"); grammarBuilder.append("KW2139 : 'KW' '2139';\n"); grammarBuilder.append("KW2140 : 'KW' '2140';\n"); grammarBuilder.append("KW2141 : 'KW' '2141';\n"); grammarBuilder.append("KW2142 : 'KW' '2142';\n"); grammarBuilder.append("KW2143 : 'KW' '2143';\n"); grammarBuilder.append("KW2144 : 'KW' '2144';\n"); grammarBuilder.append("KW2145 : 'KW' '2145';\n"); grammarBuilder.append("KW2146 : 'KW' '2146';\n"); grammarBuilder.append("KW2147 : 'KW' '2147';\n"); grammarBuilder.append("KW2148 : 'KW' '2148';\n"); grammarBuilder.append("KW2149 : 'KW' '2149';\n"); grammarBuilder.append("KW2150 : 'KW' '2150';\n"); grammarBuilder.append("KW2151 : 'KW' '2151';\n"); grammarBuilder.append("KW2152 : 'KW' '2152';\n"); grammarBuilder.append("KW2153 : 'KW' '2153';\n"); grammarBuilder.append("KW2154 : 'KW' '2154';\n"); grammarBuilder.append("KW2155 : 'KW' '2155';\n"); grammarBuilder.append("KW2156 : 'KW' '2156';\n"); grammarBuilder.append("KW2157 : 'KW' '2157';\n"); grammarBuilder.append("KW2158 : 'KW' '2158';\n"); grammarBuilder.append("KW2159 : 'KW' '2159';\n"); grammarBuilder.append("KW2160 : 'KW' '2160';\n"); grammarBuilder.append("KW2161 : 'KW' '2161';\n"); grammarBuilder.append("KW2162 : 'KW' '2162';\n"); grammarBuilder.append("KW2163 : 'KW' '2163';\n"); grammarBuilder.append("KW2164 : 'KW' '2164';\n"); grammarBuilder.append("KW2165 : 'KW' '2165';\n"); grammarBuilder.append("KW2166 : 'KW' '2166';\n"); grammarBuilder.append("KW2167 : 'KW' '2167';\n"); grammarBuilder.append("KW2168 : 'KW' '2168';\n"); grammarBuilder.append("KW2169 : 'KW' '2169';\n"); grammarBuilder.append("KW2170 : 'KW' '2170';\n"); grammarBuilder.append("KW2171 : 'KW' '2171';\n"); grammarBuilder.append("KW2172 : 'KW' '2172';\n"); grammarBuilder.append("KW2173 : 'KW' '2173';\n"); grammarBuilder.append("KW2174 : 'KW' '2174';\n"); grammarBuilder.append("KW2175 : 'KW' '2175';\n"); grammarBuilder.append("KW2176 : 'KW' '2176';\n"); grammarBuilder.append("KW2177 : 'KW' '2177';\n"); grammarBuilder.append("KW2178 : 'KW' '2178';\n"); grammarBuilder.append("KW2179 : 'KW' '2179';\n"); grammarBuilder.append("KW2180 : 'KW' '2180';\n"); grammarBuilder.append("KW2181 : 'KW' '2181';\n"); grammarBuilder.append("KW2182 : 'KW' '2182';\n"); grammarBuilder.append("KW2183 : 'KW' '2183';\n"); grammarBuilder.append("KW2184 : 'KW' '2184';\n"); grammarBuilder.append("KW2185 : 'KW' '2185';\n"); grammarBuilder.append("KW2186 : 'KW' '2186';\n"); grammarBuilder.append("KW2187 : 'KW' '2187';\n"); grammarBuilder.append("KW2188 : 'KW' '2188';\n"); grammarBuilder.append("KW2189 : 'KW' '2189';\n"); grammarBuilder.append("KW2190 : 'KW' '2190';\n"); grammarBuilder.append("KW2191 : 'KW' '2191';\n"); grammarBuilder.append("KW2192 : 'KW' '2192';\n"); grammarBuilder.append("KW2193 : 'KW' '2193';\n"); grammarBuilder.append("KW2194 : 'KW' '2194';\n"); grammarBuilder.append("KW2195 : 'KW' '2195';\n"); grammarBuilder.append("KW2196 : 'KW' '2196';\n"); grammarBuilder.append("KW2197 : 'KW' '2197';\n"); grammarBuilder.append("KW2198 : 'KW' '2198';\n"); grammarBuilder.append("KW2199 : 'KW' '2199';\n"); grammarBuilder.append("KW2200 : 'KW' '2200';\n"); grammarBuilder.append("KW2201 : 'KW' '2201';\n"); grammarBuilder.append("KW2202 : 'KW' '2202';\n"); grammarBuilder.append("KW2203 : 'KW' '2203';\n"); grammarBuilder.append("KW2204 : 'KW' '2204';\n"); grammarBuilder.append("KW2205 : 'KW' '2205';\n"); grammarBuilder.append("KW2206 : 'KW' '2206';\n"); grammarBuilder.append("KW2207 : 'KW' '2207';\n"); grammarBuilder.append("KW2208 : 'KW' '2208';\n"); grammarBuilder.append("KW2209 : 'KW' '2209';\n"); grammarBuilder.append("KW2210 : 'KW' '2210';\n"); grammarBuilder.append("KW2211 : 'KW' '2211';\n"); grammarBuilder.append("KW2212 : 'KW' '2212';\n"); grammarBuilder.append("KW2213 : 'KW' '2213';\n"); grammarBuilder.append("KW2214 : 'KW' '2214';\n"); grammarBuilder.append("KW2215 : 'KW' '2215';\n"); grammarBuilder.append("KW2216 : 'KW' '2216';\n"); grammarBuilder.append("KW2217 : 'KW' '2217';\n"); grammarBuilder.append("KW2218 : 'KW' '2218';\n"); grammarBuilder.append("KW2219 : 'KW' '2219';\n"); grammarBuilder.append("KW2220 : 'KW' '2220';\n"); grammarBuilder.append("KW2221 : 'KW' '2221';\n"); grammarBuilder.append("KW2222 : 'KW' '2222';\n"); grammarBuilder.append("KW2223 : 'KW' '2223';\n"); grammarBuilder.append("KW2224 : 'KW' '2224';\n"); grammarBuilder.append("KW2225 : 'KW' '2225';\n"); grammarBuilder.append("KW2226 : 'KW' '2226';\n"); grammarBuilder.append("KW2227 : 'KW' '2227';\n"); grammarBuilder.append("KW2228 : 'KW' '2228';\n"); grammarBuilder.append("KW2229 : 'KW' '2229';\n"); grammarBuilder.append("KW2230 : 'KW' '2230';\n"); grammarBuilder.append("KW2231 : 'KW' '2231';\n"); grammarBuilder.append("KW2232 : 'KW' '2232';\n"); grammarBuilder.append("KW2233 : 'KW' '2233';\n"); grammarBuilder.append("KW2234 : 'KW' '2234';\n"); grammarBuilder.append("KW2235 : 'KW' '2235';\n"); grammarBuilder.append("KW2236 : 'KW' '2236';\n"); grammarBuilder.append("KW2237 : 'KW' '2237';\n"); grammarBuilder.append("KW2238 : 'KW' '2238';\n"); grammarBuilder.append("KW2239 : 'KW' '2239';\n"); grammarBuilder.append("KW2240 : 'KW' '2240';\n"); grammarBuilder.append("KW2241 : 'KW' '2241';\n"); grammarBuilder.append("KW2242 : 'KW' '2242';\n"); grammarBuilder.append("KW2243 : 'KW' '2243';\n"); grammarBuilder.append("KW2244 : 'KW' '2244';\n"); grammarBuilder.append("KW2245 : 'KW' '2245';\n"); grammarBuilder.append("KW2246 : 'KW' '2246';\n"); grammarBuilder.append("KW2247 : 'KW' '2247';\n"); grammarBuilder.append("KW2248 : 'KW' '2248';\n"); grammarBuilder.append("KW2249 : 'KW' '2249';\n"); grammarBuilder.append("KW2250 : 'KW' '2250';\n"); grammarBuilder.append("KW2251 : 'KW' '2251';\n"); grammarBuilder.append("KW2252 : 'KW' '2252';\n"); grammarBuilder.append("KW2253 : 'KW' '2253';\n"); grammarBuilder.append("KW2254 : 'KW' '2254';\n"); grammarBuilder.append("KW2255 : 'KW' '2255';\n"); grammarBuilder.append("KW2256 : 'KW' '2256';\n"); grammarBuilder.append("KW2257 : 'KW' '2257';\n"); grammarBuilder.append("KW2258 : 'KW' '2258';\n"); grammarBuilder.append("KW2259 : 'KW' '2259';\n"); grammarBuilder.append("KW2260 : 'KW' '2260';\n"); grammarBuilder.append("KW2261 : 'KW' '2261';\n"); grammarBuilder.append("KW2262 : 'KW' '2262';\n"); grammarBuilder.append("KW2263 : 'KW' '2263';\n"); grammarBuilder.append("KW2264 : 'KW' '2264';\n"); grammarBuilder.append("KW2265 : 'KW' '2265';\n"); grammarBuilder.append("KW2266 : 'KW' '2266';\n"); grammarBuilder.append("KW2267 : 'KW' '2267';\n"); grammarBuilder.append("KW2268 : 'KW' '2268';\n"); grammarBuilder.append("KW2269 : 'KW' '2269';\n"); grammarBuilder.append("KW2270 : 'KW' '2270';\n"); grammarBuilder.append("KW2271 : 'KW' '2271';\n"); grammarBuilder.append("KW2272 : 'KW' '2272';\n"); grammarBuilder.append("KW2273 : 'KW' '2273';\n"); grammarBuilder.append("KW2274 : 'KW' '2274';\n"); grammarBuilder.append("KW2275 : 'KW' '2275';\n"); grammarBuilder.append("KW2276 : 'KW' '2276';\n"); grammarBuilder.append("KW2277 : 'KW' '2277';\n"); grammarBuilder.append("KW2278 : 'KW' '2278';\n"); grammarBuilder.append("KW2279 : 'KW' '2279';\n"); grammarBuilder.append("KW2280 : 'KW' '2280';\n"); grammarBuilder.append("KW2281 : 'KW' '2281';\n"); grammarBuilder.append("KW2282 : 'KW' '2282';\n"); grammarBuilder.append("KW2283 : 'KW' '2283';\n"); grammarBuilder.append("KW2284 : 'KW' '2284';\n"); grammarBuilder.append("KW2285 : 'KW' '2285';\n"); grammarBuilder.append("KW2286 : 'KW' '2286';\n"); grammarBuilder.append("KW2287 : 'KW' '2287';\n"); grammarBuilder.append("KW2288 : 'KW' '2288';\n"); grammarBuilder.append("KW2289 : 'KW' '2289';\n"); grammarBuilder.append("KW2290 : 'KW' '2290';\n"); grammarBuilder.append("KW2291 : 'KW' '2291';\n"); grammarBuilder.append("KW2292 : 'KW' '2292';\n"); grammarBuilder.append("KW2293 : 'KW' '2293';\n"); grammarBuilder.append("KW2294 : 'KW' '2294';\n"); grammarBuilder.append("KW2295 : 'KW' '2295';\n"); grammarBuilder.append("KW2296 : 'KW' '2296';\n"); grammarBuilder.append("KW2297 : 'KW' '2297';\n"); grammarBuilder.append("KW2298 : 'KW' '2298';\n"); grammarBuilder.append("KW2299 : 'KW' '2299';\n"); grammarBuilder.append("KW2300 : 'KW' '2300';\n"); grammarBuilder.append("KW2301 : 'KW' '2301';\n"); grammarBuilder.append("KW2302 : 'KW' '2302';\n"); grammarBuilder.append("KW2303 : 'KW' '2303';\n"); grammarBuilder.append("KW2304 : 'KW' '2304';\n"); grammarBuilder.append("KW2305 : 'KW' '2305';\n"); grammarBuilder.append("KW2306 : 'KW' '2306';\n"); grammarBuilder.append("KW2307 : 'KW' '2307';\n"); grammarBuilder.append("KW2308 : 'KW' '2308';\n"); grammarBuilder.append("KW2309 : 'KW' '2309';\n"); grammarBuilder.append("KW2310 : 'KW' '2310';\n"); grammarBuilder.append("KW2311 : 'KW' '2311';\n"); grammarBuilder.append("KW2312 : 'KW' '2312';\n"); grammarBuilder.append("KW2313 : 'KW' '2313';\n"); grammarBuilder.append("KW2314 : 'KW' '2314';\n"); grammarBuilder.append("KW2315 : 'KW' '2315';\n"); grammarBuilder.append("KW2316 : 'KW' '2316';\n"); grammarBuilder.append("KW2317 : 'KW' '2317';\n"); grammarBuilder.append("KW2318 : 'KW' '2318';\n"); grammarBuilder.append("KW2319 : 'KW' '2319';\n"); grammarBuilder.append("KW2320 : 'KW' '2320';\n"); grammarBuilder.append("KW2321 : 'KW' '2321';\n"); grammarBuilder.append("KW2322 : 'KW' '2322';\n"); grammarBuilder.append("KW2323 : 'KW' '2323';\n"); grammarBuilder.append("KW2324 : 'KW' '2324';\n"); grammarBuilder.append("KW2325 : 'KW' '2325';\n"); grammarBuilder.append("KW2326 : 'KW' '2326';\n"); grammarBuilder.append("KW2327 : 'KW' '2327';\n"); grammarBuilder.append("KW2328 : 'KW' '2328';\n"); grammarBuilder.append("KW2329 : 'KW' '2329';\n"); grammarBuilder.append("KW2330 : 'KW' '2330';\n"); grammarBuilder.append("KW2331 : 'KW' '2331';\n"); grammarBuilder.append("KW2332 : 'KW' '2332';\n"); grammarBuilder.append("KW2333 : 'KW' '2333';\n"); grammarBuilder.append("KW2334 : 'KW' '2334';\n"); grammarBuilder.append("KW2335 : 'KW' '2335';\n"); grammarBuilder.append("KW2336 : 'KW' '2336';\n"); grammarBuilder.append("KW2337 : 'KW' '2337';\n"); grammarBuilder.append("KW2338 : 'KW' '2338';\n"); grammarBuilder.append("KW2339 : 'KW' '2339';\n"); grammarBuilder.append("KW2340 : 'KW' '2340';\n"); grammarBuilder.append("KW2341 : 'KW' '2341';\n"); grammarBuilder.append("KW2342 : 'KW' '2342';\n"); grammarBuilder.append("KW2343 : 'KW' '2343';\n"); grammarBuilder.append("KW2344 : 'KW' '2344';\n"); grammarBuilder.append("KW2345 : 'KW' '2345';\n"); grammarBuilder.append("KW2346 : 'KW' '2346';\n"); grammarBuilder.append("KW2347 : 'KW' '2347';\n"); grammarBuilder.append("KW2348 : 'KW' '2348';\n"); grammarBuilder.append("KW2349 : 'KW' '2349';\n"); grammarBuilder.append("KW2350 : 'KW' '2350';\n"); grammarBuilder.append("KW2351 : 'KW' '2351';\n"); grammarBuilder.append("KW2352 : 'KW' '2352';\n"); grammarBuilder.append("KW2353 : 'KW' '2353';\n"); grammarBuilder.append("KW2354 : 'KW' '2354';\n"); grammarBuilder.append("KW2355 : 'KW' '2355';\n"); grammarBuilder.append("KW2356 : 'KW' '2356';\n"); grammarBuilder.append("KW2357 : 'KW' '2357';\n"); grammarBuilder.append("KW2358 : 'KW' '2358';\n"); grammarBuilder.append("KW2359 : 'KW' '2359';\n"); grammarBuilder.append("KW2360 : 'KW' '2360';\n"); grammarBuilder.append("KW2361 : 'KW' '2361';\n"); grammarBuilder.append("KW2362 : 'KW' '2362';\n"); grammarBuilder.append("KW2363 : 'KW' '2363';\n"); grammarBuilder.append("KW2364 : 'KW' '2364';\n"); grammarBuilder.append("KW2365 : 'KW' '2365';\n"); grammarBuilder.append("KW2366 : 'KW' '2366';\n"); grammarBuilder.append("KW2367 : 'KW' '2367';\n"); grammarBuilder.append("KW2368 : 'KW' '2368';\n"); grammarBuilder.append("KW2369 : 'KW' '2369';\n"); grammarBuilder.append("KW2370 : 'KW' '2370';\n"); grammarBuilder.append("KW2371 : 'KW' '2371';\n"); grammarBuilder.append("KW2372 : 'KW' '2372';\n"); grammarBuilder.append("KW2373 : 'KW' '2373';\n"); grammarBuilder.append("KW2374 : 'KW' '2374';\n"); grammarBuilder.append("KW2375 : 'KW' '2375';\n"); grammarBuilder.append("KW2376 : 'KW' '2376';\n"); grammarBuilder.append("KW2377 : 'KW' '2377';\n"); grammarBuilder.append("KW2378 : 'KW' '2378';\n"); grammarBuilder.append("KW2379 : 'KW' '2379';\n"); grammarBuilder.append("KW2380 : 'KW' '2380';\n"); grammarBuilder.append("KW2381 : 'KW' '2381';\n"); grammarBuilder.append("KW2382 : 'KW' '2382';\n"); grammarBuilder.append("KW2383 : 'KW' '2383';\n"); grammarBuilder.append("KW2384 : 'KW' '2384';\n"); grammarBuilder.append("KW2385 : 'KW' '2385';\n"); grammarBuilder.append("KW2386 : 'KW' '2386';\n"); grammarBuilder.append("KW2387 : 'KW' '2387';\n"); grammarBuilder.append("KW2388 : 'KW' '2388';\n"); grammarBuilder.append("KW2389 : 'KW' '2389';\n"); grammarBuilder.append("KW2390 : 'KW' '2390';\n"); grammarBuilder.append("KW2391 : 'KW' '2391';\n"); grammarBuilder.append("KW2392 : 'KW' '2392';\n"); grammarBuilder.append("KW2393 : 'KW' '2393';\n"); grammarBuilder.append("KW2394 : 'KW' '2394';\n"); grammarBuilder.append("KW2395 : 'KW' '2395';\n"); grammarBuilder.append("KW2396 : 'KW' '2396';\n"); grammarBuilder.append("KW2397 : 'KW' '2397';\n"); grammarBuilder.append("KW2398 : 'KW' '2398';\n"); grammarBuilder.append("KW2399 : 'KW' '2399';\n"); grammarBuilder.append("KW2400 : 'KW' '2400';\n"); grammarBuilder.append("KW2401 : 'KW' '2401';\n"); grammarBuilder.append("KW2402 : 'KW' '2402';\n"); grammarBuilder.append("KW2403 : 'KW' '2403';\n"); grammarBuilder.append("KW2404 : 'KW' '2404';\n"); grammarBuilder.append("KW2405 : 'KW' '2405';\n"); grammarBuilder.append("KW2406 : 'KW' '2406';\n"); grammarBuilder.append("KW2407 : 'KW' '2407';\n"); grammarBuilder.append("KW2408 : 'KW' '2408';\n"); grammarBuilder.append("KW2409 : 'KW' '2409';\n"); grammarBuilder.append("KW2410 : 'KW' '2410';\n"); grammarBuilder.append("KW2411 : 'KW' '2411';\n"); grammarBuilder.append("KW2412 : 'KW' '2412';\n"); grammarBuilder.append("KW2413 : 'KW' '2413';\n"); grammarBuilder.append("KW2414 : 'KW' '2414';\n"); grammarBuilder.append("KW2415 : 'KW' '2415';\n"); grammarBuilder.append("KW2416 : 'KW' '2416';\n"); grammarBuilder.append("KW2417 : 'KW' '2417';\n"); grammarBuilder.append("KW2418 : 'KW' '2418';\n"); grammarBuilder.append("KW2419 : 'KW' '2419';\n"); grammarBuilder.append("KW2420 : 'KW' '2420';\n"); grammarBuilder.append("KW2421 : 'KW' '2421';\n"); grammarBuilder.append("KW2422 : 'KW' '2422';\n"); grammarBuilder.append("KW2423 : 'KW' '2423';\n"); grammarBuilder.append("KW2424 : 'KW' '2424';\n"); grammarBuilder.append("KW2425 : 'KW' '2425';\n"); grammarBuilder.append("KW2426 : 'KW' '2426';\n"); grammarBuilder.append("KW2427 : 'KW' '2427';\n"); grammarBuilder.append("KW2428 : 'KW' '2428';\n"); grammarBuilder.append("KW2429 : 'KW' '2429';\n"); grammarBuilder.append("KW2430 : 'KW' '2430';\n"); grammarBuilder.append("KW2431 : 'KW' '2431';\n"); grammarBuilder.append("KW2432 : 'KW' '2432';\n"); grammarBuilder.append("KW2433 : 'KW' '2433';\n"); grammarBuilder.append("KW2434 : 'KW' '2434';\n"); grammarBuilder.append("KW2435 : 'KW' '2435';\n"); grammarBuilder.append("KW2436 : 'KW' '2436';\n"); grammarBuilder.append("KW2437 : 'KW' '2437';\n"); grammarBuilder.append("KW2438 : 'KW' '2438';\n"); grammarBuilder.append("KW2439 : 'KW' '2439';\n"); grammarBuilder.append("KW2440 : 'KW' '2440';\n"); grammarBuilder.append("KW2441 : 'KW' '2441';\n"); grammarBuilder.append("KW2442 : 'KW' '2442';\n"); grammarBuilder.append("KW2443 : 'KW' '2443';\n"); grammarBuilder.append("KW2444 : 'KW' '2444';\n"); grammarBuilder.append("KW2445 : 'KW' '2445';\n"); grammarBuilder.append("KW2446 : 'KW' '2446';\n"); grammarBuilder.append("KW2447 : 'KW' '2447';\n"); grammarBuilder.append("KW2448 : 'KW' '2448';\n"); grammarBuilder.append("KW2449 : 'KW' '2449';\n"); grammarBuilder.append("KW2450 : 'KW' '2450';\n"); grammarBuilder.append("KW2451 : 'KW' '2451';\n"); grammarBuilder.append("KW2452 : 'KW' '2452';\n"); grammarBuilder.append("KW2453 : 'KW' '2453';\n"); grammarBuilder.append("KW2454 : 'KW' '2454';\n"); grammarBuilder.append("KW2455 : 'KW' '2455';\n"); grammarBuilder.append("KW2456 : 'KW' '2456';\n"); grammarBuilder.append("KW2457 : 'KW' '2457';\n"); grammarBuilder.append("KW2458 : 'KW' '2458';\n"); grammarBuilder.append("KW2459 : 'KW' '2459';\n"); grammarBuilder.append("KW2460 : 'KW' '2460';\n"); grammarBuilder.append("KW2461 : 'KW' '2461';\n"); grammarBuilder.append("KW2462 : 'KW' '2462';\n"); grammarBuilder.append("KW2463 : 'KW' '2463';\n"); grammarBuilder.append("KW2464 : 'KW' '2464';\n"); grammarBuilder.append("KW2465 : 'KW' '2465';\n"); grammarBuilder.append("KW2466 : 'KW' '2466';\n"); grammarBuilder.append("KW2467 : 'KW' '2467';\n"); grammarBuilder.append("KW2468 : 'KW' '2468';\n"); grammarBuilder.append("KW2469 : 'KW' '2469';\n"); grammarBuilder.append("KW2470 : 'KW' '2470';\n"); grammarBuilder.append("KW2471 : 'KW' '2471';\n"); grammarBuilder.append("KW2472 : 'KW' '2472';\n"); grammarBuilder.append("KW2473 : 'KW' '2473';\n"); grammarBuilder.append("KW2474 : 'KW' '2474';\n"); grammarBuilder.append("KW2475 : 'KW' '2475';\n"); grammarBuilder.append("KW2476 : 'KW' '2476';\n"); grammarBuilder.append("KW2477 : 'KW' '2477';\n"); grammarBuilder.append("KW2478 : 'KW' '2478';\n"); grammarBuilder.append("KW2479 : 'KW' '2479';\n"); grammarBuilder.append("KW2480 : 'KW' '2480';\n"); grammarBuilder.append("KW2481 : 'KW' '2481';\n"); grammarBuilder.append("KW2482 : 'KW' '2482';\n"); grammarBuilder.append("KW2483 : 'KW' '2483';\n"); grammarBuilder.append("KW2484 : 'KW' '2484';\n"); grammarBuilder.append("KW2485 : 'KW' '2485';\n"); grammarBuilder.append("KW2486 : 'KW' '2486';\n"); grammarBuilder.append("KW2487 : 'KW' '2487';\n"); grammarBuilder.append("KW2488 : 'KW' '2488';\n"); grammarBuilder.append("KW2489 : 'KW' '2489';\n"); grammarBuilder.append("KW2490 : 'KW' '2490';\n"); grammarBuilder.append("KW2491 : 'KW' '2491';\n"); grammarBuilder.append("KW2492 : 'KW' '2492';\n"); grammarBuilder.append("KW2493 : 'KW' '2493';\n"); grammarBuilder.append("KW2494 : 'KW' '2494';\n"); grammarBuilder.append("KW2495 : 'KW' '2495';\n"); grammarBuilder.append("KW2496 : 'KW' '2496';\n"); grammarBuilder.append("KW2497 : 'KW' '2497';\n"); grammarBuilder.append("KW2498 : 'KW' '2498';\n"); grammarBuilder.append("KW2499 : 'KW' '2499';\n"); grammarBuilder.append("KW2500 : 'KW' '2500';\n"); grammarBuilder.append("KW2501 : 'KW' '2501';\n"); grammarBuilder.append("KW2502 : 'KW' '2502';\n"); grammarBuilder.append("KW2503 : 'KW' '2503';\n"); grammarBuilder.append("KW2504 : 'KW' '2504';\n"); grammarBuilder.append("KW2505 : 'KW' '2505';\n"); grammarBuilder.append("KW2506 : 'KW' '2506';\n"); grammarBuilder.append("KW2507 : 'KW' '2507';\n"); grammarBuilder.append("KW2508 : 'KW' '2508';\n"); grammarBuilder.append("KW2509 : 'KW' '2509';\n"); grammarBuilder.append("KW2510 : 'KW' '2510';\n"); grammarBuilder.append("KW2511 : 'KW' '2511';\n"); grammarBuilder.append("KW2512 : 'KW' '2512';\n"); grammarBuilder.append("KW2513 : 'KW' '2513';\n"); grammarBuilder.append("KW2514 : 'KW' '2514';\n"); grammarBuilder.append("KW2515 : 'KW' '2515';\n"); grammarBuilder.append("KW2516 : 'KW' '2516';\n"); grammarBuilder.append("KW2517 : 'KW' '2517';\n"); grammarBuilder.append("KW2518 : 'KW' '2518';\n"); grammarBuilder.append("KW2519 : 'KW' '2519';\n"); grammarBuilder.append("KW2520 : 'KW' '2520';\n"); grammarBuilder.append("KW2521 : 'KW' '2521';\n"); grammarBuilder.append("KW2522 : 'KW' '2522';\n"); grammarBuilder.append("KW2523 : 'KW' '2523';\n"); grammarBuilder.append("KW2524 : 'KW' '2524';\n"); grammarBuilder.append("KW2525 : 'KW' '2525';\n"); grammarBuilder.append("KW2526 : 'KW' '2526';\n"); grammarBuilder.append("KW2527 : 'KW' '2527';\n"); grammarBuilder.append("KW2528 : 'KW' '2528';\n"); grammarBuilder.append("KW2529 : 'KW' '2529';\n"); grammarBuilder.append("KW2530 : 'KW' '2530';\n"); grammarBuilder.append("KW2531 : 'KW' '2531';\n"); grammarBuilder.append("KW2532 : 'KW' '2532';\n"); grammarBuilder.append("KW2533 : 'KW' '2533';\n"); grammarBuilder.append("KW2534 : 'KW' '2534';\n"); grammarBuilder.append("KW2535 : 'KW' '2535';\n"); grammarBuilder.append("KW2536 : 'KW' '2536';\n"); grammarBuilder.append("KW2537 : 'KW' '2537';\n"); grammarBuilder.append("KW2538 : 'KW' '2538';\n"); grammarBuilder.append("KW2539 : 'KW' '2539';\n"); grammarBuilder.append("KW2540 : 'KW' '2540';\n"); grammarBuilder.append("KW2541 : 'KW' '2541';\n"); grammarBuilder.append("KW2542 : 'KW' '2542';\n"); grammarBuilder.append("KW2543 : 'KW' '2543';\n"); grammarBuilder.append("KW2544 : 'KW' '2544';\n"); grammarBuilder.append("KW2545 : 'KW' '2545';\n"); grammarBuilder.append("KW2546 : 'KW' '2546';\n"); grammarBuilder.append("KW2547 : 'KW' '2547';\n"); grammarBuilder.append("KW2548 : 'KW' '2548';\n"); grammarBuilder.append("KW2549 : 'KW' '2549';\n"); grammarBuilder.append("KW2550 : 'KW' '2550';\n"); grammarBuilder.append("KW2551 : 'KW' '2551';\n"); grammarBuilder.append("KW2552 : 'KW' '2552';\n"); grammarBuilder.append("KW2553 : 'KW' '2553';\n"); grammarBuilder.append("KW2554 : 'KW' '2554';\n"); grammarBuilder.append("KW2555 : 'KW' '2555';\n"); grammarBuilder.append("KW2556 : 'KW' '2556';\n"); grammarBuilder.append("KW2557 : 'KW' '2557';\n"); grammarBuilder.append("KW2558 : 'KW' '2558';\n"); grammarBuilder.append("KW2559 : 'KW' '2559';\n"); grammarBuilder.append("KW2560 : 'KW' '2560';\n"); grammarBuilder.append("KW2561 : 'KW' '2561';\n"); grammarBuilder.append("KW2562 : 'KW' '2562';\n"); grammarBuilder.append("KW2563 : 'KW' '2563';\n"); grammarBuilder.append("KW2564 : 'KW' '2564';\n"); grammarBuilder.append("KW2565 : 'KW' '2565';\n"); grammarBuilder.append("KW2566 : 'KW' '2566';\n"); grammarBuilder.append("KW2567 : 'KW' '2567';\n"); grammarBuilder.append("KW2568 : 'KW' '2568';\n"); grammarBuilder.append("KW2569 : 'KW' '2569';\n"); grammarBuilder.append("KW2570 : 'KW' '2570';\n"); grammarBuilder.append("KW2571 : 'KW' '2571';\n"); grammarBuilder.append("KW2572 : 'KW' '2572';\n"); grammarBuilder.append("KW2573 : 'KW' '2573';\n"); grammarBuilder.append("KW2574 : 'KW' '2574';\n"); grammarBuilder.append("KW2575 : 'KW' '2575';\n"); grammarBuilder.append("KW2576 : 'KW' '2576';\n"); grammarBuilder.append("KW2577 : 'KW' '2577';\n"); grammarBuilder.append("KW2578 : 'KW' '2578';\n"); grammarBuilder.append("KW2579 : 'KW' '2579';\n"); grammarBuilder.append("KW2580 : 'KW' '2580';\n"); grammarBuilder.append("KW2581 : 'KW' '2581';\n"); grammarBuilder.append("KW2582 : 'KW' '2582';\n"); grammarBuilder.append("KW2583 : 'KW' '2583';\n"); grammarBuilder.append("KW2584 : 'KW' '2584';\n"); grammarBuilder.append("KW2585 : 'KW' '2585';\n"); grammarBuilder.append("KW2586 : 'KW' '2586';\n"); grammarBuilder.append("KW2587 : 'KW' '2587';\n"); grammarBuilder.append("KW2588 : 'KW' '2588';\n"); grammarBuilder.append("KW2589 : 'KW' '2589';\n"); grammarBuilder.append("KW2590 : 'KW' '2590';\n"); grammarBuilder.append("KW2591 : 'KW' '2591';\n"); grammarBuilder.append("KW2592 : 'KW' '2592';\n"); grammarBuilder.append("KW2593 : 'KW' '2593';\n"); grammarBuilder.append("KW2594 : 'KW' '2594';\n"); grammarBuilder.append("KW2595 : 'KW' '2595';\n"); grammarBuilder.append("KW2596 : 'KW' '2596';\n"); grammarBuilder.append("KW2597 : 'KW' '2597';\n"); grammarBuilder.append("KW2598 : 'KW' '2598';\n"); grammarBuilder.append("KW2599 : 'KW' '2599';\n"); grammarBuilder.append("KW2600 : 'KW' '2600';\n"); grammarBuilder.append("KW2601 : 'KW' '2601';\n"); grammarBuilder.append("KW2602 : 'KW' '2602';\n"); grammarBuilder.append("KW2603 : 'KW' '2603';\n"); grammarBuilder.append("KW2604 : 'KW' '2604';\n"); grammarBuilder.append("KW2605 : 'KW' '2605';\n"); grammarBuilder.append("KW2606 : 'KW' '2606';\n"); grammarBuilder.append("KW2607 : 'KW' '2607';\n"); grammarBuilder.append("KW2608 : 'KW' '2608';\n"); grammarBuilder.append("KW2609 : 'KW' '2609';\n"); grammarBuilder.append("KW2610 : 'KW' '2610';\n"); grammarBuilder.append("KW2611 : 'KW' '2611';\n"); grammarBuilder.append("KW2612 : 'KW' '2612';\n"); grammarBuilder.append("KW2613 : 'KW' '2613';\n"); grammarBuilder.append("KW2614 : 'KW' '2614';\n"); grammarBuilder.append("KW2615 : 'KW' '2615';\n"); grammarBuilder.append("KW2616 : 'KW' '2616';\n"); grammarBuilder.append("KW2617 : 'KW' '2617';\n"); grammarBuilder.append("KW2618 : 'KW' '2618';\n"); grammarBuilder.append("KW2619 : 'KW' '2619';\n"); grammarBuilder.append("KW2620 : 'KW' '2620';\n"); grammarBuilder.append("KW2621 : 'KW' '2621';\n"); grammarBuilder.append("KW2622 : 'KW' '2622';\n"); grammarBuilder.append("KW2623 : 'KW' '2623';\n"); grammarBuilder.append("KW2624 : 'KW' '2624';\n"); grammarBuilder.append("KW2625 : 'KW' '2625';\n"); grammarBuilder.append("KW2626 : 'KW' '2626';\n"); grammarBuilder.append("KW2627 : 'KW' '2627';\n"); grammarBuilder.append("KW2628 : 'KW' '2628';\n"); grammarBuilder.append("KW2629 : 'KW' '2629';\n"); grammarBuilder.append("KW2630 : 'KW' '2630';\n"); grammarBuilder.append("KW2631 : 'KW' '2631';\n"); grammarBuilder.append("KW2632 : 'KW' '2632';\n"); grammarBuilder.append("KW2633 : 'KW' '2633';\n"); grammarBuilder.append("KW2634 : 'KW' '2634';\n"); grammarBuilder.append("KW2635 : 'KW' '2635';\n"); grammarBuilder.append("KW2636 : 'KW' '2636';\n"); grammarBuilder.append("KW2637 : 'KW' '2637';\n"); grammarBuilder.append("KW2638 : 'KW' '2638';\n"); grammarBuilder.append("KW2639 : 'KW' '2639';\n"); grammarBuilder.append("KW2640 : 'KW' '2640';\n"); grammarBuilder.append("KW2641 : 'KW' '2641';\n"); grammarBuilder.append("KW2642 : 'KW' '2642';\n"); grammarBuilder.append("KW2643 : 'KW' '2643';\n"); grammarBuilder.append("KW2644 : 'KW' '2644';\n"); grammarBuilder.append("KW2645 : 'KW' '2645';\n"); grammarBuilder.append("KW2646 : 'KW' '2646';\n"); grammarBuilder.append("KW2647 : 'KW' '2647';\n"); grammarBuilder.append("KW2648 : 'KW' '2648';\n"); grammarBuilder.append("KW2649 : 'KW' '2649';\n"); grammarBuilder.append("KW2650 : 'KW' '2650';\n"); grammarBuilder.append("KW2651 : 'KW' '2651';\n"); grammarBuilder.append("KW2652 : 'KW' '2652';\n"); grammarBuilder.append("KW2653 : 'KW' '2653';\n"); grammarBuilder.append("KW2654 : 'KW' '2654';\n"); grammarBuilder.append("KW2655 : 'KW' '2655';\n"); grammarBuilder.append("KW2656 : 'KW' '2656';\n"); grammarBuilder.append("KW2657 : 'KW' '2657';\n"); grammarBuilder.append("KW2658 : 'KW' '2658';\n"); grammarBuilder.append("KW2659 : 'KW' '2659';\n"); grammarBuilder.append("KW2660 : 'KW' '2660';\n"); grammarBuilder.append("KW2661 : 'KW' '2661';\n"); grammarBuilder.append("KW2662 : 'KW' '2662';\n"); grammarBuilder.append("KW2663 : 'KW' '2663';\n"); grammarBuilder.append("KW2664 : 'KW' '2664';\n"); grammarBuilder.append("KW2665 : 'KW' '2665';\n"); grammarBuilder.append("KW2666 : 'KW' '2666';\n"); grammarBuilder.append("KW2667 : 'KW' '2667';\n"); grammarBuilder.append("KW2668 : 'KW' '2668';\n"); grammarBuilder.append("KW2669 : 'KW' '2669';\n"); grammarBuilder.append("KW2670 : 'KW' '2670';\n"); grammarBuilder.append("KW2671 : 'KW' '2671';\n"); grammarBuilder.append("KW2672 : 'KW' '2672';\n"); grammarBuilder.append("KW2673 : 'KW' '2673';\n"); grammarBuilder.append("KW2674 : 'KW' '2674';\n"); grammarBuilder.append("KW2675 : 'KW' '2675';\n"); grammarBuilder.append("KW2676 : 'KW' '2676';\n"); grammarBuilder.append("KW2677 : 'KW' '2677';\n"); grammarBuilder.append("KW2678 : 'KW' '2678';\n"); grammarBuilder.append("KW2679 : 'KW' '2679';\n"); grammarBuilder.append("KW2680 : 'KW' '2680';\n"); grammarBuilder.append("KW2681 : 'KW' '2681';\n"); grammarBuilder.append("KW2682 : 'KW' '2682';\n"); grammarBuilder.append("KW2683 : 'KW' '2683';\n"); grammarBuilder.append("KW2684 : 'KW' '2684';\n"); grammarBuilder.append("KW2685 : 'KW' '2685';\n"); grammarBuilder.append("KW2686 : 'KW' '2686';\n"); grammarBuilder.append("KW2687 : 'KW' '2687';\n"); grammarBuilder.append("KW2688 : 'KW' '2688';\n"); grammarBuilder.append("KW2689 : 'KW' '2689';\n"); grammarBuilder.append("KW2690 : 'KW' '2690';\n"); grammarBuilder.append("KW2691 : 'KW' '2691';\n"); grammarBuilder.append("KW2692 : 'KW' '2692';\n"); grammarBuilder.append("KW2693 : 'KW' '2693';\n"); grammarBuilder.append("KW2694 : 'KW' '2694';\n"); grammarBuilder.append("KW2695 : 'KW' '2695';\n"); grammarBuilder.append("KW2696 : 'KW' '2696';\n"); grammarBuilder.append("KW2697 : 'KW' '2697';\n"); grammarBuilder.append("KW2698 : 'KW' '2698';\n"); grammarBuilder.append("KW2699 : 'KW' '2699';\n"); grammarBuilder.append("KW2700 : 'KW' '2700';\n"); grammarBuilder.append("KW2701 : 'KW' '2701';\n"); grammarBuilder.append("KW2702 : 'KW' '2702';\n"); grammarBuilder.append("KW2703 : 'KW' '2703';\n"); grammarBuilder.append("KW2704 : 'KW' '2704';\n"); grammarBuilder.append("KW2705 : 'KW' '2705';\n"); grammarBuilder.append("KW2706 : 'KW' '2706';\n"); grammarBuilder.append("KW2707 : 'KW' '2707';\n"); grammarBuilder.append("KW2708 : 'KW' '2708';\n"); grammarBuilder.append("KW2709 : 'KW' '2709';\n"); grammarBuilder.append("KW2710 : 'KW' '2710';\n"); grammarBuilder.append("KW2711 : 'KW' '2711';\n"); grammarBuilder.append("KW2712 : 'KW' '2712';\n"); grammarBuilder.append("KW2713 : 'KW' '2713';\n"); grammarBuilder.append("KW2714 : 'KW' '2714';\n"); grammarBuilder.append("KW2715 : 'KW' '2715';\n"); grammarBuilder.append("KW2716 : 'KW' '2716';\n"); grammarBuilder.append("KW2717 : 'KW' '2717';\n"); grammarBuilder.append("KW2718 : 'KW' '2718';\n"); grammarBuilder.append("KW2719 : 'KW' '2719';\n"); grammarBuilder.append("KW2720 : 'KW' '2720';\n"); grammarBuilder.append("KW2721 : 'KW' '2721';\n"); grammarBuilder.append("KW2722 : 'KW' '2722';\n"); grammarBuilder.append("KW2723 : 'KW' '2723';\n"); grammarBuilder.append("KW2724 : 'KW' '2724';\n"); grammarBuilder.append("KW2725 : 'KW' '2725';\n"); grammarBuilder.append("KW2726 : 'KW' '2726';\n"); grammarBuilder.append("KW2727 : 'KW' '2727';\n"); grammarBuilder.append("KW2728 : 'KW' '2728';\n"); grammarBuilder.append("KW2729 : 'KW' '2729';\n"); grammarBuilder.append("KW2730 : 'KW' '2730';\n"); grammarBuilder.append("KW2731 : 'KW' '2731';\n"); grammarBuilder.append("KW2732 : 'KW' '2732';\n"); grammarBuilder.append("KW2733 : 'KW' '2733';\n"); grammarBuilder.append("KW2734 : 'KW' '2734';\n"); grammarBuilder.append("KW2735 : 'KW' '2735';\n"); grammarBuilder.append("KW2736 : 'KW' '2736';\n"); grammarBuilder.append("KW2737 : 'KW' '2737';\n"); grammarBuilder.append("KW2738 : 'KW' '2738';\n"); grammarBuilder.append("KW2739 : 'KW' '2739';\n"); grammarBuilder.append("KW2740 : 'KW' '2740';\n"); grammarBuilder.append("KW2741 : 'KW' '2741';\n"); grammarBuilder.append("KW2742 : 'KW' '2742';\n"); grammarBuilder.append("KW2743 : 'KW' '2743';\n"); grammarBuilder.append("KW2744 : 'KW' '2744';\n"); grammarBuilder.append("KW2745 : 'KW' '2745';\n"); grammarBuilder.append("KW2746 : 'KW' '2746';\n"); grammarBuilder.append("KW2747 : 'KW' '2747';\n"); grammarBuilder.append("KW2748 : 'KW' '2748';\n"); grammarBuilder.append("KW2749 : 'KW' '2749';\n"); grammarBuilder.append("KW2750 : 'KW' '2750';\n"); grammarBuilder.append("KW2751 : 'KW' '2751';\n"); grammarBuilder.append("KW2752 : 'KW' '2752';\n"); grammarBuilder.append("KW2753 : 'KW' '2753';\n"); grammarBuilder.append("KW2754 : 'KW' '2754';\n"); grammarBuilder.append("KW2755 : 'KW' '2755';\n"); grammarBuilder.append("KW2756 : 'KW' '2756';\n"); grammarBuilder.append("KW2757 : 'KW' '2757';\n"); grammarBuilder.append("KW2758 : 'KW' '2758';\n"); grammarBuilder.append("KW2759 : 'KW' '2759';\n"); grammarBuilder.append("KW2760 : 'KW' '2760';\n"); grammarBuilder.append("KW2761 : 'KW' '2761';\n"); grammarBuilder.append("KW2762 : 'KW' '2762';\n"); grammarBuilder.append("KW2763 : 'KW' '2763';\n"); grammarBuilder.append("KW2764 : 'KW' '2764';\n"); grammarBuilder.append("KW2765 : 'KW' '2765';\n"); grammarBuilder.append("KW2766 : 'KW' '2766';\n"); grammarBuilder.append("KW2767 : 'KW' '2767';\n"); grammarBuilder.append("KW2768 : 'KW' '2768';\n"); grammarBuilder.append("KW2769 : 'KW' '2769';\n"); grammarBuilder.append("KW2770 : 'KW' '2770';\n"); grammarBuilder.append("KW2771 : 'KW' '2771';\n"); grammarBuilder.append("KW2772 : 'KW' '2772';\n"); grammarBuilder.append("KW2773 : 'KW' '2773';\n"); grammarBuilder.append("KW2774 : 'KW' '2774';\n"); grammarBuilder.append("KW2775 : 'KW' '2775';\n"); grammarBuilder.append("KW2776 : 'KW' '2776';\n"); grammarBuilder.append("KW2777 : 'KW' '2777';\n"); grammarBuilder.append("KW2778 : 'KW' '2778';\n"); grammarBuilder.append("KW2779 : 'KW' '2779';\n"); grammarBuilder.append("KW2780 : 'KW' '2780';\n"); grammarBuilder.append("KW2781 : 'KW' '2781';\n"); grammarBuilder.append("KW2782 : 'KW' '2782';\n"); grammarBuilder.append("KW2783 : 'KW' '2783';\n"); grammarBuilder.append("KW2784 : 'KW' '2784';\n"); grammarBuilder.append("KW2785 : 'KW' '2785';\n"); grammarBuilder.append("KW2786 : 'KW' '2786';\n"); grammarBuilder.append("KW2787 : 'KW' '2787';\n"); grammarBuilder.append("KW2788 : 'KW' '2788';\n"); grammarBuilder.append("KW2789 : 'KW' '2789';\n"); grammarBuilder.append("KW2790 : 'KW' '2790';\n"); grammarBuilder.append("KW2791 : 'KW' '2791';\n"); grammarBuilder.append("KW2792 : 'KW' '2792';\n"); grammarBuilder.append("KW2793 : 'KW' '2793';\n"); grammarBuilder.append("KW2794 : 'KW' '2794';\n"); grammarBuilder.append("KW2795 : 'KW' '2795';\n"); grammarBuilder.append("KW2796 : 'KW' '2796';\n"); grammarBuilder.append("KW2797 : 'KW' '2797';\n"); grammarBuilder.append("KW2798 : 'KW' '2798';\n"); grammarBuilder.append("KW2799 : 'KW' '2799';\n"); grammarBuilder.append("KW2800 : 'KW' '2800';\n"); grammarBuilder.append("KW2801 : 'KW' '2801';\n"); grammarBuilder.append("KW2802 : 'KW' '2802';\n"); grammarBuilder.append("KW2803 : 'KW' '2803';\n"); grammarBuilder.append("KW2804 : 'KW' '2804';\n"); grammarBuilder.append("KW2805 : 'KW' '2805';\n"); grammarBuilder.append("KW2806 : 'KW' '2806';\n"); grammarBuilder.append("KW2807 : 'KW' '2807';\n"); grammarBuilder.append("KW2808 : 'KW' '2808';\n"); grammarBuilder.append("KW2809 : 'KW' '2809';\n"); grammarBuilder.append("KW2810 : 'KW' '2810';\n"); grammarBuilder.append("KW2811 : 'KW' '2811';\n"); grammarBuilder.append("KW2812 : 'KW' '2812';\n"); grammarBuilder.append("KW2813 : 'KW' '2813';\n"); grammarBuilder.append("KW2814 : 'KW' '2814';\n"); grammarBuilder.append("KW2815 : 'KW' '2815';\n"); grammarBuilder.append("KW2816 : 'KW' '2816';\n"); grammarBuilder.append("KW2817 : 'KW' '2817';\n"); grammarBuilder.append("KW2818 : 'KW' '2818';\n"); grammarBuilder.append("KW2819 : 'KW' '2819';\n"); grammarBuilder.append("KW2820 : 'KW' '2820';\n"); grammarBuilder.append("KW2821 : 'KW' '2821';\n"); grammarBuilder.append("KW2822 : 'KW' '2822';\n"); grammarBuilder.append("KW2823 : 'KW' '2823';\n"); grammarBuilder.append("KW2824 : 'KW' '2824';\n"); grammarBuilder.append("KW2825 : 'KW' '2825';\n"); grammarBuilder.append("KW2826 : 'KW' '2826';\n"); grammarBuilder.append("KW2827 : 'KW' '2827';\n"); grammarBuilder.append("KW2828 : 'KW' '2828';\n"); grammarBuilder.append("KW2829 : 'KW' '2829';\n"); grammarBuilder.append("KW2830 : 'KW' '2830';\n"); grammarBuilder.append("KW2831 : 'KW' '2831';\n"); grammarBuilder.append("KW2832 : 'KW' '2832';\n"); grammarBuilder.append("KW2833 : 'KW' '2833';\n"); grammarBuilder.append("KW2834 : 'KW' '2834';\n"); grammarBuilder.append("KW2835 : 'KW' '2835';\n"); grammarBuilder.append("KW2836 : 'KW' '2836';\n"); grammarBuilder.append("KW2837 : 'KW' '2837';\n"); grammarBuilder.append("KW2838 : 'KW' '2838';\n"); grammarBuilder.append("KW2839 : 'KW' '2839';\n"); grammarBuilder.append("KW2840 : 'KW' '2840';\n"); grammarBuilder.append("KW2841 : 'KW' '2841';\n"); grammarBuilder.append("KW2842 : 'KW' '2842';\n"); grammarBuilder.append("KW2843 : 'KW' '2843';\n"); grammarBuilder.append("KW2844 : 'KW' '2844';\n"); grammarBuilder.append("KW2845 : 'KW' '2845';\n"); grammarBuilder.append("KW2846 : 'KW' '2846';\n"); grammarBuilder.append("KW2847 : 'KW' '2847';\n"); grammarBuilder.append("KW2848 : 'KW' '2848';\n"); grammarBuilder.append("KW2849 : 'KW' '2849';\n"); grammarBuilder.append("KW2850 : 'KW' '2850';\n"); grammarBuilder.append("KW2851 : 'KW' '2851';\n"); grammarBuilder.append("KW2852 : 'KW' '2852';\n"); grammarBuilder.append("KW2853 : 'KW' '2853';\n"); grammarBuilder.append("KW2854 : 'KW' '2854';\n"); grammarBuilder.append("KW2855 : 'KW' '2855';\n"); grammarBuilder.append("KW2856 : 'KW' '2856';\n"); grammarBuilder.append("KW2857 : 'KW' '2857';\n"); grammarBuilder.append("KW2858 : 'KW' '2858';\n"); grammarBuilder.append("KW2859 : 'KW' '2859';\n"); grammarBuilder.append("KW2860 : 'KW' '2860';\n"); grammarBuilder.append("KW2861 : 'KW' '2861';\n"); grammarBuilder.append("KW2862 : 'KW' '2862';\n"); grammarBuilder.append("KW2863 : 'KW' '2863';\n"); grammarBuilder.append("KW2864 : 'KW' '2864';\n"); grammarBuilder.append("KW2865 : 'KW' '2865';\n"); grammarBuilder.append("KW2866 : 'KW' '2866';\n"); grammarBuilder.append("KW2867 : 'KW' '2867';\n"); grammarBuilder.append("KW2868 : 'KW' '2868';\n"); grammarBuilder.append("KW2869 : 'KW' '2869';\n"); grammarBuilder.append("KW2870 : 'KW' '2870';\n"); grammarBuilder.append("KW2871 : 'KW' '2871';\n"); grammarBuilder.append("KW2872 : 'KW' '2872';\n"); grammarBuilder.append("KW2873 : 'KW' '2873';\n"); grammarBuilder.append("KW2874 : 'KW' '2874';\n"); grammarBuilder.append("KW2875 : 'KW' '2875';\n"); grammarBuilder.append("KW2876 : 'KW' '2876';\n"); grammarBuilder.append("KW2877 : 'KW' '2877';\n"); grammarBuilder.append("KW2878 : 'KW' '2878';\n"); grammarBuilder.append("KW2879 : 'KW' '2879';\n"); grammarBuilder.append("KW2880 : 'KW' '2880';\n"); grammarBuilder.append("KW2881 : 'KW' '2881';\n"); grammarBuilder.append("KW2882 : 'KW' '2882';\n"); grammarBuilder.append("KW2883 : 'KW' '2883';\n"); grammarBuilder.append("KW2884 : 'KW' '2884';\n"); grammarBuilder.append("KW2885 : 'KW' '2885';\n"); grammarBuilder.append("KW2886 : 'KW' '2886';\n"); grammarBuilder.append("KW2887 : 'KW' '2887';\n"); grammarBuilder.append("KW2888 : 'KW' '2888';\n"); grammarBuilder.append("KW2889 : 'KW' '2889';\n"); grammarBuilder.append("KW2890 : 'KW' '2890';\n"); grammarBuilder.append("KW2891 : 'KW' '2891';\n"); grammarBuilder.append("KW2892 : 'KW' '2892';\n"); grammarBuilder.append("KW2893 : 'KW' '2893';\n"); grammarBuilder.append("KW2894 : 'KW' '2894';\n"); grammarBuilder.append("KW2895 : 'KW' '2895';\n"); grammarBuilder.append("KW2896 : 'KW' '2896';\n"); grammarBuilder.append("KW2897 : 'KW' '2897';\n"); grammarBuilder.append("KW2898 : 'KW' '2898';\n"); grammarBuilder.append("KW2899 : 'KW' '2899';\n"); grammarBuilder.append("KW2900 : 'KW' '2900';\n"); grammarBuilder.append("KW2901 : 'KW' '2901';\n"); grammarBuilder.append("KW2902 : 'KW' '2902';\n"); grammarBuilder.append("KW2903 : 'KW' '2903';\n"); grammarBuilder.append("KW2904 : 'KW' '2904';\n"); grammarBuilder.append("KW2905 : 'KW' '2905';\n"); grammarBuilder.append("KW2906 : 'KW' '2906';\n"); grammarBuilder.append("KW2907 : 'KW' '2907';\n"); grammarBuilder.append("KW2908 : 'KW' '2908';\n"); grammarBuilder.append("KW2909 : 'KW' '2909';\n"); grammarBuilder.append("KW2910 : 'KW' '2910';\n"); grammarBuilder.append("KW2911 : 'KW' '2911';\n"); grammarBuilder.append("KW2912 : 'KW' '2912';\n"); grammarBuilder.append("KW2913 : 'KW' '2913';\n"); grammarBuilder.append("KW2914 : 'KW' '2914';\n"); grammarBuilder.append("KW2915 : 'KW' '2915';\n"); grammarBuilder.append("KW2916 : 'KW' '2916';\n"); grammarBuilder.append("KW2917 : 'KW' '2917';\n"); grammarBuilder.append("KW2918 : 'KW' '2918';\n"); grammarBuilder.append("KW2919 : 'KW' '2919';\n"); grammarBuilder.append("KW2920 : 'KW' '2920';\n"); grammarBuilder.append("KW2921 : 'KW' '2921';\n"); grammarBuilder.append("KW2922 : 'KW' '2922';\n"); grammarBuilder.append("KW2923 : 'KW' '2923';\n"); grammarBuilder.append("KW2924 : 'KW' '2924';\n"); grammarBuilder.append("KW2925 : 'KW' '2925';\n"); grammarBuilder.append("KW2926 : 'KW' '2926';\n"); grammarBuilder.append("KW2927 : 'KW' '2927';\n"); grammarBuilder.append("KW2928 : 'KW' '2928';\n"); grammarBuilder.append("KW2929 : 'KW' '2929';\n"); grammarBuilder.append("KW2930 : 'KW' '2930';\n"); grammarBuilder.append("KW2931 : 'KW' '2931';\n"); grammarBuilder.append("KW2932 : 'KW' '2932';\n"); grammarBuilder.append("KW2933 : 'KW' '2933';\n"); grammarBuilder.append("KW2934 : 'KW' '2934';\n"); grammarBuilder.append("KW2935 : 'KW' '2935';\n"); grammarBuilder.append("KW2936 : 'KW' '2936';\n"); grammarBuilder.append("KW2937 : 'KW' '2937';\n"); grammarBuilder.append("KW2938 : 'KW' '2938';\n"); grammarBuilder.append("KW2939 : 'KW' '2939';\n"); grammarBuilder.append("KW2940 : 'KW' '2940';\n"); grammarBuilder.append("KW2941 : 'KW' '2941';\n"); grammarBuilder.append("KW2942 : 'KW' '2942';\n"); grammarBuilder.append("KW2943 : 'KW' '2943';\n"); grammarBuilder.append("KW2944 : 'KW' '2944';\n"); grammarBuilder.append("KW2945 : 'KW' '2945';\n"); grammarBuilder.append("KW2946 : 'KW' '2946';\n"); grammarBuilder.append("KW2947 : 'KW' '2947';\n"); grammarBuilder.append("KW2948 : 'KW' '2948';\n"); grammarBuilder.append("KW2949 : 'KW' '2949';\n"); grammarBuilder.append("KW2950 : 'KW' '2950';\n"); grammarBuilder.append("KW2951 : 'KW' '2951';\n"); grammarBuilder.append("KW2952 : 'KW' '2952';\n"); grammarBuilder.append("KW2953 : 'KW' '2953';\n"); grammarBuilder.append("KW2954 : 'KW' '2954';\n"); grammarBuilder.append("KW2955 : 'KW' '2955';\n"); grammarBuilder.append("KW2956 : 'KW' '2956';\n"); grammarBuilder.append("KW2957 : 'KW' '2957';\n"); grammarBuilder.append("KW2958 : 'KW' '2958';\n"); grammarBuilder.append("KW2959 : 'KW' '2959';\n"); grammarBuilder.append("KW2960 : 'KW' '2960';\n"); grammarBuilder.append("KW2961 : 'KW' '2961';\n"); grammarBuilder.append("KW2962 : 'KW' '2962';\n"); grammarBuilder.append("KW2963 : 'KW' '2963';\n"); grammarBuilder.append("KW2964 : 'KW' '2964';\n"); grammarBuilder.append("KW2965 : 'KW' '2965';\n"); grammarBuilder.append("KW2966 : 'KW' '2966';\n"); grammarBuilder.append("KW2967 : 'KW' '2967';\n"); grammarBuilder.append("KW2968 : 'KW' '2968';\n"); grammarBuilder.append("KW2969 : 'KW' '2969';\n"); grammarBuilder.append("KW2970 : 'KW' '2970';\n"); grammarBuilder.append("KW2971 : 'KW' '2971';\n"); grammarBuilder.append("KW2972 : 'KW' '2972';\n"); grammarBuilder.append("KW2973 : 'KW' '2973';\n"); grammarBuilder.append("KW2974 : 'KW' '2974';\n"); grammarBuilder.append("KW2975 : 'KW' '2975';\n"); grammarBuilder.append("KW2976 : 'KW' '2976';\n"); grammarBuilder.append("KW2977 : 'KW' '2977';\n"); grammarBuilder.append("KW2978 : 'KW' '2978';\n"); grammarBuilder.append("KW2979 : 'KW' '2979';\n"); grammarBuilder.append("KW2980 : 'KW' '2980';\n"); grammarBuilder.append("KW2981 : 'KW' '2981';\n"); grammarBuilder.append("KW2982 : 'KW' '2982';\n"); grammarBuilder.append("KW2983 : 'KW' '2983';\n"); grammarBuilder.append("KW2984 : 'KW' '2984';\n"); grammarBuilder.append("KW2985 : 'KW' '2985';\n"); grammarBuilder.append("KW2986 : 'KW' '2986';\n"); grammarBuilder.append("KW2987 : 'KW' '2987';\n"); grammarBuilder.append("KW2988 : 'KW' '2988';\n"); grammarBuilder.append("KW2989 : 'KW' '2989';\n"); grammarBuilder.append("KW2990 : 'KW' '2990';\n"); grammarBuilder.append("KW2991 : 'KW' '2991';\n"); grammarBuilder.append("KW2992 : 'KW' '2992';\n"); grammarBuilder.append("KW2993 : 'KW' '2993';\n"); grammarBuilder.append("KW2994 : 'KW' '2994';\n"); grammarBuilder.append("KW2995 : 'KW' '2995';\n"); grammarBuilder.append("KW2996 : 'KW' '2996';\n"); grammarBuilder.append("KW2997 : 'KW' '2997';\n"); grammarBuilder.append("KW2998 : 'KW' '2998';\n"); grammarBuilder.append("KW2999 : 'KW' '2999';\n"); grammarBuilder.append("KW3000 : 'KW' '3000';\n"); grammarBuilder.append("KW3001 : 'KW' '3001';\n"); grammarBuilder.append("KW3002 : 'KW' '3002';\n"); grammarBuilder.append("KW3003 : 'KW' '3003';\n"); grammarBuilder.append("KW3004 : 'KW' '3004';\n"); grammarBuilder.append("KW3005 : 'KW' '3005';\n"); grammarBuilder.append("KW3006 : 'KW' '3006';\n"); grammarBuilder.append("KW3007 : 'KW' '3007';\n"); grammarBuilder.append("KW3008 : 'KW' '3008';\n"); grammarBuilder.append("KW3009 : 'KW' '3009';\n"); grammarBuilder.append("KW3010 : 'KW' '3010';\n"); grammarBuilder.append("KW3011 : 'KW' '3011';\n"); grammarBuilder.append("KW3012 : 'KW' '3012';\n"); grammarBuilder.append("KW3013 : 'KW' '3013';\n"); grammarBuilder.append("KW3014 : 'KW' '3014';\n"); grammarBuilder.append("KW3015 : 'KW' '3015';\n"); grammarBuilder.append("KW3016 : 'KW' '3016';\n"); grammarBuilder.append("KW3017 : 'KW' '3017';\n"); grammarBuilder.append("KW3018 : 'KW' '3018';\n"); grammarBuilder.append("KW3019 : 'KW' '3019';\n"); grammarBuilder.append("KW3020 : 'KW' '3020';\n"); grammarBuilder.append("KW3021 : 'KW' '3021';\n"); grammarBuilder.append("KW3022 : 'KW' '3022';\n"); grammarBuilder.append("KW3023 : 'KW' '3023';\n"); grammarBuilder.append("KW3024 : 'KW' '3024';\n"); grammarBuilder.append("KW3025 : 'KW' '3025';\n"); grammarBuilder.append("KW3026 : 'KW' '3026';\n"); grammarBuilder.append("KW3027 : 'KW' '3027';\n"); grammarBuilder.append("KW3028 : 'KW' '3028';\n"); grammarBuilder.append("KW3029 : 'KW' '3029';\n"); grammarBuilder.append("KW3030 : 'KW' '3030';\n"); grammarBuilder.append("KW3031 : 'KW' '3031';\n"); grammarBuilder.append("KW3032 : 'KW' '3032';\n"); grammarBuilder.append("KW3033 : 'KW' '3033';\n"); grammarBuilder.append("KW3034 : 'KW' '3034';\n"); grammarBuilder.append("KW3035 : 'KW' '3035';\n"); grammarBuilder.append("KW3036 : 'KW' '3036';\n"); grammarBuilder.append("KW3037 : 'KW' '3037';\n"); grammarBuilder.append("KW3038 : 'KW' '3038';\n"); grammarBuilder.append("KW3039 : 'KW' '3039';\n"); grammarBuilder.append("KW3040 : 'KW' '3040';\n"); grammarBuilder.append("KW3041 : 'KW' '3041';\n"); grammarBuilder.append("KW3042 : 'KW' '3042';\n"); grammarBuilder.append("KW3043 : 'KW' '3043';\n"); grammarBuilder.append("KW3044 : 'KW' '3044';\n"); grammarBuilder.append("KW3045 : 'KW' '3045';\n"); grammarBuilder.append("KW3046 : 'KW' '3046';\n"); grammarBuilder.append("KW3047 : 'KW' '3047';\n"); grammarBuilder.append("KW3048 : 'KW' '3048';\n"); grammarBuilder.append("KW3049 : 'KW' '3049';\n"); grammarBuilder.append("KW3050 : 'KW' '3050';\n"); grammarBuilder.append("KW3051 : 'KW' '3051';\n"); grammarBuilder.append("KW3052 : 'KW' '3052';\n"); grammarBuilder.append("KW3053 : 'KW' '3053';\n"); grammarBuilder.append("KW3054 : 'KW' '3054';\n"); grammarBuilder.append("KW3055 : 'KW' '3055';\n"); grammarBuilder.append("KW3056 : 'KW' '3056';\n"); grammarBuilder.append("KW3057 : 'KW' '3057';\n"); grammarBuilder.append("KW3058 : 'KW' '3058';\n"); grammarBuilder.append("KW3059 : 'KW' '3059';\n"); grammarBuilder.append("KW3060 : 'KW' '3060';\n"); grammarBuilder.append("KW3061 : 'KW' '3061';\n"); grammarBuilder.append("KW3062 : 'KW' '3062';\n"); grammarBuilder.append("KW3063 : 'KW' '3063';\n"); grammarBuilder.append("KW3064 : 'KW' '3064';\n"); grammarBuilder.append("KW3065 : 'KW' '3065';\n"); grammarBuilder.append("KW3066 : 'KW' '3066';\n"); grammarBuilder.append("KW3067 : 'KW' '3067';\n"); grammarBuilder.append("KW3068 : 'KW' '3068';\n"); grammarBuilder.append("KW3069 : 'KW' '3069';\n"); grammarBuilder.append("KW3070 : 'KW' '3070';\n"); grammarBuilder.append("KW3071 : 'KW' '3071';\n"); grammarBuilder.append("KW3072 : 'KW' '3072';\n"); grammarBuilder.append("KW3073 : 'KW' '3073';\n"); grammarBuilder.append("KW3074 : 'KW' '3074';\n"); grammarBuilder.append("KW3075 : 'KW' '3075';\n"); grammarBuilder.append("KW3076 : 'KW' '3076';\n"); grammarBuilder.append("KW3077 : 'KW' '3077';\n"); grammarBuilder.append("KW3078 : 'KW' '3078';\n"); grammarBuilder.append("KW3079 : 'KW' '3079';\n"); grammarBuilder.append("KW3080 : 'KW' '3080';\n"); grammarBuilder.append("KW3081 : 'KW' '3081';\n"); grammarBuilder.append("KW3082 : 'KW' '3082';\n"); grammarBuilder.append("KW3083 : 'KW' '3083';\n"); grammarBuilder.append("KW3084 : 'KW' '3084';\n"); grammarBuilder.append("KW3085 : 'KW' '3085';\n"); grammarBuilder.append("KW3086 : 'KW' '3086';\n"); grammarBuilder.append("KW3087 : 'KW' '3087';\n"); grammarBuilder.append("KW3088 : 'KW' '3088';\n"); grammarBuilder.append("KW3089 : 'KW' '3089';\n"); grammarBuilder.append("KW3090 : 'KW' '3090';\n"); grammarBuilder.append("KW3091 : 'KW' '3091';\n"); grammarBuilder.append("KW3092 : 'KW' '3092';\n"); grammarBuilder.append("KW3093 : 'KW' '3093';\n"); grammarBuilder.append("KW3094 : 'KW' '3094';\n"); grammarBuilder.append("KW3095 : 'KW' '3095';\n"); grammarBuilder.append("KW3096 : 'KW' '3096';\n"); grammarBuilder.append("KW3097 : 'KW' '3097';\n"); grammarBuilder.append("KW3098 : 'KW' '3098';\n"); grammarBuilder.append("KW3099 : 'KW' '3099';\n"); grammarBuilder.append("KW3100 : 'KW' '3100';\n"); grammarBuilder.append("KW3101 : 'KW' '3101';\n"); grammarBuilder.append("KW3102 : 'KW' '3102';\n"); grammarBuilder.append("KW3103 : 'KW' '3103';\n"); grammarBuilder.append("KW3104 : 'KW' '3104';\n"); grammarBuilder.append("KW3105 : 'KW' '3105';\n"); grammarBuilder.append("KW3106 : 'KW' '3106';\n"); grammarBuilder.append("KW3107 : 'KW' '3107';\n"); grammarBuilder.append("KW3108 : 'KW' '3108';\n"); grammarBuilder.append("KW3109 : 'KW' '3109';\n"); grammarBuilder.append("KW3110 : 'KW' '3110';\n"); grammarBuilder.append("KW3111 : 'KW' '3111';\n"); grammarBuilder.append("KW3112 : 'KW' '3112';\n"); grammarBuilder.append("KW3113 : 'KW' '3113';\n"); grammarBuilder.append("KW3114 : 'KW' '3114';\n"); grammarBuilder.append("KW3115 : 'KW' '3115';\n"); grammarBuilder.append("KW3116 : 'KW' '3116';\n"); grammarBuilder.append("KW3117 : 'KW' '3117';\n"); grammarBuilder.append("KW3118 : 'KW' '3118';\n"); grammarBuilder.append("KW3119 : 'KW' '3119';\n"); grammarBuilder.append("KW3120 : 'KW' '3120';\n"); grammarBuilder.append("KW3121 : 'KW' '3121';\n"); grammarBuilder.append("KW3122 : 'KW' '3122';\n"); grammarBuilder.append("KW3123 : 'KW' '3123';\n"); grammarBuilder.append("KW3124 : 'KW' '3124';\n"); grammarBuilder.append("KW3125 : 'KW' '3125';\n"); grammarBuilder.append("KW3126 : 'KW' '3126';\n"); grammarBuilder.append("KW3127 : 'KW' '3127';\n"); grammarBuilder.append("KW3128 : 'KW' '3128';\n"); grammarBuilder.append("KW3129 : 'KW' '3129';\n"); grammarBuilder.append("KW3130 : 'KW' '3130';\n"); grammarBuilder.append("KW3131 : 'KW' '3131';\n"); grammarBuilder.append("KW3132 : 'KW' '3132';\n"); grammarBuilder.append("KW3133 : 'KW' '3133';\n"); grammarBuilder.append("KW3134 : 'KW' '3134';\n"); grammarBuilder.append("KW3135 : 'KW' '3135';\n"); grammarBuilder.append("KW3136 : 'KW' '3136';\n"); grammarBuilder.append("KW3137 : 'KW' '3137';\n"); grammarBuilder.append("KW3138 : 'KW' '3138';\n"); grammarBuilder.append("KW3139 : 'KW' '3139';\n"); grammarBuilder.append("KW3140 : 'KW' '3140';\n"); grammarBuilder.append("KW3141 : 'KW' '3141';\n"); grammarBuilder.append("KW3142 : 'KW' '3142';\n"); grammarBuilder.append("KW3143 : 'KW' '3143';\n"); grammarBuilder.append("KW3144 : 'KW' '3144';\n"); grammarBuilder.append("KW3145 : 'KW' '3145';\n"); grammarBuilder.append("KW3146 : 'KW' '3146';\n"); grammarBuilder.append("KW3147 : 'KW' '3147';\n"); grammarBuilder.append("KW3148 : 'KW' '3148';\n"); grammarBuilder.append("KW3149 : 'KW' '3149';\n"); grammarBuilder.append("KW3150 : 'KW' '3150';\n"); grammarBuilder.append("KW3151 : 'KW' '3151';\n"); grammarBuilder.append("KW3152 : 'KW' '3152';\n"); grammarBuilder.append("KW3153 : 'KW' '3153';\n"); grammarBuilder.append("KW3154 : 'KW' '3154';\n"); grammarBuilder.append("KW3155 : 'KW' '3155';\n"); grammarBuilder.append("KW3156 : 'KW' '3156';\n"); grammarBuilder.append("KW3157 : 'KW' '3157';\n"); grammarBuilder.append("KW3158 : 'KW' '3158';\n"); grammarBuilder.append("KW3159 : 'KW' '3159';\n"); grammarBuilder.append("KW3160 : 'KW' '3160';\n"); grammarBuilder.append("KW3161 : 'KW' '3161';\n"); grammarBuilder.append("KW3162 : 'KW' '3162';\n"); grammarBuilder.append("KW3163 : 'KW' '3163';\n"); grammarBuilder.append("KW3164 : 'KW' '3164';\n"); grammarBuilder.append("KW3165 : 'KW' '3165';\n"); grammarBuilder.append("KW3166 : 'KW' '3166';\n"); grammarBuilder.append("KW3167 : 'KW' '3167';\n"); grammarBuilder.append("KW3168 : 'KW' '3168';\n"); grammarBuilder.append("KW3169 : 'KW' '3169';\n"); grammarBuilder.append("KW3170 : 'KW' '3170';\n"); grammarBuilder.append("KW3171 : 'KW' '3171';\n"); grammarBuilder.append("KW3172 : 'KW' '3172';\n"); grammarBuilder.append("KW3173 : 'KW' '3173';\n"); grammarBuilder.append("KW3174 : 'KW' '3174';\n"); grammarBuilder.append("KW3175 : 'KW' '3175';\n"); grammarBuilder.append("KW3176 : 'KW' '3176';\n"); grammarBuilder.append("KW3177 : 'KW' '3177';\n"); grammarBuilder.append("KW3178 : 'KW' '3178';\n"); grammarBuilder.append("KW3179 : 'KW' '3179';\n"); grammarBuilder.append("KW3180 : 'KW' '3180';\n"); grammarBuilder.append("KW3181 : 'KW' '3181';\n"); grammarBuilder.append("KW3182 : 'KW' '3182';\n"); grammarBuilder.append("KW3183 : 'KW' '3183';\n"); grammarBuilder.append("KW3184 : 'KW' '3184';\n"); grammarBuilder.append("KW3185 : 'KW' '3185';\n"); grammarBuilder.append("KW3186 : 'KW' '3186';\n"); grammarBuilder.append("KW3187 : 'KW' '3187';\n"); grammarBuilder.append("KW3188 : 'KW' '3188';\n"); grammarBuilder.append("KW3189 : 'KW' '3189';\n"); grammarBuilder.append("KW3190 : 'KW' '3190';\n"); grammarBuilder.append("KW3191 : 'KW' '3191';\n"); grammarBuilder.append("KW3192 : 'KW' '3192';\n"); grammarBuilder.append("KW3193 : 'KW' '3193';\n"); grammarBuilder.append("KW3194 : 'KW' '3194';\n"); grammarBuilder.append("KW3195 : 'KW' '3195';\n"); grammarBuilder.append("KW3196 : 'KW' '3196';\n"); grammarBuilder.append("KW3197 : 'KW' '3197';\n"); grammarBuilder.append("KW3198 : 'KW' '3198';\n"); grammarBuilder.append("KW3199 : 'KW' '3199';\n"); grammarBuilder.append("KW3200 : 'KW' '3200';\n"); grammarBuilder.append("KW3201 : 'KW' '3201';\n"); grammarBuilder.append("KW3202 : 'KW' '3202';\n"); grammarBuilder.append("KW3203 : 'KW' '3203';\n"); grammarBuilder.append("KW3204 : 'KW' '3204';\n"); grammarBuilder.append("KW3205 : 'KW' '3205';\n"); grammarBuilder.append("KW3206 : 'KW' '3206';\n"); grammarBuilder.append("KW3207 : 'KW' '3207';\n"); grammarBuilder.append("KW3208 : 'KW' '3208';\n"); grammarBuilder.append("KW3209 : 'KW' '3209';\n"); grammarBuilder.append("KW3210 : 'KW' '3210';\n"); grammarBuilder.append("KW3211 : 'KW' '3211';\n"); grammarBuilder.append("KW3212 : 'KW' '3212';\n"); grammarBuilder.append("KW3213 : 'KW' '3213';\n"); grammarBuilder.append("KW3214 : 'KW' '3214';\n"); grammarBuilder.append("KW3215 : 'KW' '3215';\n"); grammarBuilder.append("KW3216 : 'KW' '3216';\n"); grammarBuilder.append("KW3217 : 'KW' '3217';\n"); grammarBuilder.append("KW3218 : 'KW' '3218';\n"); grammarBuilder.append("KW3219 : 'KW' '3219';\n"); grammarBuilder.append("KW3220 : 'KW' '3220';\n"); grammarBuilder.append("KW3221 : 'KW' '3221';\n"); grammarBuilder.append("KW3222 : 'KW' '3222';\n"); grammarBuilder.append("KW3223 : 'KW' '3223';\n"); grammarBuilder.append("KW3224 : 'KW' '3224';\n"); grammarBuilder.append("KW3225 : 'KW' '3225';\n"); grammarBuilder.append("KW3226 : 'KW' '3226';\n"); grammarBuilder.append("KW3227 : 'KW' '3227';\n"); grammarBuilder.append("KW3228 : 'KW' '3228';\n"); grammarBuilder.append("KW3229 : 'KW' '3229';\n"); grammarBuilder.append("KW3230 : 'KW' '3230';\n"); grammarBuilder.append("KW3231 : 'KW' '3231';\n"); grammarBuilder.append("KW3232 : 'KW' '3232';\n"); grammarBuilder.append("KW3233 : 'KW' '3233';\n"); grammarBuilder.append("KW3234 : 'KW' '3234';\n"); grammarBuilder.append("KW3235 : 'KW' '3235';\n"); grammarBuilder.append("KW3236 : 'KW' '3236';\n"); grammarBuilder.append("KW3237 : 'KW' '3237';\n"); grammarBuilder.append("KW3238 : 'KW' '3238';\n"); grammarBuilder.append("KW3239 : 'KW' '3239';\n"); grammarBuilder.append("KW3240 : 'KW' '3240';\n"); grammarBuilder.append("KW3241 : 'KW' '3241';\n"); grammarBuilder.append("KW3242 : 'KW' '3242';\n"); grammarBuilder.append("KW3243 : 'KW' '3243';\n"); grammarBuilder.append("KW3244 : 'KW' '3244';\n"); grammarBuilder.append("KW3245 : 'KW' '3245';\n"); grammarBuilder.append("KW3246 : 'KW' '3246';\n"); grammarBuilder.append("KW3247 : 'KW' '3247';\n"); grammarBuilder.append("KW3248 : 'KW' '3248';\n"); grammarBuilder.append("KW3249 : 'KW' '3249';\n"); grammarBuilder.append("KW3250 : 'KW' '3250';\n"); grammarBuilder.append("KW3251 : 'KW' '3251';\n"); grammarBuilder.append("KW3252 : 'KW' '3252';\n"); grammarBuilder.append("KW3253 : 'KW' '3253';\n"); grammarBuilder.append("KW3254 : 'KW' '3254';\n"); grammarBuilder.append("KW3255 : 'KW' '3255';\n"); grammarBuilder.append("KW3256 : 'KW' '3256';\n"); grammarBuilder.append("KW3257 : 'KW' '3257';\n"); grammarBuilder.append("KW3258 : 'KW' '3258';\n"); grammarBuilder.append("KW3259 : 'KW' '3259';\n"); grammarBuilder.append("KW3260 : 'KW' '3260';\n"); grammarBuilder.append("KW3261 : 'KW' '3261';\n"); grammarBuilder.append("KW3262 : 'KW' '3262';\n"); grammarBuilder.append("KW3263 : 'KW' '3263';\n"); grammarBuilder.append("KW3264 : 'KW' '3264';\n"); grammarBuilder.append("KW3265 : 'KW' '3265';\n"); grammarBuilder.append("KW3266 : 'KW' '3266';\n"); grammarBuilder.append("KW3267 : 'KW' '3267';\n"); grammarBuilder.append("KW3268 : 'KW' '3268';\n"); grammarBuilder.append("KW3269 : 'KW' '3269';\n"); grammarBuilder.append("KW3270 : 'KW' '3270';\n"); grammarBuilder.append("KW3271 : 'KW' '3271';\n"); grammarBuilder.append("KW3272 : 'KW' '3272';\n"); grammarBuilder.append("KW3273 : 'KW' '3273';\n"); grammarBuilder.append("KW3274 : 'KW' '3274';\n"); grammarBuilder.append("KW3275 : 'KW' '3275';\n"); grammarBuilder.append("KW3276 : 'KW' '3276';\n"); grammarBuilder.append("KW3277 : 'KW' '3277';\n"); grammarBuilder.append("KW3278 : 'KW' '3278';\n"); grammarBuilder.append("KW3279 : 'KW' '3279';\n"); grammarBuilder.append("KW3280 : 'KW' '3280';\n"); grammarBuilder.append("KW3281 : 'KW' '3281';\n"); grammarBuilder.append("KW3282 : 'KW' '3282';\n"); grammarBuilder.append("KW3283 : 'KW' '3283';\n"); grammarBuilder.append("KW3284 : 'KW' '3284';\n"); grammarBuilder.append("KW3285 : 'KW' '3285';\n"); grammarBuilder.append("KW3286 : 'KW' '3286';\n"); grammarBuilder.append("KW3287 : 'KW' '3287';\n"); grammarBuilder.append("KW3288 : 'KW' '3288';\n"); grammarBuilder.append("KW3289 : 'KW' '3289';\n"); grammarBuilder.append("KW3290 : 'KW' '3290';\n"); grammarBuilder.append("KW3291 : 'KW' '3291';\n"); grammarBuilder.append("KW3292 : 'KW' '3292';\n"); grammarBuilder.append("KW3293 : 'KW' '3293';\n"); grammarBuilder.append("KW3294 : 'KW' '3294';\n"); grammarBuilder.append("KW3295 : 'KW' '3295';\n"); grammarBuilder.append("KW3296 : 'KW' '3296';\n"); grammarBuilder.append("KW3297 : 'KW' '3297';\n"); grammarBuilder.append("KW3298 : 'KW' '3298';\n"); grammarBuilder.append("KW3299 : 'KW' '3299';\n"); grammarBuilder.append("KW3300 : 'KW' '3300';\n"); grammarBuilder.append("KW3301 : 'KW' '3301';\n"); grammarBuilder.append("KW3302 : 'KW' '3302';\n"); grammarBuilder.append("KW3303 : 'KW' '3303';\n"); grammarBuilder.append("KW3304 : 'KW' '3304';\n"); grammarBuilder.append("KW3305 : 'KW' '3305';\n"); grammarBuilder.append("KW3306 : 'KW' '3306';\n"); grammarBuilder.append("KW3307 : 'KW' '3307';\n"); grammarBuilder.append("KW3308 : 'KW' '3308';\n"); grammarBuilder.append("KW3309 : 'KW' '3309';\n"); grammarBuilder.append("KW3310 : 'KW' '3310';\n"); grammarBuilder.append("KW3311 : 'KW' '3311';\n"); grammarBuilder.append("KW3312 : 'KW' '3312';\n"); grammarBuilder.append("KW3313 : 'KW' '3313';\n"); grammarBuilder.append("KW3314 : 'KW' '3314';\n"); grammarBuilder.append("KW3315 : 'KW' '3315';\n"); grammarBuilder.append("KW3316 : 'KW' '3316';\n"); grammarBuilder.append("KW3317 : 'KW' '3317';\n"); grammarBuilder.append("KW3318 : 'KW' '3318';\n"); grammarBuilder.append("KW3319 : 'KW' '3319';\n"); grammarBuilder.append("KW3320 : 'KW' '3320';\n"); grammarBuilder.append("KW3321 : 'KW' '3321';\n"); grammarBuilder.append("KW3322 : 'KW' '3322';\n"); grammarBuilder.append("KW3323 : 'KW' '3323';\n"); grammarBuilder.append("KW3324 : 'KW' '3324';\n"); grammarBuilder.append("KW3325 : 'KW' '3325';\n"); grammarBuilder.append("KW3326 : 'KW' '3326';\n"); grammarBuilder.append("KW3327 : 'KW' '3327';\n"); grammarBuilder.append("KW3328 : 'KW' '3328';\n"); grammarBuilder.append("KW3329 : 'KW' '3329';\n"); grammarBuilder.append("KW3330 : 'KW' '3330';\n"); grammarBuilder.append("KW3331 : 'KW' '3331';\n"); grammarBuilder.append("KW3332 : 'KW' '3332';\n"); grammarBuilder.append("KW3333 : 'KW' '3333';\n"); grammarBuilder.append("KW3334 : 'KW' '3334';\n"); grammarBuilder.append("KW3335 : 'KW' '3335';\n"); grammarBuilder.append("KW3336 : 'KW' '3336';\n"); grammarBuilder.append("KW3337 : 'KW' '3337';\n"); grammarBuilder.append("KW3338 : 'KW' '3338';\n"); grammarBuilder.append("KW3339 : 'KW' '3339';\n"); grammarBuilder.append("KW3340 : 'KW' '3340';\n"); grammarBuilder.append("KW3341 : 'KW' '3341';\n"); grammarBuilder.append("KW3342 : 'KW' '3342';\n"); grammarBuilder.append("KW3343 : 'KW' '3343';\n"); grammarBuilder.append("KW3344 : 'KW' '3344';\n"); grammarBuilder.append("KW3345 : 'KW' '3345';\n"); grammarBuilder.append("KW3346 : 'KW' '3346';\n"); grammarBuilder.append("KW3347 : 'KW' '3347';\n"); grammarBuilder.append("KW3348 : 'KW' '3348';\n"); grammarBuilder.append("KW3349 : 'KW' '3349';\n"); grammarBuilder.append("KW3350 : 'KW' '3350';\n"); grammarBuilder.append("KW3351 : 'KW' '3351';\n"); grammarBuilder.append("KW3352 : 'KW' '3352';\n"); grammarBuilder.append("KW3353 : 'KW' '3353';\n"); grammarBuilder.append("KW3354 : 'KW' '3354';\n"); grammarBuilder.append("KW3355 : 'KW' '3355';\n"); grammarBuilder.append("KW3356 : 'KW' '3356';\n"); grammarBuilder.append("KW3357 : 'KW' '3357';\n"); grammarBuilder.append("KW3358 : 'KW' '3358';\n"); grammarBuilder.append("KW3359 : 'KW' '3359';\n"); grammarBuilder.append("KW3360 : 'KW' '3360';\n"); grammarBuilder.append("KW3361 : 'KW' '3361';\n"); grammarBuilder.append("KW3362 : 'KW' '3362';\n"); grammarBuilder.append("KW3363 : 'KW' '3363';\n"); grammarBuilder.append("KW3364 : 'KW' '3364';\n"); grammarBuilder.append("KW3365 : 'KW' '3365';\n"); grammarBuilder.append("KW3366 : 'KW' '3366';\n"); grammarBuilder.append("KW3367 : 'KW' '3367';\n"); grammarBuilder.append("KW3368 : 'KW' '3368';\n"); grammarBuilder.append("KW3369 : 'KW' '3369';\n"); grammarBuilder.append("KW3370 : 'KW' '3370';\n"); grammarBuilder.append("KW3371 : 'KW' '3371';\n"); grammarBuilder.append("KW3372 : 'KW' '3372';\n"); grammarBuilder.append("KW3373 : 'KW' '3373';\n"); grammarBuilder.append("KW3374 : 'KW' '3374';\n"); grammarBuilder.append("KW3375 : 'KW' '3375';\n"); grammarBuilder.append("KW3376 : 'KW' '3376';\n"); grammarBuilder.append("KW3377 : 'KW' '3377';\n"); grammarBuilder.append("KW3378 : 'KW' '3378';\n"); grammarBuilder.append("KW3379 : 'KW' '3379';\n"); grammarBuilder.append("KW3380 : 'KW' '3380';\n"); grammarBuilder.append("KW3381 : 'KW' '3381';\n"); grammarBuilder.append("KW3382 : 'KW' '3382';\n"); grammarBuilder.append("KW3383 : 'KW' '3383';\n"); grammarBuilder.append("KW3384 : 'KW' '3384';\n"); grammarBuilder.append("KW3385 : 'KW' '3385';\n"); grammarBuilder.append("KW3386 : 'KW' '3386';\n"); grammarBuilder.append("KW3387 : 'KW' '3387';\n"); grammarBuilder.append("KW3388 : 'KW' '3388';\n"); grammarBuilder.append("KW3389 : 'KW' '3389';\n"); grammarBuilder.append("KW3390 : 'KW' '3390';\n"); grammarBuilder.append("KW3391 : 'KW' '3391';\n"); grammarBuilder.append("KW3392 : 'KW' '3392';\n"); grammarBuilder.append("KW3393 : 'KW' '3393';\n"); grammarBuilder.append("KW3394 : 'KW' '3394';\n"); grammarBuilder.append("KW3395 : 'KW' '3395';\n"); grammarBuilder.append("KW3396 : 'KW' '3396';\n"); grammarBuilder.append("KW3397 : 'KW' '3397';\n"); grammarBuilder.append("KW3398 : 'KW' '3398';\n"); grammarBuilder.append("KW3399 : 'KW' '3399';\n"); grammarBuilder.append("KW3400 : 'KW' '3400';\n"); grammarBuilder.append("KW3401 : 'KW' '3401';\n"); grammarBuilder.append("KW3402 : 'KW' '3402';\n"); grammarBuilder.append("KW3403 : 'KW' '3403';\n"); grammarBuilder.append("KW3404 : 'KW' '3404';\n"); grammarBuilder.append("KW3405 : 'KW' '3405';\n"); grammarBuilder.append("KW3406 : 'KW' '3406';\n"); grammarBuilder.append("KW3407 : 'KW' '3407';\n"); grammarBuilder.append("KW3408 : 'KW' '3408';\n"); grammarBuilder.append("KW3409 : 'KW' '3409';\n"); grammarBuilder.append("KW3410 : 'KW' '3410';\n"); grammarBuilder.append("KW3411 : 'KW' '3411';\n"); grammarBuilder.append("KW3412 : 'KW' '3412';\n"); grammarBuilder.append("KW3413 : 'KW' '3413';\n"); grammarBuilder.append("KW3414 : 'KW' '3414';\n"); grammarBuilder.append("KW3415 : 'KW' '3415';\n"); grammarBuilder.append("KW3416 : 'KW' '3416';\n"); grammarBuilder.append("KW3417 : 'KW' '3417';\n"); grammarBuilder.append("KW3418 : 'KW' '3418';\n"); grammarBuilder.append("KW3419 : 'KW' '3419';\n"); grammarBuilder.append("KW3420 : 'KW' '3420';\n"); grammarBuilder.append("KW3421 : 'KW' '3421';\n"); grammarBuilder.append("KW3422 : 'KW' '3422';\n"); grammarBuilder.append("KW3423 : 'KW' '3423';\n"); grammarBuilder.append("KW3424 : 'KW' '3424';\n"); grammarBuilder.append("KW3425 : 'KW' '3425';\n"); grammarBuilder.append("KW3426 : 'KW' '3426';\n"); grammarBuilder.append("KW3427 : 'KW' '3427';\n"); grammarBuilder.append("KW3428 : 'KW' '3428';\n"); grammarBuilder.append("KW3429 : 'KW' '3429';\n"); grammarBuilder.append("KW3430 : 'KW' '3430';\n"); grammarBuilder.append("KW3431 : 'KW' '3431';\n"); grammarBuilder.append("KW3432 : 'KW' '3432';\n"); grammarBuilder.append("KW3433 : 'KW' '3433';\n"); grammarBuilder.append("KW3434 : 'KW' '3434';\n"); grammarBuilder.append("KW3435 : 'KW' '3435';\n"); grammarBuilder.append("KW3436 : 'KW' '3436';\n"); grammarBuilder.append("KW3437 : 'KW' '3437';\n"); grammarBuilder.append("KW3438 : 'KW' '3438';\n"); grammarBuilder.append("KW3439 : 'KW' '3439';\n"); grammarBuilder.append("KW3440 : 'KW' '3440';\n"); grammarBuilder.append("KW3441 : 'KW' '3441';\n"); grammarBuilder.append("KW3442 : 'KW' '3442';\n"); grammarBuilder.append("KW3443 : 'KW' '3443';\n"); grammarBuilder.append("KW3444 : 'KW' '3444';\n"); grammarBuilder.append("KW3445 : 'KW' '3445';\n"); grammarBuilder.append("KW3446 : 'KW' '3446';\n"); grammarBuilder.append("KW3447 : 'KW' '3447';\n"); grammarBuilder.append("KW3448 : 'KW' '3448';\n"); grammarBuilder.append("KW3449 : 'KW' '3449';\n"); grammarBuilder.append("KW3450 : 'KW' '3450';\n"); grammarBuilder.append("KW3451 : 'KW' '3451';\n"); grammarBuilder.append("KW3452 : 'KW' '3452';\n"); grammarBuilder.append("KW3453 : 'KW' '3453';\n"); grammarBuilder.append("KW3454 : 'KW' '3454';\n"); grammarBuilder.append("KW3455 : 'KW' '3455';\n"); grammarBuilder.append("KW3456 : 'KW' '3456';\n"); grammarBuilder.append("KW3457 : 'KW' '3457';\n"); grammarBuilder.append("KW3458 : 'KW' '3458';\n"); grammarBuilder.append("KW3459 : 'KW' '3459';\n"); grammarBuilder.append("KW3460 : 'KW' '3460';\n"); grammarBuilder.append("KW3461 : 'KW' '3461';\n"); grammarBuilder.append("KW3462 : 'KW' '3462';\n"); grammarBuilder.append("KW3463 : 'KW' '3463';\n"); grammarBuilder.append("KW3464 : 'KW' '3464';\n"); grammarBuilder.append("KW3465 : 'KW' '3465';\n"); grammarBuilder.append("KW3466 : 'KW' '3466';\n"); grammarBuilder.append("KW3467 : 'KW' '3467';\n"); grammarBuilder.append("KW3468 : 'KW' '3468';\n"); grammarBuilder.append("KW3469 : 'KW' '3469';\n"); grammarBuilder.append("KW3470 : 'KW' '3470';\n"); grammarBuilder.append("KW3471 : 'KW' '3471';\n"); grammarBuilder.append("KW3472 : 'KW' '3472';\n"); grammarBuilder.append("KW3473 : 'KW' '3473';\n"); grammarBuilder.append("KW3474 : 'KW' '3474';\n"); grammarBuilder.append("KW3475 : 'KW' '3475';\n"); grammarBuilder.append("KW3476 : 'KW' '3476';\n"); grammarBuilder.append("KW3477 : 'KW' '3477';\n"); grammarBuilder.append("KW3478 : 'KW' '3478';\n"); grammarBuilder.append("KW3479 : 'KW' '3479';\n"); grammarBuilder.append("KW3480 : 'KW' '3480';\n"); grammarBuilder.append("KW3481 : 'KW' '3481';\n"); grammarBuilder.append("KW3482 : 'KW' '3482';\n"); grammarBuilder.append("KW3483 : 'KW' '3483';\n"); grammarBuilder.append("KW3484 : 'KW' '3484';\n"); grammarBuilder.append("KW3485 : 'KW' '3485';\n"); grammarBuilder.append("KW3486 : 'KW' '3486';\n"); grammarBuilder.append("KW3487 : 'KW' '3487';\n"); grammarBuilder.append("KW3488 : 'KW' '3488';\n"); grammarBuilder.append("KW3489 : 'KW' '3489';\n"); grammarBuilder.append("KW3490 : 'KW' '3490';\n"); grammarBuilder.append("KW3491 : 'KW' '3491';\n"); grammarBuilder.append("KW3492 : 'KW' '3492';\n"); grammarBuilder.append("KW3493 : 'KW' '3493';\n"); grammarBuilder.append("KW3494 : 'KW' '3494';\n"); grammarBuilder.append("KW3495 : 'KW' '3495';\n"); grammarBuilder.append("KW3496 : 'KW' '3496';\n"); grammarBuilder.append("KW3497 : 'KW' '3497';\n"); grammarBuilder.append("KW3498 : 'KW' '3498';\n"); grammarBuilder.append("KW3499 : 'KW' '3499';\n"); grammarBuilder.append("KW3500 : 'KW' '3500';\n"); grammarBuilder.append("KW3501 : 'KW' '3501';\n"); grammarBuilder.append("KW3502 : 'KW' '3502';\n"); grammarBuilder.append("KW3503 : 'KW' '3503';\n"); grammarBuilder.append("KW3504 : 'KW' '3504';\n"); grammarBuilder.append("KW3505 : 'KW' '3505';\n"); grammarBuilder.append("KW3506 : 'KW' '3506';\n"); grammarBuilder.append("KW3507 : 'KW' '3507';\n"); grammarBuilder.append("KW3508 : 'KW' '3508';\n"); grammarBuilder.append("KW3509 : 'KW' '3509';\n"); grammarBuilder.append("KW3510 : 'KW' '3510';\n"); grammarBuilder.append("KW3511 : 'KW' '3511';\n"); grammarBuilder.append("KW3512 : 'KW' '3512';\n"); grammarBuilder.append("KW3513 : 'KW' '3513';\n"); grammarBuilder.append("KW3514 : 'KW' '3514';\n"); grammarBuilder.append("KW3515 : 'KW' '3515';\n"); grammarBuilder.append("KW3516 : 'KW' '3516';\n"); grammarBuilder.append("KW3517 : 'KW' '3517';\n"); grammarBuilder.append("KW3518 : 'KW' '3518';\n"); grammarBuilder.append("KW3519 : 'KW' '3519';\n"); grammarBuilder.append("KW3520 : 'KW' '3520';\n"); grammarBuilder.append("KW3521 : 'KW' '3521';\n"); grammarBuilder.append("KW3522 : 'KW' '3522';\n"); grammarBuilder.append("KW3523 : 'KW' '3523';\n"); grammarBuilder.append("KW3524 : 'KW' '3524';\n"); grammarBuilder.append("KW3525 : 'KW' '3525';\n"); grammarBuilder.append("KW3526 : 'KW' '3526';\n"); grammarBuilder.append("KW3527 : 'KW' '3527';\n"); grammarBuilder.append("KW3528 : 'KW' '3528';\n"); grammarBuilder.append("KW3529 : 'KW' '3529';\n"); grammarBuilder.append("KW3530 : 'KW' '3530';\n"); grammarBuilder.append("KW3531 : 'KW' '3531';\n"); grammarBuilder.append("KW3532 : 'KW' '3532';\n"); grammarBuilder.append("KW3533 : 'KW' '3533';\n"); grammarBuilder.append("KW3534 : 'KW' '3534';\n"); grammarBuilder.append("KW3535 : 'KW' '3535';\n"); grammarBuilder.append("KW3536 : 'KW' '3536';\n"); grammarBuilder.append("KW3537 : 'KW' '3537';\n"); grammarBuilder.append("KW3538 : 'KW' '3538';\n"); grammarBuilder.append("KW3539 : 'KW' '3539';\n"); grammarBuilder.append("KW3540 : 'KW' '3540';\n"); grammarBuilder.append("KW3541 : 'KW' '3541';\n"); grammarBuilder.append("KW3542 : 'KW' '3542';\n"); grammarBuilder.append("KW3543 : 'KW' '3543';\n"); grammarBuilder.append("KW3544 : 'KW' '3544';\n"); grammarBuilder.append("KW3545 : 'KW' '3545';\n"); grammarBuilder.append("KW3546 : 'KW' '3546';\n"); grammarBuilder.append("KW3547 : 'KW' '3547';\n"); grammarBuilder.append("KW3548 : 'KW' '3548';\n"); grammarBuilder.append("KW3549 : 'KW' '3549';\n"); grammarBuilder.append("KW3550 : 'KW' '3550';\n"); grammarBuilder.append("KW3551 : 'KW' '3551';\n"); grammarBuilder.append("KW3552 : 'KW' '3552';\n"); grammarBuilder.append("KW3553 : 'KW' '3553';\n"); grammarBuilder.append("KW3554 : 'KW' '3554';\n"); grammarBuilder.append("KW3555 : 'KW' '3555';\n"); grammarBuilder.append("KW3556 : 'KW' '3556';\n"); grammarBuilder.append("KW3557 : 'KW' '3557';\n"); grammarBuilder.append("KW3558 : 'KW' '3558';\n"); grammarBuilder.append("KW3559 : 'KW' '3559';\n"); grammarBuilder.append("KW3560 : 'KW' '3560';\n"); grammarBuilder.append("KW3561 : 'KW' '3561';\n"); grammarBuilder.append("KW3562 : 'KW' '3562';\n"); grammarBuilder.append("KW3563 : 'KW' '3563';\n"); grammarBuilder.append("KW3564 : 'KW' '3564';\n"); grammarBuilder.append("KW3565 : 'KW' '3565';\n"); grammarBuilder.append("KW3566 : 'KW' '3566';\n"); grammarBuilder.append("KW3567 : 'KW' '3567';\n"); grammarBuilder.append("KW3568 : 'KW' '3568';\n"); grammarBuilder.append("KW3569 : 'KW' '3569';\n"); grammarBuilder.append("KW3570 : 'KW' '3570';\n"); grammarBuilder.append("KW3571 : 'KW' '3571';\n"); grammarBuilder.append("KW3572 : 'KW' '3572';\n"); grammarBuilder.append("KW3573 : 'KW' '3573';\n"); grammarBuilder.append("KW3574 : 'KW' '3574';\n"); grammarBuilder.append("KW3575 : 'KW' '3575';\n"); grammarBuilder.append("KW3576 : 'KW' '3576';\n"); grammarBuilder.append("KW3577 : 'KW' '3577';\n"); grammarBuilder.append("KW3578 : 'KW' '3578';\n"); grammarBuilder.append("KW3579 : 'KW' '3579';\n"); grammarBuilder.append("KW3580 : 'KW' '3580';\n"); grammarBuilder.append("KW3581 : 'KW' '3581';\n"); grammarBuilder.append("KW3582 : 'KW' '3582';\n"); grammarBuilder.append("KW3583 : 'KW' '3583';\n"); grammarBuilder.append("KW3584 : 'KW' '3584';\n"); grammarBuilder.append("KW3585 : 'KW' '3585';\n"); grammarBuilder.append("KW3586 : 'KW' '3586';\n"); grammarBuilder.append("KW3587 : 'KW' '3587';\n"); grammarBuilder.append("KW3588 : 'KW' '3588';\n"); grammarBuilder.append("KW3589 : 'KW' '3589';\n"); grammarBuilder.append("KW3590 : 'KW' '3590';\n"); grammarBuilder.append("KW3591 : 'KW' '3591';\n"); grammarBuilder.append("KW3592 : 'KW' '3592';\n"); grammarBuilder.append("KW3593 : 'KW' '3593';\n"); grammarBuilder.append("KW3594 : 'KW' '3594';\n"); grammarBuilder.append("KW3595 : 'KW' '3595';\n"); grammarBuilder.append("KW3596 : 'KW' '3596';\n"); grammarBuilder.append("KW3597 : 'KW' '3597';\n"); grammarBuilder.append("KW3598 : 'KW' '3598';\n"); grammarBuilder.append("KW3599 : 'KW' '3599';\n"); grammarBuilder.append("KW3600 : 'KW' '3600';\n"); grammarBuilder.append("KW3601 : 'KW' '3601';\n"); grammarBuilder.append("KW3602 : 'KW' '3602';\n"); grammarBuilder.append("KW3603 : 'KW' '3603';\n"); grammarBuilder.append("KW3604 : 'KW' '3604';\n"); grammarBuilder.append("KW3605 : 'KW' '3605';\n"); grammarBuilder.append("KW3606 : 'KW' '3606';\n"); grammarBuilder.append("KW3607 : 'KW' '3607';\n"); grammarBuilder.append("KW3608 : 'KW' '3608';\n"); grammarBuilder.append("KW3609 : 'KW' '3609';\n"); grammarBuilder.append("KW3610 : 'KW' '3610';\n"); grammarBuilder.append("KW3611 : 'KW' '3611';\n"); grammarBuilder.append("KW3612 : 'KW' '3612';\n"); grammarBuilder.append("KW3613 : 'KW' '3613';\n"); grammarBuilder.append("KW3614 : 'KW' '3614';\n"); grammarBuilder.append("KW3615 : 'KW' '3615';\n"); grammarBuilder.append("KW3616 : 'KW' '3616';\n"); grammarBuilder.append("KW3617 : 'KW' '3617';\n"); grammarBuilder.append("KW3618 : 'KW' '3618';\n"); grammarBuilder.append("KW3619 : 'KW' '3619';\n"); grammarBuilder.append("KW3620 : 'KW' '3620';\n"); grammarBuilder.append("KW3621 : 'KW' '3621';\n"); grammarBuilder.append("KW3622 : 'KW' '3622';\n"); grammarBuilder.append("KW3623 : 'KW' '3623';\n"); grammarBuilder.append("KW3624 : 'KW' '3624';\n"); grammarBuilder.append("KW3625 : 'KW' '3625';\n"); grammarBuilder.append("KW3626 : 'KW' '3626';\n"); grammarBuilder.append("KW3627 : 'KW' '3627';\n"); grammarBuilder.append("KW3628 : 'KW' '3628';\n"); grammarBuilder.append("KW3629 : 'KW' '3629';\n"); grammarBuilder.append("KW3630 : 'KW' '3630';\n"); grammarBuilder.append("KW3631 : 'KW' '3631';\n"); grammarBuilder.append("KW3632 : 'KW' '3632';\n"); grammarBuilder.append("KW3633 : 'KW' '3633';\n"); grammarBuilder.append("KW3634 : 'KW' '3634';\n"); grammarBuilder.append("KW3635 : 'KW' '3635';\n"); grammarBuilder.append("KW3636 : 'KW' '3636';\n"); grammarBuilder.append("KW3637 : 'KW' '3637';\n"); grammarBuilder.append("KW3638 : 'KW' '3638';\n"); grammarBuilder.append("KW3639 : 'KW' '3639';\n"); grammarBuilder.append("KW3640 : 'KW' '3640';\n"); grammarBuilder.append("KW3641 : 'KW' '3641';\n"); grammarBuilder.append("KW3642 : 'KW' '3642';\n"); grammarBuilder.append("KW3643 : 'KW' '3643';\n"); grammarBuilder.append("KW3644 : 'KW' '3644';\n"); grammarBuilder.append("KW3645 : 'KW' '3645';\n"); grammarBuilder.append("KW3646 : 'KW' '3646';\n"); grammarBuilder.append("KW3647 : 'KW' '3647';\n"); grammarBuilder.append("KW3648 : 'KW' '3648';\n"); grammarBuilder.append("KW3649 : 'KW' '3649';\n"); grammarBuilder.append("KW3650 : 'KW' '3650';\n"); grammarBuilder.append("KW3651 : 'KW' '3651';\n"); grammarBuilder.append("KW3652 : 'KW' '3652';\n"); grammarBuilder.append("KW3653 : 'KW' '3653';\n"); grammarBuilder.append("KW3654 : 'KW' '3654';\n"); grammarBuilder.append("KW3655 : 'KW' '3655';\n"); grammarBuilder.append("KW3656 : 'KW' '3656';\n"); grammarBuilder.append("KW3657 : 'KW' '3657';\n"); grammarBuilder.append("KW3658 : 'KW' '3658';\n"); grammarBuilder.append("KW3659 : 'KW' '3659';\n"); grammarBuilder.append("KW3660 : 'KW' '3660';\n"); grammarBuilder.append("KW3661 : 'KW' '3661';\n"); grammarBuilder.append("KW3662 : 'KW' '3662';\n"); grammarBuilder.append("KW3663 : 'KW' '3663';\n"); grammarBuilder.append("KW3664 : 'KW' '3664';\n"); grammarBuilder.append("KW3665 : 'KW' '3665';\n"); grammarBuilder.append("KW3666 : 'KW' '3666';\n"); grammarBuilder.append("KW3667 : 'KW' '3667';\n"); grammarBuilder.append("KW3668 : 'KW' '3668';\n"); grammarBuilder.append("KW3669 : 'KW' '3669';\n"); grammarBuilder.append("KW3670 : 'KW' '3670';\n"); grammarBuilder.append("KW3671 : 'KW' '3671';\n"); grammarBuilder.append("KW3672 : 'KW' '3672';\n"); grammarBuilder.append("KW3673 : 'KW' '3673';\n"); grammarBuilder.append("KW3674 : 'KW' '3674';\n"); grammarBuilder.append("KW3675 : 'KW' '3675';\n"); grammarBuilder.append("KW3676 : 'KW' '3676';\n"); grammarBuilder.append("KW3677 : 'KW' '3677';\n"); grammarBuilder.append("KW3678 : 'KW' '3678';\n"); grammarBuilder.append("KW3679 : 'KW' '3679';\n"); grammarBuilder.append("KW3680 : 'KW' '3680';\n"); grammarBuilder.append("KW3681 : 'KW' '3681';\n"); grammarBuilder.append("KW3682 : 'KW' '3682';\n"); grammarBuilder.append("KW3683 : 'KW' '3683';\n"); grammarBuilder.append("KW3684 : 'KW' '3684';\n"); grammarBuilder.append("KW3685 : 'KW' '3685';\n"); grammarBuilder.append("KW3686 : 'KW' '3686';\n"); grammarBuilder.append("KW3687 : 'KW' '3687';\n"); grammarBuilder.append("KW3688 : 'KW' '3688';\n"); grammarBuilder.append("KW3689 : 'KW' '3689';\n"); grammarBuilder.append("KW3690 : 'KW' '3690';\n"); grammarBuilder.append("KW3691 : 'KW' '3691';\n"); grammarBuilder.append("KW3692 : 'KW' '3692';\n"); grammarBuilder.append("KW3693 : 'KW' '3693';\n"); grammarBuilder.append("KW3694 : 'KW' '3694';\n"); grammarBuilder.append("KW3695 : 'KW' '3695';\n"); grammarBuilder.append("KW3696 : 'KW' '3696';\n"); grammarBuilder.append("KW3697 : 'KW' '3697';\n"); grammarBuilder.append("KW3698 : 'KW' '3698';\n"); grammarBuilder.append("KW3699 : 'KW' '3699';\n"); grammarBuilder.append("KW3700 : 'KW' '3700';\n"); grammarBuilder.append("KW3701 : 'KW' '3701';\n"); grammarBuilder.append("KW3702 : 'KW' '3702';\n"); grammarBuilder.append("KW3703 : 'KW' '3703';\n"); grammarBuilder.append("KW3704 : 'KW' '3704';\n"); grammarBuilder.append("KW3705 : 'KW' '3705';\n"); grammarBuilder.append("KW3706 : 'KW' '3706';\n"); grammarBuilder.append("KW3707 : 'KW' '3707';\n"); grammarBuilder.append("KW3708 : 'KW' '3708';\n"); grammarBuilder.append("KW3709 : 'KW' '3709';\n"); grammarBuilder.append("KW3710 : 'KW' '3710';\n"); grammarBuilder.append("KW3711 : 'KW' '3711';\n"); grammarBuilder.append("KW3712 : 'KW' '3712';\n"); grammarBuilder.append("KW3713 : 'KW' '3713';\n"); grammarBuilder.append("KW3714 : 'KW' '3714';\n"); grammarBuilder.append("KW3715 : 'KW' '3715';\n"); grammarBuilder.append("KW3716 : 'KW' '3716';\n"); grammarBuilder.append("KW3717 : 'KW' '3717';\n"); grammarBuilder.append("KW3718 : 'KW' '3718';\n"); grammarBuilder.append("KW3719 : 'KW' '3719';\n"); grammarBuilder.append("KW3720 : 'KW' '3720';\n"); grammarBuilder.append("KW3721 : 'KW' '3721';\n"); grammarBuilder.append("KW3722 : 'KW' '3722';\n"); grammarBuilder.append("KW3723 : 'KW' '3723';\n"); grammarBuilder.append("KW3724 : 'KW' '3724';\n"); grammarBuilder.append("KW3725 : 'KW' '3725';\n"); grammarBuilder.append("KW3726 : 'KW' '3726';\n"); grammarBuilder.append("KW3727 : 'KW' '3727';\n"); grammarBuilder.append("KW3728 : 'KW' '3728';\n"); grammarBuilder.append("KW3729 : 'KW' '3729';\n"); grammarBuilder.append("KW3730 : 'KW' '3730';\n"); grammarBuilder.append("KW3731 : 'KW' '3731';\n"); grammarBuilder.append("KW3732 : 'KW' '3732';\n"); grammarBuilder.append("KW3733 : 'KW' '3733';\n"); grammarBuilder.append("KW3734 : 'KW' '3734';\n"); grammarBuilder.append("KW3735 : 'KW' '3735';\n"); grammarBuilder.append("KW3736 : 'KW' '3736';\n"); grammarBuilder.append("KW3737 : 'KW' '3737';\n"); grammarBuilder.append("KW3738 : 'KW' '3738';\n"); grammarBuilder.append("KW3739 : 'KW' '3739';\n"); grammarBuilder.append("KW3740 : 'KW' '3740';\n"); grammarBuilder.append("KW3741 : 'KW' '3741';\n"); grammarBuilder.append("KW3742 : 'KW' '3742';\n"); grammarBuilder.append("KW3743 : 'KW' '3743';\n"); grammarBuilder.append("KW3744 : 'KW' '3744';\n"); grammarBuilder.append("KW3745 : 'KW' '3745';\n"); grammarBuilder.append("KW3746 : 'KW' '3746';\n"); grammarBuilder.append("KW3747 : 'KW' '3747';\n"); grammarBuilder.append("KW3748 : 'KW' '3748';\n"); grammarBuilder.append("KW3749 : 'KW' '3749';\n"); grammarBuilder.append("KW3750 : 'KW' '3750';\n"); grammarBuilder.append("KW3751 : 'KW' '3751';\n"); grammarBuilder.append("KW3752 : 'KW' '3752';\n"); grammarBuilder.append("KW3753 : 'KW' '3753';\n"); grammarBuilder.append("KW3754 : 'KW' '3754';\n"); grammarBuilder.append("KW3755 : 'KW' '3755';\n"); grammarBuilder.append("KW3756 : 'KW' '3756';\n"); grammarBuilder.append("KW3757 : 'KW' '3757';\n"); grammarBuilder.append("KW3758 : 'KW' '3758';\n"); grammarBuilder.append("KW3759 : 'KW' '3759';\n"); grammarBuilder.append("KW3760 : 'KW' '3760';\n"); grammarBuilder.append("KW3761 : 'KW' '3761';\n"); grammarBuilder.append("KW3762 : 'KW' '3762';\n"); grammarBuilder.append("KW3763 : 'KW' '3763';\n"); grammarBuilder.append("KW3764 : 'KW' '3764';\n"); grammarBuilder.append("KW3765 : 'KW' '3765';\n"); grammarBuilder.append("KW3766 : 'KW' '3766';\n"); grammarBuilder.append("KW3767 : 'KW' '3767';\n"); grammarBuilder.append("KW3768 : 'KW' '3768';\n"); grammarBuilder.append("KW3769 : 'KW' '3769';\n"); grammarBuilder.append("KW3770 : 'KW' '3770';\n"); grammarBuilder.append("KW3771 : 'KW' '3771';\n"); grammarBuilder.append("KW3772 : 'KW' '3772';\n"); grammarBuilder.append("KW3773 : 'KW' '3773';\n"); grammarBuilder.append("KW3774 : 'KW' '3774';\n"); grammarBuilder.append("KW3775 : 'KW' '3775';\n"); grammarBuilder.append("KW3776 : 'KW' '3776';\n"); grammarBuilder.append("KW3777 : 'KW' '3777';\n"); grammarBuilder.append("KW3778 : 'KW' '3778';\n"); grammarBuilder.append("KW3779 : 'KW' '3779';\n"); grammarBuilder.append("KW3780 : 'KW' '3780';\n"); grammarBuilder.append("KW3781 : 'KW' '3781';\n"); grammarBuilder.append("KW3782 : 'KW' '3782';\n"); grammarBuilder.append("KW3783 : 'KW' '3783';\n"); grammarBuilder.append("KW3784 : 'KW' '3784';\n"); grammarBuilder.append("KW3785 : 'KW' '3785';\n"); grammarBuilder.append("KW3786 : 'KW' '3786';\n"); grammarBuilder.append("KW3787 : 'KW' '3787';\n"); grammarBuilder.append("KW3788 : 'KW' '3788';\n"); grammarBuilder.append("KW3789 : 'KW' '3789';\n"); grammarBuilder.append("KW3790 : 'KW' '3790';\n"); grammarBuilder.append("KW3791 : 'KW' '3791';\n"); grammarBuilder.append("KW3792 : 'KW' '3792';\n"); grammarBuilder.append("KW3793 : 'KW' '3793';\n"); grammarBuilder.append("KW3794 : 'KW' '3794';\n"); grammarBuilder.append("KW3795 : 'KW' '3795';\n"); grammarBuilder.append("KW3796 : 'KW' '3796';\n"); grammarBuilder.append("KW3797 : 'KW' '3797';\n"); grammarBuilder.append("KW3798 : 'KW' '3798';\n"); grammarBuilder.append("KW3799 : 'KW' '3799';\n"); grammarBuilder.append("KW3800 : 'KW' '3800';\n"); grammarBuilder.append("KW3801 : 'KW' '3801';\n"); grammarBuilder.append("KW3802 : 'KW' '3802';\n"); grammarBuilder.append("KW3803 : 'KW' '3803';\n"); grammarBuilder.append("KW3804 : 'KW' '3804';\n"); grammarBuilder.append("KW3805 : 'KW' '3805';\n"); grammarBuilder.append("KW3806 : 'KW' '3806';\n"); grammarBuilder.append("KW3807 : 'KW' '3807';\n"); grammarBuilder.append("KW3808 : 'KW' '3808';\n"); grammarBuilder.append("KW3809 : 'KW' '3809';\n"); grammarBuilder.append("KW3810 : 'KW' '3810';\n"); grammarBuilder.append("KW3811 : 'KW' '3811';\n"); grammarBuilder.append("KW3812 : 'KW' '3812';\n"); grammarBuilder.append("KW3813 : 'KW' '3813';\n"); grammarBuilder.append("KW3814 : 'KW' '3814';\n"); grammarBuilder.append("KW3815 : 'KW' '3815';\n"); grammarBuilder.append("KW3816 : 'KW' '3816';\n"); grammarBuilder.append("KW3817 : 'KW' '3817';\n"); grammarBuilder.append("KW3818 : 'KW' '3818';\n"); grammarBuilder.append("KW3819 : 'KW' '3819';\n"); grammarBuilder.append("KW3820 : 'KW' '3820';\n"); grammarBuilder.append("KW3821 : 'KW' '3821';\n"); grammarBuilder.append("KW3822 : 'KW' '3822';\n"); grammarBuilder.append("KW3823 : 'KW' '3823';\n"); grammarBuilder.append("KW3824 : 'KW' '3824';\n"); grammarBuilder.append("KW3825 : 'KW' '3825';\n"); grammarBuilder.append("KW3826 : 'KW' '3826';\n"); grammarBuilder.append("KW3827 : 'KW' '3827';\n"); grammarBuilder.append("KW3828 : 'KW' '3828';\n"); grammarBuilder.append("KW3829 : 'KW' '3829';\n"); grammarBuilder.append("KW3830 : 'KW' '3830';\n"); grammarBuilder.append("KW3831 : 'KW' '3831';\n"); grammarBuilder.append("KW3832 : 'KW' '3832';\n"); grammarBuilder.append("KW3833 : 'KW' '3833';\n"); grammarBuilder.append("KW3834 : 'KW' '3834';\n"); grammarBuilder.append("KW3835 : 'KW' '3835';\n"); grammarBuilder.append("KW3836 : 'KW' '3836';\n"); grammarBuilder.append("KW3837 : 'KW' '3837';\n"); grammarBuilder.append("KW3838 : 'KW' '3838';\n"); grammarBuilder.append("KW3839 : 'KW' '3839';\n"); grammarBuilder.append("KW3840 : 'KW' '3840';\n"); grammarBuilder.append("KW3841 : 'KW' '3841';\n"); grammarBuilder.append("KW3842 : 'KW' '3842';\n"); grammarBuilder.append("KW3843 : 'KW' '3843';\n"); grammarBuilder.append("KW3844 : 'KW' '3844';\n"); grammarBuilder.append("KW3845 : 'KW' '3845';\n"); grammarBuilder.append("KW3846 : 'KW' '3846';\n"); grammarBuilder.append("KW3847 : 'KW' '3847';\n"); grammarBuilder.append("KW3848 : 'KW' '3848';\n"); grammarBuilder.append("KW3849 : 'KW' '3849';\n"); grammarBuilder.append("KW3850 : 'KW' '3850';\n"); grammarBuilder.append("KW3851 : 'KW' '3851';\n"); grammarBuilder.append("KW3852 : 'KW' '3852';\n"); grammarBuilder.append("KW3853 : 'KW' '3853';\n"); grammarBuilder.append("KW3854 : 'KW' '3854';\n"); grammarBuilder.append("KW3855 : 'KW' '3855';\n"); grammarBuilder.append("KW3856 : 'KW' '3856';\n"); grammarBuilder.append("KW3857 : 'KW' '3857';\n"); grammarBuilder.append("KW3858 : 'KW' '3858';\n"); grammarBuilder.append("KW3859 : 'KW' '3859';\n"); grammarBuilder.append("KW3860 : 'KW' '3860';\n"); grammarBuilder.append("KW3861 : 'KW' '3861';\n"); grammarBuilder.append("KW3862 : 'KW' '3862';\n"); grammarBuilder.append("KW3863 : 'KW' '3863';\n"); grammarBuilder.append("KW3864 : 'KW' '3864';\n"); grammarBuilder.append("KW3865 : 'KW' '3865';\n"); grammarBuilder.append("KW3866 : 'KW' '3866';\n"); grammarBuilder.append("KW3867 : 'KW' '3867';\n"); grammarBuilder.append("KW3868 : 'KW' '3868';\n"); grammarBuilder.append("KW3869 : 'KW' '3869';\n"); grammarBuilder.append("KW3870 : 'KW' '3870';\n"); grammarBuilder.append("KW3871 : 'KW' '3871';\n"); grammarBuilder.append("KW3872 : 'KW' '3872';\n"); grammarBuilder.append("KW3873 : 'KW' '3873';\n"); grammarBuilder.append("KW3874 : 'KW' '3874';\n"); grammarBuilder.append("KW3875 : 'KW' '3875';\n"); grammarBuilder.append("KW3876 : 'KW' '3876';\n"); grammarBuilder.append("KW3877 : 'KW' '3877';\n"); grammarBuilder.append("KW3878 : 'KW' '3878';\n"); grammarBuilder.append("KW3879 : 'KW' '3879';\n"); grammarBuilder.append("KW3880 : 'KW' '3880';\n"); grammarBuilder.append("KW3881 : 'KW' '3881';\n"); grammarBuilder.append("KW3882 : 'KW' '3882';\n"); grammarBuilder.append("KW3883 : 'KW' '3883';\n"); grammarBuilder.append("KW3884 : 'KW' '3884';\n"); grammarBuilder.append("KW3885 : 'KW' '3885';\n"); grammarBuilder.append("KW3886 : 'KW' '3886';\n"); grammarBuilder.append("KW3887 : 'KW' '3887';\n"); grammarBuilder.append("KW3888 : 'KW' '3888';\n"); grammarBuilder.append("KW3889 : 'KW' '3889';\n"); grammarBuilder.append("KW3890 : 'KW' '3890';\n"); grammarBuilder.append("KW3891 : 'KW' '3891';\n"); grammarBuilder.append("KW3892 : 'KW' '3892';\n"); grammarBuilder.append("KW3893 : 'KW' '3893';\n"); grammarBuilder.append("KW3894 : 'KW' '3894';\n"); grammarBuilder.append("KW3895 : 'KW' '3895';\n"); grammarBuilder.append("KW3896 : 'KW' '3896';\n"); grammarBuilder.append("KW3897 : 'KW' '3897';\n"); grammarBuilder.append("KW3898 : 'KW' '3898';\n"); grammarBuilder.append("KW3899 : 'KW' '3899';\n"); grammarBuilder.append("KW3900 : 'KW' '3900';\n"); grammarBuilder.append("KW3901 : 'KW' '3901';\n"); grammarBuilder.append("KW3902 : 'KW' '3902';\n"); grammarBuilder.append("KW3903 : 'KW' '3903';\n"); grammarBuilder.append("KW3904 : 'KW' '3904';\n"); grammarBuilder.append("KW3905 : 'KW' '3905';\n"); grammarBuilder.append("KW3906 : 'KW' '3906';\n"); grammarBuilder.append("KW3907 : 'KW' '3907';\n"); grammarBuilder.append("KW3908 : 'KW' '3908';\n"); grammarBuilder.append("KW3909 : 'KW' '3909';\n"); grammarBuilder.append("KW3910 : 'KW' '3910';\n"); grammarBuilder.append("KW3911 : 'KW' '3911';\n"); grammarBuilder.append("KW3912 : 'KW' '3912';\n"); grammarBuilder.append("KW3913 : 'KW' '3913';\n"); grammarBuilder.append("KW3914 : 'KW' '3914';\n"); grammarBuilder.append("KW3915 : 'KW' '3915';\n"); grammarBuilder.append("KW3916 : 'KW' '3916';\n"); grammarBuilder.append("KW3917 : 'KW' '3917';\n"); grammarBuilder.append("KW3918 : 'KW' '3918';\n"); grammarBuilder.append("KW3919 : 'KW' '3919';\n"); grammarBuilder.append("KW3920 : 'KW' '3920';\n"); grammarBuilder.append("KW3921 : 'KW' '3921';\n"); grammarBuilder.append("KW3922 : 'KW' '3922';\n"); grammarBuilder.append("KW3923 : 'KW' '3923';\n"); grammarBuilder.append("KW3924 : 'KW' '3924';\n"); grammarBuilder.append("KW3925 : 'KW' '3925';\n"); grammarBuilder.append("KW3926 : 'KW' '3926';\n"); grammarBuilder.append("KW3927 : 'KW' '3927';\n"); grammarBuilder.append("KW3928 : 'KW' '3928';\n"); grammarBuilder.append("KW3929 : 'KW' '3929';\n"); grammarBuilder.append("KW3930 : 'KW' '3930';\n"); grammarBuilder.append("KW3931 : 'KW' '3931';\n"); grammarBuilder.append("KW3932 : 'KW' '3932';\n"); grammarBuilder.append("KW3933 : 'KW' '3933';\n"); grammarBuilder.append("KW3934 : 'KW' '3934';\n"); grammarBuilder.append("KW3935 : 'KW' '3935';\n"); grammarBuilder.append("KW3936 : 'KW' '3936';\n"); grammarBuilder.append("KW3937 : 'KW' '3937';\n"); grammarBuilder.append("KW3938 : 'KW' '3938';\n"); grammarBuilder.append("KW3939 : 'KW' '3939';\n"); grammarBuilder.append("KW3940 : 'KW' '3940';\n"); grammarBuilder.append("KW3941 : 'KW' '3941';\n"); grammarBuilder.append("KW3942 : 'KW' '3942';\n"); grammarBuilder.append("KW3943 : 'KW' '3943';\n"); grammarBuilder.append("KW3944 : 'KW' '3944';\n"); grammarBuilder.append("KW3945 : 'KW' '3945';\n"); grammarBuilder.append("KW3946 : 'KW' '3946';\n"); grammarBuilder.append("KW3947 : 'KW' '3947';\n"); grammarBuilder.append("KW3948 : 'KW' '3948';\n"); grammarBuilder.append("KW3949 : 'KW' '3949';\n"); grammarBuilder.append("KW3950 : 'KW' '3950';\n"); grammarBuilder.append("KW3951 : 'KW' '3951';\n"); grammarBuilder.append("KW3952 : 'KW' '3952';\n"); grammarBuilder.append("KW3953 : 'KW' '3953';\n"); grammarBuilder.append("KW3954 : 'KW' '3954';\n"); grammarBuilder.append("KW3955 : 'KW' '3955';\n"); grammarBuilder.append("KW3956 : 'KW' '3956';\n"); grammarBuilder.append("KW3957 : 'KW' '3957';\n"); grammarBuilder.append("KW3958 : 'KW' '3958';\n"); grammarBuilder.append("KW3959 : 'KW' '3959';\n"); grammarBuilder.append("KW3960 : 'KW' '3960';\n"); grammarBuilder.append("KW3961 : 'KW' '3961';\n"); grammarBuilder.append("KW3962 : 'KW' '3962';\n"); grammarBuilder.append("KW3963 : 'KW' '3963';\n"); grammarBuilder.append("KW3964 : 'KW' '3964';\n"); grammarBuilder.append("KW3965 : 'KW' '3965';\n"); grammarBuilder.append("KW3966 : 'KW' '3966';\n"); grammarBuilder.append("KW3967 : 'KW' '3967';\n"); grammarBuilder.append("KW3968 : 'KW' '3968';\n"); grammarBuilder.append("KW3969 : 'KW' '3969';\n"); grammarBuilder.append("KW3970 : 'KW' '3970';\n"); grammarBuilder.append("KW3971 : 'KW' '3971';\n"); grammarBuilder.append("KW3972 : 'KW' '3972';\n"); grammarBuilder.append("KW3973 : 'KW' '3973';\n"); grammarBuilder.append("KW3974 : 'KW' '3974';\n"); grammarBuilder.append("KW3975 : 'KW' '3975';\n"); grammarBuilder.append("KW3976 : 'KW' '3976';\n"); grammarBuilder.append("KW3977 : 'KW' '3977';\n"); grammarBuilder.append("KW3978 : 'KW' '3978';\n"); grammarBuilder.append("KW3979 : 'KW' '3979';\n"); grammarBuilder.append("KW3980 : 'KW' '3980';\n"); grammarBuilder.append("KW3981 : 'KW' '3981';\n"); grammarBuilder.append("KW3982 : 'KW' '3982';\n"); grammarBuilder.append("KW3983 : 'KW' '3983';\n"); grammarBuilder.append("KW3984 : 'KW' '3984';\n"); grammarBuilder.append("KW3985 : 'KW' '3985';\n"); grammarBuilder.append("KW3986 : 'KW' '3986';\n"); grammarBuilder.append("KW3987 : 'KW' '3987';\n"); grammarBuilder.append("KW3988 : 'KW' '3988';\n"); grammarBuilder.append("KW3989 : 'KW' '3989';\n"); grammarBuilder.append("KW3990 : 'KW' '3990';\n"); grammarBuilder.append("KW3991 : 'KW' '3991';\n"); grammarBuilder.append("KW3992 : 'KW' '3992';\n"); grammarBuilder.append("KW3993 : 'KW' '3993';\n"); grammarBuilder.append("KW3994 : 'KW' '3994';\n"); grammarBuilder.append("KW3995 : 'KW' '3995';\n"); grammarBuilder.append("KW3996 : 'KW' '3996';\n"); grammarBuilder.append("KW3997 : 'KW' '3997';\n"); grammarBuilder.append("KW3998 : 'KW' '3998';\n"); grammarBuilder.append("KW3999 : 'KW' '3999';"); String grammar = grammarBuilder.toString(); String input ="KW400"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "[@0,0:4='KW400',<402>,1:0]\n" + "[@1,5:4='<EOF>',<-1>,1:5]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testNonGreedyClosure() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(61); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("CMT : '//' .*? '\\n' CMT*?;\n"); grammarBuilder.append("WS : (' '|'\\t')+;"); String grammar = grammarBuilder.toString(); String input = "//blah\n" + "//blah\n"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "[@0,0:6='//blah\\n',<1>,1:0]\n" + "[@1,7:13='//blah\\n',<1>,2:0]\n" + "[@2,14:13='<EOF>',<-1>,3:0]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testNonGreedyConfigs() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(148); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("I : .*? ('a' | 'ab') {System.out.println(this.getText());} ;\n"); grammarBuilder.append("WS : (' '|'\\n') -> skip ;\n"); grammarBuilder.append("J : . {System.out.println(this.getText());};"); String grammar = grammarBuilder.toString(); String input ="ab"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "a\n" + "b\n" + "[@0,0:0='a',<1>,1:0]\n" + "[@1,1:1='b',<3>,1:1]\n" + "[@2,2:1='<EOF>',<-1>,1:2]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testNonGreedyOptional() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(61); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("CMT : '//' .*? '\\n' CMT??;\n"); grammarBuilder.append("WS : (' '|'\\t')+;"); String grammar = grammarBuilder.toString(); String input = "//blah\n" + "//blah\n"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "[@0,0:6='//blah\\n',<1>,1:0]\n" + "[@1,7:13='//blah\\n',<1>,2:0]\n" + "[@2,14:13='<EOF>',<-1>,3:0]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testNonGreedyPositiveClosure() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(59); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("CMT : ('//' .*? '\\n')+?;\n"); grammarBuilder.append("WS : (' '|'\\t')+;"); String grammar = grammarBuilder.toString(); String input = "//blah\n" + "//blah\n"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "[@0,0:6='//blah\\n',<1>,1:0]\n" + "[@1,7:13='//blah\\n',<1>,2:0]\n" + "[@2,14:13='<EOF>',<-1>,3:0]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testNonGreedyTermination1() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(47); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("STRING : '\"' ('\"\"' | .)*? '\"';"); String grammar = grammarBuilder.toString(); String input ="\"hi\"\"mom\""; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "[@0,0:3='\"hi\"',<1>,1:0]\n" + "[@1,4:8='\"mom\"',<1>,1:4]\n" + "[@2,9:8='<EOF>',<-1>,1:9]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testNonGreedyTermination2() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(47); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("STRING : '\"' ('\"\"' | .)+? '\"';"); String grammar = grammarBuilder.toString(); String input ="\"\"\"mom\""; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "[@0,0:6='\"\"\"mom\"',<1>,1:0]\n" + "[@1,7:6='<EOF>',<-1>,1:7]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testParentheses() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(166); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("START_BLOCK: '-.-.-';\n"); grammarBuilder.append("ID : (LETTER SEPARATOR) (LETTER SEPARATOR)+;\n"); grammarBuilder.append("fragment LETTER: L_A|L_K;\n"); grammarBuilder.append("fragment L_A: '.-';\n"); grammarBuilder.append("fragment L_K: '-.-';\n"); grammarBuilder.append("SEPARATOR: '!';"); String grammar = grammarBuilder.toString(); String input ="-.-.-!"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "[@0,0:4='-.-.-',<1>,1:0]\n" + "[@1,5:5='!',<3>,1:5]\n" + "[@2,6:5='<EOF>',<-1>,1:6]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testPositionAdjustingLexer() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(2501); grammarBuilder.append("lexer grammar PositionAdjustingLexer;\n"); grammarBuilder.append("\n"); grammarBuilder.append("@members {\n"); grammarBuilder.append("@Override\n"); grammarBuilder.append("public Token nextToken() {\n"); grammarBuilder.append(" if (!(_interp instanceof PositionAdjustingLexerATNSimulator)) {\n"); grammarBuilder.append(" _interp = new PositionAdjustingLexerATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache);\n"); grammarBuilder.append(" }\n"); grammarBuilder.append("\n"); grammarBuilder.append(" return super.nextToken();\n"); grammarBuilder.append("}\n"); grammarBuilder.append("\n"); grammarBuilder.append("@Override\n"); grammarBuilder.append("public Token emit() {\n"); grammarBuilder.append(" switch (_type) {\n"); grammarBuilder.append(" case TOKENS:\n"); grammarBuilder.append(" handleAcceptPositionForKeyword(\"tokens\");\n"); grammarBuilder.append(" break;\n"); grammarBuilder.append("\n"); grammarBuilder.append(" case LABEL:\n"); grammarBuilder.append(" handleAcceptPositionForIdentifier();\n"); grammarBuilder.append(" break;\n"); grammarBuilder.append("\n"); grammarBuilder.append(" default:\n"); grammarBuilder.append(" break;\n"); grammarBuilder.append(" }\n"); grammarBuilder.append("\n"); grammarBuilder.append(" return super.emit();\n"); grammarBuilder.append("}\n"); grammarBuilder.append("\n"); grammarBuilder.append("private boolean handleAcceptPositionForIdentifier() {\n"); grammarBuilder.append(" String tokenText = getText();\n"); grammarBuilder.append(" int identifierLength = 0;\n"); grammarBuilder.append(" while (identifierLength < tokenText.length() && isIdentifierChar(tokenText.charAt(identifierLength))) {\n"); grammarBuilder.append(" identifierLength++;\n"); grammarBuilder.append(" }\n"); grammarBuilder.append("\n"); grammarBuilder.append(" if (getInputStream().index() > _tokenStartCharIndex + identifierLength) {\n"); grammarBuilder.append(" int offset = identifierLength - 1;\n"); grammarBuilder.append(" getInterpreter().resetAcceptPosition(getInputStream(), _tokenStartCharIndex + offset, _tokenStartLine, _tokenStartCharPositionInLine + offset);\n"); grammarBuilder.append(" return true;\n"); grammarBuilder.append(" }\n"); grammarBuilder.append("\n"); grammarBuilder.append(" return false;\n"); grammarBuilder.append("}\n"); grammarBuilder.append("\n"); grammarBuilder.append("private boolean handleAcceptPositionForKeyword(String keyword) {\n"); grammarBuilder.append(" if (getInputStream().index() > _tokenStartCharIndex + keyword.length()) {\n"); grammarBuilder.append(" int offset = keyword.length() - 1;\n"); grammarBuilder.append(" getInterpreter().resetAcceptPosition(getInputStream(), _tokenStartCharIndex + offset, _tokenStartLine, _tokenStartCharPositionInLine + offset);\n"); grammarBuilder.append(" return true;\n"); grammarBuilder.append(" }\n"); grammarBuilder.append("\n"); grammarBuilder.append(" return false;\n"); grammarBuilder.append("}\n"); grammarBuilder.append("\n"); grammarBuilder.append("@Override\n"); grammarBuilder.append("public PositionAdjustingLexerATNSimulator getInterpreter() {\n"); grammarBuilder.append(" return (PositionAdjustingLexerATNSimulator)super.getInterpreter();\n"); grammarBuilder.append("}\n"); grammarBuilder.append("\n"); grammarBuilder.append("private static boolean isIdentifierChar(char c) {\n"); grammarBuilder.append(" return Character.isLetterOrDigit(c) || c == '_';\n"); grammarBuilder.append("}\n"); grammarBuilder.append("\n"); grammarBuilder.append("protected static class PositionAdjustingLexerATNSimulator extends LexerATNSimulator {\n"); grammarBuilder.append("\n"); grammarBuilder.append(" public PositionAdjustingLexerATNSimulator(Lexer recog, ATN atn,\n"); grammarBuilder.append(" DFA[] decisionToDFA,\n"); grammarBuilder.append(" PredictionContextCache sharedContextCache)\n"); grammarBuilder.append(" {\n"); grammarBuilder.append(" super(recog, atn, decisionToDFA, sharedContextCache);\n"); grammarBuilder.append(" }\n"); grammarBuilder.append("\n"); grammarBuilder.append(" protected void resetAcceptPosition(CharStream input, int index, int line, int charPositionInLine) {\n"); grammarBuilder.append(" input.seek(index);\n"); grammarBuilder.append(" this.line = line;\n"); grammarBuilder.append(" this.charPositionInLine = charPositionInLine;\n"); grammarBuilder.append(" consume(input);\n"); grammarBuilder.append(" }\n"); grammarBuilder.append("\n"); grammarBuilder.append("}\n"); grammarBuilder.append("\n"); grammarBuilder.append("}\n"); grammarBuilder.append("\n"); grammarBuilder.append("ASSIGN : '=' ;\n"); grammarBuilder.append("PLUS_ASSIGN : '+=' ;\n"); grammarBuilder.append("LCURLY: '{';\n"); grammarBuilder.append("\n"); grammarBuilder.append("// 'tokens' followed by '{'\n"); grammarBuilder.append("TOKENS : 'tokens' IGNORED '{';\n"); grammarBuilder.append("\n"); grammarBuilder.append("// IDENTIFIER followed by '+=' or '='\n"); grammarBuilder.append("LABEL\n"); grammarBuilder.append(" : IDENTIFIER IGNORED '+'? '='\n"); grammarBuilder.append(" ;\n"); grammarBuilder.append("\n"); grammarBuilder.append("IDENTIFIER\n"); grammarBuilder.append(" : [a-zA-Z_] [a-zA-Z0-9_]*\n"); grammarBuilder.append(" ;\n"); grammarBuilder.append("\n"); grammarBuilder.append("fragment\n"); grammarBuilder.append("IGNORED\n"); grammarBuilder.append(" : [ \\t\\r\\n]*\n"); grammarBuilder.append(" ;\n"); grammarBuilder.append("\n"); grammarBuilder.append("NEWLINE\n"); grammarBuilder.append(" : [\\r\\n]+ -> skip\n"); grammarBuilder.append(" ;\n"); grammarBuilder.append("\n"); grammarBuilder.append("WS\n"); grammarBuilder.append(" : [ \\t]+ -> skip\n"); grammarBuilder.append(" ;"); String grammar = grammarBuilder.toString(); String input = "tokens\n" + "tokens {\n" + "notLabel\n" + "label1 =\n" + "label2 +=\n" + "notLabel\n"; String found = execLexer("PositionAdjustingLexer.g4", grammar, "PositionAdjustingLexer", input, false); assertEquals( "[@0,0:5='tokens',<6>,1:0]\n" + "[@1,7:12='tokens',<4>,2:0]\n" + "[@2,14:14='{',<3>,2:7]\n" + "[@3,16:23='notLabel',<6>,3:0]\n" + "[@4,25:30='label1',<5>,4:0]\n" + "[@5,32:32='=',<1>,4:7]\n" + "[@6,34:39='label2',<5>,5:0]\n" + "[@7,41:42='+=',<2>,5:7]\n" + "[@8,44:51='notLabel',<6>,6:0]\n" + "[@9,53:52='<EOF>',<-1>,7:0]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testQuoteTranslation() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(57); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("QUOTE : '\"' ; // make sure this compiles"); String grammar = grammarBuilder.toString(); String input ="\""; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "[@0,0:0='\"',<1>,1:0]\n" + "[@1,1:0='<EOF>',<-1>,1:1]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testRecursiveLexerRuleRefWithWildcardPlus_1() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(64); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("CMT : '/*' (CMT | .)+? '*/' ;\n"); grammarBuilder.append("WS : (' '|'\\n')+;"); String grammar = grammarBuilder.toString(); String input = "/* ick */\n" + "/* /* */\n" + "/* /*nested*/ */\n"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "[@0,0:8='/* ick */',<1>,1:0]\n" + "[@1,9:9='\\n',<2>,1:9]\n" + "[@2,10:34='/* /* */\\n/* /*nested*/ */',<1>,2:0]\n" + "[@3,35:35='\\n',<2>,3:16]\n" + "[@4,36:35='<EOF>',<-1>,4:0]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testRecursiveLexerRuleRefWithWildcardPlus_2() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(64); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("CMT : '/*' (CMT | .)+? '*/' ;\n"); grammarBuilder.append("WS : (' '|'\\n')+;"); String grammar = grammarBuilder.toString(); String input = "/* ick */x\n" + "/* /* */x\n" + "/* /*nested*/ */x\n"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "[@0,0:8='/* ick */',<1>,1:0]\n" + "[@1,10:10='\\n',<2>,1:10]\n" + "[@2,11:36='/* /* */x\\n/* /*nested*/ */',<1>,2:0]\n" + "[@3,38:38='\\n',<2>,3:17]\n" + "[@4,39:38='<EOF>',<-1>,4:0]\n", found); assertEquals( "line 1:9 token recognition error at: 'x'\n" + "line 3:16 token recognition error at: 'x'\n", this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testRecursiveLexerRuleRefWithWildcardStar_1() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(64); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("CMT : '/*' (CMT | .)*? '*/' ;\n"); grammarBuilder.append("WS : (' '|'\\n')+;"); String grammar = grammarBuilder.toString(); String input = "/* ick */\n" + "/* /* */\n" + "/* /*nested*/ */\n"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "[@0,0:8='/* ick */',<1>,1:0]\n" + "[@1,9:9='\\n',<2>,1:9]\n" + "[@2,10:34='/* /* */\\n/* /*nested*/ */',<1>,2:0]\n" + "[@3,35:35='\\n',<2>,3:16]\n" + "[@4,36:35='<EOF>',<-1>,4:0]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testRecursiveLexerRuleRefWithWildcardStar_2() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(64); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("CMT : '/*' (CMT | .)*? '*/' ;\n"); grammarBuilder.append("WS : (' '|'\\n')+;"); String grammar = grammarBuilder.toString(); String input = "/* ick */x\n" + "/* /* */x\n" + "/* /*nested*/ */x\n"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "[@0,0:8='/* ick */',<1>,1:0]\n" + "[@1,10:10='\\n',<2>,1:10]\n" + "[@2,11:36='/* /* */x\\n/* /*nested*/ */',<1>,2:0]\n" + "[@3,38:38='\\n',<2>,3:17]\n" + "[@4,39:38='<EOF>',<-1>,4:0]\n", found); assertEquals( "line 1:9 token recognition error at: 'x'\n" + "line 3:16 token recognition error at: 'x'\n", this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testRefToRuleDoesNotSetTokenNorEmitAnother() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(70); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("A : '-' I ;\n"); grammarBuilder.append("I : '0'..'9'+ ;\n"); grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); String grammar = grammarBuilder.toString(); String input ="34 -21 3"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "[@0,0:1='34',<2>,1:0]\n" + "[@1,3:5='-21',<1>,1:3]\n" + "[@2,7:7='3',<2>,1:7]\n" + "[@3,8:7='<EOF>',<-1>,1:8]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testSlashes() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(95); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("Backslash : '\\\\';\n"); grammarBuilder.append("Slash : '/';\n"); grammarBuilder.append("Vee : '\\\\/';\n"); grammarBuilder.append("Wedge : '/\\\\';\n"); grammarBuilder.append("WS : [ \\t] -> skip;"); String grammar = grammarBuilder.toString(); String input ="\\ / \\/ /\\"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "[@0,0:0='\\',<1>,1:0]\n" + "[@1,2:2='/',<2>,1:2]\n" + "[@2,4:5='\\/',<3>,1:4]\n" + "[@3,7:8='/\\',<4>,1:7]\n" + "[@4,9:8='<EOF>',<-1>,1:9]\n", found); assertNull(this.stderrDuringParse); } /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ @Test public void testZeroLengthToken() throws Exception { mkdir(tmpdir); StringBuilder grammarBuilder = new StringBuilder(215); grammarBuilder.append("lexer grammar L;\n"); grammarBuilder.append("BeginString\n"); grammarBuilder.append(" : '\\'' -> more, pushMode(StringMode)\n"); grammarBuilder.append(" ;\n"); grammarBuilder.append("mode StringMode;\n"); grammarBuilder.append(" StringMode_X : 'x' -> more;\n"); grammarBuilder.append(" StringMode_Done : -> more, mode(EndStringMode);\n"); grammarBuilder.append("mode EndStringMode; \n"); grammarBuilder.append(" EndString : '\\'' -> popMode;"); String grammar = grammarBuilder.toString(); String input ="'xxx'"; String found = execLexer("L.g4", grammar, "L", input, false); assertEquals( "[@0,0:4=''xxx'',<1>,1:0]\n" + "[@1,5:4='<EOF>',<-1>,1:5]\n", found); assertNull(this.stderrDuringParse); } }
chienjchienj/antlr4
runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestLexerExec.java
Java
bsd-3-clause
242,532
<?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_Search_Lucene * @subpackage Search * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ /** * @category Zend * @package Zend_Search_Lucene * @subpackage Search * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Search_Lucene_Search_Similarity { /** * The Similarity implementation used by default. * * @var Zend_Search_Lucene_Search_Similarity */ private static $_defaultImpl; /** * Cache of decoded bytes. * Array of floats * * @var array */ private static $_normTable = array( 0 => 0.0, 1 => 5.820766E-10, 2 => 6.9849193E-10, 3 => 8.1490725E-10, 4 => 9.313226E-10, 5 => 1.1641532E-9, 6 => 1.3969839E-9, 7 => 1.6298145E-9, 8 => 1.8626451E-9, 9 => 2.3283064E-9, 10 => 2.7939677E-9, 11 => 3.259629E-9, 12 => 3.7252903E-9, 13 => 4.656613E-9, 14 => 5.5879354E-9, 15 => 6.519258E-9, 16 => 7.4505806E-9, 17 => 9.313226E-9, 18 => 1.1175871E-8, 19 => 1.3038516E-8, 20 => 1.4901161E-8, 21 => 1.8626451E-8, 22 => 2.2351742E-8, 23 => 2.6077032E-8, 24 => 2.9802322E-8, 25 => 3.7252903E-8, 26 => 4.4703484E-8, 27 => 5.2154064E-8, 28 => 5.9604645E-8, 29 => 7.4505806E-8, 30 => 8.940697E-8, 31 => 1.0430813E-7, 32 => 1.1920929E-7, 33 => 1.4901161E-7, 34 => 1.7881393E-7, 35 => 2.0861626E-7, 36 => 2.3841858E-7, 37 => 2.9802322E-7, 38 => 3.5762787E-7, 39 => 4.172325E-7, 40 => 4.7683716E-7, 41 => 5.9604645E-7, 42 => 7.1525574E-7, 43 => 8.34465E-7, 44 => 9.536743E-7, 45 => 1.1920929E-6, 46 => 1.4305115E-6, 47 => 1.66893E-6, 48 => 1.9073486E-6, 49 => 2.3841858E-6, 50 => 2.861023E-6, 51 => 3.33786E-6, 52 => 3.8146973E-6, 53 => 4.7683716E-6, 54 => 5.722046E-6, 55 => 6.67572E-6, 56 => 7.6293945E-6, 57 => 9.536743E-6, 58 => 1.1444092E-5, 59 => 1.335144E-5, 60 => 1.5258789E-5, 61 => 1.9073486E-5, 62 => 2.2888184E-5, 63 => 2.670288E-5, 64 => 3.0517578E-5, 65 => 3.8146973E-5, 66 => 4.5776367E-5, 67 => 5.340576E-5, 68 => 6.1035156E-5, 69 => 7.6293945E-5, 70 => 9.1552734E-5, 71 => 1.0681152E-4, 72 => 1.2207031E-4, 73 => 1.5258789E-4, 74 => 1.8310547E-4, 75 => 2.1362305E-4, 76 => 2.4414062E-4, 77 => 3.0517578E-4, 78 => 3.6621094E-4, 79 => 4.272461E-4, 80 => 4.8828125E-4, 81 => 6.1035156E-4, 82 => 7.324219E-4, 83 => 8.544922E-4, 84 => 9.765625E-4, 85 => 0.0012207031, 86 => 0.0014648438, 87 => 0.0017089844, 88 => 0.001953125, 89 => 0.0024414062, 90 => 0.0029296875, 91 => 0.0034179688, 92 => 0.00390625, 93 => 0.0048828125, 94 => 0.005859375, 95 => 0.0068359375, 96 => 0.0078125, 97 => 0.009765625, 98 => 0.01171875, 99 => 0.013671875, 100 => 0.015625, 101 => 0.01953125, 102 => 0.0234375, 103 => 0.02734375, 104 => 0.03125, 105 => 0.0390625, 106 => 0.046875, 107 => 0.0546875, 108 => 0.0625, 109 => 0.078125, 110 => 0.09375, 111 => 0.109375, 112 => 0.125, 113 => 0.15625, 114 => 0.1875, 115 => 0.21875, 116 => 0.25, 117 => 0.3125, 118 => 0.375, 119 => 0.4375, 120 => 0.5, 121 => 0.625, 122 => 0.75, 123 => 0.875, 124 => 1.0, 125 => 1.25, 126 => 1.5, 127 => 1.75, 128 => 2.0, 129 => 2.5, 130 => 3.0, 131 => 3.5, 132 => 4.0, 133 => 5.0, 134 => 6.0, 135 => 7.0, 136 => 8.0, 137 => 10.0, 138 => 12.0, 139 => 14.0, 140 => 16.0, 141 => 20.0, 142 => 24.0, 143 => 28.0, 144 => 32.0, 145 => 40.0, 146 => 48.0, 147 => 56.0, 148 => 64.0, 149 => 80.0, 150 => 96.0, 151 => 112.0, 152 => 128.0, 153 => 160.0, 154 => 192.0, 155 => 224.0, 156 => 256.0, 157 => 320.0, 158 => 384.0, 159 => 448.0, 160 => 512.0, 161 => 640.0, 162 => 768.0, 163 => 896.0, 164 => 1024.0, 165 => 1280.0, 166 => 1536.0, 167 => 1792.0, 168 => 2048.0, 169 => 2560.0, 170 => 3072.0, 171 => 3584.0, 172 => 4096.0, 173 => 5120.0, 174 => 6144.0, 175 => 7168.0, 176 => 8192.0, 177 => 10240.0, 178 => 12288.0, 179 => 14336.0, 180 => 16384.0, 181 => 20480.0, 182 => 24576.0, 183 => 28672.0, 184 => 32768.0, 185 => 40960.0, 186 => 49152.0, 187 => 57344.0, 188 => 65536.0, 189 => 81920.0, 190 => 98304.0, 191 => 114688.0, 192 => 131072.0, 193 => 163840.0, 194 => 196608.0, 195 => 229376.0, 196 => 262144.0, 197 => 327680.0, 198 => 393216.0, 199 => 458752.0, 200 => 524288.0, 201 => 655360.0, 202 => 786432.0, 203 => 917504.0, 204 => 1048576.0, 205 => 1310720.0, 206 => 1572864.0, 207 => 1835008.0, 208 => 2097152.0, 209 => 2621440.0, 210 => 3145728.0, 211 => 3670016.0, 212 => 4194304.0, 213 => 5242880.0, 214 => 6291456.0, 215 => 7340032.0, 216 => 8388608.0, 217 => 1.048576E7, 218 => 1.2582912E7, 219 => 1.4680064E7, 220 => 1.6777216E7, 221 => 2.097152E7, 222 => 2.5165824E7, 223 => 2.9360128E7, 224 => 3.3554432E7, 225 => 4.194304E7, 226 => 5.0331648E7, 227 => 5.8720256E7, 228 => 6.7108864E7, 229 => 8.388608E7, 230 => 1.00663296E8, 231 => 1.17440512E8, 232 => 1.34217728E8, 233 => 1.6777216E8, 234 => 2.01326592E8, 235 => 2.34881024E8, 236 => 2.68435456E8, 237 => 3.3554432E8, 238 => 4.02653184E8, 239 => 4.69762048E8, 240 => 5.3687091E8, 241 => 6.7108864E8, 242 => 8.0530637E8, 243 => 9.395241E8, 244 => 1.07374182E9, 245 => 1.34217728E9, 246 => 1.61061274E9, 247 => 1.87904819E9, 248 => 2.14748365E9, 249 => 2.68435456E9, 250 => 3.22122547E9, 251 => 3.75809638E9, 252 => 4.2949673E9, 253 => 5.3687091E9, 254 => 6.4424509E9, 255 => 7.5161928E9 ); /** * Set the default Similarity implementation used by indexing and search * code. * * @param Zend_Search_Lucene_Search_Similarity $similarity */ public static function setDefault(Zend_Search_Lucene_Search_Similarity $similarity) { self::$_defaultImpl = $similarity; } /** * Return the default Similarity implementation used by indexing and search * code. * * @return Zend_Search_Lucene_Search_Similarity */ public static function getDefault() { if (!self::$_defaultImpl instanceof Zend_Search_Lucene_Search_Similarity) { // require_once 'Zend/Search/Lucene/Search/Similarity/Default.php'; self::$_defaultImpl = new Zend_Search_Lucene_Search_Similarity_Default(); } return self::$_defaultImpl; } /** * Computes the normalization value for a field given the total number of * terms contained in a field. These values, together with field boosts, are * stored in an index and multipled into scores for hits on each field by the * search code. * * Matches in longer fields are less precise, so implemenations of this * method usually return smaller values when 'numTokens' is large, * and larger values when 'numTokens' is small. * * That these values are computed under * IndexWriter::addDocument(Document) and stored then using * encodeNorm(float). Thus they have limited precision, and documents * must be re-indexed if this method is altered. * * fieldName - name of field * numTokens - the total number of tokens contained in fields named * 'fieldName' of 'doc'. * Returns a normalization factor for hits on this field of this document * * @param string $fieldName * @param integer $numTokens * @return float */ abstract public function lengthNorm($fieldName, $numTokens); /** * Computes the normalization value for a query given the sum of the squared * weights of each of the query terms. This value is then multipled into the * weight of each query term. * * This does not affect ranking, but rather just attempts to make scores * from different queries comparable. * * sumOfSquaredWeights - the sum of the squares of query term weights * Returns a normalization factor for query weights * * @param float $sumOfSquaredWeights * @return float */ abstract public function queryNorm($sumOfSquaredWeights); /** * Decodes a normalization factor stored in an index. * * @param integer $byte * @return float */ public static function decodeNorm($byte) { return self::$_normTable[$byte & 0xFF]; } /** * Encodes a normalization factor for storage in an index. * * The encoding uses a five-bit exponent and three-bit mantissa, thus * representing values from around 7x10^9 to 2x10^-9 with about one * significant decimal digit of accuracy. Zero is also represented. * Negative numbers are rounded up to zero. Values too large to represent * are rounded down to the largest representable value. Positive values too * small to represent are rounded up to the smallest positive representable * value. * * @param float $f * @return integer */ static function encodeNorm($f) { return self::_floatToByte($f); } /** * Float to byte conversion * * @param integer $b * @return float */ private static function _floatToByte($f) { // round negatives up to zero if ($f <= 0.0) { return 0; } // search for appropriate value $lowIndex = 0; $highIndex = 255; while ($highIndex >= $lowIndex) { // $mid = ($highIndex - $lowIndex)/2; $mid = ($highIndex + $lowIndex) >> 1; $delta = $f - self::$_normTable[$mid]; if ($delta < 0) { $highIndex = $mid-1; } elseif ($delta > 0) { $lowIndex = $mid+1; } else { return $mid; // We got it! } } // round to closest value if ($highIndex != 255 && $f - self::$_normTable[$highIndex] > self::$_normTable[$highIndex+1] - $f ) { return $highIndex + 1; } else { return $highIndex; } } /** * Computes a score factor based on a term or phrase's frequency in a * document. This value is multiplied by the idf(Term, Searcher) * factor for each term in the query and these products are then summed to * form the initial score for a document. * * Terms and phrases repeated in a document indicate the topic of the * document, so implementations of this method usually return larger values * when 'freq' is large, and smaller values when 'freq' * is small. * * freq - the frequency of a term within a document * Returns a score factor based on a term's within-document frequency * * @param float $freq * @return float */ abstract public function tf($freq); /** * Computes the amount of a sloppy phrase match, based on an edit distance. * This value is summed for each sloppy phrase match in a document to form * the frequency that is passed to tf(float). * * A phrase match with a small edit distance to a document passage more * closely matches the document, so implementations of this method usually * return larger values when the edit distance is small and smaller values * when it is large. * * distance - the edit distance of this sloppy phrase match * Returns the frequency increment for this match * * @param integer $distance * @return float */ abstract public function sloppyFreq($distance); /** * Computes a score factor for a simple term or a phrase. * * The default implementation is: * return idfFreq(searcher.docFreq(term), searcher.maxDoc()); * * input - the term in question or array of terms * reader - reader the document collection being searched * Returns a score factor for the term * * @param mixed $input * @param Zend_Search_Lucene_Interface $reader * @return a score factor for the term */ public function idf($input, Zend_Search_Lucene_Interface $reader) { if (!is_array($input)) { return $this->idfFreq($reader->docFreq($input), $reader->count()); } else { $idf = 0.0; foreach ($input as $term) { $idf += $this->idfFreq($reader->docFreq($term), $reader->count()); } return $idf; } } /** * Computes a score factor based on a term's document frequency (the number * of documents which contain the term). This value is multiplied by the * tf(int) factor for each term in the query and these products are * then summed to form the initial score for a document. * * Terms that occur in fewer documents are better indicators of topic, so * implemenations of this method usually return larger values for rare terms, * and smaller values for common terms. * * docFreq - the number of documents which contain the term * numDocs - the total number of documents in the collection * Returns a score factor based on the term's document frequency * * @param integer $docFreq * @param integer $numDocs * @return float */ abstract public function idfFreq($docFreq, $numDocs); /** * Computes a score factor based on the fraction of all query terms that a * document contains. This value is multiplied into scores. * * The presence of a large portion of the query terms indicates a better * match with the query, so implemenations of this method usually return * larger values when the ratio between these parameters is large and smaller * values when the ratio between them is small. * * overlap - the number of query terms matched in the document * maxOverlap - the total number of terms in the query * Returns a score factor based on term overlap with the query * * @param integer $overlap * @param integer $maxOverlap * @return float */ abstract public function coord($overlap, $maxOverlap); }
adoraxion/appsCms
pimcore/lib/Zend/Search/Lucene/Search/Similarity.php
PHP
bsd-3-clause
24,734
// Copyright 2016 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package runtime // Numbers fundamental to the encoding. const ( runeError = '\uFFFD' // the "error" Rune or "Unicode replacement character" runeSelf = 0x80 // characters below Runeself are represented as themselves in a single byte. maxRune = '\U0010FFFF' // Maximum valid Unicode code point. ) // Code points in the surrogate range are not valid for UTF-8. const ( surrogateMin = 0xD800 surrogateMax = 0xDFFF ) const ( t1 = 0x00 // 0000 0000 tx = 0x80 // 1000 0000 t2 = 0xC0 // 1100 0000 t3 = 0xE0 // 1110 0000 t4 = 0xF0 // 1111 0000 t5 = 0xF8 // 1111 1000 maskx = 0x3F // 0011 1111 mask2 = 0x1F // 0001 1111 mask3 = 0x0F // 0000 1111 mask4 = 0x07 // 0000 0111 rune1Max = 1<<7 - 1 rune2Max = 1<<11 - 1 rune3Max = 1<<16 - 1 // The default lowest and highest continuation byte. locb = 0x80 // 1000 0000 hicb = 0xBF // 1011 1111 ) // decoderune returns the non-ASCII rune at the start of // s[k:] and the index after the rune in s. // // decoderune assumes that caller has checked that // the to be decoded rune is a non-ASCII rune. // // If the string appears to be incomplete or decoding problems // are encountered (runeerror, k + 1) is returned to ensure // progress when decoderune is used to iterate over a string. func decoderune(s string, k int) (r rune, pos int) { pos = k if k >= len(s) { return runeError, k + 1 } s = s[k:] switch { case t2 <= s[0] && s[0] < t3: // 0080-07FF two byte sequence if len(s) > 1 && (locb <= s[1] && s[1] <= hicb) { r = rune(s[0]&mask2)<<6 | rune(s[1]&maskx) pos += 2 if rune1Max < r { return } } case t3 <= s[0] && s[0] < t4: // 0800-FFFF three byte sequence if len(s) > 2 && (locb <= s[1] && s[1] <= hicb) && (locb <= s[2] && s[2] <= hicb) { r = rune(s[0]&mask3)<<12 | rune(s[1]&maskx)<<6 | rune(s[2]&maskx) pos += 3 if rune2Max < r && !(surrogateMin <= r && r <= surrogateMax) { return } } case t4 <= s[0] && s[0] < t5: // 10000-1FFFFF four byte sequence if len(s) > 3 && (locb <= s[1] && s[1] <= hicb) && (locb <= s[2] && s[2] <= hicb) && (locb <= s[3] && s[3] <= hicb) { r = rune(s[0]&mask4)<<18 | rune(s[1]&maskx)<<12 | rune(s[2]&maskx)<<6 | rune(s[3]&maskx) pos += 4 if rune3Max < r && r <= maxRune { return } } } return runeError, k + 1 } // encoderune writes into p (which must be large enough) the UTF-8 encoding of the rune. // It returns the number of bytes written. func encoderune(p []byte, r rune) int { // Negative values are erroneous. Making it unsigned addresses the problem. switch i := uint32(r); { case i <= rune1Max: p[0] = byte(r) return 1 case i <= rune2Max: _ = p[1] // eliminate bounds checks p[0] = t2 | byte(r>>6) p[1] = tx | byte(r)&maskx return 2 case i > maxRune, surrogateMin <= i && i <= surrogateMax: r = runeError fallthrough case i <= rune3Max: _ = p[2] // eliminate bounds checks p[0] = t3 | byte(r>>12) p[1] = tx | byte(r>>6)&maskx p[2] = tx | byte(r)&maskx return 3 default: _ = p[3] // eliminate bounds checks p[0] = t4 | byte(r>>18) p[1] = tx | byte(r>>12)&maskx p[2] = tx | byte(r>>6)&maskx p[3] = tx | byte(r)&maskx return 4 } }
vsekhar/elastic-go
src/runtime/utf8.go
GO
bsd-3-clause
3,342
# Copyright 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. import optparse import os import unittest from telemetry.internal.browser import browser_options class BrowserOptionsTest(unittest.TestCase): def testDefaults(self): options = browser_options.BrowserFinderOptions() parser = options.CreateParser() parser.add_option('-x', action='store', default=3) parser.parse_args(['--browser', 'any']) self.assertEquals(options.x, 3) # pylint: disable=no-member def testDefaultsPlusOverride(self): options = browser_options.BrowserFinderOptions() parser = options.CreateParser() parser.add_option('-x', action='store', default=3) parser.parse_args(['--browser', 'any', '-x', 10]) self.assertEquals(options.x, 10) # pylint: disable=no-member def testDefaultsDontClobberPresetValue(self): options = browser_options.BrowserFinderOptions() setattr(options, 'x', 7) parser = options.CreateParser() parser.add_option('-x', action='store', default=3) parser.parse_args(['--browser', 'any']) self.assertEquals(options.x, 7) # pylint: disable=no-member def testCount0(self): options = browser_options.BrowserFinderOptions() parser = options.CreateParser() parser.add_option('-x', action='count', dest='v') parser.parse_args(['--browser', 'any']) self.assertEquals(options.v, None) # pylint: disable=no-member def testCount2(self): options = browser_options.BrowserFinderOptions() parser = options.CreateParser() parser.add_option('-x', action='count', dest='v') parser.parse_args(['--browser', 'any', '-xx']) self.assertEquals(options.v, 2) # pylint: disable=no-member def testOptparseMutabilityWhenSpecified(self): options = browser_options.BrowserFinderOptions() parser = options.CreateParser() parser.add_option('-x', dest='verbosity', action='store_true') options_ret, _ = parser.parse_args(['--browser', 'any', '-x']) self.assertEquals(options_ret, options) self.assertTrue(options.verbosity) def testOptparseMutabilityWhenNotSpecified(self): options = browser_options.BrowserFinderOptions() parser = options.CreateParser() parser.add_option('-x', dest='verbosity', action='store_true') options_ret, _ = parser.parse_args(['--browser', 'any']) self.assertEquals(options_ret, options) self.assertFalse(options.verbosity) def testProfileDirDefault(self): options = browser_options.BrowserFinderOptions() parser = options.CreateParser() parser.parse_args(['--browser', 'any']) self.assertEquals(options.browser_options.profile_dir, None) def testProfileDir(self): options = browser_options.BrowserFinderOptions() parser = options.CreateParser() # Need to use a directory that exists. current_dir = os.path.dirname(__file__) parser.parse_args(['--browser', 'any', '--profile-dir', current_dir]) self.assertEquals(options.browser_options.profile_dir, current_dir) def testExtraBrowserArgs(self): options = browser_options.BrowserFinderOptions() parser = options.CreateParser() parser.parse_args(['--extra-browser-args=--foo --bar']) self.assertEquals(options.browser_options.extra_browser_args, set(['--foo', '--bar'])) def testMergeDefaultValues(self): options = browser_options.BrowserFinderOptions() options.already_true = True options.already_false = False options.override_to_true = False options.override_to_false = True parser = optparse.OptionParser() parser.add_option('--already_true', action='store_true') parser.add_option('--already_false', action='store_true') parser.add_option('--unset', action='store_true') parser.add_option('--default_true', action='store_true', default=True) parser.add_option('--default_false', action='store_true', default=False) parser.add_option('--override_to_true', action='store_true', default=False) parser.add_option('--override_to_false', action='store_true', default=True) options.MergeDefaultValues(parser.get_default_values()) self.assertTrue(options.already_true) self.assertFalse(options.already_false) self.assertTrue(options.unset is None) self.assertTrue(options.default_true) self.assertFalse(options.default_false) self.assertFalse(options.override_to_true) self.assertTrue(options.override_to_false)
js0701/chromium-crosswalk
tools/telemetry/telemetry/internal/browser/browser_options_unittest.py
Python
bsd-3-clause
4,501
""" Wrapper for loading templates from the filesystem. """ from django.conf import settings from django.template.base import TemplateDoesNotExist from django.template.loader import BaseLoader from django.utils._os import safe_join class Loader(BaseLoader): is_usable = True def get_template_sources(self, template_name, template_dirs=None): """ Returns the absolute paths to "template_name", when appended to each directory in "template_dirs". Any paths that don't lie inside one of the template dirs are excluded from the result set, for security reasons. """ if not template_dirs: template_dirs = settings.TEMPLATE_DIRS for template_dir in template_dirs: try: yield safe_join(template_dir, template_name) except UnicodeDecodeError: # The template dir name was a bytestring that wasn't valid UTF-8. raise except ValueError: # The joined path was located outside of this particular # template_dir (it might be inside another one, so this isn't # fatal). pass def load_template_source(self, template_name, template_dirs=None): tried = [] for filepath in self.get_template_sources(template_name, template_dirs): try: with open(filepath, 'rb') as fp: return (fp.read().decode(settings.FILE_CHARSET), filepath) except IOError: tried.append(filepath) if tried: error_msg = "Tried %s" % tried else: error_msg = "Your TEMPLATE_DIRS setting is empty. Change it to point to at least one template directory." raise TemplateDoesNotExist(error_msg) load_template_source.is_usable = True _loader = Loader()
RaoUmer/django
django/template/loaders/filesystem.py
Python
bsd-3-clause
1,871
# rastest.py - test/demonstrate the win32ras module. # Much of the code here contributed by Jethro Wright. import sys import string import os import win32ras # Build a little dictionary of RAS states to decent strings. # eg win32ras.RASCS_OpenPort -> "OpenPort" stateMap = {} for name, val in win32ras.__dict__.items(): if name[:6]=="RASCS_": stateMap[val] = name[6:] # Use a lock so the callback can tell the main thread when it is finished. import win32event callbackEvent = win32event.CreateEvent(None, 0, 0, None) def Callback( hras, msg, state, error, exterror): # print "Callback called with ", hras, msg, state, error, exterror stateName = stateMap.get(state, "Unknown state?") print "Status is %s (%04lx), error code is %d" % (stateName, state, error) finished = state in [win32ras.RASCS_Connected] if finished: win32event.SetEvent(callbackEvent) if error != 0 or int( state ) == win32ras.RASCS_Disconnected: # we know for sure this is a good place to hangup.... print "Detected call failure: %s" % win32ras.GetErrorString( error ) HangUp( hras ) win32event.SetEvent(callbackEvent) def ShowConnections(): print "All phone-book entries:" for (name,) in win32ras.EnumEntries(): print " ", name print "Current Connections:" for con in win32ras.EnumConnections(): print " ", con def EditEntry(entryName): try: win32ras.EditPhonebookEntry(0,None,entryName) except win32ras.error, (rc, function, msg): print "Can not edit/find the RAS entry -", msg def HangUp( hras ): # trap potential, irrelevant errors from win32ras.... try: win32ras.HangUp( hras ) except: print "Tried to hang up gracefully on error, but didn't work...." return None def Connect(entryName, bUseCallback): if bUseCallback: theCallback = Callback win32event.ResetEvent(callbackEvent) else: theCallback = None # in order to *use* the username/password of a particular dun entry, one must # explicitly get those params under win95.... try: dp, b = win32ras.GetEntryDialParams( None, entryName ) except: print "Couldn't find DUN entry: %s" % entryName else: hras, rc = win32ras.Dial(None, None, (entryName, "", "", dp[ 3 ], dp[ 4 ], ""),theCallback) # hras, rc = win32ras.Dial(None, None, (entryName, ),theCallback) # print hras, rc if not bUseCallback and rc <> 0: print "Could not dial the RAS connection:", win32ras.GetErrorString(rc) hras = HangUp( hras ) # don't wait here if there's no need to.... elif bUseCallback and win32event.WaitForSingleObject(callbackEvent, 60000)!=win32event.WAIT_OBJECT_0: print "Gave up waiting for the process to complete!" # sdk docs state one must explcitly hangup, even if there's an error.... try: cs = win32ras.GetConnectStatus( hras ) except: # on error, attempt a hang up anyway.... hras = HangUp( hras ) else: if int( cs[ 0 ] ) == win32ras.RASCS_Disconnected: hras = HangUp( hras ) return hras, rc def Disconnect( rasEntry ): # Need to find the entry name = string.lower( rasEntry ) for hcon, entryName, devName, devType in win32ras.EnumConnections(): if string.lower( entryName ) == name: win32ras.HangUp( hcon ) print "Disconnected from", rasEntry break else: print "Could not find an open connection to", entryName usage = """ Usage: %s [-s] [-l] [-c connection] [-d connection] -l : List phone-book entries and current connections. -s : Show status while connecting/disconnecting (uses callbacks) -c : Connect to the specified phonebook name. -d : Disconnect from the specified phonebook name. -e : Edit the specified phonebook entry. """ def main(): import getopt try: opts, args = getopt.getopt(sys.argv[1:], "slc:d:e:") except getopt.error, why: print why print usage % (os.path.basename(sys.argv[0],)) return bCallback = 0 if args or not opts: print usage % (os.path.basename(sys.argv[0],)) return for opt, val in opts: if opt=="-s": bCallback = 1 if opt=="-l": ShowConnections() if opt=="-c": hras, rc = Connect(val, bCallback) if hras != None: print "hras: 0x%8lx, rc: 0x%04x" % ( hras, rc ) if opt=="-d": Disconnect(val) if opt=="-e": EditEntry(val) if __name__=='__main__': main()
espadrine/opera
chromium/src/third_party/python_26/Lib/site-packages/win32/Demos/rastest.py
Python
bsd-3-clause
4,789
""" Test PostgreSQL full text search. These tests use dialogue from the 1975 film Monty Python and the Holy Grail. All text copyright Python (Monty) Pictures. Thanks to sacred-texts.com for the transcript. """ from django.contrib.postgres.search import ( SearchQuery, SearchRank, SearchVector, ) from django.db.models import F from django.test import modify_settings from . import PostgreSQLTestCase from .models import Character, Line, Scene class GrailTestData(object): @classmethod def setUpTestData(cls): cls.robin = Scene.objects.create(scene='Scene 10', setting='The dark forest of Ewing') cls.minstrel = Character.objects.create(name='Minstrel') verses = [ ( 'Bravely bold Sir Robin, rode forth from Camelot. ' 'He was not afraid to die, o Brave Sir Robin. ' 'He was not at all afraid to be killed in nasty ways. ' 'Brave, brave, brave, brave Sir Robin!' ), ( 'He was not in the least bit scared to be mashed into a pulp, ' 'Or to have his eyes gouged out, and his elbows broken. ' 'To have his kneecaps split, and his body burned away, ' 'And his limbs all hacked and mangled, brave Sir Robin!' ), ( 'His head smashed in and his heart cut out, ' 'And his liver removed and his bowels unplugged, ' 'And his nostrils ripped and his bottom burned off,' 'And his --' ), ] cls.verses = [Line.objects.create( scene=cls.robin, character=cls.minstrel, dialogue=verse, ) for verse in verses] cls.verse0, cls.verse1, cls.verse2 = cls.verses cls.witch_scene = Scene.objects.create(scene='Scene 5', setting="Sir Bedemir's Castle") bedemir = Character.objects.create(name='Bedemir') crowd = Character.objects.create(name='Crowd') witch = Character.objects.create(name='Witch') duck = Character.objects.create(name='Duck') cls.bedemir0 = Line.objects.create( scene=cls.witch_scene, character=bedemir, dialogue='We shall use my larger scales!', dialogue_config='english', ) cls.bedemir1 = Line.objects.create( scene=cls.witch_scene, character=bedemir, dialogue='Right, remove the supports!', dialogue_config='english', ) cls.duck = Line.objects.create(scene=cls.witch_scene, character=duck, dialogue=None) cls.crowd = Line.objects.create(scene=cls.witch_scene, character=crowd, dialogue='A witch! A witch!') cls.witch = Line.objects.create(scene=cls.witch_scene, character=witch, dialogue="It's a fair cop.") trojan_rabbit = Scene.objects.create(scene='Scene 8', setting="The castle of Our Master Ruiz' de lu la Ramper") guards = Character.objects.create(name='French Guards') cls.french = Line.objects.create( scene=trojan_rabbit, character=guards, dialogue='Oh. Un cadeau. Oui oui.', dialogue_config='french', ) @modify_settings(INSTALLED_APPS={'append': 'django.contrib.postgres'}) class SimpleSearchTest(GrailTestData, PostgreSQLTestCase): def test_simple(self): searched = Line.objects.filter(dialogue__search='elbows') self.assertSequenceEqual(searched, [self.verse1]) def test_non_exact_match(self): searched = Line.objects.filter(dialogue__search='hearts') self.assertSequenceEqual(searched, [self.verse2]) def test_search_two_terms(self): searched = Line.objects.filter(dialogue__search='heart bowel') self.assertSequenceEqual(searched, [self.verse2]) def test_search_two_terms_with_partial_match(self): searched = Line.objects.filter(dialogue__search='Robin killed') self.assertSequenceEqual(searched, [self.verse0]) @modify_settings(INSTALLED_APPS={'append': 'django.contrib.postgres'}) class SearchVectorFieldTest(GrailTestData, PostgreSQLTestCase): def test_existing_vector(self): Line.objects.update(dialogue_search_vector=SearchVector('dialogue')) searched = Line.objects.filter(dialogue_search_vector=SearchQuery('Robin killed')) self.assertSequenceEqual(searched, [self.verse0]) def test_existing_vector_config_explicit(self): Line.objects.update(dialogue_search_vector=SearchVector('dialogue')) searched = Line.objects.filter(dialogue_search_vector=SearchQuery('cadeaux', config='french')) self.assertSequenceEqual(searched, [self.french]) class MultipleFieldsTest(GrailTestData, PostgreSQLTestCase): def test_simple_on_dialogue(self): searched = Line.objects.annotate( search=SearchVector('scene__setting', 'dialogue'), ).filter(search='elbows') self.assertSequenceEqual(searched, [self.verse1]) def test_simple_on_scene(self): searched = Line.objects.annotate( search=SearchVector('scene__setting', 'dialogue'), ).filter(search='Forest') self.assertSequenceEqual(searched, self.verses) def test_non_exact_match(self): searched = Line.objects.annotate( search=SearchVector('scene__setting', 'dialogue'), ).filter(search='heart') self.assertSequenceEqual(searched, [self.verse2]) def test_search_two_terms(self): searched = Line.objects.annotate( search=SearchVector('scene__setting', 'dialogue'), ).filter(search='heart forest') self.assertSequenceEqual(searched, [self.verse2]) def test_terms_adjacent(self): searched = Line.objects.annotate( search=SearchVector('character__name', 'dialogue'), ).filter(search='minstrel') self.assertSequenceEqual(searched, self.verses) searched = Line.objects.annotate( search=SearchVector('scene__setting', 'dialogue'), ).filter(search='minstrelbravely') self.assertSequenceEqual(searched, []) def test_search_with_null(self): searched = Line.objects.annotate( search=SearchVector('scene__setting', 'dialogue'), ).filter(search='bedemir') self.assertEqual(set(searched), {self.bedemir0, self.bedemir1, self.crowd, self.witch, self.duck}) def test_config_query_explicit(self): searched = Line.objects.annotate( search=SearchVector('scene__setting', 'dialogue', config='french'), ).filter(search=SearchQuery('cadeaux', config='french')) self.assertSequenceEqual(searched, [self.french]) def test_config_query_implicit(self): searched = Line.objects.annotate( search=SearchVector('scene__setting', 'dialogue', config='french'), ).filter(search='cadeaux') self.assertSequenceEqual(searched, [self.french]) def test_config_from_field_explicit(self): searched = Line.objects.annotate( search=SearchVector('scene__setting', 'dialogue', config=F('dialogue_config')), ).filter(search=SearchQuery('cadeaux', config=F('dialogue_config'))) self.assertSequenceEqual(searched, [self.french]) def test_config_from_field_implicit(self): searched = Line.objects.annotate( search=SearchVector('scene__setting', 'dialogue', config=F('dialogue_config')), ).filter(search='cadeaux') self.assertSequenceEqual(searched, [self.french]) @modify_settings(INSTALLED_APPS={'append': 'django.contrib.postgres'}) class TestCombinations(GrailTestData, PostgreSQLTestCase): def test_vector_add(self): searched = Line.objects.annotate( search=SearchVector('scene__setting') + SearchVector('character__name'), ).filter(search='bedemir') self.assertEqual(set(searched), {self.bedemir0, self.bedemir1, self.crowd, self.witch, self.duck}) def test_vector_add_multi(self): searched = Line.objects.annotate( search=( SearchVector('scene__setting') + SearchVector('character__name') + SearchVector('dialogue') ), ).filter(search='bedemir') self.assertEqual(set(searched), {self.bedemir0, self.bedemir1, self.crowd, self.witch, self.duck}) def test_query_and(self): searched = Line.objects.annotate( search=SearchVector('scene__setting', 'dialogue'), ).filter(search=SearchQuery('bedemir') & SearchQuery('scales')) self.assertSequenceEqual(searched, [self.bedemir0]) def test_query_or(self): searched = Line.objects.filter(dialogue__search=SearchQuery('kneecaps') | SearchQuery('nostrils')) self.assertSequenceEqual(set(searched), {self.verse1, self.verse2}) def test_query_invert(self): searched = Line.objects.filter(character=self.minstrel, dialogue__search=~SearchQuery('kneecaps')) self.assertEqual(set(searched), {self.verse0, self.verse2}) @modify_settings(INSTALLED_APPS={'append': 'django.contrib.postgres'}) class TestRankingAndWeights(GrailTestData, PostgreSQLTestCase): def test_ranking(self): searched = Line.objects.filter(character=self.minstrel).annotate( rank=SearchRank(SearchVector('dialogue'), SearchQuery('brave sir robin')), ).order_by('rank') self.assertSequenceEqual(searched, [self.verse2, self.verse1, self.verse0]) def test_rank_passing_untyped_args(self): searched = Line.objects.filter(character=self.minstrel).annotate( rank=SearchRank('dialogue', 'brave sir robin'), ).order_by('rank') self.assertSequenceEqual(searched, [self.verse2, self.verse1, self.verse0]) def test_weights_in_vector(self): vector = SearchVector('dialogue', weight='A') + SearchVector('character__name', weight='D') searched = Line.objects.filter(scene=self.witch_scene).annotate( rank=SearchRank(vector, SearchQuery('witch')), ).order_by('-rank')[:2] self.assertSequenceEqual(searched, [self.crowd, self.witch]) vector = SearchVector('dialogue', weight='D') + SearchVector('character__name', weight='A') searched = Line.objects.filter(scene=self.witch_scene).annotate( rank=SearchRank(vector, SearchQuery('witch')), ).order_by('-rank')[:2] self.assertSequenceEqual(searched, [self.witch, self.crowd]) def test_ranked_custom_weights(self): vector = SearchVector('dialogue', weight='D') + SearchVector('character__name', weight='A') searched = Line.objects.filter(scene=self.witch_scene).annotate( rank=SearchRank(vector, SearchQuery('witch'), weights=[1, 0, 0, 0.5]), ).order_by('-rank')[:2] self.assertSequenceEqual(searched, [self.crowd, self.witch]) def test_ranking_chaining(self): searched = Line.objects.filter(character=self.minstrel).annotate( rank=SearchRank(SearchVector('dialogue'), SearchQuery('brave sir robin')), ).filter(rank__gt=0.3) self.assertSequenceEqual(searched, [self.verse0])
sergei-maertens/django
tests/postgres_tests/test_search.py
Python
bsd-3-clause
11,247
# -*- coding: utf-8 -*- # vispy: gallery 30 # ----------------------------------------------------------------------------- # Copyright (c) 2015, Vispy Development Team. All Rights Reserved. # Distributed under the (new) BSD License. See LICENSE.txt for more info. # ----------------------------------------------------------------------------- """ This example demonstrates the use of the SurfacePlot visual. """ import sys import numpy as np from vispy import app, scene from vispy.util.filter import gaussian_filter canvas = scene.SceneCanvas(keys='interactive', bgcolor='w') view = canvas.central_widget.add_view() view.camera = scene.TurntableCamera(up='z', fov=60) # Simple surface plot example # x, y values are not specified, so assumed to be 0:50 z = np.random.normal(size=(250, 250), scale=200) z[100, 100] += 50000 z = gaussian_filter(z, (10, 10)) p1 = scene.visuals.SurfacePlot(z=z, color=(0.3, 0.3, 1, 1)) p1.transform = scene.transforms.MatrixTransform() p1.transform.scale([1/249., 1/249., 1/249.]) p1.transform.translate([-0.5, -0.5, 0]) view.add(p1) # p1._update_data() # cheating. # cf = scene.filters.ZColormapFilter('fire', zrange=(z.max(), z.min())) # p1.attach(cf) xax = scene.Axis(pos=[[-0.5, -0.5], [0.5, -0.5]], tick_direction=(0, -1), font_size=16, axis_color='k', tick_color='k', text_color='k', parent=view.scene) xax.transform = scene.STTransform(translate=(0, 0, -0.2)) yax = scene.Axis(pos=[[-0.5, -0.5], [-0.5, 0.5]], tick_direction=(-1, 0), font_size=16, axis_color='k', tick_color='k', text_color='k', parent=view.scene) yax.transform = scene.STTransform(translate=(0, 0, -0.2)) # Add a 3D axis to keep us oriented axis = scene.visuals.XYZAxis(parent=view.scene) if __name__ == '__main__': canvas.show() if sys.flags.interactive == 0: app.run()
jay3sh/vispy
examples/basics/scene/surface_plot.py
Python
bsd-3-clause
1,876
// Copyright 2015 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package gl import ( "bytes" "fmt" "sync/atomic" "time" ) const ( printGlobalStats = false historySize = 100 ) func init() { if printGlobalStats { go func() { for { time.Sleep(time.Second) println(globalStats.get()) } }() } } type count struct { value int32 incs int32 decs int32 } func (c *count) inc() { atomic.AddInt32(&c.value, 1) atomic.AddInt32(&c.incs, 1) } func (c *count) dec() { atomic.AddInt32(&c.decs, 1) if atomic.AddInt32(&c.value, -1) < 0 { panic("Count has gone negative") } } func (c *count) resetDeltas() { atomic.StoreInt32(&c.incs, 0) atomic.StoreInt32(&c.decs, 0) } func (c count) String() string { return fmt.Sprintf("%d [+%d/-%d]", c.value, c.incs, c.decs) } type globalDriverStats struct { vertexStreamContextCount count indexBufferContextCount count textureContextCount count } func (s *globalDriverStats) get() string { buffer := &bytes.Buffer{} fmt.Fprintf(buffer, "Vertex stream context count: %v\n", s.vertexStreamContextCount) fmt.Fprintf(buffer, "Index buffer context count: %v\n", s.indexBufferContextCount) fmt.Fprintf(buffer, "Texture context count: %v\n", s.textureContextCount) s.vertexStreamContextCount.resetDeltas() s.indexBufferContextCount.resetDeltas() s.textureContextCount.resetDeltas() return buffer.String() } var globalStats globalDriverStats type timer struct { name string duration time.Duration total time.Duration history [historySize]time.Duration timer time.Time current int } func (t *timer) start() { t.timer = time.Now() } func (t *timer) stop() { duration := time.Since(t.timer) t.total -= t.history[t.current] t.history[t.current] = duration t.total += t.history[t.current] t.duration = t.total / historySize t.current++ if t.current >= historySize { t.current = 0 } } func (t timer) Format(f fmt.State, c rune) { ps := 1.0 / t.duration.Seconds() max := t.history[0] min := t.history[0] for _, h := range t.history { if max < h { max = h } if min > h { min = h } } fmt.Fprintf(f, "%s: %v [%.2f/s] %v<%v<%v", t.name, t.duration, ps, min, t.history[t.current], max) } type contextStats struct { textureCount int vertexStreamCount int indexBufferCount int shaderProgramCount int frameCount int drawCallCount int timers []timer } func (s *contextStats) timer(name string) *timer { for i := range s.timers { t := &s.timers[i] if t.name == name { return t } } s.timers = append(s.timers, timer{name: name}) return &s.timers[len(s.timers)-1] } func (s contextStats) String() string { buffer := &bytes.Buffer{} for _, t := range s.timers { fmt.Fprintf(buffer, "%v\n", t) } fmt.Fprintf(buffer, "Draw calls per frame: %d\n", s.drawCallCount) fmt.Fprintf(buffer, "Frame count: %d\n", s.frameCount) fmt.Fprintf(buffer, "Textures: %d\n", s.textureCount) fmt.Fprintf(buffer, "Vertex stream count: %d\n", s.vertexStreamCount) fmt.Fprintf(buffer, "Index buffer count: %d\n", s.indexBufferCount) fmt.Fprintf(buffer, "Shader program count: %d\n", s.shaderProgramCount) return buffer.String() }
leelib/gxui
drivers/gl/stats.go
GO
bsd-3-clause
3,289
// Copyright 2014 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package profile import ( "strings" "testing" ) func TestPrune(t *testing.T) { for _, test := range []struct { in *Profile want string }{ {in1, out1}, {in2, out2}, } { in := test.in.Copy() in.RemoveUninteresting() if err := in.CheckValid(); err != nil { t.Error(err) } w := strings.Split(test.want, "\n") for i, g := range strings.Split(in.String(), "\n") { if i >= len(w) { t.Fatalf("got trailing %s", g) } if strings.TrimSpace(g) != strings.TrimSpace(w[i]) { t.Fatalf(`%d: got: "%s" want:"%s"`, i, g, w[i]) } } } } var funs = []*Function{ {ID: 1, Name: "main", SystemName: "main", Filename: "main.c"}, {ID: 2, Name: "fun1", SystemName: "fun1", Filename: "fun.c"}, {ID: 3, Name: "fun2", SystemName: "fun2", Filename: "fun.c"}, {ID: 4, Name: "fun3", SystemName: "fun3", Filename: "fun.c"}, {ID: 5, Name: "fun4", SystemName: "fun4", Filename: "fun.c"}, {ID: 6, Name: "fun5", SystemName: "fun5", Filename: "fun.c"}, {ID: 7, Name: "unsimplified_fun(int)", SystemName: "unsimplified_fun(int)", Filename: "fun.c"}, {ID: 8, Name: "Foo::(anonymous namespace)::Test::Bar", SystemName: "Foo::(anonymous namespace)::Test::Bar", Filename: "fun.c"}, {ID: 9, Name: "Hello::(anonymous namespace)::World(const Foo::(anonymous namespace)::Test::Bar)", SystemName: "Hello::(anonymous namespace)::World(const Foo::(anonymous namespace)::Test::Bar)", Filename: "fun.c"}, {ID: 10, Name: "Foo::operator()(::Bar)", SystemName: "Foo::operator()(::Bar)", Filename: "fun.c"}, } var locs1 = []*Location{ { ID: 1, Line: []Line{ {Function: funs[0], Line: 1}, }, }, { ID: 2, Line: []Line{ {Function: funs[1], Line: 2}, {Function: funs[2], Line: 1}, }, }, { ID: 3, Line: []Line{ {Function: funs[3], Line: 2}, {Function: funs[1], Line: 1}, }, }, { ID: 4, Line: []Line{ {Function: funs[3], Line: 2}, {Function: funs[1], Line: 2}, {Function: funs[5], Line: 2}, }, }, } var in1 = &Profile{ PeriodType: &ValueType{Type: "cpu", Unit: "milliseconds"}, Period: 1, DurationNanos: 10e9, SampleType: []*ValueType{ {Type: "samples", Unit: "count"}, {Type: "cpu", Unit: "milliseconds"}, }, Sample: []*Sample{ { Location: []*Location{locs1[0]}, Value: []int64{1, 1}, }, { Location: []*Location{locs1[1], locs1[0]}, Value: []int64{1, 1}, }, { Location: []*Location{locs1[2], locs1[0]}, Value: []int64{1, 1}, }, { Location: []*Location{locs1[3], locs1[0]}, Value: []int64{1, 1}, }, { Location: []*Location{locs1[3], locs1[2], locs1[1], locs1[0]}, Value: []int64{1, 1}, }, }, Location: locs1, Function: funs, DropFrames: "fu.*[12]|banana", KeepFrames: ".*[n2][n2]", } const out1 = `PeriodType: cpu milliseconds Period: 1 Duration: 10s Samples: samples/count cpu/milliseconds 1 1: 1 1 1: 2 1 1 1: 1 1 1: 4 1 1 1: 2 1 Locations 1: 0x0 main main.c:1 s=0 2: 0x0 fun2 fun.c:1 s=0 3: 0x0 fun3 fun.c:2 s=0 fun1 fun.c:1 s=0 4: 0x0 fun5 fun.c:2 s=0 Mappings ` var locs2 = []*Location{ { ID: 1, Line: []Line{ {Function: funs[0], Line: 1}, }, }, { ID: 2, Line: []Line{ {Function: funs[6], Line: 1}, }, }, { ID: 3, Line: []Line{ {Function: funs[7], Line: 1}, }, }, { ID: 4, Line: []Line{ {Function: funs[8], Line: 1}, }, }, { ID: 5, Line: []Line{ {Function: funs[9], Line: 1}, }, }, } var in2 = &Profile{ PeriodType: &ValueType{Type: "cpu", Unit: "milliseconds"}, Period: 1, DurationNanos: 10e9, SampleType: []*ValueType{ {Type: "samples", Unit: "count"}, {Type: "cpu", Unit: "milliseconds"}, }, Sample: []*Sample{ // Unsimplified name with parameters shouldn't match. { Location: []*Location{locs2[1], locs2[0]}, Value: []int64{1, 1}, }, // .*Foo::.*::Bar.* should (and will be dropped) regardless of the anonymous namespace. { Location: []*Location{locs2[2], locs2[0]}, Value: []int64{1, 1}, }, // .*Foo::.*::Bar.* shouldn't match inside the parameter list. { Location: []*Location{locs2[3], locs2[0]}, Value: []int64{1, 1}, }, // .*operator\(\) should match, regardless of parameters. { Location: []*Location{locs2[4], locs2[0]}, Value: []int64{1, 1}, }, }, Location: locs2, Function: funs, DropFrames: `unsimplified_fun\(int\)|.*Foo::.*::Bar.*|.*operator\(\)`, } const out2 = `PeriodType: cpu milliseconds Period: 1 Duration: 10s Samples: samples/count cpu/milliseconds 1 1: 2 1 1 1: 1 1 1: 4 1 1 1: 1 Locations 1: 0x0 main main.c:1 s=0 2: 0x0 unsimplified_fun(int) fun.c:1 s=0 3: 0x0 Foo::(anonymous namespace)::Test::Bar fun.c:1 s=0 4: 0x0 Hello::(anonymous namespace)::World(const Foo::(anonymous namespace)::Test::Bar) fun.c:1 s=0 5: 0x0 Foo::operator()(::Bar) fun.c:1 s=0 Mappings `
Cofyc/go
src/cmd/vendor/github.com/google/pprof/profile/prune_test.go
GO
bsd-3-clause
5,637
<?php /* * This file is part of the Fxp Composer Asset Plugin package. * * (c) François Pluchino <francois.pluchino@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Fxp\Composer\AssetPlugin\Tests\Fixtures\Repository\Vcs; use Composer\Config; use Composer\IO\IOInterface; use Composer\Repository\Vcs\VcsDriverInterface; /** * Mock vcs driver. * * @author François Pluchino <francois.pluchino@gmail.com> */ class MockVcsDriver implements VcsDriverInterface { /** * @var bool */ public static $supported = true; /** * @var mixed */ public $contents = null; /** * {@inheritdoc} */ public function initialize() { // no action } /** * {@inheritdoc} */ public function getComposerInformation($identifier) { return; } /** * {@inheritdoc} */ public function getRootIdentifier() { return; } /** * {@inheritdoc} */ public function getBranches() { return array(); } /** * {@inheritdoc} */ public function getTags() { return array(); } /** * {@inheritdoc} */ public function getDist($identifier) { return; } /** * {@inheritdoc} */ public function getSource($identifier) { return; } /** * {@inheritdoc} */ public function getUrl() { return; } /** * {@inheritdoc} */ public function hasComposerFile($identifier) { return false; } /** * {@inheritdoc} */ public function cleanup() { // no action } /** * {@inheritdoc} */ public static function supports(IOInterface $io, Config $config, $url, $deep = false) { return static::$supported; } /** * @return mixed */ protected function getContents() { return $this->contents; } }
BayramovNicat/toyplan
vendor/fxp/composer-asset-plugin/Tests/Fixtures/Repository/Vcs/MockVcsDriver.php
PHP
bsd-3-clause
2,083
<?php /** * Locale data for 'fr_YT'. * * This file is automatically generated by yiic cldr command. * * Copyright © 1991-2007 Unicode, Inc. All rights reserved. * Distributed under the Terms of Use in http://www.unicode.org/copyright.html. * * @copyright 2008-2013 Yii Software LLC (http://www.yiiframework.com/license/) */ return array ( 'version' => '5798', 'numberSymbols' => array ( 'alias' => '', 'decimal' => ',', 'group' => ' ', 'list' => ';', 'percentSign' => '%', 'plusSign' => '+', 'minusSign' => '-', 'exponential' => 'E', 'perMille' => '‰', 'infinity' => '∞', 'nan' => 'NaN', ), 'decimalFormat' => '#,##0.###', 'scientificFormat' => '#E0', 'percentFormat' => '#,##0 %', 'currencyFormat' => '#,##0.00 ¤', 'currencySymbols' => array ( 'AUD' => '$AU', 'BRL' => 'R$', 'CAD' => '$CA', 'CNY' => 'Ұ', 'EUR' => '€', 'GBP' => '£UK', 'HKD' => '$HK', 'ILS' => '₪', 'INR' => '₹', 'JPY' => '¥JP', 'KRW' => '₩', 'MXN' => 'MX$', 'NZD' => '$NZ', 'THB' => '฿', 'TWD' => 'NT$', 'USD' => '$US', 'VND' => '₫', 'XAF' => 'FCFA', 'XCD' => 'EC$', 'XOF' => 'CFA', 'XPF' => 'FCFP', 'ADP' => '₧A', 'ANG' => 'f.NA', 'ARS' => '$AR', 'BEF' => 'FB', 'BMD' => '$BM', 'BND' => '$BN', 'BSD' => '$BS', 'BZD' => '$BZ', 'CDF' => 'FrCD', 'CLP' => '$CL', 'COP' => '$CO', 'CUP' => '$CU', 'CVE' => '$CV', 'CYP' => '£CY', 'DKK' => 'krD', 'EEK' => 'krE', 'EGP' => '£EG', 'ESP' => '₧', 'FJD' => '$FJ', 'FKP' => '£FK', 'FRF' => 'F', 'GIP' => '£GI', 'GYD' => '$GY', 'IEP' => '£IE', 'ILP' => '£IL', 'ISK' => 'krI', 'ITL' => '₤IT', 'JMD' => '$JM', 'JOD' => 'DJ', 'KMF' => 'FC', 'KPW' => '₩KP', 'KWD' => 'DK', 'KYD' => '$KY', 'LBP' => '£LB', 'LKR' => 'RsSL', 'LRD' => '$LR', 'LYD' => 'DL', 'MTP' => '£MT', 'MUR' => 'RsMU', 'NAD' => '$NA', 'NOK' => 'krN', 'NPR' => 'RsNP', 'PKR' => 'RsPK', 'QAR' => 'RQ', 'RHD' => '$RH', 'RWF' => 'FR', 'SBD' => '$SB', 'SEK' => 'krS', 'SGD' => '$SG', 'SHP' => '£SH', 'SRD' => '$SR', 'SVC' => '₡SV', 'SYP' => '£SY', 'TTD' => '$TT', 'UYU' => '$UY', 'YER' => 'RY', 'ZWD' => '$Z', ), 'monthNames' => array ( 'wide' => array ( 1 => 'janvier', 2 => 'février', 3 => 'mars', 4 => 'avril', 5 => 'mai', 6 => 'juin', 7 => 'juillet', 8 => 'août', 9 => 'septembre', 10 => 'octobre', 11 => 'novembre', 12 => 'décembre', ), 'abbreviated' => array ( 1 => 'janv.', 2 => 'févr.', 3 => 'mars', 4 => 'avr.', 5 => 'mai', 6 => 'juin', 7 => 'juil.', 8 => 'août', 9 => 'sept.', 10 => 'oct.', 11 => 'nov.', 12 => 'déc.', ), ), 'monthNamesSA' => array ( 'narrow' => array ( 1 => 'J', 2 => 'F', 3 => 'M', 4 => 'A', 5 => 'M', 6 => 'J', 7 => 'J', 8 => 'A', 9 => 'S', 10 => 'O', 11 => 'N', 12 => 'D', ), 'abbreviated' => array ( 1 => 'janv.', 2 => 'févr.', 3 => 'mars', 4 => 'avr.', 7 => 'juil.', 9 => 'sept.', 10 => 'oct.', 11 => 'nov.', 12 => 'déc.', ), ), 'weekDayNames' => array ( 'wide' => array ( 0 => 'dimanche', 1 => 'lundi', 2 => 'mardi', 3 => 'mercredi', 4 => 'jeudi', 5 => 'vendredi', 6 => 'samedi', ), 'abbreviated' => array ( 0 => 'dim.', 1 => 'lun.', 2 => 'mar.', 3 => 'mer.', 4 => 'jeu.', 5 => 'ven.', 6 => 'sam.', ), ), 'weekDayNamesSA' => array ( 'narrow' => array ( 0 => 'D', 1 => 'L', 2 => 'M', 3 => 'M', 4 => 'J', 5 => 'V', 6 => 'S', ), 'abbreviated' => array ( 0 => 'dim.', 1 => 'lun.', 2 => 'mar.', 3 => 'mer.', 4 => 'jeu.', 5 => 'ven.', 6 => 'sam.', ), ), 'eraNames' => array ( 'abbreviated' => array ( 0 => 'av. J.-C.', 1 => 'ap. J.-C.', ), 'wide' => array ( 0 => 'avant Jésus-Christ', 1 => 'après Jésus-Christ', ), 'narrow' => array ( 0 => 'av. J.-C.', 1 => 'ap. J.-C.', ), ), 'dateFormats' => array ( 'full' => 'EEEE d MMMM y', 'long' => 'd MMMM y', 'medium' => 'd MMM y', 'short' => 'dd/MM/yy', ), 'timeFormats' => array ( 'full' => 'HH:mm:ss zzzz', 'long' => 'HH:mm:ss z', 'medium' => 'HH:mm:ss', 'short' => 'HH:mm', ), 'dateTimeFormat' => '{1} {0}', 'amName' => 'AM', 'pmName' => 'PM', 'orientation' => 'ltr', 'languages' => array ( 'aa' => 'afar', 'ab' => 'abkhaze', 'ace' => 'aceh', 'ach' => 'acoli', 'ada' => 'adangme', 'ady' => 'adyghéen', 'ae' => 'avestique', 'af' => 'afrikaans', 'afa' => 'langue afro-asiatique', 'afh' => 'afrihili', 'agq' => 'aghem', 'ain' => 'aïnou', 'ak' => 'akan', 'akk' => 'akkadien', 'ale' => 'aléoute', 'alg' => 'langue algonquienne', 'alt' => 'altaï du Sud', 'am' => 'amharique', 'an' => 'aragonais', 'ang' => 'ancien anglais', 'anp' => 'angika', 'apa' => 'langue apache', 'ar' => 'arabe', 'arc' => 'araméen', 'arn' => 'araukan', 'arp' => 'arapaho', 'art' => 'langue artificielle', 'arw' => 'arawak', 'as' => 'assamais', 'asa' => 'asou (Tanzania)', 'ast' => 'asturien', 'ath' => 'langue athapascane', 'aus' => 'langue australienne', 'av' => 'avar', 'awa' => 'awadhi', 'ay' => 'aymara', 'az' => 'azéri', 'ba' => 'bachkir', 'bad' => 'banda', 'bai' => 'langue bamilékée', 'bal' => 'baloutchi', 'ban' => 'balinais', 'bas' => 'bassa', 'bat' => 'langue balte', 'be' => 'biélorusse', 'bej' => 'bedja', 'bem' => 'bemba', 'ber' => 'berbère', 'bez' => 'bena (Tanzania)', 'bg' => 'bulgare', 'bh' => 'bihari', 'bho' => 'bhojpuri', 'bi' => 'bichelamar', 'bik' => 'bikol', 'bin' => 'bini', 'bla' => 'siksika', 'bm' => 'bambara', 'bn' => 'bengali', 'bnt' => 'bantou', 'bo' => 'tibétain', 'br' => 'breton', 'bra' => 'braj', 'brx' => 'bodo', 'bs' => 'bosniaque', 'btk' => 'batak', 'bua' => 'bouriate', 'bug' => 'bugi', 'byn' => 'blin', 'ca' => 'catalan', 'cad' => 'caddo', 'cai' => 'langue amérindienne centrale', 'car' => 'caribe', 'cau' => 'langue caucasienne', 'cch' => 'atsam', 'ce' => 'tchétchène', 'ceb' => 'cebuano', 'cel' => 'langue celtique', 'ch' => 'chamorro', 'chb' => 'chibcha', 'chg' => 'tchaghataï', 'chk' => 'chuuk', 'chm' => 'mari', 'chn' => 'jargon chinook', 'cho' => 'choctaw', 'chp' => 'chipewyan', 'chr' => 'cherokee', 'chy' => 'cheyenne', 'cmc' => 'langue chame', 'co' => 'corse', 'cop' => 'copte', 'cpe' => 'créole ou pidgin anglais', 'cpf' => 'créole ou pidgin français', 'cpp' => 'créole ou pidgin portugais', 'cr' => 'cree', 'crh' => 'turc de Crimée', 'crp' => 'créole ou pidgin', 'cs' => 'tchèque', 'csb' => 'kachoube', 'cu' => 'slavon d’église', 'cus' => 'langue couchitique', 'cv' => 'tchouvache', 'cy' => 'gallois', 'da' => 'danois', 'dak' => 'dakota', 'dar' => 'dargwa', 'day' => 'dayak', 'de' => 'allemand', 'de_at' => 'allemand autrichien', 'de_ch' => 'allemand suisse', 'del' => 'delaware', 'den' => 'slavey', 'dgr' => 'dogrib', 'din' => 'dinka', 'doi' => 'dogri', 'dra' => 'langue dravidienne', 'dsb' => 'bas-sorabe', 'dua' => 'douala', 'dum' => 'moyen néerlandais', 'dv' => 'maldivien', 'dyo' => 'jola-foyi', 'dyu' => 'dioula', 'dz' => 'dzongkha', 'ebu' => 'embu', 'ee' => 'éwé', 'efi' => 'efik', 'egy' => 'égyptien ancien', 'eka' => 'ekajuk', 'el' => 'grec', 'elx' => 'élamite', 'en' => 'anglais', 'en_au' => 'anglais australien', 'en_ca' => 'anglais canadien', 'en_gb' => 'anglais britannique', 'en_us' => 'anglais américain', 'enm' => 'moyen anglais', 'eo' => 'espéranto', 'es' => 'espagnol', 'es_419' => 'espagnol latino-américain', 'es_es' => 'espagnol ibérique', 'et' => 'estonien', 'eu' => 'basque', 'ewo' => 'éwondo', 'fa' => 'persan', 'fan' => 'fang', 'fat' => 'fanti', 'ff' => 'peul', 'fi' => 'finnois', 'fil' => 'filipino', 'fiu' => 'langue finno-ougrienne', 'fj' => 'fidjien', 'fo' => 'féroïen', 'fon' => 'fon', 'fr' => 'français', 'fr_ca' => 'français canadien', 'fr_ch' => 'français suisse', 'frm' => 'moyen français', 'fro' => 'ancien français', 'frr' => 'frison du Nord', 'frs' => 'frison oriental', 'fur' => 'frioulan', 'fy' => 'frison', 'ga' => 'irlandais', 'gaa' => 'ga', 'gay' => 'gayo', 'gba' => 'gbaya', 'gd' => 'gaélique écossais', 'gem' => 'langue germanique', 'gez' => 'guèze', 'gil' => 'gilbertais', 'gl' => 'galicien', 'gmh' => 'moyen haut-allemand', 'gn' => 'guarani', 'goh' => 'ancien haut allemand', 'gon' => 'gondi', 'gor' => 'gorontalo', 'got' => 'gotique', 'grb' => 'grebo', 'grc' => 'grec ancien', 'gsw' => 'alémanique', 'gu' => 'goudjarâtî', 'gv' => 'manx', 'gwi' => 'gwichʼin', 'ha' => 'haoussa', 'hai' => 'haida', 'haw' => 'hawaïen', 'he' => 'hébreu', 'hi' => 'hindi', 'hil' => 'hiligaynon', 'him' => 'himachali', 'hit' => 'hittite', 'hmn' => 'hmong', 'ho' => 'hiri motu', 'hr' => 'croate', 'hsb' => 'haut-sorabe', 'ht' => 'haïtien', 'hu' => 'hongrois', 'hup' => 'hupa', 'hy' => 'arménien', 'hz' => 'héréro', 'ia' => 'interlingua', 'iba' => 'iban', 'id' => 'indonésien', 'ie' => 'interlingue', 'ig' => 'igbo', 'ii' => 'yi de Sichuan', 'ijo' => 'ijo', 'ik' => 'inupiaq', 'ilo' => 'ilokano', 'inc' => 'langue indo-aryenne', 'ine' => 'langue indo-européenne', 'inh' => 'ingouche', 'io' => 'ido', 'ira' => 'langue iranienne', 'iro' => 'langue iroquoienne', 'is' => 'islandais', 'it' => 'italien', 'iu' => 'inuktitut', 'ja' => 'japonais', 'jbo' => 'lojban', 'jpr' => 'judéo-persan', 'jrb' => 'judéo-arabe', 'jv' => 'javanais', 'ka' => 'géorgien', 'kaa' => 'karakalpak', 'kab' => 'kabyle', 'kac' => 'kachin', 'kaj' => 'jju', 'kam' => 'kamba', 'kar' => 'karen', 'kaw' => 'kawi', 'kbd' => 'kabardin', 'kcg' => 'tyap', 'kea' => 'capverdien', 'kfo' => 'koro', 'kg' => 'kongo', 'kha' => 'khasi', 'khi' => 'langue khoïsan', 'kho' => 'khotanais', 'ki' => 'kikuyu', 'kj' => 'kuanyama', 'kk' => 'kazakh', 'kl' => 'groenlandais', 'km' => 'khmer', 'kmb' => 'kiMboundou', 'kn' => 'kannada', 'ko' => 'coréen', 'kok' => 'konkani', 'kos' => 'kusaien', 'kpe' => 'kpellé', 'kr' => 'kanouri', 'krc' => 'karatchaï balkar', 'krl' => 'carélien', 'kro' => 'krou', 'kru' => 'kurukh', 'ks' => 'kâshmîrî', 'ksf' => 'bafia', 'ku' => 'kurde', 'kum' => 'koumyk', 'kut' => 'kutenai', 'kv' => 'komi', 'kw' => 'cornique', 'ky' => 'kirghize', 'la' => 'latin', 'lad' => 'ladino', 'lah' => 'lahnda', 'lam' => 'lamba', 'lb' => 'luxembourgeois', 'lez' => 'lezghien', 'lg' => 'ganda', 'li' => 'limbourgeois', 'ln' => 'lingala', 'lo' => 'lao', 'lol' => 'mongo', 'loz' => 'lozi', 'lt' => 'lituanien', 'lu' => 'luba-katanga', 'lua' => 'luba-lulua', 'lui' => 'luiseno', 'lun' => 'lunda', 'luo' => 'luo', 'lus' => 'lushai', 'luy' => 'oloulouyia', 'lv' => 'letton', 'mad' => 'madurais', 'mag' => 'magahi', 'mai' => 'maithili', 'mak' => 'makassar', 'man' => 'mandingue', 'map' => 'malayo-polynésien', 'mas' => 'masai', 'mdf' => 'moksa', 'mdr' => 'mandar', 'men' => 'mendé', 'mg' => 'malgache', 'mga' => 'moyen irlandais', 'mgh' => 'makhuwa-meetto', 'mh' => 'marshall', 'mi' => 'maori', 'mic' => 'micmac', 'min' => 'minangkabau', 'mis' => 'langue diverse', 'mk' => 'macédonien', 'mkh' => 'langue mon-khmère', 'ml' => 'malayalam', 'mn' => 'mongol', 'mnc' => 'mandchou', 'mni' => 'manipuri', 'mno' => 'langue manobo', 'mo' => 'moldave', 'moh' => 'mohawk', 'mos' => 'moré', 'mr' => 'marathe', 'ms' => 'malais', 'mt' => 'maltais', 'mua' => 'mundang', 'mul' => 'multilingue', 'mun' => 'langue mounda', 'mus' => 'creek', 'mwl' => 'mirandais', 'mwr' => 'marwarî', 'my' => 'birman', 'myn' => 'langue maya', 'myv' => 'erzya', 'na' => 'nauruan', 'nah' => 'nahuatl', 'nai' => 'langue amérindienne du Nord', 'nap' => 'napolitain', 'nb' => 'norvégien bokmål', 'nd' => 'ndébélé du Nord', 'nds' => 'bas-allemand', 'ne' => 'népalais', 'new' => 'newari', 'ng' => 'ndonga', 'nia' => 'nias', 'nic' => 'langue nigéro-congolaise', 'niu' => 'niué', 'nl' => 'néerlandais', 'nl_be' => 'néerlandais belge', 'nmg' => 'kwasio', 'nn' => 'norvégien nynorsk', 'no' => 'norvégien', 'nog' => 'nogaï', 'non' => 'vieux norrois', 'nqo' => 'n’ko', 'nr' => 'ndébélé du Sud', 'nso' => 'sotho du Nord', 'nub' => 'langue nubienne', 'nus' => 'nuer', 'nv' => 'navaho', 'nwc' => 'newarî classique', 'ny' => 'nyanja', 'nym' => 'nyamwezi', 'nyn' => 'nyankolé', 'nyo' => 'nyoro', 'nzi' => 'nzema', 'oc' => 'occitan', 'oj' => 'ojibwa', 'om' => 'oromo', 'or' => 'oriya', 'os' => 'ossète', 'osa' => 'osage', 'ota' => 'turc ottoman', 'oto' => 'langue otomangue', 'pa' => 'pendjabi', 'paa' => 'langue papoue', 'pag' => 'pangasinan', 'pal' => 'pahlavi', 'pam' => 'pampangan', 'pap' => 'papiamento', 'pau' => 'palau', 'peo' => 'persan ancien', 'phi' => 'langue philippine', 'phn' => 'phénicien', 'pi' => 'pali', 'pl' => 'polonais', 'pon' => 'pohnpei', 'pra' => 'langues prâkrit', 'pro' => 'provençal ancien', 'ps' => 'pashto', 'pt' => 'portugais', 'pt_br' => 'portugais brésilien', 'pt_pt' => 'portugais ibérique', 'qu' => 'langue quechua', 'raj' => 'rajasthani', 'rap' => 'rapanui', 'rar' => 'rarotongien', 'rm' => 'rhéto-roman', 'rn' => 'roundi', 'ro' => 'roumain', 'roa' => 'langue romane', 'rof' => 'rombo', 'rom' => 'tzigane', 'root' => 'racine', 'ru' => 'russe', 'rup' => 'valaque', 'rw' => 'rwanda', 'rwk' => 'rwa', 'sa' => 'sanskrit', 'sad' => 'sandawe', 'sah' => 'iakoute', 'sai' => 'langue amérindienne du Sud', 'sal' => 'langue salishenne', 'sam' => 'araméen samaritain', 'sas' => 'sasak', 'sat' => 'santal', 'sbp' => 'sangu', 'sc' => 'sarde', 'scn' => 'sicilien', 'sco' => 'écossais', 'sd' => 'sindhî', 'se' => 'sami du Nord', 'sel' => 'selkoupe', 'sem' => 'langue sémitique', 'sg' => 'sangho', 'sga' => 'ancien irlandais', 'sgn' => 'langue des signes', 'sh' => 'serbo-croate', 'shn' => 'shan', 'si' => 'singhalais', 'sid' => 'sidamo', 'sio' => 'langue sioux', 'sit' => 'langue sino-tibétaine', 'sk' => 'slovaque', 'sl' => 'slovène', 'sla' => 'langue slave', 'sm' => 'samoan', 'sma' => 'sami du Sud', 'smi' => 'langue samie', 'smj' => 'sami de Lule', 'smn' => 'sami d’Inari', 'sms' => 'sami skolt', 'sn' => 'shona', 'snk' => 'soninké', 'so' => 'somali', 'sog' => 'sogdien', 'son' => 'songhai', 'sq' => 'albanais', 'sr' => 'serbe', 'srn' => 'sranan tongo', 'srr' => 'sérère', 'ss' => 'swati', 'ssa' => 'langue nilo-saharienne', 'st' => 'sesotho', 'su' => 'soundanais', 'suk' => 'sukuma', 'sus' => 'soussou', 'sux' => 'sumérien', 'sv' => 'suédois', 'sw' => 'swahili', 'swb' => 'comorien', 'syc' => 'syriaque classique', 'syr' => 'syriaque', 'ta' => 'tamoul', 'tai' => 'langue taï', 'te' => 'télougou', 'tem' => 'temne', 'ter' => 'tereno', 'tet' => 'tetum', 'tg' => 'tadjik', 'th' => 'thaï', 'ti' => 'tigrigna', 'tig' => 'tigré', 'tiv' => 'tiv', 'tk' => 'turkmène', 'tkl' => 'tokelau', 'tl' => 'tagalog', 'tlh' => 'klingon', 'tli' => 'tlingit', 'tmh' => 'tamacheq', 'tn' => 'tswana', 'to' => 'tongan', 'tog' => 'tonga nyasa', 'tpi' => 'tok pisin', 'tr' => 'turc', 'ts' => 'tsonga', 'tsi' => 'tsimshian', 'tt' => 'tatar', 'tum' => 'tumbuka', 'tup' => 'langue tupi', 'tut' => 'langue altaïque', 'tvl' => 'tuvalu', 'tw' => 'twi', 'twq' => 'tasawaq', 'ty' => 'tahitien', 'tyv' => 'touva', 'udm' => 'oudmourte', 'ug' => 'ouïghour', 'uga' => 'ougaritique', 'uk' => 'ukrainien', 'umb' => 'umbundu', 'und' => 'indéterminé', 'ur' => 'ourdou', 'uz' => 'ouzbek', 'vai' => 'vaï', 've' => 'venda', 'vi' => 'vietnamien', 'vo' => 'volapuk', 'vot' => 'vote', 'wa' => 'wallon', 'wak' => 'langues wakashennes', 'wal' => 'walamo', 'war' => 'waray', 'was' => 'washo', 'wen' => 'langue sorabe', 'wo' => 'wolof', 'xal' => 'kalmouk', 'xh' => 'xhosa', 'yao' => 'yao', 'yap' => 'yapois', 'yav' => 'yangben', 'yi' => 'yiddish', 'yo' => 'yoruba', 'ypk' => 'langues yupik', 'yue' => 'cantonais', 'za' => 'zhuang', 'zap' => 'zapotèque', 'zbl' => 'symboles Bliss', 'zen' => 'zenaga', 'zh' => 'chinois', 'zh_hans' => 'chinois simplifié', 'zh_hant' => 'chinois traditionnel', 'znd' => 'zandé', 'zu' => 'zoulou', 'zun' => 'zuni', 'zxx' => 'sans contenu linguistique', 'zza' => 'zazaki', ), 'scripts' => array ( 'arab' => 'arabo-persan', 'armi' => 'araméen impérial', 'armn' => 'arménien', 'avst' => 'avestique', 'bali' => 'balinais', 'batk' => 'batak', 'beng' => 'bengâglî', 'blis' => 'symboles Bliss', 'bopo' => 'bopomofo', 'brah' => 'brâhmî', 'brai' => 'braille', 'bugi' => 'bouguis', 'buhd' => 'bouhide', 'cakm' => 'chakma', 'cans' => 'syllabaire autochtone canadien unifié', 'cari' => 'carien', 'cham' => 'cham', 'cher' => 'tchérokî', 'cirt' => 'cirth', 'copt' => 'copte', 'cprt' => 'syllabaire chypriote', 'cyrl' => 'cyrillique', 'cyrs' => 'cyrillique (variante slavonne)', 'deva' => 'dévanâgarî', 'dsrt' => 'déséret', 'egyd' => 'démotique égyptien', 'egyh' => 'hiératique égyptien', 'egyp' => 'hiéroglyphes égyptiens', 'ethi' => 'éthiopique', 'geok' => 'géorgien khoutsouri', 'geor' => 'géorgien', 'glag' => 'glagolitique', 'goth' => 'gotique', 'grek' => 'grec', 'gujr' => 'goudjarâtî', 'guru' => 'gourmoukhî', 'hang' => 'hangûl', 'hani' => 'idéogrammes han', 'hano' => 'hanounóo', 'hans' => 'chinois simplifié', 'hant' => 'chinois traditionnel', 'hebr' => 'hébreu', 'hira' => 'hiragana', 'hmng' => 'pahawh hmong', 'hrkt' => 'katakana ou hiragana', 'hung' => 'ancien hongrois', 'inds' => 'indus', 'ital' => 'ancien italique', 'java' => 'javanais', 'jpan' => 'japonais', 'kali' => 'kayah li', 'kana' => 'katakana', 'khar' => 'kharochthî', 'khmr' => 'khmer', 'knda' => 'kannara', 'kore' => 'coréen', 'kthi' => 'kaithî', 'lana' => 'lanna', 'laoo' => 'lao', 'latf' => 'latin (variante brisée)', 'latg' => 'latin (variante gaélique)', 'latn' => 'latin', 'lepc' => 'lepcha', 'limb' => 'limbou', 'lina' => 'linéaire A', 'linb' => 'linéaire B', 'lyci' => 'lycien', 'lydi' => 'lydien', 'mand' => 'mandéen', 'mani' => 'manichéen', 'maya' => 'hiéroglyphes mayas', 'mero' => 'méroïtique', 'mlym' => 'malayâlam', 'mong' => 'mongol', 'moon' => 'moon', 'mtei' => 'meitei mayek', 'mymr' => 'birman', 'nkoo' => 'n’ko', 'ogam' => 'ogam', 'olck' => 'ol tchiki', 'orkh' => 'orkhon', 'orya' => 'oriyâ', 'osma' => 'osmanais', 'perm' => 'ancien permien', 'phag' => 'phags pa', 'phli' => 'pehlevi des inscriptions', 'phlp' => 'pehlevi des psautiers', 'phlv' => 'pehlevi des livres', 'phnx' => 'phénicien', 'plrd' => 'phonétique de Pollard', 'prti' => 'parthe des inscriptions', 'rjng' => 'rejang', 'roro' => 'rongorongo', 'runr' => 'runique', 'samr' => 'samaritain', 'sara' => 'sarati', 'saur' => 'saurashtra', 'sgnw' => 'écriture des signes', 'shaw' => 'shavien', 'sinh' => 'singhalais', 'sund' => 'sundanais', 'sylo' => 'sylotî nâgrî', 'syrc' => 'syriaque', 'syre' => 'syriaque estranghélo', 'syrj' => 'syriaque occidental', 'syrn' => 'syriaque oriental', 'tagb' => 'tagbanoua', 'tale' => 'taï-le', 'talu' => 'nouveau taï-lue', 'taml' => 'tamoul', 'tavt' => 'taï viêt', 'telu' => 'télougou', 'teng' => 'tengwar', 'tfng' => 'tifinagh', 'tglg' => 'tagal', 'thaa' => 'thâna', 'thai' => 'thaï', 'tibt' => 'tibétain', 'ugar' => 'ougaritique', 'vaii' => 'vaï', 'visp' => 'parole visible', 'xpeo' => 'cunéiforme persépolitain', 'xsux' => 'cunéiforme suméro-akkadien', 'yiii' => 'yi', 'zinh' => 'hérité', 'zmth' => 'notation mathématique', 'zsym' => 'symboles', 'zxxx' => 'non écrit', 'zyyy' => 'commun', 'zzzz' => 'écriture inconnue ou non valide', ), 'territories' => array ( '001' => 'Monde', '002' => 'Afrique', '003' => 'Amérique du Nord', '005' => 'Amérique du Sud', '009' => 'Océanie', '011' => 'Afrique occidentale', '013' => 'Amérique centrale', '014' => 'Afrique orientale', '015' => 'Afrique septentrionale', '017' => 'Afrique centrale', '018' => 'Afrique australe', '019' => 'Amériques', '021' => 'Amérique septentrionale', '029' => 'Caraïbes', '030' => 'Asie orientale', '034' => 'Asie du Sud', '035' => 'Asie du Sud-Est', '039' => 'Europe méridionale', '053' => 'Australie et Nouvelle-Zélande', '054' => 'Mélanésie', '057' => 'région micronésienne', '061' => 'Polynésie', 142 => 'Asie', 143 => 'Asie centrale', 145 => 'Asie occidentale', 150 => 'Europe', 151 => 'Europe orientale', 154 => 'Europe septentrionale', 155 => 'Europe occidentale', 419 => 'Amérique latine', 'ac' => 'Île de l\'Ascension', 'ad' => 'Andorre', 'ae' => 'Émirats arabes unis', 'af' => 'Afghanistan', 'ag' => 'Antigua-et-Barbuda', 'ai' => 'Anguilla', 'al' => 'Albanie', 'am' => 'Arménie', 'an' => 'Antilles néerlandaises', 'ao' => 'Angola', 'aq' => 'Antarctique', 'ar' => 'Argentine', 'as' => 'Samoa américaines', 'at' => 'Autriche', 'au' => 'Australie', 'aw' => 'Aruba', 'ax' => 'Îles Åland', 'az' => 'Azerbaïdjan', 'ba' => 'Bosnie-Herzégovine', 'bb' => 'Barbade', 'bd' => 'Bangladesh', 'be' => 'Belgique', 'bf' => 'Burkina Faso', 'bg' => 'Bulgarie', 'bh' => 'Bahreïn', 'bi' => 'Burundi', 'bj' => 'Bénin', 'bl' => 'Saint-Barthélémy', 'bm' => 'Bermudes', 'bn' => 'Brunéi Darussalam', 'bo' => 'Bolivie', 'br' => 'Brésil', 'bs' => 'Bahamas', 'bt' => 'Bhoutan', 'bv' => 'Île Bouvet', 'bw' => 'Botswana', 'by' => 'Bélarus', 'bz' => 'Belize', 'ca' => 'Canada', 'cc' => 'Îles Cocos - Keeling', 'cd' => 'Congo-Kinshasa', 'cf' => 'République centrafricaine', 'cg' => 'République du Congo', 'ch' => 'Suisse', 'ci' => 'Côte d’Ivoire', 'ck' => 'Îles Cook', 'cl' => 'Chili', 'cm' => 'Cameroun', 'cn' => 'Chine', 'co' => 'Colombie', 'cp' => 'Île Clipperton', 'cr' => 'Costa Rica', 'cs' => 'Serbie-et-Monténégro', 'cu' => 'Cuba', 'cv' => 'Cap-Vert', 'cx' => 'Île Christmas', 'cy' => 'Chypre', 'cz' => 'République tchèque', 'de' => 'Allemagne', 'dg' => 'Diego Garcia', 'dj' => 'Djibouti', 'dk' => 'Danemark', 'dm' => 'Dominique', 'do' => 'République dominicaine', 'dz' => 'Algérie', 'ea' => 'Ceuta et Melilla', 'ec' => 'Équateur', 'ee' => 'Estonie', 'eg' => 'Égypte', 'eh' => 'Sahara occidental', 'er' => 'Érythrée', 'es' => 'Espagne', 'et' => 'Éthiopie', 'eu' => 'Union européenne', 'fi' => 'Finlande', 'fj' => 'Fidji', 'fk' => 'Îles Malouines', 'fm' => 'États fédérés de Micronésie', 'fo' => 'Îles Féroé', 'fr' => 'France', 'fx' => 'France métropolitaine', 'ga' => 'Gabon', 'gb' => 'Royaume-Uni', 'gd' => 'Grenade', 'ge' => 'Géorgie', 'gf' => 'Guyane française', 'gg' => 'Guernesey', 'gh' => 'Ghana', 'gi' => 'Gibraltar', 'gl' => 'Groenland', 'gm' => 'Gambie', 'gn' => 'Guinée', 'gp' => 'Guadeloupe', 'gq' => 'Guinée équatoriale', 'gr' => 'Grèce', 'gs' => 'Géorgie du Sud et les îles Sandwich du Sud', 'gt' => 'Guatemala', 'gu' => 'Guam', 'gw' => 'Guinée-Bissau', 'gy' => 'Guyana', 'hk' => 'Hong Kong', 'hm' => 'Îles Heard et MacDonald', 'hn' => 'Honduras', 'hr' => 'Croatie', 'ht' => 'Haïti', 'hu' => 'Hongrie', 'ic' => 'Îles Canaries', 'id' => 'Indonésie', 'ie' => 'Irlande', 'il' => 'Israël', 'im' => 'Île de Man', 'in' => 'Inde', 'io' => 'Territoire britannique de l\'océan Indien', 'iq' => 'Irak', 'ir' => 'Iran', 'is' => 'Islande', 'it' => 'Italie', 'je' => 'Jersey', 'jm' => 'Jamaïque', 'jo' => 'Jordanie', 'jp' => 'Japon', 'ke' => 'Kenya', 'kg' => 'Kirghizistan', 'kh' => 'Cambodge', 'ki' => 'Kiribati', 'km' => 'Comores', 'kn' => 'Saint-Kitts-et-Nevis', 'kp' => 'Corée du Nord', 'kr' => 'Corée du Sud', 'kw' => 'Koweït', 'ky' => 'Îles Caïmans', 'kz' => 'Kazakhstan', 'la' => 'Laos', 'lb' => 'Liban', 'lc' => 'Sainte-Lucie', 'li' => 'Liechtenstein', 'lk' => 'Sri Lanka', 'lr' => 'Libéria', 'ls' => 'Lesotho', 'lt' => 'Lituanie', 'lu' => 'Luxembourg', 'lv' => 'Lettonie', 'ly' => 'Libye', 'ma' => 'Maroc', 'mc' => 'Monaco', 'md' => 'Moldavie', 'me' => 'Monténégro', 'mf' => 'Saint-Martin', 'mg' => 'Madagascar', 'mh' => 'Îles Marshall', 'mk' => 'Macédoine', 'ml' => 'Mali', 'mm' => 'Myanmar', 'mn' => 'Mongolie', 'mo' => 'Macao', 'mp' => 'Îles Mariannes du Nord', 'mq' => 'Martinique', 'mr' => 'Mauritanie', 'ms' => 'Montserrat', 'mt' => 'Malte', 'mu' => 'Maurice', 'mv' => 'Maldives', 'mw' => 'Malawi', 'mx' => 'Mexique', 'my' => 'Malaisie', 'mz' => 'Mozambique', 'na' => 'Namibie', 'nc' => 'Nouvelle-Calédonie', 'ne' => 'Niger', 'nf' => 'Île Norfolk', 'ng' => 'Nigéria', 'ni' => 'Nicaragua', 'nl' => 'Pays-Bas', 'no' => 'Norvège', 'np' => 'Népal', 'nr' => 'Nauru', 'nu' => 'Niue', 'nz' => 'Nouvelle-Zélande', 'om' => 'Oman', 'pa' => 'Panama', 'pe' => 'Pérou', 'pf' => 'Polynésie française', 'pg' => 'Papouasie-Nouvelle-Guinée', 'ph' => 'Philippines', 'pk' => 'Pakistan', 'pl' => 'Pologne', 'pm' => 'Saint-Pierre-et-Miquelon', 'pn' => 'Pitcairn', 'pr' => 'Porto Rico', 'ps' => 'Territoire palestinien', 'pt' => 'Portugal', 'pw' => 'Palaos', 'py' => 'Paraguay', 'qa' => 'Qatar', 'qo' => 'régions éloignées de l’Océanie', 're' => 'Réunion', 'ro' => 'Roumanie', 'rs' => 'Serbie', 'ru' => 'Russie', 'rw' => 'Rwanda', 'sa' => 'Arabie saoudite', 'sb' => 'Îles Salomon', 'sc' => 'Seychelles', 'sd' => 'Soudan', 'se' => 'Suède', 'sg' => 'Singapour', 'sh' => 'Sainte-Hélène', 'si' => 'Slovénie', 'sj' => 'Svalbard et Île Jan Mayen', 'sk' => 'Slovaquie', 'sl' => 'Sierra Leone', 'sm' => 'Saint-Marin', 'sn' => 'Sénégal', 'so' => 'Somalie', 'sr' => 'Suriname', 'st' => 'Sao Tomé-et-Principe', 'sv' => 'El Salvador', 'sy' => 'Syrie', 'sz' => 'Swaziland', 'ta' => 'Tristan da Cunha', 'tc' => 'Îles Turks et Caïques', 'td' => 'Tchad', 'tf' => 'Terres australes françaises', 'tg' => 'Togo', 'th' => 'Thaïlande', 'tj' => 'Tadjikistan', 'tk' => 'Tokelau', 'tl' => 'Timor oriental', 'tm' => 'Turkménistan', 'tn' => 'Tunisie', 'to' => 'Tonga', 'tr' => 'Turquie', 'tt' => 'Trinité-et-Tobago', 'tv' => 'Tuvalu', 'tw' => 'Taïwan', 'tz' => 'Tanzanie', 'ua' => 'Ukraine', 'ug' => 'Ouganda', 'um' => 'Îles Mineures Éloignées des États-Unis', 'us' => 'États-Unis', 'uy' => 'Uruguay', 'uz' => 'Ouzbékistan', 'va' => 'État de la Cité du Vatican', 'vc' => 'Saint-Vincent-et-les Grenadines', 've' => 'Venezuela', 'vg' => 'Îles Vierges britanniques', 'vi' => 'Îles Vierges des États-Unis', 'vn' => 'Viêt Nam', 'vu' => 'Vanuatu', 'wf' => 'Wallis-et-Futuna', 'ws' => 'Samoa', 'ye' => 'Yémen', 'yt' => 'Mayotte', 'za' => 'Afrique du Sud', 'zm' => 'Zambie', 'zw' => 'Zimbabwe', 'zz' => 'région indéterminée', ), 'pluralRules' => array ( 0 => '(n>=0&&n<=2)&&n!=2', 1 => 'true', ), );
Seafnox/CMS6
framework/i18n/data/fr_yt.php
PHP
bsd-3-clause
30,359
<?php /** * Locale data for 'fr_CD'. * * This file is automatically generated by yiic cldr command. * * Copyright © 1991-2007 Unicode, Inc. All rights reserved. * Distributed under the Terms of Use in http://www.unicode.org/copyright.html. * * @copyright 2008-2013 Yii Software LLC (http://www.yiiframework.com/license/) */ return array ( 'version' => '5798', 'numberSymbols' => array ( 'alias' => '', 'decimal' => ',', 'group' => ' ', 'list' => ';', 'percentSign' => '%', 'plusSign' => '+', 'minusSign' => '-', 'exponential' => 'E', 'perMille' => '‰', 'infinity' => '∞', 'nan' => 'NaN', ), 'decimalFormat' => '#,##0.###', 'scientificFormat' => '#E0', 'percentFormat' => '#,##0 %', 'currencyFormat' => '#,##0.00 ¤', 'currencySymbols' => array ( 'AUD' => '$AU', 'BRL' => 'R$', 'CAD' => '$CA', 'CNY' => 'Ұ', 'EUR' => '€', 'GBP' => '£UK', 'HKD' => '$HK', 'ILS' => '₪', 'INR' => '₹', 'JPY' => '¥JP', 'KRW' => '₩', 'MXN' => 'MX$', 'NZD' => '$NZ', 'THB' => '฿', 'TWD' => 'NT$', 'USD' => '$US', 'VND' => '₫', 'XAF' => 'FCFA', 'XCD' => 'EC$', 'XOF' => 'CFA', 'XPF' => 'FCFP', 'ADP' => '₧A', 'ANG' => 'f.NA', 'ARS' => '$AR', 'BEF' => 'FB', 'BMD' => '$BM', 'BND' => '$BN', 'BSD' => '$BS', 'BZD' => '$BZ', 'CDF' => 'FrCD', 'CLP' => '$CL', 'COP' => '$CO', 'CUP' => '$CU', 'CVE' => '$CV', 'CYP' => '£CY', 'DKK' => 'krD', 'EEK' => 'krE', 'EGP' => '£EG', 'ESP' => '₧', 'FJD' => '$FJ', 'FKP' => '£FK', 'FRF' => 'F', 'GIP' => '£GI', 'GYD' => '$GY', 'IEP' => '£IE', 'ILP' => '£IL', 'ISK' => 'krI', 'ITL' => '₤IT', 'JMD' => '$JM', 'JOD' => 'DJ', 'KMF' => 'FC', 'KPW' => '₩KP', 'KWD' => 'DK', 'KYD' => '$KY', 'LBP' => '£LB', 'LKR' => 'RsSL', 'LRD' => '$LR', 'LYD' => 'DL', 'MTP' => '£MT', 'MUR' => 'RsMU', 'NAD' => '$NA', 'NOK' => 'krN', 'NPR' => 'RsNP', 'PKR' => 'RsPK', 'QAR' => 'RQ', 'RHD' => '$RH', 'RWF' => 'FR', 'SBD' => '$SB', 'SEK' => 'krS', 'SGD' => '$SG', 'SHP' => '£SH', 'SRD' => '$SR', 'SVC' => '₡SV', 'SYP' => '£SY', 'TTD' => '$TT', 'UYU' => '$UY', 'YER' => 'RY', 'ZWD' => '$Z', ), 'monthNames' => array ( 'wide' => array ( 1 => 'janvier', 2 => 'février', 3 => 'mars', 4 => 'avril', 5 => 'mai', 6 => 'juin', 7 => 'juillet', 8 => 'août', 9 => 'septembre', 10 => 'octobre', 11 => 'novembre', 12 => 'décembre', ), 'abbreviated' => array ( 1 => 'janv.', 2 => 'févr.', 3 => 'mars', 4 => 'avr.', 5 => 'mai', 6 => 'juin', 7 => 'juil.', 8 => 'août', 9 => 'sept.', 10 => 'oct.', 11 => 'nov.', 12 => 'déc.', ), ), 'monthNamesSA' => array ( 'narrow' => array ( 1 => 'J', 2 => 'F', 3 => 'M', 4 => 'A', 5 => 'M', 6 => 'J', 7 => 'J', 8 => 'A', 9 => 'S', 10 => 'O', 11 => 'N', 12 => 'D', ), 'abbreviated' => array ( 1 => 'janv.', 2 => 'févr.', 3 => 'mars', 4 => 'avr.', 7 => 'juil.', 9 => 'sept.', 10 => 'oct.', 11 => 'nov.', 12 => 'déc.', ), ), 'weekDayNames' => array ( 'wide' => array ( 0 => 'dimanche', 1 => 'lundi', 2 => 'mardi', 3 => 'mercredi', 4 => 'jeudi', 5 => 'vendredi', 6 => 'samedi', ), 'abbreviated' => array ( 0 => 'dim.', 1 => 'lun.', 2 => 'mar.', 3 => 'mer.', 4 => 'jeu.', 5 => 'ven.', 6 => 'sam.', ), ), 'weekDayNamesSA' => array ( 'narrow' => array ( 0 => 'D', 1 => 'L', 2 => 'M', 3 => 'M', 4 => 'J', 5 => 'V', 6 => 'S', ), 'abbreviated' => array ( 0 => 'dim.', 1 => 'lun.', 2 => 'mar.', 3 => 'mer.', 4 => 'jeu.', 5 => 'ven.', 6 => 'sam.', ), ), 'eraNames' => array ( 'abbreviated' => array ( 0 => 'av. J.-C.', 1 => 'ap. J.-C.', ), 'wide' => array ( 0 => 'avant Jésus-Christ', 1 => 'après Jésus-Christ', ), 'narrow' => array ( 0 => 'av. J.-C.', 1 => 'ap. J.-C.', ), ), 'dateFormats' => array ( 'full' => 'EEEE d MMMM y', 'long' => 'd MMMM y', 'medium' => 'd MMM y', 'short' => 'dd/MM/yy', ), 'timeFormats' => array ( 'full' => 'HH:mm:ss zzzz', 'long' => 'HH:mm:ss z', 'medium' => 'HH:mm:ss', 'short' => 'HH:mm', ), 'dateTimeFormat' => '{1} {0}', 'amName' => 'AM', 'pmName' => 'PM', 'orientation' => 'ltr', 'languages' => array ( 'aa' => 'afar', 'ab' => 'abkhaze', 'ace' => 'aceh', 'ach' => 'acoli', 'ada' => 'adangme', 'ady' => 'adyghéen', 'ae' => 'avestique', 'af' => 'afrikaans', 'afa' => 'langue afro-asiatique', 'afh' => 'afrihili', 'agq' => 'aghem', 'ain' => 'aïnou', 'ak' => 'akan', 'akk' => 'akkadien', 'ale' => 'aléoute', 'alg' => 'langue algonquienne', 'alt' => 'altaï du Sud', 'am' => 'amharique', 'an' => 'aragonais', 'ang' => 'ancien anglais', 'anp' => 'angika', 'apa' => 'langue apache', 'ar' => 'arabe', 'arc' => 'araméen', 'arn' => 'araukan', 'arp' => 'arapaho', 'art' => 'langue artificielle', 'arw' => 'arawak', 'as' => 'assamais', 'asa' => 'asou (Tanzania)', 'ast' => 'asturien', 'ath' => 'langue athapascane', 'aus' => 'langue australienne', 'av' => 'avar', 'awa' => 'awadhi', 'ay' => 'aymara', 'az' => 'azéri', 'ba' => 'bachkir', 'bad' => 'banda', 'bai' => 'langue bamilékée', 'bal' => 'baloutchi', 'ban' => 'balinais', 'bas' => 'bassa', 'bat' => 'langue balte', 'be' => 'biélorusse', 'bej' => 'bedja', 'bem' => 'bemba', 'ber' => 'berbère', 'bez' => 'bena (Tanzania)', 'bg' => 'bulgare', 'bh' => 'bihari', 'bho' => 'bhojpuri', 'bi' => 'bichelamar', 'bik' => 'bikol', 'bin' => 'bini', 'bla' => 'siksika', 'bm' => 'bambara', 'bn' => 'bengali', 'bnt' => 'bantou', 'bo' => 'tibétain', 'br' => 'breton', 'bra' => 'braj', 'brx' => 'bodo', 'bs' => 'bosniaque', 'btk' => 'batak', 'bua' => 'bouriate', 'bug' => 'bugi', 'byn' => 'blin', 'ca' => 'catalan', 'cad' => 'caddo', 'cai' => 'langue amérindienne centrale', 'car' => 'caribe', 'cau' => 'langue caucasienne', 'cch' => 'atsam', 'ce' => 'tchétchène', 'ceb' => 'cebuano', 'cel' => 'langue celtique', 'ch' => 'chamorro', 'chb' => 'chibcha', 'chg' => 'tchaghataï', 'chk' => 'chuuk', 'chm' => 'mari', 'chn' => 'jargon chinook', 'cho' => 'choctaw', 'chp' => 'chipewyan', 'chr' => 'cherokee', 'chy' => 'cheyenne', 'cmc' => 'langue chame', 'co' => 'corse', 'cop' => 'copte', 'cpe' => 'créole ou pidgin anglais', 'cpf' => 'créole ou pidgin français', 'cpp' => 'créole ou pidgin portugais', 'cr' => 'cree', 'crh' => 'turc de Crimée', 'crp' => 'créole ou pidgin', 'cs' => 'tchèque', 'csb' => 'kachoube', 'cu' => 'slavon d’église', 'cus' => 'langue couchitique', 'cv' => 'tchouvache', 'cy' => 'gallois', 'da' => 'danois', 'dak' => 'dakota', 'dar' => 'dargwa', 'day' => 'dayak', 'de' => 'allemand', 'de_at' => 'allemand autrichien', 'de_ch' => 'allemand suisse', 'del' => 'delaware', 'den' => 'slavey', 'dgr' => 'dogrib', 'din' => 'dinka', 'doi' => 'dogri', 'dra' => 'langue dravidienne', 'dsb' => 'bas-sorabe', 'dua' => 'douala', 'dum' => 'moyen néerlandais', 'dv' => 'maldivien', 'dyo' => 'jola-foyi', 'dyu' => 'dioula', 'dz' => 'dzongkha', 'ebu' => 'embu', 'ee' => 'éwé', 'efi' => 'efik', 'egy' => 'égyptien ancien', 'eka' => 'ekajuk', 'el' => 'grec', 'elx' => 'élamite', 'en' => 'anglais', 'en_au' => 'anglais australien', 'en_ca' => 'anglais canadien', 'en_gb' => 'anglais britannique', 'en_us' => 'anglais américain', 'enm' => 'moyen anglais', 'eo' => 'espéranto', 'es' => 'espagnol', 'es_419' => 'espagnol latino-américain', 'es_es' => 'espagnol ibérique', 'et' => 'estonien', 'eu' => 'basque', 'ewo' => 'éwondo', 'fa' => 'persan', 'fan' => 'fang', 'fat' => 'fanti', 'ff' => 'peul', 'fi' => 'finnois', 'fil' => 'filipino', 'fiu' => 'langue finno-ougrienne', 'fj' => 'fidjien', 'fo' => 'féroïen', 'fon' => 'fon', 'fr' => 'français', 'fr_ca' => 'français canadien', 'fr_ch' => 'français suisse', 'frm' => 'moyen français', 'fro' => 'ancien français', 'frr' => 'frison du Nord', 'frs' => 'frison oriental', 'fur' => 'frioulan', 'fy' => 'frison', 'ga' => 'irlandais', 'gaa' => 'ga', 'gay' => 'gayo', 'gba' => 'gbaya', 'gd' => 'gaélique écossais', 'gem' => 'langue germanique', 'gez' => 'guèze', 'gil' => 'gilbertais', 'gl' => 'galicien', 'gmh' => 'moyen haut-allemand', 'gn' => 'guarani', 'goh' => 'ancien haut allemand', 'gon' => 'gondi', 'gor' => 'gorontalo', 'got' => 'gotique', 'grb' => 'grebo', 'grc' => 'grec ancien', 'gsw' => 'alémanique', 'gu' => 'goudjarâtî', 'gv' => 'manx', 'gwi' => 'gwichʼin', 'ha' => 'haoussa', 'hai' => 'haida', 'haw' => 'hawaïen', 'he' => 'hébreu', 'hi' => 'hindi', 'hil' => 'hiligaynon', 'him' => 'himachali', 'hit' => 'hittite', 'hmn' => 'hmong', 'ho' => 'hiri motu', 'hr' => 'croate', 'hsb' => 'haut-sorabe', 'ht' => 'haïtien', 'hu' => 'hongrois', 'hup' => 'hupa', 'hy' => 'arménien', 'hz' => 'héréro', 'ia' => 'interlingua', 'iba' => 'iban', 'id' => 'indonésien', 'ie' => 'interlingue', 'ig' => 'igbo', 'ii' => 'yi de Sichuan', 'ijo' => 'ijo', 'ik' => 'inupiaq', 'ilo' => 'ilokano', 'inc' => 'langue indo-aryenne', 'ine' => 'langue indo-européenne', 'inh' => 'ingouche', 'io' => 'ido', 'ira' => 'langue iranienne', 'iro' => 'langue iroquoienne', 'is' => 'islandais', 'it' => 'italien', 'iu' => 'inuktitut', 'ja' => 'japonais', 'jbo' => 'lojban', 'jpr' => 'judéo-persan', 'jrb' => 'judéo-arabe', 'jv' => 'javanais', 'ka' => 'géorgien', 'kaa' => 'karakalpak', 'kab' => 'kabyle', 'kac' => 'kachin', 'kaj' => 'jju', 'kam' => 'kamba', 'kar' => 'karen', 'kaw' => 'kawi', 'kbd' => 'kabardin', 'kcg' => 'tyap', 'kea' => 'capverdien', 'kfo' => 'koro', 'kg' => 'kongo', 'kha' => 'khasi', 'khi' => 'langue khoïsan', 'kho' => 'khotanais', 'ki' => 'kikuyu', 'kj' => 'kuanyama', 'kk' => 'kazakh', 'kl' => 'groenlandais', 'km' => 'khmer', 'kmb' => 'kiMboundou', 'kn' => 'kannada', 'ko' => 'coréen', 'kok' => 'konkani', 'kos' => 'kusaien', 'kpe' => 'kpellé', 'kr' => 'kanouri', 'krc' => 'karatchaï balkar', 'krl' => 'carélien', 'kro' => 'krou', 'kru' => 'kurukh', 'ks' => 'kâshmîrî', 'ksf' => 'bafia', 'ku' => 'kurde', 'kum' => 'koumyk', 'kut' => 'kutenai', 'kv' => 'komi', 'kw' => 'cornique', 'ky' => 'kirghize', 'la' => 'latin', 'lad' => 'ladino', 'lah' => 'lahnda', 'lam' => 'lamba', 'lb' => 'luxembourgeois', 'lez' => 'lezghien', 'lg' => 'ganda', 'li' => 'limbourgeois', 'ln' => 'lingala', 'lo' => 'lao', 'lol' => 'mongo', 'loz' => 'lozi', 'lt' => 'lituanien', 'lu' => 'luba-katanga', 'lua' => 'luba-lulua', 'lui' => 'luiseno', 'lun' => 'lunda', 'luo' => 'luo', 'lus' => 'lushai', 'luy' => 'oloulouyia', 'lv' => 'letton', 'mad' => 'madurais', 'mag' => 'magahi', 'mai' => 'maithili', 'mak' => 'makassar', 'man' => 'mandingue', 'map' => 'malayo-polynésien', 'mas' => 'masai', 'mdf' => 'moksa', 'mdr' => 'mandar', 'men' => 'mendé', 'mg' => 'malgache', 'mga' => 'moyen irlandais', 'mgh' => 'makhuwa-meetto', 'mh' => 'marshall', 'mi' => 'maori', 'mic' => 'micmac', 'min' => 'minangkabau', 'mis' => 'langue diverse', 'mk' => 'macédonien', 'mkh' => 'langue mon-khmère', 'ml' => 'malayalam', 'mn' => 'mongol', 'mnc' => 'mandchou', 'mni' => 'manipuri', 'mno' => 'langue manobo', 'mo' => 'moldave', 'moh' => 'mohawk', 'mos' => 'moré', 'mr' => 'marathe', 'ms' => 'malais', 'mt' => 'maltais', 'mua' => 'mundang', 'mul' => 'multilingue', 'mun' => 'langue mounda', 'mus' => 'creek', 'mwl' => 'mirandais', 'mwr' => 'marwarî', 'my' => 'birman', 'myn' => 'langue maya', 'myv' => 'erzya', 'na' => 'nauruan', 'nah' => 'nahuatl', 'nai' => 'langue amérindienne du Nord', 'nap' => 'napolitain', 'nb' => 'norvégien bokmål', 'nd' => 'ndébélé du Nord', 'nds' => 'bas-allemand', 'ne' => 'népalais', 'new' => 'newari', 'ng' => 'ndonga', 'nia' => 'nias', 'nic' => 'langue nigéro-congolaise', 'niu' => 'niué', 'nl' => 'néerlandais', 'nl_be' => 'néerlandais belge', 'nmg' => 'kwasio', 'nn' => 'norvégien nynorsk', 'no' => 'norvégien', 'nog' => 'nogaï', 'non' => 'vieux norrois', 'nqo' => 'n’ko', 'nr' => 'ndébélé du Sud', 'nso' => 'sotho du Nord', 'nub' => 'langue nubienne', 'nus' => 'nuer', 'nv' => 'navaho', 'nwc' => 'newarî classique', 'ny' => 'nyanja', 'nym' => 'nyamwezi', 'nyn' => 'nyankolé', 'nyo' => 'nyoro', 'nzi' => 'nzema', 'oc' => 'occitan', 'oj' => 'ojibwa', 'om' => 'oromo', 'or' => 'oriya', 'os' => 'ossète', 'osa' => 'osage', 'ota' => 'turc ottoman', 'oto' => 'langue otomangue', 'pa' => 'pendjabi', 'paa' => 'langue papoue', 'pag' => 'pangasinan', 'pal' => 'pahlavi', 'pam' => 'pampangan', 'pap' => 'papiamento', 'pau' => 'palau', 'peo' => 'persan ancien', 'phi' => 'langue philippine', 'phn' => 'phénicien', 'pi' => 'pali', 'pl' => 'polonais', 'pon' => 'pohnpei', 'pra' => 'langues prâkrit', 'pro' => 'provençal ancien', 'ps' => 'pashto', 'pt' => 'portugais', 'pt_br' => 'portugais brésilien', 'pt_pt' => 'portugais ibérique', 'qu' => 'langue quechua', 'raj' => 'rajasthani', 'rap' => 'rapanui', 'rar' => 'rarotongien', 'rm' => 'rhéto-roman', 'rn' => 'roundi', 'ro' => 'roumain', 'roa' => 'langue romane', 'rof' => 'rombo', 'rom' => 'tzigane', 'root' => 'racine', 'ru' => 'russe', 'rup' => 'valaque', 'rw' => 'rwanda', 'rwk' => 'rwa', 'sa' => 'sanskrit', 'sad' => 'sandawe', 'sah' => 'iakoute', 'sai' => 'langue amérindienne du Sud', 'sal' => 'langue salishenne', 'sam' => 'araméen samaritain', 'sas' => 'sasak', 'sat' => 'santal', 'sbp' => 'sangu', 'sc' => 'sarde', 'scn' => 'sicilien', 'sco' => 'écossais', 'sd' => 'sindhî', 'se' => 'sami du Nord', 'sel' => 'selkoupe', 'sem' => 'langue sémitique', 'sg' => 'sangho', 'sga' => 'ancien irlandais', 'sgn' => 'langue des signes', 'sh' => 'serbo-croate', 'shn' => 'shan', 'si' => 'singhalais', 'sid' => 'sidamo', 'sio' => 'langue sioux', 'sit' => 'langue sino-tibétaine', 'sk' => 'slovaque', 'sl' => 'slovène', 'sla' => 'langue slave', 'sm' => 'samoan', 'sma' => 'sami du Sud', 'smi' => 'langue samie', 'smj' => 'sami de Lule', 'smn' => 'sami d’Inari', 'sms' => 'sami skolt', 'sn' => 'shona', 'snk' => 'soninké', 'so' => 'somali', 'sog' => 'sogdien', 'son' => 'songhai', 'sq' => 'albanais', 'sr' => 'serbe', 'srn' => 'sranan tongo', 'srr' => 'sérère', 'ss' => 'swati', 'ssa' => 'langue nilo-saharienne', 'st' => 'sesotho', 'su' => 'soundanais', 'suk' => 'sukuma', 'sus' => 'soussou', 'sux' => 'sumérien', 'sv' => 'suédois', 'sw' => 'swahili', 'swb' => 'comorien', 'syc' => 'syriaque classique', 'syr' => 'syriaque', 'ta' => 'tamoul', 'tai' => 'langue taï', 'te' => 'télougou', 'tem' => 'temne', 'ter' => 'tereno', 'tet' => 'tetum', 'tg' => 'tadjik', 'th' => 'thaï', 'ti' => 'tigrigna', 'tig' => 'tigré', 'tiv' => 'tiv', 'tk' => 'turkmène', 'tkl' => 'tokelau', 'tl' => 'tagalog', 'tlh' => 'klingon', 'tli' => 'tlingit', 'tmh' => 'tamacheq', 'tn' => 'tswana', 'to' => 'tongan', 'tog' => 'tonga nyasa', 'tpi' => 'tok pisin', 'tr' => 'turc', 'ts' => 'tsonga', 'tsi' => 'tsimshian', 'tt' => 'tatar', 'tum' => 'tumbuka', 'tup' => 'langue tupi', 'tut' => 'langue altaïque', 'tvl' => 'tuvalu', 'tw' => 'twi', 'twq' => 'tasawaq', 'ty' => 'tahitien', 'tyv' => 'touva', 'udm' => 'oudmourte', 'ug' => 'ouïghour', 'uga' => 'ougaritique', 'uk' => 'ukrainien', 'umb' => 'umbundu', 'und' => 'indéterminé', 'ur' => 'ourdou', 'uz' => 'ouzbek', 'vai' => 'vaï', 've' => 'venda', 'vi' => 'vietnamien', 'vo' => 'volapuk', 'vot' => 'vote', 'wa' => 'wallon', 'wak' => 'langues wakashennes', 'wal' => 'walamo', 'war' => 'waray', 'was' => 'washo', 'wen' => 'langue sorabe', 'wo' => 'wolof', 'xal' => 'kalmouk', 'xh' => 'xhosa', 'yao' => 'yao', 'yap' => 'yapois', 'yav' => 'yangben', 'yi' => 'yiddish', 'yo' => 'yoruba', 'ypk' => 'langues yupik', 'yue' => 'cantonais', 'za' => 'zhuang', 'zap' => 'zapotèque', 'zbl' => 'symboles Bliss', 'zen' => 'zenaga', 'zh' => 'chinois', 'zh_hans' => 'chinois simplifié', 'zh_hant' => 'chinois traditionnel', 'znd' => 'zandé', 'zu' => 'zoulou', 'zun' => 'zuni', 'zxx' => 'sans contenu linguistique', 'zza' => 'zazaki', ), 'scripts' => array ( 'arab' => 'arabo-persan', 'armi' => 'araméen impérial', 'armn' => 'arménien', 'avst' => 'avestique', 'bali' => 'balinais', 'batk' => 'batak', 'beng' => 'bengâglî', 'blis' => 'symboles Bliss', 'bopo' => 'bopomofo', 'brah' => 'brâhmî', 'brai' => 'braille', 'bugi' => 'bouguis', 'buhd' => 'bouhide', 'cakm' => 'chakma', 'cans' => 'syllabaire autochtone canadien unifié', 'cari' => 'carien', 'cham' => 'cham', 'cher' => 'tchérokî', 'cirt' => 'cirth', 'copt' => 'copte', 'cprt' => 'syllabaire chypriote', 'cyrl' => 'cyrillique', 'cyrs' => 'cyrillique (variante slavonne)', 'deva' => 'dévanâgarî', 'dsrt' => 'déséret', 'egyd' => 'démotique égyptien', 'egyh' => 'hiératique égyptien', 'egyp' => 'hiéroglyphes égyptiens', 'ethi' => 'éthiopique', 'geok' => 'géorgien khoutsouri', 'geor' => 'géorgien', 'glag' => 'glagolitique', 'goth' => 'gotique', 'grek' => 'grec', 'gujr' => 'goudjarâtî', 'guru' => 'gourmoukhî', 'hang' => 'hangûl', 'hani' => 'idéogrammes han', 'hano' => 'hanounóo', 'hans' => 'chinois simplifié', 'hant' => 'chinois traditionnel', 'hebr' => 'hébreu', 'hira' => 'hiragana', 'hmng' => 'pahawh hmong', 'hrkt' => 'katakana ou hiragana', 'hung' => 'ancien hongrois', 'inds' => 'indus', 'ital' => 'ancien italique', 'java' => 'javanais', 'jpan' => 'japonais', 'kali' => 'kayah li', 'kana' => 'katakana', 'khar' => 'kharochthî', 'khmr' => 'khmer', 'knda' => 'kannara', 'kore' => 'coréen', 'kthi' => 'kaithî', 'lana' => 'lanna', 'laoo' => 'lao', 'latf' => 'latin (variante brisée)', 'latg' => 'latin (variante gaélique)', 'latn' => 'latin', 'lepc' => 'lepcha', 'limb' => 'limbou', 'lina' => 'linéaire A', 'linb' => 'linéaire B', 'lyci' => 'lycien', 'lydi' => 'lydien', 'mand' => 'mandéen', 'mani' => 'manichéen', 'maya' => 'hiéroglyphes mayas', 'mero' => 'méroïtique', 'mlym' => 'malayâlam', 'mong' => 'mongol', 'moon' => 'moon', 'mtei' => 'meitei mayek', 'mymr' => 'birman', 'nkoo' => 'n’ko', 'ogam' => 'ogam', 'olck' => 'ol tchiki', 'orkh' => 'orkhon', 'orya' => 'oriyâ', 'osma' => 'osmanais', 'perm' => 'ancien permien', 'phag' => 'phags pa', 'phli' => 'pehlevi des inscriptions', 'phlp' => 'pehlevi des psautiers', 'phlv' => 'pehlevi des livres', 'phnx' => 'phénicien', 'plrd' => 'phonétique de Pollard', 'prti' => 'parthe des inscriptions', 'rjng' => 'rejang', 'roro' => 'rongorongo', 'runr' => 'runique', 'samr' => 'samaritain', 'sara' => 'sarati', 'saur' => 'saurashtra', 'sgnw' => 'écriture des signes', 'shaw' => 'shavien', 'sinh' => 'singhalais', 'sund' => 'sundanais', 'sylo' => 'sylotî nâgrî', 'syrc' => 'syriaque', 'syre' => 'syriaque estranghélo', 'syrj' => 'syriaque occidental', 'syrn' => 'syriaque oriental', 'tagb' => 'tagbanoua', 'tale' => 'taï-le', 'talu' => 'nouveau taï-lue', 'taml' => 'tamoul', 'tavt' => 'taï viêt', 'telu' => 'télougou', 'teng' => 'tengwar', 'tfng' => 'tifinagh', 'tglg' => 'tagal', 'thaa' => 'thâna', 'thai' => 'thaï', 'tibt' => 'tibétain', 'ugar' => 'ougaritique', 'vaii' => 'vaï', 'visp' => 'parole visible', 'xpeo' => 'cunéiforme persépolitain', 'xsux' => 'cunéiforme suméro-akkadien', 'yiii' => 'yi', 'zinh' => 'hérité', 'zmth' => 'notation mathématique', 'zsym' => 'symboles', 'zxxx' => 'non écrit', 'zyyy' => 'commun', 'zzzz' => 'écriture inconnue ou non valide', ), 'territories' => array ( '001' => 'Monde', '002' => 'Afrique', '003' => 'Amérique du Nord', '005' => 'Amérique du Sud', '009' => 'Océanie', '011' => 'Afrique occidentale', '013' => 'Amérique centrale', '014' => 'Afrique orientale', '015' => 'Afrique septentrionale', '017' => 'Afrique centrale', '018' => 'Afrique australe', '019' => 'Amériques', '021' => 'Amérique septentrionale', '029' => 'Caraïbes', '030' => 'Asie orientale', '034' => 'Asie du Sud', '035' => 'Asie du Sud-Est', '039' => 'Europe méridionale', '053' => 'Australie et Nouvelle-Zélande', '054' => 'Mélanésie', '057' => 'région micronésienne', '061' => 'Polynésie', 142 => 'Asie', 143 => 'Asie centrale', 145 => 'Asie occidentale', 150 => 'Europe', 151 => 'Europe orientale', 154 => 'Europe septentrionale', 155 => 'Europe occidentale', 419 => 'Amérique latine', 'ac' => 'Île de l\'Ascension', 'ad' => 'Andorre', 'ae' => 'Émirats arabes unis', 'af' => 'Afghanistan', 'ag' => 'Antigua-et-Barbuda', 'ai' => 'Anguilla', 'al' => 'Albanie', 'am' => 'Arménie', 'an' => 'Antilles néerlandaises', 'ao' => 'Angola', 'aq' => 'Antarctique', 'ar' => 'Argentine', 'as' => 'Samoa américaines', 'at' => 'Autriche', 'au' => 'Australie', 'aw' => 'Aruba', 'ax' => 'Îles Åland', 'az' => 'Azerbaïdjan', 'ba' => 'Bosnie-Herzégovine', 'bb' => 'Barbade', 'bd' => 'Bangladesh', 'be' => 'Belgique', 'bf' => 'Burkina Faso', 'bg' => 'Bulgarie', 'bh' => 'Bahreïn', 'bi' => 'Burundi', 'bj' => 'Bénin', 'bl' => 'Saint-Barthélémy', 'bm' => 'Bermudes', 'bn' => 'Brunéi Darussalam', 'bo' => 'Bolivie', 'br' => 'Brésil', 'bs' => 'Bahamas', 'bt' => 'Bhoutan', 'bv' => 'Île Bouvet', 'bw' => 'Botswana', 'by' => 'Bélarus', 'bz' => 'Belize', 'ca' => 'Canada', 'cc' => 'Îles Cocos - Keeling', 'cd' => 'Congo-Kinshasa', 'cf' => 'République centrafricaine', 'cg' => 'République du Congo', 'ch' => 'Suisse', 'ci' => 'Côte d’Ivoire', 'ck' => 'Îles Cook', 'cl' => 'Chili', 'cm' => 'Cameroun', 'cn' => 'Chine', 'co' => 'Colombie', 'cp' => 'Île Clipperton', 'cr' => 'Costa Rica', 'cs' => 'Serbie-et-Monténégro', 'cu' => 'Cuba', 'cv' => 'Cap-Vert', 'cx' => 'Île Christmas', 'cy' => 'Chypre', 'cz' => 'République tchèque', 'de' => 'Allemagne', 'dg' => 'Diego Garcia', 'dj' => 'Djibouti', 'dk' => 'Danemark', 'dm' => 'Dominique', 'do' => 'République dominicaine', 'dz' => 'Algérie', 'ea' => 'Ceuta et Melilla', 'ec' => 'Équateur', 'ee' => 'Estonie', 'eg' => 'Égypte', 'eh' => 'Sahara occidental', 'er' => 'Érythrée', 'es' => 'Espagne', 'et' => 'Éthiopie', 'eu' => 'Union européenne', 'fi' => 'Finlande', 'fj' => 'Fidji', 'fk' => 'Îles Malouines', 'fm' => 'États fédérés de Micronésie', 'fo' => 'Îles Féroé', 'fr' => 'France', 'fx' => 'France métropolitaine', 'ga' => 'Gabon', 'gb' => 'Royaume-Uni', 'gd' => 'Grenade', 'ge' => 'Géorgie', 'gf' => 'Guyane française', 'gg' => 'Guernesey', 'gh' => 'Ghana', 'gi' => 'Gibraltar', 'gl' => 'Groenland', 'gm' => 'Gambie', 'gn' => 'Guinée', 'gp' => 'Guadeloupe', 'gq' => 'Guinée équatoriale', 'gr' => 'Grèce', 'gs' => 'Géorgie du Sud et les îles Sandwich du Sud', 'gt' => 'Guatemala', 'gu' => 'Guam', 'gw' => 'Guinée-Bissau', 'gy' => 'Guyana', 'hk' => 'Hong Kong', 'hm' => 'Îles Heard et MacDonald', 'hn' => 'Honduras', 'hr' => 'Croatie', 'ht' => 'Haïti', 'hu' => 'Hongrie', 'ic' => 'Îles Canaries', 'id' => 'Indonésie', 'ie' => 'Irlande', 'il' => 'Israël', 'im' => 'Île de Man', 'in' => 'Inde', 'io' => 'Territoire britannique de l\'océan Indien', 'iq' => 'Irak', 'ir' => 'Iran', 'is' => 'Islande', 'it' => 'Italie', 'je' => 'Jersey', 'jm' => 'Jamaïque', 'jo' => 'Jordanie', 'jp' => 'Japon', 'ke' => 'Kenya', 'kg' => 'Kirghizistan', 'kh' => 'Cambodge', 'ki' => 'Kiribati', 'km' => 'Comores', 'kn' => 'Saint-Kitts-et-Nevis', 'kp' => 'Corée du Nord', 'kr' => 'Corée du Sud', 'kw' => 'Koweït', 'ky' => 'Îles Caïmans', 'kz' => 'Kazakhstan', 'la' => 'Laos', 'lb' => 'Liban', 'lc' => 'Sainte-Lucie', 'li' => 'Liechtenstein', 'lk' => 'Sri Lanka', 'lr' => 'Libéria', 'ls' => 'Lesotho', 'lt' => 'Lituanie', 'lu' => 'Luxembourg', 'lv' => 'Lettonie', 'ly' => 'Libye', 'ma' => 'Maroc', 'mc' => 'Monaco', 'md' => 'Moldavie', 'me' => 'Monténégro', 'mf' => 'Saint-Martin', 'mg' => 'Madagascar', 'mh' => 'Îles Marshall', 'mk' => 'Macédoine', 'ml' => 'Mali', 'mm' => 'Myanmar', 'mn' => 'Mongolie', 'mo' => 'Macao', 'mp' => 'Îles Mariannes du Nord', 'mq' => 'Martinique', 'mr' => 'Mauritanie', 'ms' => 'Montserrat', 'mt' => 'Malte', 'mu' => 'Maurice', 'mv' => 'Maldives', 'mw' => 'Malawi', 'mx' => 'Mexique', 'my' => 'Malaisie', 'mz' => 'Mozambique', 'na' => 'Namibie', 'nc' => 'Nouvelle-Calédonie', 'ne' => 'Niger', 'nf' => 'Île Norfolk', 'ng' => 'Nigéria', 'ni' => 'Nicaragua', 'nl' => 'Pays-Bas', 'no' => 'Norvège', 'np' => 'Népal', 'nr' => 'Nauru', 'nu' => 'Niue', 'nz' => 'Nouvelle-Zélande', 'om' => 'Oman', 'pa' => 'Panama', 'pe' => 'Pérou', 'pf' => 'Polynésie française', 'pg' => 'Papouasie-Nouvelle-Guinée', 'ph' => 'Philippines', 'pk' => 'Pakistan', 'pl' => 'Pologne', 'pm' => 'Saint-Pierre-et-Miquelon', 'pn' => 'Pitcairn', 'pr' => 'Porto Rico', 'ps' => 'Territoire palestinien', 'pt' => 'Portugal', 'pw' => 'Palaos', 'py' => 'Paraguay', 'qa' => 'Qatar', 'qo' => 'régions éloignées de l’Océanie', 're' => 'Réunion', 'ro' => 'Roumanie', 'rs' => 'Serbie', 'ru' => 'Russie', 'rw' => 'Rwanda', 'sa' => 'Arabie saoudite', 'sb' => 'Îles Salomon', 'sc' => 'Seychelles', 'sd' => 'Soudan', 'se' => 'Suède', 'sg' => 'Singapour', 'sh' => 'Sainte-Hélène', 'si' => 'Slovénie', 'sj' => 'Svalbard et Île Jan Mayen', 'sk' => 'Slovaquie', 'sl' => 'Sierra Leone', 'sm' => 'Saint-Marin', 'sn' => 'Sénégal', 'so' => 'Somalie', 'sr' => 'Suriname', 'st' => 'Sao Tomé-et-Principe', 'sv' => 'El Salvador', 'sy' => 'Syrie', 'sz' => 'Swaziland', 'ta' => 'Tristan da Cunha', 'tc' => 'Îles Turks et Caïques', 'td' => 'Tchad', 'tf' => 'Terres australes françaises', 'tg' => 'Togo', 'th' => 'Thaïlande', 'tj' => 'Tadjikistan', 'tk' => 'Tokelau', 'tl' => 'Timor oriental', 'tm' => 'Turkménistan', 'tn' => 'Tunisie', 'to' => 'Tonga', 'tr' => 'Turquie', 'tt' => 'Trinité-et-Tobago', 'tv' => 'Tuvalu', 'tw' => 'Taïwan', 'tz' => 'Tanzanie', 'ua' => 'Ukraine', 'ug' => 'Ouganda', 'um' => 'Îles Mineures Éloignées des États-Unis', 'us' => 'États-Unis', 'uy' => 'Uruguay', 'uz' => 'Ouzbékistan', 'va' => 'État de la Cité du Vatican', 'vc' => 'Saint-Vincent-et-les Grenadines', 've' => 'Venezuela', 'vg' => 'Îles Vierges britanniques', 'vi' => 'Îles Vierges des États-Unis', 'vn' => 'Viêt Nam', 'vu' => 'Vanuatu', 'wf' => 'Wallis-et-Futuna', 'ws' => 'Samoa', 'ye' => 'Yémen', 'yt' => 'Mayotte', 'za' => 'Afrique du Sud', 'zm' => 'Zambie', 'zw' => 'Zimbabwe', 'zz' => 'région indéterminée', ), 'pluralRules' => array ( 0 => '(n>=0&&n<=2)&&n!=2', 1 => 'true', ), );
Arsen007/translator
framework/i18n/data/fr_cd.php
PHP
bsd-3-clause
30,359
<?php namespace Faker\Provider\el_GR; class Company extends \Faker\Provider\Company { protected static $companySuffix = array( 'Ο.Ε', 'Ε.Ε', 'Α.Ε', 'Ε.Π.Ε' ); protected static $companyFormats = array( '{{lastName}} {{firstName}} {{companySuffix}}', '{{lastName}}-{{firstName}}' ); protected static $grafm = array('#########'); protected static $doy = array( 'Α\' Αθήνας', 'Β\' Αθήνας', 'Γ\' Αθήνας', 'ΣΤ\' Αθήνας', 'Γαλάτσιου', 'Α\' Πειραιά', 'Β\' Πειραιά', 'Γ\' Πειραιά', 'Α\' Θεσσαλονίκης', 'Β\' Θεσσαλονίκης', 'Γλυφάδας', 'Ωροπού', 'Καλιθέας', 'Αγίου Δημητρίου', 'Νέας Σμύρνης', 'Αμαρουσίου', 'Θήρας', 'Αμοργού', 'Πατρών', 'ΔΟΥ ΠΛΟΙΩΝ', 'ΦΑΕΕ ΑΘΗΝΩΝ' ); protected static $οbject = array( 'Προγραμματιστής', 'Δικηγόρος', 'Γιατρός', 'Γραφίστας', 'Αρχαιολόγος', 'Εκπαιδευτικός', 'Μεταφραστής', 'Μηχανολόγος-μηχανικός', 'Αρχιτέκτονας', 'Δημοσιογράφος', 'Υπηρεσίες Διαδικτύου', 'Ραδιοφωνικές παραγωγές', 'Καραγκιοζοπαίχτης', 'Κουλουράς', 'Κομπάρσος', 'Καλλιτεχνικός πράκτορας', 'Εισαγωγαί-εξαγωγαί', 'Ωρολογοποιός', 'Καθεκλοποιός', ); /** * @example 'Αθήνας' */ public static function doy() { return static::randomElement(static::$doy); } /** * Return The profession of a company * * @example 'Δημοσιογράφος' */ public static function object() { return static::randomElement(static::$οbject); } }
Tupee/arend
vendor/fzaninotto/faker/src/Faker/Provider/el_GR/Company.php
PHP
bsd-3-clause
2,256
<?php class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestCase { private $_message1 = '4e544c4d535350000100000007020000'; private $_message2 = '4e544c4d53535000020000000c000c003000000035828980514246973ea892c10000000000000000460046003c00000054004500530054004e00540002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d0000000000'; private $_message3 = '4e544c4d5353500003000000180018006000000076007600780000000c000c0040000000080008004c0000000c000c0054000000000000009a0000000102000054004500530054004e00540074006500730074004d0045004d00420045005200bf2e015119f6bdb3f6fdb768aa12d478f5ce3d2401c8f6e9caa4da8f25d5e840974ed8976d3ada46010100000000000030fa7e3c677bc301f5ce3d2401c8f6e90000000002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d000000000000000000'; public function setUp() { if (!function_exists('mcrypt_module_open') || !function_exists('openssl_random_pseudo_bytes') || !function_exists('bcmul') || !function_exists('iconv')) { $this->markTestSkipped( 'One of the required functions is not available.' ); } } public function testKeywordIsNtlm() { $login = $this->_getAuthenticator(); $this->assertEquals('NTLM', $login->getAuthKeyword()); } public function testMessage1Generator() { $login = $this->_getAuthenticator(); $message1 = $this->_invokePrivateMethod('createMessage1', $login); $this->assertEquals($this->_message1, bin2hex($message1), '%s: We send the smallest ntlm message which should never fail.' ); } public function testLMv1Generator() { $password = 'test1234'; $challenge = 'b019d38bad875c9d'; $lmv1 = '1879f60127f8a877022132ec221bcbf3ca016a9f76095606'; $login = $this->_getAuthenticator(); $lmv1Result = $this->_invokePrivateMethod('createLMPassword', $login, array($password, $this->hex2bin($challenge))); $this->assertEquals($lmv1, bin2hex($lmv1Result), '%s: The keys should be the same cause we use the same values to generate them.' ); } public function testLMv2Generator() { $username = 'user'; $password = 'SecREt01'; $domain = 'DOMAIN'; $challenge = '0123456789abcdef'; $lmv2 = 'd6e6152ea25d03b7c6ba6629c2d6aaf0ffffff0011223344'; $login = $this->_getAuthenticator(); $lmv2Result = $this->_invokePrivateMethod('createLMv2Password', $login, array($password, $username, $domain, $this->hex2bin($challenge), $this->hex2bin('ffffff0011223344'))); $this->assertEquals($lmv2, bin2hex($lmv2Result), '%s: The keys should be the same cause we use the same values to generate them.' ); } public function testMessage3v1Generator() { $username = 'test'; $domain = 'TESTNT'; $workstation = 'MEMBER'; $lmResponse = '1879f60127f8a877022132ec221bcbf3ca016a9f76095606'; $ntlmResponse = 'e6285df3287c5d194f84df1a94817c7282d09754b6f9e02a'; $message3T = '4e544c4d5353500003000000180018006000000018001800780000000c000c0040000000080008004c0000000c000c0054000000000000009a0000000102000054004500530054004e00540074006500730074004d0045004d004200450052001879f60127f8a877022132ec221bcbf3ca016a9f76095606e6285df3287c5d194f84df1a94817c7282d09754b6f9e02a'; $login = $this->_getAuthenticator(); $message3 = $this->_invokePrivateMethod('createMessage3', $login, array($domain, $username, $workstation, $this->hex2bin($lmResponse), $this->hex2bin($ntlmResponse))); $this->assertEquals($message3T, bin2hex($message3), '%s: We send the same information as the example is created with so this should be the same' ); } public function testMessage3v2Generator() { $username = 'test'; $domain = 'TESTNT'; $workstation = 'MEMBER'; $lmResponse = 'bf2e015119f6bdb3f6fdb768aa12d478f5ce3d2401c8f6e9'; $ntlmResponse = 'caa4da8f25d5e840974ed8976d3ada46010100000000000030fa7e3c677bc301f5ce3d2401c8f6e90000000002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d000000000000000000'; $login = $this->_getAuthenticator(); $message3 = $this->_invokePrivateMethod('createMessage3', $login, array($domain, $username, $workstation, $this->hex2bin($lmResponse), $this->hex2bin($ntlmResponse))); $this->assertEquals($this->_message3, bin2hex($message3), '%s: We send the same information as the example is created with so this should be the same' ); } public function testGetDomainAndUsername() { $username = "DOMAIN\user"; $login = $this->_getAuthenticator(); list($domain, $user) = $this->_invokePrivateMethod('getDomainAndUsername', $login, array($username)); $this->assertEquals('DOMAIN', $domain, '%s: the fetched domain did not match' ); $this->assertEquals('user', $user, '%s: the fetched user did not match' ); } public function testGetDomainAndUsernameWithExtension() { $username = "domain.com\user"; $login = $this->_getAuthenticator(); list($domain, $user) = $this->_invokePrivateMethod('getDomainAndUsername', $login, array($username)); $this->assertEquals('domain.com', $domain, '%s: the fetched domain did not match' ); $this->assertEquals('user', $user, '%s: the fetched user did not match' ); } public function testGetDomainAndUsernameWithAtSymbol() { $username = 'user@DOMAIN'; $login = $this->_getAuthenticator(); list($domain, $user) = $this->_invokePrivateMethod('getDomainAndUsername', $login, array($username)); $this->assertEquals('DOMAIN', $domain, '%s: the fetched domain did not match' ); $this->assertEquals('user', $user, '%s: the fetched user did not match' ); } public function testGetDomainAndUsernameWithAtSymbolAndExtension() { $username = 'user@domain.com'; $login = $this->_getAuthenticator(); list($domain, $user) = $this->_invokePrivateMethod('getDomainAndUsername', $login, array($username)); $this->assertEquals('domain.com', $domain, '%s: the fetched domain did not match' ); $this->assertEquals('user', $user, '%s: the fetched user did not match' ); } public function testSuccessfulAuthentication() { $domain = 'TESTNT'; $username = 'test'; $secret = 'test1234'; $ntlm = $this->_getAuthenticator(); $agent = $this->_getAgent(); $agent->shouldReceive('executeCommand') ->once() ->with('AUTH NTLM '.base64_encode( $this->_invokePrivateMethod('createMessage1', $ntlm) )."\r\n", array(334)) ->andReturn('334 '.base64_encode($this->hex2bin('4e544c4d53535000020000000c000c003000000035828980514246973ea892c10000000000000000460046003c00000054004500530054004e00540002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d0000000000'))); $agent->shouldReceive('executeCommand') ->once() ->with(base64_encode( $this->_invokePrivateMethod('createMessage3', $ntlm, array($domain, $username, $this->hex2bin('4d0045004d00420045005200'), $this->hex2bin('bf2e015119f6bdb3f6fdb768aa12d478f5ce3d2401c8f6e9'), $this->hex2bin('caa4da8f25d5e840974ed8976d3ada46010100000000000030fa7e3c677bc301f5ce3d2401c8f6e90000000002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d000000000000000000')) ))."\r\n", array(235)); $this->assertTrue($ntlm->authenticate($agent, $username.'@'.$domain, $secret, $this->hex2bin('30fa7e3c677bc301'), $this->hex2bin('f5ce3d2401c8f6e9')), '%s: The buffer accepted all commands authentication should succeed' ); } public function testAuthenticationFailureSendRsetAndReturnFalse() { $domain = 'TESTNT'; $username = 'test'; $secret = 'test1234'; $ntlm = $this->_getAuthenticator(); $agent = $this->_getAgent(); $agent->shouldReceive('executeCommand') ->once() ->with('AUTH NTLM '.base64_encode( $this->_invokePrivateMethod('createMessage1', $ntlm) )."\r\n", array(334)) ->andThrow(new Swift_TransportException('')); $agent->shouldReceive('executeCommand') ->once() ->with("RSET\r\n", array(250)); $this->assertFalse($ntlm->authenticate($agent, $username.'@'.$domain, $secret, $this->hex2bin('30fa7e3c677bc301'), $this->hex2bin('f5ce3d2401c8f6e9')), '%s: Authentication fails, so RSET should be sent' ); } // -- Private helpers private function _getAuthenticator() { return new Swift_Transport_Esmtp_Auth_NTLMAuthenticator(); } private function _getAgent() { return $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing(); } private function _invokePrivateMethod($method, $instance, array $args = array()) { $methodC = new ReflectionMethod($instance, trim($method)); $methodC->setAccessible(true); return $methodC->invokeArgs($instance, $args); } /** * Hex2bin replacement for < PHP 5.4. * * @param string $hex * * @return string Binary */ protected function hex2bin($hex) { return function_exists('hex2bin') ? hex2bin($hex) : pack('H*', $hex); } }
sangbima/amsys
vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/NTLMAuthenticatorTest.php
PHP
bsd-3-clause
10,135
/* * @brief LPC17xx/40xx System and Control driver * * @note * Copyright(C) NXP Semiconductors, 2014 * All rights reserved. * * @par * Software that is described herein is for illustrative purposes only * which provides customers with programming information regarding the * LPC products. This software is supplied "AS IS" without any warranties of * any kind, and NXP Semiconductors and its licensor disclaim any and * all warranties, express or implied, including all implied warranties of * merchantability, fitness for a particular purpose and non-infringement of * intellectual property rights. NXP Semiconductors assumes no responsibility * or liability for the use of the software, conveys no license or rights under any * patent, copyright, mask work right, or any other intellectual property rights in * or to any products. NXP Semiconductors reserves the right to make changes * in the software without notification. NXP Semiconductors also makes no * representation or warranty that such application will be suitable for the * specified use without further testing or modification. * * @par * Permission to use, copy, modify, and distribute this software and its * documentation is hereby granted, under NXP Semiconductors' and its * licensor's relevant copyrights in the software, without fee, provided that it * is used in conjunction with NXP Semiconductors microcontrollers. This * copyright, permission, and disclaimer notice must appear in all copies of * this code. */ #include "chip.h" /***************************************************************************** * Private types/enumerations/variables ****************************************************************************/ /***************************************************************************** * Public types/enumerations/variables ****************************************************************************/ /***************************************************************************** * Private functions ****************************************************************************/ /* Returns and clears the current sleep mode entry flags */ uint32_t Chip_SYSCTL_GetClrSleepFlags(uint32_t flags) { uint32_t savedFlags = LPC_SYSCTL->PCON; LPC_SYSCTL->PCON = flags; return savedFlags & (SYSCTL_PD_SMFLAG | SYSCTL_PD_DSFLAG | SYSCTL_PD_PDFLAG | SYSCTL_PD_DPDFLAG); } #if !defined(CHIP_LPC175X_6X) /* Resets a peripheral */ void Chip_SYSCTL_PeriphReset(CHIP_SYSCTL_RESET_T periph) { uint32_t bitIndex, regIndex = (uint32_t) periph; /* Get register array index and clock index into the register */ bitIndex = (regIndex % 32); regIndex = regIndex / 32; /* Reset peripheral */ LPC_SYSCTL->RSTCON[regIndex] = (1 << bitIndex); LPC_SYSCTL->RSTCON[regIndex] &= ~(1 << bitIndex); } #endif /*!defined(CHIP_LPC175X_6X)*/
pridolfi/workspace
modules/lpc1769/chip/src/sysctl_17xx_40xx.c
C
bsd-3-clause
2,933
// Window.cpp // Copyright (c) 2009, Dan Heeks // This program is released under the BSD license. See the file COPYING for details. #include "stdafx.h" #include "Window.h" #include "../interface/HeeksObj.h" #include "SelectMode.h" #include "GraphicsCanvas.h" #include "HeeksFrame.h" WindowDragging::WindowDragging(){ reset(); } void WindowDragging::reset(void){ box_found = false; finish_dragging = false; } void WindowDragging::OnMouse( wxMouseEvent& event ){ if(event.LeftDown()){ window_box.x = event.GetX(); window_box.y = wxGetApp().m_current_viewport->GetViewportSize().GetHeight() - event.GetY(); } else if(event.LeftUp()){ window_box.width = event.GetX() - window_box.x; window_box.height = (wxGetApp().m_current_viewport->GetViewportSize().GetHeight() - window_box.y) - event.GetY(); if(abs(window_box.width)<4)box_found = false; else if(abs(window_box.height)<4)box_found = false; else box_found = true; finish_dragging = true; } else if(event.Dragging()){ window_box.width = event.GetX() - window_box.x; window_box.height = (wxGetApp().m_current_viewport->GetViewportSize().GetHeight() - window_box.y) - event.GetY(); } }
namoamitof/heekscad
src/Window.cpp
C++
bsd-3-clause
1,202
//================================================================================================= /*! // \file src/mathtest/dmatsmatadd/MDaUCa.cpp // \brief Source file for the MDaUCa dense matrix/sparse matrix addition math test // // Copyright (C) 2013 Klaus Iglberger - All Rights Reserved // // This file is part of the Blaze library. You can redistribute it and/or modify it under // the terms of the New (Revised) BSD License. Redistribution and use in source and binary // forms, with or without modification, are permitted provided that the following conditions // are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, this list // of conditions and the following disclaimer in the documentation and/or other materials // provided with the distribution. // 3. Neither the names of the Blaze development group 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 HOLDER 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. */ //================================================================================================= //************************************************************************************************* // Includes //************************************************************************************************* #include <cstdlib> #include <iostream> #include <blaze/math/CompressedMatrix.h> #include <blaze/math/DynamicMatrix.h> #include <blaze/math/UpperMatrix.h> #include <blazetest/mathtest/Creator.h> #include <blazetest/mathtest/dmatsmatadd/OperationTest.h> #include <blazetest/system/MathTest.h> //================================================================================================= // // MAIN FUNCTION // //================================================================================================= //************************************************************************************************* int main() { std::cout << " Running 'MDaUCa'..." << std::endl; using blazetest::mathtest::TypeA; try { // Matrix type definitions typedef blaze::DynamicMatrix<TypeA> MDa; typedef blaze::UpperMatrix< blaze::CompressedMatrix<TypeA> > UCa; // Creator type definitions typedef blazetest::Creator<MDa> CMDa; typedef blazetest::Creator<UCa> CUCa; // Running tests with small matrices for( size_t i=0UL; i<=6UL; ++i ) { for( size_t j=0UL; j<=UCa::maxNonZeros( i ); ++j ) { RUN_DMATSMATADD_OPERATION_TEST( CMDa( i, i ), CUCa( i, j ) ); } } // Running tests with large matrices RUN_DMATSMATADD_OPERATION_TEST( CMDa( 67UL, 67UL ), CUCa( 67UL, 7UL ) ); RUN_DMATSMATADD_OPERATION_TEST( CMDa( 128UL, 128UL ), CUCa( 128UL, 16UL ) ); } catch( std::exception& ex ) { std::cerr << "\n\n ERROR DETECTED during dense matrix/sparse matrix addition:\n" << ex.what() << "\n"; return EXIT_FAILURE; } return EXIT_SUCCESS; } //*************************************************************************************************
byzhang/blaze-lib
blazetest/src/mathtest/dmatsmatadd/MDaUCa.cpp
C++
bsd-3-clause
4,104
//================================================================================================= /*! // \file src/blaze/TDMatSVecMult.cpp // \brief Source file for the Blaze transpose dense matrix/sparse vector multiplication kernel // // Copyright (C) 2013 Klaus Iglberger - All Rights Reserved // // This file is part of the Blaze library. You can redistribute it and/or modify it under // the terms of the New (Revised) BSD License. Redistribution and use in source and binary // forms, with or without modification, are permitted provided that the following conditions // are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, this list // of conditions and the following disclaimer in the documentation and/or other materials // provided with the distribution. // 3. Neither the names of the Blaze development group 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 HOLDER 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. */ //================================================================================================= //************************************************************************************************* // Includes //************************************************************************************************* #include <iostream> #include <blaze/math/CompressedVector.h> #include <blaze/math/DynamicMatrix.h> #include <blaze/math/DynamicVector.h> #include <blaze/util/Timing.h> #include <blazemark/blaze/init/CompressedVector.h> #include <blazemark/blaze/init/DynamicMatrix.h> #include <blazemark/blaze/TDMatSVecMult.h> #include <blazemark/system/Config.h> namespace blazemark { namespace blaze { //================================================================================================= // // KERNEL FUNCTIONS // //================================================================================================= //************************************************************************************************* /*!\brief Blaze transpose dense matrix/sparse vector multiplication kernel. // // \param N The number of rows and columns of the matrix and the size of the vector. // \param F The number of non-zero elements for the sparse vector. // \param steps The number of iteration steps to perform. // \return Minimum runtime of the kernel function. // // This kernel function implements the transpose dense matrix/sparse vector multiplication by // means of the Blaze functionality. */ double tdmatsvecmult( size_t N, size_t F, size_t steps ) { using ::blazemark::element_t; using ::blaze::columnVector; using ::blaze::columnMajor; ::blaze::setSeed( seed ); ::blaze::DynamicMatrix<element_t,columnMajor> A( N, N ); ::blaze::CompressedVector<element_t,columnVector> a( N ); ::blaze::DynamicVector<element_t,columnVector> b( N ); ::blaze::timing::WcTimer timer; init( A ); init( a, F ); b = A * a; for( size_t rep=0UL; rep<reps; ++rep ) { timer.start(); for( size_t step=0UL; step<steps; ++step ) { b = A * a; } timer.end(); if( b.size() != N ) std::cerr << " Line " << __LINE__ << ": ERROR detected!!!\n"; if( timer.last() > maxtime ) break; } const double minTime( timer.min() ); const double avgTime( timer.average() ); if( minTime * ( 1.0 + deviation*0.01 ) < avgTime ) std::cerr << " Blaze kernel 'tdmatsvecmult': Time deviation too large!!!\n"; return minTime; } //************************************************************************************************* } // namespace blaze } // namespace blazemark
ceramos/blaze-lib
blazemark/src/blaze/TDMatSVecMult.cpp
C++
bsd-3-clause
4,657
//================================================================================================= /*! // \file src/mathtest/dvecsvecsub/V3bVCb.cpp // \brief Source file for the V3bVCb dense vector/sparse vector subtraction math test // // Copyright (C) 2013 Klaus Iglberger - All Rights Reserved // // This file is part of the Blaze library. You can redistribute it and/or modify it under // the terms of the New (Revised) BSD License. Redistribution and use in source and binary // forms, with or without modification, are permitted provided that the following conditions // are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, this list // of conditions and the following disclaimer in the documentation and/or other materials // provided with the distribution. // 3. Neither the names of the Blaze development group 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 HOLDER 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. */ //================================================================================================= //************************************************************************************************* // Includes //************************************************************************************************* #include <cstdlib> #include <iostream> #include <blaze/math/CompressedVector.h> #include <blaze/math/StaticVector.h> #include <blazetest/mathtest/Creator.h> #include <blazetest/mathtest/dvecsvecsub/OperationTest.h> #include <blazetest/system/MathTest.h> //================================================================================================= // // MAIN FUNCTION // //================================================================================================= //************************************************************************************************* int main() { std::cout << " Running 'V3bVCb'..." << std::endl; using blazetest::mathtest::TypeB; try { // Vector type definitions typedef blaze::StaticVector<TypeB,3UL> V3b; typedef blaze::CompressedVector<TypeB> VCb; // Creator type definitions typedef blazetest::Creator<V3b> CV3b; typedef blazetest::Creator<VCb> CVCb; // Running the tests for( size_t i=0UL; i<=3UL; ++i ) { RUN_DVECSVECSUB_OPERATION_TEST( CV3b(), CVCb( 3UL, i ) ); } } catch( std::exception& ex ) { std::cerr << "\n\n ERROR DETECTED during dense vector/sparse vector subtraction:\n" << ex.what() << "\n"; return EXIT_FAILURE; } return EXIT_SUCCESS; } //*************************************************************************************************
gnzlbg/blaze-lib
blazetest/src/mathtest/dvecsvecsub/V3bVCb.cpp
C++
bsd-3-clause
3,723
#!/usr/bin/python """ Copyright 2014 Google Inc. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. Compare results of two render_pictures runs. TODO(epoger): Start using this module to compare ALL images (whether they were generated from GMs or SKPs), and rename it accordingly. """ # System-level imports import logging import os import shutil import subprocess import tempfile import time # Must fix up PYTHONPATH before importing from within Skia import rs_fixpypath # pylint: disable=W0611 # Imports from within Skia from py.utils import git_utils from py.utils import gs_utils from py.utils import url_utils import buildbot_globals import column import gm_json import imagediffdb import imagepair import imagepairset import results # URL under which all render_pictures images can be found in Google Storage. # # TODO(epoger): In order to allow live-view of GMs and other images, read this # from the input summary files, or allow the caller to set it within the # GET_live_results call. DEFAULT_IMAGE_BASE_GS_URL = 'gs://' + buildbot_globals.Get('skp_images_bucket') # Column descriptors, and display preferences for them. COLUMN__RESULT_TYPE = results.KEY__EXTRACOLUMNS__RESULT_TYPE COLUMN__SOURCE_SKP = 'sourceSkpFile' COLUMN__TILED_OR_WHOLE = 'tiledOrWhole' COLUMN__TILENUM = 'tilenum' COLUMN__BUILDER_A = 'builderA' COLUMN__RENDER_MODE_A = 'renderModeA' COLUMN__BUILDER_B = 'builderB' COLUMN__RENDER_MODE_B = 'renderModeB' # Known values for some of those columns. COLUMN__TILED_OR_WHOLE__TILED = 'tiled' COLUMN__TILED_OR_WHOLE__WHOLE = 'whole' FREEFORM_COLUMN_IDS = [ COLUMN__SOURCE_SKP, COLUMN__TILENUM, ] ORDERED_COLUMN_IDS = [ COLUMN__RESULT_TYPE, COLUMN__SOURCE_SKP, COLUMN__TILED_OR_WHOLE, COLUMN__TILENUM, COLUMN__BUILDER_A, COLUMN__RENDER_MODE_A, COLUMN__BUILDER_B, COLUMN__RENDER_MODE_B, ] # A special "repo:" URL type that we use to refer to Skia repo contents. # (Useful for comparing against expectations files we store in our repo.) REPO_URL_PREFIX = 'repo:' REPO_BASEPATH = os.path.abspath(os.path.join( os.path.dirname(os.path.abspath(__file__)), os.pardir, os.pardir)) # Which sections within a JSON summary file can contain results. ALLOWED_SECTION_NAMES = [ gm_json.JSONKEY_ACTUALRESULTS, gm_json.JSONKEY_EXPECTEDRESULTS, ] class RenderedPicturesComparisons(results.BaseComparisons): """Loads results from multiple render_pictures runs into an ImagePairSet. """ def __init__(self, setA_dir, setB_dir, setA_section, setB_section, image_diff_db, image_base_gs_url=DEFAULT_IMAGE_BASE_GS_URL, diff_base_url=None, setA_label=None, setB_label=None, gs=None, truncate_results=False, prefetch_only=False, download_all_images=False): """Constructor: downloads images and generates diffs. Once the object has been created (which may take a while), you can call its get_packaged_results_of_type() method to quickly retrieve the results... unless you have set prefetch_only to True, in which case we will asynchronously warm up the ImageDiffDB cache but not fill in self._results. Args: setA_dir: root directory to copy all JSON summaries from, and to use as setA within the comparisons. This directory may be specified as a gs:// URL, special "repo:" URL, or local filepath. setB_dir: root directory to copy all JSON summaries from, and to use as setB within the comparisons. This directory may be specified as a gs:// URL, special "repo:" URL, or local filepath. setA_section: which section within setA to examine; must be one of ALLOWED_SECTION_NAMES setB_section: which section within setB to examine; must be one of ALLOWED_SECTION_NAMES image_diff_db: ImageDiffDB instance image_base_gs_url: "gs://" URL pointing at the Google Storage bucket/dir under which all render_pictures result images can be found; this will be used to read images for comparison within this code, and included in the ImagePairSet (as an HTTP URL) so its consumers know where to download the images from diff_base_url: base URL within which the client should look for diff images; if not specified, defaults to a "file:///" URL representation of image_diff_db's storage_root setA_label: description to use for results in setA; if None, will be set to a reasonable default setB_label: description to use for results in setB; if None, will be set to a reasonable default gs: instance of GSUtils object we can use to download summary files truncate_results: FOR MANUAL TESTING: if True, truncate the set of images we process, to speed up testing. prefetch_only: if True, return the new object as quickly as possible with empty self._results (just queue up all the files to process, don't wait around for them to be processed and recorded); otherwise, block until the results have been assembled and recorded in self._results. download_all_images: if True, download all images, even if we don't need them to generate diffs. This will take much longer to complete, but is useful for warming up the bitmap cache on local disk. """ super(RenderedPicturesComparisons, self).__init__() self._image_diff_db = image_diff_db self._image_base_gs_url = image_base_gs_url self._diff_base_url = ( diff_base_url or url_utils.create_filepath_url(image_diff_db.storage_root)) self._gs = gs self.truncate_results = truncate_results self._prefetch_only = prefetch_only self._download_all_images = download_all_images # If we are comparing two different section types, we can use those # as the default labels for setA and setB. if setA_section != setB_section: self._setA_label = setA_label or setA_section self._setB_label = setB_label or setB_section else: self._setA_label = setA_label or 'setA' self._setB_label = setB_label or 'setB' tempdir = tempfile.mkdtemp() try: setA_root = os.path.join(tempdir, 'setA') setB_root = os.path.join(tempdir, 'setB') # TODO(stephana): There is a potential race condition here... we copy # the contents out of the source_dir, and THEN we get the commithash # of source_dir. If source_dir points at a git checkout, and that # checkout is updated (by a different thread/process) during this # operation, then the contents and commithash will be out of sync. self._copy_dir_contents(source_dir=setA_dir, dest_dir=setA_root) setA_repo_revision = self._get_repo_revision(source_dir=setA_dir) self._copy_dir_contents(source_dir=setB_dir, dest_dir=setB_root) setB_repo_revision = self._get_repo_revision(source_dir=setB_dir) self._setA_descriptions = { results.KEY__SET_DESCRIPTIONS__DIR: setA_dir, results.KEY__SET_DESCRIPTIONS__REPO_REVISION: setA_repo_revision, results.KEY__SET_DESCRIPTIONS__SECTION: setA_section, } self._setB_descriptions = { results.KEY__SET_DESCRIPTIONS__DIR: setB_dir, results.KEY__SET_DESCRIPTIONS__REPO_REVISION: setB_repo_revision, results.KEY__SET_DESCRIPTIONS__SECTION: setB_section, } time_start = int(time.time()) self._results = self._load_result_pairs( setA_root=setA_root, setB_root=setB_root, setA_section=setA_section, setB_section=setB_section) if self._results: self._timestamp = int(time.time()) logging.info('Number of download file collisions: %s' % imagediffdb.global_file_collisions) logging.info('Results complete; took %d seconds.' % (self._timestamp - time_start)) finally: shutil.rmtree(tempdir) def _load_result_pairs(self, setA_root, setB_root, setA_section, setB_section): """Loads all JSON image summaries from 2 directory trees and compares them. TODO(stephana): This method is only called from within __init__(); it might make more sense to just roll the content of this method into __init__(). Args: setA_root: root directory containing JSON summaries of rendering results setB_root: root directory containing JSON summaries of rendering results setA_section: which section (gm_json.JSONKEY_ACTUALRESULTS or gm_json.JSONKEY_EXPECTEDRESULTS) to load from the summaries in setA setB_section: which section (gm_json.JSONKEY_ACTUALRESULTS or gm_json.JSONKEY_EXPECTEDRESULTS) to load from the summaries in setB Returns the summary of all image diff results (or None, depending on self._prefetch_only). """ logging.info('Reading JSON image summaries from dirs %s and %s...' % ( setA_root, setB_root)) setA_dicts = self.read_dicts_from_root(setA_root) setB_dicts = self.read_dicts_from_root(setB_root) logging.info('Comparing summary dicts...') all_image_pairs = imagepairset.ImagePairSet( descriptions=(self._setA_label, self._setB_label), diff_base_url=self._diff_base_url) failing_image_pairs = imagepairset.ImagePairSet( descriptions=(self._setA_label, self._setB_label), diff_base_url=self._diff_base_url) # Override settings for columns that should be filtered using freeform text. for column_id in FREEFORM_COLUMN_IDS: factory = column.ColumnHeaderFactory( header_text=column_id, use_freeform_filter=True) all_image_pairs.set_column_header_factory( column_id=column_id, column_header_factory=factory) failing_image_pairs.set_column_header_factory( column_id=column_id, column_header_factory=factory) all_image_pairs.ensure_extra_column_values_in_summary( column_id=COLUMN__RESULT_TYPE, values=[ results.KEY__RESULT_TYPE__FAILED, results.KEY__RESULT_TYPE__NOCOMPARISON, results.KEY__RESULT_TYPE__SUCCEEDED, ]) failing_image_pairs.ensure_extra_column_values_in_summary( column_id=COLUMN__RESULT_TYPE, values=[ results.KEY__RESULT_TYPE__FAILED, results.KEY__RESULT_TYPE__NOCOMPARISON, ]) logging.info('Starting to add imagepairs to queue.') self._image_diff_db.log_queue_size_if_changed(limit_verbosity=False) union_dict_paths = sorted(set(setA_dicts.keys() + setB_dicts.keys())) num_union_dict_paths = len(union_dict_paths) dict_num = 0 for dict_path in union_dict_paths: dict_num += 1 logging.info( 'Asynchronously requesting pixel diffs for dict #%d of %d, "%s"...' % (dict_num, num_union_dict_paths, dict_path)) dictA = self.get_default(setA_dicts, None, dict_path) self._validate_dict_version(dictA) dictA_results = self.get_default(dictA, {}, setA_section) dictB = self.get_default(setB_dicts, None, dict_path) self._validate_dict_version(dictB) dictB_results = self.get_default(dictB, {}, setB_section) image_A_base_url = self.get_default( setA_dicts, self._image_base_gs_url, dict_path, gm_json.JSONKEY_IMAGE_BASE_GS_URL) image_B_base_url = self.get_default( setB_dicts, self._image_base_gs_url, dict_path, gm_json.JSONKEY_IMAGE_BASE_GS_URL) # get the builders and render modes for each set builder_A = self.get_default(dictA, None, gm_json.JSONKEY_DESCRIPTIONS, gm_json.JSONKEY_DESCRIPTIONS_BUILDER) render_mode_A = self.get_default(dictA, None, gm_json.JSONKEY_DESCRIPTIONS, gm_json.JSONKEY_DESCRIPTIONS_RENDER_MODE) builder_B = self.get_default(dictB, None, gm_json.JSONKEY_DESCRIPTIONS, gm_json.JSONKEY_DESCRIPTIONS_BUILDER) render_mode_B = self.get_default(dictB, None, gm_json.JSONKEY_DESCRIPTIONS, gm_json.JSONKEY_DESCRIPTIONS_RENDER_MODE) skp_names = sorted(set(dictA_results.keys() + dictB_results.keys())) # Just for manual testing... truncate to an arbitrary subset. if self.truncate_results: skp_names = skp_names[1:3] for skp_name in skp_names: imagepairs_for_this_skp = [] whole_image_A = self.get_default( dictA_results, None, skp_name, gm_json.JSONKEY_SOURCE_WHOLEIMAGE) whole_image_B = self.get_default( dictB_results, None, skp_name, gm_json.JSONKEY_SOURCE_WHOLEIMAGE) imagepairs_for_this_skp.append(self._create_image_pair( image_dict_A=whole_image_A, image_dict_B=whole_image_B, image_A_base_url=image_A_base_url, image_B_base_url=image_B_base_url, builder_A=builder_A, render_mode_A=render_mode_A, builder_B=builder_B, render_mode_B=render_mode_B, source_json_file=dict_path, source_skp_name=skp_name, tilenum=None)) tiled_images_A = self.get_default( dictA_results, [], skp_name, gm_json.JSONKEY_SOURCE_TILEDIMAGES) tiled_images_B = self.get_default( dictB_results, [], skp_name, gm_json.JSONKEY_SOURCE_TILEDIMAGES) if tiled_images_A or tiled_images_B: num_tiles_A = len(tiled_images_A) num_tiles_B = len(tiled_images_B) num_tiles = max(num_tiles_A, num_tiles_B) for tile_num in range(num_tiles): imagepairs_for_this_skp.append(self._create_image_pair( image_dict_A=(tiled_images_A[tile_num] if tile_num < num_tiles_A else None), image_dict_B=(tiled_images_B[tile_num] if tile_num < num_tiles_B else None), image_A_base_url=image_A_base_url, image_B_base_url=image_B_base_url, builder_A=builder_A, render_mode_A=render_mode_A, builder_B=builder_B, render_mode_B=render_mode_B, source_json_file=dict_path, source_skp_name=skp_name, tilenum=tile_num)) for one_imagepair in imagepairs_for_this_skp: if one_imagepair: all_image_pairs.add_image_pair(one_imagepair) result_type = one_imagepair.extra_columns_dict\ [COLUMN__RESULT_TYPE] if result_type != results.KEY__RESULT_TYPE__SUCCEEDED: failing_image_pairs.add_image_pair(one_imagepair) logging.info('Finished adding imagepairs to queue.') self._image_diff_db.log_queue_size_if_changed(limit_verbosity=False) if self._prefetch_only: return None else: return { results.KEY__HEADER__RESULTS_ALL: all_image_pairs.as_dict( column_ids_in_order=ORDERED_COLUMN_IDS), results.KEY__HEADER__RESULTS_FAILURES: failing_image_pairs.as_dict( column_ids_in_order=ORDERED_COLUMN_IDS), } def _validate_dict_version(self, result_dict): """Raises Exception if the dict is not the type/version we know how to read. Args: result_dict: dictionary holding output of render_pictures; if None, this method will return without raising an Exception """ # TODO(stephana): These values should be defined as constants somewhere, # to be kept in sync between this file and writable_expectations.py expected_header_type = 'ChecksummedImages' expected_header_revision = 1 if result_dict == None: return header = result_dict[gm_json.JSONKEY_HEADER] header_type = header[gm_json.JSONKEY_HEADER_TYPE] if header_type != expected_header_type: raise Exception('expected header_type "%s", but got "%s"' % ( expected_header_type, header_type)) header_revision = header[gm_json.JSONKEY_HEADER_REVISION] if header_revision != expected_header_revision: raise Exception('expected header_revision %d, but got %d' % ( expected_header_revision, header_revision)) def _create_image_pair(self, image_dict_A, image_dict_B, image_A_base_url, image_B_base_url, builder_A, render_mode_A, builder_B, render_mode_B, source_json_file, source_skp_name, tilenum): """Creates an ImagePair object for this pair of images. Args: image_dict_A: dict with JSONKEY_IMAGE_* keys, or None if no image image_dict_B: dict with JSONKEY_IMAGE_* keys, or None if no image image_A_base_url: base URL for image A image_B_base_url: base URL for image B builder_A: builder that created image set A or None if unknow render_mode_A: render mode used to generate image set A or None if unknown. builder_B: builder that created image set A or None if unknow render_mode_B: render mode used to generate image set A or None if unknown. source_json_file: string; relative path of the JSON file where this result came from, within setA and setB. source_skp_name: string; name of the source SKP file tilenum: which tile, or None if a wholeimage Returns: An ImagePair object, or None if both image_dict_A and image_dict_B are None. """ if (not image_dict_A) and (not image_dict_B): return None def _checksum_and_relative_url(dic): if dic: return ((dic[gm_json.JSONKEY_IMAGE_CHECKSUMALGORITHM], int(dic[gm_json.JSONKEY_IMAGE_CHECKSUMVALUE])), dic[gm_json.JSONKEY_IMAGE_FILEPATH]) else: return None, None imageA_checksum, imageA_relative_url = _checksum_and_relative_url( image_dict_A) imageB_checksum, imageB_relative_url = _checksum_and_relative_url( image_dict_B) if not imageA_checksum: result_type = results.KEY__RESULT_TYPE__NOCOMPARISON elif not imageB_checksum: result_type = results.KEY__RESULT_TYPE__NOCOMPARISON elif imageA_checksum == imageB_checksum: result_type = results.KEY__RESULT_TYPE__SUCCEEDED else: result_type = results.KEY__RESULT_TYPE__FAILED extra_columns_dict = { COLUMN__RESULT_TYPE: result_type, COLUMN__SOURCE_SKP: source_skp_name, COLUMN__BUILDER_A: builder_A, COLUMN__RENDER_MODE_A: render_mode_A, COLUMN__BUILDER_B: builder_B, COLUMN__RENDER_MODE_B: render_mode_B, } if tilenum == None: extra_columns_dict[COLUMN__TILED_OR_WHOLE] = COLUMN__TILED_OR_WHOLE__WHOLE extra_columns_dict[COLUMN__TILENUM] = 'N/A' else: extra_columns_dict[COLUMN__TILED_OR_WHOLE] = COLUMN__TILED_OR_WHOLE__TILED extra_columns_dict[COLUMN__TILENUM] = str(tilenum) try: return imagepair.ImagePair( image_diff_db=self._image_diff_db, imageA_base_url=image_A_base_url, imageB_base_url=image_B_base_url, imageA_relative_url=imageA_relative_url, imageB_relative_url=imageB_relative_url, extra_columns=extra_columns_dict, source_json_file=source_json_file, download_all_images=self._download_all_images) except (KeyError, TypeError): logging.exception( 'got exception while creating ImagePair for' ' urlPair=("%s","%s"), source_skp_name="%s", tilenum="%s"' % ( imageA_relative_url, imageB_relative_url, source_skp_name, tilenum)) return None def _copy_dir_contents(self, source_dir, dest_dir): """Copy all contents of source_dir into dest_dir, recursing into subdirs. Args: source_dir: path to source dir (GS URL, local filepath, or a special "repo:" URL type that points at a file within our Skia checkout) dest_dir: path to destination dir (local filepath) The copy operates as a "merge with overwrite": any files in source_dir will be "overlaid" on top of the existing content in dest_dir. Existing files with the same names will be overwritten. """ if gs_utils.GSUtils.is_gs_url(source_dir): (bucket, path) = gs_utils.GSUtils.split_gs_url(source_dir) self._gs.download_dir_contents(source_bucket=bucket, source_dir=path, dest_dir=dest_dir) elif source_dir.lower().startswith(REPO_URL_PREFIX): repo_dir = os.path.join(REPO_BASEPATH, source_dir[len(REPO_URL_PREFIX):]) shutil.copytree(repo_dir, dest_dir) else: shutil.copytree(source_dir, dest_dir) def _get_repo_revision(self, source_dir): """Get the commit hash of source_dir, IF it refers to a git checkout. Args: source_dir: path to source dir (GS URL, local filepath, or a special "repo:" URL type that points at a file within our Skia checkout; only the "repo:" URL type will have a commit hash. """ if source_dir.lower().startswith(REPO_URL_PREFIX): repo_dir = os.path.join(REPO_BASEPATH, source_dir[len(REPO_URL_PREFIX):]) return subprocess.check_output( args=[git_utils.GIT, 'rev-parse', 'HEAD'], cwd=repo_dir).strip() else: return None
Omegaphora/external_chromium_org_third_party_skia
gm/rebaseline_server/compare_rendered_pictures.py
Python
bsd-3-clause
21,541
<?php namespace Doctrine\Tests\Common\Persistence; use Doctrine\Common\Persistence\PersistentObject; use Doctrine\Common\Persistence\Mapping\ClassMetadata; use Doctrine\Common\Persistence\Mapping\ReflectionService; /** * @group DDC-1448 */ class PersistentObjectTest extends \Doctrine\Tests\DoctrineTestCase { private $cm; private $om; private $object; public function setUp() { $this->cm = new TestObjectMetadata; $this->om = $this->getMock('Doctrine\Common\Persistence\ObjectManager'); $this->om->expects($this->any())->method('getClassMetadata') ->will($this->returnValue($this->cm)); $this->object = new TestObject; PersistentObject::setObjectManager($this->om); $this->object->injectObjectManager($this->om, $this->cm); } public function testGetObjectManager() { $this->assertSame($this->om, PersistentObject::getObjectManager()); } public function testNonMatchingObjectManager() { $this->setExpectedException('RuntimeException'); $om = $this->getMock('Doctrine\Common\Persistence\ObjectManager'); $this->object->injectObjectManager($om, $this->cm); } public function testGetField() { $this->assertEquals('beberlei', $this->object->getName()); } public function testSetField() { $this->object->setName("test"); $this->assertEquals("test", $this->object->getName()); } public function testGetIdentifier() { $this->assertEquals(1, $this->object->getId()); } public function testSetIdentifier() { $this->setExpectedException('BadMethodCallException'); $this->object->setId(2); } public function testSetUnknownField() { $this->setExpectedException('BadMethodCallException'); $this->object->setUnknown("test"); } public function testGetUnknownField() { $this->setExpectedException('BadMethodCallException'); $this->object->getUnknown(); } public function testGetToOneAssociation() { $this->assertNull($this->object->getParent()); } public function testSetToOneAssociation() { $parent = new TestObject(); $this->object->setParent($parent); $this->assertSame($parent, $this->object->getParent($parent)); } public function testSetInvalidToOneAssocation() { $parent = new \stdClass(); $this->setExpectedException('InvalidArgumentException'); $this->object->setParent($parent); } public function testSetToOneAssociationNull() { $parent = new TestObject(); $this->object->setParent($parent); $this->object->setParent(null); $this->assertNull($this->object->getParent()); } public function testAddToManyAssocation() { $child = new TestObject(); $this->object->addChildren($child); $this->assertSame($this->object, $child->getParent()); $this->assertEquals(1, count($this->object->getChildren())); $child = new TestObject(); $this->object->addChildren($child); $this->assertEquals(2, count($this->object->getChildren())); } public function testAddInvalidToManyAssocation() { $this->setExpectedException('InvalidArgumentException'); $this->object->addChildren(new \stdClass()); } public function testNoObjectManagerSet() { PersistentObject::setObjectManager(null); $child = new TestObject(); $this->setExpectedException('RuntimeException'); $child->setName("test"); } public function testInvalidMethod() { $this->setExpectedException('BadMethodCallException'); $this->object->asdf(); } public function testAddInvalidCollection() { $this->setExpectedException('BadMethodCallException'); $this->object->addAsdf(new \stdClass()); } } class TestObject extends PersistentObject { protected $id = 1; protected $name = 'beberlei'; protected $parent; protected $children; } class TestObjectMetadata implements ClassMetadata { public function getAssociationMappedByTargetField($assocName) { $assoc = array('children' => 'parent'); return $assoc[$assocName]; } public function getAssociationNames() { return array('parent', 'children'); } public function getAssociationTargetClass($assocName) { return __NAMESPACE__ . '\TestObject'; } public function getFieldNames() { return array('id', 'name'); } public function getIdentifier() { return array('id'); } public function getName() { return __NAMESPACE__ . '\TestObject'; } public function getReflectionClass() { return new \ReflectionClass($this->getName()); } public function getTypeOfField($fieldName) { $types = array('id' => 'integer', 'name' => 'string'); return $types[$fieldName]; } public function hasAssociation($fieldName) { return in_array($fieldName, array('parent', 'children')); } public function hasField($fieldName) { return in_array($fieldName, array('id', 'name')); } public function isAssociationInverseSide($assocName) { return ($assocName === 'children'); } public function isCollectionValuedAssociation($fieldName) { return ($fieldName === 'children'); } public function isIdentifier($fieldName) { return $fieldName === 'id'; } public function isSingleValuedAssociation($fieldName) { return $fieldName === 'parent'; } public function getIdentifierValues($entity) { } public function getIdentifierFieldNames() { } public function initializeReflection(ReflectionService $reflService) { } public function wakeupReflection(ReflectionService $reflService) { } }
Tlapi/Noodle
vendor/doctrine/common/tests/tests/Doctrine/Tests/Common/Persistence/PersistentObjectTest.php
PHP
bsd-3-clause
6,051
<!DOCTYPE html> <!-- Copyright (c) 2015 Intel Corporation. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of works must retain the original copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the original 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 Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this work without specific prior written permission. THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "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 INTEL CORPORATION 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: Yin, Haichao <haichaox.yin@intel.com> Xu, Kang <kangx.xu@intel.com> --> <meta charset="utf-8"> <title>Runtime Test: Flash Plugin</title> <link rel="author" title="Intel" href="http://www.intel.com"> <body> <div id="operate"> <p>Test passes if the flash is showing normally</p> <div> <embed width="500" height="500" src="source/test.swf"> </div> </body>
haoxli/crosswalk-test-suite
usecase/usecase-wrt-linux-tests/res/testapp/flashplugin/index.html
HTML
bsd-3-clause
1,841
import os, sys; sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..")) from pattern.web import Bing, plaintext from pattern.en import parsetree from pattern.search import Pattern from pattern.db import Datasheet, pprint # "X IS MORE IMPORTANT THAN Y" # Here is a rough example of how to build a web miner. # It mines comparative statements from Bing and stores the results in a table, # which can be saved as a text file for further processing later on. # Pattern matching also works with Sentence objects from the MBSP module. # MBSP's parser is much more robust (but also slower). #from MBSP import Sentence, parse q = '"more important than"' # Bing search query p = "NP VP? more important than NP" # Search pattern. p = Pattern.fromstring(p) d = Datasheet() engine = Bing(license=None) for i in range(1): # max=10 for result in engine.search(q, start=i+1, count=100, cached=True): s = result.description s = plaintext(s) t = parsetree(s) for m in p.search(t): a = m.constituents(constraint=0)[-1] # Left NP. b = m.constituents(constraint=5)[ 0] # Right NP. d.append(( a.string.lower(), b.string.lower())) pprint(d) print print len(d), "results."
Sri0405/pattern
examples/04-search/09-web.py
Python
bsd-3-clause
1,296
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>SuperLU: EXAMPLE/dlinsol1.c File Reference</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.5 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main&nbsp;Page</span></a></li> <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> </div> <div class="contents"> <h1>EXAMPLE/dlinsol1.c File Reference</h1><code>#include &quot;<a class="el" href="slu__ddefs_8h-source.html">slu_ddefs.h</a>&quot;</code><br> <table border="0" cellpadding="0" cellspacing="0"> <tr><td></td></tr> <tr><td colspan="2"><br><h2>Functions</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="dlinsol1_8c.html#e0665038b72011f5c680c660fcb59459">main</a> (int argc, char *argv[])</td></tr> </table> <hr><h2>Function Documentation</h2> <a class="anchor" name="e0665038b72011f5c680c660fcb59459"></a><!-- doxytag: member="dlinsol1.c::main" ref="e0665038b72011f5c680c660fcb59459" args="(int argc, char *argv[])" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">main </td> <td>(</td> <td class="paramtype">int&nbsp;</td> <td class="paramname"> <em>argc</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">char *&nbsp;</td> <td class="paramname"> <em>argv</em>[]</td><td>&nbsp;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> </div> </div><p> </div> <hr size="1"><address style="text-align: right;"><small>Generated on Mon Nov 22 10:23:47 2010 for SuperLU by&nbsp; <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address> </body> </html>
tomosu/opentoonz
thirdparty/superlu/SuperLU_4.1/DOC/html/dlinsol1_8c.html
HTML
bsd-3-clause
2,357
<?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 Zend\Navigation\Page; use Zend\Http\Request; use Zend\Navigation\Exception; /** * Represents a page that is defined by specifying a URI */ class Uri extends AbstractPage { /** * Page URI * * @var string|null */ protected $uri = null; /** * Request object used to determine uri path * * @var string */ protected $request; /** * Sets page URI * * @param string $uri page URI, must a string or null * * @return Uri fluent interface, returns self * @throws Exception\InvalidArgumentException if $uri is invalid */ public function setUri($uri) { if (null !== $uri && !is_string($uri)) { throw new Exception\InvalidArgumentException( 'Invalid argument: $uri must be a string or null' ); } $this->uri = $uri; return $this; } /** * Returns URI * * @return string */ public function getUri() { return $this->uri; } /** * Returns href for this page * * Includes the fragment identifier if it is set. * * @return string */ public function getHref() { $uri = $this->getUri(); $fragment = $this->getFragment(); if (null !== $fragment) { if ('#' == substr($uri, -1)) { return $uri . $fragment; } else { return $uri . '#' . $fragment; } } return $uri; } /** * Returns whether page should be considered active or not * * This method will compare the page properties against the request uri. * * @param bool $recursive * [optional] whether page should be considered * active if any child pages are active. Default is * false. * @return bool whether page should be considered active or not */ public function isActive($recursive = false) { if (!$this->active) { if ($this->getRequest() instanceof Request) { if ($this->getRequest()->getUri()->getPath() == $this->getUri()) { $this->active = true; return true; } } } return parent::isActive($recursive); } /** * Get the request * * @return Request */ public function getRequest() { return $this->request; } /** * Sets request for assembling URLs * * @param Request $request * @return Fluent interface, returns self */ public function setRequest(Request $request = null) { $this->request = $request; return $this; } /** * Returns an array representation of the page * * @return array */ public function toArray() { return array_merge( parent::toArray(), array( 'uri' => $this->getUri(), ) ); } }
Vericlongmore/zendframework2-weixin-wechat
vendor/zendframework/zendframework/library/Zend/Navigation/Page/Uri.php
PHP
bsd-3-clause
3,382
#!/usr/bin/env python # -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright (c) 2013, Nicolas P. Rougier. All rights reserved. # Distributed under the terms of the new BSD License. # ----------------------------------------------------------------------------- import numpy as np from functools import reduce from operator import mul def dtype_reduce(dtype, level=0, depth=0): """ Try to reduce dtype up to a given level when it is possible dtype = [ ('vertex', [('x', 'f4'), ('y', 'f4'), ('z', 'f4')]), ('normal', [('x', 'f4'), ('y', 'f4'), ('z', 'f4')]), ('color', [('r', 'f4'), ('g', 'f4'), ('b', 'f4'), ('a', 'f4')])] level 0: ['color,vertex,normal,', 10, 'float32'] level 1: [['color', 4, 'float32'] ['normal', 3, 'float32'] ['vertex', 3, 'float32']] """ dtype = np.dtype(dtype) fields = dtype.fields # No fields if fields is None: if len(dtype.shape): count = reduce(mul, dtype.shape) else: count = 1 # size = dtype.itemsize / count if dtype.subdtype: name = str(dtype.subdtype[0]) else: name = str(dtype) return ['', count, name] else: items = [] name = '' # Get reduced fields for key, value in fields.items(): l = dtype_reduce(value[0], level, depth + 1) if type(l[0]) is str: items.append([key, l[1], l[2]]) else: items.append(l) name += key + ',' # Check if we can reduce item list ctype = None count = 0 for i, item in enumerate(items): # One item is a list, we cannot reduce if type(item[0]) is not str: return items else: if i == 0: ctype = item[2] count += item[1] else: if item[2] != ctype: return items count += item[1] if depth >= level: return [name, count, ctype] else: return items def fetchcode(utype, prefix=""): """ Generate the GLSL code needed to retrieve fake uniform values from a texture. uniforms : sampler2D Texture to fetch uniforms from uniforms_shape: vec3 Size of texture (width,height,count) where count is the number of float to be fetched. collection_index: float Attribute giving the index of the uniforms to be fetched. This index relates to the index in the uniform array from python side. """ utype = np.dtype(utype) _utype = dtype_reduce(utype, level=1) header = """ uniform sampler2D uniforms; uniform vec3 uniforms_shape; attribute float collection_index; """ # Header generation (easy) types = {1: 'float', 2: 'vec2 ', 3: 'vec3 ', 4: 'vec4 ', 9: 'mat3 ', 16: 'mat4 '} for name, count, _ in _utype: if name != '__unused__': header += "varying %s %s%s;\n" % (types[count], prefix, name) # Body generation (not so easy) body = """\nvoid fetch_uniforms() { float rows = uniforms_shape.x; float cols = uniforms_shape.y; float count = uniforms_shape.z; float index = collection_index; int index_x = int(mod(index, (floor(cols/(count/4.0))))) * int(count/4.0); int index_y = int(floor(index / (floor(cols/(count/4.0))))); float size_x = cols - 1.0; float size_y = rows - 1.0; float ty = 0.0; if (size_y > 0.0) ty = float(index_y)/size_y; int i = index_x; vec4 _uniform;\n""" _utype = dict([(name, count) for name, count, _ in _utype]) store = 0 # Be very careful with utype name order (_utype.keys is wrong) for name in utype.names: if name == '__unused__': continue count, shift = _utype[name], 0 size = count while count: if store == 0: body += "\n _uniform = texture2D(uniforms, vec2(float(i++)/size_x,ty));\n" # noqa store = 4 if store == 4: a = "xyzw" elif store == 3: a = "yzw" elif store == 2: a = "zw" elif store == 1: a = "w" if shift == 0: b = "xyzw" elif shift == 1: b = "yzw" elif shift == 2: b = "zw" elif shift == 3: b = "w" i = min(min(len(b), count), len(a)) if size > 1: body += " %s%s.%s = _uniform.%s;\n" % (prefix, name, b[:i], a[:i]) # noqa else: body += " %s%s = _uniform.%s;\n" % (prefix, name, a[:i]) count -= i shift += i store -= i body += """}\n\n""" return header + body
dchilds7/Deysha-Star-Formation
vispy/visuals/collections/util.py
Python
bsd-3-clause
5,086
/* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause */ var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); /** * Encode an integer in the range of 0 to 63 to a single base 64 digit. */ exports.encode = function (number) { if (0 <= number && number < intToCharMap.length) { return intToCharMap[number]; } throw new TypeError("Must be between 0 and 63: " + number); }; /** * Decode a single base 64 character code digit to an integer. Returns -1 on * failure. */ exports.decode = function (charCode) { var bigA = 65; // 'A' var bigZ = 90; // 'Z' var littleA = 97; // 'a' var littleZ = 122; // 'z' var zero = 48; // '0' var nine = 57; // '9' var plus = 43; // '+' var slash = 47; // '/' var littleOffset = 26; var numberOffset = 52; // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ if (bigA <= charCode && charCode <= bigZ) { return (charCode - bigA); } // 26 - 51: abcdefghijklmnopqrstuvwxyz if (littleA <= charCode && charCode <= littleZ) { return (charCode - littleA + littleOffset); } // 52 - 61: 0123456789 if (zero <= charCode && charCode <= nine) { return (charCode - zero + numberOffset); } // 62: + if (charCode == plus) { return 62; } // 63: / if (charCode == slash) { return 63; } // Invalid base64 digit. return -1; };
GAIA-project/bma
node_modules/concat-with-sourcemaps/node_modules/source-map/lib/base64.js
JavaScript
bsd-3-clause
1,540
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ 'use strict'; var path = require('path'); var yeoman = require('yeoman-generator'); var utils = require('../generator-utils'); module.exports = yeoman.generators.NamedBase.extend({ constructor: function() { yeoman.generators.NamedBase.apply(this, arguments); this.option('skip-ios', { desc: 'Skip generating iOS files', type: Boolean, defaults: false }); this.option('skip-android', { desc: 'Skip generating Android files', type: Boolean, defaults: false }); this.option('upgrade', { desc: 'Specify an upgrade', type: Boolean, defaults: false }); // this passes command line arguments down to the composed generators var args = {args: arguments[0], options: this.options}; if (!this.options['skip-ios']) { this.composeWith('react:ios', args, { local: require.resolve(path.resolve(__dirname, '..', 'generator-ios')) }); } if (!this.options['skip-android']) { this.composeWith('react:android', args, { local: require.resolve(path.resolve(__dirname, '..', 'generator-android')) }); } }, configuring: function() { utils.copyAndReplace( this.templatePath('../../../.flowconfig'), this.destinationPath('.flowconfig'), { 'Libraries\/react-native\/react-native-interface.js' : 'node_modules/react-native/Libraries/react-native/react-native-interface.js', '^flow/$' : 'node_modules/react-native/flow\nflow/' } ); this.fs.copy( this.templatePath('_gitignore'), this.destinationPath('.gitignore') ); this.fs.copy( this.templatePath('_watchmanconfig'), this.destinationPath('.watchmanconfig') ); this.fs.copy( this.templatePath('_buckconfig'), this.destinationPath('.buckconfig') ); }, writing: function() { if (this.options.upgrade) { // never upgrade index.*.js files return; } if (!this.options['skip-ios']) { this.fs.copyTpl( this.templatePath('index.ios.js'), this.destinationPath('index.ios.js'), {name: this.name} ); } if (!this.options['skip-android']) { this.fs.copyTpl( this.templatePath('index.android.js'), this.destinationPath('index.android.js'), {name: this.name} ); } }, install: function() { if (this.options.upgrade) { return; } var reactNativePackageJson = require('../../package.json'); var { peerDependencies } = reactNativePackageJson; if (!peerDependencies) { return; } var reactVersion = peerDependencies.react; if (!reactVersion) { return; } this.npmInstall(`react@${reactVersion}`, { '--save': true, '--save-exact': true }); } });
tarkus/react-native-appletv
local-cli/generator/index.js
JavaScript
bsd-3-clause
3,101
dojo.provide("dojox.lang.functional.listcomp"); // This module adds high-level functions and related constructs: // - list comprehensions similar to JavaScript 1.7 // Notes: // - listcomp() produces functions, which after the compilation step are // as fast as regular JS functions (at least theoretically). (function(){ var g_re = /\bfor\b|\bif\b/gm; var listcomp = function(/*String*/ s){ var frag = s.split(g_re), act = s.match(g_re), head = ["var r = [];"], tail = [], i = 0, l = act.length; while(i < l){ var a = act[i], f = frag[++i]; if(a == "for" && !/^\s*\(\s*(;|var)/.test(f)){ f = f.replace(/^\s*\(/, "(var "); } head.push(a, f, "{"); tail.push("}"); } return head.join("") + "r.push(" + frag[0] + ");" + tail.join("") + "return r;"; // String }; dojo.mixin(dojox.lang.functional, { buildListcomp: function(/*String*/ s){ // summary: // builds a function from a text snippet, which represents a valid // JS 1.7 list comprehension, returns a string, which represents the function. // description: // This method returns a textual representation of a function // built from the list comprehension text snippet (conformant to JS 1.7). // It is meant to be evaled in the proper context, so local variable can be // pulled from the environment. return "function(){" + listcomp(s) + "}"; // String }, compileListcomp: function(/*String*/ s){ // summary: // builds a function from a text snippet, which represents a valid // JS 1.7 list comprehension, returns a function object. // description: // This method returns a function built from the list // comprehension text snippet (conformant to JS 1.7). It is meant to be // reused several times. return new Function([], listcomp(s)); // Function }, listcomp: function(/*String*/ s){ // summary: // executes the list comprehension building an array. return (new Function([], listcomp(s)))(); // Array } }); })();
pilbender/dojoExample
src/main/webapp/resources/dojo-release-1.10.2-src/dojox/lang/functional/listcomp.js
JavaScript
bsd-3-clause
1,991
/*********************************************************************/ /* Copyright 2009, 2010 The University of Texas at Austin. */ /* All rights reserved. */ /* */ /* Redistribution and use in source and binary forms, with or */ /* without modification, are permitted provided that the following */ /* conditions are met: */ /* */ /* 1. Redistributions of source code must retain the above */ /* copyright notice, this list of conditions and the following */ /* disclaimer. */ /* */ /* 2. Redistributions in binary form must reproduce the above */ /* copyright notice, this list of conditions and the following */ /* disclaimer in the documentation and/or other materials */ /* provided with the distribution. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ /* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ /* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */ /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */ /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */ /* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */ /* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */ /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */ /* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */ /* POSSIBILITY OF SUCH DAMAGE. */ /* */ /* The views and conclusions contained in the software and */ /* documentation are those of the authors and should not be */ /* interpreted as representing official policies, either expressed */ /* or implied, of The University of Texas at Austin. */ /*********************************************************************/ #include <stdio.h> #include "common.h" int CNAME(BLASLONG m, BLASLONG n, FLOAT *a, BLASLONG lda, FLOAT *b){ BLASLONG i, j; FLOAT *a_offset; FLOAT *b_offset; FLOAT ctemp1, ctemp2, ctemp3, ctemp4; FLOAT ctemp5, ctemp6, ctemp7, ctemp8; a_offset = a; b_offset = b; lda *= 2; i = n; if (i > 0){ do { j = (m >> 2); if (j > 0){ do{ ctemp1 = *(a_offset + 0); ctemp2 = *(a_offset + 1); ctemp3 = *(a_offset + 2); ctemp4 = *(a_offset + 3); ctemp5 = *(a_offset + 4); ctemp6 = *(a_offset + 5); ctemp7 = *(a_offset + 6); ctemp8 = *(a_offset + 7); *(b_offset + 0) = ctemp1; *(b_offset + 1) = ctemp2; *(b_offset + 2) = ctemp3; *(b_offset + 3) = ctemp4; *(b_offset + 4) = ctemp5; *(b_offset + 5) = ctemp6; *(b_offset + 6) = ctemp7; *(b_offset + 7) = ctemp8; a_offset += 8; b_offset += 8; j --; } while(j>0); } j = (m & 3); if (j > 0){ do{ ctemp1 = *(a_offset + 0); ctemp2 = *(a_offset + 1); *(b_offset + 0) = ctemp1; *(b_offset + 1) = ctemp2; a_offset += 2; b_offset += 2; j --; } while(j>0); } a_offset += lda - m * 2; i--; } while (i > 0); } return 0; }
ryanrhymes/openblas
lib/OpenBLAS-0.2.19/kernel/generic/zgemm_ncopy_1.c
C
bsd-3-clause
3,897
<?php /** * Copyright 2011-2013 Fabrizio Branca. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @package WebDriver * * @author Fabrizio Branca <mail@fabrizio-branca.de> * @author Anthon Pang <apang@softwaredevelopment.ca> */ namespace WebDriver; /** * WebDriver\Capability class * * @package WebDriver */ class Capability { /** * Desired capabilities * * @see http://code.google.com/p/selenium/source/browse/trunk/java/client/src/org/openqa/selenium/remote/CapabilityType.java * @see http://code.google.com/p/selenium/wiki/JsonWireProtocol#Capabilities_JSON_Object */ const BROWSER_NAME = 'browserName'; const VERSION = 'version'; const PLATFORM = 'platform'; const JAVASCRIPT_ENABLED = 'javascriptEnabled'; const TAKES_SCREENSHOT = 'takesScreenshot'; const HANDLES_ALERTS = 'handlesAlerts'; const DATABASE_ENABLED = 'databaseEnabled'; const LOCATION_CONTEXT_ENABLED = 'locationContextEnabled'; const APPLICATION_CACHE_ENABLED = 'applicationCacheEnabled'; const BROWSER_CONNECTION_ENABLED = 'browserConnectionEnabled'; const CSS_SELECTORS_ENABLED = 'cssSelectorsEnabled'; const WEB_STORAGE_ENABLED = 'webStorageEnabled'; const ROTATABLE = 'rotatable'; const ACCEPT_SSL_CERTS = 'acceptSslCerts'; const NATIVE_EVENTS = 'nativeEvents'; const PROXY = 'proxy'; const UNEXPECTED_ALERT_BEHAVIOUR = 'unexpectedAlertBehaviour'; /** * Proxy types * * @see http://code.google.com/p/selenium/wiki/JsonWireProtocol#Proxy_JSON_Object */ const DIRECT = 'direct'; const MANUAL = 'manual'; const PAC = 'pac'; const AUTODETECT = 'autodetect'; const SYSTEM = 'system'; }
Sampa/PP
vendor/instaclick/php-webdriver/lib/WebDriver/Capability.php
PHP
bsd-3-clause
2,429
<?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_Search_Lucene * @subpackage Search * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $ */ /** * @category Zend * @package Zend_Search_Lucene * @subpackage Search * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Search_Lucene_Search_Highlighter_Interface { /** * Set document for highlighting. * * @param Zend_Search_Lucene_Document_Html $document */ public function setDocument(Zend_Search_Lucene_Document_Html $document); /** * Get document for highlighting. * * @return Zend_Search_Lucene_Document_Html $document */ public function getDocument(); /** * Highlight specified words (method is invoked once per subquery) * * @param string|array $words Words to highlight. They could be organized using the array or string. */ public function highlight($words); }
alexkos252/yupe
protected/modules/zendsearch/vendors/Zend/Search/Lucene/Search/Highlighter/Interface.php
PHP
bsd-3-clause
1,680
// Copyright 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. package org.chromium.content.browser; import android.content.Context; import android.os.Bundle; import android.os.SystemClock; import android.test.InstrumentationTestCase; import android.test.suitebuilder.annotation.SmallTest; import android.util.Log; import android.view.MotionEvent; import android.view.MotionEvent.PointerCoords; import android.view.MotionEvent.PointerProperties; import android.view.ViewConfiguration; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.ScalableTimeout; import org.chromium.content.browser.ContentViewGestureHandler.MotionEventDelegate; import org.chromium.content.browser.third_party.GestureDetector; import java.util.ArrayList; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; /** * Test suite for ContentViewGestureHandler. */ public class ContentViewGestureHandlerTest extends InstrumentationTestCase { private static final int FAKE_COORD_X = 42; private static final int FAKE_COORD_Y = 24; private static final String TAG = "ContentViewGestureHandler"; private MockListener mMockListener; private MockMotionEventDelegate mMockMotionEventDelegate; private MockGestureDetector mMockGestureDetector; private MockZoomManager mMockZoomManager; private ContentViewGestureHandler mGestureHandler; private LongPressDetector mLongPressDetector; static class MockListener extends GestureDetector.SimpleOnGestureListener { MotionEvent mLastLongPress; MotionEvent mLastShowPress; MotionEvent mLastSingleTap; MotionEvent mLastFling1; CountDownLatch mLongPressCalled; CountDownLatch mShowPressCalled; public MockListener() { mLongPressCalled = new CountDownLatch(1); mShowPressCalled = new CountDownLatch(1); } @Override public void onLongPress(MotionEvent e) { mLastLongPress = MotionEvent.obtain(e); mLongPressCalled.countDown(); } @Override public void onShowPress(MotionEvent e) { mLastShowPress = MotionEvent.obtain(e); mShowPressCalled.countDown(); Log.e("Overscroll", "OnShowPress"); } @Override public boolean onSingleTapConfirmed(MotionEvent e) { mLastSingleTap = e; return true; } @Override public boolean onSingleTapUp(MotionEvent e) { mLastSingleTap = e; return true; } @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { return true; } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { mLastFling1 = e1; return true; } } static class MockGestureDetector extends GestureDetector { MotionEvent mLastEvent; public MockGestureDetector(Context context, OnGestureListener listener) { super(context, listener); } @Override public boolean onTouchEvent(MotionEvent ev) { mLastEvent = MotionEvent.obtain(ev); return super.onTouchEvent(ev); } } static class MockMotionEventDelegate implements MotionEventDelegate { private ContentViewGestureHandler mSynchronousConfirmTarget; private int mSynchronousConfirmAckResult; public int mLastTouchAction; public int mLastGestureType; public int mTotalSentGestureCount; @Override public boolean sendTouchEvent(long timeMs, int action, TouchPoint[] pts) { mLastTouchAction = action; if (mSynchronousConfirmTarget != null) { mSynchronousConfirmTarget.confirmTouchEvent(mSynchronousConfirmAckResult); } return true; } @Override public boolean sendGesture(int type, long timeMs, int x, int y, Bundle extraParams) { Log.i(TAG,"Gesture event received with type id " + type); mLastGestureType = type; mTotalSentGestureCount++; return true; } @Override public void sendSingleTapUMA(int type) { // Not implemented. } @Override public void sendActionAfterDoubleTapUMA(int type, boolean clickDelayEnabled) { // Not implemented. } @Override public void invokeZoomPicker() { // Not implemented. } public void enableSynchronousConfirmTouchEvent( ContentViewGestureHandler handler, int ackResult) { mSynchronousConfirmTarget = handler; mSynchronousConfirmAckResult = ackResult; } public void disableSynchronousConfirmTouchEvent() { mSynchronousConfirmTarget = null; } } static class MockZoomManager extends ZoomManager { private ContentViewGestureHandler mHandlerForMoveEvents; MockZoomManager(Context context, ContentViewCore contentViewCore) { super(context, contentViewCore); } public void pinchOnMoveEvents(ContentViewGestureHandler handler) { mHandlerForMoveEvents = handler; } @Override public boolean processTouchEvent(MotionEvent event) { if (event.getActionMasked() == MotionEvent.ACTION_MOVE && mHandlerForMoveEvents != null) { mHandlerForMoveEvents.pinchBy(event.getEventTime(), 1, 1, 1.1f); return true; } return false; } } private static MotionEvent motionEvent(int action, long downTime, long eventTime) { return MotionEvent.obtain(downTime, eventTime, action, FAKE_COORD_X, FAKE_COORD_Y, 0); } @Override public void setUp() { mMockListener = new MockListener(); mMockGestureDetector = new MockGestureDetector( getInstrumentation().getTargetContext(), mMockListener); mMockMotionEventDelegate = new MockMotionEventDelegate(); mMockZoomManager = new MockZoomManager(getInstrumentation().getTargetContext(), null); mGestureHandler = new ContentViewGestureHandler( getInstrumentation().getTargetContext(), mMockMotionEventDelegate, mMockZoomManager); mLongPressDetector = new LongPressDetector( getInstrumentation().getTargetContext(), mGestureHandler); mGestureHandler.setTestDependencies( mLongPressDetector, mMockGestureDetector, mMockListener); TouchPoint.initializeConstantsForTesting(); } /** * Verify that a DOWN followed shortly by an UP will trigger a single tap. * * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testGestureSingleClick() throws Exception { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertFalse(mGestureHandler.onTouchEvent(event)); assertTrue("Should have a pending gesture", mMockGestureDetector.mLastEvent != null); assertTrue("Should have a pending LONG_PRESS", mLongPressDetector.hasPendingMessage()); event = motionEvent(MotionEvent.ACTION_UP, downTime, eventTime + 10); mLongPressDetector.cancelLongPressIfNeeded(event); assertTrue("Should not have a pending LONG_PRESS", !mLongPressDetector.hasPendingMessage()); assertTrue(mGestureHandler.onTouchEvent(event)); // Synchronous, no need to wait. assertTrue("Should have a single tap", mMockListener.mLastSingleTap != null); } /** * Verify that when a touch event handler is registered the touch events are queued * and sent in order. * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testFlingOnTouchHandler() throws Exception { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); mGestureHandler.hasTouchEventHandlers(true); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(1, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); assertTrue("Should not have a pending gesture", mMockGestureDetector.mLastEvent == null); assertFalse("Should not have a pending LONG_PRESS", mLongPressDetector.hasPendingMessage()); event = MotionEvent.obtain( downTime, eventTime + 5, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 5, FAKE_COORD_Y * 5, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(2, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = MotionEvent.obtain( downTime, eventTime + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 10, FAKE_COORD_Y * 10, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("We should have coalesced move events into one" , 2, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = MotionEvent.obtain( downTime, eventTime + 15, MotionEvent.ACTION_UP, FAKE_COORD_X * 10, FAKE_COORD_Y * 10, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(3, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_NOT_CONSUMED); assertEquals(2, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); assertEquals(MotionEvent.ACTION_MOVE, mGestureHandler.peekFirstInPendingMotionEventsForTesting().getActionMasked()); assertFalse("Pending LONG_PRESS should have been canceled", mLongPressDetector.hasPendingMessage()); mGestureHandler.confirmTouchEvent(ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_CONSUMED); assertEquals(1, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); assertEquals(MotionEvent.ACTION_UP, mGestureHandler.peekFirstInPendingMotionEventsForTesting().getActionMasked()); mGestureHandler.confirmTouchEvent(ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_CONSUMED); assertEquals(0, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); // Synchronous, no need to wait. assertTrue("Should not have a fling", mMockListener.mLastFling1 == null); assertTrue("Should not have a long press", mMockListener.mLastLongPress == null); } /** * Verify that after a touch event handlers starts handling a gesture, even though some event * in the middle of the gesture returns with NOT_CONSUMED, we don't send that to the gesture * detector to avoid falling to a faulty state. * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testFlingOnTouchHandlerWithOneEventNotConsumed() throws Exception { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); mGestureHandler.hasTouchEventHandlers(true); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(1, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); assertTrue("Should not have a pending gesture", mMockGestureDetector.mLastEvent == null); assertFalse("Should not have a pending LONG_PRESS", mLongPressDetector.hasPendingMessage()); event = MotionEvent.obtain( downTime, eventTime + 5, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 5, FAKE_COORD_Y * 5, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(2, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = MotionEvent.obtain( downTime, eventTime + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 10, FAKE_COORD_Y * 10, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("We should have coalesced move events into one" , 2, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = MotionEvent.obtain( downTime, eventTime + 15, MotionEvent.ACTION_UP, FAKE_COORD_X * 10, FAKE_COORD_Y * 10, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(3, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_CONSUMED); assertEquals(2, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); assertEquals(MotionEvent.ACTION_MOVE, mGestureHandler.peekFirstInPendingMotionEventsForTesting().getActionMasked()); mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_NOT_CONSUMED); assertEquals(1, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); assertEquals(MotionEvent.ACTION_UP, mGestureHandler.peekFirstInPendingMotionEventsForTesting().getActionMasked()); assertTrue("Even though the last event was not consumed by JavaScript," + "it shouldn't have been sent to the Gesture Detector", mMockGestureDetector.mLastEvent == null); mGestureHandler.confirmTouchEvent(ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_CONSUMED); assertEquals(0, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); // Synchronous, no need to wait. assertTrue("Should not have a fling", mMockListener.mLastFling1 == null); assertTrue("Should not have a long press", mMockListener.mLastLongPress == null); } /** * Verify that when a registered touch event handler return NO_CONSUMER_EXISTS for down event * all queue is drained until next down. * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testDrainWithFlingAndClickOutofTouchHandler() throws Exception { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); mGestureHandler = new ContentViewGestureHandler( getInstrumentation().getTargetContext(), new MockMotionEventDelegate(), mMockZoomManager); mLongPressDetector = new LongPressDetector( getInstrumentation().getTargetContext(), mGestureHandler); mGestureHandler.hasTouchEventHandlers(true); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(1, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); assertFalse("Should not have a pending LONG_PRESS", mLongPressDetector.hasPendingMessage()); event = MotionEvent.obtain( downTime, eventTime + 5, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 5, FAKE_COORD_Y * 5, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(2, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = MotionEvent.obtain( downTime, eventTime + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 10, FAKE_COORD_Y * 10, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(2, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = MotionEvent.obtain( downTime, eventTime + 15, MotionEvent.ACTION_UP, FAKE_COORD_X * 10, FAKE_COORD_Y * 10, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(3, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = motionEvent(MotionEvent.ACTION_DOWN, eventTime + 20, eventTime + 20); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(4, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = MotionEvent.obtain( downTime, eventTime + 20, MotionEvent.ACTION_UP, FAKE_COORD_X, FAKE_COORD_Y, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(5, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); assertEquals("The queue should have been drained until first down since no consumer exists", 2, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); assertEquals(MotionEvent.ACTION_DOWN, mGestureHandler.peekFirstInPendingMotionEventsForTesting().getActionMasked()); mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); assertEquals("The queue should have been drained", 0, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); } /** * Verify that when a touch event handler is registered the touch events stop getting queued * after we received INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS. * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testFlingOutOfTouchHandler() throws Exception { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); mGestureHandler.hasTouchEventHandlers(true); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(1, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); assertTrue("Should not have a pending gesture", mMockGestureDetector.mLastEvent == null); assertFalse("Should not have a pending LONG_PRESS", mLongPressDetector.hasPendingMessage()); mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); assertEquals(0, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); assertEquals("The down touch event should have been sent to the Gesture Detector", event.getEventTime(), mMockGestureDetector.mLastEvent.getEventTime()); assertEquals("The down touch event should have been sent to the Gesture Detector", MotionEvent.ACTION_DOWN, mMockGestureDetector.mLastEvent.getActionMasked()); event = MotionEvent.obtain( downTime, eventTime + 5, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 5, FAKE_COORD_Y * 5, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(0, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); assertEquals("Motion events should be going to the Gesture Detector directly", event.getEventTime(), mMockGestureDetector.mLastEvent.getEventTime()); assertEquals("Motion events should be going to the Gesture Detector directly", MotionEvent.ACTION_MOVE, mMockGestureDetector.mLastEvent.getActionMasked()); event = MotionEvent.obtain( downTime, eventTime + 10, MotionEvent.ACTION_UP, FAKE_COORD_X * 5, FAKE_COORD_Y * 5, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(0, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); assertEquals("Motion events should be going to the Gesture Detector directly", event.getEventTime(), mMockGestureDetector.mLastEvent.getEventTime()); assertEquals("Motion events should be going to the Gesture Detector directly", MotionEvent.ACTION_UP, mMockGestureDetector.mLastEvent.getActionMasked()); // Synchronous, no need to wait. assertTrue("Should have a fling", mMockListener.mLastFling1 != null); assertTrue("Should not have a long press", mMockListener.mLastLongPress == null); } /** * Verifies that a single tap doesn't cause a long press event to be sent. * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testNoLongPressIsSentForSingleTapOutOfTouchHandler() throws Exception { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); mGestureHandler.hasTouchEventHandlers(true); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(1, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); assertTrue("Should not have a pending gesture", mMockGestureDetector.mLastEvent == null); assertFalse("Should not have a pending LONG_PRESS", mLongPressDetector.hasPendingMessage()); event = motionEvent(MotionEvent.ACTION_UP, downTime, eventTime + 5); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(2, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_NOT_CONSUMED); assertEquals(1, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); assertEquals("The down touch event should have been sent to the Gesture Detector", event.getDownTime(), mMockGestureDetector.mLastEvent.getEventTime()); assertEquals("The next event should be ACTION_UP", MotionEvent.ACTION_UP, mGestureHandler.peekFirstInPendingMotionEventsForTesting().getActionMasked()); mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_NOT_CONSUMED); assertEquals(0, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); assertEquals("The up touch event should have been sent to the Gesture Detector", event.getEventTime(), mMockGestureDetector.mLastEvent.getEventTime()); assertFalse("Should not have a pending LONG_PRESS", mLongPressDetector.hasPendingMessage()); } /** * Verify that a DOWN followed by a MOVE will trigger fling (but not LONG). * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testGestureFlingAndCancelLongClick() throws Exception { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertFalse(mGestureHandler.onTouchEvent(event)); assertTrue("Should have a pending gesture", mMockGestureDetector.mLastEvent != null); assertTrue("Should have a pending LONG_PRESS", mLongPressDetector.hasPendingMessage()); event = MotionEvent.obtain( downTime, eventTime + 5, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 10, FAKE_COORD_Y * 10, 0); mLongPressDetector.cancelLongPressIfNeeded(event); assertTrue("Should not have a pending LONG_PRESS", !mLongPressDetector.hasPendingMessage()); assertTrue(mGestureHandler.onTouchEvent(event)); event = MotionEvent.obtain( downTime, eventTime + 10, MotionEvent.ACTION_UP, FAKE_COORD_X * 10, FAKE_COORD_Y * 10, 0); assertTrue(mGestureHandler.onTouchEvent(event)); // Synchronous, no need to wait. assertTrue("Should have a fling", mMockListener.mLastFling1 != null); assertTrue("Should not have a long press", mMockListener.mLastLongPress == null); } /** * Verify that for a normal scroll the following events are sent: * - GESTURE_SCROLL_START * - GESTURE_SCROLL_BY * - GESTURE_SCROLL_END * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testScrollEventActionUpSequence() throws Exception { checkScrollEventSequenceForEndActionType(MotionEvent.ACTION_UP); } /** * Verify that for a cancelled scroll the following events are sent: * - GESTURE_SCROLL_START * - GESTURE_SCROLL_BY * - GESTURE_SCROLL_END * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testScrollEventActionCancelSequence() throws Exception { checkScrollEventSequenceForEndActionType(MotionEvent.ACTION_CANCEL); } private void checkScrollEventSequenceForEndActionType(int endActionType) throws Exception { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); final int scrollToX = FAKE_COORD_X + 100; final int scrollToY = FAKE_COORD_Y + 100; GestureRecordingMotionEventDelegate mockDelegate = new GestureRecordingMotionEventDelegate(); mGestureHandler = new ContentViewGestureHandler( getInstrumentation().getTargetContext(), mockDelegate, mMockZoomManager); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(mGestureHandler.onTouchEvent(event)); event = MotionEvent.obtain( downTime, eventTime + 1000, MotionEvent.ACTION_MOVE, scrollToX, scrollToY, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue(mGestureHandler.isNativeScrolling()); assertTrue("A scrollStart event should have been sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_SCROLL_START)); assertEquals("We should have started scrolling", ContentViewGestureHandler.GESTURE_SCROLL_BY, mockDelegate.mMostRecentGestureEvent.mType); assertEquals("Only tapDown, tapCancel, scrollBegin and scrollBy should have been sent", 4, mockDelegate.mGestureTypeList.size()); assertEquals("scrollBegin should be sent before scrollBy", ContentViewGestureHandler.GESTURE_SCROLL_START, (int) mockDelegate.mGestureTypeList.get(2)); assertEquals("scrollBegin should have the time of the ACTION_MOVE", eventTime + 1000, (long) mockDelegate.mGestureTimeList.get(2)); event = MotionEvent.obtain( downTime, eventTime + 1000, endActionType, scrollToX, scrollToY, 0); mGestureHandler.onTouchEvent(event); assertFalse(mGestureHandler.isNativeScrolling()); assertTrue("A scrollEnd event should have been sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_SCROLL_END)); assertEquals("We should have stopped scrolling", ContentViewGestureHandler.GESTURE_SCROLL_END, mockDelegate.mMostRecentGestureEvent.mType); assertEquals("Only tapDown, scrollBegin and scrollBy and scrollEnd should have been sent", 5, mockDelegate.mGestureTypeList.size()); } /** * Verify that for a normal fling (fling after scroll) the following events are sent: * - GESTURE_SCROLL_BEGIN * - GESTURE_FLING_START * and GESTURE_FLING_CANCEL is sent on the next touch. * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testFlingEventSequence() throws Exception { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); GestureRecordingMotionEventDelegate mockDelegate = new GestureRecordingMotionEventDelegate(); mGestureHandler = new ContentViewGestureHandler( getInstrumentation().getTargetContext(), mockDelegate, mMockZoomManager); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(mGestureHandler.onTouchEvent(event)); event = MotionEvent.obtain( downTime, eventTime + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 5, FAKE_COORD_Y * 5, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue(mGestureHandler.isNativeScrolling()); assertTrue("A scrollStart event should have been sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_SCROLL_START)); assertEquals("We should have started scrolling", ContentViewGestureHandler.GESTURE_SCROLL_BY, mockDelegate.mMostRecentGestureEvent.mType); assertEquals("Only tapDown, tapCancel, scrollBegin and scrollBy should have been sent", 4, mockDelegate.mGestureTypeList.size()); assertEquals("scrollBegin should be sent before scrollBy", ContentViewGestureHandler.GESTURE_SCROLL_START, (int) mockDelegate.mGestureTypeList.get(2)); assertEquals("scrollBegin should have the time of the ACTION_MOVE", eventTime + 10, (long) mockDelegate.mGestureTimeList.get(2)); event = MotionEvent.obtain( downTime, eventTime + 15, MotionEvent.ACTION_UP, FAKE_COORD_X * 10, FAKE_COORD_Y * 10, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertFalse(mGestureHandler.isNativeScrolling()); assertEquals("We should have started flinging", ContentViewGestureHandler.GESTURE_FLING_START, mockDelegate.mMostRecentGestureEvent.mType); assertTrue("A scroll end event should not have been sent", !mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_SCROLL_END)); assertEquals("The last up should have caused flingStart to be sent", 5, mockDelegate.mGestureTypeList.size()); assertEquals("flingStart should have the time of the ACTION_UP", eventTime + 15, (long) mockDelegate.mGestureTimeList.get(4)); event = motionEvent(MotionEvent.ACTION_DOWN, downTime + 50, downTime + 50); assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue("A flingCancel should have been sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_FLING_CANCEL)); assertEquals("Only tapDown and flingCancel should have been sent", 7, mockDelegate.mGestureTypeList.size()); } /** * Verify that a zero-velocity fling is never forwarded, and cancels any * previous fling or scroll sequence. * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testZeroVelocityFling() throws Exception { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); GestureRecordingMotionEventDelegate mockDelegate = new GestureRecordingMotionEventDelegate(); mGestureHandler = new ContentViewGestureHandler( getInstrumentation().getTargetContext(), mockDelegate, mMockZoomManager); mGestureHandler.fling(eventTime, 5, 5, 0, 0); assertEquals("A zero-velocity fling should not be forwrded", null, mockDelegate.mMostRecentGestureEvent); mGestureHandler.fling(eventTime, 5, 5, 5, 0); assertEquals("Subsequent flings should work properly", ContentViewGestureHandler.GESTURE_FLING_START, mockDelegate.mMostRecentGestureEvent.mType); mGestureHandler.fling(eventTime, 5, 5, 0, 0); assertEquals("A zero-velocity fling should cancel any outstanding fling", ContentViewGestureHandler.GESTURE_FLING_CANCEL, mockDelegate.mMostRecentGestureEvent.mType); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(mGestureHandler.onTouchEvent(event)); event = MotionEvent.obtain( downTime, eventTime + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 5, FAKE_COORD_Y * 5, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue(mGestureHandler.isNativeScrolling()); assertTrue("A scrollStart event should have been sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_SCROLL_START)); assertEquals("We should have started scrolling", ContentViewGestureHandler.GESTURE_SCROLL_BY, mockDelegate.mMostRecentGestureEvent.mType); mGestureHandler.fling(eventTime, 5, 5, 0, 0); assertEquals("A zero-velicty fling should end the current scroll sequence", ContentViewGestureHandler.GESTURE_SCROLL_END, mockDelegate.mMostRecentGestureEvent.mType); } /** * Verify that a show pressed state gesture followed by a long press followed by the focus * loss in the window due to context menu cancels show pressed. * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testShowPressCancelOnWindowFocusLost() throws Exception { final long time = SystemClock.uptimeMillis(); GestureRecordingMotionEventDelegate mockDelegate = new GestureRecordingMotionEventDelegate(); mGestureHandler = new ContentViewGestureHandler( getInstrumentation().getTargetContext(), mockDelegate, mMockZoomManager); mLongPressDetector = new LongPressDetector( getInstrumentation().getTargetContext(), mGestureHandler); mGestureHandler.setTestDependencies(mLongPressDetector, null, null); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, time, time); mGestureHandler.onTouchEvent(event); mGestureHandler.sendShowPressedStateGestureForTesting(); assertEquals("A show pressed state event should have been sent", ContentViewGestureHandler.GESTURE_SHOW_PRESSED_STATE, mockDelegate.mMostRecentGestureEvent.mType); assertEquals("Only showPressedState and tapDown should have been sent", 2, mockDelegate.mGestureTypeList.size()); mLongPressDetector.startLongPressTimerIfNeeded(event); mLongPressDetector.sendLongPressGestureForTest(); assertEquals("Only should have sent only LONG_PRESS event", 3, mockDelegate.mGestureTypeList.size()); assertEquals("Should have a long press event next", ContentViewGestureHandler.GESTURE_LONG_PRESS, mockDelegate.mGestureTypeList.get(2).intValue()); // The long press triggers window focus loss by opening a context menu mGestureHandler.onWindowFocusLost(); assertEquals("Only should have sent only GESTURE_TAP_CANCEL event", 4, mockDelegate.mGestureTypeList.size()); assertEquals("Should have a gesture show press cancel event next", ContentViewGestureHandler.GESTURE_TAP_CANCEL, mockDelegate.mGestureTypeList.get(3).intValue()); } /** * Verify that a recent show pressed state gesture is canceled when scrolling begins. * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testShowPressCancelWhenScrollBegins() throws Exception { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); GestureRecordingMotionEventDelegate mockDelegate = new GestureRecordingMotionEventDelegate(); mGestureHandler = new ContentViewGestureHandler( getInstrumentation().getTargetContext(), mockDelegate, mMockZoomManager); mLongPressDetector = new LongPressDetector( getInstrumentation().getTargetContext(), mGestureHandler); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(mGestureHandler.onTouchEvent(event)); assertFalse("Should not have a pending LONG_PRESS", mLongPressDetector.hasPendingMessage()); mGestureHandler.sendShowPressedStateGestureForTesting(); assertEquals("A show pressed state event should have been sent", ContentViewGestureHandler.GESTURE_SHOW_PRESSED_STATE, mockDelegate.mMostRecentGestureEvent.mType); assertEquals("Only tapDown and showPressedState should have been sent", 2, mockDelegate.mGestureTypeList.size()); event = MotionEvent.obtain( downTime, eventTime + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 5, FAKE_COORD_Y * 5, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("We should have started scrolling", ContentViewGestureHandler.GESTURE_SCROLL_BY, mockDelegate.mMostRecentGestureEvent.mType); assertTrue("A show press cancel event should have been sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_TAP_CANCEL)); assertEquals("Only tapDown, showPressedState, showPressCancel, scrollBegin and scrollBy" + " should have been sent", 5, mockDelegate.mGestureTypeList.size()); event = MotionEvent.obtain( downTime, eventTime + 15, MotionEvent.ACTION_UP, FAKE_COORD_X * 10, FAKE_COORD_Y * 10, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("We should have started flinging", ContentViewGestureHandler.GESTURE_FLING_START, mockDelegate.mMostRecentGestureEvent.mType); assertTrue("A scroll end event should not have been sent", !mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_SCROLL_END)); assertEquals("The last up should have caused flingStart to be sent", 6, mockDelegate.mGestureTypeList.size()); } /** * Verify that double tap is correctly handled including the recent show pressed state gesture * cancellation. * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testDoubleTap() throws Exception { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); GestureRecordingMotionEventDelegate mockDelegate = new GestureRecordingMotionEventDelegate(); mGestureHandler = new ContentViewGestureHandler( getInstrumentation().getTargetContext(), mockDelegate, mMockZoomManager); mLongPressDetector = new LongPressDetector( getInstrumentation().getTargetContext(), mGestureHandler); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(mGestureHandler.onTouchEvent(event)); assertFalse("Should not have a pending LONG_PRESS", mLongPressDetector.hasPendingMessage()); mGestureHandler.sendShowPressedStateGestureForTesting(); assertEquals("GESTURE_SHOW_PRESSED_STATE should have been sent", ContentViewGestureHandler.GESTURE_SHOW_PRESSED_STATE, mockDelegate.mMostRecentGestureEvent.mType); assertEquals("Only GESTURE_TAP_DOWN and GESTURE_SHOW_PRESSED_STATE should have been sent", 2, mockDelegate.mGestureTypeList.size()); event = MotionEvent.obtain( downTime, eventTime + 5, MotionEvent.ACTION_UP, FAKE_COORD_X, FAKE_COORD_Y, 0); mGestureHandler.onTouchEvent(event); assertEquals("A GESTURE_SINGLE_TAP_UNCONFIRMED event should have been sent", ContentViewGestureHandler.GESTURE_SINGLE_TAP_UNCONFIRMED, mockDelegate.mMostRecentGestureEvent.mType); assertEquals("Only GESTURE_TAP_DOWN, " + "GESTURE_SHOW_PRESSED_STATE and " + "GESTURE_SINGLE_TAP_UNCONFIRMED should have been sent", 3, mockDelegate.mGestureTypeList.size()); event = MotionEvent.obtain( eventTime + 10, eventTime + 10, MotionEvent.ACTION_DOWN, FAKE_COORD_X, FAKE_COORD_Y, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("A GESTURE_TAP_DOWN event should have been sent ", ContentViewGestureHandler.GESTURE_TAP_DOWN, mockDelegate.mMostRecentGestureEvent.mType); assertEquals("Only GESTURE_TAP_DOWN, " + "GESTURE_SHOW_PRESSED_STATE, " + "GESTURE_SINGLE_TAP_UNCONFIRMED," + "GESTURE_TAP_CANCEL and" + "GESTURE_TAP_DOWN should have been sent", 5, mockDelegate.mGestureTypeList.size()); // Moving a very small amount of distance should not trigger the double tap drag zoom mode. event = MotionEvent.obtain( eventTime + 10, eventTime + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X, FAKE_COORD_Y + 1, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("Only GESTURE_TAP_DOWN, " + "GESTURE_SHOW_PRESSED_STATE, " + "GESTURE_SINGLE_TAP_UNCONFIRMED and" + "GESTURE_TAP_CANCEL and" + "GESTURE_TAP_DOWN should have been sent", 5, mockDelegate.mGestureTypeList.size()); event = MotionEvent.obtain( eventTime + 10, eventTime + 15, MotionEvent.ACTION_UP, FAKE_COORD_X, FAKE_COORD_Y + 1, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("A double tap should have occurred", ContentViewGestureHandler.GESTURE_DOUBLE_TAP, mockDelegate.mMostRecentGestureEvent.mType); assertEquals("Only GESTURE_TAP_DOWN, " + "GESTURE_SHOW_PRESSED_STATE, " + "GESTURE_SINGLE_TAP_UNCONFIRMED, " + "GESTURE_TAP_CANCEL, " + "GESTURE_TAP_DOWN, " + "GESTURE_DOUBLE_TAP should have been sent", 6, mockDelegate.mGestureTypeList.size()); } /** * Verify that double tap drag zoom feature is correctly executed. * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testDoubleTapDragZoom() throws Exception { final long downTime1 = SystemClock.uptimeMillis(); final long downTime2 = downTime1 + 100; GestureRecordingMotionEventDelegate mockDelegate = new GestureRecordingMotionEventDelegate(); mGestureHandler = new ContentViewGestureHandler( getInstrumentation().getTargetContext(), mockDelegate, mMockZoomManager); mLongPressDetector = new LongPressDetector( getInstrumentation().getTargetContext(), mGestureHandler); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime1, downTime1); assertTrue(mGestureHandler.onTouchEvent(event)); assertFalse("Should not have a pending LONG_PRESS", mLongPressDetector.hasPendingMessage()); mGestureHandler.sendShowPressedStateGestureForTesting(); assertEquals("GESTURE_SHOW_PRESSED_STATE should have been sent", ContentViewGestureHandler.GESTURE_SHOW_PRESSED_STATE, mockDelegate.mMostRecentGestureEvent.mType); assertEquals("Only GESTURE_TAP_DOWN and GESTURE_SHOW_PRESSED_STATE should have been sent", 2, mockDelegate.mGestureTypeList.size()); event = MotionEvent.obtain( downTime1, downTime1 + 5, MotionEvent.ACTION_UP, FAKE_COORD_X, FAKE_COORD_Y, 0); mGestureHandler.onTouchEvent(event); assertEquals("A GESTURE_SINGLE_TAP_UNCONFIRMED event should have been sent", ContentViewGestureHandler.GESTURE_SINGLE_TAP_UNCONFIRMED, mockDelegate.mMostRecentGestureEvent.mType); assertEquals("Only GESTURE_TAP_DOWN, " + "GESTURE_SHOW_PRESSED_STATE and " + "GESTURE_TAP_UNCONFIRMED " + "should have been sent", 3, mockDelegate.mGestureTypeList.size()); event = MotionEvent.obtain( downTime2, downTime2, MotionEvent.ACTION_DOWN, FAKE_COORD_X, FAKE_COORD_Y, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("GESTURE_TAP_DOWN should have been sent", ContentViewGestureHandler.GESTURE_TAP_DOWN, mockDelegate.mMostRecentGestureEvent.mType); assertEquals("Only GESTURE_TAP_DOWN, " + "GESTURE_SHOW_PRESSED_STATE, " + "GESTURE_TAP_UNCONFIRMED," + "GESTURE_TAP_CANCEL and" + "GESTURE_TAP_DOWN should have been sent", 5, mockDelegate.mGestureTypeList.size()); event = MotionEvent.obtain( downTime2, downTime2 + 5, MotionEvent.ACTION_MOVE, FAKE_COORD_X, FAKE_COORD_Y + 100, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue("GESTURE_SCROLL_START should have been sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_SCROLL_START)); assertEquals("GESTURE_PINCH_BEGIN should have been sent", ContentViewGestureHandler.GESTURE_PINCH_BEGIN, mockDelegate.mMostRecentGestureEvent.mType); assertEquals("Only GESTURE_TAP_DOWN, " + "GESTURE_SHOW_PRESSED_STATE, " + "GESTURE_TAP_UNCONFIRMED," + "GESTURE_TAP_CANCEL, " + "GESTURE_TAP_DOWN, " + "GESTURE_TAP_CANCEL, " + "GESTURE_SCROLL_START, and " + "GESTURE_PINCH_BEGIN should have been sent", 8, mockDelegate.mGestureTypeList.size()); event = MotionEvent.obtain( downTime2, downTime2 + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X, FAKE_COORD_Y + 200, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue("GESTURE_SCROLL_BY should have been sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_SCROLL_BY)); assertEquals("GESTURE_PINCH_BY should have been sent", ContentViewGestureHandler.GESTURE_PINCH_BY, mockDelegate.mMostRecentGestureEvent.mType); assertEquals("Only GESTURE_TAP_DOWN, " + "GESTURE_SHOW_PRESSED_STATE, " + "GESTURE_TAP_UNCONFIRMED," + "GESTURE_TAP_CANCEL, " + "GESTURE_TAP_DOWN, " + "GESTURE_TAP_CANCEL, " + "GESTURE_SCROLL_START," + "GESTURE_PINCH_BEGIN, " + "GESTURE_SCROLL_BY, and " + "GESTURE_PINCH_BY should have been sent", 10, mockDelegate.mGestureTypeList.size()); event = MotionEvent.obtain( downTime2, downTime2 + 15, MotionEvent.ACTION_UP, FAKE_COORD_X, FAKE_COORD_Y + 200, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue("GESTURE_PINCH_END should have been sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_PINCH_END)); assertEquals("GESTURE_SCROLL_END should have been sent", ContentViewGestureHandler.GESTURE_SCROLL_END, mockDelegate.mMostRecentGestureEvent.mType); assertEquals("Only GESTURE_TAP_DOWN, " + "GESTURE_SHOW_PRESSED_STATE, " + "GESTURE_TAP_UNCONFIRMED," + "GESTURE_TAP_CANCEL, " + "GESTURE_TAP_DOWN, " + "GESTURE_TAP_CANCEL, " + "GESTURE_SCROLL_START," + "GESTURE_PINCH_BEGIN, " + "GESTURE_SCROLL_BY," + "GESTURE_PINCH_BY, " + "GESTURE_PINCH_END, and " + "GESTURE_SCROLL_END should have been sent", 12, mockDelegate.mGestureTypeList.size()); } /** * Verify that double tap drag zoom feature is not invoked * when it is disabled.. * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testDoubleTapDragZoomNothingWhenDisabled() throws Exception { final long downTime1 = SystemClock.uptimeMillis(); final long downTime2 = downTime1 + 100; GestureRecordingMotionEventDelegate mockDelegate = new GestureRecordingMotionEventDelegate(); mGestureHandler = new ContentViewGestureHandler( getInstrumentation().getTargetContext(), mockDelegate, mMockZoomManager); mGestureHandler.updateDoubleTapSupport(false); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime1, downTime1); assertTrue(mGestureHandler.onTouchEvent(event)); event = MotionEvent.obtain( downTime1, downTime1 + 5, MotionEvent.ACTION_UP, FAKE_COORD_X, FAKE_COORD_Y, 0); mGestureHandler.onTouchEvent(event); event = MotionEvent.obtain( downTime2, downTime2, MotionEvent.ACTION_DOWN, FAKE_COORD_X, FAKE_COORD_Y, 0); assertTrue(mGestureHandler.onTouchEvent(event)); event = MotionEvent.obtain( downTime2, downTime2 + 5, MotionEvent.ACTION_MOVE, FAKE_COORD_X, FAKE_COORD_Y + 100, 0); // The move should become a scroll, as double tap and drag to zoom is // disabled. assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue("GESTURE_SCROLL_START should have been sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_SCROLL_START)); assertFalse("No GESTURE_PINCH_BEGIN should have been sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_PINCH_BEGIN)); event = MotionEvent.obtain( downTime2, downTime2 + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X, FAKE_COORD_Y + 200, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("GESTURE_SCROLL_BY should have been sent", ContentViewGestureHandler.GESTURE_SCROLL_BY, mockDelegate.mMostRecentGestureEvent.mType); assertEquals("GESTURE_SCROLL_BY should have been sent", event.getEventTime(), mockDelegate.mMostRecentGestureEvent.getTimeMs()); assertTrue("No GESTURE_PINCH_BY should have been sent", ContentViewGestureHandler.GESTURE_PINCH_BY != mockDelegate.mMostRecentGestureEvent.mType); event = MotionEvent.obtain( downTime2, downTime2 + 15, MotionEvent.ACTION_UP, FAKE_COORD_X, FAKE_COORD_Y + 200, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertFalse("No GESTURE_PINCH_END should have been sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_PINCH_END)); } /** * Mock MotionEventDelegate that remembers the most recent gesture event. */ static class GestureRecordingMotionEventDelegate implements MotionEventDelegate { static class GestureEvent { private final int mType; private final long mTimeMs; private final int mX; private final int mY; private final Bundle mExtraParams; public GestureEvent(int type, long timeMs, int x, int y, Bundle extraParams) { mType = type; mTimeMs = timeMs; mX = x; mY = y; mExtraParams = extraParams; } public int getType() { return mType; } public long getTimeMs() { return mTimeMs; } public int getX() { return mX; } public int getY() { return mY; } public Bundle getExtraParams() { return mExtraParams; } } private GestureEvent mMostRecentGestureEvent; private final ArrayList<Integer> mGestureTypeList = new ArrayList<Integer>(); private final ArrayList<Long> mGestureTimeList = new ArrayList<Long>(); @Override public boolean sendTouchEvent(long timeMs, int action, TouchPoint[] pts) { return true; } @Override public boolean sendGesture(int type, long timeMs, int x, int y, Bundle extraParams) { Log.i(TAG, "Gesture event received with type id " + type); mMostRecentGestureEvent = new GestureEvent(type, timeMs, x, y, extraParams); mGestureTypeList.add(mMostRecentGestureEvent.mType); mGestureTimeList.add(timeMs); return true; } @Override public void sendSingleTapUMA(int type) { // Not implemented. } @Override public void sendActionAfterDoubleTapUMA(int type, boolean clickDelayEnabled) { // Not implemented. } @Override public void invokeZoomPicker() { // Not implemented. } public GestureEvent getMostRecentGestureEvent() { return mMostRecentGestureEvent; } } /** * Generate a scroll gesture and verify that the resulting scroll motion event has both absolute * and relative position information. */ @SmallTest @Feature({"Gestures"}) public void testScrollUpdateCoordinates() { final int deltaX = 16; final int deltaY = 84; final long downTime = SystemClock.uptimeMillis(); GestureRecordingMotionEventDelegate delegate = new GestureRecordingMotionEventDelegate(); ContentViewGestureHandler gestureHandler = new ContentViewGestureHandler( getInstrumentation().getTargetContext(), delegate, mMockZoomManager); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(gestureHandler.onTouchEvent(event)); // Move twice, because the first move gesture is discarded. event = MotionEvent.obtain( downTime, downTime + 5, MotionEvent.ACTION_MOVE, FAKE_COORD_X - deltaX / 2, FAKE_COORD_Y - deltaY / 2, 0); assertTrue(gestureHandler.onTouchEvent(event)); event = MotionEvent.obtain( downTime, downTime + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X - deltaX, FAKE_COORD_Y - deltaY, 0); assertTrue(gestureHandler.onTouchEvent(event)); // Make sure the reported gesture event has all the expected data. GestureRecordingMotionEventDelegate.GestureEvent gestureEvent = delegate.getMostRecentGestureEvent(); assertNotNull(gestureEvent); assertEquals(ContentViewGestureHandler.GESTURE_SCROLL_BY, gestureEvent.getType()); assertEquals(downTime + 10, gestureEvent.getTimeMs()); assertEquals(FAKE_COORD_X - deltaX, gestureEvent.getX()); assertEquals(FAKE_COORD_Y - deltaY, gestureEvent.getY()); Bundle extraParams = gestureEvent.getExtraParams(); assertNotNull(extraParams); // No horizontal delta because of snapping. assertEquals(0, extraParams.getInt(ContentViewGestureHandler.DISTANCE_X)); assertEquals(deltaY / 2, extraParams.getInt(ContentViewGestureHandler.DISTANCE_Y)); } /** * Verify that the timer of LONG_PRESS will be cancelled when scrolling begins so * LONG_PRESS and LONG_TAP won't be triggered. * * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testLongPressAndTapCancelWhenScrollBegins() throws Exception { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); GestureRecordingMotionEventDelegate mockDelegate = new GestureRecordingMotionEventDelegate(); mGestureHandler = new ContentViewGestureHandler( getInstrumentation().getTargetContext(), mockDelegate, mMockZoomManager); mLongPressDetector = mGestureHandler.getLongPressDetector(); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue("Should have a pending LONG_PRESS", mLongPressDetector.hasPendingMessage()); event = MotionEvent.obtain( downTime, eventTime + 5, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 5, FAKE_COORD_Y * 5, 0); assertTrue(mGestureHandler.onTouchEvent(event)); event = MotionEvent.obtain( downTime, eventTime + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 10, FAKE_COORD_Y * 10, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue("Should not have a pending LONG_PRESS", !mLongPressDetector.hasPendingMessage()); // No LONG_TAP because LONG_PRESS timer is cancelled. assertFalse("No LONG_PRESS should be sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_LONG_PRESS)); assertFalse("No LONG_TAP should be sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_LONG_TAP)); } /** * Verifies that when hasTouchEventHandlers changes while in a gesture, that the pending * queue does not grow continually. */ @SmallTest @Feature({"Gestures"}) public void testHasTouchEventHandlersChangesInGesture() { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); mGestureHandler = new ContentViewGestureHandler( getInstrumentation().getTargetContext(), new MockMotionEventDelegate(), mMockZoomManager); mLongPressDetector = new LongPressDetector( getInstrumentation().getTargetContext(), mGestureHandler); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(0, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); assertFalse("Should not have a pending LONG_PRESS", mLongPressDetector.hasPendingMessage()); event = MotionEvent.obtain( downTime, eventTime + 5, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 5, FAKE_COORD_Y * 5, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(0, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); mGestureHandler.hasTouchEventHandlers(true); event = MotionEvent.obtain( downTime, eventTime + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 10, FAKE_COORD_Y * 10, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(0, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = MotionEvent.obtain( downTime, eventTime + 15, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 15, FAKE_COORD_Y * 15, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(0, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); } /** * Verify that LONG_TAP is triggered after LongPress followed by an UP. * * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testGestureLongTap() throws Exception { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); GestureRecordingMotionEventDelegate mockDelegate = new GestureRecordingMotionEventDelegate(); mGestureHandler = new ContentViewGestureHandler( getInstrumentation().getTargetContext(), mockDelegate, mMockZoomManager); mLongPressDetector = mGestureHandler.getLongPressDetector(); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue("Should have a pending LONG_PRESS", mLongPressDetector.hasPendingMessage()); mLongPressDetector.sendLongPressGestureForTest(); assertEquals("A LONG_PRESS gesture should have been sent", ContentViewGestureHandler.GESTURE_LONG_PRESS, mockDelegate.mMostRecentGestureEvent.mType); event = motionEvent(MotionEvent.ACTION_UP, downTime, eventTime + 1000); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("A LONG_TAP gesture should have been sent", ContentViewGestureHandler.GESTURE_LONG_TAP, mockDelegate.mMostRecentGestureEvent.mType); } /** * Verify that the touch slop region is removed from the first scroll delta to avoid a jump when * starting to scroll. * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testTouchSlopRemovedFromScroll() throws Exception { Context context = getInstrumentation().getTargetContext(); final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); final int scaledTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); final int scrollDelta = 5; GestureRecordingMotionEventDelegate mockDelegate = new GestureRecordingMotionEventDelegate(); mGestureHandler = new ContentViewGestureHandler( context, mockDelegate, mMockZoomManager); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(mGestureHandler.onTouchEvent(event)); event = MotionEvent.obtain( downTime, eventTime + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X, FAKE_COORD_Y + scaledTouchSlop + scrollDelta, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("We should have started scrolling", ContentViewGestureHandler.GESTURE_SCROLL_BY, mockDelegate.mMostRecentGestureEvent.mType); GestureRecordingMotionEventDelegate.GestureEvent gestureEvent = mockDelegate.getMostRecentGestureEvent(); assertNotNull(gestureEvent); Bundle extraParams = gestureEvent.getExtraParams(); assertEquals(0, extraParams.getInt(ContentViewGestureHandler.DISTANCE_X)); assertEquals(-scrollDelta, extraParams.getInt(ContentViewGestureHandler.DISTANCE_Y)); } /** * Verify that touch moves are deferred if they are within the touch slop region * and the touch sequence is not being consumed. * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testTouchMoveWithinTouchSlopDeferred() throws Exception { Context context = getInstrumentation().getTargetContext(); final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); final int scaledTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); final int lessThanSlopScrollDelta = scaledTouchSlop / 2; final int greaterThanSlopScrollDelta = scaledTouchSlop * 2; mGestureHandler.hasTouchEventHandlers(true); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("The touch down should have been forwarded", TouchPoint.TOUCH_EVENT_TYPE_START, mMockMotionEventDelegate.mLastTouchAction); assertEquals(1, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = MotionEvent.obtain( downTime, eventTime + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X, FAKE_COORD_Y + lessThanSlopScrollDelta, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(2, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_NOT_CONSUMED); assertEquals("The less-than-slop touch move should not have been forwarded", TouchPoint.TOUCH_EVENT_TYPE_START, mMockMotionEventDelegate.mLastTouchAction); assertEquals(0, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = MotionEvent.obtain( downTime, eventTime + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X, FAKE_COORD_Y + greaterThanSlopScrollDelta, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("The touch move should have been forwarded", TouchPoint.TOUCH_EVENT_TYPE_MOVE, mMockMotionEventDelegate.mLastTouchAction); mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_NOT_CONSUMED); assertEquals(0, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); } /** * Verify that touch moves are not deferred even if they are within the touch slop region * when the touch sequence is being consumed. * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testTouchMoveWithinTouchSlopNotDeferredIfJavascriptConsumingGesture() throws Exception { Context context = getInstrumentation().getTargetContext(); final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); final int scaledTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); final int lessThanSlopScrollDelta = scaledTouchSlop / 2; mGestureHandler.hasTouchEventHandlers(true); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("The touch down should have been forwarded", TouchPoint.TOUCH_EVENT_TYPE_START, mMockMotionEventDelegate.mLastTouchAction); assertEquals(1, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = MotionEvent.obtain( downTime, eventTime + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X, FAKE_COORD_Y + lessThanSlopScrollDelta, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(2, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_CONSUMED); assertEquals("The less-than-slop touch move should have been forwarded", TouchPoint.TOUCH_EVENT_TYPE_MOVE, mMockMotionEventDelegate.mLastTouchAction); } private static void sendLastScrollByEvent(ContentViewGestureHandler handler) { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(handler.onTouchEvent(event)); event = MotionEvent.obtain( downTime, eventTime + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X, FAKE_COORD_Y + 30, 0); assertTrue(handler.onTouchEvent(event)); } private static void sendLastZoomEvent( ContentViewGestureHandler handler, MockZoomManager zoomManager) { zoomManager.pinchOnMoveEvents(handler); final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(handler.onTouchEvent(event)); event = MotionEvent.obtain( downTime, eventTime + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X, FAKE_COORD_Y + 30, 0); assertTrue(handler.onTouchEvent(event)); } private static void sendLastPinchEvent(ContentViewGestureHandler handler) { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); handler.pinchBegin(downTime, FAKE_COORD_X, FAKE_COORD_Y); handler.pinchBy(eventTime + 10, FAKE_COORD_X, FAKE_COORD_Y, 2); } /** * Verify that a DOWN followed shortly by an UP will trigger * a GESTURE_SINGLE_TAP_UNCONFIRMED event immediately. * * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testGestureEventsSingleTapUnconfirmed() throws Exception { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); GestureRecordingMotionEventDelegate mockDelegate = new GestureRecordingMotionEventDelegate(); mGestureHandler = new ContentViewGestureHandler( getInstrumentation().getTargetContext(), mockDelegate, mMockZoomManager); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("A TAP_DOWN gesture should have been sent", ContentViewGestureHandler.GESTURE_TAP_DOWN, mockDelegate.mMostRecentGestureEvent.mType); event = motionEvent(MotionEvent.ACTION_UP, downTime, eventTime + 10); assertFalse(mGestureHandler.onTouchEvent(event)); assertEquals("A GESTURE_SINGLE_TAP_UNCONFIRMED gesture should have been sent", ContentViewGestureHandler.GESTURE_SINGLE_TAP_UNCONFIRMED, mockDelegate.mMostRecentGestureEvent.mType); assertTrue("Should not have confirmed a single tap yet", mMockListener.mLastSingleTap == null); } /** * Verify that a tap-ending event will follow a TAP_DOWN event. * * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testTapDownFollowedByTapEndingEvent() throws Exception { long downTime = SystemClock.uptimeMillis(); long eventTime = SystemClock.uptimeMillis(); GestureRecordingMotionEventDelegate mockDelegate = new GestureRecordingMotionEventDelegate(); mGestureHandler = new ContentViewGestureHandler( getInstrumentation().getTargetContext(), mockDelegate, mMockZoomManager); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(ContentViewGestureHandler.GESTURE_TAP_DOWN, mockDelegate.mMostRecentGestureEvent.mType); assertTrue(mGestureHandler.needsTapEndingEventForTesting()); event = motionEvent(MotionEvent.ACTION_UP, downTime, eventTime + 5); assertFalse(mGestureHandler.onTouchEvent(event)); assertEquals(ContentViewGestureHandler.GESTURE_SINGLE_TAP_UNCONFIRMED, mockDelegate.mMostRecentGestureEvent.mType); assertTrue("An unconfirmed tap does not terminate the tap down.", mGestureHandler.needsTapEndingEventForTesting()); // A confirmed tap is a tap-ending event. downTime += 20; eventTime += 20; mockDelegate.mGestureTypeList.clear(); mGestureHandler.updateShouldDisableDoubleTap(true); event = MotionEvent.obtain( downTime, downTime, MotionEvent.ACTION_DOWN, FAKE_COORD_X, FAKE_COORD_Y, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue(mGestureHandler.needsTapEndingEventForTesting()); event = MotionEvent.obtain( downTime, eventTime + 5, MotionEvent.ACTION_UP, FAKE_COORD_X, FAKE_COORD_Y, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(ContentViewGestureHandler.GESTURE_SINGLE_TAP_CONFIRMED, mockDelegate.mMostRecentGestureEvent.mType); assertFalse("A confirmed single tap should terminate the tap down.", mGestureHandler.needsTapEndingEventForTesting()); // A double tap gesture is a tap-ending event. downTime += 20; eventTime += 20; mockDelegate.mGestureTypeList.clear(); mGestureHandler.updateShouldDisableDoubleTap(false); event = MotionEvent.obtain( downTime, downTime, MotionEvent.ACTION_DOWN, FAKE_COORD_X, FAKE_COORD_Y, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue(mGestureHandler.needsTapEndingEventForTesting()); event = MotionEvent.obtain( downTime, eventTime + 5, MotionEvent.ACTION_UP, FAKE_COORD_X, FAKE_COORD_Y, 0); event = MotionEvent.obtain( eventTime + 10, eventTime + 10, MotionEvent.ACTION_DOWN, FAKE_COORD_X, FAKE_COORD_Y, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue(mGestureHandler.needsTapEndingEventForTesting()); event = MotionEvent.obtain( eventTime + 10, eventTime + 15, MotionEvent.ACTION_UP, FAKE_COORD_X, FAKE_COORD_Y, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(ContentViewGestureHandler.GESTURE_DOUBLE_TAP, mockDelegate.mMostRecentGestureEvent.mType); assertFalse("A double tap should terminate the tap down.", mGestureHandler.needsTapEndingEventForTesting()); // A double tap drag gesture will trigger a tap-ending event. downTime += 20; eventTime += 20; mockDelegate.mGestureTypeList.clear(); mGestureHandler.updateShouldDisableDoubleTap(false); event = MotionEvent.obtain( downTime, downTime, MotionEvent.ACTION_DOWN, FAKE_COORD_X, FAKE_COORD_Y, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue(mGestureHandler.needsTapEndingEventForTesting()); event = MotionEvent.obtain( downTime, eventTime + 5, MotionEvent.ACTION_UP, FAKE_COORD_X, FAKE_COORD_Y, 0); event = MotionEvent.obtain( eventTime + 10, eventTime + 10, MotionEvent.ACTION_DOWN, FAKE_COORD_X, FAKE_COORD_Y, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue(mGestureHandler.needsTapEndingEventForTesting()); event = MotionEvent.obtain( eventTime + 10, eventTime + 15, MotionEvent.ACTION_MOVE, FAKE_COORD_X, FAKE_COORD_Y + 100, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertFalse("A double tap drag should terminate the tap down.", mGestureHandler.needsTapEndingEventForTesting()); assertTrue(mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_SCROLL_START)); assertTrue(mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_TAP_CANCEL)); event = MotionEvent.obtain( eventTime + 10, eventTime + 20, MotionEvent.ACTION_UP, FAKE_COORD_X, FAKE_COORD_Y, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertFalse(mGestureHandler.needsTapEndingEventForTesting()); // A scroll event will trigger a tap-ending (cancel) event. downTime += 25; eventTime += 25; mockDelegate.mGestureTypeList.clear(); event = MotionEvent.obtain( downTime, downTime, MotionEvent.ACTION_DOWN, FAKE_COORD_X, FAKE_COORD_Y, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue(mGestureHandler.needsTapEndingEventForTesting()); event = MotionEvent.obtain( downTime, eventTime + 5, MotionEvent.ACTION_MOVE, FAKE_COORD_X, FAKE_COORD_Y + 100, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue(mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_SCROLL_START)); assertTrue(mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_TAP_CANCEL)); assertFalse("A scroll should terminate the tap down.", mGestureHandler.needsTapEndingEventForTesting()); assertFalse(mGestureHandler.needsTapEndingEventForTesting()); } /** * Verify that touch move events are properly coalesced. * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testTouchMoveCoalescing() throws Exception { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); mGestureHandler.hasTouchEventHandlers(true); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(mGestureHandler.onTouchEvent(event)); mGestureHandler.confirmTouchEvent(ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_CONSUMED); assertEquals(TouchPoint.TOUCH_EVENT_TYPE_START, mMockMotionEventDelegate.mLastTouchAction); event = MotionEvent.obtain( downTime, eventTime + 5, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 5, FAKE_COORD_Y * 5, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertFalse("Should not have a pending LONG_PRESS", mLongPressDetector.hasPendingMessage()); assertEquals("Initial move events should offered to javascript and added to the queue", 1, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); assertEquals(TouchPoint.TOUCH_EVENT_TYPE_MOVE, mMockMotionEventDelegate.mLastTouchAction); event = MotionEvent.obtain( downTime, eventTime + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 10, FAKE_COORD_Y * 10, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("Move events already sent to javascript should not be coalesced", 2, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = MotionEvent.obtain( downTime, eventTime + 15, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 15, FAKE_COORD_Y * 15, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("Similar pending move events should be coalesced", 2, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); PointerProperties pp1 = new PointerProperties(); pp1.id = 0; pp1.toolType = MotionEvent.TOOL_TYPE_FINGER; PointerProperties pp2 = new PointerProperties(); pp2.id = 1; pp2.toolType = MotionEvent.TOOL_TYPE_FINGER; PointerProperties[] properties = new PointerProperties[] { pp1, pp2 }; PointerCoords pc1 = new PointerCoords(); pc1.x = FAKE_COORD_X * 10; pc1.y = FAKE_COORD_Y * 10; pc1.pressure = 1; pc1.size = 1; PointerCoords pc2 = new PointerCoords(); pc2.x = FAKE_COORD_X * 15; pc2.y = FAKE_COORD_Y * 15; pc2.pressure = 1; pc2.size = 1; PointerCoords[] coords = new PointerCoords[] { pc1, pc2 }; event = MotionEvent.obtain( downTime, eventTime + 20, MotionEvent.ACTION_MOVE, 2, properties, coords, 0, 0, 1.0f, 1.0f, 0, 0, 0, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("Move events with different pointer counts should not be coalesced", 3, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = MotionEvent.obtain( downTime, eventTime + 25, MotionEvent.ACTION_MOVE, 2, properties, coords, 0, 0, 1.0f, 1.0f, 0, 0, 0, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("Move events with similar pointer counts should be coalesced", 3, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("Move events should not be coalesced with other events", 4, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); } /** * Verify that synchronous confirmTouchEvent() calls made from the MotionEventDelegate behave * properly. * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testSynchronousConfirmTouchEvent() throws Exception { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); mGestureHandler.hasTouchEventHandlers(true); mMockMotionEventDelegate.disableSynchronousConfirmTouchEvent(); // Queue an asynchronously handled event. MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(1, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); // Queue another event; this will remain in the queue until the first event is confirmed. event = MotionEvent.obtain( downTime, eventTime + 5, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 10, FAKE_COORD_Y * 10, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(2, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); // Enable synchronous event confirmation upon dispatch. mMockMotionEventDelegate.enableSynchronousConfirmTouchEvent( mGestureHandler, ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_CONSUMED); // Confirm the original event; this should dispatch the second event and confirm it // synchronously. mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_CONSUMED); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(0, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); assertEquals(TouchPoint.TOUCH_EVENT_TYPE_MOVE, mMockMotionEventDelegate.mLastTouchAction); // Adding events to any empty queue will trigger synchronous dispatch and confirmation. event = MotionEvent.obtain( downTime, eventTime + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 5, FAKE_COORD_Y * 5, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(0, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); } /** * Verify that no double tap gestures are created if the gesture handler is * told to disable double tap gesture detection (according to the logic in * ContentViewCore.onRenderCoordinatesUpdated). * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testNoDoubleTapWhenDoubleTapDisabled() throws Exception { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); GestureRecordingMotionEventDelegate mockDelegate = new GestureRecordingMotionEventDelegate(); mGestureHandler = new ContentViewGestureHandler( getInstrumentation().getTargetContext(), mockDelegate, mMockZoomManager); mGestureHandler.updateShouldDisableDoubleTap(true); MotionEvent event = MotionEvent.obtain( downTime, downTime, MotionEvent.ACTION_DOWN, FAKE_COORD_X, FAKE_COORD_Y, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("Only GESTURE_TAP_DOWN should have been sent", 1, mockDelegate.mGestureTypeList.size()); event = MotionEvent.obtain( downTime, eventTime + 5, MotionEvent.ACTION_UP, FAKE_COORD_X, FAKE_COORD_Y, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("A GESTURE_SINGLE_TAP_CONFIRMED event should have been sent", ContentViewGestureHandler.GESTURE_SINGLE_TAP_CONFIRMED, mockDelegate.mMostRecentGestureEvent.mType); assertEquals("Only GESTURE_TAP_DOWN and GESTURE_SINGLE_TAP_CONFIRMED " + "should have been sent", 2, mockDelegate.mGestureTypeList.size()); event = MotionEvent.obtain( eventTime + 10, eventTime + 10, MotionEvent.ACTION_DOWN, FAKE_COORD_X, FAKE_COORD_Y, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("Only GESTURE_TAP_DOWN, " + "GESTURE_SINGLE_TAP_CONFIRMED and " + "GESTURE_TAP_DOWN should have been sent", 3, mockDelegate.mGestureTypeList.size()); event = MotionEvent.obtain( eventTime + 10, eventTime + 15, MotionEvent.ACTION_UP, FAKE_COORD_X, FAKE_COORD_Y, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("A double tap should not have occurred", ContentViewGestureHandler.GESTURE_SINGLE_TAP_CONFIRMED, mockDelegate.mMostRecentGestureEvent.mType); assertEquals("Only GESTURE_TAP_DOWN, " + "GESTURE_SINGLE_TAP_CONFIRMED, " + "GESTURE_TAP_DOWN and " + "GESTURE_SINGLE_TAP_CONFIRMED should have been sent", 4, mockDelegate.mGestureTypeList.size()); } /** * Verify that double tap drag zoom feature is not invoked when the gesture * handler is told to disable double tap gesture detection (according to the * logic in ContentViewCore.onRenderCoordinatesUpdated). * The second tap sequence should be treated just as the first would be. * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testNoDoubleTapDragZoomWhenDoubleTapDisabled() throws Exception { final long downTime1 = SystemClock.uptimeMillis(); final long downTime2 = downTime1 + 100; GestureRecordingMotionEventDelegate mockDelegate = new GestureRecordingMotionEventDelegate(); mGestureHandler = new ContentViewGestureHandler( getInstrumentation().getTargetContext(), mockDelegate, mMockZoomManager); mGestureHandler.updateShouldDisableDoubleTap(true); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime1, downTime1); assertTrue(mGestureHandler.onTouchEvent(event)); event = MotionEvent.obtain( downTime1, downTime1 + 5, MotionEvent.ACTION_UP, FAKE_COORD_X, FAKE_COORD_Y, 0); mGestureHandler.onTouchEvent(event); event = MotionEvent.obtain( downTime2, downTime2, MotionEvent.ACTION_DOWN, FAKE_COORD_X, FAKE_COORD_Y, 0); assertTrue(mGestureHandler.onTouchEvent(event)); event = MotionEvent.obtain( downTime2, downTime2 + 5, MotionEvent.ACTION_MOVE, FAKE_COORD_X, FAKE_COORD_Y + 100, 0); // The move should become a scroll, as double tap and drag to zoom is // disabled. assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue("GESTURE_SCROLL_START should have been sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_SCROLL_START)); assertFalse("No GESTURE_PINCH_BEGIN should have been sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_PINCH_BEGIN)); event = MotionEvent.obtain( downTime2, downTime2 + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X, FAKE_COORD_Y + 200, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals("GESTURE_SCROLL_BY should have been sent", ContentViewGestureHandler.GESTURE_SCROLL_BY, mockDelegate.mMostRecentGestureEvent.mType); assertEquals("GESTURE_SCROLL_BY should have been sent", event.getEventTime(), mockDelegate.mMostRecentGestureEvent.getTimeMs()); assertTrue("No GESTURE_PINCH_BY should have been sent", ContentViewGestureHandler.GESTURE_PINCH_BY != mockDelegate.mMostRecentGestureEvent.mType); event = MotionEvent.obtain( downTime2, downTime2 + 15, MotionEvent.ACTION_UP, FAKE_COORD_X, FAKE_COORD_Y + 200, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertFalse("No GESTURE_PINCH_END should have been sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_PINCH_END)); } /** * Verify that setting a fixed page scale (or a mobile viewport) during a double * tap drag zoom disables double tap detection after the gesture has ended. * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testFixedPageScaleDuringDoubleTapDragZoom() throws Exception { long downTime1 = SystemClock.uptimeMillis(); long downTime2 = downTime1 + 100; GestureRecordingMotionEventDelegate mockDelegate = new GestureRecordingMotionEventDelegate(); mGestureHandler = new ContentViewGestureHandler( getInstrumentation().getTargetContext(), mockDelegate, mMockZoomManager); mLongPressDetector = new LongPressDetector( getInstrumentation().getTargetContext(), mGestureHandler); // Start a double-tap drag gesture. MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime1, downTime1); assertTrue(mGestureHandler.onTouchEvent(event)); mGestureHandler.sendShowPressedStateGestureForTesting(); event = MotionEvent.obtain( downTime1, downTime1 + 5, MotionEvent.ACTION_UP, FAKE_COORD_X, FAKE_COORD_Y, 0); mGestureHandler.onTouchEvent(event); event = MotionEvent.obtain( downTime2, downTime2, MotionEvent.ACTION_DOWN, FAKE_COORD_X, FAKE_COORD_Y, 0); assertTrue(mGestureHandler.onTouchEvent(event)); event = MotionEvent.obtain( downTime2, downTime2 + 5, MotionEvent.ACTION_MOVE, FAKE_COORD_X, FAKE_COORD_Y + 100, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue("GESTURE_SCROLL_START should have been sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_SCROLL_START)); assertEquals("GESTURE_PINCH_BEGIN should have been sent", ContentViewGestureHandler.GESTURE_PINCH_BEGIN, mockDelegate.mMostRecentGestureEvent.mType); // Simulate setting a fixed page scale (or a mobile viewport); // this should not disrupt the current double-tap gesture. mGestureHandler.updateShouldDisableDoubleTap(true); // Double tap zoom updates should continue. event = MotionEvent.obtain( downTime2, downTime2 + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X, FAKE_COORD_Y + 200, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue("GESTURE_SCROLL_BY should have been sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_SCROLL_BY)); assertEquals("GESTURE_PINCH_BY should have been sent", ContentViewGestureHandler.GESTURE_PINCH_BY, mockDelegate.mMostRecentGestureEvent.mType); event = MotionEvent.obtain( downTime2, downTime2 + 15, MotionEvent.ACTION_UP, FAKE_COORD_X, FAKE_COORD_Y + 200, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue("GESTURE_PINCH_END should have been sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_PINCH_END)); assertEquals("GESTURE_SCROLL_END should have been sent", ContentViewGestureHandler.GESTURE_SCROLL_END, mockDelegate.mMostRecentGestureEvent.mType); // The double-tap gesture has finished, but the page scale is fixed. // The same event sequence should not generate any double tap getsures. mockDelegate.mGestureTypeList.clear(); downTime1 += 200; downTime2 += 200; // Start a double-tap drag gesture. event = motionEvent(MotionEvent.ACTION_DOWN, downTime1, downTime1); assertTrue(mGestureHandler.onTouchEvent(event)); event = MotionEvent.obtain( downTime1, downTime1 + 5, MotionEvent.ACTION_UP, FAKE_COORD_X, FAKE_COORD_Y, 0); mGestureHandler.onTouchEvent(event); event = MotionEvent.obtain( downTime2, downTime2, MotionEvent.ACTION_DOWN, FAKE_COORD_X, FAKE_COORD_Y, 0); assertTrue(mGestureHandler.onTouchEvent(event)); event = MotionEvent.obtain( downTime2, downTime2 + 5, MotionEvent.ACTION_MOVE, FAKE_COORD_X, FAKE_COORD_Y + 100, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue("GESTURE_SCROLL_START should have been sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_SCROLL_START)); assertFalse("GESTURE_PINCH_BEGIN should not have been sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_PINCH_BEGIN)); // Double tap zoom updates should not be sent. // Instead, the second tap drag becomes a scroll gesture sequence. event = MotionEvent.obtain( downTime2, downTime2 + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X, FAKE_COORD_Y + 200, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertTrue("GESTURE_SCROLL_BY should have been sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_SCROLL_BY)); assertFalse("GESTURE_PINCH_BY should not have been sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_PINCH_BY)); event = MotionEvent.obtain( downTime2, downTime2 + 15, MotionEvent.ACTION_UP, FAKE_COORD_X, FAKE_COORD_Y + 200, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertFalse("GESTURE_PINCH_END should not have been sent", mockDelegate.mGestureTypeList.contains( ContentViewGestureHandler.GESTURE_PINCH_END)); } /** * Verify that a secondary pointer press with no consumer does not interfere * with Javascript touch handling. * * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testSecondaryPointerWithNoConsumer() throws Exception { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); mGestureHandler.hasTouchEventHandlers(true); // Queue a primary pointer press, a secondary pointer press and release, // and a primary pointer move. MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(1, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = motionEvent(MotionEvent.ACTION_POINTER_DOWN, downTime, eventTime); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(2, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = motionEvent(MotionEvent.ACTION_POINTER_UP, downTime, eventTime + 10); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(3, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = MotionEvent.obtain( downTime, eventTime + 15, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 5, FAKE_COORD_Y * 5, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(4, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); // Simulate preventDefault from Javascript, forcing all touch events to Javascript // for the current sequence. mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_CONSUMED); assertEquals(3, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); assertEquals("Even if the secondary pointer has no consumer, continue sending events", 2, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); assertEquals("Even if the secondary pointer has no consumer, continue sending events", 1, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_NOT_CONSUMED); assertEquals(0, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); assertEquals("No gestures should result from the Javascript-consumed sequence", 0, mMockMotionEventDelegate.mTotalSentGestureCount); } /** * Verify that multiple touch sequences in the queue are handled properly when * the Javascript response is different for each. * * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testMultiplyEnqueuedTouches() throws Exception { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); mGestureHandler.hasTouchEventHandlers(true); mGestureHandler.updateDoubleTapSupport(false); // Queue a tap sequence. MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(1, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = motionEvent(MotionEvent.ACTION_UP, downTime, eventTime + 5); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(2, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); // Queue a scroll sequence. event = motionEvent(MotionEvent.ACTION_DOWN, downTime + 10, downTime + 10); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(3, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = MotionEvent.obtain( downTime + 10, eventTime + 15, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 5, FAKE_COORD_Y * 5, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertFalse(mGestureHandler.isNativeScrolling()); assertEquals(4, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = motionEvent(MotionEvent.ACTION_UP, downTime + 10, downTime + 20); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(5, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); // Consume the first gesture. mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_CONSUMED); assertEquals(4, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_CONSUMED); assertEquals(3, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); // Don't consume the second gesture; it should be fed to the gesture detector. mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_NOT_CONSUMED); assertEquals(2, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); assertEquals("The down touch event should have been sent to the gesture detector", MotionEvent.ACTION_DOWN, mMockGestureDetector.mLastEvent.getActionMasked()); assertFalse(mGestureHandler.isNativeScrolling()); mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_NOT_CONSUMED); assertEquals("The move touch event should have been sent to the gesture detector", MotionEvent.ACTION_MOVE, mMockGestureDetector.mLastEvent.getActionMasked()); } /** * Verify that only complete gestures are forwarded to Javascript if we receive * a touch handler notification. * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testOnlyCompleteGesturesForwardedToTouchHandler() throws Exception { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); mGestureHandler.hasTouchEventHandlers(false); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); mGestureHandler.onTouchEvent(event); assertEquals("Initial down events should not be sent to Javascript without a touch handler", 0, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); assertTrue("Should have a pending gesture", mMockGestureDetector.mLastEvent != null); mMockGestureDetector.mLastEvent = null; mGestureHandler.hasTouchEventHandlers(true); event = MotionEvent.obtain( downTime, eventTime + 5, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 5, FAKE_COORD_Y * 5, 0); mGestureHandler.onTouchEvent(event); assertEquals("A move event should only be offered to javascript if the down was offered", 0, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); assertTrue("Should have a pending gesture", mMockGestureDetector.mLastEvent != null); event = motionEvent(MotionEvent.ACTION_POINTER_DOWN, downTime, eventTime + 10); mGestureHandler.onTouchEvent(event); assertEquals("A pointer event should only be offered to Javascript if the down was offered", 0, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); // Ensure that redundant notifications have no effect. mGestureHandler.hasTouchEventHandlers(true); event = motionEvent(MotionEvent.ACTION_POINTER_UP, downTime, eventTime + 15); mGestureHandler.onTouchEvent(event); assertEquals("A pointer event should only be offered to Javascript if the down was offered", 0, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = motionEvent(MotionEvent.ACTION_UP, downTime, eventTime + 20); mGestureHandler.onTouchEvent(event); assertEquals("A pointer event should only be offered to Javascript if the down was offered", 0, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = motionEvent(MotionEvent.ACTION_DOWN, downTime + 25, downTime + 25); mGestureHandler.onTouchEvent(event); assertEquals("A down event should be offered to Javascript with a registered touch handler", 1, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); } /** * Verify that no timeout-based gestures are triggered after a touch event * is consumed. In particular, LONG_PRESS and SHOW_PRESS should not fire * if TouchStart went unconsumed, but subsequent TouchMoves are consumed. * * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testNoTimeoutGestureAfterTouchConsumed() throws Exception { getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { setUp(); final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); mGestureHandler.hasTouchEventHandlers(true); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, eventTime); assertTrue(mGestureHandler.onTouchEvent(event)); mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_NOT_CONSUMED); assertTrue("Should have a pending LONG_PRESS", mLongPressDetector.hasPendingMessage()); event = MotionEvent.obtain( downTime, eventTime + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X, FAKE_COORD_Y + 200, 0); assertTrue(mGestureHandler.onTouchEvent(event)); mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_CONSUMED); assertFalse("Should not have a pending LONG_PRESS", mLongPressDetector.hasPendingMessage()); } }); assertFalse(mMockListener.mShowPressCalled.await( ScalableTimeout.ScaleTimeout(ViewConfiguration.getTapTimeout() + 10), TimeUnit.MILLISECONDS)); assertFalse(mMockListener.mLongPressCalled.await( ScalableTimeout.ScaleTimeout(ViewConfiguration.getLongPressTimeout() + 10), TimeUnit.MILLISECONDS)); } /** * Verify that a TAP_DOWN will be followed by a TAP_CANCEL if the first * touch is unconsumed, but the subsequent touch is consumed. * * @throws Exception */ @SmallTest @Feature({"Gestures"}) public void testTapCancelledAfterTouchConsumed() throws Exception { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); GestureRecordingMotionEventDelegate mockDelegate = new GestureRecordingMotionEventDelegate(); mGestureHandler = new ContentViewGestureHandler( getInstrumentation().getTargetContext(), mockDelegate, mMockZoomManager); mGestureHandler.hasTouchEventHandlers(true); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(mGestureHandler.onTouchEvent(event)); mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_NOT_CONSUMED); assertEquals("A TAP_DOWN gesture should have been sent", ContentViewGestureHandler.GESTURE_TAP_DOWN, mockDelegate.mMostRecentGestureEvent.mType); event = MotionEvent.obtain( downTime, eventTime + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X, FAKE_COORD_Y + 200, 0); assertTrue(mGestureHandler.onTouchEvent(event)); mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_CONSUMED); assertEquals("A TAP_CANCEL gesture should have been sent", ContentViewGestureHandler.GESTURE_TAP_CANCEL, mockDelegate.mMostRecentGestureEvent.mType); event = MotionEvent.obtain( downTime, eventTime + 15, MotionEvent.ACTION_MOVE, FAKE_COORD_X, FAKE_COORD_Y + 400, 0); assertTrue(mGestureHandler.onTouchEvent(event)); mGestureHandler.confirmTouchEvent( ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_NOT_CONSUMED); assertEquals("No further gestures should be sent", ContentViewGestureHandler.GESTURE_TAP_CANCEL, mockDelegate.mMostRecentGestureEvent.mType); } }
yinquan529/platform-external-chromium_org
content/public/android/javatests/src/org/chromium/content/browser/ContentViewGestureHandlerTest.java
Java
bsd-3-clause
109,438
/* Copyright (c) 2014, Intel Corporation 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 Intel Corporation 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. */ #include "../../../common/nn_workload_data.h" #include "../../api_internal/nn_device_interface_0_internal.h" #include "layer_convolution_pooling_int16_fixedpoint_avx2.h" #include "layer_convolution_int16_fixedpoint_avx2.h" #include <immintrin.h> #include <assert.h> #include <string.h> #include <algorithm> #include <thread> #include <vector> // NN_CODE_UNREACHABLE signal to supporting compiler that specific location in code cannot be reached #if defined _MSC_VER # define NN_UNREACHABLE_CODE __assume(0) #endif #if defined __GNUC__ # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 # define NN_UNREACHABLE_CODE __builtin_unreachable() # else # define NN_UNREACHABLE_CODE # endif #endif #if defined __clang__ # if __has_builtin(__builtin_unreachable) # define NN_UNREACHABLE_CODE __builtin_unreachable() # else # define NN_UNREACHABLE_CODE # endif #endif namespace int16_fixedpoint { #define SETGET_PARAMETERS \ const auto OFMOutBlock = work_item->output->parent->lengths.t[NN_DATA_COORD_p]; \ const auto num_output_feature_maps = work_item->output->parent->lengths.t[NN_DATA_COORD_z] * OFMOutBlock; \ const auto num_input_feature_maps = input_view->parent->lengths.t[NN_DATA_COORD_z] * input_view->parent->lengths.t[NN_DATA_COORD_p]; \ const auto output_feature_map_width = work_item->output->parent->lengths.t[NN_DATA_COORD_x]; \ const auto output_feature_map_height = work_item->output->parent->lengths.t[NN_DATA_COORD_y]; \ const auto input_feature_map_width = input_view->parent->lengths.t[NN_DATA_COORD_x]; \ const auto input_feature_map_height = input_view->parent->lengths.t[NN_DATA_COORD_y]; \ const auto output_view_width = work_item->output->view_end.t[NN_DATA_COORD_x] - work_item->output->view_begin.t[NN_DATA_COORD_x] + 1; \ const auto output_view_height = work_item->output->view_end.t[NN_DATA_COORD_y] - work_item->output->view_begin.t[NN_DATA_COORD_y] + 1; \ const auto input_view_width = input_view->view_end.t[NN_DATA_COORD_x] - input_view->view_begin.t[NN_DATA_COORD_x] + 1; \ const auto input_view_height = input_view->view_end.t[NN_DATA_COORD_y] - input_view->view_begin.t[NN_DATA_COORD_y] + 1; \ const auto kernel_width = arguments->weights->parent->lengths.t[NN_DATA_COORD_n]; \ const auto kernel_height = arguments->weights->parent->lengths.t[NN_DATA_COORD_x]; \ const auto kernel_stride_x = arguments->stride[0]; \ const auto kernel_stride_y = arguments->stride[1]; \ const auto pool_size_x = 2; \ const auto pool_size_y = 2; \ const auto pool_stride_x = 2; \ const auto pool_stride_y = 2; \ const auto acc_fraction = arguments->activation.fractions.accumulator; \ const auto out_fraction = arguments->activation.fractions.output inline void AddNoBias(__m256i & val, void * addr) { val = _mm256_setzero_si256(); } inline void AddBias16(__m256i & val, void * addr) { val = _mm256_cvtepi16_epi32(_mm_load_si128((__m128i *)(addr))); } inline void AddBias32(__m256i & val, void * addr) { val = _mm256_load_si256((__m256i *)(addr)); } inline void Store16_wRELu_shiftR(void * addr, __m256i val, uint8_t shift) { _mm_stream_si128((__m128i *)(addr), _mm_max_epi16(_mm256_castsi256_si128(_mm256_permute4x64_epi64(_mm256_packs_epi32(_mm256_srai_epi32(val, shift), _mm256_setzero_si256()), 0xd8)), _mm_setzero_si128())); } inline void Store16_wRELu_shiftL(void * addr, __m256i val, uint8_t shift) { _mm_stream_si128((__m128i *)(addr), _mm_max_epi16(_mm256_castsi256_si128(_mm256_permute4x64_epi64(_mm256_packs_epi32(_mm256_slli_epi32(val, -shift), _mm256_setzero_si256()), 0xd8)), _mm_setzero_si128())); } inline void Store16_woActiv_shiftR(void * addr, __m256i val, uint8_t shift) { _mm_stream_si128((__m128i *)(addr), _mm256_castsi256_si128(_mm256_permute4x64_epi64(_mm256_packs_epi32(_mm256_srai_epi32(val, shift), _mm256_setzero_si256()), 0xd8))); } inline void Store16_woActiv_shiftL(void * addr, __m256i val, uint8_t shift) { _mm_stream_si128((__m128i *)(addr), _mm256_castsi256_si128(_mm256_permute4x64_epi64(_mm256_packs_epi32(_mm256_slli_epi32(val, -shift), _mm256_setzero_si256()), 0xd8))); } template <const int T_input_z_block_size, const int T_compute_ofm_block_size, const int T_compute_x_block_size, const int T_compute_y_block_size, const int T_compute_x_sub_block_size, const int T_compute_y_sub_block_size, FActiveShift FStoreActiv, FBias FBias> void NN_ConvolveAVX2_Pool2x2_INT16_fixedpoint( nn_workload_item *const work_item, nn_workload_data_t *_input_view, nn_workload_data_t *_output_view, nn::arguments_forward_merged_convolution_pooling_max_2x2_stride_2x2_fixedpoint* _arguments) { const size_t pool_size_y_2 = 2; const size_t pool_size_x_2 = 2; const size_t ifm_sub_block_size = 2; const size_t output_z_block_size = 8; auto input_view = reinterpret_cast<nn::nn_workload_data_t<int16_t> *>(_input_view); auto output_view = reinterpret_cast<nn::nn_workload_data_t<int16_t> *>(work_item->output); const size_t batch_window_size = output_view->view_end.t[NN_DATA_COORD_n] - output_view->view_begin.t[NN_DATA_COORD_n] + 1; const size_t batch_window_start = output_view->view_begin.t[NN_DATA_COORD_n]; // outputs assert(output_view->parent->lengths.t[NN_DATA_COORD_p] == output_z_block_size); const size_t output_size_x = output_view->parent->lengths.t[NN_DATA_COORD_x], output_stride_x = output_z_block_size; const size_t output_size_y = output_view->parent->lengths.t[NN_DATA_COORD_y], output_stride_y = output_stride_x * output_size_x; const size_t output_size_z = output_view->parent->lengths.t[NN_DATA_COORD_z] * output_z_block_size, output_stride_z = output_stride_y * output_size_y; const size_t output_stride_batch = output_size_x * output_size_y * output_size_z; const size_t output_window_start_x = output_view->view_begin.t[NN_DATA_COORD_x], output_window_size_x = output_view->view_end.t[NN_DATA_COORD_x] - output_window_start_x + 1; const size_t output_window_start_y = output_view->view_begin.t[NN_DATA_COORD_y], output_window_size_y = output_view->view_end.t[NN_DATA_COORD_y] - output_window_start_y + 1; const size_t output_window_start_z = output_view->view_begin.t[NN_DATA_COORD_z], output_window_size_z = (output_view->view_end.t[NN_DATA_COORD_z] - output_window_start_z + 1) * output_z_block_size; // inputs if (input_view->parent->lengths.t[NN_DATA_COORD_p] != T_input_z_block_size) assert(input_view->parent->lengths.t[NN_DATA_COORD_p] == T_input_z_block_size); const size_t input_size_x = input_view->parent->lengths.t[NN_DATA_COORD_x], input_stride_x = T_input_z_block_size; const size_t input_size_y = input_view->parent->lengths.t[NN_DATA_COORD_y], input_stride_y = input_stride_x * input_size_x; const size_t input_size_z = input_view->parent->lengths.t[NN_DATA_COORD_z] * T_input_z_block_size, input_stride_z = input_stride_y * input_size_y; const size_t input_stride_batch = input_size_x * input_size_y * input_size_z; const size_t input_start_x = input_view->view_begin.t[NN_DATA_COORD_x]; const size_t input_start_y = input_view->view_begin.t[NN_DATA_COORD_y]; const size_t input_start_z = input_view->view_begin.t[NN_DATA_COORD_z]; const auto& arguments = work_item->arguments.forward_convolution_pooling_max_2x2_stride_2x2_fixedpoint; // weights assert(arguments.weights->parent->lengths.t[NN_DATA_COORD_p] == T_compute_ofm_block_size); assert(arguments.weights->parent->lengths.t[NN_DATA_COORD_y] == ifm_sub_block_size); const size_t weights_start_ofm = arguments.weights->view_begin.t[NN_DATA_COORD_q]; const size_t weights_stride_ifm = ifm_sub_block_size * T_compute_ofm_block_size; const size_t weights_stride_x = weights_stride_ifm * arguments.weights->parent->lengths.t[NN_DATA_COORD_z]; const size_t weights_size_x = arguments.weights->parent->lengths.t[NN_DATA_COORD_n]; const size_t weights_stride_y = weights_stride_x * arguments.weights->parent->lengths.t[NN_DATA_COORD_n]; const size_t weights_size_y = arguments.weights->parent->lengths.t[NN_DATA_COORD_x]; const size_t weights_stride_ofm = weights_stride_y * arguments.weights->parent->lengths.t[NN_DATA_COORD_x]; // bias const size_t bias_start = arguments.biases->view_begin.t[NN_DATA_COORD_z]; for (uint32_t batch_it = 0; batch_it < batch_window_size; ++batch_it) { int16_t *output_window = (int16_t *)output_view->parent->data_buffer + output_window_start_x * output_stride_x + output_window_start_y * output_stride_y + output_window_start_z * output_stride_z + (batch_window_start + batch_it) * output_stride_batch; int16_t *input_window = (int16_t *)input_view->parent->data_buffer + input_start_x * input_stride_x + input_start_y * input_stride_y + input_start_z * input_stride_z + (batch_window_start + batch_it) * input_stride_batch; int16_t* weights_window = (int16_t*)arguments.weights->parent->data_buffer + weights_stride_ofm * weights_start_ofm; int32_t* bias_window = (int32_t*)arguments.biases->parent->data_buffer + bias_start; const size_t center_x = arguments.center_offset[0]; const size_t center_y = arguments.center_offset[1]; const size_t kernel_stride_x = arguments.stride[0]; const size_t kernel_stride_y = arguments.stride[1]; const size_t shift = arguments.activation.fractions.accumulator - arguments.activation.fractions.output; //it is assumed that inputs and kernal layout is ready for (size_t BlockOffsetY = 0; BlockOffsetY < output_window_size_y; BlockOffsetY += T_compute_y_block_size / pool_size_y_2) { for (size_t BlockOffsetX = 0; BlockOffsetX < output_window_size_x; BlockOffsetX += T_compute_x_block_size / pool_size_x_2) { for (size_t BlockOffsetOFM = 0; BlockOffsetOFM < output_window_size_z; BlockOffsetOFM += T_compute_ofm_block_size) { __m256i OutBlock[T_compute_y_block_size][T_compute_x_block_size][T_compute_ofm_block_size / 8]; for (size_t OBlockYItr = 0; OBlockYItr < T_compute_y_block_size; OBlockYItr += 1) { #pragma unroll for (size_t OBlockXItr = 0; OBlockXItr < T_compute_x_block_size; OBlockXItr += 1) { #pragma unroll for (size_t OFMItr = 0; OFMItr < T_compute_ofm_block_size / 8; ++OFMItr) { FBias(OutBlock[OBlockYItr][OBlockXItr][OFMItr], (__m128i *)(bias_window + BlockOffsetOFM + OFMItr * 8)); } } } for (size_t ifm_block_offset = 0; ifm_block_offset < input_size_z; ifm_block_offset += T_input_z_block_size) { for (size_t KernelYItr = 0; KernelYItr < weights_size_y; KernelYItr += 1) { for (size_t KernelXItr = 0; KernelXItr < weights_size_x; KernelXItr += 1) { #pragma unroll for (size_t OBlockYItr = 0; OBlockYItr < T_compute_y_block_size; OBlockYItr += T_compute_y_sub_block_size) { #pragma unroll for (size_t OBlockXItr = 0; OBlockXItr < T_compute_x_block_size; OBlockXItr += T_compute_x_sub_block_size) { #pragma unroll (T_compute_y_sub_block_size) for (size_t OpBlockYItr = 0; OpBlockYItr < T_compute_y_sub_block_size; OpBlockYItr += 1) { #pragma unroll (T_compute_x_sub_block_size) for (size_t OpBlockXItr = 0; OpBlockXItr < T_compute_x_sub_block_size; OpBlockXItr += 1) { __m256i vi[T_input_z_block_size / ifm_sub_block_size]; #pragma unroll (T_input_z_block_size / ifm_sub_block_size) for (size_t IFMSubItr = 0; IFMSubItr < T_input_z_block_size / ifm_sub_block_size; IFMSubItr += 1) { vi[IFMSubItr] = _mm256_set1_epi32(*(int32_t *)(input_window + ((BlockOffsetX*pool_size_x_2 + OBlockXItr + OpBlockXItr - center_x) * kernel_stride_x + KernelXItr) * input_stride_x + ((BlockOffsetY*pool_size_y_2 + OBlockYItr + OpBlockYItr - center_y) * kernel_stride_y + KernelYItr) * input_stride_y + (ifm_block_offset) / T_input_z_block_size * input_stride_z + IFMSubItr * ifm_sub_block_size)); } #pragma unroll (T_input_z_block_size / ifm_sub_block_size) for (size_t IFMSubItr = 0; IFMSubItr < T_input_z_block_size / ifm_sub_block_size; IFMSubItr += 1) { #pragma unroll (T_compute_ofm_block_size / 8) for (size_t OFMItr = 0; OFMItr < T_compute_ofm_block_size / 8; OFMItr += 1) { __m256i vw = _mm256_load_si256((__m256i *)(weights_window + ifm_sub_block_size * 8 * OFMItr + (ifm_block_offset + IFMSubItr * ifm_sub_block_size) / ifm_sub_block_size * weights_stride_ifm + (BlockOffsetOFM) / T_compute_ofm_block_size * weights_stride_ofm + KernelXItr * weights_stride_x + KernelYItr * weights_stride_y)); __m256i tmp = _mm256_madd_epi16( vw , vi[IFMSubItr]); OutBlock[OBlockYItr + OpBlockYItr][OBlockXItr + OpBlockXItr][OFMItr] = _mm256_add_epi32(OutBlock[OBlockYItr + OpBlockYItr][OBlockXItr + OpBlockXItr][OFMItr], tmp); } } } } } } } } } for (size_t OBlockYItr = 0; OBlockYItr < T_compute_y_block_size; OBlockYItr += pool_size_y_2) { for (size_t OBlockXItr = 0; OBlockXItr < T_compute_x_block_size; OBlockXItr += pool_size_x_2) { for (size_t OFMItr = 0; OFMItr < T_compute_ofm_block_size; OFMItr += 8) { //with MaxPol2x2 __m256i Max1 = _mm256_max_epi32(OutBlock[OBlockYItr + 0][OBlockXItr + 0][OFMItr / 8], OutBlock[OBlockYItr + 0][OBlockXItr + 1][OFMItr / 8]); __m256i Max2 = _mm256_max_epi32(OutBlock[OBlockYItr + 1][OBlockXItr + 0][OFMItr / 8], OutBlock[OBlockYItr + 1][OBlockXItr + 1][OFMItr / 8]); Max1 = _mm256_max_epi32(Max1, Max2); FStoreActiv((void *)(output_window + (BlockOffsetOFM + OFMItr) / 8 * output_stride_z + (BlockOffsetY + OBlockYItr / pool_size_y_2) * output_stride_y + (BlockOffsetX + OBlockXItr / pool_size_x_2) * output_stride_x), Max1, shift); } } } } } } } } inline __m256i ***Create3DBuf256(uint32_t Dim1, uint32_t Dim2, uint32_t Dim3) { __m256i *** dest = new __m256i **[Dim1]; dest[0] = new __m256i *[Dim1*Dim2]; dest[0][0] = (__m256i *)_mm_malloc(Dim1*Dim2*Dim3*sizeof(__m256i), 64); uint32_t i, j; for (i = 0; i < Dim1; i++) { if (i < Dim1 - 1) { dest[0][(i + 1)*Dim2] = &(dest[0][0][(i + 1)*Dim3*Dim2]); dest[i + 1] = &(dest[0][(i + 1)*Dim2]); } for (j = 0; j < Dim2; j++) { if (j > 0) dest[i][j] = dest[i][j - 1] + Dim3; } } return dest; } static void Delete3DBuf256(__m256i ***dist) { _mm_free(dist[0][0]); delete[] dist[0]; delete[] dist; } template <FActiveShift FStoreActiv, FBias FBias> void NN_ConvolveAVX2_Pool2x2_INT16_fixedpoint_Flex( nn_workload_item *const work_item, nn_workload_data_t *input_view, nn_workload_data_t *output_view, nn::arguments_forward_merged_convolution_pooling_max_2x2_stride_2x2_fixedpoint* arguments) { uint32_t BatchSize = output_view->parent->lengths.t[NN_DATA_COORD_n]; for (uint32_t bItr = 0; bItr < BatchSize; ++bItr) { // Get required data from call argument. int16_t* output = (int16_t *)output_view->parent->data_buffer + bItr * (output_view->parent->buffer_size) / BatchSize / (output_view->parent->data_type_size);; int16_t* input = (int16_t *)input_view->parent->data_buffer + bItr * (input_view->parent->buffer_size) / BatchSize / (input_view->parent->data_type_size); int16_t* kernel = (int16_t*)arguments->weights->parent->data_buffer; int32_t* bias = (int32_t*)arguments->biases->parent->data_buffer; SETGET_PARAMETERS; const auto output_width = OFMOutBlock * (output_view->view_end.t[NN_DATA_COORD_z] - output_view->view_begin.t[NN_DATA_COORD_z] + 1); auto BlockOffsetOFMStart = OFMOutBlock * output_view->view_begin.t[NN_DATA_COORD_z]; auto BlockOffsetOFMEnd = OFMOutBlock * (output_view->view_end.t[NN_DATA_COORD_z] + 1); const auto center_x = arguments->center_offset[0]; const auto center_y = arguments->center_offset[1]; const auto OutStartX = output_view->view_begin.t[NN_DATA_COORD_x]; const auto OutStartY = output_view->view_begin.t[NN_DATA_COORD_y]; const auto shift = acc_fraction - out_fraction; const uint32_t OXBlock = output_view_width; const uint32_t OXpBlock = output_view_width; const uint32_t OYBlock = output_view_height; const uint32_t OYpBlock = (output_view_height <= 16 && output_view_height % 2 == 0) ? 2 : 1; const uint32_t IFMBlock = input_view->parent->lengths.t[NN_DATA_COORD_p]; const uint32_t OFMBlock = arguments->weights->parent->lengths.t[NN_DATA_COORD_p]; uint_least32_t output_feature_map_width_int = output_view_width * 2; uint_least32_t output_feature_map_height_int = output_view_height * 2; __m256i *** OutBlock = Create3DBuf256(OYBlock, OXBlock, OFMBlock / 8); __m256i *vi = (__m256i *)_mm_malloc((IFMBlock / 2) * sizeof(__m256i), 64); //it is assumed that inputs and kernal layout is ready for (uint32_t BlockOffsetY = OutStartY; BlockOffsetY < OutStartY + output_feature_map_height_int; BlockOffsetY += OYBlock) { for (uint32_t BlockOffsetX = OutStartX; BlockOffsetX < OutStartX + output_feature_map_width_int; BlockOffsetX += OXBlock) { for (uint32_t BlockOffsetOFM = BlockOffsetOFMStart; BlockOffsetOFM < BlockOffsetOFMEnd; BlockOffsetOFM += OFMBlock) { //__m256i OutBlock[OYBlock][OXBlock][OFMBlock / 8]; for (uint32_t OBlockYItr = 0; OBlockYItr < OYBlock; OBlockYItr += 1) { #pragma unroll for (uint32_t OBlockXItr = 0; OBlockXItr < OXBlock; OBlockXItr += 1) { #pragma unroll for (uint32_t OFMItr = 0; OFMItr < OFMBlock; OFMItr += 8) { FBias(OutBlock[OBlockYItr][OBlockXItr][OFMItr / 8], (__m128i *)(bias + BlockOffsetOFM + OFMItr)); } } } for (uint32_t IFMItr = 0; IFMItr < num_input_feature_maps / IFMBlock; IFMItr += 1) { for (uint32_t KernelYItr = 0; KernelYItr < kernel_height; KernelYItr += 1) { for (uint32_t KernelXItr = 0; KernelXItr < kernel_width; KernelXItr += 1) { #pragma unroll for (uint32_t OBlockYItr = 0; OBlockYItr < OYBlock; OBlockYItr += OYpBlock) { #pragma unroll for (uint32_t OBlockXItr = 0; OBlockXItr < OXBlock; OBlockXItr += OXpBlock) { #pragma unroll for (uint32_t OpBlockYItr = 0; OpBlockYItr < OYpBlock; OpBlockYItr += 1) { #pragma unroll for (uint32_t OpBlockXItr = 0; OpBlockXItr < OXpBlock; OpBlockXItr += 1) { //__m256i vi[IFMBlock / 2]; #pragma unroll for (uint32_t IFMSubItr = 0; IFMSubItr < IFMBlock / 2; IFMSubItr += 1) { vi[IFMSubItr] = _mm256_set1_epi32(*(int32_t *)(input + IFMItr * IFMBlock * input_feature_map_width * input_feature_map_height + IFMSubItr * 2 + (OBlockXItr + OpBlockXItr + BlockOffsetX - center_x) * IFMBlock * kernel_stride_x + KernelXItr * IFMBlock + (OBlockYItr + OpBlockYItr + BlockOffsetY - center_y) * input_feature_map_width * IFMBlock * kernel_stride_y + KernelYItr * input_feature_map_width * IFMBlock)); } #pragma unroll for (uint32_t IFMSubItr = 0; IFMSubItr < IFMBlock / 2; IFMSubItr += 1) { #pragma unroll for (uint32_t OFMItr = 0; OFMItr < OFMBlock / 8; OFMItr += 1) { __m256i vw = _mm256_load_si256((__m256i *)(kernel + 2 * 8 * OFMItr + (IFMItr * IFMBlock + IFMSubItr * 2) * OFMBlock + KernelXItr * (num_input_feature_maps * OFMBlock) + KernelYItr * (num_input_feature_maps * OFMBlock) * kernel_width + num_input_feature_maps * kernel_width * kernel_height * BlockOffsetOFM)); __m256i tmp = _mm256_madd_epi16( vw , vi[IFMSubItr]); OutBlock[OBlockYItr + OpBlockYItr][OBlockXItr + OpBlockXItr][OFMItr] = _mm256_add_epi32(OutBlock[OBlockYItr + OpBlockYItr][OBlockXItr + OpBlockXItr][OFMItr], tmp); } } } } } } } } } for (uint32_t OBlockYItr = 0; OBlockYItr < OYBlock; OBlockYItr += pool_size_y) { for (uint32_t OBlockXItr = 0; OBlockXItr < OXBlock; OBlockXItr += pool_size_x) { for (uint32_t OFMItr = 0; OFMItr < OFMBlock; OFMItr += 8) { //with MaxPol2x2 __m256i Max1 = _mm256_max_epi32(OutBlock[OBlockYItr + 0][OBlockXItr + 0][OFMItr / 8], OutBlock[OBlockYItr + 0][OBlockXItr + 1][OFMItr / 8]); __m256i Max2 = _mm256_max_epi32(OutBlock[OBlockYItr + 1][OBlockXItr + 0][OFMItr / 8], OutBlock[OBlockYItr + 1][OBlockXItr + 1][OFMItr / 8]); Max1 = _mm256_max_epi32(Max1, Max2); FStoreActiv((void *)(output + output_feature_map_width * output_feature_map_height * (BlockOffsetOFM + OFMItr) + ((OBlockXItr + BlockOffsetX - center_x) / pool_size_x + center_x + (OBlockYItr / pool_size_y) * output_feature_map_width + ((BlockOffsetY - center_y) / pool_size_y + center_y) * output_feature_map_width) * OFMOutBlock), Max1, shift); } } } } } } _mm_free(vi); Delete3DBuf256(OutBlock); } } template <FActiveShift FStoreActiv, FBias FBias> struct convolution_avx2_int16_fixedpoint_selector{ using convolve_maxpool_call_params = std::tuple<nn_workload_item *const, nn_workload_data_t*, nn_workload_data_t*, nn::arguments_forward_merged_convolution_pooling_max_2x2_stride_2x2_fixedpoint*>; template<int IFMBlock, int OFMBlock, int OXBlock, int OXpBlock> struct SelectOYBlock{ inline static void choose(int num_ifm, int num_ofm, int out_width, int out_height, convolve_maxpool_call_params const& call_params){ if ((out_height * 2) % 2 == 0) NN_ConvolveAVX2_Pool2x2_INT16_fixedpoint<IFMBlock, OFMBlock, OXBlock, 2, OXpBlock, 2, FStoreActiv, FBias>(std::get<0>(call_params), std::get<1>(call_params), std::get<2>(call_params), std::get<3>(call_params)); else NN_ConvolveAVX2_Pool2x2_INT16_fixedpoint<IFMBlock, OFMBlock, OXBlock, 1, OXpBlock, 1, FStoreActiv, FBias>(std::get<0>(call_params), std::get<1>(call_params), std::get<2>(call_params), std::get<3>(call_params)); } }; template<int IFMBlock, int OFMBlock> struct SelectOXBlock{ inline static void choose(int num_ifm, int num_ofm, int out_width, int out_height, convolve_maxpool_call_params const& call_params){ if ((out_width * 2) % 14 == 0) SelectOYBlock<IFMBlock, OFMBlock, 14, 2>::choose(num_ifm, num_ofm, out_width, out_height, call_params); else if ((out_width * 2) % 12 == 0) SelectOYBlock<IFMBlock, OFMBlock, 12, 2>::choose(num_ifm, num_ofm, out_width, out_height, call_params); else if ((out_width * 2) % 2 == 0) SelectOYBlock<IFMBlock, OFMBlock, 2, 2>::choose(num_ifm, num_ofm, out_width, out_height, call_params); else SelectOYBlock<IFMBlock, OFMBlock, 1, 1>::choose(num_ifm, num_ofm, out_width, out_height, call_params); } }; template <int IFMBlock> struct SelectOXBlock<IFMBlock, 384> { inline static void choose(int num_ifm, int num_ofm, int out_width, int out_height, convolve_maxpool_call_params const& call_params){ NN_ConvolveAVX2_Pool2x2_INT16_fixedpoint<IFMBlock, 384, 1, 1, 1, 1, FStoreActiv, FBias>(std::get<0>(call_params), std::get<1>(call_params), std::get<2>(call_params), std::get<3>(call_params)); } }; template<int IFMBlock> struct SelectOFMBlock{ inline static void choose(int num_ifm, int num_ofm, int out_width, int out_height, convolve_maxpool_call_params const& call_params){ if (num_ofm % 32 == 0) SelectOXBlock<IFMBlock, 32>::choose(num_ifm, num_ofm, out_width, out_height, call_params); else assert(0); } }; struct SelectIFMBlock{ inline static void choose(int num_ifm, int num_ofm, int out_width, int out_height, convolve_maxpool_call_params const& call_params){ if (num_ifm % 8 == 0) SelectOFMBlock<8>::choose(num_ifm, num_ofm, out_width, out_height, call_params); else if (num_ifm % 4 == 0) SelectOFMBlock<4>::choose(num_ifm, num_ofm, out_width, out_height, call_params); else assert(0); } }; inline static void choose( nn_workload_item *const work_item, nn_workload_data_t *input_view, nn_workload_data_t *output_view, nn::arguments_forward_merged_convolution_pooling_max_2x2_stride_2x2_fixedpoint* arguments) { SETGET_PARAMETERS; const auto acc_shift = acc_fraction - out_fraction; SelectIFMBlock::choose(num_input_feature_maps, num_output_feature_maps, output_view_width, output_view_height, std::forward_as_tuple(work_item, input_view, output_view, arguments)); } }; void run_convolve_maxpool2x2_fixedpoint_work_item( nn_workload_item *const work_item, nn_workload_data_t *input_view, nn_workload_data_t *output_view) { auto &arguments = work_item->arguments.forward_convolution_pooling_max_2x2_stride_2x2_fixedpoint; const auto acc_shift = arguments.activation.fractions.accumulator - arguments.activation.fractions.output; // Copy biases. if (arguments.biases != nullptr && arguments.biases->parent != nullptr && arguments.biases->parent->data_buffer != nullptr) { // Invoke convolution. if (arguments.activation.basic_arguments.function == NN_ACTIVATION_FUNCTION_NONE) { if (acc_shift >= 0) convolution_avx2_int16_fixedpoint_selector<Store16_woActiv_shiftR, AddBias32>::choose(work_item, input_view, output_view, &arguments); else convolution_avx2_int16_fixedpoint_selector<Store16_woActiv_shiftL, AddBias32>::choose(work_item, input_view, output_view, &arguments); } else if (arguments.activation.basic_arguments.function == NN_ACTIVATION_FUNCTION_RELU) { if (acc_shift >= 0) convolution_avx2_int16_fixedpoint_selector<Store16_wRELu_shiftR, AddBias32>::choose(work_item, input_view, output_view, &arguments); else convolution_avx2_int16_fixedpoint_selector<Store16_wRELu_shiftL, AddBias32>::choose(work_item, input_view, output_view, &arguments); } } else { // Invoke convolution. if (arguments.activation.basic_arguments.function == NN_ACTIVATION_FUNCTION_NONE) { if (acc_shift >= 0) convolution_avx2_int16_fixedpoint_selector<Store16_woActiv_shiftR, AddNoBias>::choose(work_item, input_view, output_view, &arguments); else convolution_avx2_int16_fixedpoint_selector<Store16_woActiv_shiftL, AddNoBias>::choose(work_item, input_view, output_view, &arguments); } else if (arguments.activation.basic_arguments.function == NN_ACTIVATION_FUNCTION_RELU) { if (acc_shift >= 0) convolution_avx2_int16_fixedpoint_selector<Store16_wRELu_shiftR, AddNoBias>::choose(work_item, input_view, output_view, &arguments); else convolution_avx2_int16_fixedpoint_selector<Store16_wRELu_shiftL, AddNoBias>::choose(work_item, input_view, output_view, &arguments); } } } /* * Inputs layout required: * nn_workload_data_layout_t in_view_layout = * { * { 0, 0, 0, 0, 0, 0 }, // tile_log2 * { 0, 0, 0, 0, 0, 0 }, // alignment * { NN_DATA_COORD_p, NN_DATA_COORD_x, NN_DATA_COORD_y, NN_DATA_COORD_z, NN_DATA_COORD_n, NN_DATA_COORD_q }, // ordering * NN_DATATYPE_INT16 * }; * * nn_workload_data_coords_t input_view_coords = * { * NumBatch, * Width, * Height, * NumInputs/FMBlock, * FMBlock, * 1 * }; * * Output is configured similarly, with outputs either Int16 or Int32 * */ void unpack_convolve_pooling_fixedpoint_callback_handle(void *void_handle) { nn_cpu_request_handle* handle = reinterpret_cast<nn_cpu_request_handle*>(void_handle); run_convolve_maxpool2x2_fixedpoint_work_item(handle->work_item, handle->input_view, handle->output_view); } void run_multithreaded_convolve_pooling_fixedpoint_work_item(nn_workload_item *const work_item, nn_device_internal* device) { const auto threadpool_size = device->thread_pool.get_num_threads(); const auto &master_arguments = work_item->arguments.forward_convolution_pooling_max_2x2_stride_2x2_fixedpoint; const auto OFMBlock = master_arguments.weights->parent->lengths.t[NN_DATA_COORD_p]; const auto ofm_out_block_size = work_item->output->parent->lengths.t[NN_DATA_COORD_p]; const auto num_output_feature_maps = (work_item->output->view_end.t[NN_DATA_COORD_z] - work_item->output->view_begin.t[NN_DATA_COORD_z] + 1) * ofm_out_block_size; const auto batch_size = work_item->output->parent->lengths.t[NN_DATA_COORD_n]; const auto ofm_group_size = OFMBlock; const auto ofm_groups_per_batch = num_output_feature_maps / ofm_group_size; const auto task_count = batch_size * ofm_groups_per_batch; // Check if we have enough data to cover all threads. if (threadpool_size < 2 || task_count < 2) { // Its tiny data - just do it singlethreaded way. run_convolve_maxpool2x2_fixedpoint_work_item(work_item, work_item->input[0]->output, work_item->output); } else { std::vector<nn_workload_item> slave_work_items; std::vector<nn_workload_data_t*> input_views; slave_work_items.resize(task_count); // Fill slave work items. for (auto it_ofm_group = 0u; it_ofm_group < ofm_groups_per_batch; ++it_ofm_group) { for (auto it_batch = 0u; it_batch < batch_size; ++it_batch) { auto& slave = slave_work_items[it_batch + it_ofm_group * batch_size]; auto& slave_arguments = slave.arguments.forward_convolution_pooling_max_2x2_stride_2x2_fixedpoint; // Copy all data from master. slave.type = work_item->type; slave_arguments = master_arguments; const auto cpp_master_input = reinterpret_cast<nn::nn_workload_data_t<int16_t>*>(work_item->input[0]->output); const auto cpp_master_output = reinterpret_cast<nn::nn_workload_data_t<int16_t>*>(work_item->output); const auto cpp_master_weights = reinterpret_cast<nn::nn_workload_data_t<int16_t>*>(master_arguments.weights); auto work_begin_batch = it_batch; auto work_begin_ofm_out_block = it_ofm_group * ofm_group_size / ofm_out_block_size; auto work_end_batch = it_batch + 1; auto work_end_ofm_out_block = work_begin_ofm_out_block + ofm_group_size / ofm_out_block_size; nn_workload_data_coords_t output_view_begin = { work_begin_batch, 0, 0, work_begin_ofm_out_block, 0, 0 }; nn_workload_data_coords_t output_view_end = { work_end_batch - 1, cpp_master_output->get_length(NN_DATA_COORD_x) - 1, cpp_master_output->get_length(NN_DATA_COORD_y) - 1, work_end_ofm_out_block - 1, cpp_master_output->get_length(NN_DATA_COORD_p) - 1, 0 }; nn_workload_data_coords_t input_view_begin = { work_begin_batch, 0, 0, 0, 0, 0 }; nn_workload_data_coords_t input_view_end = { work_end_batch - 1, cpp_master_input->get_length(NN_DATA_COORD_x) - 1, cpp_master_input->get_length(NN_DATA_COORD_y) - 1, cpp_master_input->get_length(NN_DATA_COORD_z) - 1, cpp_master_input->get_length(NN_DATA_COORD_p) - 1, cpp_master_input->get_length(NN_DATA_COORD_q) - 1 }; nn_workload_data_coords_t weights_view_begin = { 0, 0, 0, 0, 0, work_begin_ofm_out_block * ofm_out_block_size / ofm_group_size }; nn_workload_data_coords_t weights_view_end = { cpp_master_weights->get_length(NN_DATA_COORD_n) - 1, cpp_master_weights->get_length(NN_DATA_COORD_x) - 1, cpp_master_weights->get_length(NN_DATA_COORD_y) - 1, cpp_master_weights->get_length(NN_DATA_COORD_z) - 1, cpp_master_weights->get_length(NN_DATA_COORD_p) - 1, work_end_ofm_out_block * ofm_out_block_size / ofm_group_size - 1 }; input_views.push_back(new nn::nn_workload_data_t<int16_t>( *(reinterpret_cast<nn::nn_workload_data_t<int16_t> *>(work_item->input[0]->output)), input_view_begin, input_view_end)); slave.output = new nn::nn_workload_data_t<int16_t>( *(reinterpret_cast<nn::nn_workload_data_t<int16_t> *>(work_item->output)), output_view_begin, output_view_end); slave_arguments.weights = new nn::nn_workload_data_t<int16_t>( *(reinterpret_cast<nn::nn_workload_data_t<int16_t> *>(master_arguments.weights)), weights_view_begin, weights_view_end); // Use biases. if (master_arguments.biases != nullptr) { const auto cpp_master_biases = reinterpret_cast<nn::nn_workload_data_t<int32_t>*>(master_arguments.biases); nn_workload_data_coords_t bias_view_begin = { 0, 0, 0, work_begin_ofm_out_block * ofm_out_block_size, 0, 0 }; nn_workload_data_coords_t bias_view_end = { cpp_master_biases->get_length(NN_DATA_COORD_n) - 1, cpp_master_biases->get_length(NN_DATA_COORD_x) - 1, cpp_master_biases->get_length(NN_DATA_COORD_y) - 1, work_end_ofm_out_block * ofm_out_block_size - 1, cpp_master_biases->get_length(NN_DATA_COORD_p) - 1, cpp_master_biases->get_length(NN_DATA_COORD_q) - 1 }; slave_arguments.biases = new nn::nn_workload_data_t<int32_t>( *(reinterpret_cast<nn::nn_workload_data_t<int32_t> *>(master_arguments.biases)), bias_view_begin, bias_view_end); } } } std::vector<nn_multithreaded_request> jobs(task_count); std::vector<nn_cpu_request_handle> request_handles(task_count); for (auto it_task = 0; it_task < task_count; ++it_task) { request_handles[it_task].work_item = &slave_work_items[it_task]; request_handles[it_task].input_view = input_views[it_task]; request_handles[it_task].output_view = slave_work_items[it_task].output; jobs[it_task].callback = unpack_convolve_pooling_fixedpoint_callback_handle; jobs[it_task].request_handle = &request_handles[it_task]; } // Wait for all sub threads. device->thread_pool.push_job(jobs); for (auto it_task = 0; it_task < task_count; ++it_task) { delete input_views[it_task]; delete slave_work_items[it_task].output; auto &slave_arguments = slave_work_items[it_task].arguments.forward_convolution_pooling_max_2x2_stride_2x2_fixedpoint; delete slave_arguments.biases; delete slave_arguments.weights; } } } } // namepace cpu16
gaoxw126/idlf
intel_visual_cloud_node/devices/device_cpu/core/fixedpoint/layer_convolution_pooling_int16_fixedpoint_avx2.cpp
C++
bsd-3-clause
46,071
#define JEMALLOC_CHUNK_C_ #include "jemalloc/internal/jemalloc_internal.h" /******************************************************************************/ /* Data. */ size_t opt_lg_chunk = LG_CHUNK_DEFAULT; #ifdef JEMALLOC_SWAP bool opt_overcommit = true; #endif #if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) malloc_mutex_t chunks_mtx; chunk_stats_t stats_chunks; #endif #ifdef JEMALLOC_IVSALLOC rtree_t *chunks_rtree; #endif /* Various chunk-related settings. */ size_t chunksize; size_t chunksize_mask; /* (chunksize - 1). */ size_t chunk_npages; size_t map_bias; size_t arena_maxclass; /* Max size class for arenas. */ /******************************************************************************/ /* * If the caller specifies (*zero == false), it is still possible to receive * zeroed memory, in which case *zero is toggled to true. arena_chunk_alloc() * takes advantage of this to avoid demanding zeroed chunks, but taking * advantage of them if they are returned. */ void * chunk_alloc(size_t size, bool base, bool *zero) { void *ret; assert(size != 0); assert((size & chunksize_mask) == 0); #ifdef JEMALLOC_SWAP if (swap_enabled) { ret = chunk_alloc_swap(size, zero); if (ret != NULL) goto RETURN; } if (swap_enabled == false || opt_overcommit) { #endif #ifdef JEMALLOC_DSS ret = chunk_alloc_dss(size, zero); if (ret != NULL) goto RETURN; #endif ret = chunk_alloc_mmap(size); if (ret != NULL) { *zero = true; goto RETURN; } #ifdef JEMALLOC_SWAP } #endif /* All strategies for allocation failed. */ ret = NULL; RETURN: #ifdef JEMALLOC_IVSALLOC if (base == false && ret != NULL) { if (rtree_set(chunks_rtree, (uintptr_t)ret, ret)) { chunk_dealloc(ret, size, true); return (NULL); } } #endif #if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) if (ret != NULL) { # ifdef JEMALLOC_PROF bool gdump; # endif malloc_mutex_lock(&chunks_mtx); # ifdef JEMALLOC_STATS stats_chunks.nchunks += (size / chunksize); # endif stats_chunks.curchunks += (size / chunksize); if (stats_chunks.curchunks > stats_chunks.highchunks) { stats_chunks.highchunks = stats_chunks.curchunks; # ifdef JEMALLOC_PROF gdump = true; # endif } # ifdef JEMALLOC_PROF else gdump = false; # endif malloc_mutex_unlock(&chunks_mtx); # ifdef JEMALLOC_PROF if (opt_prof && opt_prof_gdump && gdump) prof_gdump(); # endif } #endif assert(CHUNK_ADDR2BASE(ret) == ret); return (ret); } void chunk_dealloc(void *chunk, size_t size, bool unmap) { assert(chunk != NULL); assert(CHUNK_ADDR2BASE(chunk) == chunk); assert(size != 0); assert((size & chunksize_mask) == 0); #ifdef JEMALLOC_IVSALLOC rtree_set(chunks_rtree, (uintptr_t)chunk, NULL); #endif #if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) malloc_mutex_lock(&chunks_mtx); stats_chunks.curchunks -= (size / chunksize); malloc_mutex_unlock(&chunks_mtx); #endif if (unmap) { #ifdef JEMALLOC_SWAP if (swap_enabled && chunk_dealloc_swap(chunk, size) == false) return; #endif #ifdef JEMALLOC_DSS if (chunk_dealloc_dss(chunk, size) == false) return; #endif chunk_dealloc_mmap(chunk, size); } } bool chunk_boot(void) { /* Set variables according to the value of opt_lg_chunk. */ chunksize = (ZU(1) << opt_lg_chunk); assert(chunksize >= PAGE_SIZE); chunksize_mask = chunksize - 1; chunk_npages = (chunksize >> PAGE_SHIFT); #if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) if (malloc_mutex_init(&chunks_mtx)) return (true); memset(&stats_chunks, 0, sizeof(chunk_stats_t)); #endif #ifdef JEMALLOC_SWAP if (chunk_swap_boot()) return (true); #endif if (chunk_mmap_boot()) return (true); #ifdef JEMALLOC_DSS if (chunk_dss_boot()) return (true); #endif #ifdef JEMALLOC_IVSALLOC chunks_rtree = rtree_new((ZU(1) << (LG_SIZEOF_PTR+3)) - opt_lg_chunk); if (chunks_rtree == NULL) return (true); #endif return (false); }
esomenos/redis
deps/jemalloc/src/chunk.c
C
bsd-3-clause
3,914
// 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. var SourceEntry = (function() { 'use strict'; /** * A SourceEntry gathers all log entries with the same source. * * @constructor */ function SourceEntry(logEntry, maxPreviousSourceId) { this.maxPreviousSourceId_ = maxPreviousSourceId; this.entries_ = []; this.description_ = ''; // Set to true on most net errors. this.isError_ = false; // If the first entry is a BEGIN_PHASE, set to false. // Set to true when an END_PHASE matching the first entry is encountered. this.isInactive_ = true; if (logEntry.phase == EventPhase.PHASE_BEGIN) this.isInactive_ = false; this.update(logEntry); } SourceEntry.prototype = { update: function(logEntry) { // Only the last event should have the same type first event, if (!this.isInactive_ && logEntry.phase == EventPhase.PHASE_END && logEntry.type == this.entries_[0].type) { this.isInactive_ = true; } // If we have a net error code, update |this.isError_| if appropriate. if (logEntry.params) { var netErrorCode = logEntry.params.net_error; // Skip both cases where netErrorCode is undefined, and cases where it // is 0, indicating no actual error occurred. if (netErrorCode) { // Ignore error code caused by not finding an entry in the cache. if (logEntry.type != EventType.HTTP_CACHE_OPEN_ENTRY || netErrorCode != NetError.FAILED) { this.isError_ = true; } } } var prevStartEntry = this.getStartEntry_(); this.entries_.push(logEntry); var curStartEntry = this.getStartEntry_(); // If we just got the first entry for this source. if (prevStartEntry != curStartEntry) this.updateDescription_(); }, updateDescription_: function() { var e = this.getStartEntry_(); this.description_ = ''; if (!e) return; if (e.source.type == EventSourceType.NONE) { // NONE is what we use for global events that aren't actually grouped // by a "source ID", so we will just stringize the event's type. this.description_ = EventTypeNames[e.type]; return; } if (e.params == undefined) { return; } switch (e.source.type) { case EventSourceType.URL_REQUEST: case EventSourceType.SOCKET_STREAM: case EventSourceType.HTTP_STREAM_JOB: this.description_ = e.params.url; break; case EventSourceType.CONNECT_JOB: this.description_ = e.params.group_name; break; case EventSourceType.HOST_RESOLVER_IMPL_REQUEST: case EventSourceType.HOST_RESOLVER_IMPL_JOB: case EventSourceType.HOST_RESOLVER_IMPL_PROC_TASK: this.description_ = e.params.host; break; case EventSourceType.DISK_CACHE_ENTRY: case EventSourceType.MEMORY_CACHE_ENTRY: this.description_ = e.params.key; break; case EventSourceType.QUIC_SESSION: if (e.params.host != undefined) this.description_ = e.params.host; break; case EventSourceType.SPDY_SESSION: if (e.params.host) this.description_ = e.params.host + ' (' + e.params.proxy + ')'; break; case EventSourceType.HTTP_PIPELINED_CONNECTION: if (e.params.host_and_port) this.description_ = e.params.host_and_port; break; case EventSourceType.SOCKET: case EventSourceType.PROXY_CLIENT_SOCKET: // Use description of parent source, if any. if (e.params.source_dependency != undefined) { var parentId = e.params.source_dependency.id; this.description_ = SourceTracker.getInstance().getDescription(parentId); } break; case EventSourceType.UDP_SOCKET: if (e.params.address != undefined) { this.description_ = e.params.address; // If the parent of |this| is a HOST_RESOLVER_IMPL_JOB, use // '<DNS Server IP> [<host we're resolving>]'. if (this.entries_[0].type == EventType.SOCKET_ALIVE && this.entries_[0].params && this.entries_[0].params.source_dependency != undefined) { var parentId = this.entries_[0].params.source_dependency.id; var parent = SourceTracker.getInstance().getSourceEntry(parentId); if (parent && parent.getSourceType() == EventSourceType.HOST_RESOLVER_IMPL_JOB && parent.getDescription().length > 0) { this.description_ += ' [' + parent.getDescription() + ']'; } } } break; case EventSourceType.ASYNC_HOST_RESOLVER_REQUEST: case EventSourceType.DNS_TRANSACTION: this.description_ = e.params.hostname; break; case EventSourceType.DOWNLOAD: switch (e.type) { case EventType.DOWNLOAD_FILE_RENAMED: this.description_ = e.params.new_filename; break; case EventType.DOWNLOAD_FILE_OPENED: this.description_ = e.params.file_name; break; case EventType.DOWNLOAD_ITEM_ACTIVE: this.description_ = e.params.file_name; break; } break; case EventSourceType.FILESTREAM: this.description_ = e.params.file_name; break; case EventSourceType.IPV6_PROBE_JOB: if (e.type == EventType.IPV6_PROBE_RUNNING && e.phase == EventPhase.PHASE_END) { this.description_ = e.params.ipv6_supported ? 'IPv6 Supported' : 'IPv6 Not Supported'; } break; } if (this.description_ == undefined) this.description_ = ''; }, /** * Returns a description for this source log stream, which will be displayed * in the list view. Most often this is a URL that identifies the request, * or a hostname for a connect job, etc... */ getDescription: function() { return this.description_; }, /** * Returns the starting entry for this source. Conceptually this is the * first entry that was logged to this source. However, we skip over the * TYPE_REQUEST_ALIVE entries which wrap TYPE_URL_REQUEST_START_JOB / * TYPE_SOCKET_STREAM_CONNECT. */ getStartEntry_: function() { if (this.entries_.length < 1) return undefined; if (this.entries_[0].source.type == EventSourceType.FILESTREAM) { var e = this.findLogEntryByType_(EventType.FILE_STREAM_OPEN); if (e != undefined) return e; } if (this.entries_[0].source.type == EventSourceType.DOWNLOAD) { // If any rename occurred, use the last name e = this.findLastLogEntryStartByType_( EventType.DOWNLOAD_FILE_RENAMED); if (e != undefined) return e; // Otherwise, if the file was opened, use that name e = this.findLogEntryByType_(EventType.DOWNLOAD_FILE_OPENED); if (e != undefined) return e; // History items are never opened, so use the activation info e = this.findLogEntryByType_(EventType.DOWNLOAD_ITEM_ACTIVE); if (e != undefined) return e; } if (this.entries_.length >= 2) { // Needed for compatability with log dumps prior to M26. // TODO(mmenke): Remove this. if (this.entries_[0].type == EventType.SOCKET_POOL_CONNECT_JOB && this.entries_[0].params == undefined) { return this.entries_[1]; } if (this.entries_[1].type == EventType.UDP_CONNECT) return this.entries_[1]; if (this.entries_[0].type == EventType.REQUEST_ALIVE && this.entries_[0].params == undefined) { var startIndex = 1; // Skip over URL_REQUEST_BLOCKED_ON_DELEGATE events for URL_REQUESTs. while (startIndex + 1 < this.entries_.length && this.entries_[startIndex].type == EventType.URL_REQUEST_BLOCKED_ON_DELEGATE) { ++startIndex; } return this.entries_[startIndex]; } if (this.entries_[1].type == EventType.IPV6_PROBE_RUNNING) return this.entries_[1]; } return this.entries_[0]; }, /** * Returns the first entry with the specified type, or undefined if not * found. */ findLogEntryByType_: function(type) { for (var i = 0; i < this.entries_.length; ++i) { if (this.entries_[i].type == type) { return this.entries_[i]; } } return undefined; }, /** * Returns the beginning of the last entry with the specified type, or * undefined if not found. */ findLastLogEntryStartByType_: function(type) { for (var i = this.entries_.length - 1; i >= 0; --i) { if (this.entries_[i].type == type) { if (this.entries_[i].phase != EventPhase.PHASE_END) return this.entries_[i]; } } return undefined; }, getLogEntries: function() { return this.entries_; }, getSourceTypeString: function() { return EventSourceTypeNames[this.entries_[0].source.type]; }, getSourceType: function() { return this.entries_[0].source.type; }, getSourceId: function() { return this.entries_[0].source.id; }, /** * Returns the largest source ID seen before this object was received. * Used only for sorting SourceEntries without a source by source ID. */ getMaxPreviousEntrySourceId: function() { return this.maxPreviousSourceId_; }, isInactive: function() { return this.isInactive_; }, isError: function() { return this.isError_; }, getStartTime: function() { var startTicks = this.entries_[0].time; return timeutil.convertTimeTicksToTime(startTicks); }, /** * Returns time of last event if inactive. Returns current time otherwise. */ getEndTime: function() { if (!this.isInactive_) { return timeutil.getCurrentTime(); } else { var endTicks = this.entries_[this.entries_.length - 1].time; return timeutil.convertTimeTicksToTime(endTicks); } }, /** * Returns the time between the first and last events with a matching * source ID. If source is still active, uses the current time for the * last event. */ getDuration: function() { var startTime = this.getStartTime(); var endTime = this.getEndTime(); return endTime - startTime; }, /** * Prints descriptive text about |entries_| to a new node added to the end * of |parent|. */ printAsText: function(parent) { // The date will be undefined if not viewing a loaded log file. printLogEntriesAsText(this.entries_, parent, SourceTracker.getInstance().getPrivacyStripping(), Constants.clientInfo.numericDate); } }; return SourceEntry; })();
ThinkingBridge/platform_external_chromium_org
chrome/browser/resources/net_internals/source_entry.js
JavaScript
bsd-3-clause
11,507
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns:yui="http://yuilibrary.com/rdf/1.0/yui.rdf#"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <title>API: menu YAHOO.widget.Menu (YUI Library)</title> <link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css" /> <link rel="stylesheet" type="text/css" href="assets/api.css" /> <script type="text/javascript" src="assets/api-js"></script> <script type="text/javascript" src="assets/ac-js"></script> </head> <body id="yahoo-com"> <div id="doc3" class="yui-t2"> <div id="hd"> <h1><a href="http://developer.yahoo.com/yui/" title="Yahoo! UI Library">Yahoo! UI Library</a></h1> <h3>Menu&nbsp; <span class="subtitle">2.9.0</span></h3> <a href="./index.html" title="Yahoo! UI Library">Yahoo! UI Library</a> &gt; <a href="./module_menu.html" title="menu">menu</a> &gt; YAHOO.widget.Menu <form onsubmit="return false"> <div id="propertysearch"> Search: <input autocomplete="off" id="searchinput" /> <div id="searchresults"> &nbsp; </div> </div> </form> </div> <div id="bd"> <div id="yui-main"> <div class="yui-b"> <form action="#" name="yui-classopts-form" method="get" id="yui-classopts-form"> <fieldset> <legend>Filters</legend> <span class="classopts"><input type="checkbox" name="show_private" id="show_private" /> <label for="show_private">Show Private</label></span> <span class="classopts"><input type="checkbox" name="show_protected" id="show_protected" /> <label for="show_protected">Show Protected</label></span> <span class="classopts"><input type="checkbox" name="show_deprecated" id="show_deprecated" /> <label for="show_deprecated">Show Deprecated</label></span> </fieldset> </form> <h2> Class <b property="yui:name">YAHOO.widget.Menu</b> <span class="extends"> - extends <a href="YAHOO.widget.Overlay.html" title="YAHOO.widget.Overlay">YAHOO.widget.Overlay</a> </span> </h2> <!-- class tree goes here --> <dl class="subclasses" rel="yui:subclasses"> <dt>Known Subclasses:</dt> <dd> <span rel="yui:subclass" resource="YAHOO.widget.MenuBar.html"> <a href="YAHOO.widget.MenuBar.html" property="yui:name" title="YAHOO.widget.MenuBar">YAHOO.widget.MenuBar</a> </span> <span rel="yui:subclass" resource="YAHOO.widget.ContextMenu.html"> <a href="YAHOO.widget.ContextMenu.html" property="yui:name" title="YAHOO.widget.ContextMenu">YAHOO.widget.ContextMenu</a> </span> </dd> </dl> <div class="summary description" property="yui:description"> The Menu class creates a container that holds a vertical list representing a set of options or commands. Menu is the base class for all menu containers. </div> <div class="section constructor details" rel="yui:constructor" resource="#constructor"> <h3 id="constructor">Constructor</h3> <div class="content"> <div class="detail"> <strong property="yui:name">YAHOO.widget.Menu</strong> <code> ( p_oElement , p_oConfig ) </code> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_oElement</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String specifying the id attribute of the <code>&#60;div&#62;</code> element of the menu.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oElement</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String specifying the id attribute of the <code>&#60;select&#62;</code> element to be used as the data source for the menu.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oElement</span> &lt;<span property="yui:type"><a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/ level-one-html.html#ID-22445964">HTMLDivElement</a></span>&gt; </code> <span property="yui:description"> Object specifying the <code>&#60;div&#62;</code> element of the menu.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oElement</span> &lt;<span property="yui:type"><a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/ level-one-html.html#ID-94282980">HTMLSelectElement</a></span>&gt; </code> <span property="yui:description"> Object specifying the <code>&#60;select&#62;</code> element to be used as the data source for the menu.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oConfig</span> &lt;<span property="yui:type">Object</span>&gt; </code> <span property="yui:description"> Optional. Object literal specifying the configuration for the menu. See configuration class documentation for more details.</span> </dd> </dl> </div> </div> </div> </div> <div rel="yui:properties" resource="#properties"> <div class="section field details"> <h3 id="properties">Properties</h3> <div class="content"> <div class="private" rel="yui:property" resource="#property__aGroupTitleElements"> <h4><a name="property__aGroupTitleElements" property="yui:name">_aGroupTitleElements</a> - <code>private <span property="yui:type">Array</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Array of HTML element used to title groups of menu items. </div> </div> <div class="default" property="yui:defaultValue"> Default Value: [] </div> <hr /> </div> <div class="private" rel="yui:property" resource="#property__aItemGroups"> <h4><a name="property__aItemGroups" property="yui:name">_aItemGroups</a> - <code>private <span property="yui:type">Array</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Multi-dimensional Array representing the menu items as they are grouped in the menu. </div> </div> <div class="default" property="yui:defaultValue"> Default Value: [] </div> <hr /> </div> <div class="private" rel="yui:property" resource="#property__aListElements"> <h4><a name="property__aListElements" property="yui:name">_aListElements</a> - <code>private <span property="yui:type">Array</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Array of <code>&#60;ul&#62;</code> elements, each of which is the parent node for each item's <code>&#60;li&#62;</code> element. </div> </div> <div class="default" property="yui:defaultValue"> Default Value: [] </div> <hr /> </div> <div class="private" rel="yui:property" resource="#property__bHandledMouseOutEvent"> <h4><a name="property__bHandledMouseOutEvent" property="yui:name">_bHandledMouseOutEvent</a> - <code>private <span property="yui:type">Boolean</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Boolean indicating the current state of the menu's "mouseout" event. </div> </div> <div class="default" property="yui:defaultValue"> Default Value: false </div> <hr /> </div> <div class="private" rel="yui:property" resource="#property__bHandledMouseOverEvent"> <h4><a name="property__bHandledMouseOverEvent" property="yui:name">_bHandledMouseOverEvent</a> - <code>private <span property="yui:type">Boolean</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Boolean indicating the current state of the menu's "mouseover" event. </div> </div> <div class="default" property="yui:defaultValue"> Default Value: false </div> <hr /> </div> <div class="private" rel="yui:property" resource="#property__bStopMouseEventHandlers"> <h4><a name="property__bStopMouseEventHandlers" property="yui:name">_bStopMouseEventHandlers</a> - <code>private <span property="yui:type">Boolean</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Stops "mouseover," "mouseout," and "mousemove" event handlers from executing. </div> </div> <div class="default" property="yui:defaultValue"> Default Value: false </div> <hr /> </div> <div class="private" rel="yui:property" resource="#property__nCurrentMouseX"> <h4><a name="property__nCurrentMouseX" property="yui:name">_nCurrentMouseX</a> - <code>private <span property="yui:type">Number</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> The current x coordinate of the mouse inside the area of the menu. </div> </div> <div class="default" property="yui:defaultValue"> Default Value: 0 </div> <hr /> </div> <div class="private" rel="yui:property" resource="#property__sClassName"> <h4><a name="property__sClassName" property="yui:name">_sClassName</a> - <code>private <span property="yui:type">String</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> The current value of the "classname" configuration attribute. </div> </div> <div class="default" property="yui:defaultValue"> Default Value: null </div> <hr /> </div> <div class="private" rel="yui:property" resource="#property__useHideDelay"> <h4><a name="property__useHideDelay" property="yui:name">_useHideDelay</a> - <code>private <span property="yui:type">Boolean</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Boolean indicating if the "mouseover" and "mouseout" event handlers used for hiding the menu via a call to "YAHOO.lang.later" have already been assigned. </div> </div> <div class="default" property="yui:defaultValue"> Default Value: false </div> <hr /> </div> <div class="" rel="yui:property" resource="#property_activeItem"> <h4><a name="property_activeItem" property="yui:name">activeItem</a> - <code><span property="yui:type">YAHOO.widget.MenuItem</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Object reference to the item in the menu that has is selected. </div> </div> <div class="default" property="yui:defaultValue"> Default Value: null </div> <hr /> </div> <div class="" rel="yui:property" resource="#property_CSS_CLASS_NAME"> <h4><a name="property_CSS_CLASS_NAME" property="yui:name">CSS_CLASS_NAME</a> - <code>final <span property="yui:type">String</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> String representing the CSS class(es) to be applied to the menu's <code>&#60;div&#62;</code> element. </div> </div> <div class="default" property="yui:defaultValue"> Default Value: "yuimenu" </div> <hr /> </div> <div class="" rel="yui:property" resource="#property_GROUP_TITLE_TAG_NAME"> <h4><a name="property_GROUP_TITLE_TAG_NAME" property="yui:name">GROUP_TITLE_TAG_NAME</a> - <code>final <span property="yui:type">String</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> String representing the tagname of the HTML element used to title the menu's item groups. </div> </div> <div class="default" property="yui:defaultValue"> Default Value: H6 </div> <hr /> </div> <div class="" rel="yui:property" resource="#property_ITEM_TYPE"> <h4><a name="property_ITEM_TYPE" property="yui:name">ITEM_TYPE</a> - <code>final <span property="yui:type">YAHOO.widget.MenuItem</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Object representing the type of menu item to instantiate and add when parsing the child nodes (either <code>&#60;li&#62;</code> element, <code>&#60;optgroup&#62;</code> element or <code>&#60;option&#62;</code>) of the menu's source HTML element. </div> </div> <div class="default" property="yui:defaultValue"> Default Value: YAHOO.widget.MenuItem </div> <hr /> </div> <div class="" rel="yui:property" resource="#property_itemData"> <h4><a name="property_itemData" property="yui:name">itemData</a> - <code><span property="yui:type">Array</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Array of items to be added to the menu. The array can contain strings representing the text for each item to be created, object literals representing the menu item configuration properties, or MenuItem instances. This property should be set via the constructor using the configuration object literal. </div> </div> <div class="default" property="yui:defaultValue"> Default Value: null </div> <hr /> </div> <div class="" rel="yui:property" resource="#property_lazyLoad"> <h4><a name="property_lazyLoad" property="yui:name">lazyLoad</a> - <code><span property="yui:type">Boolean</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Boolean indicating if the menu's "lazy load" feature is enabled. If set to "true," initialization and rendering of the menu's items will be deferred until the first time it is made visible. This property should be set via the constructor using the configuration object literal. </div> </div> <div class="default" property="yui:defaultValue"> Default Value: false </div> <hr /> </div> <div class="" rel="yui:property" resource="#property_OFF_SCREEN_POSITION"> <h4><a name="property_OFF_SCREEN_POSITION" property="yui:name">OFF_SCREEN_POSITION</a> - <code>final <span property="yui:type">String</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Array representing the default x and y position that a menu should have when it is positioned outside the viewport by the "poistionOffScreen" method. </div> </div> <div class="default" property="yui:defaultValue"> Default Value: "-999em" </div> <hr /> </div> <div class="" rel="yui:property" resource="#property_parent"> <h4><a name="property_parent" property="yui:name">parent</a> - <code><span property="yui:type">YAHOO.widget.MenuItem</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Object reference to the menu's parent menu or menu item. This property can be set via the constructor using the configuration object literal. </div> </div> <div class="default" property="yui:defaultValue"> Default Value: null </div> <hr /> </div> <div class="" rel="yui:property" resource="#property_srcElement"> <h4><a name="property_srcElement" property="yui:name">srcElement</a> - <code><span property="yui:type"><a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/ level-one-html.html#ID-94282980">HTMLSelectElement</a>|<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html. html#ID-22445964">HTMLDivElement</a></span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Object reference to the HTML element (either <code>&#60;select&#62;</code> or <code>&#60;div&#62;</code>) used to create the menu. </div> </div> <div class="default" property="yui:defaultValue"> Default Value: null </div> <hr /> </div> </div> </div> <div rel="yui:inheritance"> <div class="section field inheritance" rel="yui:superclass" resource="YAHOO.widget.Module.html"> <h4>Properties inherited from <a href="YAHOO.widget.Module.html" property="yui:name" title="YAHOO.widget.Module">YAHOO.widget.Module</a>:</h4> <div class="content" rel="yui:properties"> <code> <span rel="yui:property" resource="YAHOO.widget.Module.html#property_body"> <a class="" href="YAHOO.widget.Module.html#property_body" property="yui:name" title="body">body</a><span class="">,</span> </span> <span rel="yui:property" resource="YAHOO.widget.Module.html#property_browser"> <a class=" deprecated" href="YAHOO.widget.Module.html#property_browser" property="yui:name" title="browser">browser</a><span class=" deprecated">,</span> </span> <span rel="yui:property" resource="YAHOO.widget.Module.html#property_cacheEffects"> <a class="" href="YAHOO.widget.Module.html#property_cacheEffects" property="yui:name" title="cacheEffects">cacheEffects</a><span class="">,</span> </span> <span rel="yui:property" resource="YAHOO.widget.Module.html#property_cfg"> <a class="" href="YAHOO.widget.Module.html#property_cfg" property="yui:name" title="cfg">cfg</a><span class="">,</span> </span> <span rel="yui:property" resource="YAHOO.widget.Module.html#property_contructor"> <a class="" href="YAHOO.widget.Module.html#property_contructor" property="yui:name" title="contructor">contructor</a><span class="">,</span> </span> <span rel="yui:property" resource="YAHOO.widget.Module.html#property_DEFAULT_CONFIG"> <a class="private" href="YAHOO.widget.Module.html#property_DEFAULT_CONFIG" property="yui:name" title="DEFAULT_CONFIG">DEFAULT_CONFIG</a><span class="private">,</span> </span> <span rel="yui:property" resource="YAHOO.widget.Module.html#property_element"> <a class="" href="YAHOO.widget.Module.html#property_element" property="yui:name" title="element">element</a><span class="">,</span> </span> <span rel="yui:property" resource="YAHOO.widget.Module.html#property_EVENT_TYPES"> <a class="private" href="YAHOO.widget.Module.html#property_EVENT_TYPES" property="yui:name" title="EVENT_TYPES">EVENT_TYPES</a><span class="private">,</span> </span> <span rel="yui:property" resource="YAHOO.widget.Module.html#property_footer"> <a class="" href="YAHOO.widget.Module.html#property_footer" property="yui:name" title="footer">footer</a><span class="">,</span> </span> <span rel="yui:property" resource="YAHOO.widget.Module.html#property_header"> <a class="" href="YAHOO.widget.Module.html#property_header" property="yui:name" title="header">header</a><span class="">,</span> </span> <span rel="yui:property" resource="YAHOO.widget.Module.html#property_id"> <a class="" href="YAHOO.widget.Module.html#property_id" property="yui:name" title="id">id</a><span class="">,</span> </span> <span rel="yui:property" resource="YAHOO.widget.Module.html#property_imageRoot"> <a class=" deprecated" href="YAHOO.widget.Module.html#property_imageRoot" property="yui:name" title="imageRoot">imageRoot</a><span class=" deprecated">,</span> </span> <span rel="yui:property" resource="YAHOO.widget.Module.html#property_isSecure"> <a class="" href="YAHOO.widget.Module.html#property_isSecure" property="yui:name" title="isSecure">isSecure</a><span class="">,</span> </span> <span rel="yui:property" resource="YAHOO.widget.Module.html#property_platform"> <a class=" deprecated" href="YAHOO.widget.Module.html#property_platform" property="yui:name" title="platform">platform</a> </span> </code> </div> </div> <div class="section field inheritance" rel="yui:superclass" resource="YAHOO.widget.Overlay.html"> <h4>Properties inherited from <a href="YAHOO.widget.Overlay.html" property="yui:name" title="YAHOO.widget.Overlay">YAHOO.widget.Overlay</a>:</h4> <div class="content" rel="yui:properties"> <code> <span rel="yui:property" resource="YAHOO.widget.Overlay.html#property_CONTEXT_TRIGGERS"> <a class="" href="YAHOO.widget.Overlay.html#property_CONTEXT_TRIGGERS" property="yui:name" title="CONTEXT_TRIGGERS">CONTEXT_TRIGGERS</a><span class="">,</span> </span> <span rel="yui:property" resource="YAHOO.widget.Overlay.html#property_DEFAULT_CONFIG"> <a class="private" href="YAHOO.widget.Overlay.html#property_DEFAULT_CONFIG" property="yui:name" title="DEFAULT_CONFIG">DEFAULT_CONFIG</a><span class="private">,</span> </span> <span rel="yui:property" resource="YAHOO.widget.Overlay.html#property_EVENT_TYPES"> <a class="private" href="YAHOO.widget.Overlay.html#property_EVENT_TYPES" property="yui:name" title="EVENT_TYPES">EVENT_TYPES</a><span class="private">,</span> </span> <span rel="yui:property" resource="YAHOO.widget.Overlay.html#property_YAHOO.widget.Overlay._initialized"> <a class="private" href="YAHOO.widget.Overlay.html#property_YAHOO.widget.Overlay._initialized" property="yui:name" title="YAHOO.widget.Overlay._initialized">YAHOO.widget.Overlay._initialized</a> </span> </code> </div> </div> </div> </div> <div rel="yui:methods" resource="#methods"> <div class="section method details"> <h3 id="methods">Methods</h3> <div class="content"> <div class="private" rel="yui:method" resource="#method__addItemToGroup"> <h4> <a name="method__addItemToGroup">_addItemToGroup</a></h4> <div class="detail" > <code> private YAHOO.widget.MenuItem <strong property="yui:name">_addItemToGroup</strong> ( p_nGroupIndex , p_oItem , p_nItemIndex ) </code> <div class="description" property="yui:description"> Adds a menu item to a group. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_nGroupIndex</span> &lt;<span property="yui:type">Number</span>&gt; </code> <span property="yui:description"> Number indicating the group to which the item belongs.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oItem</span> &lt;<span property="yui:type">YAHOO.widget.MenuItem</span>&gt; </code> <span property="yui:description"> Object reference for the MenuItem instance to be added to the menu.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oItem</span> &lt;<span property="yui:type">HTML</span>&gt; </code> <span property="yui:description"> String or markup specifying the content of the item to be added to the menu. The item is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oItem</span> &lt;<span property="yui:type">Object</span>&gt; </code> <span property="yui:description"> Object literal containing a set of menu item configuration properties.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_nItemIndex</span> &lt;<span property="yui:type">Number</span>&gt; </code> <span property="yui:description"> Optional. Number indicating the index at which the menu item should be added.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="protected" rel="yui:method" resource="#method__addShadowVisibleClass"> <h4> <a name="method__addShadowVisibleClass">_addShadowVisibleClass</a></h4> <div class="detail" > <code> protected void <strong property="yui:name">_addShadowVisibleClass</strong> ( ) </code> <div class="description" property="yui:description"> Adds the classname marker for a visible shadow, to the shadow element </div> <div class="description"> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__cancelHideDelay"> <h4> <a name="method__cancelHideDelay">_cancelHideDelay</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_cancelHideDelay</strong> ( ) </code> <div class="description" property="yui:description"> Cancels the call to "hideMenu." </div> <div class="description"> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__cancelShowDelay"> <h4> <a name="method__cancelShowDelay">_cancelShowDelay</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_cancelShowDelay</strong> ( ) </code> <div class="description" property="yui:description"> Cancels the call to the "showMenu." </div> <div class="description"> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__clearSetWidthFlag"> <h4> <a name="method__clearSetWidthFlag">_clearSetWidthFlag</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_clearSetWidthFlag</strong> ( ) </code> <div class="description" property="yui:description"> Change event listener for the "width" configuration property. This listener is added when a Menu's "width" configuration property is set by the "_setScrollHeight" method, and is used to set the "_widthSetForScroll" property to "false" if the "width" configuration property is changed after it was set by the "_setScrollHeight" method. If the "_widthSetForScroll" property is set to "false", and the "_setScrollHeight" method is in the process of tearing down scrolling functionality, it will maintain the Menu's new width rather than reseting it. </div> <div class="description"> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__configureSubmenu"> <h4> <a name="method__configureSubmenu">_configureSubmenu</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_configureSubmenu</strong> ( p_oItem ) </code> <div class="description" property="yui:description"> Subscribes the menu item's submenu to its parent menu's events. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_oItem</span> &lt;<span property="yui:type">YAHOO.widget.MenuItem</span>&gt; </code> <span property="yui:description"> Object reference for the MenuItem instance with the submenu to be configured.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__createItemGroup"> <h4> <a name="method__createItemGroup">_createItemGroup</a></h4> <div class="detail" > <code> private Array <strong property="yui:name">_createItemGroup</strong> ( p_nIndex ) </code> <div class="description" property="yui:description"> Creates a new menu item group (array) and its associated <code>&#60;ul&#62;</code> element. Returns an aray of menu item groups. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_nIndex</span> &lt;<span property="yui:type">Number</span>&gt; </code> <span property="yui:description"> Number indicating the group to create.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="protected" rel="yui:method" resource="#method__createShadow"> <h4> <a name="method__createShadow">_createShadow</a></h4> <div class="detail" > <code> protected void <strong property="yui:name">_createShadow</strong> ( ) </code> <div class="description" property="yui:description"> Used to create the shadow element, add it to the DOM, and subscribe listeners to keep it in sync. </div> <div class="description"> </div> </div> <hr /> </div> <div class="protected" rel="yui:method" resource="#method__didMouseLeave"> <h4> <a name="method__didMouseLeave">_didMouseLeave</a></h4> <div class="detail" > <code> protected boolean <strong property="yui:name">_didMouseLeave</strong> ( oRelatedTarget ) </code> <div class="description" property="yui:description"> Utilility method to determine if we really moused out of the menu based on the related target </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">oRelatedTarget</span> &lt;<span property="yui:type">HTMLElement</span>&gt; </code> <span property="yui:description"> The related target based on which we're making the decision</span> </dd> </dl> <dl> <dt>Returns: <code property="yui:return"> boolean </code></dt> <dd property="yui:returnInfo">true if it's OK to hide based on the related target.</dd> </dl> </div> </div> <hr /> </div> <div class="protected" rel="yui:method" resource="#method__disableScrollFooter"> <h4> <a name="method__disableScrollFooter">_disableScrollFooter</a></h4> <div class="detail" > <code> protected void <strong property="yui:name">_disableScrollFooter</strong> ( ) </code> <div class="description" property="yui:description"> Disables the footer used for scrolling the body of the menu. </div> <div class="description"> </div> </div> <hr /> </div> <div class="protected" rel="yui:method" resource="#method__disableScrollHeader"> <h4> <a name="method__disableScrollHeader">_disableScrollHeader</a></h4> <div class="detail" > <code> protected void <strong property="yui:name">_disableScrollHeader</strong> ( ) </code> <div class="description" property="yui:description"> Disables the header used for scrolling the body of the menu. </div> <div class="description"> </div> </div> <hr /> </div> <div class="protected" rel="yui:method" resource="#method__enableScrollFooter"> <h4> <a name="method__enableScrollFooter">_enableScrollFooter</a></h4> <div class="detail" > <code> protected void <strong property="yui:name">_enableScrollFooter</strong> ( ) </code> <div class="description" property="yui:description"> Enables the footer used for scrolling the body of the menu. </div> <div class="description"> </div> </div> <hr /> </div> <div class="protected" rel="yui:method" resource="#method__enableScrollHeader"> <h4> <a name="method__enableScrollHeader">_enableScrollHeader</a></h4> <div class="detail" > <code> protected void <strong property="yui:name">_enableScrollHeader</strong> ( ) </code> <div class="description" property="yui:description"> Enables the header used for scrolling the body of the menu. </div> <div class="description"> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__execHideDelay"> <h4> <a name="method__execHideDelay">_execHideDelay</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_execHideDelay</strong> ( ) </code> <div class="description" property="yui:description"> Hides the menu after the number of milliseconds specified by the "hidedelay" configuration property. </div> <div class="description"> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__execSubmenuHideDelay"> <h4> <a name="method__execSubmenuHideDelay">_execSubmenuHideDelay</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_execSubmenuHideDelay</strong> ( p_oSubmenu , p_nMouseX , p_nHideDelay ) </code> <div class="description" property="yui:description"> Hides a submenu after the number of milliseconds specified by the "submenuhidedelay" configuration property have elapsed. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_oSubmenu</span> &lt;<span property="yui:type">YAHOO.widget.Menu</span>&gt; </code> <span property="yui:description"> Object specifying the submenu that should be hidden.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_nMouseX</span> &lt;<span property="yui:type">Number</span>&gt; </code> <span property="yui:description"> The x coordinate of the mouse when it left the specified submenu's parent menu item.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_nHideDelay</span> &lt;<span property="yui:type">Number</span>&gt; </code> <span property="yui:description"> The number of milliseconds that should ellapse before the submenu is hidden.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__getFirstEnabledItem"> <h4> <a name="method__getFirstEnabledItem">_getFirstEnabledItem</a></h4> <div class="detail" > <code> private YAHOO.widget.MenuItem <strong property="yui:name">_getFirstEnabledItem</strong> ( ) </code> <div class="description" property="yui:description"> Returns the first enabled item in the menu. </div> <div class="description"> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__getItemGroup"> <h4> <a name="method__getItemGroup">_getItemGroup</a></h4> <div class="detail" > <code> private Array <strong property="yui:name">_getItemGroup</strong> ( p_nIndex ) </code> <div class="description" property="yui:description"> Returns the menu item group at the specified index. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_nIndex</span> &lt;<span property="yui:type">Number</span>&gt; </code> <span property="yui:description"> Number indicating the index of the menu item group to be retrieved.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__initSubTree"> <h4> <a name="method__initSubTree">_initSubTree</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_initSubTree</strong> ( ) </code> <div class="description" property="yui:description"> Iterates the childNodes of the source element to find nodes used to instantiate menu and menu items. </div> <div class="description"> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__onBeforeHide"> <h4> <a name="method__onBeforeHide">_onBeforeHide</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_onBeforeHide</strong> ( p_sType , p_aArgs ) </code> <div class="description" property="yui:description"> "beforehide" event handler for the menu. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String representing the name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Array of arguments sent when the event was fired.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__onBeforeRender"> <h4> <a name="method__onBeforeRender">_onBeforeRender</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_onBeforeRender</strong> ( p_sType , p_aArgs ) </code> <div class="description" property="yui:description"> "beforerender" event handler for the menu. Appends all of the <code>&#60;ul&#62;</code>, <code>&#60;li&#62;</code> and their accompanying title elements to the body element of the menu. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String representing the name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Array of arguments sent when the event was fired.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__onBeforeShow"> <h4> <a name="method__onBeforeShow">_onBeforeShow</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_onBeforeShow</strong> ( p_sType , p_aArgs ) </code> <div class="description" property="yui:description"> "beforeshow" event handler for the menu. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String representing the name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Array of arguments sent when the event was fired.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="protected" rel="yui:method" resource="#method__onBlur"> <h4> <a name="method__onBlur">_onBlur</a></h4> <div class="detail" > <code> protected void <strong property="yui:name">_onBlur</strong> ( p_sType , p_aArgs ) </code> <div class="description" property="yui:description"> "blur" event handler for a Menu instance. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> The name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Collection of arguments sent when the event was fired.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="protected" rel="yui:method" resource="#method__onClick"> <h4> <a name="method__onClick">_onClick</a></h4> <div class="detail" > <code> protected void <strong property="yui:name">_onClick</strong> ( p_sType , p_aArgs ) </code> <div class="description" property="yui:description"> "click" event handler for the menu. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String representing the name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Array of arguments sent when the event was fired.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__onHide"> <h4> <a name="method__onHide">_onHide</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_onHide</strong> ( p_sType , p_aArgs ) </code> <div class="description" property="yui:description"> "hide" event handler for the menu. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String representing the name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Array of arguments sent when the event was fired.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__onInit"> <h4> <a name="method__onInit">_onInit</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_onInit</strong> ( p_sType , p_aArgs ) </code> <div class="description" property="yui:description"> "init" event handler for the menu. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String representing the name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Array of arguments sent when the event was fired.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__onItemAdded"> <h4> <a name="method__onItemAdded">_onItemAdded</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_onItemAdded</strong> ( p_sType , p_aArgs ) </code> <div class="description" property="yui:description"> "itemadded" event handler for a Menu instance. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> The name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Collection of arguments sent when the event was fired.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="protected" rel="yui:method" resource="#method__onKeyDown"> <h4> <a name="method__onKeyDown">_onKeyDown</a></h4> <div class="detail" > <code> protected void <strong property="yui:name">_onKeyDown</strong> ( p_sType , p_aArgs ) </code> <div class="description" property="yui:description"> "keydown" event handler for the menu. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String representing the name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Array of arguments sent when the event was fired.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="protected" rel="yui:method" resource="#method__onKeyPress"> <h4> <a name="method__onKeyPress">_onKeyPress</a></h4> <div class="detail" > <code> protected void <strong property="yui:name">_onKeyPress</strong> ( p_sType , p_aArgs ) </code> <div class="description" property="yui:description"> "keypress" event handler for a Menu instance. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> The name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Collection of arguments sent when the event was fired.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__onMenuItemConfigChange"> <h4> <a name="method__onMenuItemConfigChange">_onMenuItemConfigChange</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_onMenuItemConfigChange</strong> ( p_sType , p_aArgs , p_oItem ) </code> <div class="description" property="yui:description"> "configchange" event handler for the menu's items. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String representing the name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Array of arguments sent when the event was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oItem</span> &lt;<span property="yui:type">YAHOO.widget.MenuItem</span>&gt; </code> <span property="yui:description"> Object representing the menu item that fired the event.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__onMenuItemDestroy"> <h4> <a name="method__onMenuItemDestroy">_onMenuItemDestroy</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_onMenuItemDestroy</strong> ( p_sType , p_aArgs , p_oItem ) </code> <div class="description" property="yui:description"> "destroy" event handler for the menu's items. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String representing the name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Array of arguments sent when the event was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oItem</span> &lt;<span property="yui:type">YAHOO.widget.MenuItem</span>&gt; </code> <span property="yui:description"> Object representing the menu item that fired the event.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="protected" rel="yui:method" resource="#method__onMouseMove"> <h4> <a name="method__onMouseMove">_onMouseMove</a></h4> <div class="detail" > <code> protected void <strong property="yui:name">_onMouseMove</strong> ( p_oEvent , p_oMenu ) </code> <div class="description" property="yui:description"> "click" event handler for the menu. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_oEvent</span> &lt;<span property="yui:type">Event</span>&gt; </code> <span property="yui:description"> Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oMenu</span> &lt;<span property="yui:type">YAHOO.widget.Menu</span>&gt; </code> <span property="yui:description"> Object representing the menu that fired the event.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="protected" rel="yui:method" resource="#method__onMouseOut"> <h4> <a name="method__onMouseOut">_onMouseOut</a></h4> <div class="detail" > <code> protected void <strong property="yui:name">_onMouseOut</strong> ( p_sType , p_aArgs ) </code> <div class="description" property="yui:description"> "mouseout" event handler for the menu. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String representing the name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Array of arguments sent when the event was fired.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="protected" rel="yui:method" resource="#method__onMouseOver"> <h4> <a name="method__onMouseOver">_onMouseOver</a></h4> <div class="detail" > <code> protected void <strong property="yui:name">_onMouseOver</strong> ( p_sType , p_aArgs ) </code> <div class="description" property="yui:description"> "mouseover" event handler for the menu. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String representing the name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Array of arguments sent when the event was fired.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__onParentMenuConfigChange"> <h4> <a name="method__onParentMenuConfigChange">_onParentMenuConfigChange</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_onParentMenuConfigChange</strong> ( p_sType , p_aArgs , p_oSubmenu ) </code> <div class="description" property="yui:description"> "configchange" event handler for a submenu. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String representing the name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Array of arguments sent when the event was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oSubmenu</span> &lt;<span property="yui:type">YAHOO.widget.Menu</span>&gt; </code> <span property="yui:description"> Object representing the submenu that subscribed to the event.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__onParentMenuRender"> <h4> <a name="method__onParentMenuRender">_onParentMenuRender</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_onParentMenuRender</strong> ( p_sType , p_aArgs , p_oSubmenu ) </code> <div class="description" property="yui:description"> "render" event handler for a submenu. Renders a submenu in response to the firing of its parent's "render" event. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String representing the name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Array of arguments sent when the event was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oSubmenu</span> &lt;<span property="yui:type">YAHOO.widget.Menu</span>&gt; </code> <span property="yui:description"> Object representing the submenu that subscribed to the event.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__onRender"> <h4> <a name="method__onRender">_onRender</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_onRender</strong> ( p_sType , p_aArgs ) </code> <div class="description" property="yui:description"> "render" event handler for the menu. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String representing the name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Array of arguments sent when the event was fired.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="protected" rel="yui:method" resource="#method__onScrollTargetMouseOut"> <h4> <a name="method__onScrollTargetMouseOut">_onScrollTargetMouseOut</a></h4> <div class="detail" > <code> protected void <strong property="yui:name">_onScrollTargetMouseOut</strong> ( p_oEvent , p_oMenu ) </code> <div class="description" property="yui:description"> "mouseout" event handler for the menu's "header" and "footer" elements. Used to stop scrolling the body of the menu up and down when the menu's "maxheight" configuration property is set to a value greater than 0. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_oEvent</span> &lt;<span property="yui:type">Event</span>&gt; </code> <span property="yui:description"> Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oMenu</span> &lt;<span property="yui:type">YAHOO.widget.Menu</span>&gt; </code> <span property="yui:description"> Object representing the menu that fired the event.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="protected" rel="yui:method" resource="#method__onScrollTargetMouseOver"> <h4> <a name="method__onScrollTargetMouseOver">_onScrollTargetMouseOver</a></h4> <div class="detail" > <code> protected void <strong property="yui:name">_onScrollTargetMouseOver</strong> ( p_oEvent , p_oMenu ) </code> <div class="description" property="yui:description"> "mouseover" event handler for the menu's "header" and "footer" elements. Used to scroll the body of the menu up and down when the menu's "maxheight" configuration property is set to a value greater than 0. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_oEvent</span> &lt;<span property="yui:type">Event</span>&gt; </code> <span property="yui:description"> Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oMenu</span> &lt;<span property="yui:type">YAHOO.widget.Menu</span>&gt; </code> <span property="yui:description"> Object representing the menu that fired the event.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__onShow"> <h4> <a name="method__onShow">_onShow</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_onShow</strong> ( p_sType , p_aArgs ) </code> <div class="description" property="yui:description"> "show" event handler for the menu. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String representing the name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Array of arguments sent when the event was fired.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__onVisibleChange"> <h4> <a name="method__onVisibleChange">_onVisibleChange</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_onVisibleChange</strong> ( p_sType , p_aArgs ) </code> <div class="description" property="yui:description"> Change event handler for the the menu's "visible" configuration property. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String representing the name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Array of arguments sent when the event was fired.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="protected" rel="yui:method" resource="#method__onYChange"> <h4> <a name="method__onYChange">_onYChange</a></h4> <div class="detail" > <code> protected void <strong property="yui:name">_onYChange</strong> ( p_sType , p_aArgs ) </code> <div class="description" property="yui:description"> "y" event handler for a Menu instance. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> The name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Collection of arguments sent when the event was fired.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__removeItemFromGroupByIndex"> <h4> <a name="method__removeItemFromGroupByIndex">_removeItemFromGroupByIndex</a></h4> <div class="detail" > <code> private YAHOO.widget.MenuItem <strong property="yui:name">_removeItemFromGroupByIndex</strong> ( p_nGroupIndex , p_nItemIndex ) </code> <div class="description" property="yui:description"> Removes a menu item from a group by index. Returns the menu item that was removed. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_nGroupIndex</span> &lt;<span property="yui:type">Number</span>&gt; </code> <span property="yui:description"> Number indicating the group to which the menu item belongs.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_nItemIndex</span> &lt;<span property="yui:type">Number</span>&gt; </code> <span property="yui:description"> Number indicating the index of the menu item to be removed.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__removeItemFromGroupByValue"> <h4> <a name="method__removeItemFromGroupByValue">_removeItemFromGroupByValue</a></h4> <div class="detail" > <code> private YAHOO.widget.MenuItem <strong property="yui:name">_removeItemFromGroupByValue</strong> ( p_nGroupIndex , p_oItem ) </code> <div class="description" property="yui:description"> Removes a menu item from a group by reference. Returns the menu item that was removed. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_nGroupIndex</span> &lt;<span property="yui:type">Number</span>&gt; </code> <span property="yui:description"> Number indicating the group to which the menu item belongs.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oItem</span> &lt;<span property="yui:type">YAHOO.widget.MenuItem</span>&gt; </code> <span property="yui:description"> Object reference for the MenuItem instance to be removed.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="protected" rel="yui:method" resource="#method__removeShadow"> <h4> <a name="method__removeShadow">_removeShadow</a></h4> <div class="detail" > <code> protected void <strong property="yui:name">_removeShadow</strong> ( ) </code> <div class="description" property="yui:description"> Removes the shadow element from the DOM, and unsubscribes all the listeners used to keep it in sync. Used to handle setting the shadow to false. </div> <div class="description"> </div> </div> <hr /> </div> <div class="protected" rel="yui:method" resource="#method__removeShadowVisibleClass"> <h4> <a name="method__removeShadowVisibleClass">_removeShadowVisibleClass</a></h4> <div class="detail" > <code> protected void <strong property="yui:name">_removeShadowVisibleClass</strong> ( ) </code> <div class="description" property="yui:description"> Removes the classname marker for a visible shadow, from the shadow element </div> <div class="description"> </div> </div> <hr /> </div> <div class="protected" rel="yui:method" resource="#method__replaceShadow"> <h4> <a name="method__replaceShadow">_replaceShadow</a></h4> <div class="detail" > <code> protected void <strong property="yui:name">_replaceShadow</strong> ( ) </code> <div class="description" property="yui:description"> Replaces the shadow element in the DOM with the current shadow element (this._shadow) </div> <div class="description"> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__setMaxHeight"> <h4> <a name="method__setMaxHeight">_setMaxHeight</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_setMaxHeight</strong> ( p_sType , p_aArgs , p_nMaxHeight ) </code> <div class="description" property="yui:description"> "renderEvent" handler used to defer the setting of the "maxheight" configuration property until the menu is rendered in lazy load scenarios. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> The name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Collection of arguments sent when the event was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_nMaxHeight</span> &lt;<span property="yui:type">Number</span>&gt; </code> <span property="yui:description"> Number representing the value to set for the "maxheight" configuration property.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__setScrollHeight"> <h4> <a name="method__setScrollHeight">_setScrollHeight</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_setScrollHeight</strong> ( p_nScrollHeight ) </code> <div class="description" property="yui:description"> </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_nScrollHeight</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> Number representing the scrolling height of the Menu.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="protected" rel="yui:method" resource="#method__shadowBeforeShow"> <h4> <a name="method__shadowBeforeShow">_shadowBeforeShow</a></h4> <div class="detail" > <code> protected void <strong property="yui:name">_shadowBeforeShow</strong> ( ) </code> <div class="description" property="yui:description"> The beforeShow event handler used to set up the shadow lazily when the menu is made visible. </div> <div class="description"> </div> </div> <hr /> </div> <div class="protected" rel="yui:method" resource="#method__sizeShadow"> <h4> <a name="method__sizeShadow">_sizeShadow</a></h4> <div class="detail" > <code> protected void <strong property="yui:name">_sizeShadow</strong> ( ) </code> <div class="description" property="yui:description"> Resizes the shadow to match the container bounding element </div> <div class="description"> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__stopMouseEventHandlers"> <h4> <a name="method__stopMouseEventHandlers">_stopMouseEventHandlers</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_stopMouseEventHandlers</strong> ( ) </code> <div class="description" property="yui:description"> Utility method to stop mouseevents from being fired if the DOM changes under a stationary mouse pointer (as opposed to the mouse moving over a DOM element). </div> <div class="description"> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method__subscribeScrollHandlers"> <h4> <a name="method__subscribeScrollHandlers">_subscribeScrollHandlers</a></h4> <div class="detail" > <code> void <strong property="yui:name">_subscribeScrollHandlers</strong> ( oHeader , oFooter ) </code> <div class="description" property="yui:description"> </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">oHeader</span> &lt;<span property="yui:type">HTMLElement</span>&gt; </code> <span property="yui:description"> The scroll header element</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">oFooter</span> &lt;<span property="yui:type">HTMLElement</span>&gt; </code> <span property="yui:description"> The scroll footer element</span> </dd> </dl> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__subscribeToItemEvents"> <h4> <a name="method__subscribeToItemEvents">_subscribeToItemEvents</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_subscribeToItemEvents</strong> ( p_oItem ) </code> <div class="description" property="yui:description"> Subscribes a menu to a menu item's event. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_oItem</span> &lt;<span property="yui:type">YAHOO.widget.MenuItem</span>&gt; </code> <span property="yui:description"> Object reference for the MenuItem instance whose events should be subscribed to.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method__unsubscribeScrollHandlers"> <h4> <a name="method__unsubscribeScrollHandlers">_unsubscribeScrollHandlers</a></h4> <div class="detail" > <code> void <strong property="yui:name">_unsubscribeScrollHandlers</strong> ( oHeader , oFooter ) </code> <div class="description" property="yui:description"> </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">oHeader</span> &lt;<span property="yui:type">HTMLElement</span>&gt; </code> <span property="yui:description"> The scroll header element</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">oFooter</span> &lt;<span property="yui:type">HTMLElement</span>&gt; </code> <span property="yui:description"> The scroll footer element</span> </dd> </dl> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method__updateItemProperties"> <h4> <a name="method__updateItemProperties">_updateItemProperties</a></h4> <div class="detail" > <code> private void <strong property="yui:name">_updateItemProperties</strong> ( p_nGroupIndex ) </code> <div class="description" property="yui:description"> Updates the "index," "groupindex," and "className" properties of the menu items in the specified group. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_nGroupIndex</span> &lt;<span property="yui:type">Number</span>&gt; </code> <span property="yui:description"> Number indicating the group of items to update.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_addItem"> <h4> <a name="method_addItem">addItem</a></h4> <div class="detail" > <code> YAHOO.widget.MenuItem <strong property="yui:name">addItem</strong> ( p_oItem , p_nGroupIndex ) </code> <div class="description" property="yui:description"> Appends an item to the menu. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_oItem</span> &lt;<span property="yui:type">YAHOO.widget.MenuItem</span>&gt; </code> <span property="yui:description"> Object reference for the MenuItem instance to be added to the menu.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oItem</span> &lt;<span property="yui:type">HTML</span>&gt; </code> <span property="yui:description"> String or markup specifying content of the item to be added to the menu. The item text is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oItem</span> &lt;<span property="yui:type">Object</span>&gt; </code> <span property="yui:description"> Object literal containing a set of menu item configuration properties.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_nGroupIndex</span> &lt;<span property="yui:type">Number</span>&gt; </code> <span property="yui:description"> Optional. Number indicating the group to which the item belongs.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_addItems"> <h4> <a name="method_addItems">addItems</a></h4> <div class="detail" > <code> Array <strong property="yui:name">addItems</strong> ( p_aItems , p_nGroupIndex ) </code> <div class="description" property="yui:description"> Adds an array of items to the menu. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_aItems</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Array of items to be added to the menu. The array can contain strings specifying the markup for the content of each item to be created, object literals specifying each of the menu item configuration properties, or MenuItem instances. The item content if provided as a string is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_nGroupIndex</span> &lt;<span property="yui:type">Number</span>&gt; </code> <span property="yui:description"> Optional. Number specifying the group to which the items belongs.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_blur"> <h4> <a name="method_blur">blur</a></h4> <div class="detail" > <code> void <strong property="yui:name">blur</strong> ( ) </code> <div class="description" property="yui:description"> Causes the menu to lose focus and fires the "blur" event. </div> <div class="description"> </div> </div> <hr /> </div> <div class="private" rel="yui:method" resource="#method_checkPosition"> <h4> <a name="method_checkPosition">checkPosition</a></h4> <div class="detail" > <code> private Boolean <strong property="yui:name">checkPosition</strong> ( p_sPosition ) </code> <div class="description" property="yui:description"> Checks to make sure that the value of the "position" property is one of the supported strings. Returns true if the position is supported. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sPosition</span> &lt;<span property="yui:type">Object</span>&gt; </code> <span property="yui:description"> String specifying the position of the menu.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_clearActiveItem"> <h4> <a name="method_clearActiveItem">clearActiveItem</a></h4> <div class="detail" > <code> void <strong property="yui:name">clearActiveItem</strong> ( p_bBlur ) </code> <div class="description" property="yui:description"> Sets the "selected" configuration property of the menu's active item to "false" and hides the item's submenu. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_bBlur</span> &lt;<span property="yui:type">Boolean</span>&gt; </code> <span property="yui:description"> Boolean indicating if the menu's active item should be blurred.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_clearContent"> <h4> <a name="method_clearContent">clearContent</a></h4> <div class="detail" > <code> void <strong property="yui:name">clearContent</strong> ( ) </code> <div class="description" property="yui:description"> Removes all of the content from the menu, including the menu items, group titles, header and footer. </div> <div class="description"> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_configClassName"> <h4> <a name="method_configClassName">configClassName</a></h4> <div class="detail" > <code> void <strong property="yui:name">configClassName</strong> ( p_sType , p_aArgs , p_oMenu ) </code> <div class="description" property="yui:description"> Event handler for when the "classname" configuration property of a menu changes. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> The name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Collection of arguments sent when the event was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oMenu</span> &lt;<span property="yui:type">YAHOO.widget.Menu</span>&gt; </code> <span property="yui:description"> The Menu instance fired the event.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_configContainer"> <h4> <a name="method_configContainer">configContainer</a></h4> <div class="detail" > <code> void <strong property="yui:name">configContainer</strong> ( p_sType , p_aArgs , p_oMenu ) </code> <div class="description" property="yui:description"> Event handler for when the "container" configuration property of the menu changes. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String representing the name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Array of arguments sent when the event was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oMenu</span> &lt;<span property="yui:type">YAHOO.widget.Menu</span>&gt; </code> <span property="yui:description"> Object representing the menu that fired the event.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_configDisabled"> <h4> <a name="method_configDisabled">configDisabled</a></h4> <div class="detail" > <code> void <strong property="yui:name">configDisabled</strong> ( p_sType , p_aArgs , p_oMenu ) </code> <div class="description" property="yui:description"> Event handler for when the "disabled" configuration property of a menu changes. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> The name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Collection of arguments sent when the event was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oMenu</span> &lt;<span property="yui:type">YAHOO.widget.Menu</span>&gt; </code> <span property="yui:description"> The Menu instance fired the event.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_configHideDelay"> <h4> <a name="method_configHideDelay">configHideDelay</a></h4> <div class="detail" > <code> void <strong property="yui:name">configHideDelay</strong> ( p_sType , p_aArgs , p_oMenu ) </code> <div class="description" property="yui:description"> Event handler for when the "hidedelay" configuration property of the menu changes. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String representing the name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Array of arguments sent when the event was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oMenu</span> &lt;<span property="yui:type">YAHOO.widget.Menu</span>&gt; </code> <span property="yui:description"> Object representing the menu that fired the event.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_configIframe"> <h4> <a name="method_configIframe">configIframe</a></h4> <div class="detail" > <code> void <strong property="yui:name">configIframe</strong> ( p_sType , p_aArgs , p_oMenu ) </code> <div class="description" property="yui:description"> Event handler for when the "iframe" configuration property of the menu changes. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String representing the name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Array of arguments sent when the event was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oMenu</span> &lt;<span property="yui:type">YAHOO.widget.Menu</span>&gt; </code> <span property="yui:description"> Object representing the menu that fired the event.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_configMaxHeight"> <h4> <a name="method_configMaxHeight">configMaxHeight</a></h4> <div class="detail" > <code> void <strong property="yui:name">configMaxHeight</strong> ( p_sType , p_aArgs , p_oMenu ) </code> <div class="description" property="yui:description"> Event handler for when the "maxheight" configuration property of a Menu changes. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> The name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Collection of arguments sent when the event was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oMenu</span> &lt;<span property="yui:type">YAHOO.widget.Menu</span>&gt; </code> <span property="yui:description"> The Menu instance fired the event.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_configPosition"> <h4> <a name="method_configPosition">configPosition</a></h4> <div class="detail" > <code> void <strong property="yui:name">configPosition</strong> ( p_sType , p_aArgs , p_oMenu ) </code> <div class="description" property="yui:description"> Event handler for when the "position" configuration property of the menu changes. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String representing the name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Array of arguments sent when the event was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oMenu</span> &lt;<span property="yui:type">YAHOO.widget.Menu</span>&gt; </code> <span property="yui:description"> Object representing the menu that fired the event.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_configShadow"> <h4> <a name="method_configShadow">configShadow</a></h4> <div class="detail" > <code> void <strong property="yui:name">configShadow</strong> ( p_sType , p_aArgs , p_oMenu ) </code> <div class="description" property="yui:description"> Event handler for when the "shadow" configuration property of a menu changes. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> The name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Collection of arguments sent when the event was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oMenu</span> &lt;<span property="yui:type">YAHOO.widget.Menu</span>&gt; </code> <span property="yui:description"> The Menu instance fired the event.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_configVisible"> <h4> <a name="method_configVisible">configVisible</a></h4> <div class="detail" > <code> void <strong property="yui:name">configVisible</strong> ( p_sType , p_aArgs , p_oMenu ) </code> <div class="description" property="yui:description"> Event handler for when the "visible" configuration property the menu changes. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sType</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String representing the name of the event that was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_aArgs</span> &lt;<span property="yui:type">Array</span>&gt; </code> <span property="yui:description"> Array of arguments sent when the event was fired.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oMenu</span> &lt;<span property="yui:type">YAHOO.widget.Menu</span>&gt; </code> <span property="yui:description"> Object representing the menu that fired the event.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_destroy"> <h4> <a name="method_destroy">destroy</a></h4> <div class="detail" > <code> void <strong property="yui:name">destroy</strong> ( shallowPurge ) </code> <div class="description" property="yui:description"> Removes the menu's <code>&#60;div&#62;</code> element (and accompanying child nodes) from the document. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">shallowPurge</span> &lt;<span property="yui:type">boolean</span>&gt; </code> <span property="yui:description"> If true, only the parent element's DOM event listeners are purged. If false, or not provided, all children are also purged of DOM event listeners. NOTE: The flag is a "shallowPurge" flag, as opposed to what may be a more intuitive "purgeChildren" flag to maintain backwards compatibility with behavior prior to 2.9.0.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_focus"> <h4> <a name="method_focus">focus</a></h4> <div class="detail" > <code> void <strong property="yui:name">focus</strong> ( ) </code> <div class="description" property="yui:description"> Causes the menu to receive focus and fires the "focus" event. </div> <div class="description"> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_getItem"> <h4> <a name="method_getItem">getItem</a></h4> <div class="detail" > <code> YAHOO.widget.MenuItem <strong property="yui:name">getItem</strong> ( p_nItemIndex , p_nGroupIndex ) </code> <div class="description" property="yui:description"> Returns the item at the specified index. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_nItemIndex</span> &lt;<span property="yui:type">Number</span>&gt; </code> <span property="yui:description"> Number indicating the ordinal position of the item to be retrieved.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_nGroupIndex</span> &lt;<span property="yui:type">Number</span>&gt; </code> <span property="yui:description"> Optional. Number indicating the group to which the item belongs.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_getItemGroups"> <h4> <a name="method_getItemGroups">getItemGroups</a></h4> <div class="detail" > <code> Array <strong property="yui:name">getItemGroups</strong> ( ) </code> <div class="description" property="yui:description"> Multi-dimensional Array representing the menu items as they are grouped in the menu. </div> <div class="description"> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_getItems"> <h4> <a name="method_getItems">getItems</a></h4> <div class="detail" > <code> Array <strong property="yui:name">getItems</strong> ( ) </code> <div class="description" property="yui:description"> Returns an array of all of the items in the menu. </div> <div class="description"> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_getRoot"> <h4> <a name="method_getRoot">getRoot</a></h4> <div class="detail" > <code> void <strong property="yui:name">getRoot</strong> ( ) </code> <div class="description" property="yui:description"> Finds the menu's root menu. </div> <div class="description"> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_getSubmenus"> <h4> <a name="method_getSubmenus">getSubmenus</a></h4> <div class="detail" > <code> Array <strong property="yui:name">getSubmenus</strong> ( ) </code> <div class="description" property="yui:description"> Returns an array of all of the submenus that are immediate children of the menu. </div> <div class="description"> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_hasFocus"> <h4> <a name="method_hasFocus">hasFocus</a></h4> <div class="detail" > <code> Boolean <strong property="yui:name">hasFocus</strong> ( ) </code> <div class="description" property="yui:description"> Returns a boolean indicating whether or not the menu has focus. </div> <div class="description"> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_init"> <h4> <a name="method_init">init</a></h4> <div class="detail" > <code> void <strong property="yui:name">init</strong> ( p_oElement , p_oConfig ) </code> <div class="description" property="yui:description"> The Menu class's initialization method. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_oElement</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String specifying the id attribute of the <code>&#60;div&#62;</code> element of the menu.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oElement</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String specifying the id attribute of the <code>&#60;select&#62;</code> element to be used as the data source for the menu.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oElement</span> &lt;<span property="yui:type"><a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/ level-one-html.html#ID-22445964">HTMLDivElement</a></span>&gt; </code> <span property="yui:description"> Object specifying the <code>&#60;div&#62;</code> element of the menu.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oElement</span> &lt;<span property="yui:type"><a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/ level-one-html.html#ID-94282980">HTMLSelectElement</a></span>&gt; </code> <span property="yui:description"> Object specifying the <code>&#60;select&#62;</code> element to be used as the data source for the menu.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oConfig</span> &lt;<span property="yui:type">Object</span>&gt; </code> <span property="yui:description"> Optional. Object literal specifying the configuration for the menu. See configuration class documentation for more details.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_initDefaultConfig"> <h4> <a name="method_initDefaultConfig">initDefaultConfig</a></h4> <div class="detail" > <code> void <strong property="yui:name">initDefaultConfig</strong> ( ) </code> <div class="description" property="yui:description"> Initializes the class's configurable properties which can be changed using the menu's Config object ("cfg"). </div> <div class="description"> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_initEvents"> <h4> <a name="method_initEvents">initEvents</a></h4> <div class="detail" > <code> void <strong property="yui:name">initEvents</strong> ( ) </code> <div class="description" property="yui:description"> Initializes the custom events for the menu. </div> <div class="description"> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_insertItem"> <h4> <a name="method_insertItem">insertItem</a></h4> <div class="detail" > <code> YAHOO.widget.MenuItem <strong property="yui:name">insertItem</strong> ( p_oItem , p_nItemIndex , p_nGroupIndex ) </code> <div class="description" property="yui:description"> Inserts an item into the menu at the specified index. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_oItem</span> &lt;<span property="yui:type">YAHOO.widget.MenuItem</span>&gt; </code> <span property="yui:description"> Object reference for the MenuItem instance to be added to the menu.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oItem</span> &lt;<span property="yui:type">String</span>&gt; </code> <span property="yui:description"> String specifying the text of the item to be added to the menu.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oItem</span> &lt;<span property="yui:type">Object</span>&gt; </code> <span property="yui:description"> Object literal containing a set of menu item configuration properties.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_nItemIndex</span> &lt;<span property="yui:type">Number</span>&gt; </code> <span property="yui:description"> Number indicating the ordinal position at which the item should be added.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_nGroupIndex</span> &lt;<span property="yui:type">Number</span>&gt; </code> <span property="yui:description"> Optional. Number indicating the group to which the item belongs.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_positionOffScreen"> <h4> <a name="method_positionOffScreen">positionOffScreen</a></h4> <div class="detail" > <code> void <strong property="yui:name">positionOffScreen</strong> ( ) </code> <div class="description" property="yui:description"> Positions the menu outside of the boundaries of the browser's viewport. Called automatically when a menu is hidden to ensure that it doesn't force the browser to render uncessary scrollbars. </div> <div class="description"> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_removeItem"> <h4> <a name="method_removeItem">removeItem</a></h4> <div class="detail" > <code> YAHOO.widget.MenuItem <strong property="yui:name">removeItem</strong> ( p_oObject , p_nGroupIndex ) </code> <div class="description" property="yui:description"> Removes the specified item from the menu. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_oObject</span> &lt;<span property="yui:type">YAHOO.widget.MenuItem</span>&gt; </code> <span property="yui:description"> Object reference for the MenuItem instance to be removed from the menu.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_oObject</span> &lt;<span property="yui:type">Number</span>&gt; </code> <span property="yui:description"> Number specifying the index of the item to be removed.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_nGroupIndex</span> &lt;<span property="yui:type">Number</span>&gt; </code> <span property="yui:description"> Optional. Number specifying the group to which the item belongs.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_setInitialFocus"> <h4> <a name="method_setInitialFocus">setInitialFocus</a></h4> <div class="detail" > <code> void <strong property="yui:name">setInitialFocus</strong> ( ) </code> <div class="description" property="yui:description"> Sets focus to the menu's first enabled item. </div> <div class="description"> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_setInitialSelection"> <h4> <a name="method_setInitialSelection">setInitialSelection</a></h4> <div class="detail" > <code> void <strong property="yui:name">setInitialSelection</strong> ( ) </code> <div class="description" property="yui:description"> Sets the "selected" configuration property of the menu's first enabled item to "true." </div> <div class="description"> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_setItemGroupTitle"> <h4> <a name="method_setItemGroupTitle">setItemGroupTitle</a></h4> <div class="detail" > <code> void <strong property="yui:name">setItemGroupTitle</strong> ( p_sGroupTitle , p_nGroupIndex ) </code> <div class="description" property="yui:description"> Sets the title of a group of menu items. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_sGroupTitle</span> &lt;<span property="yui:type">HTML</span>&gt; </code> <span property="yui:description"> String or markup specifying the title of the group. The title is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_nGroupIndex</span> &lt;<span property="yui:type">Number</span>&gt; </code> <span property="yui:description"> Optional. Number specifying the group to which the title belongs.</span> </dd> </dl> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_subscribe"> <h4> <a name="method_subscribe">subscribe</a></h4> <div class="detail" > <code> void <strong property="yui:name">subscribe</strong> ( p_type , p_fn , p_obj , p_override ) </code> <div class="description" property="yui:description"> Adds the specified CustomEvent subscriber to the menu and each of its submenus. </div> <div class="description"> <dl rel="yui:parameters"> <dt>Parameters:</dt> <dd rel="yui:parameter"> <code><span property="yui:name">p_type</span> &lt;<span property="yui:type">string</span>&gt; </code> <span property="yui:description"> the type, or name of the event</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_fn</span> &lt;<span property="yui:type">function</span>&gt; </code> <span property="yui:description"> the function to exectute when the event fires</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_obj</span> &lt;<span property="yui:type">Object</span>&gt; </code> <span property="yui:description"> An object to be passed along when the event fires</span> </dd> <dd rel="yui:parameter"> <code><span property="yui:name">p_override</span> &lt;<span property="yui:type">boolean</span>&gt; </code> <span property="yui:description"> If true, the obj passed in becomes the execution scope of the listener</span> </dd> </dl> </div> </div> <hr /> </div> <div class="" rel="yui:method" resource="#method_toString"> <h4> <a name="method_toString">toString</a></h4> <div class="detail" > <code> String <strong property="yui:name">toString</strong> ( ) </code> <div class="description" property="yui:description"> Returns a string representing the menu. </div> <div class="description"> </div> </div> <hr /> </div> </div> </div> <div rel="yui:inheritance"> <div class="section field inheritance" rel="yui:superclass" resource="YAHOO.widget.Module.html"> <h4>Methods inherited from <a href="YAHOO.widget.Module.html" property="yui:name" title="YAHOO.widget.Module">YAHOO.widget.Module</a>:</h4> <div class="content" rel="yui:methods"> <code> <span rel="yui:method" resource="YAHOO.widget.Module.html#method__addToParent"> <a class="protected" href="YAHOO.widget.Module.html#method__addToParent" property="yui:name" title="_addToParent">_addToParent</a><span class="protected">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method__createEffects"> <a class="protected" href="YAHOO.widget.Module.html#method__createEffects" property="yui:name" title="_createEffects">_createEffects</a><span class="protected">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method__initResizeMonitor"> <a class="protected" href="YAHOO.widget.Module.html#method__initResizeMonitor" property="yui:name" title="_initResizeMonitor">_initResizeMonitor</a><span class="protected">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method__renderBody"> <a class="protected" href="YAHOO.widget.Module.html#method__renderBody" property="yui:name" title="_renderBody">_renderBody</a><span class="protected">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method__renderFooter"> <a class="protected" href="YAHOO.widget.Module.html#method__renderFooter" property="yui:name" title="_renderFooter">_renderFooter</a><span class="protected">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method__renderHeader"> <a class="protected" href="YAHOO.widget.Module.html#method__renderHeader" property="yui:name" title="_renderHeader">_renderHeader</a><span class="protected">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method__supportsCWResize"> <a class="private" href="YAHOO.widget.Module.html#method__supportsCWResize" property="yui:name" title="_supportsCWResize">_supportsCWResize</a><span class="private">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method_appendToBody"> <a class="" href="YAHOO.widget.Module.html#method_appendToBody" property="yui:name" title="appendToBody">appendToBody</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method_appendToFooter"> <a class="" href="YAHOO.widget.Module.html#method_appendToFooter" property="yui:name" title="appendToFooter">appendToFooter</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method_appendToHeader"> <a class="" href="YAHOO.widget.Module.html#method_appendToHeader" property="yui:name" title="appendToHeader">appendToHeader</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method_configEffect"> <a class="" href="YAHOO.widget.Module.html#method_configEffect" property="yui:name" title="configEffect">configEffect</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method_configMonitorResize"> <a class="" href="YAHOO.widget.Module.html#method_configMonitorResize" property="yui:name" title="configMonitorResize">configMonitorResize</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method_configVisible"> <a class="" href="YAHOO.widget.Module.html#method_configVisible" property="yui:name" title="configVisible">configVisible</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method_destroy"> <a class="" href="YAHOO.widget.Module.html#method_destroy" property="yui:name" title="destroy">destroy</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method_hide"> <a class="" href="YAHOO.widget.Module.html#method_hide" property="yui:name" title="hide">hide</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method_init"> <a class="" href="YAHOO.widget.Module.html#method_init" property="yui:name" title="init">init</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method_initDefaultConfig"> <a class="" href="YAHOO.widget.Module.html#method_initDefaultConfig" property="yui:name" title="initDefaultConfig">initDefaultConfig</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method_initEvents"> <a class="" href="YAHOO.widget.Module.html#method_initEvents" property="yui:name" title="initEvents">initEvents</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method_initResizeMonitor"> <a class="" href="YAHOO.widget.Module.html#method_initResizeMonitor" property="yui:name" title="initResizeMonitor">initResizeMonitor</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method_onDomResize"> <a class="" href="YAHOO.widget.Module.html#method_onDomResize" property="yui:name" title="onDomResize">onDomResize</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method_render"> <a class="" href="YAHOO.widget.Module.html#method_render" property="yui:name" title="render">render</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method_setBody"> <a class="" href="YAHOO.widget.Module.html#method_setBody" property="yui:name" title="setBody">setBody</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method_setFooter"> <a class="" href="YAHOO.widget.Module.html#method_setFooter" property="yui:name" title="setFooter">setFooter</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method_setHeader"> <a class="" href="YAHOO.widget.Module.html#method_setHeader" property="yui:name" title="setHeader">setHeader</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method_show"> <a class="" href="YAHOO.widget.Module.html#method_show" property="yui:name" title="show">show</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Module.html#method_toString"> <a class="" href="YAHOO.widget.Module.html#method_toString" property="yui:name" title="toString">toString</a> </span> </code> </div> </div> <div class="section field inheritance" rel="yui:superclass" resource="YAHOO.widget.Overlay.html"> <h4>Methods inherited from <a href="YAHOO.widget.Overlay.html" property="yui:name" title="YAHOO.widget.Overlay">YAHOO.widget.Overlay</a>:</h4> <div class="content" rel="yui:methods"> <code> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method__alignOnTrigger"> <a class="protected" href="YAHOO.widget.Overlay.html#method__alignOnTrigger" property="yui:name" title="_alignOnTrigger">_alignOnTrigger</a><span class="protected">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method__autoFillOnHeightChange"> <a class="protected" href="YAHOO.widget.Overlay.html#method__autoFillOnHeightChange" property="yui:name" title="_autoFillOnHeightChange">_autoFillOnHeightChange</a><span class="protected">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method__findTriggerCE"> <a class="private" href="YAHOO.widget.Overlay.html#method__findTriggerCE" property="yui:name" title="_findTriggerCE">_findTriggerCE</a><span class="private">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method__getComputedHeight"> <a class="private" href="YAHOO.widget.Overlay.html#method__getComputedHeight" property="yui:name" title="_getComputedHeight">_getComputedHeight</a><span class="private">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method__getConstrainedPos"> <a class="protected" href="YAHOO.widget.Overlay.html#method__getConstrainedPos" property="yui:name" title="_getConstrainedPos">_getConstrainedPos</a><span class="protected">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method__getPreciseHeight"> <a class="private" href="YAHOO.widget.Overlay.html#method__getPreciseHeight" property="yui:name" title="_getPreciseHeight">_getPreciseHeight</a><span class="private">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method__preventOverlap"> <a class="protected" href="YAHOO.widget.Overlay.html#method__preventOverlap" property="yui:name" title="_preventOverlap">_preventOverlap</a><span class="protected">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method__primeXYFromDOM"> <a class="protected" href="YAHOO.widget.Overlay.html#method__primeXYFromDOM" property="yui:name" title="_primeXYFromDOM">_primeXYFromDOM</a><span class="protected">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method__processTriggers"> <a class="protected" href="YAHOO.widget.Overlay.html#method__processTriggers" property="yui:name" title="_processTriggers">_processTriggers</a><span class="protected">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method__setDomVisibility"> <a class="protected" href="YAHOO.widget.Overlay.html#method__setDomVisibility" property="yui:name" title="_setDomVisibility">_setDomVisibility</a><span class="protected">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method__validateAutoFillHeight"> <a class="protected" href="YAHOO.widget.Overlay.html#method__validateAutoFillHeight" property="yui:name" title="_validateAutoFillHeight">_validateAutoFillHeight</a><span class="protected">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_align"> <a class="" href="YAHOO.widget.Overlay.html#method_align" property="yui:name" title="align">align</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_bringToTop"> <a class="" href="YAHOO.widget.Overlay.html#method_bringToTop" property="yui:name" title="bringToTop">bringToTop</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_center"> <a class="" href="YAHOO.widget.Overlay.html#method_center" property="yui:name" title="center">center</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_configAutoFillHeight"> <a class="" href="YAHOO.widget.Overlay.html#method_configAutoFillHeight" property="yui:name" title="configAutoFillHeight">configAutoFillHeight</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_configConstrainToViewport"> <a class="" href="YAHOO.widget.Overlay.html#method_configConstrainToViewport" property="yui:name" title="configConstrainToViewport">configConstrainToViewport</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_configContext"> <a class="" href="YAHOO.widget.Overlay.html#method_configContext" property="yui:name" title="configContext">configContext</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_configFixedCenter"> <a class="" href="YAHOO.widget.Overlay.html#method_configFixedCenter" property="yui:name" title="configFixedCenter">configFixedCenter</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_configHeight"> <a class="" href="YAHOO.widget.Overlay.html#method_configHeight" property="yui:name" title="configHeight">configHeight</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_configIframe"> <a class="" href="YAHOO.widget.Overlay.html#method_configIframe" property="yui:name" title="configIframe">configIframe</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_configVisible"> <a class="" href="YAHOO.widget.Overlay.html#method_configVisible" property="yui:name" title="configVisible">configVisible</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_configWidth"> <a class="" href="YAHOO.widget.Overlay.html#method_configWidth" property="yui:name" title="configWidth">configWidth</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_configX"> <a class="" href="YAHOO.widget.Overlay.html#method_configX" property="yui:name" title="configX">configX</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_configXY"> <a class="" href="YAHOO.widget.Overlay.html#method_configXY" property="yui:name" title="configXY">configXY</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_configY"> <a class="" href="YAHOO.widget.Overlay.html#method_configY" property="yui:name" title="configY">configY</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_configzIndex"> <a class="" href="YAHOO.widget.Overlay.html#method_configzIndex" property="yui:name" title="configzIndex">configzIndex</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_destroy"> <a class="" href="YAHOO.widget.Overlay.html#method_destroy" property="yui:name" title="destroy">destroy</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_doCenterOnDOMEvent"> <a class="" href="YAHOO.widget.Overlay.html#method_doCenterOnDOMEvent" property="yui:name" title="doCenterOnDOMEvent">doCenterOnDOMEvent</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_enforceConstraints"> <a class="" href="YAHOO.widget.Overlay.html#method_enforceConstraints" property="yui:name" title="enforceConstraints">enforceConstraints</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_fillHeight"> <a class="" href="YAHOO.widget.Overlay.html#method_fillHeight" property="yui:name" title="fillHeight">fillHeight</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_fitsInViewport"> <a class="" href="YAHOO.widget.Overlay.html#method_fitsInViewport" property="yui:name" title="fitsInViewport">fitsInViewport</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_forceContainerRedraw"> <a class="" href="YAHOO.widget.Overlay.html#method_forceContainerRedraw" property="yui:name" title="forceContainerRedraw">forceContainerRedraw</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_getConstrainedX"> <a class="" href="YAHOO.widget.Overlay.html#method_getConstrainedX" property="yui:name" title="getConstrainedX">getConstrainedX</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_getConstrainedXY"> <a class="" href="YAHOO.widget.Overlay.html#method_getConstrainedXY" property="yui:name" title="getConstrainedXY">getConstrainedXY</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_getConstrainedY"> <a class="" href="YAHOO.widget.Overlay.html#method_getConstrainedY" property="yui:name" title="getConstrainedY">getConstrainedY</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_hideIframe"> <a class="" href="YAHOO.widget.Overlay.html#method_hideIframe" property="yui:name" title="hideIframe">hideIframe</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_hideMacGeckoScrollbars"> <a class="" href="YAHOO.widget.Overlay.html#method_hideMacGeckoScrollbars" property="yui:name" title="hideMacGeckoScrollbars">hideMacGeckoScrollbars</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_init"> <a class="" href="YAHOO.widget.Overlay.html#method_init" property="yui:name" title="init">init</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_initDefaultConfig"> <a class="" href="YAHOO.widget.Overlay.html#method_initDefaultConfig" property="yui:name" title="initDefaultConfig">initDefaultConfig</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_initEvents"> <a class="" href="YAHOO.widget.Overlay.html#method_initEvents" property="yui:name" title="initEvents">initEvents</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_moveTo"> <a class="" href="YAHOO.widget.Overlay.html#method_moveTo" property="yui:name" title="moveTo">moveTo</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_onDomResize"> <a class="" href="YAHOO.widget.Overlay.html#method_onDomResize" property="yui:name" title="onDomResize">onDomResize</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_showIframe"> <a class="" href="YAHOO.widget.Overlay.html#method_showIframe" property="yui:name" title="showIframe">showIframe</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_showMacGeckoScrollbars"> <a class="" href="YAHOO.widget.Overlay.html#method_showMacGeckoScrollbars" property="yui:name" title="showMacGeckoScrollbars">showMacGeckoScrollbars</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_stackIframe"> <a class="" href="YAHOO.widget.Overlay.html#method_stackIframe" property="yui:name" title="stackIframe">stackIframe</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_syncIframe"> <a class="" href="YAHOO.widget.Overlay.html#method_syncIframe" property="yui:name" title="syncIframe">syncIframe</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_syncPosition"> <a class="" href="YAHOO.widget.Overlay.html#method_syncPosition" property="yui:name" title="syncPosition">syncPosition</a><span class="">,</span> </span> <span rel="yui:method" resource="YAHOO.widget.Overlay.html#method_toString"> <a class="" href="YAHOO.widget.Overlay.html#method_toString" property="yui:name" title="toString">toString</a> </span> </code> </div> </div> </div> </div> <div rel="yui:events" resource="#events"> <div class="section method details"> <h3 id="events">Events</h3> <div class="content"> <div class="" rel="yui:event" resource="#event_clickEvent"> <h4> <a name="event_clickEvent">clickEvent</a></h4> <div class="detail"> <code> <strong property="yui:name">clickEvent</strong> ( ) </code> <div class="description" property="yui:description"> Fires when the user clicks the on the menu. Passes back the DOM Event object as an argument. </div> <div class="description"> </div> </div> <hr /> </div> <div class="" rel="yui:event" resource="#event_itemAddedEvent"> <h4> <a name="event_itemAddedEvent">itemAddedEvent</a></h4> <div class="detail"> <code> <strong property="yui:name">itemAddedEvent</strong> ( ) </code> <div class="description" property="yui:description"> Fires when an item is added to the menu. </div> <div class="description"> </div> </div> <hr /> </div> <div class="" rel="yui:event" resource="#event_itemRemovedEvent"> <h4> <a name="event_itemRemovedEvent">itemRemovedEvent</a></h4> <div class="detail"> <code> <strong property="yui:name">itemRemovedEvent</strong> ( ) </code> <div class="description" property="yui:description"> Fires when an item is removed to the menu. </div> <div class="description"> </div> </div> <hr /> </div> <div class="" rel="yui:event" resource="#event_keyDownEvent"> <h4> <a name="event_keyDownEvent">keyDownEvent</a></h4> <div class="detail"> <code> <strong property="yui:name">keyDownEvent</strong> ( ) </code> <div class="description" property="yui:description"> Fires when the user presses a key when one of the menu's items has focus. Passes back the DOM Event object as an argument. </div> <div class="description"> </div> </div> <hr /> </div> <div class="" rel="yui:event" resource="#event_keyPressEvent"> <h4> <a name="event_keyPressEvent">keyPressEvent</a></h4> <div class="detail"> <code> <strong property="yui:name">keyPressEvent</strong> ( ) </code> <div class="description" property="yui:description"> Fires when the user presses an alphanumeric key when one of the menu's items has focus. Passes back the DOM Event object as an argument. </div> <div class="description"> </div> </div> <hr /> </div> <div class="" rel="yui:event" resource="#event_keyUpEvent"> <h4> <a name="event_keyUpEvent">keyUpEvent</a></h4> <div class="detail"> <code> <strong property="yui:name">keyUpEvent</strong> ( ) </code> <div class="description" property="yui:description"> Fires when the user releases a key when one of the menu's items has focus. Passes back the DOM Event object as an argument. </div> <div class="description"> </div> </div> <hr /> </div> <div class="" rel="yui:event" resource="#event_mouseDownEvent"> <h4> <a name="event_mouseDownEvent">mouseDownEvent</a></h4> <div class="detail"> <code> <strong property="yui:name">mouseDownEvent</strong> ( ) </code> <div class="description" property="yui:description"> Fires when the user mouses down on the menu. Passes back the DOM Event object as an argument. </div> <div class="description"> </div> </div> <hr /> </div> <div class="" rel="yui:event" resource="#event_mouseOutEvent"> <h4> <a name="event_mouseOutEvent">mouseOutEvent</a></h4> <div class="detail"> <code> <strong property="yui:name">mouseOutEvent</strong> ( ) </code> <div class="description" property="yui:description"> Fires when the mouse has left the menu. Passes back the DOM Event object as an argument. </div> <div class="description"> </div> </div> <hr /> </div> <div class="" rel="yui:event" resource="#event_mouseOverEvent"> <h4> <a name="event_mouseOverEvent">mouseOverEvent</a></h4> <div class="detail"> <code> <strong property="yui:name">mouseOverEvent</strong> ( ) </code> <div class="description" property="yui:description"> Fires when the mouse has entered the menu. Passes back the DOM Event object as an argument. </div> <div class="description"> </div> </div> <hr /> </div> <div class="" rel="yui:event" resource="#event_mouseUpEvent"> <h4> <a name="event_mouseUpEvent">mouseUpEvent</a></h4> <div class="detail"> <code> <strong property="yui:name">mouseUpEvent</strong> ( ) </code> <div class="description" property="yui:description"> Fires when the user releases a mouse button while the mouse is over the menu. Passes back the DOM Event object as an argument. </div> <div class="description"> </div> </div> <hr /> </div> </div> </div> <div rel="yui:inheritance"> <div class="section field inheritance" rel="yui:superclass" resource="YAHOO.widget.Module.html"> <h4>Events inherited from <a href="YAHOO.widget.Module.html" property="yui:name" title="YAHOO.widget.Module">YAHOO.widget.Module</a>:</h4> <div class="content" rel="yui:events"> <code> <span rel="yui:event" resource="YAHOO.widget.Module.html#event_appendEvent"> <a class="" href="YAHOO.widget.Module.html#event_appendEvent" property="yui:name" title="appendEvent">appendEvent</a><span class="">,</span> </span> <span rel="yui:event" resource="YAHOO.widget.Module.html#event_beforeHideEvent"> <a class="" href="YAHOO.widget.Module.html#event_beforeHideEvent" property="yui:name" title="beforeHideEvent">beforeHideEvent</a><span class="">,</span> </span> <span rel="yui:event" resource="YAHOO.widget.Module.html#event_beforeInitEvent"> <a class="" href="YAHOO.widget.Module.html#event_beforeInitEvent" property="yui:name" title="beforeInitEvent">beforeInitEvent</a><span class="">,</span> </span> <span rel="yui:event" resource="YAHOO.widget.Module.html#event_beforeRenderEvent"> <a class="" href="YAHOO.widget.Module.html#event_beforeRenderEvent" property="yui:name" title="beforeRenderEvent">beforeRenderEvent</a><span class="">,</span> </span> <span rel="yui:event" resource="YAHOO.widget.Module.html#event_beforeShowEvent"> <a class="" href="YAHOO.widget.Module.html#event_beforeShowEvent" property="yui:name" title="beforeShowEvent">beforeShowEvent</a><span class="">,</span> </span> <span rel="yui:event" resource="YAHOO.widget.Module.html#event_changeBodyEvent"> <a class="" href="YAHOO.widget.Module.html#event_changeBodyEvent" property="yui:name" title="changeBodyEvent">changeBodyEvent</a><span class="">,</span> </span> <span rel="yui:event" resource="YAHOO.widget.Module.html#event_changeContentEvent"> <a class="" href="YAHOO.widget.Module.html#event_changeContentEvent" property="yui:name" title="changeContentEvent">changeContentEvent</a><span class="">,</span> </span> <span rel="yui:event" resource="YAHOO.widget.Module.html#event_changeFooterEvent"> <a class="" href="YAHOO.widget.Module.html#event_changeFooterEvent" property="yui:name" title="changeFooterEvent">changeFooterEvent</a><span class="">,</span> </span> <span rel="yui:event" resource="YAHOO.widget.Module.html#event_changeHeaderEvent"> <a class="" href="YAHOO.widget.Module.html#event_changeHeaderEvent" property="yui:name" title="changeHeaderEvent">changeHeaderEvent</a><span class="">,</span> </span> <span rel="yui:event" resource="YAHOO.widget.Module.html#event_destroyEvent"> <a class="" href="YAHOO.widget.Module.html#event_destroyEvent" property="yui:name" title="destroyEvent">destroyEvent</a><span class="">,</span> </span> <span rel="yui:event" resource="YAHOO.widget.Module.html#event_hideEvent"> <a class="" href="YAHOO.widget.Module.html#event_hideEvent" property="yui:name" title="hideEvent">hideEvent</a><span class="">,</span> </span> <span rel="yui:event" resource="YAHOO.widget.Module.html#event_initEvent"> <a class="" href="YAHOO.widget.Module.html#event_initEvent" property="yui:name" title="initEvent">initEvent</a><span class="">,</span> </span> <span rel="yui:event" resource="YAHOO.widget.Module.html#event_renderEvent"> <a class="" href="YAHOO.widget.Module.html#event_renderEvent" property="yui:name" title="renderEvent">renderEvent</a> </span> <span rel="yui:event" resource="YAHOO.widget.Module.html#event_showEvent"> <a class="" href="YAHOO.widget.Module.html#event_showEvent" property="yui:name" title="showEvent">showEvent</a> </span> <span rel="yui:event" resource="YAHOO.widget.Module.html#event_YAHOO.widget.Module.textResizeEvent"> <a class="" href="YAHOO.widget.Module.html#event_YAHOO.widget.Module.textResizeEvent" property="yui:name" title="YAHOO.widget.Module.textResizeEvent">YAHOO.widget.Module.textResizeEvent</a> </span> </code> </div> </div> <div class="section field inheritance" rel="yui:superclass" resource="YAHOO.widget.Overlay.html"> <h4>Events inherited from <a href="YAHOO.widget.Overlay.html" property="yui:name" title="YAHOO.widget.Overlay">YAHOO.widget.Overlay</a>:</h4> <div class="content" rel="yui:events"> <code> <span rel="yui:event" resource="YAHOO.widget.Overlay.html#event_beforeMoveEvent"> <a class="" href="YAHOO.widget.Overlay.html#event_beforeMoveEvent" property="yui:name" title="beforeMoveEvent">beforeMoveEvent</a><span class="">,</span> </span> <span rel="yui:event" resource="YAHOO.widget.Overlay.html#event_moveEvent"> <a class="" href="YAHOO.widget.Overlay.html#event_moveEvent" property="yui:name" title="moveEvent">moveEvent</a><span class="">,</span> </span> <span rel="yui:event" resource="YAHOO.widget.Overlay.html#event_YAHOO.widget.Overlay.windowResizeEvent"> <a class="" href="YAHOO.widget.Overlay.html#event_YAHOO.widget.Overlay.windowResizeEvent" property="yui:name" title="YAHOO.widget.Overlay.windowResizeEvent">YAHOO.widget.Overlay.windowResizeEvent</a><span class="">,</span> </span> <span rel="yui:event" resource="YAHOO.widget.Overlay.html#event_YAHOO.widget.Overlay.windowScrollEvent"> <a class="" href="YAHOO.widget.Overlay.html#event_YAHOO.widget.Overlay.windowScrollEvent" property="yui:name" title="YAHOO.widget.Overlay.windowScrollEvent">YAHOO.widget.Overlay.windowScrollEvent</a><span class="">,</span> </span> </code> </div> </div> </div> </div> <div rel="yui:attributes" resource="#configattributes"> <div class="section field details"> <h3 id="configattributes">Configuration Attributes</h3> <div class="content"> <div class="" rel="yui:attribute" resource="#config_autosubmenudisplay"> <h4><a name="config_autosubmenudisplay">autosubmenudisplay</a> <code>- <span property="yui:type">Boolean</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Boolean indicating if submenus are automatically made visible when the user mouses over the menu's items. </div> </div> <div class="default"> Default Value: true </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_classname"> <h4><a name="config_classname">classname</a> <code>- <span property="yui:type">String</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> String representing the CSS class to be applied to the menu's root <code>&#60;div&#62;</code> element. The specified class(es) are appended in addition to the default class as specified by the menu's CSS_CLASS_NAME constant. When set this property is automatically applied to all submenus. </div> </div> <div class="default"> Default Value: null </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_clicktohide"> <h4><a name="config_clicktohide">clicktohide</a> <code>- <span property="yui:type">Boolean</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Boolean indicating if the menu will automatically be hidden if the user clicks outside of it. This property is only applied when the "position" configuration property is set to dynamic and is automatically applied to all submenus. </div> </div> <div class="default"> Default Value: true </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_constraintoviewport"> <h4><a name="config_constraintoviewport">constraintoviewport</a> <code>- <span property="yui:type">Boolean</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Boolean indicating if the menu will try to remain inside the boundaries of the size of viewport. This property is only applied when the "position" configuration property is set to dynamic and is automatically applied to all submenus. </div> </div> <div class="default"> Default Value: true </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_container"> <h4><a name="config_container">container</a> <code>- <span property="yui:type"><a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/ level-one-html.html#ID-58190037">HTMLElement</a>|String</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> HTML element reference or string specifying the id attribute of the HTML element that the menu's markup should be rendered into. </div> </div> <div class="default"> Default Value: document.body </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_context"> <h4><a name="config_context">context</a> <code>- <span property="yui:type">Array</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Array of context arguments for context-sensitive positioning. The format is: [id or element, element corner, context corner]. For example, setting this property to ["img1", "tl", "bl"] would align the Menu's top left corner to the context element's bottom left corner. This property is only applied when the "position" configuration property is set to dynamic. </div> </div> <div class="default"> Default Value: null </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_disabled"> <h4><a name="config_disabled">disabled</a> <code>- <span property="yui:type">Boolean</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Boolean indicating if the menu should be disabled. Disabling a menu disables each of its items. (Disabled menu items are dimmed and will not respond to user input or fire events.) Disabled menus have a corresponding "disabled" CSS class applied to their root <code>&#60;div&#62;</code> element. </div> </div> <div class="default"> Default Value: false </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_effect"> <h4><a name="config_effect">effect</a> <code>- <span property="yui:type">Object</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Object or array of objects representing the ContainerEffect classes that are active for animating the container. When set this property is automatically applied to all submenus. </div> </div> <div class="default"> Default Value: null </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_fixedcenter"> <h4><a name="config_fixedcenter">fixedcenter</a> <code>- <span property="yui:type">Boolean</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Boolean indicating if the Menu should be anchored to the center of the viewport. This property is only applied when the "position" configuration property is set to dynamic. </div> </div> <div class="default"> Default Value: false </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_hidedelay"> <h4><a name="config_hidedelay">hidedelay</a> <code>- <span property="yui:type">Number</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Number indicating the time (in milliseconds) that should expire before the menu is hidden. This property is only applied when the "position" configuration property is set to dynamic and is automatically applied to all submenus. </div> </div> <div class="default"> Default Value: 0 </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_iframe"> <h4><a name="config_iframe">iframe</a> <code>- <span property="yui:type">Boolean</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Boolean indicating whether or not the Menu should have an IFRAME shim; used to prevent SELECT elements from poking through an Overlay instance in IE6. When set to "true", the iframe shim is created when the Menu instance is intially made visible. This property is only applied when the "position" configuration property is set to dynamic and is automatically applied to all submenus. </div> </div> <div class="default"> Default Value: true for IE6 and below, false for all other browsers. </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_keepopen"> <h4><a name="config_keepopen">keepopen</a> <code>- <span property="yui:type">Boolean</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Boolean indicating if the menu should remain open when clicked. </div> </div> <div class="default"> Default Value: false </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_maxheight"> <h4><a name="config_maxheight">maxheight</a> <code>- <span property="yui:type">Number</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Number defining the maximum height (in pixels) for a menu's body element (<code>&#60;div class="bd"&#62;</code>). Once a menu's body exceeds this height, the contents of the body are scrolled to maintain this value. This value cannot be set lower than the value of the "minscrollheight" configuration property. </div> </div> <div class="default"> Default Value: 0 </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_minscrollheight"> <h4><a name="config_minscrollheight">minscrollheight</a> <code>- <span property="yui:type">Number</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Number defining the minimum threshold for the "maxheight" configuration property. When set this property is automatically applied to all submenus. </div> </div> <div class="default"> Default Value: 90 </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_position"> <h4><a name="config_position">position</a> <code>- <span property="yui:type">String</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> String indicating how a menu should be positioned on the screen. Possible values are "static" and "dynamic." Static menus are visible by default and reside in the normal flow of the document (CSS position: static). Dynamic menus are hidden by default, reside out of the normal flow of the document (CSS position: absolute), and can overlay other elements on the screen. </div> </div> <div class="default"> Default Value: dynamic </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_preventcontextoverlap"> <h4><a name="config_preventcontextoverlap">preventcontextoverlap</a> <code>- <span property="yui:type">Boolean</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Boolean indicating whether or not a submenu should overlap its parent MenuItem when the "constraintoviewport" configuration property is set to "true". </div> </div> <div class="default"> Default Value: true </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_scrollincrement"> <h4><a name="config_scrollincrement">scrollincrement</a> <code>- <span property="yui:type">Number</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Number used to control the scroll speed of a menu. Used to increment the "scrollTop" property of the menu's body by when a menu's content is scrolling. When set this property is automatically applied to all submenus. </div> </div> <div class="default"> Default Value: 1 </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_shadow"> <h4><a name="config_shadow">shadow</a> <code>- <span property="yui:type">Boolean</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Boolean indicating if the menu should have a shadow. </div> </div> <div class="default"> Default Value: true </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_showdelay"> <h4><a name="config_showdelay">showdelay</a> <code>- <span property="yui:type">Number</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Number indicating the time (in milliseconds) that should expire before a submenu is made visible when the user mouses over the menu's items. This property is only applied when the "position" configuration property is set to dynamic and is automatically applied to all submenus. </div> </div> <div class="default"> Default Value: 250 </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_submenualignment"> <h4><a name="config_submenualignment">submenualignment</a> <code>- <span property="yui:type">Array</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Array defining how submenus should be aligned to their parent menu item. The format is: [itemCorner, submenuCorner]. By default a submenu's top left corner is aligned to its parent menu item's top right corner. </div> </div> <div class="default"> Default Value: ["tl","tr"] </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_submenuhidedelay"> <h4><a name="config_submenuhidedelay">submenuhidedelay</a> <code>- <span property="yui:type">Number</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Number indicating the time (in milliseconds) that should expire before a submenu is hidden when the user mouses out of a menu item heading in the direction of a submenu. The value must be greater than or equal to the value specified for the "showdelay" configuration property. This property is only applied when the "position" configuration property is set to dynamic and is automatically applied to all submenus. </div> </div> <div class="default"> Default Value: 250 </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_visible"> <h4><a name="config_visible">visible</a> <code>- <span property="yui:type">Boolean</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Boolean indicating whether or not the menu is visible. If the menu's "position" configuration property is set to "dynamic" (the default), this property toggles the menu's <code>&#60;div&#62;</code> element's "visibility" style property between "visible" (true) or "hidden" (false). If the menu's "position" configuration property is set to "static" this property toggles the menu's <code>&#60;div&#62;</code> element's "display" style property between "block" (true) or "none" (false). </div> </div> <div class="default"> Default Value: false </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_x"> <h4><a name="config_x">x</a> <code>- <span property="yui:type">Number</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Number representing the absolute x-coordinate position of the Menu. This property is only applied when the "position" configuration property is set to dynamic. </div> </div> <div class="default"> Default Value: null </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_xy"> <h4><a name="config_xy">xy</a> <code>- <span property="yui:type">Number[]</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Array of the absolute x and y positions of the Menu. This property is only applied when the "position" configuration property is set to dynamic. </div> </div> <div class="default"> Default Value: null </div> <hr /> </div> <div class="" rel="yui:attribute" resource="#config_y"> <h4><a name="config_y">y</a> <code>- <span property="yui:type">Number</span></code> </h4> <div class="detail"> <div class="description" property="yui:description"> Number representing the absolute y-coordinate position of the Menu. This property is only applied when the "position" configuration property is set to dynamic. </div> </div> <div class="default"> Default Value: null </div> <hr /> </div> </div> </div> <div rel="yui:inheritance"> <div class="section field inheritance" rel="yui:superclass" resource="YAHOO.widget.Module.html"> <h4>Configuration attributes inherited from <a href="YAHOO.widget.Module.html" property="yui:name" title="YAHOO.widget.Module">YAHOO.widget.Module</a>:</h4> <div class="content" rel="yui:attributes"> <code> <span rel="yui:attribute" resource="YAHOO.widget.Module.html#config_appendtodocumentbody"> <a class="" href="YAHOO.widget.Module.html#config_appendtodocumentbody" property="yui:name" title="appendtodocumentbody">appendtodocumentbody</a><span class="">,</span> </span> <span rel="yui:attribute" resource="YAHOO.widget.Module.html#config_effect"> <a class="" href="YAHOO.widget.Module.html#config_effect" property="yui:name" title="effect">effect</a> </span> <span rel="yui:attribute" resource="YAHOO.widget.Module.html#config_monitorresize"> <a class="" href="YAHOO.widget.Module.html#config_monitorresize" property="yui:name" title="monitorresize">monitorresize</a> </span> <span rel="yui:attribute" resource="YAHOO.widget.Module.html#config_visible"> <a class="" href="YAHOO.widget.Module.html#config_visible" property="yui:name" title="visible">visible</a> </span> </code> </div> </div> <div class="section field inheritance" rel="yui:superclass" resource="YAHOO.widget.Overlay.html"> <h4>Configuration attributes inherited from <a href="YAHOO.widget.Overlay.html" property="yui:name" title="YAHOO.widget.Overlay">YAHOO.widget.Overlay</a>:</h4> <div class="content" rel="yui:attributes"> <code> <span rel="yui:attribute" resource="YAHOO.widget.Overlay.html#config_autofillheight"> <a class="" href="YAHOO.widget.Overlay.html#config_autofillheight" property="yui:name" title="autofillheight">autofillheight</a><span class="">,</span> </span> <span rel="yui:attribute" resource="YAHOO.widget.Overlay.html#config_constraintoviewport"> <a class="" href="YAHOO.widget.Overlay.html#config_constraintoviewport" property="yui:name" title="constraintoviewport">constraintoviewport</a><span class="">,</span> </span> <span rel="yui:attribute" resource="YAHOO.widget.Overlay.html#config_context"> <a class="" href="YAHOO.widget.Overlay.html#config_context" property="yui:name" title="context">context</a><span class="">,</span> </span> <span rel="yui:attribute" resource="YAHOO.widget.Overlay.html#config_fixedcenter"> <a class="" href="YAHOO.widget.Overlay.html#config_fixedcenter" property="yui:name" title="fixedcenter">fixedcenter</a><span class="">,</span> </span> <span rel="yui:attribute" resource="YAHOO.widget.Overlay.html#config_height"> <a class="" href="YAHOO.widget.Overlay.html#config_height" property="yui:name" title="height">height</a><span class="">,</span> </span> <span rel="yui:attribute" resource="YAHOO.widget.Overlay.html#config_iframe"> <a class="" href="YAHOO.widget.Overlay.html#config_iframe" property="yui:name" title="iframe">iframe</a> </span> <span rel="yui:attribute" resource="YAHOO.widget.Overlay.html#config_preventcontextoverlap"> <a class="" href="YAHOO.widget.Overlay.html#config_preventcontextoverlap" property="yui:name" title="preventcontextoverlap">preventcontextoverlap</a> </span> <span rel="yui:attribute" resource="YAHOO.widget.Overlay.html#config_width"> <a class="" href="YAHOO.widget.Overlay.html#config_width" property="yui:name" title="width">width</a> </span> <span rel="yui:attribute" resource="YAHOO.widget.Overlay.html#config_x"> <a class="" href="YAHOO.widget.Overlay.html#config_x" property="yui:name" title="x">x</a> </span> <span rel="yui:attribute" resource="YAHOO.widget.Overlay.html#config_xy"> <a class="" href="YAHOO.widget.Overlay.html#config_xy" property="yui:name" title="xy">xy</a> </span> <span rel="yui:attribute" resource="YAHOO.widget.Overlay.html#config_y"> <a class="" href="YAHOO.widget.Overlay.html#config_y" property="yui:name" title="y">y</a> </span> <span rel="yui:attribute" resource="YAHOO.widget.Overlay.html#config_zIndex"> <a class="" href="YAHOO.widget.Overlay.html#config_zIndex" property="yui:name" title="zIndex">zIndex</a> </span> </code> </div> </div> </div> </div> </div> </div> <div class="yui-b"> <div class="nav"> <div id="moduleList" class="module"> <h4>Modules</h4> <ul class="content"> <li class=""><a href="module_animation.html" title="animation">animation</a></li> <li class=""><a href="module_autocomplete.html" title="autocomplete">autocomplete</a></li> <li class=""><a href="module_button.html" title="button">button</a></li> <li class=""><a href="module_calendar.html" title="calendar">calendar</a></li> <li class=""><a href="module_carousel.html" title="carousel">carousel</a></li> <li class=""><a href="module_charts.html" title="charts">charts</a></li> <li class=""><a href="module_colorpicker.html" title="colorpicker">colorpicker</a></li> <li class=""><a href="module_connection.html" title="connection">connection</a></li> <li class=""><a href="module_container.html" title="container">container</a></li> <li class=""><a href="module_cookie.html" title="cookie">cookie</a></li> <li class=""><a href="module_datasource.html" title="datasource">datasource</a></li> <li class=""><a href="module_datatable.html" title="datatable">datatable</a></li> <li class=""><a href="module_datemath.html" title="datemath">datemath</a></li> <li class=""><a href="module_dom.html" title="dom">dom</a></li> <li class=""><a href="module_dragdrop.html" title="dragdrop">dragdrop</a></li> <li class=""><a href="module_editor.html" title="editor">editor</a></li> <li class=""><a href="module_element.html" title="element">element</a></li> <li class=""><a href="module_element-delegate.html" title="element-delegate">element-delegate</a></li> <li class=""><a href="module_event.html" title="event">event</a></li> <li class=""><a href="module_event-delegate.html" title="event-delegate">event-delegate</a></li> <li class=""><a href="module_event-mouseenter.html" title="event-mouseenter">event-mouseenter</a></li> <li class=""><a href="module_event-simulate.html" title="event-simulate">event-simulate</a></li> <li class=""><a href="module_get.html" title="get">get</a></li> <li class=""><a href="module_history.html" title="history">history</a></li> <li class=""><a href="module_imagecropper.html" title="imagecropper">imagecropper</a></li> <li class=""><a href="module_imageloader.html" title="imageloader">imageloader</a></li> <li class=""><a href="module_json.html" title="json">json</a></li> <li class=""><a href="module_layout.html" title="layout">layout</a></li> <li class=""><a href="module_logger.html" title="logger">logger</a></li> <li class="selected"><a href="module_menu.html" title="menu">menu</a></li> <li class=""><a href="module_paginator.html" title="paginator">paginator</a></li> <li class=""><a href="module_profiler.html" title="profiler">profiler</a></li> <li class=""><a href="module_profilerviewer.html" title="profilerviewer">profilerviewer</a></li> <li class=""><a href="module_progressbar.html" title="progressbar">progressbar</a></li> <li class=""><a href="module_resize.html" title="resize">resize</a></li> <li class=""><a href="module_selector.html" title="selector">selector</a></li> <li class=""><a href="module_slider.html" title="slider">slider</a></li> <li class=""><a href="module_storage.html" title="Storage">Storage</a></li> <li class=""><a href="module_stylesheet.html" title="stylesheet">stylesheet</a></li> <li class=""><a href="module_swf.html" title="swf">swf</a></li> <li class=""><a href="module_swfdetect.html" title="swfdetect">swfdetect</a></li> <li class=""><a href="module_swfstore.html" title="swfstore">swfstore</a></li> <li class=""><a href="module_tabview.html" title="tabview">tabview</a></li> <li class=""><a href="module_treeview.html" title="treeview">treeview</a></li> <li class=""><a href="module_uploader.html" title="uploader">uploader</a></li> <li class=""><a href="module_yahoo.html" title="yahoo">yahoo</a></li> <li class=""><a href="module_yuiloader.html" title="yuiloader">yuiloader</a></li> <li class=""><a href="module_yuitest.html" title="yuitest">yuitest</a></li> </ul> </div> <div id="classList" class="module"> <h4>Classes</h4> <ul class="content"> <li class=""><a href="YAHOO.widget.ContextMenu.html" title="YAHOO.widget.ContextMenu">YAHOO.widget.ContextMenu</a></li> <li class=""><a href="YAHOO.widget.ContextMenuItem.html" title="YAHOO.widget.ContextMenuItem">YAHOO.widget.ContextMenuItem</a></li> <li class="selected"><a href="YAHOO.widget.Menu.html" title="YAHOO.widget.Menu">YAHOO.widget.Menu</a></li> <li class=""><a href="YAHOO.widget.MenuBar.html" title="YAHOO.widget.MenuBar">YAHOO.widget.MenuBar</a></li> <li class=""><a href="YAHOO.widget.MenuBarItem.html" title="YAHOO.widget.MenuBarItem">YAHOO.widget.MenuBarItem</a></li> <li class=""><a href="YAHOO.widget.MenuItem.html" title="YAHOO.widget.MenuItem">YAHOO.widget.MenuItem</a></li> <li class=""><a href="YAHOO.widget.MenuManager.html" title="YAHOO.widget.MenuManager">YAHOO.widget.MenuManager</a></li> </ul> </div> <div id="fileList" class="module"> <h4>Files</h4> <ul class="content"> <li class=""><a href="contextmenu.js.html" title="contextmenu.js">contextmenu.js</a></li> <li class=""><a href="contextmenuitem.js.html" title="contextmenuitem.js">contextmenuitem.js</a></li> <li class=""><a href="menu.js.html" title="menu.js">menu.js</a></li> <li class=""><a href="menuariaplugin.js.html" title="menuariaplugin.js">menuariaplugin.js</a></li> <li class=""><a href="menubar.js.html" title="menubar.js">menubar.js</a></li> <li class=""><a href="menubaritem.js.html" title="menubaritem.js">menubaritem.js</a></li> <li class=""><a href="menuitem.js.html" title="menuitem.js">menuitem.js</a></li> <li class=""><a href="menumanager.js.html" title="menumanager.js">menumanager.js</a></li> </ul> </div> <div id="propertyList" class="module"> <h4>Properties</h4> <ul class="content"> <li class="private"><a href="#property__aGroupTitleElements" title="_aGroupTitleElements">_aGroupTitleElements</a></li> <li class="private"><a href="#property__aItemGroups" title="_aItemGroups">_aItemGroups</a></li> <li class="private"><a href="#property__aListElements" title="_aListElements">_aListElements</a></li> <li class="private"><a href="#property__bHandledMouseOutEvent" title="_bHandledMouseOutEvent">_bHandledMouseOutEvent</a></li> <li class="private"><a href="#property__bHandledMouseOverEvent" title="_bHandledMouseOverEvent">_bHandledMouseOverEvent</a></li> <li class="private"><a href="#property__bStopMouseEventHandlers" title="_bStopMouseEventHandlers">_bStopMouseEventHandlers</a></li> <li class="private"><a href="#property__nCurrentMouseX" title="_nCurrentMouseX">_nCurrentMouseX</a></li> <li class="private"><a href="#property__sClassName" title="_sClassName">_sClassName</a></li> <li class="private"><a href="#property__useHideDelay" title="_useHideDelay">_useHideDelay</a></li> <li class=""><a href="#property_activeItem" title="activeItem">activeItem</a></li> <li class=""><a href="#property_CSS_CLASS_NAME" title="CSS_CLASS_NAME">CSS_CLASS_NAME</a></li> <li class=""><a href="#property_GROUP_TITLE_TAG_NAME" title="GROUP_TITLE_TAG_NAME">GROUP_TITLE_TAG_NAME</a></li> <li class=""><a href="#property_ITEM_TYPE" title="ITEM_TYPE">ITEM_TYPE</a></li> <li class=""><a href="#property_itemData" title="itemData">itemData</a></li> <li class=""><a href="#property_lazyLoad" title="lazyLoad">lazyLoad</a></li> <li class=""><a href="#property_OFF_SCREEN_POSITION" title="OFF_SCREEN_POSITION">OFF_SCREEN_POSITION</a></li> <li class=""><a href="#property_parent" title="parent">parent</a></li> <li class=""><a href="#property_srcElement" title="srcElement">srcElement</a></li> </ul> </div> <div id="methodsList" class="module"> <h4>Methods</h4> <ul class="content"> <li class="private"><a href="#method__addItemToGroup" title="_addItemToGroup">_addItemToGroup</a></li> <li class="protected"><a href="#method__addShadowVisibleClass" title="_addShadowVisibleClass">_addShadowVisibleClass</a></li> <li class="private"><a href="#method__cancelHideDelay" title="_cancelHideDelay">_cancelHideDelay</a></li> <li class="private"><a href="#method__cancelShowDelay" title="_cancelShowDelay">_cancelShowDelay</a></li> <li class="private"><a href="#method__clearSetWidthFlag" title="_clearSetWidthFlag">_clearSetWidthFlag</a></li> <li class="private"><a href="#method__configureSubmenu" title="_configureSubmenu">_configureSubmenu</a></li> <li class="private"><a href="#method__createItemGroup" title="_createItemGroup">_createItemGroup</a></li> <li class="protected"><a href="#method__createShadow" title="_createShadow">_createShadow</a></li> <li class="protected"><a href="#method__didMouseLeave" title="_didMouseLeave">_didMouseLeave</a></li> <li class="protected"><a href="#method__disableScrollFooter" title="_disableScrollFooter">_disableScrollFooter</a></li> <li class="protected"><a href="#method__disableScrollHeader" title="_disableScrollHeader">_disableScrollHeader</a></li> <li class="protected"><a href="#method__enableScrollFooter" title="_enableScrollFooter">_enableScrollFooter</a></li> <li class="protected"><a href="#method__enableScrollHeader" title="_enableScrollHeader">_enableScrollHeader</a></li> <li class="private"><a href="#method__execHideDelay" title="_execHideDelay">_execHideDelay</a></li> <li class="private"><a href="#method__execSubmenuHideDelay" title="_execSubmenuHideDelay">_execSubmenuHideDelay</a></li> <li class="private"><a href="#method__getFirstEnabledItem" title="_getFirstEnabledItem">_getFirstEnabledItem</a></li> <li class="private"><a href="#method__getItemGroup" title="_getItemGroup">_getItemGroup</a></li> <li class="private"><a href="#method__initSubTree" title="_initSubTree">_initSubTree</a></li> <li class="private"><a href="#method__onBeforeHide" title="_onBeforeHide">_onBeforeHide</a></li> <li class="private"><a href="#method__onBeforeRender" title="_onBeforeRender">_onBeforeRender</a></li> <li class="private"><a href="#method__onBeforeShow" title="_onBeforeShow">_onBeforeShow</a></li> <li class="protected"><a href="#method__onBlur" title="_onBlur">_onBlur</a></li> <li class="protected"><a href="#method__onClick" title="_onClick">_onClick</a></li> <li class="private"><a href="#method__onHide" title="_onHide">_onHide</a></li> <li class="private"><a href="#method__onInit" title="_onInit">_onInit</a></li> <li class="private"><a href="#method__onItemAdded" title="_onItemAdded">_onItemAdded</a></li> <li class="protected"><a href="#method__onKeyDown" title="_onKeyDown">_onKeyDown</a></li> <li class="protected"><a href="#method__onKeyPress" title="_onKeyPress">_onKeyPress</a></li> <li class="private"><a href="#method__onMenuItemConfigChange" title="_onMenuItemConfigChange">_onMenuItemConfigChange</a></li> <li class="private"><a href="#method__onMenuItemDestroy" title="_onMenuItemDestroy">_onMenuItemDestroy</a></li> <li class="protected"><a href="#method__onMouseMove" title="_onMouseMove">_onMouseMove</a></li> <li class="protected"><a href="#method__onMouseOut" title="_onMouseOut">_onMouseOut</a></li> <li class="protected"><a href="#method__onMouseOver" title="_onMouseOver">_onMouseOver</a></li> <li class="private"><a href="#method__onParentMenuConfigChange" title="_onParentMenuConfigChange">_onParentMenuConfigChange</a></li> <li class="private"><a href="#method__onParentMenuRender" title="_onParentMenuRender">_onParentMenuRender</a></li> <li class="private"><a href="#method__onRender" title="_onRender">_onRender</a></li> <li class="protected"><a href="#method__onScrollTargetMouseOut" title="_onScrollTargetMouseOut">_onScrollTargetMouseOut</a></li> <li class="protected"><a href="#method__onScrollTargetMouseOver" title="_onScrollTargetMouseOver">_onScrollTargetMouseOver</a></li> <li class="private"><a href="#method__onShow" title="_onShow">_onShow</a></li> <li class="private"><a href="#method__onVisibleChange" title="_onVisibleChange">_onVisibleChange</a></li> <li class="protected"><a href="#method__onYChange" title="_onYChange">_onYChange</a></li> <li class="private"><a href="#method__removeItemFromGroupByIndex" title="_removeItemFromGroupByIndex">_removeItemFromGroupByIndex</a></li> <li class="private"><a href="#method__removeItemFromGroupByValue" title="_removeItemFromGroupByValue">_removeItemFromGroupByValue</a></li> <li class="protected"><a href="#method__removeShadow" title="_removeShadow">_removeShadow</a></li> <li class="protected"><a href="#method__removeShadowVisibleClass" title="_removeShadowVisibleClass">_removeShadowVisibleClass</a></li> <li class="protected"><a href="#method__replaceShadow" title="_replaceShadow">_replaceShadow</a></li> <li class="private"><a href="#method__setMaxHeight" title="_setMaxHeight">_setMaxHeight</a></li> <li class="private"><a href="#method__setScrollHeight" title="_setScrollHeight">_setScrollHeight</a></li> <li class="protected"><a href="#method__shadowBeforeShow" title="_shadowBeforeShow">_shadowBeforeShow</a></li> <li class="protected"><a href="#method__sizeShadow" title="_sizeShadow">_sizeShadow</a></li> <li class="private"><a href="#method__stopMouseEventHandlers" title="_stopMouseEventHandlers">_stopMouseEventHandlers</a></li> <li class=""><a href="#method__subscribeScrollHandlers" title="_subscribeScrollHandlers">_subscribeScrollHandlers</a></li> <li class="private"><a href="#method__subscribeToItemEvents" title="_subscribeToItemEvents">_subscribeToItemEvents</a></li> <li class=""><a href="#method__unsubscribeScrollHandlers" title="_unsubscribeScrollHandlers">_unsubscribeScrollHandlers</a></li> <li class="private"><a href="#method__updateItemProperties" title="_updateItemProperties">_updateItemProperties</a></li> <li class=""><a href="#method_addItem" title="addItem">addItem</a></li> <li class=""><a href="#method_addItems" title="addItems">addItems</a></li> <li class=""><a href="#method_blur" title="blur">blur</a></li> <li class="private"><a href="#method_checkPosition" title="checkPosition">checkPosition</a></li> <li class=""><a href="#method_clearActiveItem" title="clearActiveItem">clearActiveItem</a></li> <li class=""><a href="#method_clearContent" title="clearContent">clearContent</a></li> <li class=""><a href="#method_configClassName" title="configClassName">configClassName</a></li> <li class=""><a href="#method_configContainer" title="configContainer">configContainer</a></li> <li class=""><a href="#method_configDisabled" title="configDisabled">configDisabled</a></li> <li class=""><a href="#method_configHideDelay" title="configHideDelay">configHideDelay</a></li> <li class=""><a href="#method_configIframe" title="configIframe">configIframe</a></li> <li class=""><a href="#method_configMaxHeight" title="configMaxHeight">configMaxHeight</a></li> <li class=""><a href="#method_configPosition" title="configPosition">configPosition</a></li> <li class=""><a href="#method_configShadow" title="configShadow">configShadow</a></li> <li class=""><a href="#method_configVisible" title="configVisible">configVisible</a></li> <li class=""><a href="#method_destroy" title="destroy">destroy</a></li> <li class=""><a href="#method_focus" title="focus">focus</a></li> <li class=""><a href="#method_getItem" title="getItem">getItem</a></li> <li class=""><a href="#method_getItemGroups" title="getItemGroups">getItemGroups</a></li> <li class=""><a href="#method_getItems" title="getItems">getItems</a></li> <li class=""><a href="#method_getRoot" title="getRoot">getRoot</a></li> <li class=""><a href="#method_getSubmenus" title="getSubmenus">getSubmenus</a></li> <li class=""><a href="#method_hasFocus" title="hasFocus">hasFocus</a></li> <li class=""><a href="#method_init" title="init">init</a></li> <li class=""><a href="#method_initDefaultConfig" title="initDefaultConfig">initDefaultConfig</a></li> <li class=""><a href="#method_initEvents" title="initEvents">initEvents</a></li> <li class=""><a href="#method_insertItem" title="insertItem">insertItem</a></li> <li class=""><a href="#method_positionOffScreen" title="positionOffScreen">positionOffScreen</a></li> <li class=""><a href="#method_removeItem" title="removeItem">removeItem</a></li> <li class=""><a href="#method_setInitialFocus" title="setInitialFocus">setInitialFocus</a></li> <li class=""><a href="#method_setInitialSelection" title="setInitialSelection">setInitialSelection</a></li> <li class=""><a href="#method_setItemGroupTitle" title="setItemGroupTitle">setItemGroupTitle</a></li> <li class=""><a href="#method_subscribe" title="subscribe">subscribe</a></li> <li class=""><a href="#method_toString" title="toString">toString</a></li> </ul> </div> <div id="eventsList" class="module"> <h4>Events</h4> <ul class="content"> <li class=""><a href="#event_clickEvent" title="clickEvent">clickEvent</a></li> <li class=""><a href="#event_itemAddedEvent" title="itemAddedEvent">itemAddedEvent</a></li> <li class=""><a href="#event_itemRemovedEvent" title="itemRemovedEvent">itemRemovedEvent</a></li> <li class=""><a href="#event_keyDownEvent" title="keyDownEvent">keyDownEvent</a></li> <li class=""><a href="#event_keyPressEvent" title="keyPressEvent">keyPressEvent</a></li> <li class=""><a href="#event_keyUpEvent" title="keyUpEvent">keyUpEvent</a></li> <li class=""><a href="#event_mouseDownEvent" title="mouseDownEvent">mouseDownEvent</a></li> <li class=""><a href="#event_mouseOutEvent" title="mouseOutEvent">mouseOutEvent</a></li> <li class=""><a href="#event_mouseOverEvent" title="mouseOverEvent">mouseOverEvent</a></li> <li class=""><a href="#event_mouseUpEvent" title="mouseUpEvent">mouseUpEvent</a></li> </ul> </div> <div id="configList" class="module"> <h4>Configuration Attributes</h4> <ul class="content"> <li class=""><a href="#config_autosubmenudisplay" title="autosubmenudisplay">autosubmenudisplay</a></li> <li class=""><a href="#config_classname" title="classname">classname</a></li> <li class=""><a href="#config_clicktohide" title="clicktohide">clicktohide</a></li> <li class=""><a href="#config_constraintoviewport" title="constraintoviewport">constraintoviewport</a></li> <li class=""><a href="#config_container" title="container">container</a></li> <li class=""><a href="#config_context" title="context">context</a></li> <li class=""><a href="#config_disabled" title="disabled">disabled</a></li> <li class=""><a href="#config_effect" title="effect">effect</a></li> <li class=""><a href="#config_fixedcenter" title="fixedcenter">fixedcenter</a></li> <li class=""><a href="#config_hidedelay" title="hidedelay">hidedelay</a></li> <li class=""><a href="#config_iframe" title="iframe">iframe</a></li> <li class=""><a href="#config_keepopen" title="keepopen">keepopen</a></li> <li class=""><a href="#config_maxheight" title="maxheight">maxheight</a></li> <li class=""><a href="#config_minscrollheight" title="minscrollheight">minscrollheight</a></li> <li class=""><a href="#config_position" title="position">position</a></li> <li class=""><a href="#config_preventcontextoverlap" title="preventcontextoverlap">preventcontextoverlap</a></li> <li class=""><a href="#config_scrollincrement" title="scrollincrement">scrollincrement</a></li> <li class=""><a href="#config_shadow" title="shadow">shadow</a></li> <li class=""><a href="#config_showdelay" title="showdelay">showdelay</a></li> <li class=""><a href="#config_submenualignment" title="submenualignment">submenualignment</a></li> <li class=""><a href="#config_submenuhidedelay" title="submenuhidedelay">submenuhidedelay</a></li> <li class=""><a href="#config_visible" title="visible">visible</a></li> <li class=""><a href="#config_x" title="x">x</a></li> <li class=""><a href="#config_xy" title="xy">xy</a></li> <li class=""><a href="#config_y" title="y">y</a></li> </ul> </div> </div> </div> </div> <div id="ft"> <hr /> Copyright &copy; 2011 Yahoo! Inc. All rights reserved. </div> </div> <script type="text/javascript"> var ALL_YUI_PROPS = [{"access": "", "host": "YAHOO.widget.Menu", "name": "activeItem", "url": "YAHOO.widget.Menu.html#property_activeItem", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "addItem", "url": "YAHOO.widget.Menu.html#method_addItem", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "addItems", "url": "YAHOO.widget.Menu.html#method_addItems", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_addItemToGroup", "url": "YAHOO.widget.Menu.html#method__addItemToGroup", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_addShadowVisibleClass", "url": "YAHOO.widget.Menu.html#method__addShadowVisibleClass", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_aGroupTitleElements", "url": "YAHOO.widget.Menu.html#property__aGroupTitleElements", "type": "property"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_aItemGroups", "url": "YAHOO.widget.Menu.html#property__aItemGroups", "type": "property"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_aListElements", "url": "YAHOO.widget.Menu.html#property__aListElements", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "autosubmenudisplay", "url": "YAHOO.widget.Menu.html#config_autosubmenudisplay", "type": "config"}, {"access": "private", "host": "YAHOO.widget.ContextMenu", "name": "_bCancelled", "url": "YAHOO.widget.ContextMenu.html#property__bCancelled", "type": "property"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_bHandledMouseOutEvent", "url": "YAHOO.widget.Menu.html#property__bHandledMouseOutEvent", "type": "property"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_bHandledMouseOverEvent", "url": "YAHOO.widget.Menu.html#property__bHandledMouseOverEvent", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "blur", "url": "YAHOO.widget.Menu.html#method_blur", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_bStopMouseEventHandlers", "url": "YAHOO.widget.Menu.html#property__bStopMouseEventHandlers", "type": "property"}, {"access": "", "host": "YAHOO.widget.ContextMenu", "name": "cancel", "url": "YAHOO.widget.ContextMenu.html#method_cancel", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_cancelHideDelay", "url": "YAHOO.widget.Menu.html#method__cancelHideDelay", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_cancelShowDelay", "url": "YAHOO.widget.Menu.html#method__cancelShowDelay", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "checkPosition", "url": "YAHOO.widget.Menu.html#method_checkPosition", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "classname", "url": "YAHOO.widget.Menu.html#config_classname", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "clearActiveItem", "url": "YAHOO.widget.Menu.html#method_clearActiveItem", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "clearContent", "url": "YAHOO.widget.Menu.html#method_clearContent", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_clearSetWidthFlag", "url": "YAHOO.widget.Menu.html#method__clearSetWidthFlag", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "clickEvent", "url": "YAHOO.widget.Menu.html#event_clickEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "clicktohide", "url": "YAHOO.widget.Menu.html#config_clicktohide", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "configClassName", "url": "YAHOO.widget.Menu.html#method_configClassName", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "configContainer", "url": "YAHOO.widget.Menu.html#method_configContainer", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "configDisabled", "url": "YAHOO.widget.Menu.html#method_configDisabled", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "configHideDelay", "url": "YAHOO.widget.Menu.html#method_configHideDelay", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "configIframe", "url": "YAHOO.widget.Menu.html#method_configIframe", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "configMaxHeight", "url": "YAHOO.widget.Menu.html#method_configMaxHeight", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "configPosition", "url": "YAHOO.widget.Menu.html#method_configPosition", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "configShadow", "url": "YAHOO.widget.Menu.html#method_configShadow", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContextMenu", "name": "configTrigger", "url": "YAHOO.widget.ContextMenu.html#method_configTrigger", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_configureSubmenu", "url": "YAHOO.widget.Menu.html#method__configureSubmenu", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "configVisible", "url": "YAHOO.widget.Menu.html#method_configVisible", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "constraintoviewport", "url": "YAHOO.widget.Menu.html#config_constraintoviewport", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "container", "url": "YAHOO.widget.Menu.html#config_container", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "context", "url": "YAHOO.widget.Menu.html#config_context", "type": "config"}, {"access": "", "host": "YAHOO.widget.ContextMenu", "name": "contextEventTarget", "url": "YAHOO.widget.ContextMenu.html#property_contextEventTarget", "type": "property"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_createItemGroup", "url": "YAHOO.widget.Menu.html#method__createItemGroup", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_createShadow", "url": "YAHOO.widget.Menu.html#method__createShadow", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "CSS_CLASS_NAME", "url": "YAHOO.widget.Menu.html#property_CSS_CLASS_NAME", "type": "property"}, {"access": "private", "host": "YAHOO.widget.ContextMenu", "name": "DEFAULT_CONFIG", "url": "YAHOO.widget.ContextMenu.html#property_DEFAULT_CONFIG", "type": "property"}, {"access": "", "host": "YAHOO.widget.ContextMenu", "name": "destroy", "url": "YAHOO.widget.ContextMenu.html#method_destroy", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "destroy", "url": "YAHOO.widget.Menu.html#method_destroy", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_didMouseLeave", "url": "YAHOO.widget.Menu.html#method__didMouseLeave", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "disabled", "url": "YAHOO.widget.Menu.html#config_disabled", "type": "config"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_disableScrollFooter", "url": "YAHOO.widget.Menu.html#method__disableScrollFooter", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_disableScrollHeader", "url": "YAHOO.widget.Menu.html#method__disableScrollHeader", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "effect", "url": "YAHOO.widget.Menu.html#config_effect", "type": "config"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_enableScrollFooter", "url": "YAHOO.widget.Menu.html#method__enableScrollFooter", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_enableScrollHeader", "url": "YAHOO.widget.Menu.html#method__enableScrollHeader", "type": "method"}, {"access": "private", "host": "YAHOO.widget.ContextMenu", "name": "EVENT_TYPES", "url": "YAHOO.widget.ContextMenu.html#property_EVENT_TYPES", "type": "property"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_execHideDelay", "url": "YAHOO.widget.Menu.html#method__execHideDelay", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_execSubmenuHideDelay", "url": "YAHOO.widget.Menu.html#method__execSubmenuHideDelay", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "fixedcenter", "url": "YAHOO.widget.Menu.html#config_fixedcenter", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "focus", "url": "YAHOO.widget.Menu.html#method_focus", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_getFirstEnabledItem", "url": "YAHOO.widget.Menu.html#method__getFirstEnabledItem", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "getItem", "url": "YAHOO.widget.Menu.html#method_getItem", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_getItemGroup", "url": "YAHOO.widget.Menu.html#method__getItemGroup", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "getItemGroups", "url": "YAHOO.widget.Menu.html#method_getItemGroups", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "getItems", "url": "YAHOO.widget.Menu.html#method_getItems", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "getRoot", "url": "YAHOO.widget.Menu.html#method_getRoot", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "getSubmenus", "url": "YAHOO.widget.Menu.html#method_getSubmenus", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "GROUP_TITLE_TAG_NAME", "url": "YAHOO.widget.Menu.html#property_GROUP_TITLE_TAG_NAME", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "hasFocus", "url": "YAHOO.widget.Menu.html#method_hasFocus", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "hidedelay", "url": "YAHOO.widget.Menu.html#config_hidedelay", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "iframe", "url": "YAHOO.widget.Menu.html#config_iframe", "type": "config"}, {"access": "", "host": "YAHOO.widget.ContextMenu", "name": "init", "url": "YAHOO.widget.ContextMenu.html#method_init", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "init", "url": "YAHOO.widget.Menu.html#method_init", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContextMenu", "name": "initDefaultConfig", "url": "YAHOO.widget.ContextMenu.html#method_initDefaultConfig", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "initDefaultConfig", "url": "YAHOO.widget.Menu.html#method_initDefaultConfig", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContextMenu", "name": "initEvents", "url": "YAHOO.widget.ContextMenu.html#method_initEvents", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "initEvents", "url": "YAHOO.widget.Menu.html#method_initEvents", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_initSubTree", "url": "YAHOO.widget.Menu.html#method__initSubTree", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "insertItem", "url": "YAHOO.widget.Menu.html#method_insertItem", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "itemAddedEvent", "url": "YAHOO.widget.Menu.html#event_itemAddedEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "itemData", "url": "YAHOO.widget.Menu.html#property_itemData", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "itemRemovedEvent", "url": "YAHOO.widget.Menu.html#event_itemRemovedEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "ITEM_TYPE", "url": "YAHOO.widget.Menu.html#property_ITEM_TYPE", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "keepopen", "url": "YAHOO.widget.Menu.html#config_keepopen", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "keyDownEvent", "url": "YAHOO.widget.Menu.html#event_keyDownEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "keyPressEvent", "url": "YAHOO.widget.Menu.html#event_keyPressEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "keyUpEvent", "url": "YAHOO.widget.Menu.html#event_keyUpEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "lazyLoad", "url": "YAHOO.widget.Menu.html#property_lazyLoad", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "maxheight", "url": "YAHOO.widget.Menu.html#config_maxheight", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "minscrollheight", "url": "YAHOO.widget.Menu.html#config_minscrollheight", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "mouseDownEvent", "url": "YAHOO.widget.Menu.html#event_mouseDownEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "mouseOutEvent", "url": "YAHOO.widget.Menu.html#event_mouseOutEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "mouseOverEvent", "url": "YAHOO.widget.Menu.html#event_mouseOverEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "mouseUpEvent", "url": "YAHOO.widget.Menu.html#event_mouseUpEvent", "type": "event"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_nCurrentMouseX", "url": "YAHOO.widget.Menu.html#property__nCurrentMouseX", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "OFF_SCREEN_POSITION", "url": "YAHOO.widget.Menu.html#property_OFF_SCREEN_POSITION", "type": "property"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onBeforeHide", "url": "YAHOO.widget.Menu.html#method__onBeforeHide", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onBeforeRender", "url": "YAHOO.widget.Menu.html#method__onBeforeRender", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onBeforeShow", "url": "YAHOO.widget.Menu.html#method__onBeforeShow", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_onBlur", "url": "YAHOO.widget.Menu.html#method__onBlur", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_onClick", "url": "YAHOO.widget.Menu.html#method__onClick", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onHide", "url": "YAHOO.widget.Menu.html#method__onHide", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onInit", "url": "YAHOO.widget.Menu.html#method__onInit", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onItemAdded", "url": "YAHOO.widget.Menu.html#method__onItemAdded", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_onKeyDown", "url": "YAHOO.widget.Menu.html#method__onKeyDown", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_onKeyPress", "url": "YAHOO.widget.Menu.html#method__onKeyPress", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onMenuItemConfigChange", "url": "YAHOO.widget.Menu.html#method__onMenuItemConfigChange", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onMenuItemDestroy", "url": "YAHOO.widget.Menu.html#method__onMenuItemDestroy", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_onMouseMove", "url": "YAHOO.widget.Menu.html#method__onMouseMove", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_onMouseOut", "url": "YAHOO.widget.Menu.html#method__onMouseOut", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_onMouseOver", "url": "YAHOO.widget.Menu.html#method__onMouseOver", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onParentMenuConfigChange", "url": "YAHOO.widget.Menu.html#method__onParentMenuConfigChange", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onParentMenuRender", "url": "YAHOO.widget.Menu.html#method__onParentMenuRender", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onRender", "url": "YAHOO.widget.Menu.html#method__onRender", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_onScrollTargetMouseOut", "url": "YAHOO.widget.Menu.html#method__onScrollTargetMouseOut", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_onScrollTargetMouseOver", "url": "YAHOO.widget.Menu.html#method__onScrollTargetMouseOver", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onShow", "url": "YAHOO.widget.Menu.html#method__onShow", "type": "method"}, {"access": "private", "host": "YAHOO.widget.ContextMenu", "name": "_onTriggerClick", "url": "YAHOO.widget.ContextMenu.html#method__onTriggerClick", "type": "method"}, {"access": "private", "host": "YAHOO.widget.ContextMenu", "name": "_onTriggerContextMenu", "url": "YAHOO.widget.ContextMenu.html#method__onTriggerContextMenu", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_onVisibleChange", "url": "YAHOO.widget.Menu.html#method__onVisibleChange", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_onYChange", "url": "YAHOO.widget.Menu.html#method__onYChange", "type": "method"}, {"access": "private", "host": "YAHOO.widget.ContextMenu", "name": "_oTrigger", "url": "YAHOO.widget.ContextMenu.html#property__oTrigger", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "parent", "url": "YAHOO.widget.Menu.html#property_parent", "type": "property"}, {"access": "private", "host": "YAHOO.widget.ContextMenu", "name": "position", "url": "YAHOO.widget.ContextMenu.html#method_position", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "position", "url": "YAHOO.widget.Menu.html#config_position", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "positionOffScreen", "url": "YAHOO.widget.Menu.html#method_positionOffScreen", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "preventcontextoverlap", "url": "YAHOO.widget.Menu.html#config_preventcontextoverlap", "type": "config"}, {"access": "private", "host": "YAHOO.widget.ContextMenu", "name": "_removeEventHandlers", "url": "YAHOO.widget.ContextMenu.html#method__removeEventHandlers", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "removeItem", "url": "YAHOO.widget.Menu.html#method_removeItem", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_removeItemFromGroupByIndex", "url": "YAHOO.widget.Menu.html#method__removeItemFromGroupByIndex", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_removeItemFromGroupByValue", "url": "YAHOO.widget.Menu.html#method__removeItemFromGroupByValue", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_removeShadow", "url": "YAHOO.widget.Menu.html#method__removeShadow", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_removeShadowVisibleClass", "url": "YAHOO.widget.Menu.html#method__removeShadowVisibleClass", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_replaceShadow", "url": "YAHOO.widget.Menu.html#method__replaceShadow", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_sClassName", "url": "YAHOO.widget.Menu.html#property__sClassName", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "scrollincrement", "url": "YAHOO.widget.Menu.html#config_scrollincrement", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "setInitialFocus", "url": "YAHOO.widget.Menu.html#method_setInitialFocus", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "setInitialSelection", "url": "YAHOO.widget.Menu.html#method_setInitialSelection", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "setItemGroupTitle", "url": "YAHOO.widget.Menu.html#method_setItemGroupTitle", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_setMaxHeight", "url": "YAHOO.widget.Menu.html#method__setMaxHeight", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_setScrollHeight", "url": "YAHOO.widget.Menu.html#method__setScrollHeight", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "shadow", "url": "YAHOO.widget.Menu.html#config_shadow", "type": "config"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_shadowBeforeShow", "url": "YAHOO.widget.Menu.html#method__shadowBeforeShow", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "showdelay", "url": "YAHOO.widget.Menu.html#config_showdelay", "type": "config"}, {"access": "protected", "host": "YAHOO.widget.Menu", "name": "_sizeShadow", "url": "YAHOO.widget.Menu.html#method__sizeShadow", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "srcElement", "url": "YAHOO.widget.Menu.html#property_srcElement", "type": "property"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_stopMouseEventHandlers", "url": "YAHOO.widget.Menu.html#method__stopMouseEventHandlers", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "submenualignment", "url": "YAHOO.widget.Menu.html#config_submenualignment", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "submenuhidedelay", "url": "YAHOO.widget.Menu.html#config_submenuhidedelay", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "subscribe", "url": "YAHOO.widget.Menu.html#method_subscribe", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "_subscribeScrollHandlers", "url": "YAHOO.widget.Menu.html#method__subscribeScrollHandlers", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_subscribeToItemEvents", "url": "YAHOO.widget.Menu.html#method__subscribeToItemEvents", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContextMenu", "name": "toString", "url": "YAHOO.widget.ContextMenu.html#method_toString", "type": "method"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "toString", "url": "YAHOO.widget.Menu.html#method_toString", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContextMenu", "name": "trigger", "url": "YAHOO.widget.ContextMenu.html#config_trigger", "type": "config"}, {"access": "", "host": "YAHOO.widget.ContextMenu", "name": "triggerContextMenuEvent", "url": "YAHOO.widget.ContextMenu.html#event_triggerContextMenuEvent", "type": "event"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "_unsubscribeScrollHandlers", "url": "YAHOO.widget.Menu.html#method__unsubscribeScrollHandlers", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_updateItemProperties", "url": "YAHOO.widget.Menu.html#method__updateItemProperties", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Menu", "name": "_useHideDelay", "url": "YAHOO.widget.Menu.html#property__useHideDelay", "type": "property"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "visible", "url": "YAHOO.widget.Menu.html#config_visible", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "x", "url": "YAHOO.widget.Menu.html#config_x", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "xy", "url": "YAHOO.widget.Menu.html#config_xy", "type": "config"}, {"access": "", "host": "YAHOO.widget.Menu", "name": "y", "url": "YAHOO.widget.Menu.html#config_y", "type": "config"}]; </script> </body> </html>
sashakames/COG
cog/static/js/yui-2.9.0/docs/YAHOO.widget.Menu.html
HTML
bsd-3-clause
416,356
/*********************************************************************/ /* Copyright 2009, 2010 The University of Texas at Austin. */ /* All rights reserved. */ /* */ /* Redistribution and use in source and binary forms, with or */ /* without modification, are permitted provided that the following */ /* conditions are met: */ /* */ /* 1. Redistributions of source code must retain the above */ /* copyright notice, this list of conditions and the following */ /* disclaimer. */ /* */ /* 2. Redistributions in binary form must reproduce the above */ /* copyright notice, this list of conditions and the following */ /* disclaimer in the documentation and/or other materials */ /* provided with the distribution. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */ /* AUSTIN ``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 UNIVERSITY OF TEXAS AT */ /* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */ /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */ /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */ /* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */ /* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */ /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */ /* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */ /* POSSIBILITY OF SUCH DAMAGE. */ /* */ /* The views and conclusions contained in the software and */ /* documentation are those of the authors and should not be */ /* interpreted as representing official policies, either expressed */ /* or implied, of The University of Texas at Austin. */ /*********************************************************************/ #include <stdio.h> #include "common.h" int CNAME(BLASLONG m, BLASLONG n, FLOAT *a, BLASLONG lda, BLASLONG posX, BLASLONG posY, FLOAT *b){ BLASLONG i, js; BLASLONG X; FLOAT data01, data02, data03, data04, data05, data06, data07, data08; FLOAT data09, data10, data11, data12, data13, data14, data15, data16; FLOAT data17, data18, data19, data20, data21, data22, data23, data24; FLOAT data25, data26, data27, data28, data29, data30, data31, data32; FLOAT data33, data34, data35, data36, data37, data38, data39, data40; FLOAT data41, data42, data43, data44, data45, data46, data47, data48; FLOAT data49, data50, data51, data52, data53, data54, data55, data56; FLOAT data57, data58, data59, data60, data61, data62, data63, data64; FLOAT *ao1, *ao2, *ao3, *ao4, *ao5, *ao6, *ao7, *ao8; js = (n >> 3); if (js > 0){ do { X = posX; if (posX <= posY) { ao1 = a + posX + (posY + 0) * lda; ao2 = a + posX + (posY + 1) * lda; ao3 = a + posX + (posY + 2) * lda; ao4 = a + posX + (posY + 3) * lda; ao5 = a + posX + (posY + 4) * lda; ao6 = a + posX + (posY + 5) * lda; ao7 = a + posX + (posY + 6) * lda; ao8 = a + posX + (posY + 7) * lda; } else { ao1 = a + posY + (posX + 0) * lda; ao2 = a + posY + (posX + 1) * lda; ao3 = a + posY + (posX + 2) * lda; ao4 = a + posY + (posX + 3) * lda; ao5 = a + posY + (posX + 4) * lda; ao6 = a + posY + (posX + 5) * lda; ao7 = a + posY + (posX + 6) * lda; ao8 = a + posY + (posX + 7) * lda; } i = (m >> 3); if (i > 0) { do { if (X < posY) { data01 = *(ao1 + 0); data02 = *(ao1 + 1); data03 = *(ao1 + 2); data04 = *(ao1 + 3); data05 = *(ao1 + 4); data06 = *(ao1 + 5); data07 = *(ao1 + 6); data08 = *(ao1 + 7); data09 = *(ao2 + 0); data10 = *(ao2 + 1); data11 = *(ao2 + 2); data12 = *(ao2 + 3); data13 = *(ao2 + 4); data14 = *(ao2 + 5); data15 = *(ao2 + 6); data16 = *(ao2 + 7); data17 = *(ao3 + 0); data18 = *(ao3 + 1); data19 = *(ao3 + 2); data20 = *(ao3 + 3); data21 = *(ao3 + 4); data22 = *(ao3 + 5); data23 = *(ao3 + 6); data24 = *(ao3 + 7); data25 = *(ao4 + 0); data26 = *(ao4 + 1); data27 = *(ao4 + 2); data28 = *(ao4 + 3); data29 = *(ao4 + 4); data30 = *(ao4 + 5); data31 = *(ao4 + 6); data32 = *(ao4 + 7); data33 = *(ao5 + 0); data34 = *(ao5 + 1); data35 = *(ao5 + 2); data36 = *(ao5 + 3); data37 = *(ao5 + 4); data38 = *(ao5 + 5); data39 = *(ao5 + 6); data40 = *(ao5 + 7); data41 = *(ao6 + 0); data42 = *(ao6 + 1); data43 = *(ao6 + 2); data44 = *(ao6 + 3); data45 = *(ao6 + 4); data46 = *(ao6 + 5); data47 = *(ao6 + 6); data48 = *(ao6 + 7); data49 = *(ao7 + 0); data50 = *(ao7 + 1); data51 = *(ao7 + 2); data52 = *(ao7 + 3); data53 = *(ao7 + 4); data54 = *(ao7 + 5); data55 = *(ao7 + 6); data56 = *(ao7 + 7); data57 = *(ao8 + 0); data58 = *(ao8 + 1); data59 = *(ao8 + 2); data60 = *(ao8 + 3); data61 = *(ao8 + 4); data62 = *(ao8 + 5); data63 = *(ao8 + 6); data64 = *(ao8 + 7); b[ 0] = data01; b[ 1] = data09; b[ 2] = data17; b[ 3] = data25; b[ 4] = data33; b[ 5] = data41; b[ 6] = data49; b[ 7] = data57; b[ 8] = data02; b[ 9] = data10; b[10] = data18; b[11] = data26; b[12] = data34; b[13] = data42; b[14] = data50; b[15] = data58; b[16] = data03; b[17] = data11; b[18] = data19; b[19] = data27; b[20] = data35; b[21] = data43; b[22] = data51; b[23] = data59; b[24] = data04; b[25] = data12; b[26] = data20; b[27] = data28; b[28] = data36; b[29] = data44; b[30] = data52; b[31] = data60; b[32] = data05; b[33] = data13; b[34] = data21; b[35] = data29; b[36] = data37; b[37] = data45; b[38] = data53; b[39] = data61; b[40] = data06; b[41] = data14; b[42] = data22; b[43] = data30; b[44] = data38; b[45] = data46; b[46] = data54; b[47] = data62; b[48] = data07; b[49] = data15; b[50] = data23; b[51] = data31; b[52] = data39; b[53] = data47; b[54] = data55; b[55] = data63; b[56] = data08; b[57] = data16; b[58] = data24; b[59] = data32; b[60] = data40; b[61] = data48; b[62] = data56; b[63] = data64; ao1 += 8; ao2 += 8; ao3 += 8; ao4 += 8; ao5 += 8; ao6 += 8; ao7 += 8; ao8 += 8; b += 64; } else if (X > posY) { ao1 += 8 * lda; ao2 += 8 * lda; ao3 += 8 * lda; ao4 += 8 * lda; ao5 += 8 * lda; ao6 += 8 * lda; ao7 += 8 * lda; ao8 += 8 * lda; b += 64; } else { #ifndef UNIT data01 = *(ao1 + 0); #endif data09 = *(ao2 + 0); #ifndef UNIT data10 = *(ao2 + 1); #endif data17 = *(ao3 + 0); data18 = *(ao3 + 1); #ifndef UNIT data19 = *(ao3 + 2); #endif data25 = *(ao4 + 0); data26 = *(ao4 + 1); data27 = *(ao4 + 2); #ifndef UNIT data28 = *(ao4 + 3); #endif data33 = *(ao5 + 0); data34 = *(ao5 + 1); data35 = *(ao5 + 2); data36 = *(ao5 + 3); #ifndef UNIT data37 = *(ao5 + 4); #endif data41 = *(ao6 + 0); data42 = *(ao6 + 1); data43 = *(ao6 + 2); data44 = *(ao6 + 3); data45 = *(ao6 + 4); #ifndef UNIT data46 = *(ao6 + 5); #endif data49 = *(ao7 + 0); data50 = *(ao7 + 1); data51 = *(ao7 + 2); data52 = *(ao7 + 3); data53 = *(ao7 + 4); data54 = *(ao7 + 5); #ifndef UNIT data55 = *(ao7 + 6); #endif data57 = *(ao8 + 0); data58 = *(ao8 + 1); data59 = *(ao8 + 2); data60 = *(ao8 + 3); data61 = *(ao8 + 4); data62 = *(ao8 + 5); data63 = *(ao8 + 6); #ifndef UNIT data64 = *(ao8 + 7); #endif #ifdef UNIT b[ 0] = ONE; #else b[ 0] = data01; #endif b[ 1] = data09; b[ 2] = data17; b[ 3] = data25; b[ 4] = data33; b[ 5] = data41; b[ 6] = data49; b[ 7] = data57; b[ 8] = ZERO; #ifdef UNIT b[ 9] = ONE; #else b[ 9] = data10; #endif b[10] = data18; b[11] = data26; b[12] = data34; b[13] = data42; b[14] = data50; b[15] = data58; b[16] = ZERO; b[17] = ZERO; #ifdef UNIT b[18] = ONE; #else b[18] = data19; #endif b[19] = data27; b[20] = data35; b[21] = data43; b[22] = data51; b[23] = data59; b[24] = ZERO; b[25] = ZERO; b[26] = ZERO; #ifdef UNIT b[27] = ONE; #else b[27] = data28; #endif b[28] = data36; b[29] = data44; b[30] = data52; b[31] = data60; b[32] = ZERO; b[33] = ZERO; b[34] = ZERO; b[35] = ZERO; #ifdef UNIT b[36] = ONE; #else b[36] = data37; #endif b[37] = data45; b[38] = data53; b[39] = data61; b[40] = ZERO; b[41] = ZERO; b[42] = ZERO; b[43] = ZERO; b[44] = ZERO; #ifdef UNIT b[45] = ONE; #else b[45] = data46; #endif b[46] = data54; b[47] = data62; b[48] = ZERO; b[49] = ZERO; b[50] = ZERO; b[51] = ZERO; b[52] = ZERO; b[53] = ZERO; #ifdef UNIT b[54] = ONE; #else b[54] = data55; #endif b[55] = data63; b[56] = ZERO; b[57] = ZERO; b[58] = ZERO; b[59] = ZERO; b[60] = ZERO; b[61] = ZERO; b[62] = ZERO; #ifdef UNIT b[63] = ONE; #else b[63] = data64; #endif ao1 += 8 * lda; ao2 += 8 * lda; ao3 += 8 * lda; ao4 += 8 * lda; ao5 += 8 * lda; ao6 += 8 * lda; ao7 += 8 * lda; ao8 += 8 * lda; b += 64; } X += 8; i --; } while (i > 0); } i = (m & 7); if (i) { if (X < posY) { if (m & 4) { data01 = *(ao1 + 0); data02 = *(ao1 + 1); data03 = *(ao1 + 2); data04 = *(ao1 + 3); data09 = *(ao2 + 0); data10 = *(ao2 + 1); data11 = *(ao2 + 2); data12 = *(ao2 + 3); data17 = *(ao3 + 0); data18 = *(ao3 + 1); data19 = *(ao3 + 2); data20 = *(ao3 + 3); data25 = *(ao4 + 0); data26 = *(ao4 + 1); data27 = *(ao4 + 2); data28 = *(ao4 + 3); data33 = *(ao5 + 0); data34 = *(ao5 + 1); data35 = *(ao5 + 2); data36 = *(ao5 + 3); data41 = *(ao6 + 0); data42 = *(ao6 + 1); data43 = *(ao6 + 2); data44 = *(ao6 + 3); data49 = *(ao7 + 0); data50 = *(ao7 + 1); data51 = *(ao7 + 2); data52 = *(ao7 + 3); data57 = *(ao8 + 0); data58 = *(ao8 + 1); data59 = *(ao8 + 2); data60 = *(ao8 + 3); b[ 0] = data01; b[ 1] = data09; b[ 2] = data17; b[ 3] = data25; b[ 4] = data33; b[ 5] = data41; b[ 6] = data49; b[ 7] = data57; b[ 8] = data02; b[ 9] = data10; b[10] = data18; b[11] = data26; b[12] = data34; b[13] = data42; b[14] = data50; b[15] = data58; b[16] = data03; b[17] = data11; b[18] = data19; b[19] = data27; b[20] = data35; b[21] = data43; b[22] = data51; b[23] = data59; b[24] = data04; b[25] = data12; b[26] = data20; b[27] = data28; b[28] = data36; b[29] = data44; b[30] = data52; b[31] = data60; ao1 += 4; ao2 += 4; ao3 += 4; ao4 += 4; ao5 += 4; ao6 += 4; ao7 += 4; ao8 += 4; b += 32; } if (m & 2) { data01 = *(ao1 + 0); data02 = *(ao1 + 1); data09 = *(ao2 + 0); data10 = *(ao2 + 1); data17 = *(ao3 + 0); data18 = *(ao3 + 1); data25 = *(ao4 + 0); data26 = *(ao4 + 1); data33 = *(ao5 + 0); data34 = *(ao5 + 1); data41 = *(ao6 + 0); data42 = *(ao6 + 1); data49 = *(ao7 + 0); data50 = *(ao7 + 1); data57 = *(ao8 + 0); data58 = *(ao8 + 1); b[ 0] = data01; b[ 1] = data09; b[ 2] = data17; b[ 3] = data25; b[ 4] = data33; b[ 5] = data41; b[ 6] = data49; b[ 7] = data57; b[ 8] = data02; b[ 9] = data10; b[10] = data18; b[11] = data26; b[12] = data34; b[13] = data42; b[14] = data50; b[15] = data58; ao1 += 2; ao2 += 2; ao3 += 2; ao4 += 2; ao5 += 2; ao6 += 2; ao7 += 2; ao8 += 2; b += 16; } if (m & 1) { data01 = *(ao1 + 0); data09 = *(ao2 + 0); data17 = *(ao3 + 0); data25 = *(ao4 + 0); data33 = *(ao5 + 0); data41 = *(ao6 + 0); data49 = *(ao7 + 0); data57 = *(ao8 + 0); b[ 0] = data01; b[ 1] = data09; b[ 2] = data17; b[ 3] = data25; b[ 4] = data33; b[ 5] = data41; b[ 6] = data49; b[ 7] = data57; b += 8; } } else if (X > posY) { if (m & 4) { ao1 += 4 * lda; ao2 += 4 * lda; ao3 += 4 * lda; ao4 += 4 * lda; b += 32; } if (m & 2) { ao1 += 2 * lda; b += 16; } if (m & 1) { b += 8; } } else { #ifndef UNIT data01 = *(ao1 + 0); #endif data09 = *(ao2 + 0); data17 = *(ao3 + 0); data25 = *(ao4 + 0); data33 = *(ao5 + 0); data41 = *(ao6 + 0); data49 = *(ao7 + 0); data57 = *(ao8 + 0); if (i >= 2) { #ifndef UNIT data10 = *(ao2 + 1); #endif data18 = *(ao3 + 1); data26 = *(ao4 + 1); data34 = *(ao5 + 1); data42 = *(ao6 + 1); data50 = *(ao7 + 1); data58 = *(ao8 + 1); } if (i >= 3) { #ifndef UNIT data19 = *(ao3 + 2); #endif data27 = *(ao4 + 2); data35 = *(ao5 + 2); data43 = *(ao6 + 2); data51 = *(ao7 + 2); data59 = *(ao8 + 2); } if (i >= 4) { #ifndef UNIT data28 = *(ao4 + 3); #endif data36 = *(ao5 + 3); data44 = *(ao6 + 3); data52 = *(ao7 + 3); data60 = *(ao8 + 3); } if (i >= 5) { #ifndef UNIT data37 = *(ao5 + 4); #endif data45 = *(ao6 + 4); data53 = *(ao7 + 4); data61 = *(ao8 + 4); } if (i >= 6) { #ifndef UNIT data46 = *(ao6 + 5); #endif data54 = *(ao7 + 5); data62 = *(ao8 + 5); } if (i >= 7) { #ifndef UNIT data55 = *(ao7 + 6); #endif data63 = *(ao8 + 6); } #ifdef UNIT b[ 0] = ONE; #else b[ 0] = data01; #endif b[ 1] = data09; b[ 2] = data17; b[ 3] = data25; b[ 4] = data33; b[ 5] = data41; b[ 6] = data49; b[ 7] = data57; b += 8; if(i >= 2) { b[ 0] = ZERO; #ifdef UNIT b[ 1] = ONE; #else b[ 1] = data10; #endif b[ 2] = data18; b[ 3] = data26; b[ 4] = data34; b[ 5] = data42; b[ 6] = data50; b[ 7] = data58; b += 8; } if (i >= 3) { b[ 0] = ZERO; b[ 1] = ZERO; #ifdef UNIT b[ 2] = ONE; #else b[ 2] = data19; #endif b[ 3] = data27; b[ 4] = data35; b[ 5] = data43; b[ 6] = data51; b[ 7] = data59; b += 8; } if (i >= 4) { b[ 0] = ZERO; b[ 1] = ZERO; b[ 2] = ZERO; #ifdef UNIT b[ 3] = ONE; #else b[ 3] = data28; #endif b[ 4] = data36; b[ 5] = data44; b[ 6] = data52; b[ 7] = data60; b += 8; } if (i >= 5) { b[ 0] = ZERO; b[ 1] = ZERO; b[ 2] = ZERO; b[ 3] = ZERO; #ifdef UNIT b[ 4] = ONE; #else b[ 4] = data37; #endif b[ 5] = data45; b[ 6] = data53; b[ 7] = data61; b += 8; } if (i >= 6) { b[ 0] = ZERO; b[ 1] = ZERO; b[ 2] = ZERO; b[ 3] = ZERO; b[ 4] = ZERO; #ifdef UNIT b[ 5] = ONE; #else b[ 5] = data46; #endif b[ 6] = data54; b[ 7] = data62; b += 8; } if (i >= 7) { b[ 0] = ZERO; b[ 1] = ZERO; b[ 2] = ZERO; b[ 3] = ZERO; b[ 4] = ZERO; b[ 5] = ZERO; #ifdef UNIT b[ 6] = ONE; #else b[ 6] = data55; #endif b[ 7] = data63; b += 8; } } } posY += 8; js --; } while (js > 0); } /* End of main loop */ if (n & 4){ X = posX; if (posX <= posY) { ao1 = a + posX + (posY + 0) * lda; ao2 = a + posX + (posY + 1) * lda; ao3 = a + posX + (posY + 2) * lda; ao4 = a + posX + (posY + 3) * lda; } else { ao1 = a + posY + (posX + 0) * lda; ao2 = a + posY + (posX + 1) * lda; ao3 = a + posY + (posX + 2) * lda; ao4 = a + posY + (posX + 3) * lda; } i = (m >> 2); if (i > 0) { do { if (X < posY) { data01 = *(ao1 + 0); data02 = *(ao1 + 1); data03 = *(ao1 + 2); data04 = *(ao1 + 3); data09 = *(ao2 + 0); data10 = *(ao2 + 1); data11 = *(ao2 + 2); data12 = *(ao2 + 3); data17 = *(ao3 + 0); data18 = *(ao3 + 1); data19 = *(ao3 + 2); data20 = *(ao3 + 3); data25 = *(ao4 + 0); data26 = *(ao4 + 1); data27 = *(ao4 + 2); data28 = *(ao4 + 3); b[ 0] = data01; b[ 1] = data09; b[ 2] = data17; b[ 3] = data25; b[ 4] = data02; b[ 5] = data10; b[ 6] = data18; b[ 7] = data26; b[ 8] = data03; b[ 9] = data11; b[10] = data19; b[11] = data27; b[12] = data04; b[13] = data12; b[14] = data20; b[15] = data28; ao1 += 4; ao2 += 4; ao3 += 4; ao4 += 4; b += 16; } else if (X > posY) { ao1 += 4 * lda; ao2 += 4 * lda; ao3 += 4 * lda; ao4 += 4 * lda; b += 16; } else { #ifdef UNIT data09 = *(ao2 + 0); data17 = *(ao3 + 0); data18 = *(ao3 + 1); data25 = *(ao4 + 0); data26 = *(ao4 + 1); data27 = *(ao4 + 2); b[ 0] = ONE; b[ 1] = data09; b[ 2] = data17; b[ 3] = data25; b[ 4] = ZERO; b[ 5] = ONE; b[ 6] = data18; b[ 7] = data26; b[ 8] = ZERO; b[ 9] = ZERO; b[10] = ONE; b[11] = data27; b[12] = ZERO; b[13] = ZERO; b[14] = ZERO; b[15] = ONE; #else data01 = *(ao1 + 0); data09 = *(ao2 + 0); data10 = *(ao2 + 1); data17 = *(ao3 + 0); data18 = *(ao3 + 1); data19 = *(ao3 + 2); data25 = *(ao4 + 0); data26 = *(ao4 + 1); data27 = *(ao4 + 2); data28 = *(ao4 + 3); b[ 0] = data01; b[ 1] = data09; b[ 2] = data17; b[ 3] = data25; b[ 4] = ZERO; b[ 5] = data10; b[ 6] = data18; b[ 7] = data26; b[ 8] = ZERO; b[ 9] = ZERO; b[10] = data19; b[11] = data27; b[12] = ZERO; b[13] = ZERO; b[14] = ZERO; b[15] = data28; #endif ao1 += 4 * lda; ao2 += 4 * lda; ao3 += 4 * lda; ao4 += 4 * lda; b += 16; } X += 4; i --; } while (i > 0); } i = (m & 3); if (i) { if (X < posY) { if (m & 2) { data01 = *(ao1 + 0); data02 = *(ao1 + 1); data09 = *(ao2 + 0); data10 = *(ao2 + 1); data17 = *(ao3 + 0); data18 = *(ao3 + 1); data25 = *(ao4 + 0); data26 = *(ao4 + 1); b[ 0] = data01; b[ 1] = data09; b[ 2] = data17; b[ 3] = data25; b[ 4] = data02; b[ 5] = data10; b[ 6] = data18; b[ 7] = data26; ao1 += 2; ao2 += 2; ao3 += 2; ao4 += 2; b += 8; } if (m & 1) { data01 = *(ao1 + 0); data09 = *(ao2 + 0); data17 = *(ao3 + 0); data25 = *(ao4 + 0); b[ 0] = data01; b[ 1] = data09; b[ 2] = data17; b[ 3] = data25; b += 4; } } else if (X > posY) { if (m & 2) { ao1 += 2 * lda; b += 8; } if (m & 1) { b += 4; } } else { #ifndef UNIT data01 = *(ao1 + 0); #endif data09 = *(ao2 + 0); data17 = *(ao3 + 0); data25 = *(ao4 + 0); if (i >= 2) { #ifndef UNIT data10 = *(ao2 + 1); #endif data18 = *(ao3 + 1); data26 = *(ao4 + 1); } if (i >= 3) { #ifndef UNIT data19 = *(ao3 + 2); #endif data27 = *(ao4 + 2); } #ifdef UNIT b[ 0] = ONE; #else b[ 0] = data01; #endif b[ 1] = data09; b[ 2] = data17; b[ 3] = data25; b += 4; if(i >= 2) { b[ 0] = ZERO; #ifdef UNIT b[ 1] = ONE; #else b[ 1] = data10; #endif b[ 2] = data18; b[ 3] = data26; b += 4; } if (i >= 3) { b[ 0] = ZERO; b[ 1] = ZERO; #ifdef UNIT b[ 2] = ONE; #else b[ 2] = data19; #endif b[ 3] = data27; b += 4; } } } posY += 4; } if (n & 2){ X = posX; if (posX <= posY) { ao1 = a + posX + (posY + 0) * lda; ao2 = a + posX + (posY + 1) * lda; } else { ao1 = a + posY + (posX + 0) * lda; ao2 = a + posY + (posX + 1) * lda; } i = (m >> 1); if (i > 0) { do { if (X < posY) { data01 = *(ao1 + 0); data02 = *(ao1 + 1); data09 = *(ao2 + 0); data10 = *(ao2 + 1); b[ 0] = data01; b[ 1] = data09; b[ 2] = data02; b[ 3] = data10; ao1 += 2; ao2 += 2; b += 4; } else if (X > posY) { ao1 += 2 * lda; ao2 += 2 * lda; b += 4; } else { #ifdef UNIT data09 = *(ao2 + 0); b[ 0] = ONE; b[ 1] = data09; b[ 2] = ZERO; b[ 3] = ONE; #else data01 = *(ao1 + 0); data09 = *(ao2 + 0); data10 = *(ao2 + 1); b[ 0] = data01; b[ 1] = data09; b[ 2] = ZERO; b[ 3] = data10; #endif ao1 += 2 * lda; ao2 += 2 * lda; b += 4; } X += 2; i --; } while (i > 0); } if (m & 1) { if (X < posY) { data01 = *(ao1 + 0); data09 = *(ao2 + 0); b[ 0] = data01; b[ 1] = data09; b += 2; } else if (X > posY) { b += 2; } else { #ifdef UNIT data09 = *(ao2 + 0); b[ 0] = ONE; b[ 1] = data09; #else data01 = *(ao1 + 0); data09 = *(ao2 + 0); b[ 0] = data01; b[ 1] = data09; #endif b += 2; } } posY += 2; } if (n & 1){ X = posX; if (posX <= posY) { ao1 = a + posX + (posY + 0) * lda; } else { ao1 = a + posY + (posX + 0) * lda; } i = m; if (m > 0) { do { if (X < posY) { data01 = *(ao1 + 0); b[ 0] = data01; ao1 += 1; b += 1; } else if (X > posY) { ao1 += lda; b += 1; } else { #ifdef UNIT b[ 0] = ONE; #else data01 = *(ao1 + 0); b[ 0] = data01; #endif ao1 += lda; b += 1; } X += 1; i --; } while (i > 0); } } return 0; }
tomosu/opentoonz
thirdparty/openblas/xianyi-OpenBLAS-e6e87a2/kernel/generic/trmm_uncopy_8.c
C
bsd-3-clause
24,407
<?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_Navigation * @subpackage UnitTests * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ require_once 'Zend/Navigation/Page/Uri.php'; /** * Tests the class Zend_Navigation_Page_Uri * * @category Zend * @package Zend_Navigation * @subpackage UnitTests * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Navigation */ class Zend_Navigation_Page_UriTest extends PHPUnit_Framework_TestCase { public function testUriOptionAsString() { $page = new Zend_Navigation_Page_Uri(array( 'label' => 'foo', 'uri' => '#' )); $this->assertEquals('#', $page->getUri()); } public function testUriOptionAsNull() { $page = new Zend_Navigation_Page_Uri(array( 'label' => 'foo', 'uri' => null )); $this->assertNull($page->getUri(), 'getUri() should return null'); } public function testUriOptionAsInteger() { try { $page = new Zend_Navigation_Page_Uri(array('uri' => 1337)); $this->fail('An invalid \'uri\' was given, but ' . 'a Zend_Navigation_Exception was not thrown'); } catch (Zend_Navigation_Exception $e) { } } public function testUriOptionAsObject() { try { $uri = new stdClass(); $uri->foo = 'bar'; $page = new Zend_Navigation_Page_Uri(array('uri' => $uri)); $this->fail('An invalid \'uri\' was given, but ' . 'a Zend_Navigation_Exception was not thrown'); } catch (Zend_Navigation_Exception $e) { } } public function testSetAndGetUri() { $page = new Zend_Navigation_Page_Uri(array( 'label' => 'foo', 'uri' => '#' )); $page->setUri('http://www.example.com/')->setUri('about:blank'); $this->assertEquals('about:blank', $page->getUri()); } public function testGetHref() { $uri = 'spotify:album:4YzcWwBUSzibRsqD9Sgu4A'; $page = new Zend_Navigation_Page_Uri(); $page->setUri($uri); $this->assertEquals($uri, $page->getHref()); } /** * @group ZF-8922 */ public function testGetHrefWithFragmentIdentifier() { $uri = 'http://www.example.com/foo.html'; $page = new Zend_Navigation_Page_Uri(); $page->setUri($uri); $page->setFragment('bar'); $this->assertEquals($uri . '#bar', $page->getHref()); $page->setUri('#'); $this->assertEquals('#bar', $page->getHref()); } }
elvisdandrea/esselence
tests/Zend/Navigation/Page/UriTest.php
PHP
bsd-3-clause
3,387
var parse = require('../'); var test = require('tape'); test('flag boolean default false', function (t) { var argv = parse(['moo'], { boolean: ['t', 'verbose'], default: { verbose: false, t: false } }); t.deepEqual(argv, { verbose: false, t: false, _: ['moo'] }); t.deepEqual(typeof argv.verbose, 'boolean'); t.deepEqual(typeof argv.t, 'boolean'); t.end(); }); test('boolean groups', function (t) { var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], { boolean: ['x','y','z'] }); t.deepEqual(argv, { x : true, y : false, z : true, _ : [ 'one', 'two', 'three' ] }); t.deepEqual(typeof argv.x, 'boolean'); t.deepEqual(typeof argv.y, 'boolean'); t.deepEqual(typeof argv.z, 'boolean'); t.end(); }); test('boolean and alias with chainable api', function (t) { var aliased = [ '-h', 'derp' ]; var regular = [ '--herp', 'derp' ]; var opts = { herp: { alias: 'h', boolean: true } }; var aliasedArgv = parse(aliased, { boolean: 'herp', alias: { h: 'herp' } }); var propertyArgv = parse(regular, { boolean: 'herp', alias: { h: 'herp' } }); var expected = { herp: true, h: true, '_': [ 'derp' ] }; t.same(aliasedArgv, expected); t.same(propertyArgv, expected); t.end(); }); test('boolean and alias with options hash', function (t) { var aliased = [ '-h', 'derp' ]; var regular = [ '--herp', 'derp' ]; var opts = { alias: { 'h': 'herp' }, boolean: 'herp' }; var aliasedArgv = parse(aliased, opts); var propertyArgv = parse(regular, opts); var expected = { herp: true, h: true, '_': [ 'derp' ] }; t.same(aliasedArgv, expected); t.same(propertyArgv, expected); t.end(); }); test('boolean and alias using explicit true', function (t) { var aliased = [ '-h', 'true' ]; var regular = [ '--herp', 'true' ]; var opts = { alias: { h: 'herp' }, boolean: 'h' }; var aliasedArgv = parse(aliased, opts); var propertyArgv = parse(regular, opts); var expected = { herp: true, h: true, '_': [ ] }; t.same(aliasedArgv, expected); t.same(propertyArgv, expected); t.end(); }); // regression, see https://github.com/substack/node-optimist/issues/71 test('boolean and --x=true', function(t) { var parsed = parse(['--boool', '--other=true'], { boolean: 'boool' }); t.same(parsed.boool, true); t.same(parsed.other, 'true'); parsed = parse(['--boool', '--other=false'], { boolean: 'boool' }); t.same(parsed.boool, true); t.same(parsed.other, 'false'); t.end(); });
iostrovok/js-bratok
node_modules/gulp-connect/node_modules/gulp-util/node_modules/dateformat/node_modules/meow/node_modules/minimist/test/bool.js
JavaScript
bsd-3-clause
2,853
BODY { BACKGROUND-COLOR: white; FONT-FAMILY: "Verdana", sans-serif; FONT-SIZE: 100%; MARGIN-LEFT: 0px; MARGIN-TOP: 0px } P { FONT-FAMILY: "Verdana", sans-serif; FONT-SIZE: 70%; LINE-HEIGHT: 12pt; MARGIN-BOTTOM: 0px; MARGIN-LEFT: 10px; MARGIN-TOP: 10px } .note { BACKGROUND-COLOR: #ffffff; COLOR: #336699; FONT-FAMILY: "Verdana", sans-serif; FONT-SIZE: 100%; MARGIN-BOTTOM: 0px; MARGIN-LEFT: 0px; MARGIN-TOP: 0px; PADDING-RIGHT: 10px } .infotable { BACKGROUND-COLOR: #f0f0e0; BORDER-BOTTOM: #ffffff 0px solid; BORDER-COLLAPSE: collapse; BORDER-LEFT: #ffffff 0px solid; BORDER-RIGHT: #ffffff 0px solid; BORDER-TOP: #ffffff 0px solid; FONT-SIZE: 70%; MARGIN-LEFT: 10px } .issuetable { BACKGROUND-COLOR: #ffffe8; BORDER-COLLAPSE: collapse; COLOR: #000000; FONT-SIZE: 100%; MARGIN-BOTTOM: 10px; MARGIN-LEFT: 13px; MARGIN-TOP: 0px } .issuetitle { BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #dcdcdc 1px solid; BORDER-TOP: #dcdcdc 1px; COLOR: #003366; FONT-WEIGHT: normal } .header { BACKGROUND-COLOR: #cecf9c; BORDER-BOTTOM: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid; BORDER-RIGHT: #ffffff 1px solid; BORDER-TOP: #ffffff 1px solid; COLOR: #000000; FONT-WEIGHT: bold } .issuehdr { BACKGROUND-COLOR: #E0EBF5; BORDER-BOTTOM: #dcdcdc 1px solid; BORDER-TOP: #dcdcdc 1px solid; COLOR: #000000; FONT-WEIGHT: normal } .issuenone { BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; BORDER-RIGHT: 0px; BORDER-TOP: 0px; COLOR: #000000; FONT-WEIGHT: normal } .content { BACKGROUND-COLOR: #e7e7ce; BORDER-BOTTOM: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid; BORDER-RIGHT: #ffffff 1px solid; BORDER-TOP: #ffffff 1px solid; PADDING-LEFT: 3px } .issuecontent { BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #dcdcdc 1px solid; BORDER-TOP: #dcdcdc 1px solid; PADDING-LEFT: 3px } A:link { COLOR: #cc6633; TEXT-DECORATION: underline } A:visited { COLOR: #cc6633; } A:active { COLOR: #cc6633; } A:hover { COLOR: #cc3300; TEXT-DECORATION: underline } H1 { BACKGROUND-COLOR: #003366; BORDER-BOTTOM: #336699 6px solid; COLOR: #ffffff; FONT-SIZE: 130%; FONT-WEIGHT: normal; MARGIN: 0em 0em 0em -20px; PADDING-BOTTOM: 8px; PADDING-LEFT: 30px; PADDING-TOP: 16px } H2 { COLOR: #000000; FONT-SIZE: 80%; FONT-WEIGHT: bold; MARGIN-BOTTOM: 3px; MARGIN-LEFT: 10px; MARGIN-TOP: 20px; PADDING-LEFT: 0px } H3 { COLOR: #000000; FONT-SIZE: 80%; FONT-WEIGHT: bold; MARGIN-BOTTOM: -5px; MARGIN-LEFT: 10px; MARGIN-TOP: 20px } H4 { COLOR: #000000; FONT-SIZE: 70%; FONT-WEIGHT: bold; MARGIN-BOTTOM: 0px; MARGIN-TOP: 15px; PADDING-BOTTOM: 0px } UL { COLOR: #000000; FONT-SIZE: 70%; LIST-STYLE: square; MARGIN-BOTTOM: 0pt; MARGIN-TOP: 0pt } OL { COLOR: #000000; FONT-SIZE: 70%; LIST-STYLE: square; MARGIN-BOTTOM: 0pt; MARGIN-TOP: 0pt } LI { LIST-STYLE: square; MARGIN-LEFT: 0px } .expandable { CURSOR: hand } .expanded { color: black } .collapsed { DISPLAY: none } .foot { BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #cecf9c 1px solid; BORDER-TOP: #cecf9c 2px solid } .settings { MARGIN-LEFT: 25PX; } .help { TEXT-ALIGN: right; margin-right: 10px; }
TeravoxelTwoPhotonTomography/fetch
3rdParty/AlazarTech/ATS-SDK/5.8.2/Samples/ATS9350/SinglePort/AR/_UpgradeReport_Files/UpgradeReport.css
CSS
bsd-3-clause
3,141
<?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_View * @subpackage Helper * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: HtmlElement.php 12477 2008-11-09 01:55:35Z yoshida@zend.co.jp $ */ /** * @see Zend_View_Helper_Abstract */ require_once 'Zend/View/Helper/Abstract.php'; /** * @category Zend * @package Zend_View * @subpackage Helper * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_View_Helper_HtmlElement extends Zend_View_Helper_Abstract { /** * EOL character */ const EOL = "\n"; /** * The tag closing bracket * * @var string */ protected $_closingBracket = null; /** * Get the tag closing bracket * * @return string */ public function getClosingBracket() { if (!$this->_closingBracket) { if ($this->_isXhtml()) { $this->_closingBracket = ' />'; } else { $this->_closingBracket = '>'; } } return $this->_closingBracket; } /** * Is doctype XHTML? * * @return boolean */ protected function _isXhtml() { $doctype = $this->view->doctype(); return $doctype->isXhtml(); } /** * Converts an associative array to a string of tag attributes. * * @access public * * @param array $attribs From this array, each key-value pair is * converted to an attribute name and value. * * @return string The XHTML for the attributes. */ protected function _htmlAttribs($attribs) { $xhtml = ''; foreach ((array) $attribs as $key => $val) { $key = $this->view->escape($key); if (('on' == substr($key, 0, 2)) || ('constraints' == $key)) { // Don't escape event attributes; _do_ substitute double quotes with singles if (!is_scalar($val)) { // non-scalar data should be cast to JSON first require_once 'Zend/Json.php'; $val = Zend_Json::encode($val); } $val = preg_replace('/"([^"]*)":/', '$1:', $val); } else { if (is_array($val)) { $val = implode(' ', $val); } $val = $this->view->escape($val); } if ('id' == $key) { $val = $this->_normalizeId($val); } if (strpos($val, '"') !== false) { $xhtml .= " $key='$val'"; } else { $xhtml .= " $key=\"$val\""; } } return $xhtml; } /** * Normalize an ID * * @param string $value * @return string */ protected function _normalizeId($value) { if (strstr($value, '[')) { if ('[]' == substr($value, -2)) { $value = substr($value, 0, strlen($value) - 2); } $value = trim($value, ']'); $value = str_replace('][', '-', $value); $value = str_replace('[', '-', $value); } return $value; } }
joobsbox/joobsbox
library/Zend/View/Helper/HtmlElement.php
PHP
bsd-3-clause
3,884
/* * $Id: pa_ringbuffer.c 1421 2009-11-18 16:09:05Z bjornroche $ * Portable Audio I/O Library * Ring Buffer utility. * * Author: Phil Burk, http://www.softsynth.com * modified for SMP safety on Mac OS X by Bjorn Roche * modified for SMP safety on Linux by Leland Lucius * also, allowed for const where possible * modified for multiple-byte-sized data elements by Sven Fischer * * Note that this is safe only for a single-thread reader and a * single-thread writer. * * This program uses the PortAudio Portable Audio Library. * For more information see: http://www.portaudio.com * Copyright (c) 1999-2000 Ross Bencina and Phil Burk * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files * (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that * they can be incorporated into the canonical version. It is also * requested that these non-binding requests be included along with the * license above. */ /** @file @ingroup common_src */ #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "webrtc/modules/audio_device/mac/portaudio/pa_memorybarrier.h" #include "webrtc/modules/audio_device/mac/portaudio/pa_ringbuffer.h" /*************************************************************************** * Initialize FIFO. * elementCount must be power of 2, returns -1 if not. */ PaRingBufferSize PaUtil_InitializeRingBuffer(PaUtilRingBuffer* rbuf, PaRingBufferSize elementSizeBytes, PaRingBufferSize elementCount, void* dataPtr) { if( ((elementCount-1) & elementCount) != 0) return -1; /* Not Power of two. */ rbuf->bufferSize = elementCount; rbuf->buffer = (char *)dataPtr; PaUtil_FlushRingBuffer( rbuf ); rbuf->bigMask = (elementCount*2)-1; rbuf->smallMask = (elementCount)-1; rbuf->elementSizeBytes = elementSizeBytes; return 0; } /*************************************************************************** ** Return number of elements available for reading. */ PaRingBufferSize PaUtil_GetRingBufferReadAvailable( PaUtilRingBuffer *rbuf ) { PaUtil_ReadMemoryBarrier(); return ( (rbuf->writeIndex - rbuf->readIndex) & rbuf->bigMask ); } /*************************************************************************** ** Return number of elements available for writing. */ PaRingBufferSize PaUtil_GetRingBufferWriteAvailable( PaUtilRingBuffer *rbuf ) { /* Since we are calling PaUtil_GetRingBufferReadAvailable, we don't need an aditional MB */ return ( rbuf->bufferSize - PaUtil_GetRingBufferReadAvailable(rbuf)); } /*************************************************************************** ** Clear buffer. Should only be called when buffer is NOT being read. */ void PaUtil_FlushRingBuffer( PaUtilRingBuffer *rbuf ) { rbuf->writeIndex = rbuf->readIndex = 0; } /*************************************************************************** ** Get address of region(s) to which we can write data. ** If the region is contiguous, size2 will be zero. ** If non-contiguous, size2 will be the size of second region. ** Returns room available to be written or elementCount, whichever is smaller. */ PaRingBufferSize PaUtil_GetRingBufferWriteRegions(PaUtilRingBuffer* rbuf, PaRingBufferSize elementCount, void** dataPtr1, PaRingBufferSize* sizePtr1, void** dataPtr2, PaRingBufferSize* sizePtr2) { PaRingBufferSize index; PaRingBufferSize available = PaUtil_GetRingBufferWriteAvailable( rbuf ); if( elementCount > available ) elementCount = available; /* Check to see if write is not contiguous. */ index = rbuf->writeIndex & rbuf->smallMask; if( (index + elementCount) > rbuf->bufferSize ) { /* Write data in two blocks that wrap the buffer. */ PaRingBufferSize firstHalf = rbuf->bufferSize - index; *dataPtr1 = &rbuf->buffer[index*rbuf->elementSizeBytes]; *sizePtr1 = firstHalf; *dataPtr2 = &rbuf->buffer[0]; *sizePtr2 = elementCount - firstHalf; } else { *dataPtr1 = &rbuf->buffer[index*rbuf->elementSizeBytes]; *sizePtr1 = elementCount; *dataPtr2 = NULL; *sizePtr2 = 0; } return elementCount; } /*************************************************************************** */ PaRingBufferSize PaUtil_AdvanceRingBufferWriteIndex( PaUtilRingBuffer* rbuf, PaRingBufferSize elementCount) { /* we need to ensure that previous writes are seen before we update the write index */ PaUtil_WriteMemoryBarrier(); return rbuf->writeIndex = (rbuf->writeIndex + elementCount) & rbuf->bigMask; } /*************************************************************************** ** Get address of region(s) from which we can read data. ** If the region is contiguous, size2 will be zero. ** If non-contiguous, size2 will be the size of second region. ** Returns room available to be written or elementCount, whichever is smaller. */ PaRingBufferSize PaUtil_GetRingBufferReadRegions(PaUtilRingBuffer* rbuf, PaRingBufferSize elementCount, void** dataPtr1, PaRingBufferSize* sizePtr1, void** dataPtr2, PaRingBufferSize* sizePtr2) { PaRingBufferSize index; PaRingBufferSize available = PaUtil_GetRingBufferReadAvailable( rbuf ); if( elementCount > available ) elementCount = available; /* Check to see if read is not contiguous. */ index = rbuf->readIndex & rbuf->smallMask; if( (index + elementCount) > rbuf->bufferSize ) { /* Write data in two blocks that wrap the buffer. */ PaRingBufferSize firstHalf = rbuf->bufferSize - index; *dataPtr1 = &rbuf->buffer[index*rbuf->elementSizeBytes]; *sizePtr1 = firstHalf; *dataPtr2 = &rbuf->buffer[0]; *sizePtr2 = elementCount - firstHalf; } else { *dataPtr1 = &rbuf->buffer[index*rbuf->elementSizeBytes]; *sizePtr1 = elementCount; *dataPtr2 = NULL; *sizePtr2 = 0; } return elementCount; } /*************************************************************************** */ PaRingBufferSize PaUtil_AdvanceRingBufferReadIndex( PaUtilRingBuffer* rbuf, PaRingBufferSize elementCount) { /* we need to ensure that previous writes are always seen before updating the index. */ PaUtil_WriteMemoryBarrier(); return rbuf->readIndex = (rbuf->readIndex + elementCount) & rbuf->bigMask; } /*************************************************************************** ** Return elements written. */ PaRingBufferSize PaUtil_WriteRingBuffer(PaUtilRingBuffer* rbuf, const void* data, PaRingBufferSize elementCount) { PaRingBufferSize size1, size2, numWritten; void *data1, *data2; numWritten = PaUtil_GetRingBufferWriteRegions( rbuf, elementCount, &data1, &size1, &data2, &size2 ); if( size2 > 0 ) { memcpy( data1, data, size1*rbuf->elementSizeBytes ); data = ((char *)data) + size1*rbuf->elementSizeBytes; memcpy( data2, data, size2*rbuf->elementSizeBytes ); } else { memcpy( data1, data, size1*rbuf->elementSizeBytes ); } PaUtil_AdvanceRingBufferWriteIndex( rbuf, numWritten ); return numWritten; } /*************************************************************************** ** Return elements read. */ PaRingBufferSize PaUtil_ReadRingBuffer(PaUtilRingBuffer* rbuf, void* data, PaRingBufferSize elementCount) { PaRingBufferSize size1, size2, numRead; void *data1, *data2; numRead = PaUtil_GetRingBufferReadRegions( rbuf, elementCount, &data1, &size1, &data2, &size2 ); if( size2 > 0 ) { memcpy( data, data1, size1*rbuf->elementSizeBytes ); data = ((char *)data) + size1*rbuf->elementSizeBytes; memcpy( data, data2, size2*rbuf->elementSizeBytes ); } else { memcpy( data, data1, size1*rbuf->elementSizeBytes ); } PaUtil_AdvanceRingBufferReadIndex( rbuf, numRead ); return numRead; }
guorendong/iridium-browser-ubuntu
third_party/webrtc/modules/audio_device/mac/portaudio/pa_ringbuffer.c
C
bsd-3-clause
9,901
#!/usr/bin/env bash # Create browsable web page like in QA TPC layout # # # Example usage: # ( aliroot -b -q $AliPhysics_SRC/PWGPP/QA/scripts/qaTrending.C+ '$AliPhysics_SRC/PWGPP/QA/detectorQAscripts/qaTrendingTRD.C("LHC15o","cpass1_pass1")' ) # ( source $AliPhysics_SRC/PWGPP/scripts/makeHtml.sh table.html index.html 0); ## create run tabletable ## fill html web page ## if [ "$#" -lt 3 ]; then echo "makeHtml.sh : illegal number of input parameters" echo "1. name of output html file" echo "2. input table" echo "3. height Draw" echo "4. comma separated list of static tables" exit; fi ## Get parameters source $ALICE_ROOT/libexec/alilog4bash.sh { outputHtml=$1 inputTable=$2 htmlList=$4 heightDraw=$3 alilog_info "outputTable $outputHtml" alilog_info "inputTable $inputTable" alilog_info "height draw $heightDraw" alilog_info "htmlList $htmlList" } ######################################################################################## # 0.) include web page template (CSS and java scripts) ######################################################################################## { cat $AliPhysics_SRC/PWGPP/scripts/html/tableBrowser_v1.html > $outputHtml echo "<body class=\"content\">" >> $outputHtml echo " <div class=\"topWrapper\">" >> $outputHtml echo " <div class=\"leftDiv\">" >> $outputHtml } ####################################################################################### # 1.) Make period tabs - # code snippet https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_tabs_fade # a.) Make buttons # b.) Make tab content ####################################################################################### { # 2.a) Make buttons ( intendation 6) printf '\n <div class="tab">\n' >>$outputHtml for a in `ls tab*.html`; do tname=`echo $a |sed s_"\.html"__`; # echo "<li><a href=\"#\" onclick=\"openQATab('$tname')\"\>$tname</a></li>" >>$outputHtml # example for w3c # <button class="tablinks" onclick="openCity(event, 'London')">London</button> echo ' <button class="tabLinks" onclick="openQATab(event,'"'"$tname"'"')">'$tname'</button>' >>$outputHtml done; echo " </div>" >>$outputHtml # 2.b Make tab content #cat treePeriodTable.html >> $outputHtml ###### Period Table for the upper left corner for a in `ls tab*.html`; do tname=`echo $a |sed s_"\.html"__`; printf '\n <div id="'$tname'" class="QATab">\n'>>$outputHtml #printf '<h2 style="margin-bottom:3px;margin-top:3px">TPC QA trending</h2>' >>$outputHtml cat $a | sed s_"^"_" "_ >>$outputHtml printf " </div>\n\n" >>$outputHtml done; printf " </div>\n" >> $outputHtml } ########################################################################################################### # 2.) Draw canvas ########################################################################################################### { echo " <div class=\"rightDiv\" id=\"canvasDiv\">" >> $outputHtml echo " <canvas width=\"800\" height=\"$heightDraw\" id=\"canvasDraw\"></canvas>" >> $outputHtml echo " </div>" >> $outputHtml echo "" >> $outputHtml echo "</div>" >> $outputHtml } ########################################################################################################### # 3.) Write Custom Query Box and table ########################################################################################################### { echo "<div class=\"lowerDiv\">" >> $outputHtml echo "<table border=\"0\" cellpadding=\"1\" cellspacing=\"2\">" >> $outputHtml echo " <tbody>" >> $outputHtml echo " <tr>" >> $outputHtml echo " <td>Custom query:</td>" >> $outputHtml echo " <td><input id=\"globalSelectionMI\" class=\"globalSelectionMI\" name=\"globalSelectionMI\" type=\"text\" size=\"50\"></td>" >> $outputHtml echo " <td>Custom draw:</td>" >> $outputHtml echo " <td><input id=\"globalDrawMI\" class=\"globalDrawMI\" name=\"globalDrawMI\" type=\"text\", size=\"50\"></td>" >> $outputHtml echo " </tr>" >> $outputHtml echo " </tbody>" >> $outputHtml echo "</table>" >> $outputHtml echo '<table id="runTable" class="display" cellspacing="0" width="100%">' >>$outputHtml cat $inputTable | grep -v "<table" >> $outputHtml ##### Run Table for the lower corner echo "</div>" >> $outputHtml #echo "</document>" >> $outputHtml }
alisw/AliPhysics
PWGPP/scripts/makeHtmlv1.sh
Shell
bsd-3-clause
4,591
module.exports = FileWriter var fs = require("graceful-fs") , mkdir = require("mkdirp") , Writer = require("./writer.js") , inherits = require("inherits") , EOF = {} inherits(FileWriter, Writer) function FileWriter (props) { var me = this if (!(me instanceof FileWriter)) throw new Error( "FileWriter must be called as constructor.") // should already be established as a File type if (props.type !== "File" || !props.File) { throw new Error("Non-file type "+ props.type) } me._buffer = [] me._bytesWritten = 0 Writer.call(this, props) } FileWriter.prototype._create = function () { var me = this if (me._stream) return var so = {} if (me.props.flags) so.flags = me.props.flags so.mode = Writer.filemode if (me._old && me._old.blksize) so.bufferSize = me._old.blksize me._stream = fs.createWriteStream(me._path, so) me._stream.on("open", function (fd) { // console.error("FW open", me._buffer, me._path) me.ready = true me._buffer.forEach(function (c) { if (c === EOF) me._stream.end() else me._stream.write(c) }) me.emit("ready") // give this a kick just in case it needs it. me.emit("drain") }) me._stream.on("drain", function () { me.emit("drain") }) me._stream.on("close", function () { // console.error("\n\nFW Stream Close", me._path, me.size) me._finish() }) } FileWriter.prototype.write = function (c) { var me = this me._bytesWritten += c.length if (!me.ready) { if (!Buffer.isBuffer(c) && typeof c !== 'string') throw new Error('invalid write data') me._buffer.push(c) return false } var ret = me._stream.write(c) // console.error("\t-- fw wrote, _stream says", ret, me._stream._queue.length) // allow 2 buffered writes, because otherwise there's just too // much stop and go bs. if (ret === false && me._stream._queue) { return me._stream._queue.length <= 2; } else { return ret; } } FileWriter.prototype.end = function (c) { var me = this if (c) me.write(c) if (!me.ready) { me._buffer.push(EOF) return false } return me._stream.end() } FileWriter.prototype._finish = function () { var me = this if (typeof me.size === "number" && me._bytesWritten != me.size) { me.error( "Did not get expected byte count.\n" + "expect: " + me.size + "\n" + "actual: " + me._bytesWritten) } Writer.prototype._finish.call(me) }
Steffen911/ThesIn
node_modules/fstream/lib/file-writer.js
JavaScript
bsd-3-clause
2,444
<?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace Zend\Filter; use Traversable; use Zend\Stdlib\ErrorHandler; class RealPath extends AbstractFilter { /** * @var array $options */ protected $options = array( 'exists' => true ); /** * Class constructor * * @param bool|Traversable $existsOrOptions Options to set */ public function __construct($existsOrOptions = true) { if ($existsOrOptions !== null) { if (!static::isOptions($existsOrOptions)) { $this->setExists($existsOrOptions); } else { $this->setOptions($existsOrOptions); } } } /** * Sets if the path has to exist * TRUE when the path must exist * FALSE when not existing paths can be given * * @param bool $flag Path must exist * @return RealPath */ public function setExists($flag = true) { $this->options['exists'] = (bool) $flag; return $this; } /** * Returns true if the filtered path must exist * * @return bool */ public function getExists() { return $this->options['exists']; } /** * Defined by Zend\Filter\FilterInterface * * Returns realpath($value) * * @param string $value * @return string */ public function filter($value) { $path = (string) $value; if ($this->options['exists']) { return realpath($path); } ErrorHandler::start(); $realpath = realpath($path); ErrorHandler::stop(); if ($realpath) { return $realpath; } $drive = ''; if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $path = preg_replace('/[\\\\\/]/', DIRECTORY_SEPARATOR, $path); if (preg_match('/([a-zA-Z]\:)(.*)/', $path, $matches)) { list(, $drive, $path) = $matches; } else { $cwd = getcwd(); $drive = substr($cwd, 0, 2); if (substr($path, 0, 1) != DIRECTORY_SEPARATOR) { $path = substr($cwd, 3) . DIRECTORY_SEPARATOR . $path; } } } elseif (substr($path, 0, 1) != DIRECTORY_SEPARATOR) { $path = getcwd() . DIRECTORY_SEPARATOR . $path; } $stack = array(); $parts = explode(DIRECTORY_SEPARATOR, $path); foreach ($parts as $dir) { if (strlen($dir) && $dir !== '.') { if ($dir == '..') { array_pop($stack); } else { array_push($stack, $dir); } } } return $drive . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $stack); } }
psrearick/zf1Codenvy
vendor/ZF2/library/Zend/Filter/RealPath.php
PHP
bsd-3-clause
3,208
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @flow */ 'use strict'; 'use strict'; import DependencyGraphHelpers from '../../node-haste/DependencyGraph/DependencyGraphHelpers'; type ModuleID = string; export type Path = string; type Platform = string; type Platforms = Set<Platform>; export type Extensions = Array<string>; export type Module = { path: Path, type: 'Module', getName(): Promise<ModuleID>, getPackage(): ?Package, isHaste(): Promise<boolean>, }; export type Package = { path: Path, root: Path, type: 'Package', getMain(): Path, getName(): Promise<ModuleID>, isHaste(): Promise<boolean>, redirectRequire(id: ModuleID): Path | false, }; export type ModuleCache = { getAssetModule(path: Path): Module, getModule(path: Path): Module, getPackage(path: Path): Package, getPackageOf(path: Path): ?Package, } export type FastFS = { dirExists(path: Path): boolean, closest(path: string, fileName: string): ?string, fileExists(path: Path): boolean, getAllFiles(): Array<Path>, matches(directory: Path, pattern: RegExp): Array<Path>, }; type HasteMapOptions = {| extensions: Extensions, files: Array<string>, helpers: DependencyGraphHelpers, moduleCache: ModuleCache, platforms: Platforms, preferNativePlatform: true, |}; declare class HasteMap { // node-haste/DependencyGraph/HasteMap.js build(): Promise<Object>, constructor(options: HasteMapOptions): void, }
ndejesus1227/react-native
packager/src/ModuleGraph/node-haste/node-haste.flow.js
JavaScript
bsd-3-clause
1,702
<?php namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode, Doctrine\ORM\Query\Lexer; /** * @author Przemek Sobstel <przemek@sobstel.org> */ class TimestampDiff extends FunctionNode { public $firstDatetimeExpression = null; public $secondDatetimeExpression = null; public $unit = null; public function parse(\Doctrine\ORM\Query\Parser $parser) { $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); $parser->match(Lexer::T_IDENTIFIER); $lexer = $parser->getLexer(); $this->unit = $lexer->token['value']; $parser->match(Lexer::T_COMMA); $this->firstDatetimeExpression = $parser->ArithmeticPrimary(); $parser->match(Lexer::T_COMMA); $this->secondDatetimeExpression = $parser->ArithmeticPrimary(); $parser->match(Lexer::T_CLOSE_PARENTHESIS); } public function getSql(\Doctrine\ORM\Query\SqlWalker $sql_walker) { return sprintf('TIMESTAMPDIFF(%s, %s, %s)', $this->unit, $this->firstDatetimeExpression->dispatch($sql_walker), $this->secondDatetimeExpression->dispatch($sql_walker) ); } }
pnvasanth/DoctrineExtensions
src/Query/Mysql/TimestampDiff.php
PHP
bsd-3-clause
1,180
<!DOCTYPE html> <html> <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# githubog: http://ogp.me/ns/fb/githubog#"> <meta charset='utf-8'> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Improved regex in strip_tags · d7504a3 · django/django</title> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub" /> <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub" /> <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-114.png" /> <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114.png" /> <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-144.png" /> <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144.png" /> <link rel="logo" type="image/svg" href="http://github-media-downloads.s3.amazonaws.com/github-logo.svg" /> <meta name="msapplication-TileImage" content="/windows-tile.png"> <meta name="msapplication-TileColor" content="#ffffff"> <link rel="icon" type="image/x-icon" href="/favicon.ico" /> <meta content="authenticity_token" name="csrf-param" /> <meta content="Vbmuc30dLLFdm7POIe3xfTa4nODYc/la/wLrI1OLEOI=" name="csrf-token" /> <link href="https://a248.e.akamai.net/assets.github.com/assets/github-f70e4783e00fd4884a9e5e651a43933c9881caa8.css" media="all" rel="stylesheet" type="text/css" /> <link href="https://a248.e.akamai.net/assets.github.com/assets/github2-0d31290d073dea4d8671e2b8c747629aeb074034.css" media="all" rel="stylesheet" type="text/css" /> <script src="https://a248.e.akamai.net/assets.github.com/assets/frameworks-d76b58e749b52bc47a4c46620bf2c320fabe5248.js" type="text/javascript"></script> <script src="https://a248.e.akamai.net/assets.github.com/assets/github-67b55380cff8d6766b298e6935a3c1db7d5c6d5d.js" type="text/javascript"></script> <meta http-equiv="x-pjax-version" content="1212ad79754350a805cefbcd08a3dadf"> <link data-pjax-transient rel='alternate' type='text/plain+diff' href="&#x2F;django&#x2F;django&#x2F;commit&#x2F;d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e.diff"> <link data-pjax-transient rel='alternate' type='text/plain+patch' href="&#x2F;django&#x2F;django&#x2F;commit&#x2F;d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e.patch"> <link data-pjax-transient rel='permalink' type='text/html' href="&#x2F;django&#x2F;django&#x2F;commit&#x2F;d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e"> <meta property="og:title" content="django"/> <meta property="og:type" content="githubog:gitrepository"/> <meta property="og:url" content="https://github.com/django/django"/> <meta property="og:image" content="https://secure.gravatar.com/avatar/fd542381031aa84dca86628ece84fc07?s=420&amp;d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png"/> <meta property="og:site_name" content="GitHub"/> <meta property="og:description" content="django - The Web framework for perfectionists with deadlines."/> <meta property="twitter:card" content="summary"/> <meta property="twitter:site" content="@GitHub"> <meta property="twitter:title" content="django/django"/> <meta name="description" content="django - The Web framework for perfectionists with deadlines." /> <link href="https://github.com/django/django/commits/d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e.atom" rel="alternate" title="Recent Commits to django:d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e" type="application/atom+xml" /> </head> <body class="logged_in linux vis-public env-production "> <div id="wrapper"> <div class="header header-logged-in true"> <div class="container clearfix"> <a class="header-logo-blacktocat" href="https://github.com/"> <span class="mega-icon mega-icon-blacktocat"></span> </a> <div class="divider-vertical"></div> <a href="/django/django/notifications" class="notification-indicator tooltipped downwards contextually-unread" title="You have unread notifications in this repository"> <span class="mail-status unread"></span> </a> <div class="divider-vertical"></div> <div class="command-bar js-command-bar "> <form accept-charset="UTF-8" action="/search" class="command-bar-form" id="top_search_form" method="get"> <a href="/search/advanced" class="advanced-search-icon tooltipped downwards command-bar-search" id="advanced_search" title="Advanced search"><span class="mini-icon mini-icon-advanced-search "></span></a> <input type="text" name="q" id="js-command-bar-field" placeholder="Search or type a command" tabindex="1" data-username="claudep" autocapitalize="off"> <span class="mini-icon help tooltipped downwards" title="Show command bar help"> <span class="mini-icon mini-icon-help"></span> </span> <input type="hidden" name="ref" value="commandbar"> <div class="divider-vertical"></div> </form> <ul class="top-nav"> <li class="explore"><a href="https://github.com/explore">Explore</a></li> <li><a href="https://gist.github.com">Gist</a></li> <li><a href="/blog">Blog</a></li> <li><a href="http://help.github.com">Help</a></li> </ul> </div> <ul id="user-links"> <li> <a href="https://github.com/claudep" class="name"> <img height="20" src="https://secure.gravatar.com/avatar/cf4198670f0073174b475634964b576b?s=140&amp;d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png" width="20" /> claudep </a> </li> <li> <a href="/new" id="new_repo" class="tooltipped downwards" title="Create a new repo"> <span class="mini-icon mini-icon-create"></span> </a> </li> <li> <a href="/settings/profile" id="account_settings" class="tooltipped downwards" title="Account settings "> <span class="mini-icon mini-icon-account-settings"></span> </a> </li> <li> <a href="/logout" data-method="post" id="logout" class="tooltipped downwards" title="Sign out"> <span class="mini-icon mini-icon-logout"></span> </a> </li> </ul> </div> </div> <div class="site hfeed" itemscope itemtype="http://schema.org/WebPage"> <div class="hentry"> <div class="pagehead repohead instapaper_ignore readability-menu "> <div class="container"> <div class="title-actions-bar"> <ul class="pagehead-actions"> <li class="nspr"> <a href="/django/django/pull/new/d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e" class="button minibutton btn-pull-request" icon_class="mini-icon-pull-request"><span class="mini-icon mini-icon-pull-request"></span>Pull Request</a> </li> <li class="subscription"> <form accept-charset="UTF-8" action="/notifications/subscribe" data-autosubmit="true" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="authenticity_token" type="hidden" value="Vbmuc30dLLFdm7POIe3xfTa4nODYc/la/wLrI1OLEOI=" /></div> <input id="repository_id" name="repository_id" type="hidden" value="4164482" /> <div class="select-menu js-menu-container js-select-menu"> <span class="minibutton select-menu-button js-menu-target"> <span class="js-select-button"> <span class="mini-icon mini-icon-watching"></span> Watch </span> </span> <div class="select-menu-modal-holder js-menu-content"> <div class="select-menu-modal"> <div class="select-menu-header"> <span class="select-menu-title">Notification status</span> <span class="mini-icon mini-icon-remove-close js-menu-close"></span> </div> <!-- /.select-menu-header --> <div class="select-menu-list js-navigation-container"> <div class="select-menu-item js-navigation-item js-navigation-target selected"> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <div class="select-menu-item-text"> <input checked="checked" id="do_included" name="do" type="radio" value="included" /> <h4>Not watching</h4> <span class="description">You only receive notifications for discussions in which you participate or are @mentioned.</span> <span class="js-select-button-text hidden-select-button-text"> <span class="mini-icon mini-icon-watching"></span> Watch </span> </div> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <div class="select-menu-item-text"> <input id="do_subscribed" name="do" type="radio" value="subscribed" /> <h4>Watching</h4> <span class="description">You receive notifications for all discussions in this repository.</span> <span class="js-select-button-text hidden-select-button-text"> <span class="mini-icon mini-icon-unwatch"></span> Unwatch </span> </div> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <div class="select-menu-item-text"> <input id="do_ignore" name="do" type="radio" value="ignore" /> <h4>Ignoring</h4> <span class="description">You do not receive any notifications for discussions in this repository.</span> <span class="js-select-button-text hidden-select-button-text"> <span class="mini-icon mini-icon-mute"></span> Stop ignoring </span> </div> </div> <!-- /.select-menu-item --> </div> <!-- /.select-menu-list --> </div> <!-- /.select-menu-modal --> </div> <!-- /.select-menu-modal-holder --> </div> <!-- /.select-menu --> </form> </li> <li class="js-toggler-container js-social-container starring-container on"> <a href="/django/django/unstar" class="minibutton js-toggler-target star-button starred upwards" title="Unstar this repo" data-remote="true" data-method="post" rel="nofollow"> <span class="mini-icon mini-icon-remove-star"></span> <span class="text">Unstar</span> </a> <a href="/django/django/star" class="minibutton js-toggler-target star-button unstarred upwards" title="Star this repo" data-remote="true" data-method="post" rel="nofollow"> <span class="mini-icon mini-icon-star"></span> <span class="text">Star</span> </a> <a class="social-count js-social-count" href="/django/django/stargazers">5,939</a> </li> <li> <a href="/django/django/fork_select" class="minibutton js-toggler-target fork-button lighter upwards" title="Fork this repo" rel="facebox nofollow"> <span class="mini-icon mini-icon-branch-create"></span> <span class="text">Fork</span> </a> <a href="/django/django/network" class="social-count">1,909</a> </li> </ul> <h1 itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="entry-title public"> <span class="repo-label"><span>public</span></span> <span class="mega-icon mega-icon-public-repo"></span> <span class="author vcard"> <a href="/django" class="url fn" itemprop="url" rel="author"> <span itemprop="title">django</span> </a></span> / <strong><a href="/django/django" class="js-current-repository">django</a></strong> </h1> </div> <ul class="tabs"> <li><a href="/django/django" class="selected" highlight="repo_source repo_downloads repo_commits repo_tags repo_branches">Code</a></li> <li><a href="/django/django/network" highlight="repo_network">Network</a></li> <li><a href="/django/django/pulls" highlight="repo_pulls">Pull Requests <span class='counter'>177</span></a></li> <li><a href="/django/django/graphs" highlight="repo_graphs repo_contributors">Graphs</a></li> <li> <a href="/django/django/settings">Settings</a> </li> </ul> <div class="tabnav"> <span class="tabnav-right"> <ul class="tabnav-tabs"> <li><a href="/django/django/tags" class="tabnav-tab" highlight="repo_tags">Tags <span class="counter ">39</span></a></li> </ul> </span> <div class="tabnav-widget scope"> <div class="select-menu js-menu-container js-select-menu js-branch-menu"> <a class="minibutton select-menu-button js-menu-target" data-hotkey="w" data-ref=""> <span class="mini-icon mini-icon-tree"></span> <i>tree:</i> <span class="js-select-button">d7504a3d7b</span> </a> <div class="select-menu-modal-holder js-menu-content js-navigation-container"> <div class="select-menu-modal"> <div class="select-menu-header"> <span class="select-menu-title">Switch branches/tags</span> <span class="mini-icon mini-icon-remove-close js-menu-close"></span> </div> <!-- /.select-menu-header --> <div class="select-menu-filters"> <div class="select-menu-text-filter"> <input type="text" id="commitish-filter-field" class="js-filterable-field js-navigation-enable" placeholder="Find or create a branch…"> </div> <div class="select-menu-tabs"> <ul> <li class="select-menu-tab"> <a href="#" data-tab-filter="branches" class="js-select-menu-tab">Branches</a> </li> <li class="select-menu-tab"> <a href="#" data-tab-filter="tags" class="js-select-menu-tab">Tags</a> </li> </ul> </div><!-- /.select-menu-tabs --> </div><!-- /.select-menu-filters --> <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket css-truncate" data-tab-filter="branches"> <div data-filterable-for="commitish-filter-field" data-filterable-type="substring"> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/attic/boulder-oracle-sprint" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="attic/boulder-oracle-sprint" rel="nofollow" title="attic/boulder-oracle-sprint">attic/boulder-oracle-sprint</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/attic/full-history" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="attic/full-history" rel="nofollow" title="attic/full-history">attic/full-history</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/attic/generic-auth" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="attic/generic-auth" rel="nofollow" title="attic/generic-auth">attic/generic-auth</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/attic/gis" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="attic/gis" rel="nofollow" title="attic/gis">attic/gis</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/attic/i18n" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="attic/i18n" rel="nofollow" title="attic/i18n">attic/i18n</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/attic/magic-removal" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="attic/magic-removal" rel="nofollow" title="attic/magic-removal">attic/magic-removal</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/attic/multi-auth" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="attic/multi-auth" rel="nofollow" title="attic/multi-auth">attic/multi-auth</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/attic/multiple-db-support" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="attic/multiple-db-support" rel="nofollow" title="attic/multiple-db-support">attic/multiple-db-support</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/attic/new-admin" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="attic/new-admin" rel="nofollow" title="attic/new-admin">attic/new-admin</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/attic/newforms-admin" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="attic/newforms-admin" rel="nofollow" title="attic/newforms-admin">attic/newforms-admin</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/attic/per-object-permissions" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="attic/per-object-permissions" rel="nofollow" title="attic/per-object-permissions">attic/per-object-permissions</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/attic/queryset-refactor" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="attic/queryset-refactor" rel="nofollow" title="attic/queryset-refactor">attic/queryset-refactor</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/attic/schema-evolution" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="attic/schema-evolution" rel="nofollow" title="attic/schema-evolution">attic/schema-evolution</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/attic/schema-evolution-ng" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="attic/schema-evolution-ng" rel="nofollow" title="attic/schema-evolution-ng">attic/schema-evolution-ng</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/attic/search-api" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="attic/search-api" rel="nofollow" title="attic/search-api">attic/search-api</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/attic/sqlalchemy" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="attic/sqlalchemy" rel="nofollow" title="attic/sqlalchemy">attic/sqlalchemy</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/attic/unicode" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="attic/unicode" rel="nofollow" title="attic/unicode">attic/unicode</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/master" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="master" rel="nofollow" title="master">master</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/soc2009/admin-ui" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="soc2009/admin-ui" rel="nofollow" title="soc2009/admin-ui">soc2009/admin-ui</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/soc2009/http-wsgi-improvements" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="soc2009/http-wsgi-improvements" rel="nofollow" title="soc2009/http-wsgi-improvements">soc2009/http-wsgi-improvements</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/soc2009/i18n-improvements" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="soc2009/i18n-improvements" rel="nofollow" title="soc2009/i18n-improvements">soc2009/i18n-improvements</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/soc2009/model-validation" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="soc2009/model-validation" rel="nofollow" title="soc2009/model-validation">soc2009/model-validation</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/soc2009/multidb" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="soc2009/multidb" rel="nofollow" title="soc2009/multidb">soc2009/multidb</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/soc2009/test-improvements" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="soc2009/test-improvements" rel="nofollow" title="soc2009/test-improvements">soc2009/test-improvements</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/soc2010/app-loading" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="soc2010/app-loading" rel="nofollow" title="soc2010/app-loading">soc2010/app-loading</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/soc2010/query-refactor" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="soc2010/query-refactor" rel="nofollow" title="soc2010/query-refactor">soc2010/query-refactor</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/soc2010/test-refactor" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="soc2010/test-refactor" rel="nofollow" title="soc2010/test-refactor">soc2010/test-refactor</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/stable/0.90.x" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="stable/0.90.x" rel="nofollow" title="stable/0.90.x">stable/0.90.x</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/stable/0.91.x" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="stable/0.91.x" rel="nofollow" title="stable/0.91.x">stable/0.91.x</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/stable/0.95.x" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="stable/0.95.x" rel="nofollow" title="stable/0.95.x">stable/0.95.x</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/stable/0.96.x" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="stable/0.96.x" rel="nofollow" title="stable/0.96.x">stable/0.96.x</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/stable/1.0.x" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="stable/1.0.x" rel="nofollow" title="stable/1.0.x">stable/1.0.x</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/stable/1.1.x" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="stable/1.1.x" rel="nofollow" title="stable/1.1.x">stable/1.1.x</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/stable/1.2.x" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="stable/1.2.x" rel="nofollow" title="stable/1.2.x">stable/1.2.x</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/stable/1.3.x" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="stable/1.3.x" rel="nofollow" title="stable/1.3.x">stable/1.3.x</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/stable/1.4.x" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="stable/1.4.x" rel="nofollow" title="stable/1.4.x">stable/1.4.x</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/stable/1.5.x" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="stable/1.5.x" rel="nofollow" title="stable/1.5.x">stable/1.5.x</a> </div> <!-- /.select-menu-item --> </div> <form accept-charset="UTF-8" action="/django/django/branches" class="js-create-branch select-menu-item select-menu-new-item-form js-navigation-item js-navigation-target js-new-item-form" method="post"><div style="margin:0;padding:0;display:inline"><input name="authenticity_token" type="hidden" value="Vbmuc30dLLFdm7POIe3xfTa4nODYc/la/wLrI1OLEOI=" /></div> <span class="mini-icon mini-icon-branch-create select-menu-item-icon"></span> <div class="select-menu-item-text"> <h4>Create branch: <span class="js-new-item-name"></span></h4> <span class="description">from ‘d7504a3’</span> </div> <input type="hidden" name="name" id="name" class="js-new-item-submit" /> <input type="hidden" name="branch" id="branch" value="d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e" /> <input type="hidden" name="path" id="branch" value="" /> </form> <!-- /.select-menu-item --> </div> <!-- /.select-menu-list --> <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket css-truncate" data-tab-filter="tags"> <div data-filterable-for="commitish-filter-field" data-filterable-type="substring"> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.5c2" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.5c2" rel="nofollow" title="1.5c2">1.5c2</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.5c1" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.5c1" rel="nofollow" title="1.5c1">1.5c1</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.5b2" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.5b2" rel="nofollow" title="1.5b2">1.5b2</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.5b1" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.5b1" rel="nofollow" title="1.5b1">1.5b1</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.5a1" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.5a1" rel="nofollow" title="1.5a1">1.5a1</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.5.1" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.5.1" rel="nofollow" title="1.5.1">1.5.1</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.5" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.5" rel="nofollow" title="1.5">1.5</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.4.5" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.4.5" rel="nofollow" title="1.4.5">1.4.5</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.4.4" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.4.4" rel="nofollow" title="1.4.4">1.4.4</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.4.3" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.4.3" rel="nofollow" title="1.4.3">1.4.3</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.4.2" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.4.2" rel="nofollow" title="1.4.2">1.4.2</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.4.1" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.4.1" rel="nofollow" title="1.4.1">1.4.1</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.4" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.4" rel="nofollow" title="1.4">1.4</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.3.7" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.3.7" rel="nofollow" title="1.3.7">1.3.7</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.3.6" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.3.6" rel="nofollow" title="1.3.6">1.3.6</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.3.5" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.3.5" rel="nofollow" title="1.3.5">1.3.5</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.3.4" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.3.4" rel="nofollow" title="1.3.4">1.3.4</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.3.3" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.3.3" rel="nofollow" title="1.3.3">1.3.3</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.3.2" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.3.2" rel="nofollow" title="1.3.2">1.3.2</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.3.1" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.3.1" rel="nofollow" title="1.3.1">1.3.1</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.3" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.3" rel="nofollow" title="1.3">1.3</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.2.7" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.2.7" rel="nofollow" title="1.2.7">1.2.7</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.2.6" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.2.6" rel="nofollow" title="1.2.6">1.2.6</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.2.5" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.2.5" rel="nofollow" title="1.2.5">1.2.5</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.2.4" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.2.4" rel="nofollow" title="1.2.4">1.2.4</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.2.3" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.2.3" rel="nofollow" title="1.2.3">1.2.3</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.2.2" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.2.2" rel="nofollow" title="1.2.2">1.2.2</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.2.1" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.2.1" rel="nofollow" title="1.2.1">1.2.1</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.2" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.2" rel="nofollow" title="1.2">1.2</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.1.4" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.1.4" rel="nofollow" title="1.1.4">1.1.4</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.1.3" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.1.3" rel="nofollow" title="1.1.3">1.1.3</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.1.2" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.1.2" rel="nofollow" title="1.1.2">1.1.2</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.1.1" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.1.1" rel="nofollow" title="1.1.1">1.1.1</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.1" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.1" rel="nofollow" title="1.1">1.1</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.0.4" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.0.4" rel="nofollow" title="1.0.4">1.0.4</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.0.3" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.0.3" rel="nofollow" title="1.0.3">1.0.3</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.0.2" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.0.2" rel="nofollow" title="1.0.2">1.0.2</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.0.1" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.0.1" rel="nofollow" title="1.0.1">1.0.1</a> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <a href="/django/django/commit/1.0" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="1.0" rel="nofollow" title="1.0">1.0</a> </div> <!-- /.select-menu-item --> </div> <div class="select-menu-no-results">Nothing to show</div> </div> <!-- /.select-menu-list --> </div> <!-- /.select-menu-modal --> </div> <!-- /.select-menu-modal-holder --> </div> <!-- /.select-menu --> </div> <!-- /.scope --> <ul class="tabnav-tabs"> <li><a href="/django/django" class="tabnav-tab" highlight="repo_source">Files</a></li> <li><a href="/django/django/commits/" class="selected tabnav-tab" highlight="repo_commits">Commits</a></li> <li><a href="/django/django/branches" class="tabnav-tab" highlight="repo_branches" rel="nofollow">Branches <span class="counter ">37</span></a></li> </ul> </div> </div> </div><!-- /.repohead --> <div id="js-repo-pjax-container" class="container context-loader-container" data-pjax-container> <div class="commit full-commit "> <a href="/django/django/tree/d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e" class="browse-button" title="Browse the code at this point in the history" rel="nofollow">Browse code</a> <p class="commit-title"> Improved regex in strip_tags </p> <div class="commit-desc"><pre>Thanks Pablo Recio for the report. Refs #19237.</pre></div> <div class="commit-meta clearfix"> <span class="sha-block">commit <span class="sha js-selectable-text">d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e</span></span> <span class="sha-block" data-pjax> 1 parent <a href="/django/django/commit/afa3e1633431137f4e76c7efc359b579f4d9c08e" class="sha" data-hotkey="p">afa3e16</a> </span> <div class="authorship"> <img class="gravatar" height="24" src="https://secure.gravatar.com/avatar/cf4198670f0073174b475634964b576b?s=140&amp;d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png" width="24" /> <span class="author-name"><a href="/claudep" rel="author">claudep</a></span> authored <time class="js-relative-date" datetime="2013-02-06T12:20:43-08:00" title="2013-02-06 12:20:43">February 06, 2013</time> </div> </div> </div> <a name="diff-stat"></a> <div id='toc' class="details-collapse js-details-container "> <p class="explain"> <span class="mini-icon mini-icon-diff"></span>Showing <strong>2 changed files</strong> with <strong>2 additions</strong> and <strong>1 deletion</strong>. <a href="#" class="minibutton show-diff-stats js-details-target">Show Diff Stats</a> <a href="#" class="minibutton hide-diff-stats js-details-target">Hide Diff Stats</a></p> <ol class="content collapse js-transitionable"> <li> <span class="diffstat"> <a href="#diff-0" class="tooltipped leftwards" title="1 addition &amp; 1 deletion"> 2 <span class="diffstat-bar"> <i class='plus'>&#xf053;</i><i class='minus'>&#xf053;</i>&#xf053;&#xf053;&#xf053; </span> </a> </span> <span class='mini-icon mini-icon-modified' title='modified'></span> <a href="#diff-0">django/utils/html.py</a> </li> <li> <span class="diffstat"> <a href="#diff-1" class="tooltipped leftwards" title="1 addition &amp; 0 deletions"> 1 <span class="diffstat-bar"> <i class='plus'>&#xf053;</i>&#xf053;&#xf053;&#xf053;&#xf053; </span> </a> </span> <span class='mini-icon mini-icon-modified' title='modified'></span> <a href="#diff-1">tests/regressiontests/utils/html.py</a> </li> </ol> </div> <div id="files" class="diff-view commentable"> <div id="diff-0" class="file js-details-container"> <div class="meta" data-path="django/utils/html.py"> <div class="info"> <span class="diffstat tooltipped rightwards" title="1 addition &amp; 1 deletion">2 <span class="diffstat-bar"><i class='plus'>&#xf053;</i><i class='minus'>&#xf053;</i>&#xf053;&#xf053;&#xf053;</span></span> <span class="js-selectable-text css-truncate css-truncate-target" title="django/utils/html.py"> django/utils/html.py </span> </div> <div class="actions"> <span class="show-inline-notes"> <label> <input type="checkbox" checked="checked" class="js-show-inline-comments-toggle"> show inline notes </label> </span> <div class="button-group"> <a href="/django/django/blob/d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e/django/utils/html.py" class="minibutton" rel="nofollow">View file @ <code>d7504a3</code></a> </div> </div> </div> <div class="data highlight "> <table class="diff-table"> <tr id="django-utils-html-py-P0" data-position='0'> <td id="L0L32" class="line_numbers linkable-line-number"> <span class="line-number-content">...</span> </td> <td id="L0R32" class="line_numbers linkable-line-number"> <span class="line-number-content">...</span> </td> <td class="gc diff-line line"> <b class="add-bubble mini-icon mini-icon-add-comment" data-remote="/django/django/commit_comment/form?commit_id=d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e&amp;path=django/utils/html.py&amp;position=0&amp;line=32"></b> @@&nbsp;-33,7&nbsp;+33,7&nbsp;@@ </td> </tr> <tr id="django-utils-html-py-P1" data-position='1'> <td id="L0L33" class="line_numbers linkable-line-number"> <span class="line-number-content">33</span> </td> <td id="L0R33" class="line_numbers linkable-line-number"> <span class="line-number-content">33</span> </td> <td class=" diff-line line"> <b class="add-bubble mini-icon mini-icon-add-comment" data-remote="/django/django/commit_comment/form?commit_id=d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e&amp;path=django/utils/html.py&amp;position=1&amp;line=33"></b> &nbsp;html_gunk_re&nbsp;=&nbsp;re.compile(r&#39;(?:&lt;br&nbsp;clear=&quot;all&quot;&gt;|&lt;i&gt;&lt;\/i&gt;|&lt;b&gt;&lt;\/b&gt;|&lt;em&gt;&lt;\/em&gt;|&lt;strong&gt;&lt;\/strong&gt;|&lt;\/?smallcaps&gt;|&lt;\/?uppercase&gt;)&#39;,&nbsp;re.IGNORECASE) </td> </tr> <tr id="django-utils-html-py-P2" data-position='2'> <td id="L0L34" class="line_numbers linkable-line-number"> <span class="line-number-content">34</span> </td> <td id="L0R34" class="line_numbers linkable-line-number"> <span class="line-number-content">34</span> </td> <td class=" diff-line line"> <b class="add-bubble mini-icon mini-icon-add-comment" data-remote="/django/django/commit_comment/form?commit_id=d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e&amp;path=django/utils/html.py&amp;position=2&amp;line=34"></b> &nbsp;hard_coded_bullets_re&nbsp;=&nbsp;re.compile(r&#39;((?:&lt;p&gt;(?:%s).*?[a-zA-Z].*?&lt;/p&gt;\s*)+)&#39;&nbsp;%&nbsp;&#39;|&#39;.join([re.escape(x)&nbsp;for&nbsp;x&nbsp;in&nbsp;DOTS]),&nbsp;re.DOTALL) </td> </tr> <tr id="django-utils-html-py-P3" data-position='3'> <td id="L0L35" class="line_numbers linkable-line-number"> <span class="line-number-content">35</span> </td> <td id="L0R35" class="line_numbers linkable-line-number"> <span class="line-number-content">35</span> </td> <td class=" diff-line line"> <b class="add-bubble mini-icon mini-icon-add-comment" data-remote="/django/django/commit_comment/form?commit_id=d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e&amp;path=django/utils/html.py&amp;position=3&amp;line=35"></b> &nbsp;trailing_empty_content_re&nbsp;=&nbsp;re.compile(r&#39;(?:&lt;p&gt;(?:&amp;nbsp;|\s|&lt;br&nbsp;\/&gt;)*?&lt;/p&gt;\s*)+\Z&#39;) </td> </tr> <tr id="django-utils-html-py-P4" data-position='4'> <td id="L0L36" class="line_numbers linkable-line-number"> <span class="line-number-content">36</span> </td> <td id="L0R35" class="line_numbers linkable-line-number empty-cell"> <span class="line-number-content">&nbsp;</span> </td> <td class="gd diff-line line"> <b class="add-bubble mini-icon mini-icon-add-comment" data-remote="/django/django/commit_comment/form?commit_id=d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e&amp;path=django/utils/html.py&amp;position=4&amp;line=36"></b> -strip_tags_re&nbsp;=&nbsp;re.compile(r&#39;&lt;/?\S([^=<span class="x"></span>]*=(\s*&quot;[^&quot;]*&quot;|\s*\&#39;[^\&#39;]*\&#39;|\S*)|[^&gt;])*?&gt;&#39;,&nbsp;re.IGNORECASE) </td> </tr> <tr id="django-utils-html-py-P5" data-position='5'> <td id="L0L36" class="line_numbers linkable-line-number empty-cell"> <span class="line-number-content">&nbsp;</span> </td> <td id="L0R36" class="line_numbers linkable-line-number"> <span class="line-number-content">36</span> </td> <td class="gi diff-line line"> <b class="add-bubble mini-icon mini-icon-add-comment" data-remote="/django/django/commit_comment/form?commit_id=d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e&amp;path=django/utils/html.py&amp;position=5&amp;line=36"></b> +strip_tags_re&nbsp;=&nbsp;re.compile(r&#39;&lt;/?\S([^=<span class="x">&gt;</span>]*=(\s*&quot;[^&quot;]*&quot;|\s*\&#39;[^\&#39;]*\&#39;|\S*)|[^&gt;])*?&gt;&#39;,&nbsp;re.IGNORECASE) </td> </tr> <tr id="django-utils-html-py-P6" data-position='6'> <td id="L0L37" class="line_numbers linkable-line-number"> <span class="line-number-content">37</span> </td> <td id="L0R37" class="line_numbers linkable-line-number"> <span class="line-number-content">37</span> </td> <td class=" diff-line line"> <b class="add-bubble mini-icon mini-icon-add-comment" data-remote="/django/django/commit_comment/form?commit_id=d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e&amp;path=django/utils/html.py&amp;position=6&amp;line=37"></b> &nbsp; </td> </tr> <tr id="django-utils-html-py-P7" data-position='7'> <td id="L0L38" class="line_numbers linkable-line-number"> <span class="line-number-content">38</span> </td> <td id="L0R38" class="line_numbers linkable-line-number"> <span class="line-number-content">38</span> </td> <td class=" diff-line line"> <b class="add-bubble mini-icon mini-icon-add-comment" data-remote="/django/django/commit_comment/form?commit_id=d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e&amp;path=django/utils/html.py&amp;position=7&amp;line=38"></b> &nbsp; </td> </tr> <tr id="django-utils-html-py-P8" data-position='8'> <td id="L0L39" class="line_numbers linkable-line-number"> <span class="line-number-content">39</span> </td> <td id="L0R39" class="line_numbers linkable-line-number"> <span class="line-number-content">39</span> </td> <td class=" diff-line line"> <b class="add-bubble mini-icon mini-icon-add-comment" data-remote="/django/django/commit_comment/form?commit_id=d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e&amp;path=django/utils/html.py&amp;position=8&amp;line=39"></b> &nbsp;def&nbsp;escape(text): </td> </tr> </table> </div> <div class="file-comments-place-holder" data-path="django/utils/html.py"></div> </div> <div id="diff-1" class="file js-details-container"> <div class="meta" data-path="tests/regressiontests/utils/html.py"> <div class="info"> <span class="diffstat tooltipped rightwards" title="1 addition &amp; 0 deletions">1 <span class="diffstat-bar"><i class='plus'>&#xf053;</i>&#xf053;&#xf053;&#xf053;&#xf053;</span></span> <span class="js-selectable-text css-truncate css-truncate-target" title="tests/regressiontests/utils/html.py"> tests/regressiontests/utils/html.py </span> </div> <div class="actions"> <span class="show-inline-notes"> <label> <input type="checkbox" checked="checked" class="js-show-inline-comments-toggle"> show inline notes </label> </span> <div class="button-group"> <a href="/django/django/blob/d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e/tests/regressiontests/utils/html.py" class="minibutton" rel="nofollow">View file @ <code>d7504a3</code></a> </div> </div> </div> <div class="data highlight "> <table class="diff-table"> <tr id="tests-regressiontests-utils-html-py-P0" data-position='0'> <td id="L1L67" class="line_numbers linkable-line-number"> <span class="line-number-content">...</span> </td> <td id="L1R67" class="line_numbers linkable-line-number"> <span class="line-number-content">...</span> </td> <td class="gc diff-line line"> <b class="add-bubble mini-icon mini-icon-add-comment" data-remote="/django/django/commit_comment/form?commit_id=d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e&amp;path=tests/regressiontests/utils/html.py&amp;position=0&amp;line=67"></b> @@&nbsp;-68,6&nbsp;+68,7&nbsp;@@&nbsp;def&nbsp;test_strip_tags(self): </td> </tr> <tr id="tests-regressiontests-utils-html-py-P1" data-position='1'> <td id="L1L68" class="line_numbers linkable-line-number"> <span class="line-number-content">68</span> </td> <td id="L1R68" class="line_numbers linkable-line-number"> <span class="line-number-content">68</span> </td> <td class=" diff-line line"> <b class="add-bubble mini-icon mini-icon-add-comment" data-remote="/django/django/commit_comment/form?commit_id=d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e&amp;path=tests/regressiontests/utils/html.py&amp;position=1&amp;line=68"></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(&#39;a&lt;p&nbsp;onclick=&quot;alert(\&#39;&lt;test&gt;\&#39;)&quot;&gt;b&lt;/p&gt;c&#39;,&nbsp;&#39;abc&#39;), </td> </tr> <tr id="tests-regressiontests-utils-html-py-P2" data-position='2'> <td id="L1L69" class="line_numbers linkable-line-number"> <span class="line-number-content">69</span> </td> <td id="L1R69" class="line_numbers linkable-line-number"> <span class="line-number-content">69</span> </td> <td class=" diff-line line"> <b class="add-bubble mini-icon mini-icon-add-comment" data-remote="/django/django/commit_comment/form?commit_id=d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e&amp;path=tests/regressiontests/utils/html.py&amp;position=2&amp;line=69"></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(&#39;a&lt;p&nbsp;a&nbsp;&gt;b&lt;/p&gt;c&#39;,&nbsp;&#39;abc&#39;), </td> </tr> <tr id="tests-regressiontests-utils-html-py-P3" data-position='3'> <td id="L1L70" class="line_numbers linkable-line-number"> <span class="line-number-content">70</span> </td> <td id="L1R70" class="line_numbers linkable-line-number"> <span class="line-number-content">70</span> </td> <td class=" diff-line line"> <b class="add-bubble mini-icon mini-icon-add-comment" data-remote="/django/django/commit_comment/form?commit_id=d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e&amp;path=tests/regressiontests/utils/html.py&amp;position=3&amp;line=70"></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(&#39;d&lt;a:b&nbsp;c:d&gt;e&lt;/p&gt;f&#39;,&nbsp;&#39;def&#39;), </td> </tr> <tr id="tests-regressiontests-utils-html-py-P4" data-position='4'> <td id="L1L70" class="line_numbers linkable-line-number empty-cell"> <span class="line-number-content">&nbsp;</span> </td> <td id="L1R71" class="line_numbers linkable-line-number"> <span class="line-number-content">71</span> </td> <td class="gi diff-line line"> <b class="add-bubble mini-icon mini-icon-add-comment" data-remote="/django/django/commit_comment/form?commit_id=d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e&amp;path=tests/regressiontests/utils/html.py&amp;position=4&amp;line=71"></b> +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(&#39;&lt;strong&gt;foo&lt;/strong&gt;&lt;a&nbsp;href=&quot;http://example.com&quot;&gt;bar&lt;/a&gt;&#39;,&nbsp;&#39;foobar&#39;), </td> </tr> <tr id="tests-regressiontests-utils-html-py-P5" data-position='5'> <td id="L1L71" class="line_numbers linkable-line-number"> <span class="line-number-content">71</span> </td> <td id="L1R72" class="line_numbers linkable-line-number"> <span class="line-number-content">72</span> </td> <td class=" diff-line line"> <b class="add-bubble mini-icon mini-icon-add-comment" data-remote="/django/django/commit_comment/form?commit_id=d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e&amp;path=tests/regressiontests/utils/html.py&amp;position=5&amp;line=72"></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;) </td> </tr> <tr id="tests-regressiontests-utils-html-py-P6" data-position='6'> <td id="L1L72" class="line_numbers linkable-line-number"> <span class="line-number-content">72</span> </td> <td id="L1R73" class="line_numbers linkable-line-number"> <span class="line-number-content">73</span> </td> <td class=" diff-line line"> <b class="add-bubble mini-icon mini-icon-add-comment" data-remote="/django/django/commit_comment/form?commit_id=d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e&amp;path=tests/regressiontests/utils/html.py&amp;position=6&amp;line=73"></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;value,&nbsp;output&nbsp;in&nbsp;items: </td> </tr> <tr id="tests-regressiontests-utils-html-py-P7" data-position='7'> <td id="L1L73" class="line_numbers linkable-line-number"> <span class="line-number-content">73</span> </td> <td id="L1R74" class="line_numbers linkable-line-number"> <span class="line-number-content">74</span> </td> <td class=" diff-line line"> <b class="add-bubble mini-icon mini-icon-add-comment" data-remote="/django/django/commit_comment/form?commit_id=d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e&amp;path=tests/regressiontests/utils/html.py&amp;position=7&amp;line=74"></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.check_output(f,&nbsp;value,&nbsp;output) </td> </tr> </table> </div> <div class="file-comments-place-holder" data-path="tests/regressiontests/utils/html.py"></div> </div> </div> <div id="all_commit_comments"> <h2 class="commit-comments-header"> 0 notes on commit <code class="commit-comments-header-sha">d7504a3</code> <span class="commit-comments-toggle-line-notes-wrapper"><label><input id="js-inline-comments-toggle" class="commit-comments-toggle-line-notes" type="checkbox">Show line notes below</label></span> </h2> <div id="comments" class="only-commit-comments comment-holder commit-comments"> </div> <div class="discussion-bubble js-comment-container"> <img class="discussion-bubble-avatar" height="48" src="https://secure.gravatar.com/avatar/cf4198670f0073174b475634964b576b?s=140&amp;d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png" width="48" /> <form accept-charset="UTF-8" action="/django/django/commit_comment/create" method="post"><div style="margin:0;padding:0;display:inline"><input name="authenticity_token" type="hidden" value="Vbmuc30dLLFdm7POIe3xfTa4nODYc/la/wLrI1OLEOI=" /></div> <div class="discussion-bubble-content bubble"> <div class="discussion-bubble-inner"> <input type='hidden' name='commit_id' value='d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e'> <div class="js-previewable-comment-form previewable-comment-form write-selected" data-preview-url="/preview?repository=4164482"> <div class="comment-form-head tabnav"> <ul class="tabnav-tabs"> <li><a href="#write_bucket_525" class="tabnav-tab write-tab js-write-tab selected">Write</a></li> <li><a href="#preview_bucket_525" class="tabnav-tab preview-tab js-preview-tab">Preview</a></li> </ul> <span class="tabnav-right"> <span class="tabnav-widget text">Comments are parsed with <a href="http://github.github.com/github-flavored-markdown/" class="gfm-help" target="_blank">GitHub Flavored Markdown</a></span> </span> </div> <div class="comment-form-error js-comment-form-error" style="display:none;"></div> <div id="write_bucket_525" class="write-content js-write-bucket js-uploadable-container upload-enabled is-default" data-model="asset"> <a href="#fullscreen_comment_body_525" class="enable-fullscreen js-enable-fullscreen tooltipped leftwards " title="Zen Mode"> <span class="mini-icon mini-icon-fullscreen"></span> </a> <textarea name="comment[body]" tabindex="2" id="comment_body_525" placeholder="Leave a comment" class="js-comment-field js-size-to-fit input-with-fullscreen-icon" data-suggester="525_new_preview_suggester" required></textarea> <p class="drag-and-drop"> <span class="default"> Attach images by dragging &amp; dropping them or <input type="file" multiple="multiple" class="manual-file-chooser js-manual-file-chooser"> <a class="manual-file-chooser-text" href="#">choose an image</a> </span> <span class="loading"> <img alt="Octocat-spinner-32" height="16" src="https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-32.gif?1338945075" width="16" /> Uploading your images now… </span> <span class="error bad-file"> Unfortunately we don't support that file type yet. Try image files less than 5MB. </span> <span class="error bad-browser"> This browser doesn't support image attachments. </span> <span class="error failed-request"> Something went really wrong and we can't process that image. </span> </p> </div> <div id="preview_bucket_525" class="preview-content js-preview-bucket"> <div id="openstruct-163168300" class="js-comment comment"> <div class="comment-header normal-comment-header"> <img class="comment-header-gravatar" height="22" src="https://secure.gravatar.com/avatar/cf4198670f0073174b475634964b576b?s=140&amp;d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png" width="22" /> <a href="/claudep" class="comment-header-author">claudep</a> <span class='comment-header-action-text'> <a href="#openstruct-163168300"> commented </a> </span> <span class="comment-header-right"> <a href="#openstruct-163168300" class="comment-header-date"><time class="js-relative-date" datetime="2013-04-01T06:45:26-07:00" title="2013-04-01 06:45:26">April 01, 2013</time></a> </span> </div> <!-- /.comment-header --> <div class="comment-content"> <div class="edit-comment-hide"> <div class="js-comment-body comment-body markdown-body " data-body-version=""> <p>Nothing to preview</p> </div> </div> </div> <!-- /.comment-content --> </div> <!-- /.comment --> </div> <div class="suggester-container"> <div class="suggester js-navigation-container" id="525_new_preview_suggester" data-url="/django/django/suggestions/commit"> </div> </div> </div> </div> </div> <div class="form-actions"> <div class="tip"> <img alt="Commit_comment_tip" height="35" src="https://a248.e.akamai.net/assets.github.com/images/modules/commit/commit_comment_tip.gif?1347524281" width="95" /> <p><strong>Tip:</strong> You can also add notes to lines in a file. Hover to the left of a line to make a note</p> </div> <button type="submit" class="button primary" tabindex="2" data-disable-invalid data-disable-with>Comment on this commit</button> </div> </form> </div><!-- /.discussion-bubble --> </div> <div class="thread-subscription-status clearfix"> <span class="mega-icon mega-icon-notifications"></span> <div class="select-menu js-menu-container js-select-menu"> <form accept-charset="UTF-8" action="/notifications/thread" data-autosubmit="true" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="authenticity_token" type="hidden" value="Vbmuc30dLLFdm7POIe3xfTa4nODYc/la/wLrI1OLEOI=" /></div> <input id="repository_id" name="repository_id" type="hidden" value="4164482" /> <input id="thread_id" name="thread_id" type="hidden" value="d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e" /> <input id="thread_class" name="thread_class" type="hidden" value="c" /> <span class="minibutton select-menu-button js-menu-target"> <span class="js-select-button"> <span class="mini-icon mini-icon-watching"></span> Watch thread </span> </span> <div class="select-menu-modal-holder js-menu-content js-navigation-container"> <div class="select-menu-modal"> <div class="select-menu-header"> <span class="select-menu-title">Thread notifications</span> <span class="mini-icon mini-icon-remove-close js-menu-close"></span> </div> <!-- /.select-menu-header --> <div class="select-menu-list"> <div class="select-menu-item js-navigation-item js-navigation-target selected"> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <div class="select-menu-item-text"> <input checked="checked" id="id_unsubscribe" name="id" type="radio" value="unsubscribe" /> <h4>Not watching</h4> <span class="description">You only receive notifications for this thread if you participate or are @mentioned.</span> <span class="js-select-button-text hidden-select-button-text"> <span class="mini-icon mini-icon-watching"></span> Watch thread </span> </div> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <div class="select-menu-item-text"> <input checked="checked" id="id_subscribe" name="id" type="radio" value="subscribe" /> <h4>Watching</h4> <span class="description">Receive all notifications for this thread.</span> <span class="js-select-button-text hidden-select-button-text"> <span class="mini-icon mini-icon-unwatch"></span> Unwatch thread </span> </div> </div> <!-- /.select-menu-item --> <div class="select-menu-item js-navigation-item js-navigation-target "> <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span> <div class="select-menu-item-text"> <input checked="checked" id="id_mute" name="id" type="radio" value="mute" /> <h4>Ignoring</h4> <span class="description">You do not receive notifications for this thread.</span> <span class="js-select-button-text hidden-select-button-text"> <span class="mini-icon mini-icon-mute ignored"></span> Stop ignoring thread </span> </div> </div> <!-- /.select-menu-item --> </div> <!-- /.select-menu-list --> </div> <!-- /.select-menu-modal --> </div> <!-- /.select-menu-modal-holder --> </form> </div> <!-- /.select-menu --> <p class="reason">You only receive notifications for this thread when you participate or are @mentioned.</p> </div> <!-- COMMENTS --> <div id='diff-comment-data' style='display:none'> </div> </div> </div> <div class="context-overlay"></div> </div> <div id="footer-push"></div><!-- hack for sticky footer --> </div><!-- end of wrapper - hack for sticky footer --> <!-- footer --> <div id="footer"> <div class="container clearfix"> <dl class="footer_nav"> <dt>GitHub</dt> <dd><a href="https://github.com/about">About us</a></dd> <dd><a href="https://github.com/blog">Blog</a></dd> <dd><a href="https://github.com/contact">Contact &amp; support</a></dd> <dd><a href="http://enterprise.github.com/">GitHub Enterprise</a></dd> <dd><a href="http://status.github.com/">Site status</a></dd> </dl> <dl class="footer_nav"> <dt>Applications</dt> <dd><a href="http://mac.github.com/">GitHub for Mac</a></dd> <dd><a href="http://windows.github.com/">GitHub for Windows</a></dd> <dd><a href="http://eclipse.github.com/">GitHub for Eclipse</a></dd> <dd><a href="http://mobile.github.com/">GitHub mobile apps</a></dd> </dl> <dl class="footer_nav"> <dt>Services</dt> <dd><a href="http://get.gaug.es/">Gauges: Web analytics</a></dd> <dd><a href="http://speakerdeck.com">Speaker Deck: Presentations</a></dd> <dd><a href="https://gist.github.com">Gist: Code snippets</a></dd> <dd><a href="http://jobs.github.com/">Job board</a></dd> </dl> <dl class="footer_nav"> <dt>Documentation</dt> <dd><a href="http://help.github.com/">GitHub Help</a></dd> <dd><a href="http://developer.github.com/">Developer API</a></dd> <dd><a href="http://github.github.com/github-flavored-markdown/">GitHub Flavored Markdown</a></dd> <dd><a href="http://pages.github.com/">GitHub Pages</a></dd> </dl> <dl class="footer_nav"> <dt>More</dt> <dd><a href="http://training.github.com/">Training</a></dd> <dd><a href="https://github.com/edu">Students &amp; teachers</a></dd> <dd><a href="http://shop.github.com">The Shop</a></dd> <dd><a href="/plans">Plans &amp; pricing</a></dd> <dd><a href="http://octodex.github.com/">The Octodex</a></dd> </dl> <hr class="footer-divider"> <p class="right">&copy; 2013 <span title="0.09734s from fe2.rs.github.com">GitHub</span>, Inc. All rights reserved.</p> <a class="left" href="https://github.com/"> <span class="mega-icon mega-icon-invertocat"></span> </a> <ul id="legal"> <li><a href="https://github.com/site/terms">Terms of Service</a></li> <li><a href="https://github.com/site/privacy">Privacy</a></li> <li><a href="https://github.com/security">Security</a></li> </ul> </div><!-- /.container --> </div><!-- /.#footer --> <div class="fullscreen-overlay js-fullscreen-overlay" id="fullscreen_overlay"> <div class="fullscreen-container js-fullscreen-container"> <div class="textarea-wrap"> <textarea name="fullscreen-contents" id="fullscreen-contents" class="js-fullscreen-contents" placeholder="" data-suggester="fullscreen_suggester"></textarea> <div class="suggester-container"> <div class="suggester fullscreen-suggester js-navigation-container" id="fullscreen_suggester" data-url="/django/django/suggestions/commit"> </div> </div> </div> </div> <div class="fullscreen-sidebar"> <a href="#" class="exit-fullscreen js-exit-fullscreen tooltipped leftwards" title="Exit Zen Mode"> <span class="mega-icon mega-icon-normalscreen"></span> </a> <a href="#" class="theme-switcher js-theme-switcher tooltipped leftwards" title="Switch themes"> <span class="mini-icon mini-icon-brightness"></span> </a> </div> </div> <div id="ajax-error-message" class="flash flash-error"> <span class="mini-icon mini-icon-exclamation"></span> Something went wrong with that request. Please try again. <a href="#" class="mini-icon mini-icon-remove-close ajax-error-dismiss"></a> </div> <span id='server_response_time' data-time='0.09780' data-host='fe2'></span> </body> </html>
ABaldwinHunter/django-clone
tests/utils_tests/files/strip_tags1.html
HTML
bsd-3-clause
85,536
using System.Collections.Generic; using System.Linq; using System.Xml.Linq; using Orchard.DynamicForms.Services; using Orchard.Environment.Extensions; using Orchard.Events; namespace Orchard.DynamicForms.ImportExport { public interface IExportEventHandler : IEventHandler { void Exporting(dynamic context); void Exported(dynamic context); } [OrchardFeature("Orchard.DynamicForms.ImportExport")] public class FormsExportHandler : IExportEventHandler { private readonly IFormService _formService; public FormsExportHandler(IFormService formService) { _formService = formService; } public void Exporting(dynamic context) { } public void Exported(dynamic context) { if (!((IEnumerable<string>)context.ExportOptions.CustomSteps).Contains("Forms")) { return; } var submissions = _formService.GetSubmissions().ToArray(); if (!submissions.Any()) { return; } var forms = submissions.GroupBy(x => x.FormName); var root = new XElement("Forms"); context.Document.Element("Orchard").Add(root); foreach (var form in forms) { root.Add(new XElement("Form", new XAttribute("Name", form.Key), new XElement("Submissions", form.Select(submission => new XElement("Submission", new XAttribute("CreatedUtc", submission.CreatedUtc), new XCData(submission.FormData)))))); } } } }
KeithRaven/Orchard
src/Orchard.Web/Modules/Orchard.DynamicForms/ImportExport/FormsExportHandler.cs
C#
bsd-3-clause
1,660
<!DOCTYPE html> <html> <head> <title>CSS Backgrounds and Borders Test: background-size '100% 100%' with background-clip 'content-box'</title> <link rel="author" title="Intel" href="http://www.intel.com"> <link rel="reviewer" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/"> <!-- 2012-11-09 --> <link rel="help" href="http://www.w3.org/TR/css3-background/#the-background-size" title="3.9. Sizing Images: the 'background-size' property"> <link rel="help" href="http://www.w3.org/TR/css3-background/#the-background-clip"> <meta name="flags" content="image"> <meta name="assert" content="Check if 'background-size' is '100% 100%' that it rescales the background image independently in both dimensions to completely cover the background positioning area (it is 150px by 150px in this test), and then the background image is clipped to fit into the content area (it is 100px by 100px as background-clip is 'content-box')."> <style> #ref-overlapped-red { background-color: red; left: 30px; height: 100px; position: relative; top: 30px; width: 100px; } #test-overlapping-cat { background-clip: content-box; background-image: url(support/cat.png); /* 98px wide by 99px tall */ background-repeat: no-repeat; background-size: 100% 100%; border: transparent dotted 5px; bottom: 100px; height: 100px; padding: 25px; position: relative; width: 100px; /* Background positioning area is 150px wide by 150px tall, and background painting area is 100px wide by 100px tall. So, the image should be scaled to 150px by 150px, and then be clipped to 100px by 100px. */ } </style> </head> <body> <p>Test passes if there is a partially displayed cat and <strong>no red</strong>.</p> <div id="ref-overlapped-red"></div> <div id="test-overlapping-cat"></div> </body> </html>
yhe39/crosswalk-test-suite
webapi/tct-backgrounds-css3-tests/backgrounds/csswg/background-size-024-manual.html
HTML
bsd-3-clause
2,155
<?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace Zend\Mvc\Router\Http; use ArrayObject; use Traversable; use Zend\Mvc\Router\Exception; use Zend\Mvc\Router\PriorityList; use Zend\Mvc\Router\RoutePluginManager; use Zend\Stdlib\ArrayUtils; use Zend\Stdlib\RequestInterface as Request; /** * Part route. */ class Part extends TreeRouteStack implements RouteInterface { /** * RouteInterface to match. * * @var RouteInterface */ protected $route; /** * Whether the route may terminate. * * @var bool */ protected $mayTerminate; /** * Child routes. * * @var mixed */ protected $childRoutes; /** * Create a new part route. * * @param mixed $route * @param bool $mayTerminate * @param RoutePluginManager $routePlugins * @param array|null $childRoutes * @param ArrayObject|null $prototypes * @throws Exception\InvalidArgumentException */ public function __construct($route, $mayTerminate, RoutePluginManager $routePlugins, array $childRoutes = null, ArrayObject $prototypes = null) { $this->routePluginManager = $routePlugins; if (!$route instanceof RouteInterface) { $route = $this->routeFromArray($route); } if ($route instanceof self) { throw new Exception\InvalidArgumentException('Base route may not be a part route'); } $this->route = $route; $this->mayTerminate = $mayTerminate; $this->childRoutes = $childRoutes; $this->prototypes = $prototypes; $this->routes = new PriorityList(); } /** * factory(): defined by RouteInterface interface. * * @see \Zend\Mvc\Router\RouteInterface::factory() * @param mixed $options * @return Part * @throws Exception\InvalidArgumentException */ public static function factory($options = array()) { if ($options instanceof Traversable) { $options = ArrayUtils::iteratorToArray($options); } elseif (!is_array($options)) { throw new Exception\InvalidArgumentException(__METHOD__ . ' expects an array or Traversable set of options'); } if (!isset($options['route'])) { throw new Exception\InvalidArgumentException('Missing "route" in options array'); } if (!isset($options['route_plugins'])) { throw new Exception\InvalidArgumentException('Missing "route_plugins" in options array'); } if (!isset($options['prototypes'])) { $options['prototypes'] = null; } if (!isset($options['may_terminate'])) { $options['may_terminate'] = false; } if (!isset($options['child_routes']) || !$options['child_routes']) { $options['child_routes'] = null; } if ($options['child_routes'] instanceof Traversable) { $options['child_routes'] = ArrayUtils::iteratorToArray($options['child_routes']); } return new static( $options['route'], $options['may_terminate'], $options['route_plugins'], $options['child_routes'], $options['prototypes'] ); } /** * match(): defined by RouteInterface interface. * * @see \Zend\Mvc\Router\RouteInterface::match() * @param Request $request * @param integer|null $pathOffset * @param array $options * @return RouteMatch|null */ public function match(Request $request, $pathOffset = null, array $options = array()) { if ($pathOffset === null) { $pathOffset = 0; } $match = $this->route->match($request, $pathOffset, $options); if ($match !== null && method_exists($request, 'getUri')) { if ($this->childRoutes !== null) { $this->addRoutes($this->childRoutes); $this->childRoutes = null; } $nextOffset = $pathOffset + $match->getLength(); $uri = $request->getUri(); $pathLength = strlen($uri->getPath()); if ($this->mayTerminate && $nextOffset === $pathLength) { $query = $uri->getQuery(); if ('' == trim($query) || !$this->hasQueryChild()) { return $match; } } foreach ($this->routes as $name => $route) { if (($subMatch = $route->match($request, $nextOffset, $options)) instanceof RouteMatch) { if ($match->getLength() + $subMatch->getLength() + $pathOffset === $pathLength) { return $match->merge($subMatch)->setMatchedRouteName($name); } } } } return null; } /** * assemble(): Defined by RouteInterface interface. * * @see \Zend\Mvc\Router\RouteInterface::assemble() * @param array $params * @param array $options * @return mixed * @throws Exception\RuntimeException */ public function assemble(array $params = array(), array $options = array()) { if ($this->childRoutes !== null) { $this->addRoutes($this->childRoutes); $this->childRoutes = null; } $options['has_child'] = (isset($options['name'])); $path = $this->route->assemble($params, $options); $params = array_diff_key($params, array_flip($this->route->getAssembledParams())); if (!isset($options['name'])) { if (!$this->mayTerminate) { throw new Exception\RuntimeException('Part route may not terminate'); } else { return $path; } } unset($options['has_child']); $options['only_return_path'] = true; $path .= parent::assemble($params, $options); return $path; } /** * getAssembledParams(): defined by RouteInterface interface. * * @see RouteInterface::getAssembledParams * @return array */ public function getAssembledParams() { // Part routes may not occur as base route of other part routes, so we // don't have to return anything here. return array(); } /** * Is one of the child routes a query route? * * @return bool */ protected function hasQueryChild() { foreach ($this->routes as $route) { if ($route instanceof Query) { return true; } } return false; } }
thienit/fashion_zf2
vendor/ZF2/library/Zend/Mvc/Router/Http/Part.php
PHP
bsd-3-clause
6,978
<?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\Yaml\Tests; use Symfony\Component\Yaml\Inline; class InlineTest extends \PHPUnit_Framework_TestCase { public function testParse() { foreach ($this->getTestsForParse() as $yaml => $value) { $this->assertSame($value, Inline::parse($yaml), sprintf('::parse() converts an inline YAML to a PHP structure (%s)', $yaml)); } } public function testDump() { $testsForDump = $this->getTestsForDump(); foreach ($testsForDump as $yaml => $value) { $this->assertEquals($yaml, Inline::dump($value), sprintf('::dump() converts a PHP structure to an inline YAML (%s)', $yaml)); } foreach ($this->getTestsForParse() as $value) { $this->assertEquals($value, Inline::parse(Inline::dump($value)), 'check consistency'); } foreach ($testsForDump as $value) { $this->assertEquals($value, Inline::parse(Inline::dump($value)), 'check consistency'); } } public function testDumpNumericValueWithLocale() { $locale = setlocale(LC_NUMERIC, 0); if (false === $locale) { $this->markTestSkipped('Your platform does not support locales.'); } $required_locales = array('fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252'); if (false === setlocale(LC_ALL, $required_locales)) { $this->markTestSkipped('Could not set any of required locales: '.implode(", ", $required_locales)); } $this->assertEquals('1.2', Inline::dump(1.2)); $this->assertContains('fr', strtolower(setlocale(LC_NUMERIC, 0))); setlocale(LC_ALL, $locale); } public function testHashStringsResemblingExponentialNumericsShouldNotBeChangedToINF() { $value = '686e444'; $this->assertSame($value, Inline::parse(Inline::dump($value))); } /** * @expectedException \Symfony\Component\Yaml\Exception\ParseException */ public function testParseScalarWithIncorrectlyQuotedStringShouldThrowException() { $value = "'don't do somthin' like that'"; Inline::parse($value); } /** * @expectedException \Symfony\Component\Yaml\Exception\ParseException */ public function testParseScalarWithIncorrectlyDoubleQuotedStringShouldThrowException() { $value = '"don"t do somthin" like that"'; Inline::parse($value); } /** * @expectedException \Symfony\Component\Yaml\Exception\ParseException */ public function testParseInvalidMappingKeyShouldThrowException() { $value = '{ "foo " bar": "bar" }'; Inline::parse($value); } /** * @expectedException \Symfony\Component\Yaml\Exception\ParseException */ public function testParseInvalidMappingShouldThrowException() { Inline::parse('[foo] bar'); } /** * @expectedException \Symfony\Component\Yaml\Exception\ParseException */ public function testParseInvalidSequenceShouldThrowException() { Inline::parse('{ foo: bar } bar'); } public function testParseScalarWithCorrectlyQuotedStringShouldReturnString() { $value = "'don''t do somthin'' like that'"; $expect = "don't do somthin' like that"; $this->assertSame($expect, Inline::parseScalar($value)); } protected function getTestsForParse() { return array( '' => '', 'null' => null, 'false' => false, 'true' => true, '12' => 12, '-12' => -12, '"quoted string"' => 'quoted string', "'quoted string'" => 'quoted string', '12.30e+02' => 12.30e+02, '0x4D2' => 0x4D2, '02333' => 02333, '.Inf' => -log(0), '-.Inf' => log(0), "'686e444'" => '686e444', '686e444' => 646e444, '123456789123456789123456789123456789' => '123456789123456789123456789123456789', '"foo\r\nbar"' => "foo\r\nbar", "'foo#bar'" => 'foo#bar', "'foo # bar'" => 'foo # bar', "'#cfcfcf'" => '#cfcfcf', '::form_base.html.twig' => '::form_base.html.twig', '2007-10-30' => mktime(0, 0, 0, 10, 30, 2007), '2007-10-30T02:59:43Z' => gmmktime(2, 59, 43, 10, 30, 2007), '2007-10-30 02:59:43 Z' => gmmktime(2, 59, 43, 10, 30, 2007), '1960-10-30 02:59:43 Z' => gmmktime(2, 59, 43, 10, 30, 1960), '1730-10-30T02:59:43Z' => gmmktime(2, 59, 43, 10, 30, 1730), '"a \\"string\\" with \'quoted strings inside\'"' => 'a "string" with \'quoted strings inside\'', "'a \"string\" with ''quoted strings inside'''" => 'a "string" with \'quoted strings inside\'', // sequences // urls are no key value mapping. see #3609. Valid yaml "key: value" mappings require a space after the colon '[foo, http://urls.are/no/mappings, false, null, 12]' => array('foo', 'http://urls.are/no/mappings', false, null, 12), '[ foo , bar , false , null , 12 ]' => array('foo', 'bar', false, null, 12), '[\'foo,bar\', \'foo bar\']' => array('foo,bar', 'foo bar'), // mappings '{foo:bar,bar:foo,false:false,null:null,integer:12}' => array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12), '{ foo : bar, bar : foo, false : false, null : null, integer : 12 }' => array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12), '{foo: \'bar\', bar: \'foo: bar\'}' => array('foo' => 'bar', 'bar' => 'foo: bar'), '{\'foo\': \'bar\', "bar": \'foo: bar\'}' => array('foo' => 'bar', 'bar' => 'foo: bar'), '{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}' => array('foo\'' => 'bar', "bar\"" => 'foo: bar'), '{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}' => array('foo: ' => 'bar', "bar: " => 'foo: bar'), // nested sequences and mappings '[foo, [bar, foo]]' => array('foo', array('bar', 'foo')), '[foo, {bar: foo}]' => array('foo', array('bar' => 'foo')), '{ foo: {bar: foo} }' => array('foo' => array('bar' => 'foo')), '{ foo: [bar, foo] }' => array('foo' => array('bar', 'foo')), '[ foo, [ bar, foo ] ]' => array('foo', array('bar', 'foo')), '[{ foo: {bar: foo} }]' => array(array('foo' => array('bar' => 'foo'))), '[foo, [bar, [foo, [bar, foo]], foo]]' => array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo')), '[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]' => array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo'))), '[foo, bar: { foo: bar }]' => array('foo', '1' => array('bar' => array('foo' => 'bar'))), '[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']' => array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%',), true, '@service_container',), ); } protected function getTestsForDump() { return array( 'null' => null, 'false' => false, 'true' => true, '12' => 12, "'quoted string'" => 'quoted string', '12.30e+02' => 12.30e+02, '1234' => 0x4D2, '1243' => 02333, '.Inf' => -log(0), '-.Inf' => log(0), "'686e444'" => '686e444', '"foo\r\nbar"' => "foo\r\nbar", "'foo#bar'" => 'foo#bar', "'foo # bar'" => 'foo # bar', "'#cfcfcf'" => '#cfcfcf', "'a \"string\" with ''quoted strings inside'''" => 'a "string" with \'quoted strings inside\'', "'-dash'" => '-dash', "'-'" => '-', // sequences '[foo, bar, false, null, 12]' => array('foo', 'bar', false, null, 12), '[\'foo,bar\', \'foo bar\']' => array('foo,bar', 'foo bar'), // mappings '{ foo: bar, bar: foo, \'false\': false, \'null\': null, integer: 12 }' => array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12), '{ foo: bar, bar: \'foo: bar\' }' => array('foo' => 'bar', 'bar' => 'foo: bar'), // nested sequences and mappings '[foo, [bar, foo]]' => array('foo', array('bar', 'foo')), '[foo, [bar, [foo, [bar, foo]], foo]]' => array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo')), '{ foo: { bar: foo } }' => array('foo' => array('bar' => 'foo')), '[foo, { bar: foo }]' => array('foo', array('bar' => 'foo')), '[foo, { bar: foo, foo: [foo, { bar: foo }] }, [foo, { bar: foo }]]' => array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo'))), '[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']' => array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%',), true, '@service_container',), ); } }
cezar08/blog
vendor/symfony/yaml/Symfony/Component/Yaml/Tests/InlineTest.php
PHP
bsd-3-clause
9,563
/** * @license * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ var bower = require('bower'); var path = require('path'); process.chdir(path.dirname(__dirname)); console.log('Fetching bower dependencies for the WCT client to', path.join(process.cwd(), 'bower_components')); bower.commands.install(null, [], {}, {}) .on('end', function(installed) { console.log('Fetched bower packages:', Object.keys(installed).join(', ')); }) .on('error', function(error) { console.log('Failed to fetch bower dependencies:', error.stack); console.log(''); console.log('WCT install will continue, but you may need to manually provide browser dependencies (mocha, chai, etc)'); });
tessalt/ec-polymer-demo
node_modules/web-component-tester/scripts/postinstall.js
JavaScript
bsd-3-clause
1,176
// Copyright 2015 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.chrome.browser.signin; import android.app.Fragment; import android.content.Context; import android.content.Intent; import org.chromium.chrome.R; import org.chromium.chrome.browser.notifications.GoogleServicesNotificationController; import org.chromium.chrome.browser.notifications.NotificationConstants; import org.chromium.chrome.browser.preferences.PreferencesLauncher; import org.chromium.sync.signin.ChromeSigninController; /** * {@link SigninNotificationController} provides functionality for displaying Android notifications * regarding the user sign-in status. */ public class SigninNotificationController implements ChromeSigninController.Listener { private final Context mApplicationContext; private final GoogleServicesNotificationController mNotificationController; private final Class<? extends Fragment> mAccountManagementFragment; public SigninNotificationController(Context context, GoogleServicesNotificationController controller, Class<? extends Fragment> accountManagementFragment) { mApplicationContext = context.getApplicationContext(); mNotificationController = controller; mAccountManagementFragment = accountManagementFragment; } /** * Alerts the user through the notification bar that they have been signed in to Chrome. * Clicking on the notification should immediately go to the sync account page. */ public void showSyncSignInNotification() { // Create an Intent to go to the sync page. Intent prefIntent = PreferencesLauncher.createIntentForSettingsPage( mApplicationContext, mAccountManagementFragment.getCanonicalName()); // Create the notification. String title = mApplicationContext.getResources().getString(R.string.firstrun_signed_in_title); String syncPromo = title + " " + mApplicationContext.getResources().getString( R.string.firstrun_signed_in_description); mNotificationController.showNotification( NotificationConstants.NOTIFICATION_ID_SIGNED_IN, title, syncPromo, prefIntent); } /** * Callback for {@link ChromeSigninController.Listener}. */ @Override public void onClearSignedInUser() { mNotificationController.cancelNotification(NotificationConstants.NOTIFICATION_ID_SIGNED_IN); } }
CapOM/ChromiumGStreamerBackend
chrome/android/java/src/org/chromium/chrome/browser/signin/SigninNotificationController.java
Java
bsd-3-clause
2,591
""" Slovak districts according to http://sk.wikipedia.org/wiki/Administrat%C3%ADvne_%C4%8Dlenenie_Slovenska """ from django.utils.translation import ugettext_lazy as _ DISTRICT_CHOICES = ( ('BB', _('Banska Bystrica')), ('BS', _('Banska Stiavnica')), ('BJ', _('Bardejov')), ('BN', _('Banovce nad Bebravou')), ('BR', _('Brezno')), ('BA1', _('Bratislava I')), ('BA2', _('Bratislava II')), ('BA3', _('Bratislava III')), ('BA4', _('Bratislava IV')), ('BA5', _('Bratislava V')), ('BY', _('Bytca')), ('CA', _('Cadca')), ('DT', _('Detva')), ('DK', _('Dolny Kubin')), ('DS', _('Dunajska Streda')), ('GA', _('Galanta')), ('GL', _('Gelnica')), ('HC', _('Hlohovec')), ('HE', _('Humenne')), ('IL', _('Ilava')), ('KK', _('Kezmarok')), ('KN', _('Komarno')), ('KE1', _('Kosice I')), ('KE2', _('Kosice II')), ('KE3', _('Kosice III')), ('KE4', _('Kosice IV')), ('KEO', _('Kosice - okolie')), ('KA', _('Krupina')), ('KM', _('Kysucke Nove Mesto')), ('LV', _('Levice')), ('LE', _('Levoca')), ('LM', _('Liptovsky Mikulas')), ('LC', _('Lucenec')), ('MA', _('Malacky')), ('MT', _('Martin')), ('ML', _('Medzilaborce')), ('MI', _('Michalovce')), ('MY', _('Myjava')), ('NO', _('Namestovo')), ('NR', _('Nitra')), ('NM', _('Nove Mesto nad Vahom')), ('NZ', _('Nove Zamky')), ('PE', _('Partizanske')), ('PK', _('Pezinok')), ('PN', _('Piestany')), ('PT', _('Poltar')), ('PP', _('Poprad')), ('PB', _('Povazska Bystrica')), ('PO', _('Presov')), ('PD', _('Prievidza')), ('PU', _('Puchov')), ('RA', _('Revuca')), ('RS', _('Rimavska Sobota')), ('RV', _('Roznava')), ('RK', _('Ruzomberok')), ('SB', _('Sabinov')), ('SC', _('Senec')), ('SE', _('Senica')), ('SI', _('Skalica')), ('SV', _('Snina')), ('SO', _('Sobrance')), ('SN', _('Spisska Nova Ves')), ('SL', _('Stara Lubovna')), ('SP', _('Stropkov')), ('SK', _('Svidnik')), ('SA', _('Sala')), ('TO', _('Topolcany')), ('TV', _('Trebisov')), ('TN', _('Trencin')), ('TT', _('Trnava')), ('TR', _('Turcianske Teplice')), ('TS', _('Tvrdosin')), ('VK', _('Velky Krtis')), ('VT', _('Vranov nad Toplou')), ('ZM', _('Zlate Moravce')), ('ZV', _('Zvolen')), ('ZC', _('Zarnovica')), ('ZH', _('Ziar nad Hronom')), ('ZA', _('Zilina')), )
tigersirvine/occtigerscricket
django/contrib/localflavor/sk/sk_districts.py
Python
bsd-3-clause
2,453
# Module 'ntpath' -- common operations on WinNT/Win95 pathnames """Common pathname manipulations, WindowsNT/95 version. Instead of importing this module directly, import os and refer to this module as os.path. """ import os import stat import sys __all__ = ["normcase","isabs","join","splitdrive","split","splitext", "basename","dirname","commonprefix","getsize","getmtime", "getatime","getctime", "islink","exists","lexists","isdir","isfile", "ismount","walk","expanduser","expandvars","normpath","abspath", "splitunc","curdir","pardir","sep","pathsep","defpath","altsep", "extsep","devnull","realpath","supports_unicode_filenames"] # strings representing various path-related bits and pieces curdir = '.' pardir = '..' extsep = '.' sep = '\\' pathsep = ';' altsep = '/' defpath = '.;C:\\bin' if 'ce' in sys.builtin_module_names: defpath = '\\Windows' elif 'os2' in sys.builtin_module_names: # OS/2 w/ VACPP altsep = '/' devnull = 'nul' # Normalize the case of a pathname and map slashes to backslashes. # Other normalizations (such as optimizing '../' away) are not done # (this is done by normpath). def normcase(s): """Normalize case of pathname. Makes all characters lowercase and all slashes into backslashes.""" return s.replace("/", "\\").lower() # Return whether a path is absolute. # Trivial in Posix, harder on the Mac or MS-DOS. # For DOS it is absolute if it starts with a slash or backslash (current # volume), or if a pathname after the volume letter and colon / UNC resource # starts with a slash or backslash. def isabs(s): """Test whether a path is absolute""" s = splitdrive(s)[1] return s != '' and s[:1] in '/\\' # Join two (or more) paths. def join(a, *p): """Join two or more pathname components, inserting "\\" as needed""" path = a for b in p: b_wins = 0 # set to 1 iff b makes path irrelevant if path == "": b_wins = 1 elif isabs(b): # This probably wipes out path so far. However, it's more # complicated if path begins with a drive letter: # 1. join('c:', '/a') == 'c:/a' # 2. join('c:/', '/a') == 'c:/a' # But # 3. join('c:/a', '/b') == '/b' # 4. join('c:', 'd:/') = 'd:/' # 5. join('c:/', 'd:/') = 'd:/' if path[1:2] != ":" or b[1:2] == ":": # Path doesn't start with a drive letter, or cases 4 and 5. b_wins = 1 # Else path has a drive letter, and b doesn't but is absolute. elif len(path) > 3 or (len(path) == 3 and path[-1] not in "/\\"): # case 3 b_wins = 1 if b_wins: path = b else: # Join, and ensure there's a separator. assert len(path) > 0 if path[-1] in "/\\": if b and b[0] in "/\\": path += b[1:] else: path += b elif path[-1] == ":": path += b elif b: if b[0] in "/\\": path += b else: path += "\\" + b else: # path is not empty and does not end with a backslash, # but b is empty; since, e.g., split('a/') produces # ('a', ''), it's best if join() adds a backslash in # this case. path += '\\' return path # Split a path in a drive specification (a drive letter followed by a # colon) and the path specification. # It is always true that drivespec + pathspec == p def splitdrive(p): """Split a pathname into drive and path specifiers. Returns a 2-tuple "(drive,path)"; either part may be empty""" if p[1:2] == ':': return p[0:2], p[2:] return '', p # Parse UNC paths def splitunc(p): """Split a pathname into UNC mount point and relative path specifiers. Return a 2-tuple (unc, rest); either part may be empty. If unc is not empty, it has the form '//host/mount' (or similar using backslashes). unc+rest is always the input path. Paths containing drive letters never have an UNC part. """ if p[1:2] == ':': return '', p # Drive letter present firstTwo = p[0:2] if firstTwo == '//' or firstTwo == '\\\\': # is a UNC path: # vvvvvvvvvvvvvvvvvvvv equivalent to drive letter # \\machine\mountpoint\directories... # directory ^^^^^^^^^^^^^^^ normp = normcase(p) index = normp.find('\\', 2) if index == -1: ##raise RuntimeError, 'illegal UNC path: "' + p + '"' return ("", p) index = normp.find('\\', index + 1) if index == -1: index = len(p) return p[:index], p[index:] return '', p # Split a path in head (everything up to the last '/') and tail (the # rest). After the trailing '/' is stripped, the invariant # join(head, tail) == p holds. # The resulting head won't end in '/' unless it is the root. def split(p): """Split a pathname. Return tuple (head, tail) where tail is everything after the final slash. Either part may be empty.""" d, p = splitdrive(p) # set i to index beyond p's last slash i = len(p) while i and p[i-1] not in '/\\': i = i - 1 head, tail = p[:i], p[i:] # now tail has no slashes # remove trailing slashes from head, unless it's all slashes head2 = head while head2 and head2[-1] in '/\\': head2 = head2[:-1] head = head2 or head return d + head, tail # Split a path in root and extension. # The extension is everything starting at the last dot in the last # pathname component; the root is everything before that. # It is always true that root + ext == p. def splitext(p): """Split the extension from a pathname. Extension is everything from the last dot to the end. Return (root, ext), either part may be empty.""" i = p.rfind('.') if i<=max(p.rfind('/'), p.rfind('\\')): return p, '' else: return p[:i], p[i:] # Return the tail (basename) part of a path. def basename(p): """Returns the final component of a pathname""" return split(p)[1] # Return the head (dirname) part of a path. def dirname(p): """Returns the directory component of a pathname""" return split(p)[0] # Return the longest prefix of all list elements. def commonprefix(m): "Given a list of pathnames, returns the longest common leading component" if not m: return '' s1 = min(m) s2 = max(m) n = min(len(s1), len(s2)) for i in xrange(n): if s1[i] != s2[i]: return s1[:i] return s1[:n] # Get size, mtime, atime of files. def getsize(filename): """Return the size of a file, reported by os.stat()""" return os.stat(filename).st_size def getmtime(filename): """Return the last modification time of a file, reported by os.stat()""" return os.stat(filename).st_mtime def getatime(filename): """Return the last access time of a file, reported by os.stat()""" return os.stat(filename).st_atime def getctime(filename): """Return the creation time of a file, reported by os.stat().""" return os.stat(filename).st_ctime # Is a path a symbolic link? # This will always return false on systems where posix.lstat doesn't exist. def islink(path): """Test for symbolic link. On WindowsNT/95 always returns false""" return False # Does a path exist? def exists(path): """Test whether a path exists""" try: st = os.stat(path) except os.error: return False return True lexists = exists # Is a path a dos directory? # This follows symbolic links, so both islink() and isdir() can be true # for the same path. def isdir(path): """Test whether a path is a directory""" try: st = os.stat(path) except os.error: return False return stat.S_ISDIR(st.st_mode) # Is a path a regular file? # This follows symbolic links, so both islink() and isdir() can be true # for the same path. def isfile(path): """Test whether a path is a regular file""" try: st = os.stat(path) except os.error: return False return stat.S_ISREG(st.st_mode) # Is a path a mount point? Either a root (with or without drive letter) # or an UNC path with at most a / or \ after the mount point. def ismount(path): """Test whether a path is a mount point (defined as root of drive)""" unc, rest = splitunc(path) if unc: return rest in ("", "/", "\\") p = splitdrive(path)[1] return len(p) == 1 and p[0] in '/\\' # Directory tree walk. # For each directory under top (including top itself, but excluding # '.' and '..'), func(arg, dirname, filenames) is called, where # dirname is the name of the directory and filenames is the list # of files (and subdirectories etc.) in the directory. # The func may modify the filenames list, to implement a filter, # or to impose a different order of visiting. def walk(top, func, arg): """Directory tree walk with callback function. For each directory in the directory tree rooted at top (including top itself, but excluding '.' and '..'), call func(arg, dirname, fnames). dirname is the name of the directory, and fnames a list of the names of the files and subdirectories in dirname (excluding '.' and '..'). func may modify the fnames list in-place (e.g. via del or slice assignment), and walk will only recurse into the subdirectories whose names remain in fnames; this can be used to implement a filter, or to impose a specific order of visiting. No semantics are defined for, or required of, arg, beyond that arg is always passed to func. It can be used, e.g., to pass a filename pattern, or a mutable object designed to accumulate statistics. Passing None for arg is common.""" try: names = os.listdir(top) except os.error: return func(arg, top, names) exceptions = ('.', '..') for name in names: if name not in exceptions: name = join(top, name) if isdir(name): walk(name, func, arg) # Expand paths beginning with '~' or '~user'. # '~' means $HOME; '~user' means that user's home directory. # If the path doesn't begin with '~', or if the user or $HOME is unknown, # the path is returned unchanged (leaving error reporting to whatever # function is called with the expanded path as argument). # See also module 'glob' for expansion of *, ? and [...] in pathnames. # (A function should also be defined to do full *sh-style environment # variable expansion.) def expanduser(path): """Expand ~ and ~user constructs. If user or $HOME is unknown, do nothing.""" if path[:1] != '~': return path i, n = 1, len(path) while i < n and path[i] not in '/\\': i = i + 1 if i == 1: if 'HOME' in os.environ: userhome = os.environ['HOME'] elif not 'HOMEPATH' in os.environ: return path else: try: drive = os.environ['HOMEDRIVE'] except KeyError: drive = '' userhome = join(drive, os.environ['HOMEPATH']) else: return path return userhome + path[i:] # Expand paths containing shell variable substitutions. # The following rules apply: # - no expansion within single quotes # - no escape character, except for '$$' which is translated into '$' # - ${varname} is accepted. # - varnames can be made out of letters, digits and the character '_' # XXX With COMMAND.COM you can use any characters in a variable name, # XXX except '^|<>='. def expandvars(path): """Expand shell variables of form $var and ${var}. Unknown variables are left unchanged.""" if '$' not in path: return path import string varchars = string.ascii_letters + string.digits + '_-' res = '' index = 0 pathlen = len(path) while index < pathlen: c = path[index] if c == '\'': # no expansion within single quotes path = path[index + 1:] pathlen = len(path) try: index = path.index('\'') res = res + '\'' + path[:index + 1] except ValueError: res = res + path index = pathlen - 1 elif c == '$': # variable or '$$' if path[index + 1:index + 2] == '$': res = res + c index = index + 1 elif path[index + 1:index + 2] == '{': path = path[index+2:] pathlen = len(path) try: index = path.index('}') var = path[:index] if var in os.environ: res = res + os.environ[var] except ValueError: res = res + path index = pathlen - 1 else: var = '' index = index + 1 c = path[index:index + 1] while c != '' and c in varchars: var = var + c index = index + 1 c = path[index:index + 1] if var in os.environ: res = res + os.environ[var] if c != '': res = res + c else: res = res + c index = index + 1 return res # Normalize a path, e.g. A//B, A/./B and A/foo/../B all become A\B. # Previously, this function also truncated pathnames to 8+3 format, # but as this module is called "ntpath", that's obviously wrong! def normpath(path): """Normalize path, eliminating double slashes, etc.""" path = path.replace("/", "\\") prefix, path = splitdrive(path) # We need to be careful here. If the prefix is empty, and the path starts # with a backslash, it could either be an absolute path on the current # drive (\dir1\dir2\file) or a UNC filename (\\server\mount\dir1\file). It # is therefore imperative NOT to collapse multiple backslashes blindly in # that case. # The code below preserves multiple backslashes when there is no drive # letter. This means that the invalid filename \\\a\b is preserved # unchanged, where a\\\b is normalised to a\b. It's not clear that there # is any better behaviour for such edge cases. if prefix == '': # No drive letter - preserve initial backslashes while path[:1] == "\\": prefix = prefix + "\\" path = path[1:] else: # We have a drive letter - collapse initial backslashes if path.startswith("\\"): prefix = prefix + "\\" path = path.lstrip("\\") comps = path.split("\\") i = 0 while i < len(comps): if comps[i] in ('.', ''): del comps[i] elif comps[i] == '..': if i > 0 and comps[i-1] != '..': del comps[i-1:i+1] i -= 1 elif i == 0 and prefix.endswith("\\"): del comps[i] else: i += 1 else: i += 1 # If the path is now empty, substitute '.' if not prefix and not comps: comps.append('.') return prefix + "\\".join(comps) # Return an absolute path. try: from nt import _getfullpathname except ImportError: # not running on Windows - mock up something sensible def abspath(path): """Return the absolute version of a path.""" if not isabs(path): path = join(os.getcwd(), path) return normpath(path) else: # use native Windows method on Windows def abspath(path): """Return the absolute version of a path.""" if path: # Empty path must return current working directory. try: path = _getfullpathname(path) except WindowsError: pass # Bad path - return unchanged. else: path = os.getcwd() return normpath(path) # realpath is a no-op on systems without islink support realpath = abspath # Win9x family and earlier have no Unicode filename support. supports_unicode_filenames = (hasattr(sys, "getwindowsversion") and sys.getwindowsversion()[3] >= 2)
sitsbeyou/Django-facebook
docs/docs_env/Lib/ntpath.py
Python
bsd-3-clause
16,576
/* * Copyright 2012 The Android Open Source Project * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include <emmintrin.h> #include "SkBitmapProcState_opts_SSE2.h" #include "SkBlitRow_opts_SSE2.h" #include "SkColorPriv.h" #include "SkColor_opts_SSE2.h" #include "SkDither.h" #include "SkUtils.h" /* SSE2 version of S32_Blend_BlitRow32() * portable version is in core/SkBlitRow_D32.cpp */ void S32_Blend_BlitRow32_SSE2(SkPMColor* SK_RESTRICT dst, const SkPMColor* SK_RESTRICT src, int count, U8CPU alpha) { SkASSERT(alpha <= 255); if (count <= 0) { return; } uint32_t src_scale = SkAlpha255To256(alpha); uint32_t dst_scale = 256 - src_scale; if (count >= 4) { SkASSERT(((size_t)dst & 0x03) == 0); while (((size_t)dst & 0x0F) != 0) { *dst = SkAlphaMulQ(*src, src_scale) + SkAlphaMulQ(*dst, dst_scale); src++; dst++; count--; } const __m128i *s = reinterpret_cast<const __m128i*>(src); __m128i *d = reinterpret_cast<__m128i*>(dst); while (count >= 4) { // Load 4 pixels each of src and dest. __m128i src_pixel = _mm_loadu_si128(s); __m128i dst_pixel = _mm_load_si128(d); src_pixel = SkAlphaMulQ_SSE2(src_pixel, src_scale); dst_pixel = SkAlphaMulQ_SSE2(dst_pixel, dst_scale); // Add result __m128i result = _mm_add_epi8(src_pixel, dst_pixel); _mm_store_si128(d, result); s++; d++; count -= 4; } src = reinterpret_cast<const SkPMColor*>(s); dst = reinterpret_cast<SkPMColor*>(d); } while (count > 0) { *dst = SkAlphaMulQ(*src, src_scale) + SkAlphaMulQ(*dst, dst_scale); src++; dst++; count--; } } void S32A_Opaque_BlitRow32_SSE2(SkPMColor* SK_RESTRICT dst, const SkPMColor* SK_RESTRICT src, int count, U8CPU alpha) { SkASSERT(alpha == 255); if (count <= 0) { return; } #ifdef SK_USE_ACCURATE_BLENDING if (count >= 4) { SkASSERT(((size_t)dst & 0x03) == 0); while (((size_t)dst & 0x0F) != 0) { *dst = SkPMSrcOver(*src, *dst); src++; dst++; count--; } const __m128i *s = reinterpret_cast<const __m128i*>(src); __m128i *d = reinterpret_cast<__m128i*>(dst); __m128i rb_mask = _mm_set1_epi32(0x00FF00FF); __m128i c_128 = _mm_set1_epi16(128); // 8 copies of 128 (16-bit) __m128i c_255 = _mm_set1_epi16(255); // 8 copies of 255 (16-bit) while (count >= 4) { // Load 4 pixels __m128i src_pixel = _mm_loadu_si128(s); __m128i dst_pixel = _mm_load_si128(d); __m128i dst_rb = _mm_and_si128(rb_mask, dst_pixel); __m128i dst_ag = _mm_srli_epi16(dst_pixel, 8); // Shift alphas down to lower 8 bits of each quad. __m128i alpha = _mm_srli_epi32(src_pixel, 24); // Copy alpha to upper 3rd byte of each quad alpha = _mm_or_si128(alpha, _mm_slli_epi32(alpha, 16)); // Subtract alphas from 255, to get 0..255 alpha = _mm_sub_epi16(c_255, alpha); // Multiply by red and blue by src alpha. dst_rb = _mm_mullo_epi16(dst_rb, alpha); // Multiply by alpha and green by src alpha. dst_ag = _mm_mullo_epi16(dst_ag, alpha); // dst_rb_low = (dst_rb >> 8) __m128i dst_rb_low = _mm_srli_epi16(dst_rb, 8); __m128i dst_ag_low = _mm_srli_epi16(dst_ag, 8); // dst_rb = (dst_rb + dst_rb_low + 128) >> 8 dst_rb = _mm_add_epi16(dst_rb, dst_rb_low); dst_rb = _mm_add_epi16(dst_rb, c_128); dst_rb = _mm_srli_epi16(dst_rb, 8); // dst_ag = (dst_ag + dst_ag_low + 128) & ag_mask dst_ag = _mm_add_epi16(dst_ag, dst_ag_low); dst_ag = _mm_add_epi16(dst_ag, c_128); dst_ag = _mm_andnot_si128(rb_mask, dst_ag); // Combine back into RGBA. dst_pixel = _mm_or_si128(dst_rb, dst_ag); // Add result __m128i result = _mm_add_epi8(src_pixel, dst_pixel); _mm_store_si128(d, result); s++; d++; count -= 4; } src = reinterpret_cast<const SkPMColor*>(s); dst = reinterpret_cast<SkPMColor*>(d); } while (count > 0) { *dst = SkPMSrcOver(*src, *dst); src++; dst++; count--; } #else int count16 = count / 16; __m128i* dst4 = (__m128i*)dst; const __m128i* src4 = (const __m128i*)src; for (int i = 0; i < count16 * 4; i += 4) { // Load 16 source pixels. __m128i s0 = _mm_loadu_si128(src4+i+0), s1 = _mm_loadu_si128(src4+i+1), s2 = _mm_loadu_si128(src4+i+2), s3 = _mm_loadu_si128(src4+i+3); const __m128i alphaMask = _mm_set1_epi32(0xFF << SK_A32_SHIFT); const __m128i ORed = _mm_or_si128(s3, _mm_or_si128(s2, _mm_or_si128(s1, s0))); __m128i cmp = _mm_cmpeq_epi8(_mm_and_si128(ORed, alphaMask), _mm_setzero_si128()); if (0xffff == _mm_movemask_epi8(cmp)) { // All 16 source pixels are fully transparent. There's nothing to do! continue; } const __m128i ANDed = _mm_and_si128(s3, _mm_and_si128(s2, _mm_and_si128(s1, s0))); cmp = _mm_cmpeq_epi8(_mm_and_si128(ANDed, alphaMask), alphaMask); if (0xffff == _mm_movemask_epi8(cmp)) { // All 16 source pixels are fully opaque. There's no need to read dst or blend it. _mm_storeu_si128(dst4+i+0, s0); _mm_storeu_si128(dst4+i+1, s1); _mm_storeu_si128(dst4+i+2, s2); _mm_storeu_si128(dst4+i+3, s3); continue; } // The general slow case: do the blend for all 16 pixels. _mm_storeu_si128(dst4+i+0, SkPMSrcOver_SSE2(s0, _mm_loadu_si128(dst4+i+0))); _mm_storeu_si128(dst4+i+1, SkPMSrcOver_SSE2(s1, _mm_loadu_si128(dst4+i+1))); _mm_storeu_si128(dst4+i+2, SkPMSrcOver_SSE2(s2, _mm_loadu_si128(dst4+i+2))); _mm_storeu_si128(dst4+i+3, SkPMSrcOver_SSE2(s3, _mm_loadu_si128(dst4+i+3))); } // Wrap up the last <= 15 pixels. SkASSERT(count - (count16*16) <= 15); for (int i = count16*16; i < count; i++) { // This check is not really necessarily, but it prevents pointless autovectorization. if (src[i] & 0xFF000000) { dst[i] = SkPMSrcOver(src[i], dst[i]); } } #endif } void S32A_Blend_BlitRow32_SSE2(SkPMColor* SK_RESTRICT dst, const SkPMColor* SK_RESTRICT src, int count, U8CPU alpha) { SkASSERT(alpha <= 255); if (count <= 0) { return; } if (count >= 4) { while (((size_t)dst & 0x0F) != 0) { *dst = SkBlendARGB32(*src, *dst, alpha); src++; dst++; count--; } const __m128i *s = reinterpret_cast<const __m128i*>(src); __m128i *d = reinterpret_cast<__m128i*>(dst); while (count >= 4) { // Load 4 pixels each of src and dest. __m128i src_pixel = _mm_loadu_si128(s); __m128i dst_pixel = _mm_load_si128(d); __m128i result = SkBlendARGB32_SSE2(src_pixel, dst_pixel, alpha); _mm_store_si128(d, result); s++; d++; count -= 4; } src = reinterpret_cast<const SkPMColor*>(s); dst = reinterpret_cast<SkPMColor*>(d); } while (count > 0) { *dst = SkBlendARGB32(*src, *dst, alpha); src++; dst++; count--; } } void Color32A_D565_SSE2(uint16_t dst[], SkPMColor src, int count, int x, int y) { SkASSERT(count > 0); uint32_t src_expand = (SkGetPackedG32(src) << 24) | (SkGetPackedR32(src) << 13) | (SkGetPackedB32(src) << 2); unsigned scale = SkAlpha255To256(0xFF - SkGetPackedA32(src)) >> 3; // Check if we have enough pixels to run SIMD if (count >= (int)(8 + (((16 - (size_t)dst) & 0x0F) >> 1))) { __m128i* dst_wide; const __m128i src_R_wide = _mm_set1_epi16(SkGetPackedR32(src) << 2); const __m128i src_G_wide = _mm_set1_epi16(SkGetPackedG32(src) << 3); const __m128i src_B_wide = _mm_set1_epi16(SkGetPackedB32(src) << 2); const __m128i scale_wide = _mm_set1_epi16(scale); const __m128i mask_blue = _mm_set1_epi16(SK_B16_MASK); const __m128i mask_green = _mm_set1_epi16(SK_G16_MASK << SK_G16_SHIFT); // Align dst to an even 16 byte address (0-7 pixels) while (((((size_t)dst) & 0x0F) != 0) && (count > 0)) { *dst = SkBlend32_RGB16(src_expand, *dst, scale); dst += 1; count--; } dst_wide = reinterpret_cast<__m128i*>(dst); do { // Load eight RGB565 pixels __m128i pixels = _mm_load_si128(dst_wide); // Mask out sub-pixels __m128i pixel_R = _mm_srli_epi16(pixels, SK_R16_SHIFT); __m128i pixel_G = _mm_slli_epi16(pixels, SK_R16_BITS); pixel_G = _mm_srli_epi16(pixel_G, SK_R16_BITS + SK_B16_BITS); __m128i pixel_B = _mm_and_si128(pixels, mask_blue); // Scale with alpha pixel_R = _mm_mullo_epi16(pixel_R, scale_wide); pixel_G = _mm_mullo_epi16(pixel_G, scale_wide); pixel_B = _mm_mullo_epi16(pixel_B, scale_wide); // Add src_X_wide and shift down again pixel_R = _mm_add_epi16(pixel_R, src_R_wide); pixel_R = _mm_srli_epi16(pixel_R, 5); pixel_G = _mm_add_epi16(pixel_G, src_G_wide); pixel_B = _mm_add_epi16(pixel_B, src_B_wide); pixel_B = _mm_srli_epi16(pixel_B, 5); // Combine into RGB565 and store pixel_R = _mm_slli_epi16(pixel_R, SK_R16_SHIFT); pixel_G = _mm_and_si128(pixel_G, mask_green); pixels = _mm_or_si128(pixel_R, pixel_G); pixels = _mm_or_si128(pixels, pixel_B); _mm_store_si128(dst_wide, pixels); count -= 8; dst_wide++; } while (count >= 8); dst = reinterpret_cast<uint16_t*>(dst_wide); } // Small loop to handle remaining pixels. while (count > 0) { *dst = SkBlend32_RGB16(src_expand, *dst, scale); dst += 1; count--; } } void SkARGB32_A8_BlitMask_SSE2(void* device, size_t dstRB, const void* maskPtr, size_t maskRB, SkColor origColor, int width, int height) { SkPMColor color = SkPreMultiplyColor(origColor); size_t dstOffset = dstRB - (width << 2); size_t maskOffset = maskRB - width; SkPMColor* dst = (SkPMColor *)device; const uint8_t* mask = (const uint8_t*)maskPtr; do { int count = width; if (count >= 4) { while (((size_t)dst & 0x0F) != 0 && (count > 0)) { *dst = SkBlendARGB32(color, *dst, *mask); mask++; dst++; count--; } __m128i *d = reinterpret_cast<__m128i*>(dst); __m128i src_pixel = _mm_set1_epi32(color); while (count >= 4) { // Load 4 dst pixels __m128i dst_pixel = _mm_load_si128(d); // Set the alpha value __m128i alpha_wide = _mm_cvtsi32_si128(*reinterpret_cast<const uint32_t*>(mask)); alpha_wide = _mm_unpacklo_epi8(alpha_wide, _mm_setzero_si128()); alpha_wide = _mm_unpacklo_epi16(alpha_wide, _mm_setzero_si128()); __m128i result = SkBlendARGB32_SSE2(src_pixel, dst_pixel, alpha_wide); _mm_store_si128(d, result); // Load the next 4 dst pixels and alphas mask = mask + 4; d++; count -= 4; } dst = reinterpret_cast<SkPMColor*>(d); } while (count > 0) { *dst= SkBlendARGB32(color, *dst, *mask); dst += 1; mask++; count --; } dst = (SkPMColor *)((char*)dst + dstOffset); mask += maskOffset; } while (--height != 0); } // The following (left) shifts cause the top 5 bits of the mask components to // line up with the corresponding components in an SkPMColor. // Note that the mask's RGB16 order may differ from the SkPMColor order. #define SK_R16x5_R32x5_SHIFT (SK_R32_SHIFT - SK_R16_SHIFT - SK_R16_BITS + 5) #define SK_G16x5_G32x5_SHIFT (SK_G32_SHIFT - SK_G16_SHIFT - SK_G16_BITS + 5) #define SK_B16x5_B32x5_SHIFT (SK_B32_SHIFT - SK_B16_SHIFT - SK_B16_BITS + 5) #if SK_R16x5_R32x5_SHIFT == 0 #define SkPackedR16x5ToUnmaskedR32x5_SSE2(x) (x) #elif SK_R16x5_R32x5_SHIFT > 0 #define SkPackedR16x5ToUnmaskedR32x5_SSE2(x) (_mm_slli_epi32(x, SK_R16x5_R32x5_SHIFT)) #else #define SkPackedR16x5ToUnmaskedR32x5_SSE2(x) (_mm_srli_epi32(x, -SK_R16x5_R32x5_SHIFT)) #endif #if SK_G16x5_G32x5_SHIFT == 0 #define SkPackedG16x5ToUnmaskedG32x5_SSE2(x) (x) #elif SK_G16x5_G32x5_SHIFT > 0 #define SkPackedG16x5ToUnmaskedG32x5_SSE2(x) (_mm_slli_epi32(x, SK_G16x5_G32x5_SHIFT)) #else #define SkPackedG16x5ToUnmaskedG32x5_SSE2(x) (_mm_srli_epi32(x, -SK_G16x5_G32x5_SHIFT)) #endif #if SK_B16x5_B32x5_SHIFT == 0 #define SkPackedB16x5ToUnmaskedB32x5_SSE2(x) (x) #elif SK_B16x5_B32x5_SHIFT > 0 #define SkPackedB16x5ToUnmaskedB32x5_SSE2(x) (_mm_slli_epi32(x, SK_B16x5_B32x5_SHIFT)) #else #define SkPackedB16x5ToUnmaskedB32x5_SSE2(x) (_mm_srli_epi32(x, -SK_B16x5_B32x5_SHIFT)) #endif static __m128i SkBlendLCD16_SSE2(__m128i &src, __m128i &dst, __m128i &mask, __m128i &srcA) { // In the following comments, the components of src, dst and mask are // abbreviated as (s)rc, (d)st, and (m)ask. Color components are marked // by an R, G, B, or A suffix. Components of one of the four pixels that // are processed in parallel are marked with 0, 1, 2, and 3. "d1B", for // example is the blue channel of the second destination pixel. Memory // layout is shown for an ARGB byte order in a color value. // src and srcA store 8-bit values interleaved with zeros. // src = (0xFF, 0, sR, 0, sG, 0, sB, 0, 0xFF, 0, sR, 0, sG, 0, sB, 0) // srcA = (srcA, 0, srcA, 0, srcA, 0, srcA, 0, // srcA, 0, srcA, 0, srcA, 0, srcA, 0) // mask stores 16-bit values (compressed three channels) interleaved with zeros. // Lo and Hi denote the low and high bytes of a 16-bit value, respectively. // mask = (m0RGBLo, m0RGBHi, 0, 0, m1RGBLo, m1RGBHi, 0, 0, // m2RGBLo, m2RGBHi, 0, 0, m3RGBLo, m3RGBHi, 0, 0) // Get the R,G,B of each 16bit mask pixel, we want all of them in 5 bits. // r = (0, m0R, 0, 0, 0, m1R, 0, 0, 0, m2R, 0, 0, 0, m3R, 0, 0) __m128i r = _mm_and_si128(SkPackedR16x5ToUnmaskedR32x5_SSE2(mask), _mm_set1_epi32(0x1F << SK_R32_SHIFT)); // g = (0, 0, m0G, 0, 0, 0, m1G, 0, 0, 0, m2G, 0, 0, 0, m3G, 0) __m128i g = _mm_and_si128(SkPackedG16x5ToUnmaskedG32x5_SSE2(mask), _mm_set1_epi32(0x1F << SK_G32_SHIFT)); // b = (0, 0, 0, m0B, 0, 0, 0, m1B, 0, 0, 0, m2B, 0, 0, 0, m3B) __m128i b = _mm_and_si128(SkPackedB16x5ToUnmaskedB32x5_SSE2(mask), _mm_set1_epi32(0x1F << SK_B32_SHIFT)); // Pack the 4 16bit mask pixels into 4 32bit pixels, (p0, p1, p2, p3) // Each component (m0R, m0G, etc.) is then a 5-bit value aligned to an // 8-bit position // mask = (0, m0R, m0G, m0B, 0, m1R, m1G, m1B, // 0, m2R, m2G, m2B, 0, m3R, m3G, m3B) mask = _mm_or_si128(_mm_or_si128(r, g), b); // Interleave R,G,B into the lower byte of word. // i.e. split the sixteen 8-bit values from mask into two sets of eight // 16-bit values, padded by zero. __m128i maskLo, maskHi; // maskLo = (0, 0, m0R, 0, m0G, 0, m0B, 0, 0, 0, m1R, 0, m1G, 0, m1B, 0) maskLo = _mm_unpacklo_epi8(mask, _mm_setzero_si128()); // maskHi = (0, 0, m2R, 0, m2G, 0, m2B, 0, 0, 0, m3R, 0, m3G, 0, m3B, 0) maskHi = _mm_unpackhi_epi8(mask, _mm_setzero_si128()); // Upscale from 0..31 to 0..32 // (allows to replace division by left-shift further down) // Left-shift each component by 4 and add the result back to that component, // mapping numbers in the range 0..15 to 0..15, and 16..31 to 17..32 maskLo = _mm_add_epi16(maskLo, _mm_srli_epi16(maskLo, 4)); maskHi = _mm_add_epi16(maskHi, _mm_srli_epi16(maskHi, 4)); // Multiply each component of maskLo and maskHi by srcA maskLo = _mm_mullo_epi16(maskLo, srcA); maskHi = _mm_mullo_epi16(maskHi, srcA); // Left shift mask components by 8 (divide by 256) maskLo = _mm_srli_epi16(maskLo, 8); maskHi = _mm_srli_epi16(maskHi, 8); // Interleave R,G,B into the lower byte of the word // dstLo = (0, 0, d0R, 0, d0G, 0, d0B, 0, 0, 0, d1R, 0, d1G, 0, d1B, 0) __m128i dstLo = _mm_unpacklo_epi8(dst, _mm_setzero_si128()); // dstLo = (0, 0, d2R, 0, d2G, 0, d2B, 0, 0, 0, d3R, 0, d3G, 0, d3B, 0) __m128i dstHi = _mm_unpackhi_epi8(dst, _mm_setzero_si128()); // mask = (src - dst) * mask maskLo = _mm_mullo_epi16(maskLo, _mm_sub_epi16(src, dstLo)); maskHi = _mm_mullo_epi16(maskHi, _mm_sub_epi16(src, dstHi)); // mask = (src - dst) * mask >> 5 maskLo = _mm_srai_epi16(maskLo, 5); maskHi = _mm_srai_epi16(maskHi, 5); // Add two pixels into result. // result = dst + ((src - dst) * mask >> 5) __m128i resultLo = _mm_add_epi16(dstLo, maskLo); __m128i resultHi = _mm_add_epi16(dstHi, maskHi); // Pack into 4 32bit dst pixels. // resultLo and resultHi contain eight 16-bit components (two pixels) each. // Merge into one SSE regsiter with sixteen 8-bit values (four pixels), // clamping to 255 if necessary. return _mm_packus_epi16(resultLo, resultHi); } static __m128i SkBlendLCD16Opaque_SSE2(__m128i &src, __m128i &dst, __m128i &mask) { // In the following comments, the components of src, dst and mask are // abbreviated as (s)rc, (d)st, and (m)ask. Color components are marked // by an R, G, B, or A suffix. Components of one of the four pixels that // are processed in parallel are marked with 0, 1, 2, and 3. "d1B", for // example is the blue channel of the second destination pixel. Memory // layout is shown for an ARGB byte order in a color value. // src and srcA store 8-bit values interleaved with zeros. // src = (0xFF, 0, sR, 0, sG, 0, sB, 0, 0xFF, 0, sR, 0, sG, 0, sB, 0) // mask stores 16-bit values (shown as high and low bytes) interleaved with // zeros // mask = (m0RGBLo, m0RGBHi, 0, 0, m1RGBLo, m1RGBHi, 0, 0, // m2RGBLo, m2RGBHi, 0, 0, m3RGBLo, m3RGBHi, 0, 0) // Get the R,G,B of each 16bit mask pixel, we want all of them in 5 bits. // r = (0, m0R, 0, 0, 0, m1R, 0, 0, 0, m2R, 0, 0, 0, m3R, 0, 0) __m128i r = _mm_and_si128(SkPackedR16x5ToUnmaskedR32x5_SSE2(mask), _mm_set1_epi32(0x1F << SK_R32_SHIFT)); // g = (0, 0, m0G, 0, 0, 0, m1G, 0, 0, 0, m2G, 0, 0, 0, m3G, 0) __m128i g = _mm_and_si128(SkPackedG16x5ToUnmaskedG32x5_SSE2(mask), _mm_set1_epi32(0x1F << SK_G32_SHIFT)); // b = (0, 0, 0, m0B, 0, 0, 0, m1B, 0, 0, 0, m2B, 0, 0, 0, m3B) __m128i b = _mm_and_si128(SkPackedB16x5ToUnmaskedB32x5_SSE2(mask), _mm_set1_epi32(0x1F << SK_B32_SHIFT)); // Pack the 4 16bit mask pixels into 4 32bit pixels, (p0, p1, p2, p3) // Each component (m0R, m0G, etc.) is then a 5-bit value aligned to an // 8-bit position // mask = (0, m0R, m0G, m0B, 0, m1R, m1G, m1B, // 0, m2R, m2G, m2B, 0, m3R, m3G, m3B) mask = _mm_or_si128(_mm_or_si128(r, g), b); // Interleave R,G,B into the lower byte of word. // i.e. split the sixteen 8-bit values from mask into two sets of eight // 16-bit values, padded by zero. __m128i maskLo, maskHi; // maskLo = (0, 0, m0R, 0, m0G, 0, m0B, 0, 0, 0, m1R, 0, m1G, 0, m1B, 0) maskLo = _mm_unpacklo_epi8(mask, _mm_setzero_si128()); // maskHi = (0, 0, m2R, 0, m2G, 0, m2B, 0, 0, 0, m3R, 0, m3G, 0, m3B, 0) maskHi = _mm_unpackhi_epi8(mask, _mm_setzero_si128()); // Upscale from 0..31 to 0..32 // (allows to replace division by left-shift further down) // Left-shift each component by 4 and add the result back to that component, // mapping numbers in the range 0..15 to 0..15, and 16..31 to 17..32 maskLo = _mm_add_epi16(maskLo, _mm_srli_epi16(maskLo, 4)); maskHi = _mm_add_epi16(maskHi, _mm_srli_epi16(maskHi, 4)); // Interleave R,G,B into the lower byte of the word // dstLo = (0, 0, d0R, 0, d0G, 0, d0B, 0, 0, 0, d1R, 0, d1G, 0, d1B, 0) __m128i dstLo = _mm_unpacklo_epi8(dst, _mm_setzero_si128()); // dstLo = (0, 0, d2R, 0, d2G, 0, d2B, 0, 0, 0, d3R, 0, d3G, 0, d3B, 0) __m128i dstHi = _mm_unpackhi_epi8(dst, _mm_setzero_si128()); // mask = (src - dst) * mask maskLo = _mm_mullo_epi16(maskLo, _mm_sub_epi16(src, dstLo)); maskHi = _mm_mullo_epi16(maskHi, _mm_sub_epi16(src, dstHi)); // mask = (src - dst) * mask >> 5 maskLo = _mm_srai_epi16(maskLo, 5); maskHi = _mm_srai_epi16(maskHi, 5); // Add two pixels into result. // result = dst + ((src - dst) * mask >> 5) __m128i resultLo = _mm_add_epi16(dstLo, maskLo); __m128i resultHi = _mm_add_epi16(dstHi, maskHi); // Pack into 4 32bit dst pixels and force opaque. // resultLo and resultHi contain eight 16-bit components (two pixels) each. // Merge into one SSE regsiter with sixteen 8-bit values (four pixels), // clamping to 255 if necessary. Set alpha components to 0xFF. return _mm_or_si128(_mm_packus_epi16(resultLo, resultHi), _mm_set1_epi32(SK_A32_MASK << SK_A32_SHIFT)); } void SkBlitLCD16Row_SSE2(SkPMColor dst[], const uint16_t mask[], SkColor src, int width, SkPMColor) { if (width <= 0) { return; } int srcA = SkColorGetA(src); int srcR = SkColorGetR(src); int srcG = SkColorGetG(src); int srcB = SkColorGetB(src); srcA = SkAlpha255To256(srcA); if (width >= 4) { SkASSERT(((size_t)dst & 0x03) == 0); while (((size_t)dst & 0x0F) != 0) { *dst = SkBlendLCD16(srcA, srcR, srcG, srcB, *dst, *mask); mask++; dst++; width--; } __m128i *d = reinterpret_cast<__m128i*>(dst); // Set alpha to 0xFF and replicate source four times in SSE register. __m128i src_sse = _mm_set1_epi32(SkPackARGB32(0xFF, srcR, srcG, srcB)); // Interleave with zeros to get two sets of four 16-bit values. src_sse = _mm_unpacklo_epi8(src_sse, _mm_setzero_si128()); // Set srcA_sse to contain eight copies of srcA, padded with zero. // src_sse=(0xFF, 0, sR, 0, sG, 0, sB, 0, 0xFF, 0, sR, 0, sG, 0, sB, 0) __m128i srcA_sse = _mm_set1_epi16(srcA); while (width >= 4) { // Load four destination pixels into dst_sse. __m128i dst_sse = _mm_load_si128(d); // Load four 16-bit masks into lower half of mask_sse. __m128i mask_sse = _mm_loadl_epi64( reinterpret_cast<const __m128i*>(mask)); // Check whether masks are equal to 0 and get the highest bit // of each byte of result, if masks are all zero, we will get // pack_cmp to 0xFFFF int pack_cmp = _mm_movemask_epi8(_mm_cmpeq_epi16(mask_sse, _mm_setzero_si128())); // if mask pixels are not all zero, we will blend the dst pixels if (pack_cmp != 0xFFFF) { // Unpack 4 16bit mask pixels to // mask_sse = (m0RGBLo, m0RGBHi, 0, 0, m1RGBLo, m1RGBHi, 0, 0, // m2RGBLo, m2RGBHi, 0, 0, m3RGBLo, m3RGBHi, 0, 0) mask_sse = _mm_unpacklo_epi16(mask_sse, _mm_setzero_si128()); // Process 4 32bit dst pixels __m128i result = SkBlendLCD16_SSE2(src_sse, dst_sse, mask_sse, srcA_sse); _mm_store_si128(d, result); } d++; mask += 4; width -= 4; } dst = reinterpret_cast<SkPMColor*>(d); } while (width > 0) { *dst = SkBlendLCD16(srcA, srcR, srcG, srcB, *dst, *mask); mask++; dst++; width--; } } void SkBlitLCD16OpaqueRow_SSE2(SkPMColor dst[], const uint16_t mask[], SkColor src, int width, SkPMColor opaqueDst) { if (width <= 0) { return; } int srcR = SkColorGetR(src); int srcG = SkColorGetG(src); int srcB = SkColorGetB(src); if (width >= 4) { SkASSERT(((size_t)dst & 0x03) == 0); while (((size_t)dst & 0x0F) != 0) { *dst = SkBlendLCD16Opaque(srcR, srcG, srcB, *dst, *mask, opaqueDst); mask++; dst++; width--; } __m128i *d = reinterpret_cast<__m128i*>(dst); // Set alpha to 0xFF and replicate source four times in SSE register. __m128i src_sse = _mm_set1_epi32(SkPackARGB32(0xFF, srcR, srcG, srcB)); // Set srcA_sse to contain eight copies of srcA, padded with zero. // src_sse=(0xFF, 0, sR, 0, sG, 0, sB, 0, 0xFF, 0, sR, 0, sG, 0, sB, 0) src_sse = _mm_unpacklo_epi8(src_sse, _mm_setzero_si128()); while (width >= 4) { // Load four destination pixels into dst_sse. __m128i dst_sse = _mm_load_si128(d); // Load four 16-bit masks into lower half of mask_sse. __m128i mask_sse = _mm_loadl_epi64( reinterpret_cast<const __m128i*>(mask)); // Check whether masks are equal to 0 and get the highest bit // of each byte of result, if masks are all zero, we will get // pack_cmp to 0xFFFF int pack_cmp = _mm_movemask_epi8(_mm_cmpeq_epi16(mask_sse, _mm_setzero_si128())); // if mask pixels are not all zero, we will blend the dst pixels if (pack_cmp != 0xFFFF) { // Unpack 4 16bit mask pixels to // mask_sse = (m0RGBLo, m0RGBHi, 0, 0, m1RGBLo, m1RGBHi, 0, 0, // m2RGBLo, m2RGBHi, 0, 0, m3RGBLo, m3RGBHi, 0, 0) mask_sse = _mm_unpacklo_epi16(mask_sse, _mm_setzero_si128()); // Process 4 32bit dst pixels __m128i result = SkBlendLCD16Opaque_SSE2(src_sse, dst_sse, mask_sse); _mm_store_si128(d, result); } d++; mask += 4; width -= 4; } dst = reinterpret_cast<SkPMColor*>(d); } while (width > 0) { *dst = SkBlendLCD16Opaque(srcR, srcG, srcB, *dst, *mask, opaqueDst); mask++; dst++; width--; } } /* SSE2 version of S32_D565_Opaque() * portable version is in core/SkBlitRow_D16.cpp */ void S32_D565_Opaque_SSE2(uint16_t* SK_RESTRICT dst, const SkPMColor* SK_RESTRICT src, int count, U8CPU alpha, int /*x*/, int /*y*/) { SkASSERT(255 == alpha); if (count <= 0) { return; } if (count >= 8) { while (((size_t)dst & 0x0F) != 0) { SkPMColor c = *src++; SkPMColorAssert(c); *dst++ = SkPixel32ToPixel16_ToU16(c); count--; } const __m128i* s = reinterpret_cast<const __m128i*>(src); __m128i* d = reinterpret_cast<__m128i*>(dst); while (count >= 8) { // Load 8 pixels of src. __m128i src_pixel1 = _mm_loadu_si128(s++); __m128i src_pixel2 = _mm_loadu_si128(s++); __m128i d_pixel = SkPixel32ToPixel16_ToU16_SSE2(src_pixel1, src_pixel2); _mm_store_si128(d++, d_pixel); count -= 8; } src = reinterpret_cast<const SkPMColor*>(s); dst = reinterpret_cast<uint16_t*>(d); } if (count > 0) { do { SkPMColor c = *src++; SkPMColorAssert(c); *dst++ = SkPixel32ToPixel16_ToU16(c); } while (--count != 0); } } /* SSE2 version of S32A_D565_Opaque() * portable version is in core/SkBlitRow_D16.cpp */ void S32A_D565_Opaque_SSE2(uint16_t* SK_RESTRICT dst, const SkPMColor* SK_RESTRICT src, int count, U8CPU alpha, int /*x*/, int /*y*/) { SkASSERT(255 == alpha); if (count <= 0) { return; } if (count >= 8) { // Make dst 16 bytes alignment while (((size_t)dst & 0x0F) != 0) { SkPMColor c = *src++; if (c) { *dst = SkSrcOver32To16(c, *dst); } dst += 1; count--; } const __m128i* s = reinterpret_cast<const __m128i*>(src); __m128i* d = reinterpret_cast<__m128i*>(dst); __m128i var255 = _mm_set1_epi16(255); __m128i r16_mask = _mm_set1_epi16(SK_R16_MASK); __m128i g16_mask = _mm_set1_epi16(SK_G16_MASK); __m128i b16_mask = _mm_set1_epi16(SK_B16_MASK); while (count >= 8) { // Load 8 pixels of src. __m128i src_pixel1 = _mm_loadu_si128(s++); __m128i src_pixel2 = _mm_loadu_si128(s++); // Check whether src pixels are equal to 0 and get the highest bit // of each byte of result, if src pixels are all zero, src_cmp1 and // src_cmp2 will be 0xFFFF. int src_cmp1 = _mm_movemask_epi8(_mm_cmpeq_epi16(src_pixel1, _mm_setzero_si128())); int src_cmp2 = _mm_movemask_epi8(_mm_cmpeq_epi16(src_pixel2, _mm_setzero_si128())); if (src_cmp1 == 0xFFFF && src_cmp2 == 0xFFFF) { d++; count -= 8; continue; } // Load 8 pixels of dst. __m128i dst_pixel = _mm_load_si128(d); // Extract A from src. __m128i sa1 = _mm_slli_epi32(src_pixel1, (24 - SK_A32_SHIFT)); sa1 = _mm_srli_epi32(sa1, 24); __m128i sa2 = _mm_slli_epi32(src_pixel2, (24 - SK_A32_SHIFT)); sa2 = _mm_srli_epi32(sa2, 24); __m128i sa = _mm_packs_epi32(sa1, sa2); // Extract R from src. __m128i sr1 = _mm_slli_epi32(src_pixel1, (24 - SK_R32_SHIFT)); sr1 = _mm_srli_epi32(sr1, 24); __m128i sr2 = _mm_slli_epi32(src_pixel2, (24 - SK_R32_SHIFT)); sr2 = _mm_srli_epi32(sr2, 24); __m128i sr = _mm_packs_epi32(sr1, sr2); // Extract G from src. __m128i sg1 = _mm_slli_epi32(src_pixel1, (24 - SK_G32_SHIFT)); sg1 = _mm_srli_epi32(sg1, 24); __m128i sg2 = _mm_slli_epi32(src_pixel2, (24 - SK_G32_SHIFT)); sg2 = _mm_srli_epi32(sg2, 24); __m128i sg = _mm_packs_epi32(sg1, sg2); // Extract B from src. __m128i sb1 = _mm_slli_epi32(src_pixel1, (24 - SK_B32_SHIFT)); sb1 = _mm_srli_epi32(sb1, 24); __m128i sb2 = _mm_slli_epi32(src_pixel2, (24 - SK_B32_SHIFT)); sb2 = _mm_srli_epi32(sb2, 24); __m128i sb = _mm_packs_epi32(sb1, sb2); // Extract R G B from dst. __m128i dr = _mm_srli_epi16(dst_pixel, SK_R16_SHIFT); dr = _mm_and_si128(dr, r16_mask); __m128i dg = _mm_srli_epi16(dst_pixel, SK_G16_SHIFT); dg = _mm_and_si128(dg, g16_mask); __m128i db = _mm_srli_epi16(dst_pixel, SK_B16_SHIFT); db = _mm_and_si128(db, b16_mask); __m128i isa = _mm_sub_epi16(var255, sa); // 255 -sa // Calculate R G B of result. // Original algorithm is in SkSrcOver32To16(). dr = _mm_add_epi16(sr, SkMul16ShiftRound_SSE2(dr, isa, SK_R16_BITS)); dr = _mm_srli_epi16(dr, 8 - SK_R16_BITS); dg = _mm_add_epi16(sg, SkMul16ShiftRound_SSE2(dg, isa, SK_G16_BITS)); dg = _mm_srli_epi16(dg, 8 - SK_G16_BITS); db = _mm_add_epi16(sb, SkMul16ShiftRound_SSE2(db, isa, SK_B16_BITS)); db = _mm_srli_epi16(db, 8 - SK_B16_BITS); // Pack R G B into 16-bit color. __m128i d_pixel = SkPackRGB16_SSE2(dr, dg, db); // Store 8 16-bit colors in dst. _mm_store_si128(d++, d_pixel); count -= 8; } src = reinterpret_cast<const SkPMColor*>(s); dst = reinterpret_cast<uint16_t*>(d); } if (count > 0) { do { SkPMColor c = *src++; SkPMColorAssert(c); if (c) { *dst = SkSrcOver32To16(c, *dst); } dst += 1; } while (--count != 0); } } void S32_D565_Opaque_Dither_SSE2(uint16_t* SK_RESTRICT dst, const SkPMColor* SK_RESTRICT src, int count, U8CPU alpha, int x, int y) { SkASSERT(255 == alpha); if (count <= 0) { return; } if (count >= 8) { while (((size_t)dst & 0x0F) != 0) { DITHER_565_SCAN(y); SkPMColor c = *src++; SkPMColorAssert(c); unsigned dither = DITHER_VALUE(x); *dst++ = SkDitherRGB32To565(c, dither); DITHER_INC_X(x); count--; } unsigned short dither_value[8]; __m128i dither; #ifdef ENABLE_DITHER_MATRIX_4X4 const uint8_t* dither_scan = gDitherMatrix_3Bit_4X4[(y) & 3]; dither_value[0] = dither_value[4] = dither_scan[(x) & 3]; dither_value[1] = dither_value[5] = dither_scan[(x + 1) & 3]; dither_value[2] = dither_value[6] = dither_scan[(x + 2) & 3]; dither_value[3] = dither_value[7] = dither_scan[(x + 3) & 3]; #else const uint16_t dither_scan = gDitherMatrix_3Bit_16[(y) & 3]; dither_value[0] = dither_value[4] = (dither_scan >> (((x) & 3) << 2)) & 0xF; dither_value[1] = dither_value[5] = (dither_scan >> (((x + 1) & 3) << 2)) & 0xF; dither_value[2] = dither_value[6] = (dither_scan >> (((x + 2) & 3) << 2)) & 0xF; dither_value[3] = dither_value[7] = (dither_scan >> (((x + 3) & 3) << 2)) & 0xF; #endif dither = _mm_loadu_si128((__m128i*) dither_value); const __m128i* s = reinterpret_cast<const __m128i*>(src); __m128i* d = reinterpret_cast<__m128i*>(dst); while (count >= 8) { // Load 8 pixels of src. __m128i src_pixel1 = _mm_loadu_si128(s++); __m128i src_pixel2 = _mm_loadu_si128(s++); // Extract R from src. __m128i sr1 = _mm_slli_epi32(src_pixel1, (24 - SK_R32_SHIFT)); sr1 = _mm_srli_epi32(sr1, 24); __m128i sr2 = _mm_slli_epi32(src_pixel2, (24 - SK_R32_SHIFT)); sr2 = _mm_srli_epi32(sr2, 24); __m128i sr = _mm_packs_epi32(sr1, sr2); // SkDITHER_R32To565(sr, dither) __m128i sr_offset = _mm_srli_epi16(sr, 5); sr = _mm_add_epi16(sr, dither); sr = _mm_sub_epi16(sr, sr_offset); sr = _mm_srli_epi16(sr, SK_R32_BITS - SK_R16_BITS); // Extract G from src. __m128i sg1 = _mm_slli_epi32(src_pixel1, (24 - SK_G32_SHIFT)); sg1 = _mm_srli_epi32(sg1, 24); __m128i sg2 = _mm_slli_epi32(src_pixel2, (24 - SK_G32_SHIFT)); sg2 = _mm_srli_epi32(sg2, 24); __m128i sg = _mm_packs_epi32(sg1, sg2); // SkDITHER_R32To565(sg, dither) __m128i sg_offset = _mm_srli_epi16(sg, 6); sg = _mm_add_epi16(sg, _mm_srli_epi16(dither, 1)); sg = _mm_sub_epi16(sg, sg_offset); sg = _mm_srli_epi16(sg, SK_G32_BITS - SK_G16_BITS); // Extract B from src. __m128i sb1 = _mm_slli_epi32(src_pixel1, (24 - SK_B32_SHIFT)); sb1 = _mm_srli_epi32(sb1, 24); __m128i sb2 = _mm_slli_epi32(src_pixel2, (24 - SK_B32_SHIFT)); sb2 = _mm_srli_epi32(sb2, 24); __m128i sb = _mm_packs_epi32(sb1, sb2); // SkDITHER_R32To565(sb, dither) __m128i sb_offset = _mm_srli_epi16(sb, 5); sb = _mm_add_epi16(sb, dither); sb = _mm_sub_epi16(sb, sb_offset); sb = _mm_srli_epi16(sb, SK_B32_BITS - SK_B16_BITS); // Pack and store 16-bit dst pixel. __m128i d_pixel = SkPackRGB16_SSE2(sr, sg, sb); _mm_store_si128(d++, d_pixel); count -= 8; x += 8; } src = reinterpret_cast<const SkPMColor*>(s); dst = reinterpret_cast<uint16_t*>(d); } if (count > 0) { DITHER_565_SCAN(y); do { SkPMColor c = *src++; SkPMColorAssert(c); unsigned dither = DITHER_VALUE(x); *dst++ = SkDitherRGB32To565(c, dither); DITHER_INC_X(x); } while (--count != 0); } } /* SSE2 version of S32A_D565_Opaque_Dither() * portable version is in core/SkBlitRow_D16.cpp */ void S32A_D565_Opaque_Dither_SSE2(uint16_t* SK_RESTRICT dst, const SkPMColor* SK_RESTRICT src, int count, U8CPU alpha, int x, int y) { SkASSERT(255 == alpha); if (count <= 0) { return; } if (count >= 8) { while (((size_t)dst & 0x0F) != 0) { DITHER_565_SCAN(y); SkPMColor c = *src++; SkPMColorAssert(c); if (c) { unsigned a = SkGetPackedA32(c); int d = SkAlphaMul(DITHER_VALUE(x), SkAlpha255To256(a)); unsigned sr = SkGetPackedR32(c); unsigned sg = SkGetPackedG32(c); unsigned sb = SkGetPackedB32(c); sr = SkDITHER_R32_FOR_565(sr, d); sg = SkDITHER_G32_FOR_565(sg, d); sb = SkDITHER_B32_FOR_565(sb, d); uint32_t src_expanded = (sg << 24) | (sr << 13) | (sb << 2); uint32_t dst_expanded = SkExpand_rgb_16(*dst); dst_expanded = dst_expanded * (SkAlpha255To256(255 - a) >> 3); // now src and dst expanded are in g:11 r:10 x:1 b:10 *dst = SkCompact_rgb_16((src_expanded + dst_expanded) >> 5); } dst += 1; DITHER_INC_X(x); count--; } unsigned short dither_value[8]; __m128i dither, dither_cur; #ifdef ENABLE_DITHER_MATRIX_4X4 const uint8_t* dither_scan = gDitherMatrix_3Bit_4X4[(y) & 3]; dither_value[0] = dither_value[4] = dither_scan[(x) & 3]; dither_value[1] = dither_value[5] = dither_scan[(x + 1) & 3]; dither_value[2] = dither_value[6] = dither_scan[(x + 2) & 3]; dither_value[3] = dither_value[7] = dither_scan[(x + 3) & 3]; #else const uint16_t dither_scan = gDitherMatrix_3Bit_16[(y) & 3]; dither_value[0] = dither_value[4] = (dither_scan >> (((x) & 3) << 2)) & 0xF; dither_value[1] = dither_value[5] = (dither_scan >> (((x + 1) & 3) << 2)) & 0xF; dither_value[2] = dither_value[6] = (dither_scan >> (((x + 2) & 3) << 2)) & 0xF; dither_value[3] = dither_value[7] = (dither_scan >> (((x + 3) & 3) << 2)) & 0xF; #endif dither = _mm_loadu_si128((__m128i*) dither_value); const __m128i* s = reinterpret_cast<const __m128i*>(src); __m128i* d = reinterpret_cast<__m128i*>(dst); __m128i var256 = _mm_set1_epi16(256); __m128i r16_mask = _mm_set1_epi16(SK_R16_MASK); __m128i g16_mask = _mm_set1_epi16(SK_G16_MASK); __m128i b16_mask = _mm_set1_epi16(SK_B16_MASK); while (count >= 8) { // Load 8 pixels of src and dst. __m128i src_pixel1 = _mm_loadu_si128(s++); __m128i src_pixel2 = _mm_loadu_si128(s++); __m128i dst_pixel = _mm_load_si128(d); // Extract A from src. __m128i sa1 = _mm_slli_epi32(src_pixel1, (24 - SK_A32_SHIFT)); sa1 = _mm_srli_epi32(sa1, 24); __m128i sa2 = _mm_slli_epi32(src_pixel2, (24 - SK_A32_SHIFT)); sa2 = _mm_srli_epi32(sa2, 24); __m128i sa = _mm_packs_epi32(sa1, sa2); // Calculate current dither value. dither_cur = _mm_mullo_epi16(dither, _mm_add_epi16(sa, _mm_set1_epi16(1))); dither_cur = _mm_srli_epi16(dither_cur, 8); // Extract R from src. __m128i sr1 = _mm_slli_epi32(src_pixel1, (24 - SK_R32_SHIFT)); sr1 = _mm_srli_epi32(sr1, 24); __m128i sr2 = _mm_slli_epi32(src_pixel2, (24 - SK_R32_SHIFT)); sr2 = _mm_srli_epi32(sr2, 24); __m128i sr = _mm_packs_epi32(sr1, sr2); // SkDITHER_R32_FOR_565(sr, d) __m128i sr_offset = _mm_srli_epi16(sr, 5); sr = _mm_add_epi16(sr, dither_cur); sr = _mm_sub_epi16(sr, sr_offset); // Expand sr. sr = _mm_slli_epi16(sr, 2); // Extract G from src. __m128i sg1 = _mm_slli_epi32(src_pixel1, (24 - SK_G32_SHIFT)); sg1 = _mm_srli_epi32(sg1, 24); __m128i sg2 = _mm_slli_epi32(src_pixel2, (24 - SK_G32_SHIFT)); sg2 = _mm_srli_epi32(sg2, 24); __m128i sg = _mm_packs_epi32(sg1, sg2); // sg = SkDITHER_G32_FOR_565(sg, d). __m128i sg_offset = _mm_srli_epi16(sg, 6); sg = _mm_add_epi16(sg, _mm_srli_epi16(dither_cur, 1)); sg = _mm_sub_epi16(sg, sg_offset); // Expand sg. sg = _mm_slli_epi16(sg, 3); // Extract B from src. __m128i sb1 = _mm_slli_epi32(src_pixel1, (24 - SK_B32_SHIFT)); sb1 = _mm_srli_epi32(sb1, 24); __m128i sb2 = _mm_slli_epi32(src_pixel2, (24 - SK_B32_SHIFT)); sb2 = _mm_srli_epi32(sb2, 24); __m128i sb = _mm_packs_epi32(sb1, sb2); // sb = SkDITHER_B32_FOR_565(sb, d). __m128i sb_offset = _mm_srli_epi16(sb, 5); sb = _mm_add_epi16(sb, dither_cur); sb = _mm_sub_epi16(sb, sb_offset); // Expand sb. sb = _mm_slli_epi16(sb, 2); // Extract R G B from dst. __m128i dr = _mm_srli_epi16(dst_pixel, SK_R16_SHIFT); dr = _mm_and_si128(dr, r16_mask); __m128i dg = _mm_srli_epi16(dst_pixel, SK_G16_SHIFT); dg = _mm_and_si128(dg, g16_mask); __m128i db = _mm_srli_epi16(dst_pixel, SK_B16_SHIFT); db = _mm_and_si128(db, b16_mask); // SkAlpha255To256(255 - a) >> 3 __m128i isa = _mm_sub_epi16(var256, sa); isa = _mm_srli_epi16(isa, 3); dr = _mm_mullo_epi16(dr, isa); dr = _mm_add_epi16(dr, sr); dr = _mm_srli_epi16(dr, 5); dg = _mm_mullo_epi16(dg, isa); dg = _mm_add_epi16(dg, sg); dg = _mm_srli_epi16(dg, 5); db = _mm_mullo_epi16(db, isa); db = _mm_add_epi16(db, sb); db = _mm_srli_epi16(db, 5); // Package and store dst pixel. __m128i d_pixel = SkPackRGB16_SSE2(dr, dg, db); _mm_store_si128(d++, d_pixel); count -= 8; x += 8; } src = reinterpret_cast<const SkPMColor*>(s); dst = reinterpret_cast<uint16_t*>(d); } if (count > 0) { DITHER_565_SCAN(y); do { SkPMColor c = *src++; SkPMColorAssert(c); if (c) { unsigned a = SkGetPackedA32(c); int d = SkAlphaMul(DITHER_VALUE(x), SkAlpha255To256(a)); unsigned sr = SkGetPackedR32(c); unsigned sg = SkGetPackedG32(c); unsigned sb = SkGetPackedB32(c); sr = SkDITHER_R32_FOR_565(sr, d); sg = SkDITHER_G32_FOR_565(sg, d); sb = SkDITHER_B32_FOR_565(sb, d); uint32_t src_expanded = (sg << 24) | (sr << 13) | (sb << 2); uint32_t dst_expanded = SkExpand_rgb_16(*dst); dst_expanded = dst_expanded * (SkAlpha255To256(255 - a) >> 3); // now src and dst expanded are in g:11 r:10 x:1 b:10 *dst = SkCompact_rgb_16((src_expanded + dst_expanded) >> 5); } dst += 1; DITHER_INC_X(x); } while (--count != 0); } }
VRToxin-AOSP/android_external_skia
src/opts/SkBlitRow_opts_SSE2.cpp
C++
bsd-3-clause
45,919
// mgo - MongoDB driver for Go // // Copyright (c) 2010-2012 - Gustavo Niemeyer <gustavo@niemeyer.net> // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // 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. package mgo import ( "crypto/md5" "encoding/hex" "errors" "fmt" "math" "net" "net/url" "reflect" "sort" "strconv" "strings" "sync" "time" "gopkg.in/mgo.v2/bson" ) type Mode int const ( // Relevant documentation on read preference modes: // // http://docs.mongodb.org/manual/reference/read-preference/ // Primary Mode = 2 // Default mode. All operations read from the current replica set primary. PrimaryPreferred Mode = 3 // Read from the primary if available. Read from the secondary otherwise. Secondary Mode = 4 // Read from one of the nearest secondary members of the replica set. SecondaryPreferred Mode = 5 // Read from one of the nearest secondaries if available. Read from primary otherwise. Nearest Mode = 6 // Read from one of the nearest members, irrespective of it being primary or secondary. // Read preference modes are specific to mgo: Eventual Mode = 0 // Same as Nearest, but may change servers between reads. Monotonic Mode = 1 // Same as SecondaryPreferred before first write. Same as Primary after first write. Strong Mode = 2 // Same as Primary. ) // mgo.v3: Drop Strong mode, suffix all modes with "Mode". // When changing the Session type, check if newSession and copySession // need to be updated too. // Session represents a communication session with the database. // // All Session methods are concurrency-safe and may be called from multiple // goroutines. In all session modes but Eventual, using the session from // multiple goroutines will cause them to share the same underlying socket. // See the documentation on Session.SetMode for more details. type Session struct { m sync.RWMutex cluster_ *mongoCluster slaveSocket *mongoSocket masterSocket *mongoSocket slaveOk bool consistency Mode queryConfig query safeOp *queryOp syncTimeout time.Duration sockTimeout time.Duration defaultdb string sourcedb string dialCred *Credential creds []Credential poolLimit int bypassValidation bool } type Database struct { Session *Session Name string } type Collection struct { Database *Database Name string // "collection" FullName string // "db.collection" } type Query struct { m sync.Mutex session *Session query // Enables default settings in session. } type query struct { op queryOp prefetch float64 limit int32 } type getLastError struct { CmdName int "getLastError,omitempty" W interface{} "w,omitempty" WTimeout int "wtimeout,omitempty" FSync bool "fsync,omitempty" J bool "j,omitempty" } type Iter struct { m sync.Mutex gotReply sync.Cond session *Session server *mongoServer docData queue err error op getMoreOp prefetch float64 limit int32 docsToReceive int docsBeforeMore int timeout time.Duration timedout bool findCmd bool } var ( ErrNotFound = errors.New("not found") ErrCursor = errors.New("invalid cursor") ) const defaultPrefetch = 0.25 // Dial establishes a new session to the cluster identified by the given seed // server(s). The session will enable communication with all of the servers in // the cluster, so the seed servers are used only to find out about the cluster // topology. // // Dial will timeout after 10 seconds if a server isn't reached. The returned // session will timeout operations after one minute by default if servers // aren't available. To customize the timeout, see DialWithTimeout, // SetSyncTimeout, and SetSocketTimeout. // // This method is generally called just once for a given cluster. Further // sessions to the same cluster are then established using the New or Copy // methods on the obtained session. This will make them share the underlying // cluster, and manage the pool of connections appropriately. // // Once the session is not useful anymore, Close must be called to release the // resources appropriately. // // The seed servers must be provided in the following format: // // [mongodb://][user:pass@]host1[:port1][,host2[:port2],...][/database][?options] // // For example, it may be as simple as: // // localhost // // Or more involved like: // // mongodb://myuser:mypass@localhost:40001,otherhost:40001/mydb // // If the port number is not provided for a server, it defaults to 27017. // // The username and password provided in the URL will be used to authenticate // into the database named after the slash at the end of the host names, or // into the "admin" database if none is provided. The authentication information // will persist in sessions obtained through the New method as well. // // The following connection options are supported after the question mark: // // connect=direct // // Disables the automatic replica set server discovery logic, and // forces the use of servers provided only (even if secondaries). // Note that to talk to a secondary the consistency requirements // must be relaxed to Monotonic or Eventual via SetMode. // // // connect=replicaSet // // Discover replica sets automatically. Default connection behavior. // // // replicaSet=<setname> // // If specified will prevent the obtained session from communicating // with any server which is not part of a replica set with the given name. // The default is to communicate with any server specified or discovered // via the servers contacted. // // // authSource=<db> // // Informs the database used to establish credentials and privileges // with a MongoDB server. Defaults to the database name provided via // the URL path, and "admin" if that's unset. // // // authMechanism=<mechanism> // // Defines the protocol for credential negotiation. Defaults to "MONGODB-CR", // which is the default username/password challenge-response mechanism. // // // gssapiServiceName=<name> // // Defines the service name to use when authenticating with the GSSAPI // mechanism. Defaults to "mongodb". // // // maxPoolSize=<limit> // // Defines the per-server socket pool limit. Defaults to 4096. // See Session.SetPoolLimit for details. // // // Relevant documentation: // // http://docs.mongodb.org/manual/reference/connection-string/ // func Dial(url string) (*Session, error) { session, err := DialWithTimeout(url, 10*time.Second) if err == nil { session.SetSyncTimeout(1 * time.Minute) session.SetSocketTimeout(1 * time.Minute) } return session, err } // DialWithTimeout works like Dial, but uses timeout as the amount of time to // wait for a server to respond when first connecting and also on follow up // operations in the session. If timeout is zero, the call may block // forever waiting for a connection to be made. // // See SetSyncTimeout for customizing the timeout for the session. func DialWithTimeout(url string, timeout time.Duration) (*Session, error) { info, err := ParseURL(url) if err != nil { return nil, err } info.Timeout = timeout return DialWithInfo(info) } // ParseURL parses a MongoDB URL as accepted by the Dial function and returns // a value suitable for providing into DialWithInfo. // // See Dial for more details on the format of url. func ParseURL(url string) (*DialInfo, error) { uinfo, err := extractURL(url) if err != nil { return nil, err } direct := false mechanism := "" service := "" source := "" setName := "" poolLimit := 0 for k, v := range uinfo.options { switch k { case "authSource": source = v case "authMechanism": mechanism = v case "gssapiServiceName": service = v case "replicaSet": setName = v case "maxPoolSize": poolLimit, err = strconv.Atoi(v) if err != nil { return nil, errors.New("bad value for maxPoolSize: " + v) } case "connect": if v == "direct" { direct = true break } if v == "replicaSet" { break } fallthrough default: return nil, errors.New("unsupported connection URL option: " + k + "=" + v) } } info := DialInfo{ Addrs: uinfo.addrs, Direct: direct, Database: uinfo.db, Username: uinfo.user, Password: uinfo.pass, Mechanism: mechanism, Service: service, Source: source, PoolLimit: poolLimit, ReplicaSetName: setName, } return &info, nil } // DialInfo holds options for establishing a session with a MongoDB cluster. // To use a URL, see the Dial function. type DialInfo struct { // Addrs holds the addresses for the seed servers. Addrs []string // Direct informs whether to establish connections only with the // specified seed servers, or to obtain information for the whole // cluster and establish connections with further servers too. Direct bool // Timeout is the amount of time to wait for a server to respond when // first connecting and on follow up operations in the session. If // timeout is zero, the call may block forever waiting for a connection // to be established. Timeout does not affect logic in DialServer. Timeout time.Duration // FailFast will cause connection and query attempts to fail faster when // the server is unavailable, instead of retrying until the configured // timeout period. Note that an unavailable server may silently drop // packets instead of rejecting them, in which case it's impossible to // distinguish it from a slow server, so the timeout stays relevant. FailFast bool // Database is the default database name used when the Session.DB method // is called with an empty name, and is also used during the initial // authentication if Source is unset. Database string // ReplicaSetName, if specified, will prevent the obtained session from // communicating with any server which is not part of a replica set // with the given name. The default is to communicate with any server // specified or discovered via the servers contacted. ReplicaSetName string // Source is the database used to establish credentials and privileges // with a MongoDB server. Defaults to the value of Database, if that is // set, or "admin" otherwise. Source string // Service defines the service name to use when authenticating with the GSSAPI // mechanism. Defaults to "mongodb". Service string // ServiceHost defines which hostname to use when authenticating // with the GSSAPI mechanism. If not specified, defaults to the MongoDB // server's address. ServiceHost string // Mechanism defines the protocol for credential negotiation. // Defaults to "MONGODB-CR". Mechanism string // Username and Password inform the credentials for the initial authentication // done on the database defined by the Source field. See Session.Login. Username string Password string // PoolLimit defines the per-server socket pool limit. Defaults to 4096. // See Session.SetPoolLimit for details. PoolLimit int // DialServer optionally specifies the dial function for establishing // connections with the MongoDB servers. DialServer func(addr *ServerAddr) (net.Conn, error) // WARNING: This field is obsolete. See DialServer above. Dial func(addr net.Addr) (net.Conn, error) } // mgo.v3: Drop DialInfo.Dial. // ServerAddr represents the address for establishing a connection to an // individual MongoDB server. type ServerAddr struct { str string tcp *net.TCPAddr } // String returns the address that was provided for the server before resolution. func (addr *ServerAddr) String() string { return addr.str } // TCPAddr returns the resolved TCP address for the server. func (addr *ServerAddr) TCPAddr() *net.TCPAddr { return addr.tcp } // DialWithInfo establishes a new session to the cluster identified by info. func DialWithInfo(info *DialInfo) (*Session, error) { addrs := make([]string, len(info.Addrs)) for i, addr := range info.Addrs { p := strings.LastIndexAny(addr, "]:") if p == -1 || addr[p] != ':' { // XXX This is untested. The test suite doesn't use the standard port. addr += ":27017" } addrs[i] = addr } cluster := newCluster(addrs, info.Direct, info.FailFast, dialer{info.Dial, info.DialServer}, info.ReplicaSetName) session := newSession(Eventual, cluster, info.Timeout) session.defaultdb = info.Database if session.defaultdb == "" { session.defaultdb = "test" } session.sourcedb = info.Source if session.sourcedb == "" { session.sourcedb = info.Database if session.sourcedb == "" { session.sourcedb = "admin" } } if info.Username != "" { source := session.sourcedb if info.Source == "" && (info.Mechanism == "GSSAPI" || info.Mechanism == "PLAIN" || info.Mechanism == "MONGODB-X509") { source = "$external" } session.dialCred = &Credential{ Username: info.Username, Password: info.Password, Mechanism: info.Mechanism, Service: info.Service, ServiceHost: info.ServiceHost, Source: source, } session.creds = []Credential{*session.dialCred} } if info.PoolLimit > 0 { session.poolLimit = info.PoolLimit } cluster.Release() // People get confused when we return a session that is not actually // established to any servers yet (e.g. what if url was wrong). So, // ping the server to ensure there's someone there, and abort if it // fails. if err := session.Ping(); err != nil { session.Close() return nil, err } session.SetMode(Strong, true) return session, nil } func isOptSep(c rune) bool { return c == ';' || c == '&' } type urlInfo struct { addrs []string user string pass string db string options map[string]string } func extractURL(s string) (*urlInfo, error) { if strings.HasPrefix(s, "mongodb://") { s = s[10:] } info := &urlInfo{options: make(map[string]string)} if c := strings.Index(s, "?"); c != -1 { for _, pair := range strings.FieldsFunc(s[c+1:], isOptSep) { l := strings.SplitN(pair, "=", 2) if len(l) != 2 || l[0] == "" || l[1] == "" { return nil, errors.New("connection option must be key=value: " + pair) } info.options[l[0]] = l[1] } s = s[:c] } if c := strings.Index(s, "@"); c != -1 { pair := strings.SplitN(s[:c], ":", 2) if len(pair) > 2 || pair[0] == "" { return nil, errors.New("credentials must be provided as user:pass@host") } var err error info.user, err = url.QueryUnescape(pair[0]) if err != nil { return nil, fmt.Errorf("cannot unescape username in URL: %q", pair[0]) } if len(pair) > 1 { info.pass, err = url.QueryUnescape(pair[1]) if err != nil { return nil, fmt.Errorf("cannot unescape password in URL") } } s = s[c+1:] } if c := strings.Index(s, "/"); c != -1 { info.db = s[c+1:] s = s[:c] } info.addrs = strings.Split(s, ",") return info, nil } func newSession(consistency Mode, cluster *mongoCluster, timeout time.Duration) (session *Session) { cluster.Acquire() session = &Session{ cluster_: cluster, syncTimeout: timeout, sockTimeout: timeout, poolLimit: 4096, } debugf("New session %p on cluster %p", session, cluster) session.SetMode(consistency, true) session.SetSafe(&Safe{}) session.queryConfig.prefetch = defaultPrefetch return session } func copySession(session *Session, keepCreds bool) (s *Session) { cluster := session.cluster() cluster.Acquire() if session.masterSocket != nil { session.masterSocket.Acquire() } if session.slaveSocket != nil { session.slaveSocket.Acquire() } var creds []Credential if keepCreds { creds = make([]Credential, len(session.creds)) copy(creds, session.creds) } else if session.dialCred != nil { creds = []Credential{*session.dialCred} } scopy := *session scopy.m = sync.RWMutex{} scopy.creds = creds s = &scopy debugf("New session %p on cluster %p (copy from %p)", s, cluster, session) return s } // LiveServers returns a list of server addresses which are // currently known to be alive. func (s *Session) LiveServers() (addrs []string) { s.m.RLock() addrs = s.cluster().LiveServers() s.m.RUnlock() return addrs } // DB returns a value representing the named database. If name // is empty, the database name provided in the dialed URL is // used instead. If that is also empty, "test" is used as a // fallback in a way equivalent to the mongo shell. // // Creating this value is a very lightweight operation, and // involves no network communication. func (s *Session) DB(name string) *Database { if name == "" { name = s.defaultdb } return &Database{s, name} } // C returns a value representing the named collection. // // Creating this value is a very lightweight operation, and // involves no network communication. func (db *Database) C(name string) *Collection { return &Collection{db, name, db.Name + "." + name} } // With returns a copy of db that uses session s. func (db *Database) With(s *Session) *Database { newdb := *db newdb.Session = s return &newdb } // With returns a copy of c that uses session s. func (c *Collection) With(s *Session) *Collection { newdb := *c.Database newdb.Session = s newc := *c newc.Database = &newdb return &newc } // GridFS returns a GridFS value representing collections in db that // follow the standard GridFS specification. // The provided prefix (sometimes known as root) will determine which // collections to use, and is usually set to "fs" when there is a // single GridFS in the database. // // See the GridFS Create, Open, and OpenId methods for more details. // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/GridFS // http://www.mongodb.org/display/DOCS/GridFS+Tools // http://www.mongodb.org/display/DOCS/GridFS+Specification // func (db *Database) GridFS(prefix string) *GridFS { return newGridFS(db, prefix) } // Run issues the provided command on the db database and unmarshals // its result in the respective argument. The cmd argument may be either // a string with the command name itself, in which case an empty document of // the form bson.M{cmd: 1} will be used, or it may be a full command document. // // Note that MongoDB considers the first marshalled key as the command // name, so when providing a command with options, it's important to // use an ordering-preserving document, such as a struct value or an // instance of bson.D. For instance: // // db.Run(bson.D{{"create", "mycollection"}, {"size", 1024}}) // // For privilleged commands typically run on the "admin" database, see // the Run method in the Session type. // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/Commands // http://www.mongodb.org/display/DOCS/List+of+Database+CommandSkips // func (db *Database) Run(cmd interface{}, result interface{}) error { socket, err := db.Session.acquireSocket(true) if err != nil { return err } defer socket.Release() // This is an optimized form of db.C("$cmd").Find(cmd).One(result). return db.run(socket, cmd, result) } // Credential holds details to authenticate with a MongoDB server. type Credential struct { // Username and Password hold the basic details for authentication. // Password is optional with some authentication mechanisms. Username string Password string // Source is the database used to establish credentials and privileges // with a MongoDB server. Defaults to the default database provided // during dial, or "admin" if that was unset. Source string // Service defines the service name to use when authenticating with the GSSAPI // mechanism. Defaults to "mongodb". Service string // ServiceHost defines which hostname to use when authenticating // with the GSSAPI mechanism. If not specified, defaults to the MongoDB // server's address. ServiceHost string // Mechanism defines the protocol for credential negotiation. // Defaults to "MONGODB-CR". Mechanism string } // Login authenticates with MongoDB using the provided credential. The // authentication is valid for the whole session and will stay valid until // Logout is explicitly called for the same database, or the session is // closed. func (db *Database) Login(user, pass string) error { return db.Session.Login(&Credential{Username: user, Password: pass, Source: db.Name}) } // Login authenticates with MongoDB using the provided credential. The // authentication is valid for the whole session and will stay valid until // Logout is explicitly called for the same database, or the session is // closed. func (s *Session) Login(cred *Credential) error { socket, err := s.acquireSocket(true) if err != nil { return err } defer socket.Release() credCopy := *cred if cred.Source == "" { if cred.Mechanism == "GSSAPI" { credCopy.Source = "$external" } else { credCopy.Source = s.sourcedb } } err = socket.Login(credCopy) if err != nil { return err } s.m.Lock() s.creds = append(s.creds, credCopy) s.m.Unlock() return nil } func (s *Session) socketLogin(socket *mongoSocket) error { for _, cred := range s.creds { if err := socket.Login(cred); err != nil { return err } } return nil } // Logout removes any established authentication credentials for the database. func (db *Database) Logout() { session := db.Session dbname := db.Name session.m.Lock() found := false for i, cred := range session.creds { if cred.Source == dbname { copy(session.creds[i:], session.creds[i+1:]) session.creds = session.creds[:len(session.creds)-1] found = true break } } if found { if session.masterSocket != nil { session.masterSocket.Logout(dbname) } if session.slaveSocket != nil { session.slaveSocket.Logout(dbname) } } session.m.Unlock() } // LogoutAll removes all established authentication credentials for the session. func (s *Session) LogoutAll() { s.m.Lock() for _, cred := range s.creds { if s.masterSocket != nil { s.masterSocket.Logout(cred.Source) } if s.slaveSocket != nil { s.slaveSocket.Logout(cred.Source) } } s.creds = s.creds[0:0] s.m.Unlock() } // User represents a MongoDB user. // // Relevant documentation: // // http://docs.mongodb.org/manual/reference/privilege-documents/ // http://docs.mongodb.org/manual/reference/user-privileges/ // type User struct { // Username is how the user identifies itself to the system. Username string `bson:"user"` // Password is the plaintext password for the user. If set, // the UpsertUser method will hash it into PasswordHash and // unset it before the user is added to the database. Password string `bson:",omitempty"` // PasswordHash is the MD5 hash of Username+":mongo:"+Password. PasswordHash string `bson:"pwd,omitempty"` // CustomData holds arbitrary data admins decide to associate // with this user, such as the full name or employee id. CustomData interface{} `bson:"customData,omitempty"` // Roles indicates the set of roles the user will be provided. // See the Role constants. Roles []Role `bson:"roles"` // OtherDBRoles allows assigning roles in other databases from // user documents inserted in the admin database. This field // only works in the admin database. OtherDBRoles map[string][]Role `bson:"otherDBRoles,omitempty"` // UserSource indicates where to look for this user's credentials. // It may be set to a database name, or to "$external" for // consulting an external resource such as Kerberos. UserSource // must not be set if Password or PasswordHash are present. // // WARNING: This setting was only ever supported in MongoDB 2.4, // and is now obsolete. UserSource string `bson:"userSource,omitempty"` } type Role string const ( // Relevant documentation: // // http://docs.mongodb.org/manual/reference/user-privileges/ // RoleRoot Role = "root" RoleRead Role = "read" RoleReadAny Role = "readAnyDatabase" RoleReadWrite Role = "readWrite" RoleReadWriteAny Role = "readWriteAnyDatabase" RoleDBAdmin Role = "dbAdmin" RoleDBAdminAny Role = "dbAdminAnyDatabase" RoleUserAdmin Role = "userAdmin" RoleUserAdminAny Role = "userAdminAnyDatabase" RoleClusterAdmin Role = "clusterAdmin" ) // UpsertUser updates the authentication credentials and the roles for // a MongoDB user within the db database. If the named user doesn't exist // it will be created. // // This method should only be used from MongoDB 2.4 and on. For older // MongoDB releases, use the obsolete AddUser method instead. // // Relevant documentation: // // http://docs.mongodb.org/manual/reference/user-privileges/ // http://docs.mongodb.org/manual/reference/privilege-documents/ // func (db *Database) UpsertUser(user *User) error { if user.Username == "" { return fmt.Errorf("user has no Username") } if (user.Password != "" || user.PasswordHash != "") && user.UserSource != "" { return fmt.Errorf("user has both Password/PasswordHash and UserSource set") } if len(user.OtherDBRoles) > 0 && db.Name != "admin" && db.Name != "$external" { return fmt.Errorf("user with OtherDBRoles is only supported in the admin or $external databases") } // Attempt to run this using 2.6+ commands. rundb := db if user.UserSource != "" { // Compatibility logic for the userSource field of MongoDB <= 2.4.X rundb = db.Session.DB(user.UserSource) } err := rundb.runUserCmd("updateUser", user) // retry with createUser when isAuthError in order to enable the "localhost exception" if isNotFound(err) || isAuthError(err) { return rundb.runUserCmd("createUser", user) } if !isNoCmd(err) { return err } // Command does not exist. Fallback to pre-2.6 behavior. var set, unset bson.D if user.Password != "" { psum := md5.New() psum.Write([]byte(user.Username + ":mongo:" + user.Password)) set = append(set, bson.DocElem{"pwd", hex.EncodeToString(psum.Sum(nil))}) unset = append(unset, bson.DocElem{"userSource", 1}) } else if user.PasswordHash != "" { set = append(set, bson.DocElem{"pwd", user.PasswordHash}) unset = append(unset, bson.DocElem{"userSource", 1}) } if user.UserSource != "" { set = append(set, bson.DocElem{"userSource", user.UserSource}) unset = append(unset, bson.DocElem{"pwd", 1}) } if user.Roles != nil || user.OtherDBRoles != nil { set = append(set, bson.DocElem{"roles", user.Roles}) if len(user.OtherDBRoles) > 0 { set = append(set, bson.DocElem{"otherDBRoles", user.OtherDBRoles}) } else { unset = append(unset, bson.DocElem{"otherDBRoles", 1}) } } users := db.C("system.users") err = users.Update(bson.D{{"user", user.Username}}, bson.D{{"$unset", unset}, {"$set", set}}) if err == ErrNotFound { set = append(set, bson.DocElem{"user", user.Username}) if user.Roles == nil && user.OtherDBRoles == nil { // Roles must be sent, as it's the way MongoDB distinguishes // old-style documents from new-style documents in pre-2.6. set = append(set, bson.DocElem{"roles", user.Roles}) } err = users.Insert(set) } return err } func isNoCmd(err error) bool { e, ok := err.(*QueryError) return ok && (e.Code == 59 || e.Code == 13390 || strings.HasPrefix(e.Message, "no such cmd:")) } func isNotFound(err error) bool { e, ok := err.(*QueryError) return ok && e.Code == 11 } func isAuthError(err error) bool { e, ok := err.(*QueryError) return ok && e.Code == 13 } func (db *Database) runUserCmd(cmdName string, user *User) error { cmd := make(bson.D, 0, 16) cmd = append(cmd, bson.DocElem{cmdName, user.Username}) if user.Password != "" { cmd = append(cmd, bson.DocElem{"pwd", user.Password}) } var roles []interface{} for _, role := range user.Roles { roles = append(roles, role) } for db, dbroles := range user.OtherDBRoles { for _, role := range dbroles { roles = append(roles, bson.D{{"role", role}, {"db", db}}) } } if roles != nil || user.Roles != nil || cmdName == "createUser" { cmd = append(cmd, bson.DocElem{"roles", roles}) } err := db.Run(cmd, nil) if !isNoCmd(err) && user.UserSource != "" && (user.UserSource != "$external" || db.Name != "$external") { return fmt.Errorf("MongoDB 2.6+ does not support the UserSource setting") } return err } // AddUser creates or updates the authentication credentials of user within // the db database. // // WARNING: This method is obsolete and should only be used with MongoDB 2.2 // or earlier. For MongoDB 2.4 and on, use UpsertUser instead. func (db *Database) AddUser(username, password string, readOnly bool) error { // Try to emulate the old behavior on 2.6+ user := &User{Username: username, Password: password} if db.Name == "admin" { if readOnly { user.Roles = []Role{RoleReadAny} } else { user.Roles = []Role{RoleReadWriteAny} } } else { if readOnly { user.Roles = []Role{RoleRead} } else { user.Roles = []Role{RoleReadWrite} } } err := db.runUserCmd("updateUser", user) if isNotFound(err) { return db.runUserCmd("createUser", user) } if !isNoCmd(err) { return err } // Command doesn't exist. Fallback to pre-2.6 behavior. psum := md5.New() psum.Write([]byte(username + ":mongo:" + password)) digest := hex.EncodeToString(psum.Sum(nil)) c := db.C("system.users") _, err = c.Upsert(bson.M{"user": username}, bson.M{"$set": bson.M{"user": username, "pwd": digest, "readOnly": readOnly}}) return err } // RemoveUser removes the authentication credentials of user from the database. func (db *Database) RemoveUser(user string) error { err := db.Run(bson.D{{"dropUser", user}}, nil) if isNoCmd(err) { users := db.C("system.users") return users.Remove(bson.M{"user": user}) } if isNotFound(err) { return ErrNotFound } return err } type indexSpec struct { Name, NS string Key bson.D Unique bool ",omitempty" DropDups bool "dropDups,omitempty" Background bool ",omitempty" Sparse bool ",omitempty" Bits int ",omitempty" Min, Max float64 ",omitempty" BucketSize float64 "bucketSize,omitempty" ExpireAfter int "expireAfterSeconds,omitempty" Weights bson.D ",omitempty" DefaultLanguage string "default_language,omitempty" LanguageOverride string "language_override,omitempty" TextIndexVersion int "textIndexVersion,omitempty" } type Index struct { Key []string // Index key fields; prefix name with dash (-) for descending order Unique bool // Prevent two documents from having the same index key DropDups bool // Drop documents with the same index key as a previously indexed one Background bool // Build index in background and return immediately Sparse bool // Only index documents containing the Key fields // If ExpireAfter is defined the server will periodically delete // documents with indexed time.Time older than the provided delta. ExpireAfter time.Duration // Name holds the stored index name. On creation if this field is unset it is // computed by EnsureIndex based on the index key. Name string // Properties for spatial indexes. // // Min and Max were improperly typed as int when they should have been // floats. To preserve backwards compatibility they are still typed as // int and the following two fields enable reading and writing the same // fields as float numbers. In mgo.v3, these fields will be dropped and // Min/Max will become floats. Min, Max int Minf, Maxf float64 BucketSize float64 Bits int // Properties for text indexes. DefaultLanguage string LanguageOverride string // Weights defines the significance of provided fields relative to other // fields in a text index. The score for a given word in a document is derived // from the weighted sum of the frequency for each of the indexed fields in // that document. The default field weight is 1. Weights map[string]int } // mgo.v3: Drop Minf and Maxf and transform Min and Max to floats. // mgo.v3: Drop DropDups as it's unsupported past 2.8. type indexKeyInfo struct { name string key bson.D weights bson.D } func parseIndexKey(key []string) (*indexKeyInfo, error) { var keyInfo indexKeyInfo isText := false var order interface{} for _, field := range key { raw := field if keyInfo.name != "" { keyInfo.name += "_" } var kind string if field != "" { if field[0] == '$' { if c := strings.Index(field, ":"); c > 1 && c < len(field)-1 { kind = field[1:c] field = field[c+1:] keyInfo.name += field + "_" + kind } else { field = "\x00" } } switch field[0] { case 0: // Logic above failed. Reset and error. field = "" case '@': order = "2d" field = field[1:] // The shell used to render this field as key_ instead of key_2d, // and mgo followed suit. This has been fixed in recent server // releases, and mgo followed as well. keyInfo.name += field + "_2d" case '-': order = -1 field = field[1:] keyInfo.name += field + "_-1" case '+': field = field[1:] fallthrough default: if kind == "" { order = 1 keyInfo.name += field + "_1" } else { order = kind } } } if field == "" || kind != "" && order != kind { return nil, fmt.Errorf(`invalid index key: want "[$<kind>:][-]<field name>", got %q`, raw) } if kind == "text" { if !isText { keyInfo.key = append(keyInfo.key, bson.DocElem{"_fts", "text"}, bson.DocElem{"_ftsx", 1}) isText = true } keyInfo.weights = append(keyInfo.weights, bson.DocElem{field, 1}) } else { keyInfo.key = append(keyInfo.key, bson.DocElem{field, order}) } } if keyInfo.name == "" { return nil, errors.New("invalid index key: no fields provided") } return &keyInfo, nil } // EnsureIndexKey ensures an index with the given key exists, creating it // if necessary. // // This example: // // err := collection.EnsureIndexKey("a", "b") // // Is equivalent to: // // err := collection.EnsureIndex(mgo.Index{Key: []string{"a", "b"}}) // // See the EnsureIndex method for more details. func (c *Collection) EnsureIndexKey(key ...string) error { return c.EnsureIndex(Index{Key: key}) } // EnsureIndex ensures an index with the given key exists, creating it with // the provided parameters if necessary. EnsureIndex does not modify a previously // existent index with a matching key. The old index must be dropped first instead. // // Once EnsureIndex returns successfully, following requests for the same index // will not contact the server unless Collection.DropIndex is used to drop the // same index, or Session.ResetIndexCache is called. // // For example: // // index := Index{ // Key: []string{"lastname", "firstname"}, // Unique: true, // DropDups: true, // Background: true, // See notes. // Sparse: true, // } // err := collection.EnsureIndex(index) // // The Key value determines which fields compose the index. The index ordering // will be ascending by default. To obtain an index with a descending order, // the field name should be prefixed by a dash (e.g. []string{"-time"}). It can // also be optionally prefixed by an index kind, as in "$text:summary" or // "$2d:-point". The key string format is: // // [$<kind>:][-]<field name> // // If the Unique field is true, the index must necessarily contain only a single // document per Key. With DropDups set to true, documents with the same key // as a previously indexed one will be dropped rather than an error returned. // // If Background is true, other connections will be allowed to proceed using // the collection without the index while it's being built. Note that the // session executing EnsureIndex will be blocked for as long as it takes for // the index to be built. // // If Sparse is true, only documents containing the provided Key fields will be // included in the index. When using a sparse index for sorting, only indexed // documents will be returned. // // If ExpireAfter is non-zero, the server will periodically scan the collection // and remove documents containing an indexed time.Time field with a value // older than ExpireAfter. See the documentation for details: // // http://docs.mongodb.org/manual/tutorial/expire-data // // Other kinds of indexes are also supported through that API. Here is an example: // // index := Index{ // Key: []string{"$2d:loc"}, // Bits: 26, // } // err := collection.EnsureIndex(index) // // The example above requests the creation of a "2d" index for the "loc" field. // // The 2D index bounds may be changed using the Min and Max attributes of the // Index value. The default bound setting of (-180, 180) is suitable for // latitude/longitude pairs. // // The Bits parameter sets the precision of the 2D geohash values. If not // provided, 26 bits are used, which is roughly equivalent to 1 foot of // precision for the default (-180, 180) index bounds. // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/Indexes // http://www.mongodb.org/display/DOCS/Indexing+Advice+and+FAQ // http://www.mongodb.org/display/DOCS/Indexing+as+a+Background+Operation // http://www.mongodb.org/display/DOCS/Geospatial+Indexing // http://www.mongodb.org/display/DOCS/Multikeys // func (c *Collection) EnsureIndex(index Index) error { keyInfo, err := parseIndexKey(index.Key) if err != nil { return err } session := c.Database.Session cacheKey := c.FullName + "\x00" + keyInfo.name if session.cluster().HasCachedIndex(cacheKey) { return nil } spec := indexSpec{ Name: keyInfo.name, NS: c.FullName, Key: keyInfo.key, Unique: index.Unique, DropDups: index.DropDups, Background: index.Background, Sparse: index.Sparse, Bits: index.Bits, Min: index.Minf, Max: index.Maxf, BucketSize: index.BucketSize, ExpireAfter: int(index.ExpireAfter / time.Second), Weights: keyInfo.weights, DefaultLanguage: index.DefaultLanguage, LanguageOverride: index.LanguageOverride, } if spec.Min == 0 && spec.Max == 0 { spec.Min = float64(index.Min) spec.Max = float64(index.Max) } if index.Name != "" { spec.Name = index.Name } NextField: for name, weight := range index.Weights { for i, elem := range spec.Weights { if elem.Name == name { spec.Weights[i].Value = weight continue NextField } } panic("weight provided for field that is not part of index key: " + name) } cloned := session.Clone() defer cloned.Close() cloned.SetMode(Strong, false) cloned.EnsureSafe(&Safe{}) db := c.Database.With(cloned) // Try with a command first. err = db.Run(bson.D{{"createIndexes", c.Name}, {"indexes", []indexSpec{spec}}}, nil) if isNoCmd(err) { // Command not yet supported. Insert into the indexes collection instead. err = db.C("system.indexes").Insert(&spec) } if err == nil { session.cluster().CacheIndex(cacheKey, true) } return err } // DropIndex drops the index with the provided key from the c collection. // // See EnsureIndex for details on the accepted key variants. // // For example: // // err1 := collection.DropIndex("firstField", "-secondField") // err2 := collection.DropIndex("customIndexName") // func (c *Collection) DropIndex(key ...string) error { keyInfo, err := parseIndexKey(key) if err != nil { return err } session := c.Database.Session cacheKey := c.FullName + "\x00" + keyInfo.name session.cluster().CacheIndex(cacheKey, false) session = session.Clone() defer session.Close() session.SetMode(Strong, false) db := c.Database.With(session) result := struct { ErrMsg string Ok bool }{} err = db.Run(bson.D{{"dropIndexes", c.Name}, {"index", keyInfo.name}}, &result) if err != nil { return err } if !result.Ok { return errors.New(result.ErrMsg) } return nil } // DropIndexName removes the index with the provided index name. // // For example: // // err := collection.DropIndex("customIndexName") // func (c *Collection) DropIndexName(name string) error { session := c.Database.Session session = session.Clone() defer session.Close() session.SetMode(Strong, false) c = c.With(session) indexes, err := c.Indexes() if err != nil { return err } var index Index for _, idx := range indexes { if idx.Name == name { index = idx break } } if index.Name != "" { keyInfo, err := parseIndexKey(index.Key) if err != nil { return err } cacheKey := c.FullName + "\x00" + keyInfo.name session.cluster().CacheIndex(cacheKey, false) } result := struct { ErrMsg string Ok bool }{} err = c.Database.Run(bson.D{{"dropIndexes", c.Name}, {"index", name}}, &result) if err != nil { return err } if !result.Ok { return errors.New(result.ErrMsg) } return nil } // nonEventual returns a clone of session and ensures it is not Eventual. // This guarantees that the server that is used for queries may be reused // afterwards when a cursor is received. func (session *Session) nonEventual() *Session { cloned := session.Clone() if cloned.consistency == Eventual { cloned.SetMode(Monotonic, false) } return cloned } // Indexes returns a list of all indexes for the collection. // // For example, this snippet would drop all available indexes: // // indexes, err := collection.Indexes() // if err != nil { // return err // } // for _, index := range indexes { // err = collection.DropIndex(index.Key...) // if err != nil { // return err // } // } // // See the EnsureIndex method for more details on indexes. func (c *Collection) Indexes() (indexes []Index, err error) { cloned := c.Database.Session.nonEventual() defer cloned.Close() batchSize := int(cloned.queryConfig.op.limit) // Try with a command. var result struct { Indexes []bson.Raw Cursor cursorData } var iter *Iter err = c.Database.With(cloned).Run(bson.D{{"listIndexes", c.Name}, {"cursor", bson.D{{"batchSize", batchSize}}}}, &result) if err == nil { firstBatch := result.Indexes if firstBatch == nil { firstBatch = result.Cursor.FirstBatch } ns := strings.SplitN(result.Cursor.NS, ".", 2) if len(ns) < 2 { iter = c.With(cloned).NewIter(nil, firstBatch, result.Cursor.Id, nil) } else { iter = cloned.DB(ns[0]).C(ns[1]).NewIter(nil, firstBatch, result.Cursor.Id, nil) } } else if isNoCmd(err) { // Command not yet supported. Query the database instead. iter = c.Database.C("system.indexes").Find(bson.M{"ns": c.FullName}).Iter() } else { return nil, err } var spec indexSpec for iter.Next(&spec) { indexes = append(indexes, indexFromSpec(spec)) } if err = iter.Close(); err != nil { return nil, err } sort.Sort(indexSlice(indexes)) return indexes, nil } func indexFromSpec(spec indexSpec) Index { index := Index{ Name: spec.Name, Key: simpleIndexKey(spec.Key), Unique: spec.Unique, DropDups: spec.DropDups, Background: spec.Background, Sparse: spec.Sparse, Minf: spec.Min, Maxf: spec.Max, Bits: spec.Bits, BucketSize: spec.BucketSize, DefaultLanguage: spec.DefaultLanguage, LanguageOverride: spec.LanguageOverride, ExpireAfter: time.Duration(spec.ExpireAfter) * time.Second, } if float64(int(spec.Min)) == spec.Min && float64(int(spec.Max)) == spec.Max { index.Min = int(spec.Min) index.Max = int(spec.Max) } if spec.TextIndexVersion > 0 { index.Key = make([]string, len(spec.Weights)) index.Weights = make(map[string]int) for i, elem := range spec.Weights { index.Key[i] = "$text:" + elem.Name if w, ok := elem.Value.(int); ok { index.Weights[elem.Name] = w } } } return index } type indexSlice []Index func (idxs indexSlice) Len() int { return len(idxs) } func (idxs indexSlice) Less(i, j int) bool { return idxs[i].Name < idxs[j].Name } func (idxs indexSlice) Swap(i, j int) { idxs[i], idxs[j] = idxs[j], idxs[i] } func simpleIndexKey(realKey bson.D) (key []string) { for i := range realKey { field := realKey[i].Name vi, ok := realKey[i].Value.(int) if !ok { vf, _ := realKey[i].Value.(float64) vi = int(vf) } if vi == 1 { key = append(key, field) continue } if vi == -1 { key = append(key, "-"+field) continue } if vs, ok := realKey[i].Value.(string); ok { key = append(key, "$"+vs+":"+field) continue } panic("Got unknown index key type for field " + field) } return } // ResetIndexCache() clears the cache of previously ensured indexes. // Following requests to EnsureIndex will contact the server. func (s *Session) ResetIndexCache() { s.cluster().ResetIndexCache() } // New creates a new session with the same parameters as the original // session, including consistency, batch size, prefetching, safety mode, // etc. The returned session will use sockets from the pool, so there's // a chance that writes just performed in another session may not yet // be visible. // // Login information from the original session will not be copied over // into the new session unless it was provided through the initial URL // for the Dial function. // // See the Copy and Clone methods. // func (s *Session) New() *Session { s.m.Lock() scopy := copySession(s, false) s.m.Unlock() scopy.Refresh() return scopy } // Copy works just like New, but preserves the exact authentication // information from the original session. func (s *Session) Copy() *Session { s.m.Lock() scopy := copySession(s, true) s.m.Unlock() scopy.Refresh() return scopy } // Clone works just like Copy, but also reuses the same socket as the original // session, in case it had already reserved one due to its consistency // guarantees. This behavior ensures that writes performed in the old session // are necessarily observed when using the new session, as long as it was a // strong or monotonic session. That said, it also means that long operations // may cause other goroutines using the original session to wait. func (s *Session) Clone() *Session { s.m.Lock() scopy := copySession(s, true) s.m.Unlock() return scopy } // Close terminates the session. It's a runtime error to use a session // after it has been closed. func (s *Session) Close() { s.m.Lock() if s.cluster_ != nil { debugf("Closing session %p", s) s.unsetSocket() s.cluster_.Release() s.cluster_ = nil } s.m.Unlock() } func (s *Session) cluster() *mongoCluster { if s.cluster_ == nil { panic("Session already closed") } return s.cluster_ } // Refresh puts back any reserved sockets in use and restarts the consistency // guarantees according to the current consistency setting for the session. func (s *Session) Refresh() { s.m.Lock() s.slaveOk = s.consistency != Strong s.unsetSocket() s.m.Unlock() } // SetMode changes the consistency mode for the session. // // In the Strong consistency mode reads and writes will always be made to // the primary server using a unique connection so that reads and writes are // fully consistent, ordered, and observing the most up-to-date data. // This offers the least benefits in terms of distributing load, but the // most guarantees. See also Monotonic and Eventual. // // In the Monotonic consistency mode reads may not be entirely up-to-date, // but they will always see the history of changes moving forward, the data // read will be consistent across sequential queries in the same session, // and modifications made within the session will be observed in following // queries (read-your-writes). // // In practice, the Monotonic mode is obtained by performing initial reads // on a unique connection to an arbitrary secondary, if one is available, // and once the first write happens, the session connection is switched over // to the primary server. This manages to distribute some of the reading // load with secondaries, while maintaining some useful guarantees. // // In the Eventual consistency mode reads will be made to any secondary in the // cluster, if one is available, and sequential reads will not necessarily // be made with the same connection. This means that data may be observed // out of order. Writes will of course be issued to the primary, but // independent writes in the same Eventual session may also be made with // independent connections, so there are also no guarantees in terms of // write ordering (no read-your-writes guarantees either). // // The Eventual mode is the fastest and most resource-friendly, but is // also the one offering the least guarantees about ordering of the data // read and written. // // If refresh is true, in addition to ensuring the session is in the given // consistency mode, the consistency guarantees will also be reset (e.g. // a Monotonic session will be allowed to read from secondaries again). // This is equivalent to calling the Refresh function. // // Shifting between Monotonic and Strong modes will keep a previously // reserved connection for the session unless refresh is true or the // connection is unsuitable (to a secondary server in a Strong session). func (s *Session) SetMode(consistency Mode, refresh bool) { s.m.Lock() debugf("Session %p: setting mode %d with refresh=%v (master=%p, slave=%p)", s, consistency, refresh, s.masterSocket, s.slaveSocket) s.consistency = consistency if refresh { s.slaveOk = s.consistency != Strong s.unsetSocket() } else if s.consistency == Strong { s.slaveOk = false } else if s.masterSocket == nil { s.slaveOk = true } s.m.Unlock() } // Mode returns the current consistency mode for the session. func (s *Session) Mode() Mode { s.m.RLock() mode := s.consistency s.m.RUnlock() return mode } // SetSyncTimeout sets the amount of time an operation with this session // will wait before returning an error in case a connection to a usable // server can't be established. Set it to zero to wait forever. The // default value is 7 seconds. func (s *Session) SetSyncTimeout(d time.Duration) { s.m.Lock() s.syncTimeout = d s.m.Unlock() } // SetSocketTimeout sets the amount of time to wait for a non-responding // socket to the database before it is forcefully closed. func (s *Session) SetSocketTimeout(d time.Duration) { s.m.Lock() s.sockTimeout = d if s.masterSocket != nil { s.masterSocket.SetTimeout(d) } if s.slaveSocket != nil { s.slaveSocket.SetTimeout(d) } s.m.Unlock() } // SetCursorTimeout changes the standard timeout period that the server // enforces on created cursors. The only supported value right now is // 0, which disables the timeout. The standard server timeout is 10 minutes. func (s *Session) SetCursorTimeout(d time.Duration) { s.m.Lock() if d == 0 { s.queryConfig.op.flags |= flagNoCursorTimeout } else { panic("SetCursorTimeout: only 0 (disable timeout) supported for now") } s.m.Unlock() } // SetPoolLimit sets the maximum number of sockets in use in a single server // before this session will block waiting for a socket to be available. // The default limit is 4096. // // This limit must be set to cover more than any expected workload of the // application. It is a bad practice and an unsupported use case to use the // database driver to define the concurrency limit of an application. Prevent // such concurrency "at the door" instead, by properly restricting the amount // of used resources and number of goroutines before they are created. func (s *Session) SetPoolLimit(limit int) { s.m.Lock() s.poolLimit = limit s.m.Unlock() } // SetBypassValidation sets whether the server should bypass the registered // validation expressions executed when documents are inserted or modified, // in the interest of preserving invariants in the collection being modified. // The default is to not bypass, and thus to perform the validation // expressions registered for modified collections. // // Document validation was introuced in MongoDB 3.2. // // Relevant documentation: // // https://docs.mongodb.org/manual/release-notes/3.2/#bypass-validation // func (s *Session) SetBypassValidation(bypass bool) { s.m.Lock() s.bypassValidation = bypass s.m.Unlock() } // SetBatch sets the default batch size used when fetching documents from the // database. It's possible to change this setting on a per-query basis as // well, using the Query.Batch method. // // The default batch size is defined by the database itself. As of this // writing, MongoDB will use an initial size of min(100 docs, 4MB) on the // first batch, and 4MB on remaining ones. func (s *Session) SetBatch(n int) { if n == 1 { // Server interprets 1 as -1 and closes the cursor (!?) n = 2 } s.m.Lock() s.queryConfig.op.limit = int32(n) s.m.Unlock() } // SetPrefetch sets the default point at which the next batch of results will be // requested. When there are p*batch_size remaining documents cached in an // Iter, the next batch will be requested in background. For instance, when // using this: // // session.SetBatch(200) // session.SetPrefetch(0.25) // // and there are only 50 documents cached in the Iter to be processed, the // next batch of 200 will be requested. It's possible to change this setting on // a per-query basis as well, using the Prefetch method of Query. // // The default prefetch value is 0.25. func (s *Session) SetPrefetch(p float64) { s.m.Lock() s.queryConfig.prefetch = p s.m.Unlock() } // See SetSafe for details on the Safe type. type Safe struct { W int // Min # of servers to ack before success WMode string // Write mode for MongoDB 2.0+ (e.g. "majority") WTimeout int // Milliseconds to wait for W before timing out FSync bool // Sync via the journal if present, or via data files sync otherwise J bool // Sync via the journal if present } // Safe returns the current safety mode for the session. func (s *Session) Safe() (safe *Safe) { s.m.Lock() defer s.m.Unlock() if s.safeOp != nil { cmd := s.safeOp.query.(*getLastError) safe = &Safe{WTimeout: cmd.WTimeout, FSync: cmd.FSync, J: cmd.J} switch w := cmd.W.(type) { case string: safe.WMode = w case int: safe.W = w } } return } // SetSafe changes the session safety mode. // // If the safe parameter is nil, the session is put in unsafe mode, and writes // become fire-and-forget, without error checking. The unsafe mode is faster // since operations won't hold on waiting for a confirmation. // // If the safe parameter is not nil, any changing query (insert, update, ...) // will be followed by a getLastError command with the specified parameters, // to ensure the request was correctly processed. // // The safe.W parameter determines how many servers should confirm a write // before the operation is considered successful. If set to 0 or 1, the // command will return as soon as the primary is done with the request. // If safe.WTimeout is greater than zero, it determines how many milliseconds // to wait for the safe.W servers to respond before returning an error. // // Starting with MongoDB 2.0.0 the safe.WMode parameter can be used instead // of W to request for richer semantics. If set to "majority" the server will // wait for a majority of members from the replica set to respond before // returning. Custom modes may also be defined within the server to create // very detailed placement schemas. See the data awareness documentation in // the links below for more details (note that MongoDB internally reuses the // "w" field name for WMode). // // If safe.J is true, servers will block until write operations have been // committed to the journal. Cannot be used in combination with FSync. Prior // to MongoDB 2.6 this option was ignored if the server was running without // journaling. Starting with MongoDB 2.6 write operations will fail with an // exception if this option is used when the server is running without // journaling. // // If safe.FSync is true and the server is running without journaling, blocks // until the server has synced all data files to disk. If the server is running // with journaling, this acts the same as the J option, blocking until write // operations have been committed to the journal. Cannot be used in // combination with J. // // Since MongoDB 2.0.0, the safe.J option can also be used instead of FSync // to force the server to wait for a group commit in case journaling is // enabled. The option has no effect if the server has journaling disabled. // // For example, the following statement will make the session check for // errors, without imposing further constraints: // // session.SetSafe(&mgo.Safe{}) // // The following statement will force the server to wait for a majority of // members of a replica set to return (MongoDB 2.0+ only): // // session.SetSafe(&mgo.Safe{WMode: "majority"}) // // The following statement, on the other hand, ensures that at least two // servers have flushed the change to disk before confirming the success // of operations: // // session.EnsureSafe(&mgo.Safe{W: 2, FSync: true}) // // The following statement, on the other hand, disables the verification // of errors entirely: // // session.SetSafe(nil) // // See also the EnsureSafe method. // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/getLastError+Command // http://www.mongodb.org/display/DOCS/Verifying+Propagation+of+Writes+with+getLastError // http://www.mongodb.org/display/DOCS/Data+Center+Awareness // func (s *Session) SetSafe(safe *Safe) { s.m.Lock() s.safeOp = nil s.ensureSafe(safe) s.m.Unlock() } // EnsureSafe compares the provided safety parameters with the ones // currently in use by the session and picks the most conservative // choice for each setting. // // That is: // // - safe.WMode is always used if set. // - safe.W is used if larger than the current W and WMode is empty. // - safe.FSync is always used if true. // - safe.J is used if FSync is false. // - safe.WTimeout is used if set and smaller than the current WTimeout. // // For example, the following statement will ensure the session is // at least checking for errors, without enforcing further constraints. // If a more conservative SetSafe or EnsureSafe call was previously done, // the following call will be ignored. // // session.EnsureSafe(&mgo.Safe{}) // // See also the SetSafe method for details on what each option means. // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/getLastError+Command // http://www.mongodb.org/display/DOCS/Verifying+Propagation+of+Writes+with+getLastError // http://www.mongodb.org/display/DOCS/Data+Center+Awareness // func (s *Session) EnsureSafe(safe *Safe) { s.m.Lock() s.ensureSafe(safe) s.m.Unlock() } func (s *Session) ensureSafe(safe *Safe) { if safe == nil { return } var w interface{} if safe.WMode != "" { w = safe.WMode } else if safe.W > 0 { w = safe.W } var cmd getLastError if s.safeOp == nil { cmd = getLastError{1, w, safe.WTimeout, safe.FSync, safe.J} } else { // Copy. We don't want to mutate the existing query. cmd = *(s.safeOp.query.(*getLastError)) if cmd.W == nil { cmd.W = w } else if safe.WMode != "" { cmd.W = safe.WMode } else if i, ok := cmd.W.(int); ok && safe.W > i { cmd.W = safe.W } if safe.WTimeout > 0 && safe.WTimeout < cmd.WTimeout { cmd.WTimeout = safe.WTimeout } if safe.FSync { cmd.FSync = true cmd.J = false } else if safe.J && !cmd.FSync { cmd.J = true } } s.safeOp = &queryOp{ query: &cmd, collection: "admin.$cmd", limit: -1, } } // Run issues the provided command on the "admin" database and // and unmarshals its result in the respective argument. The cmd // argument may be either a string with the command name itself, in // which case an empty document of the form bson.M{cmd: 1} will be used, // or it may be a full command document. // // Note that MongoDB considers the first marshalled key as the command // name, so when providing a command with options, it's important to // use an ordering-preserving document, such as a struct value or an // instance of bson.D. For instance: // // db.Run(bson.D{{"create", "mycollection"}, {"size", 1024}}) // // For commands on arbitrary databases, see the Run method in // the Database type. // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/Commands // http://www.mongodb.org/display/DOCS/List+of+Database+CommandSkips // func (s *Session) Run(cmd interface{}, result interface{}) error { return s.DB("admin").Run(cmd, result) } // SelectServers restricts communication to servers configured with the // given tags. For example, the following statement restricts servers // used for reading operations to those with both tag "disk" set to // "ssd" and tag "rack" set to 1: // // session.SelectServers(bson.D{{"disk", "ssd"}, {"rack", 1}}) // // Multiple sets of tags may be provided, in which case the used server // must match all tags within any one set. // // If a connection was previously assigned to the session due to the // current session mode (see Session.SetMode), the tag selection will // only be enforced after the session is refreshed. // // Relevant documentation: // // http://docs.mongodb.org/manual/tutorial/configure-replica-set-tag-sets // func (s *Session) SelectServers(tags ...bson.D) { s.m.Lock() s.queryConfig.op.serverTags = tags s.m.Unlock() } // Ping runs a trivial ping command just to get in touch with the server. func (s *Session) Ping() error { return s.Run("ping", nil) } // Fsync flushes in-memory writes to disk on the server the session // is established with. If async is true, the call returns immediately, // otherwise it returns after the flush has been made. func (s *Session) Fsync(async bool) error { return s.Run(bson.D{{"fsync", 1}, {"async", async}}, nil) } // FsyncLock locks all writes in the specific server the session is // established with and returns. Any writes attempted to the server // after it is successfully locked will block until FsyncUnlock is // called for the same server. // // This method works on secondaries as well, preventing the oplog from // being flushed while the server is locked, but since only the server // connected to is locked, for locking specific secondaries it may be // necessary to establish a connection directly to the secondary (see // Dial's connect=direct option). // // As an important caveat, note that once a write is attempted and // blocks, follow up reads will block as well due to the way the // lock is internally implemented in the server. More details at: // // https://jira.mongodb.org/browse/SERVER-4243 // // FsyncLock is often used for performing consistent backups of // the database files on disk. // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/fsync+Command // http://www.mongodb.org/display/DOCS/Backups // func (s *Session) FsyncLock() error { return s.Run(bson.D{{"fsync", 1}, {"lock", true}}, nil) } // FsyncUnlock releases the server for writes. See FsyncLock for details. func (s *Session) FsyncUnlock() error { err := s.Run(bson.D{{"fsyncUnlock", 1}}, nil) if isNoCmd(err) { err = s.DB("admin").C("$cmd.sys.unlock").Find(nil).One(nil) // WTF? } return err } // Find prepares a query using the provided document. The document may be a // map or a struct value capable of being marshalled with bson. The map // may be a generic one using interface{} for its key and/or values, such as // bson.M, or it may be a properly typed map. Providing nil as the document // is equivalent to providing an empty document such as bson.M{}. // // Further details of the query may be tweaked using the resulting Query value, // and then executed to retrieve results using methods such as One, For, // Iter, or Tail. // // In case the resulting document includes a field named $err or errmsg, which // are standard ways for MongoDB to return query errors, the returned err will // be set to a *QueryError value including the Err message and the Code. In // those cases, the result argument is still unmarshalled into with the // received document so that any other custom values may be obtained if // desired. // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/Querying // http://www.mongodb.org/display/DOCS/Advanced+Queries // func (c *Collection) Find(query interface{}) *Query { session := c.Database.Session session.m.RLock() q := &Query{session: session, query: session.queryConfig} session.m.RUnlock() q.op.query = query q.op.collection = c.FullName return q } type repairCmd struct { RepairCursor string `bson:"repairCursor"` Cursor *repairCmdCursor ",omitempty" } type repairCmdCursor struct { BatchSize int `bson:"batchSize,omitempty"` } // Repair returns an iterator that goes over all recovered documents in the // collection, in a best-effort manner. This is most useful when there are // damaged data files. Multiple copies of the same document may be returned // by the iterator. // // Repair is supported in MongoDB 2.7.8 and later. func (c *Collection) Repair() *Iter { // Clone session and set it to Monotonic mode so that the server // used for the query may be safely obtained afterwards, if // necessary for iteration when a cursor is received. session := c.Database.Session cloned := session.nonEventual() defer cloned.Close() batchSize := int(cloned.queryConfig.op.limit) var result struct{ Cursor cursorData } cmd := repairCmd{ RepairCursor: c.Name, Cursor: &repairCmdCursor{batchSize}, } clonedc := c.With(cloned) err := clonedc.Database.Run(cmd, &result) return clonedc.NewIter(session, result.Cursor.FirstBatch, result.Cursor.Id, err) } // FindId is a convenience helper equivalent to: // // query := collection.Find(bson.M{"_id": id}) // // See the Find method for more details. func (c *Collection) FindId(id interface{}) *Query { return c.Find(bson.D{{"_id", id}}) } type Pipe struct { session *Session collection *Collection pipeline interface{} allowDisk bool batchSize int } type pipeCmd struct { Aggregate string Pipeline interface{} Cursor *pipeCmdCursor ",omitempty" Explain bool ",omitempty" AllowDisk bool "allowDiskUse,omitempty" } type pipeCmdCursor struct { BatchSize int `bson:"batchSize,omitempty"` } // Pipe prepares a pipeline to aggregate. The pipeline document // must be a slice built in terms of the aggregation framework language. // // For example: // // pipe := collection.Pipe([]bson.M{{"$match": bson.M{"name": "Otavio"}}}) // iter := pipe.Iter() // // Relevant documentation: // // http://docs.mongodb.org/manual/reference/aggregation // http://docs.mongodb.org/manual/applications/aggregation // http://docs.mongodb.org/manual/tutorial/aggregation-examples // func (c *Collection) Pipe(pipeline interface{}) *Pipe { session := c.Database.Session session.m.RLock() batchSize := int(session.queryConfig.op.limit) session.m.RUnlock() return &Pipe{ session: session, collection: c, pipeline: pipeline, batchSize: batchSize, } } // Iter executes the pipeline and returns an iterator capable of going // over all the generated results. func (p *Pipe) Iter() *Iter { // Clone session and set it to Monotonic mode so that the server // used for the query may be safely obtained afterwards, if // necessary for iteration when a cursor is received. cloned := p.session.nonEventual() defer cloned.Close() c := p.collection.With(cloned) var result struct { Result []bson.Raw // 2.4, no cursors. Cursor cursorData // 2.6+, with cursors. } cmd := pipeCmd{ Aggregate: c.Name, Pipeline: p.pipeline, AllowDisk: p.allowDisk, Cursor: &pipeCmdCursor{p.batchSize}, } err := c.Database.Run(cmd, &result) if e, ok := err.(*QueryError); ok && e.Message == `unrecognized field "cursor` { cmd.Cursor = nil cmd.AllowDisk = false err = c.Database.Run(cmd, &result) } firstBatch := result.Result if firstBatch == nil { firstBatch = result.Cursor.FirstBatch } return c.NewIter(p.session, firstBatch, result.Cursor.Id, err) } // NewIter returns a newly created iterator with the provided parameters. // Using this method is not recommended unless the desired functionality // is not yet exposed via a more convenient interface (Find, Pipe, etc). // // The optional session parameter associates the lifetime of the returned // iterator to an arbitrary session. If nil, the iterator will be bound to // c's session. // // Documents in firstBatch will be individually provided by the returned // iterator before documents from cursorId are made available. If cursorId // is zero, only the documents in firstBatch are provided. // // If err is not nil, the iterator's Err method will report it after // exhausting documents in firstBatch. // // NewIter must be called right after the cursor id is obtained, and must not // be called on a collection in Eventual mode, because the cursor id is // associated with the specific server that returned it. The provided session // parameter may be in any mode or state, though. // func (c *Collection) NewIter(session *Session, firstBatch []bson.Raw, cursorId int64, err error) *Iter { var server *mongoServer csession := c.Database.Session csession.m.RLock() socket := csession.masterSocket if socket == nil { socket = csession.slaveSocket } if socket != nil { server = socket.Server() } csession.m.RUnlock() if server == nil { if csession.Mode() == Eventual { panic("Collection.NewIter called in Eventual mode") } if err == nil { err = errors.New("server not available") } } if session == nil { session = csession } iter := &Iter{ session: session, server: server, timeout: -1, err: err, } iter.gotReply.L = &iter.m for _, doc := range firstBatch { iter.docData.Push(doc.Data) } if cursorId != 0 { iter.op.cursorId = cursorId iter.op.collection = c.FullName iter.op.replyFunc = iter.replyFunc() } return iter } // All works like Iter.All. func (p *Pipe) All(result interface{}) error { return p.Iter().All(result) } // One executes the pipeline and unmarshals the first item from the // result set into the result parameter. // It returns ErrNotFound if no items are generated by the pipeline. func (p *Pipe) One(result interface{}) error { iter := p.Iter() if iter.Next(result) { return nil } if err := iter.Err(); err != nil { return err } return ErrNotFound } // Explain returns a number of details about how the MongoDB server would // execute the requested pipeline, such as the number of objects examined, // the number of times the read lock was yielded to allow writes to go in, // and so on. // // For example: // // var m bson.M // err := collection.Pipe(pipeline).Explain(&m) // if err == nil { // fmt.Printf("Explain: %#v\n", m) // } // func (p *Pipe) Explain(result interface{}) error { c := p.collection cmd := pipeCmd{ Aggregate: c.Name, Pipeline: p.pipeline, AllowDisk: p.allowDisk, Explain: true, } return c.Database.Run(cmd, result) } // AllowDiskUse enables writing to the "<dbpath>/_tmp" server directory so // that aggregation pipelines do not have to be held entirely in memory. func (p *Pipe) AllowDiskUse() *Pipe { p.allowDisk = true return p } // Batch sets the batch size used when fetching documents from the database. // It's possible to change this setting on a per-session basis as well, using // the Batch method of Session. // // The default batch size is defined by the database server. func (p *Pipe) Batch(n int) *Pipe { p.batchSize = n return p } // mgo.v3: Use a single user-visible error type. type LastError struct { Err string Code, N, Waited int FSyncFiles int `bson:"fsyncFiles"` WTimeout bool UpdatedExisting bool `bson:"updatedExisting"` UpsertedId interface{} `bson:"upserted"` modified int ecases []BulkErrorCase } func (err *LastError) Error() string { return err.Err } type queryError struct { Err string "$err" ErrMsg string Assertion string Code int AssertionCode int "assertionCode" LastError *LastError "lastErrorObject" } type QueryError struct { Code int Message string Assertion bool } func (err *QueryError) Error() string { return err.Message } // IsDup returns whether err informs of a duplicate key error because // a primary key index or a secondary unique index already has an entry // with the given value. func IsDup(err error) bool { // Besides being handy, helps with MongoDB bugs SERVER-7164 and SERVER-11493. // What follows makes me sad. Hopefully conventions will be more clear over time. switch e := err.(type) { case *LastError: return e.Code == 11000 || e.Code == 11001 || e.Code == 12582 || e.Code == 16460 && strings.Contains(e.Err, " E11000 ") case *QueryError: return e.Code == 11000 || e.Code == 11001 || e.Code == 12582 case *BulkError: for _, ecase := range e.ecases { if !IsDup(ecase.Err) { return false } } return true } return false } // Insert inserts one or more documents in the respective collection. In // case the session is in safe mode (see the SetSafe method) and an error // happens while inserting the provided documents, the returned error will // be of type *LastError. func (c *Collection) Insert(docs ...interface{}) error { _, err := c.writeOp(&insertOp{c.FullName, docs, 0}, true) return err } // Update finds a single document matching the provided selector document // and modifies it according to the update document. // If the session is in safe mode (see SetSafe) a ErrNotFound error is // returned if a document isn't found, or a value of type *LastError // when some other error is detected. // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/Updating // http://www.mongodb.org/display/DOCS/Atomic+Operations // func (c *Collection) Update(selector interface{}, update interface{}) error { if selector == nil { selector = bson.D{} } op := updateOp{ Collection: c.FullName, Selector: selector, Update: update, } lerr, err := c.writeOp(&op, true) if err == nil && lerr != nil && !lerr.UpdatedExisting { return ErrNotFound } return err } // UpdateId is a convenience helper equivalent to: // // err := collection.Update(bson.M{"_id": id}, update) // // See the Update method for more details. func (c *Collection) UpdateId(id interface{}, update interface{}) error { return c.Update(bson.D{{"_id", id}}, update) } // ChangeInfo holds details about the outcome of an update operation. type ChangeInfo struct { // Updated reports the number of existing documents modified. // Due to server limitations, this reports the same value as the Matched field when // talking to MongoDB <= 2.4 and on Upsert and Apply (findAndModify) operations. Updated int Removed int // Number of documents removed Matched int // Number of documents matched but not necessarily changed UpsertedId interface{} // Upserted _id field, when not explicitly provided } // UpdateAll finds all documents matching the provided selector document // and modifies them according to the update document. // If the session is in safe mode (see SetSafe) details of the executed // operation are returned in info or an error of type *LastError when // some problem is detected. It is not an error for the update to not be // applied on any documents because the selector doesn't match. // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/Updating // http://www.mongodb.org/display/DOCS/Atomic+Operations // func (c *Collection) UpdateAll(selector interface{}, update interface{}) (info *ChangeInfo, err error) { if selector == nil { selector = bson.D{} } op := updateOp{ Collection: c.FullName, Selector: selector, Update: update, Flags: 2, Multi: true, } lerr, err := c.writeOp(&op, true) if err == nil && lerr != nil { info = &ChangeInfo{Updated: lerr.modified, Matched: lerr.N} } return info, err } // Upsert finds a single document matching the provided selector document // and modifies it according to the update document. If no document matching // the selector is found, the update document is applied to the selector // document and the result is inserted in the collection. // If the session is in safe mode (see SetSafe) details of the executed // operation are returned in info, or an error of type *LastError when // some problem is detected. // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/Updating // http://www.mongodb.org/display/DOCS/Atomic+Operations // func (c *Collection) Upsert(selector interface{}, update interface{}) (info *ChangeInfo, err error) { if selector == nil { selector = bson.D{} } op := updateOp{ Collection: c.FullName, Selector: selector, Update: update, Flags: 1, Upsert: true, } lerr, err := c.writeOp(&op, true) if err == nil && lerr != nil { info = &ChangeInfo{} if lerr.UpdatedExisting { info.Matched = lerr.N info.Updated = lerr.modified } else { info.UpsertedId = lerr.UpsertedId } } return info, err } // UpsertId is a convenience helper equivalent to: // // info, err := collection.Upsert(bson.M{"_id": id}, update) // // See the Upsert method for more details. func (c *Collection) UpsertId(id interface{}, update interface{}) (info *ChangeInfo, err error) { return c.Upsert(bson.D{{"_id", id}}, update) } // Remove finds a single document matching the provided selector document // and removes it from the database. // If the session is in safe mode (see SetSafe) a ErrNotFound error is // returned if a document isn't found, or a value of type *LastError // when some other error is detected. // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/Removing // func (c *Collection) Remove(selector interface{}) error { if selector == nil { selector = bson.D{} } lerr, err := c.writeOp(&deleteOp{c.FullName, selector, 1, 1}, true) if err == nil && lerr != nil && lerr.N == 0 { return ErrNotFound } return err } // RemoveId is a convenience helper equivalent to: // // err := collection.Remove(bson.M{"_id": id}) // // See the Remove method for more details. func (c *Collection) RemoveId(id interface{}) error { return c.Remove(bson.D{{"_id", id}}) } // RemoveAll finds all documents matching the provided selector document // and removes them from the database. In case the session is in safe mode // (see the SetSafe method) and an error happens when attempting the change, // the returned error will be of type *LastError. // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/Removing // func (c *Collection) RemoveAll(selector interface{}) (info *ChangeInfo, err error) { if selector == nil { selector = bson.D{} } lerr, err := c.writeOp(&deleteOp{c.FullName, selector, 0, 0}, true) if err == nil && lerr != nil { info = &ChangeInfo{Removed: lerr.N, Matched: lerr.N} } return info, err } // DropDatabase removes the entire database including all of its collections. func (db *Database) DropDatabase() error { return db.Run(bson.D{{"dropDatabase", 1}}, nil) } // DropCollection removes the entire collection including all of its documents. func (c *Collection) DropCollection() error { return c.Database.Run(bson.D{{"drop", c.Name}}, nil) } // The CollectionInfo type holds metadata about a collection. // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/createCollection+Command // http://www.mongodb.org/display/DOCS/Capped+Collections // type CollectionInfo struct { // DisableIdIndex prevents the automatic creation of the index // on the _id field for the collection. DisableIdIndex bool // ForceIdIndex enforces the automatic creation of the index // on the _id field for the collection. Capped collections, // for example, do not have such an index by default. ForceIdIndex bool // If Capped is true new documents will replace old ones when // the collection is full. MaxBytes must necessarily be set // to define the size when the collection wraps around. // MaxDocs optionally defines the number of documents when it // wraps, but MaxBytes still needs to be set. Capped bool MaxBytes int MaxDocs int // Validator contains a validation expression that defines which // documents should be considered valid for this collection. Validator interface{} // ValidationLevel may be set to "strict" (the default) to force // MongoDB to validate all documents on inserts and updates, to // "moderate" to apply the validation rules only to documents // that already fulfill the validation criteria, or to "off" for // disabling validation entirely. ValidationLevel string // ValidationAction determines how MongoDB handles documents that // violate the validation rules. It may be set to "error" (the default) // to reject inserts or updates that violate the rules, or to "warn" // to log invalid operations but allow them to proceed. ValidationAction string // StorageEngine allows specifying collection options for the // storage engine in use. The map keys must hold the storage engine // name for which options are being specified. StorageEngine interface{} } // Create explicitly creates the c collection with details of info. // MongoDB creates collections automatically on use, so this method // is only necessary when creating collection with non-default // characteristics, such as capped collections. // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/createCollection+Command // http://www.mongodb.org/display/DOCS/Capped+Collections // func (c *Collection) Create(info *CollectionInfo) error { cmd := make(bson.D, 0, 4) cmd = append(cmd, bson.DocElem{"create", c.Name}) if info.Capped { if info.MaxBytes < 1 { return fmt.Errorf("Collection.Create: with Capped, MaxBytes must also be set") } cmd = append(cmd, bson.DocElem{"capped", true}) cmd = append(cmd, bson.DocElem{"size", info.MaxBytes}) if info.MaxDocs > 0 { cmd = append(cmd, bson.DocElem{"max", info.MaxDocs}) } } if info.DisableIdIndex { cmd = append(cmd, bson.DocElem{"autoIndexId", false}) } if info.ForceIdIndex { cmd = append(cmd, bson.DocElem{"autoIndexId", true}) } if info.Validator != nil { cmd = append(cmd, bson.DocElem{"validator", info.Validator}) } if info.ValidationLevel != "" { cmd = append(cmd, bson.DocElem{"validationLevel", info.ValidationLevel}) } if info.ValidationAction != "" { cmd = append(cmd, bson.DocElem{"validationAction", info.ValidationAction}) } if info.StorageEngine != nil { cmd = append(cmd, bson.DocElem{"storageEngine", info.StorageEngine}) } return c.Database.Run(cmd, nil) } // Batch sets the batch size used when fetching documents from the database. // It's possible to change this setting on a per-session basis as well, using // the Batch method of Session. // The default batch size is defined by the database itself. As of this // writing, MongoDB will use an initial size of min(100 docs, 4MB) on the // first batch, and 4MB on remaining ones. func (q *Query) Batch(n int) *Query { if n == 1 { // Server interprets 1 as -1 and closes the cursor (!?) n = 2 } q.m.Lock() q.op.limit = int32(n) q.m.Unlock() return q } // Prefetch sets the point at which the next batch of results will be requested. // When there are p*batch_size remaining documents cached in an Iter, the next // batch will be requested in background. For instance, when using this: // // query.Batch(200).Prefetch(0.25) // // and there are only 50 documents cached in the Iter to be processed, the // next batch of 200 will be requested. It's possible to change this setting on // a per-session basis as well, using the SetPrefetch method of Session. // // The default prefetch value is 0.25. func (q *Query) Prefetch(p float64) *Query { q.m.Lock() q.prefetch = p q.m.Unlock() return q } // Skip skips over the n initial documents from the query results. Note that // this only makes sense with capped collections where documents are naturally // ordered by insertion time, or with sorted results. func (q *Query) Skip(n int) *Query { q.m.Lock() q.op.skip = int32(n) q.m.Unlock() return q } // Limit restricts the maximum number of documents retrieved to n, and also // changes the batch size to the same value. Once n documents have been // returned by Next, the following call will return ErrNotFound. func (q *Query) Limit(n int) *Query { q.m.Lock() switch { case n == 1: q.limit = 1 q.op.limit = -1 case n == math.MinInt32: // -MinInt32 == -MinInt32 q.limit = math.MaxInt32 q.op.limit = math.MinInt32 + 1 case n < 0: q.limit = int32(-n) q.op.limit = int32(n) default: q.limit = int32(n) q.op.limit = int32(n) } q.m.Unlock() return q } // Select enables selecting which fields should be retrieved for the results // found. For example, the following query would only retrieve the name field: // // err := collection.Find(nil).Select(bson.M{"name": 1}).One(&result) // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/Retrieving+a+Subset+of+Fields // func (q *Query) Select(selector interface{}) *Query { q.m.Lock() q.op.selector = selector q.m.Unlock() return q } // Sort asks the database to order returned documents according to the // provided field names. A field name may be prefixed by - (minus) for // it to be sorted in reverse order. // // For example: // // query1 := collection.Find(nil).Sort("firstname", "lastname") // query2 := collection.Find(nil).Sort("-age") // query3 := collection.Find(nil).Sort("$natural") // query4 := collection.Find(nil).Select(bson.M{"score": bson.M{"$meta": "textScore"}}).Sort("$textScore:score") // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/Sorting+and+Natural+Order // func (q *Query) Sort(fields ...string) *Query { q.m.Lock() var order bson.D for _, field := range fields { n := 1 var kind string if field != "" { if field[0] == '$' { if c := strings.Index(field, ":"); c > 1 && c < len(field)-1 { kind = field[1:c] field = field[c+1:] } } switch field[0] { case '+': field = field[1:] case '-': n = -1 field = field[1:] } } if field == "" { panic("Sort: empty field name") } if kind == "textScore" { order = append(order, bson.DocElem{field, bson.M{"$meta": kind}}) } else { order = append(order, bson.DocElem{field, n}) } } q.op.options.OrderBy = order q.op.hasOptions = true q.m.Unlock() return q } // Explain returns a number of details about how the MongoDB server would // execute the requested query, such as the number of objects examined, // the number of times the read lock was yielded to allow writes to go in, // and so on. // // For example: // // m := bson.M{} // err := collection.Find(bson.M{"filename": name}).Explain(m) // if err == nil { // fmt.Printf("Explain: %#v\n", m) // } // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/Optimization // http://www.mongodb.org/display/DOCS/Query+Optimizer // func (q *Query) Explain(result interface{}) error { q.m.Lock() clone := &Query{session: q.session, query: q.query} q.m.Unlock() clone.op.options.Explain = true clone.op.hasOptions = true if clone.op.limit > 0 { clone.op.limit = -q.op.limit } iter := clone.Iter() if iter.Next(result) { return nil } return iter.Close() } // TODO: Add Collection.Explain. See https://goo.gl/1MDlvz. // Hint will include an explicit "hint" in the query to force the server // to use a specified index, potentially improving performance in some // situations. The provided parameters are the fields that compose the // key of the index to be used. For details on how the indexKey may be // built, see the EnsureIndex method. // // For example: // // query := collection.Find(bson.M{"firstname": "Joe", "lastname": "Winter"}) // query.Hint("lastname", "firstname") // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/Optimization // http://www.mongodb.org/display/DOCS/Query+Optimizer // func (q *Query) Hint(indexKey ...string) *Query { q.m.Lock() keyInfo, err := parseIndexKey(indexKey) q.op.options.Hint = keyInfo.key q.op.hasOptions = true q.m.Unlock() if err != nil { panic(err) } return q } // SetMaxScan constrains the query to stop after scanning the specified // number of documents. // // This modifier is generally used to prevent potentially long running // queries from disrupting performance by scanning through too much data. func (q *Query) SetMaxScan(n int) *Query { q.m.Lock() q.op.options.MaxScan = n q.op.hasOptions = true q.m.Unlock() return q } // SetMaxTime constrains the query to stop after running for the specified time. // // When the time limit is reached MongoDB automatically cancels the query. // This can be used to efficiently prevent and identify unexpectedly slow queries. // // A few important notes about the mechanism enforcing this limit: // // - Requests can block behind locking operations on the server, and that blocking // time is not accounted for. In other words, the timer starts ticking only after // the actual start of the query when it initially acquires the appropriate lock; // // - Operations are interrupted only at interrupt points where an operation can be // safely aborted – the total execution time may exceed the specified value; // // - The limit can be applied to both CRUD operations and commands, but not all // commands are interruptible; // // - While iterating over results, computing follow up batches is included in the // total time and the iteration continues until the alloted time is over, but // network roundtrips are not taken into account for the limit. // // - This limit does not override the inactive cursor timeout for idle cursors // (default is 10 min). // // This mechanism was introduced in MongoDB 2.6. // // Relevant documentation: // // http://blog.mongodb.org/post/83621787773/maxtimems-and-query-optimizer-introspection-in // func (q *Query) SetMaxTime(d time.Duration) *Query { q.m.Lock() q.op.options.MaxTimeMS = int(d / time.Millisecond) q.op.hasOptions = true q.m.Unlock() return q } // Snapshot will force the performed query to make use of an available // index on the _id field to prevent the same document from being returned // more than once in a single iteration. This might happen without this // setting in situations when the document changes in size and thus has to // be moved while the iteration is running. // // Because snapshot mode traverses the _id index, it may not be used with // sorting or explicit hints. It also cannot use any other index for the // query. // // Even with snapshot mode, items inserted or deleted during the query may // or may not be returned; that is, this mode is not a true point-in-time // snapshot. // // The same effect of Snapshot may be obtained by using any unique index on // field(s) that will not be modified (best to use Hint explicitly too). // A non-unique index (such as creation time) may be made unique by // appending _id to the index when creating it. // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/How+to+do+Snapshotted+Queries+in+the+Mongo+Database // func (q *Query) Snapshot() *Query { q.m.Lock() q.op.options.Snapshot = true q.op.hasOptions = true q.m.Unlock() return q } // Comment adds a comment to the query to identify it in the database profiler output. // // Relevant documentation: // // http://docs.mongodb.org/manual/reference/operator/meta/comment // http://docs.mongodb.org/manual/reference/command/profile // http://docs.mongodb.org/manual/administration/analyzing-mongodb-performance/#database-profiling // func (q *Query) Comment(comment string) *Query { q.m.Lock() q.op.options.Comment = comment q.op.hasOptions = true q.m.Unlock() return q } // LogReplay enables an option that optimizes queries that are typically // made on the MongoDB oplog for replaying it. This is an internal // implementation aspect and most likely uninteresting for other uses. // It has seen at least one use case, though, so it's exposed via the API. func (q *Query) LogReplay() *Query { q.m.Lock() q.op.flags |= flagLogReplay q.m.Unlock() return q } func checkQueryError(fullname string, d []byte) error { l := len(d) if l < 16 { return nil } if d[5] == '$' && d[6] == 'e' && d[7] == 'r' && d[8] == 'r' && d[9] == '\x00' && d[4] == '\x02' { goto Error } if len(fullname) < 5 || fullname[len(fullname)-5:] != ".$cmd" { return nil } for i := 0; i+8 < l; i++ { if d[i] == '\x02' && d[i+1] == 'e' && d[i+2] == 'r' && d[i+3] == 'r' && d[i+4] == 'm' && d[i+5] == 's' && d[i+6] == 'g' && d[i+7] == '\x00' { goto Error } } return nil Error: result := &queryError{} bson.Unmarshal(d, result) if result.LastError != nil { return result.LastError } if result.Err == "" && result.ErrMsg == "" { return nil } if result.AssertionCode != 0 && result.Assertion != "" { return &QueryError{Code: result.AssertionCode, Message: result.Assertion, Assertion: true} } if result.Err != "" { return &QueryError{Code: result.Code, Message: result.Err} } return &QueryError{Code: result.Code, Message: result.ErrMsg} } // One executes the query and unmarshals the first obtained document into the // result argument. The result must be a struct or map value capable of being // unmarshalled into by gobson. This function blocks until either a result // is available or an error happens. For example: // // err := collection.Find(bson.M{"a": 1}).One(&result) // // In case the resulting document includes a field named $err or errmsg, which // are standard ways for MongoDB to return query errors, the returned err will // be set to a *QueryError value including the Err message and the Code. In // those cases, the result argument is still unmarshalled into with the // received document so that any other custom values may be obtained if // desired. // func (q *Query) One(result interface{}) (err error) { q.m.Lock() session := q.session op := q.op // Copy. q.m.Unlock() socket, err := session.acquireSocket(true) if err != nil { return err } defer socket.Release() op.limit = -1 session.prepareQuery(&op) expectFindReply := prepareFindOp(socket, &op, 1) data, err := socket.SimpleQuery(&op) if err != nil { return err } if data == nil { return ErrNotFound } if expectFindReply { var findReply struct { Ok bool Code int Errmsg string Cursor cursorData } err = bson.Unmarshal(data, &findReply) if err != nil { return err } if !findReply.Ok && findReply.Errmsg != "" { return &QueryError{Code: findReply.Code, Message: findReply.Errmsg} } if len(findReply.Cursor.FirstBatch) == 0 { return ErrNotFound } data = findReply.Cursor.FirstBatch[0].Data } if result != nil { err = bson.Unmarshal(data, result) if err == nil { debugf("Query %p document unmarshaled: %#v", q, result) } else { debugf("Query %p document unmarshaling failed: %#v", q, err) return err } } return checkQueryError(op.collection, data) } // prepareFindOp translates op from being an old-style wire protocol query into // a new-style find command if that's supported by the MongoDB server (3.2+). // It returns whether to expect a find command result or not. Note op may be // translated into an explain command, in which case the function returns false. func prepareFindOp(socket *mongoSocket, op *queryOp, limit int32) bool { if socket.ServerInfo().MaxWireVersion < 4 || op.collection == "admin.$cmd" { return false } nameDot := strings.Index(op.collection, ".") if nameDot < 0 { panic("invalid query collection name: " + op.collection) } find := findCmd{ Collection: op.collection[nameDot+1:], Filter: op.query, Projection: op.selector, Sort: op.options.OrderBy, Skip: op.skip, Limit: limit, MaxTimeMS: op.options.MaxTimeMS, MaxScan: op.options.MaxScan, Hint: op.options.Hint, Comment: op.options.Comment, Snapshot: op.options.Snapshot, OplogReplay: op.flags&flagLogReplay != 0, } if op.limit < 0 { find.BatchSize = -op.limit find.SingleBatch = true } else { find.BatchSize = op.limit } explain := op.options.Explain op.collection = op.collection[:nameDot] + ".$cmd" op.query = &find op.skip = 0 op.limit = -1 op.options = queryWrapper{} op.hasOptions = false if explain { op.query = bson.D{{"explain", op.query}} return false } return true } type cursorData struct { FirstBatch []bson.Raw "firstBatch" NextBatch []bson.Raw "nextBatch" NS string Id int64 } // findCmd holds the command used for performing queries on MongoDB 3.2+. // // Relevant documentation: // // https://docs.mongodb.org/master/reference/command/find/#dbcmd.find // type findCmd struct { Collection string `bson:"find"` Filter interface{} `bson:"filter,omitempty"` Sort interface{} `bson:"sort,omitempty"` Projection interface{} `bson:"projection,omitempty"` Hint interface{} `bson:"hint,omitempty"` Skip interface{} `bson:"skip,omitempty"` Limit int32 `bson:"limit,omitempty"` BatchSize int32 `bson:"batchSize,omitempty"` SingleBatch bool `bson:"singleBatch,omitempty"` Comment string `bson:"comment,omitempty"` MaxScan int `bson:"maxScan,omitempty"` MaxTimeMS int `bson:"maxTimeMS,omitempty"` ReadConcern interface{} `bson:"readConcern,omitempty"` Max interface{} `bson:"max,omitempty"` Min interface{} `bson:"min,omitempty"` ReturnKey bool `bson:"returnKey,omitempty"` ShowRecordId bool `bson:"showRecordId,omitempty"` Snapshot bool `bson:"snapshot,omitempty"` Tailable bool `bson:"tailable,omitempty"` AwaitData bool `bson:"awaitData,omitempty"` OplogReplay bool `bson:"oplogReplay,omitempty"` NoCursorTimeout bool `bson:"noCursorTimeout,omitempty"` AllowPartialResults bool `bson:"allowPartialResults,omitempty"` } // getMoreCmd holds the command used for requesting more query results on MongoDB 3.2+. // // Relevant documentation: // // https://docs.mongodb.org/master/reference/command/getMore/#dbcmd.getMore // type getMoreCmd struct { CursorId int64 `bson:"getMore"` Collection string `bson:"collection"` BatchSize int32 `bson:"batchSize,omitempty"` MaxTimeMS int64 `bson:"maxTimeMS,omitempty"` } // run duplicates the behavior of collection.Find(query).One(&result) // as performed by Database.Run, specializing the logic for running // database commands on a given socket. func (db *Database) run(socket *mongoSocket, cmd, result interface{}) (err error) { // Database.Run: if name, ok := cmd.(string); ok { cmd = bson.D{{name, 1}} } // Collection.Find: session := db.Session session.m.RLock() op := session.queryConfig.op // Copy. session.m.RUnlock() op.query = cmd op.collection = db.Name + ".$cmd" // Query.One: session.prepareQuery(&op) op.limit = -1 data, err := socket.SimpleQuery(&op) if err != nil { return err } if data == nil { return ErrNotFound } if result != nil { err = bson.Unmarshal(data, result) if err == nil { var res bson.M bson.Unmarshal(data, &res) debugf("Run command unmarshaled: %#v, result: %#v", op, res) } else { debugf("Run command unmarshaling failed: %#v", op, err) return err } } return checkQueryError(op.collection, data) } // The DBRef type implements support for the database reference MongoDB // convention as supported by multiple drivers. This convention enables // cross-referencing documents between collections and databases using // a structure which includes a collection name, a document id, and // optionally a database name. // // See the FindRef methods on Session and on Database. // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/Database+References // type DBRef struct { Collection string `bson:"$ref"` Id interface{} `bson:"$id"` Database string `bson:"$db,omitempty"` } // NOTE: Order of fields for DBRef above does matter, per documentation. // FindRef returns a query that looks for the document in the provided // reference. If the reference includes the DB field, the document will // be retrieved from the respective database. // // See also the DBRef type and the FindRef method on Session. // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/Database+References // func (db *Database) FindRef(ref *DBRef) *Query { var c *Collection if ref.Database == "" { c = db.C(ref.Collection) } else { c = db.Session.DB(ref.Database).C(ref.Collection) } return c.FindId(ref.Id) } // FindRef returns a query that looks for the document in the provided // reference. For a DBRef to be resolved correctly at the session level // it must necessarily have the optional DB field defined. // // See also the DBRef type and the FindRef method on Database. // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/Database+References // func (s *Session) FindRef(ref *DBRef) *Query { if ref.Database == "" { panic(errors.New(fmt.Sprintf("Can't resolve database for %#v", ref))) } c := s.DB(ref.Database).C(ref.Collection) return c.FindId(ref.Id) } // CollectionNames returns the collection names present in the db database. func (db *Database) CollectionNames() (names []string, err error) { // Clone session and set it to Monotonic mode so that the server // used for the query may be safely obtained afterwards, if // necessary for iteration when a cursor is received. cloned := db.Session.nonEventual() defer cloned.Close() batchSize := int(cloned.queryConfig.op.limit) // Try with a command. var result struct { Collections []bson.Raw Cursor cursorData } err = db.With(cloned).Run(bson.D{{"listCollections", 1}, {"cursor", bson.D{{"batchSize", batchSize}}}}, &result) if err == nil { firstBatch := result.Collections if firstBatch == nil { firstBatch = result.Cursor.FirstBatch } var iter *Iter ns := strings.SplitN(result.Cursor.NS, ".", 2) if len(ns) < 2 { iter = db.With(cloned).C("").NewIter(nil, firstBatch, result.Cursor.Id, nil) } else { iter = cloned.DB(ns[0]).C(ns[1]).NewIter(nil, firstBatch, result.Cursor.Id, nil) } var coll struct{ Name string } for iter.Next(&coll) { names = append(names, coll.Name) } if err := iter.Close(); err != nil { return nil, err } sort.Strings(names) return names, err } if err != nil && !isNoCmd(err) { return nil, err } // Command not yet supported. Query the database instead. nameIndex := len(db.Name) + 1 iter := db.C("system.namespaces").Find(nil).Iter() var coll struct{ Name string } for iter.Next(&coll) { if strings.Index(coll.Name, "$") < 0 || strings.Index(coll.Name, ".oplog.$") >= 0 { names = append(names, coll.Name[nameIndex:]) } } if err := iter.Close(); err != nil { return nil, err } sort.Strings(names) return names, nil } type dbNames struct { Databases []struct { Name string Empty bool } } // DatabaseNames returns the names of non-empty databases present in the cluster. func (s *Session) DatabaseNames() (names []string, err error) { var result dbNames err = s.Run("listDatabases", &result) if err != nil { return nil, err } for _, db := range result.Databases { if !db.Empty { names = append(names, db.Name) } } sort.Strings(names) return names, nil } // Iter executes the query and returns an iterator capable of going over all // the results. Results will be returned in batches of configurable // size (see the Batch method) and more documents will be requested when a // configurable number of documents is iterated over (see the Prefetch method). func (q *Query) Iter() *Iter { q.m.Lock() session := q.session op := q.op prefetch := q.prefetch limit := q.limit q.m.Unlock() iter := &Iter{ session: session, prefetch: prefetch, limit: limit, timeout: -1, } iter.gotReply.L = &iter.m iter.op.collection = op.collection iter.op.limit = op.limit iter.op.replyFunc = iter.replyFunc() iter.docsToReceive++ socket, err := session.acquireSocket(true) if err != nil { iter.err = err return iter } defer socket.Release() session.prepareQuery(&op) op.replyFunc = iter.op.replyFunc if prepareFindOp(socket, &op, limit) { iter.findCmd = true } iter.server = socket.Server() err = socket.Query(&op) if err != nil { // Must lock as the query is already out and it may call replyFunc. iter.m.Lock() iter.err = err iter.m.Unlock() } return iter } // Tail returns a tailable iterator. Unlike a normal iterator, a // tailable iterator may wait for new values to be inserted in the // collection once the end of the current result set is reached, // A tailable iterator may only be used with capped collections. // // The timeout parameter indicates how long Next will block waiting // for a result before timing out. If set to -1, Next will not // timeout, and will continue waiting for a result for as long as // the cursor is valid and the session is not closed. If set to 0, // Next times out as soon as it reaches the end of the result set. // Otherwise, Next will wait for at least the given number of // seconds for a new document to be available before timing out. // // On timeouts, Next will unblock and return false, and the Timeout // method will return true if called. In these cases, Next may still // be called again on the same iterator to check if a new value is // available at the current cursor position, and again it will block // according to the specified timeoutSecs. If the cursor becomes // invalid, though, both Next and Timeout will return false and // the query must be restarted. // // The following example demonstrates timeout handling and query // restarting: // // iter := collection.Find(nil).Sort("$natural").Tail(5 * time.Second) // for { // for iter.Next(&result) { // fmt.Println(result.Id) // lastId = result.Id // } // if iter.Err() != nil { // return iter.Close() // } // if iter.Timeout() { // continue // } // query := collection.Find(bson.M{"_id": bson.M{"$gt": lastId}}) // iter = query.Sort("$natural").Tail(5 * time.Second) // } // iter.Close() // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/Tailable+Cursors // http://www.mongodb.org/display/DOCS/Capped+Collections // http://www.mongodb.org/display/DOCS/Sorting+and+Natural+Order // func (q *Query) Tail(timeout time.Duration) *Iter { q.m.Lock() session := q.session op := q.op prefetch := q.prefetch q.m.Unlock() iter := &Iter{session: session, prefetch: prefetch} iter.gotReply.L = &iter.m iter.timeout = timeout iter.op.collection = op.collection iter.op.limit = op.limit iter.op.replyFunc = iter.replyFunc() iter.docsToReceive++ session.prepareQuery(&op) op.replyFunc = iter.op.replyFunc op.flags |= flagTailable | flagAwaitData socket, err := session.acquireSocket(true) if err != nil { iter.err = err } else { iter.server = socket.Server() err = socket.Query(&op) if err != nil { // Must lock as the query is already out and it may call replyFunc. iter.m.Lock() iter.err = err iter.m.Unlock() } socket.Release() } return iter } func (s *Session) prepareQuery(op *queryOp) { s.m.RLock() op.mode = s.consistency if s.slaveOk { op.flags |= flagSlaveOk } s.m.RUnlock() return } // Err returns nil if no errors happened during iteration, or the actual // error otherwise. // // In case a resulting document included a field named $err or errmsg, which are // standard ways for MongoDB to report an improper query, the returned value has // a *QueryError type, and includes the Err message and the Code. func (iter *Iter) Err() error { iter.m.Lock() err := iter.err iter.m.Unlock() if err == ErrNotFound { return nil } return err } // Close kills the server cursor used by the iterator, if any, and returns // nil if no errors happened during iteration, or the actual error otherwise. // // Server cursors are automatically closed at the end of an iteration, which // means close will do nothing unless the iteration was interrupted before // the server finished sending results to the driver. If Close is not called // in such a situation, the cursor will remain available at the server until // the default cursor timeout period is reached. No further problems arise. // // Close is idempotent. That means it can be called repeatedly and will // return the same result every time. // // In case a resulting document included a field named $err or errmsg, which are // standard ways for MongoDB to report an improper query, the returned value has // a *QueryError type. func (iter *Iter) Close() error { iter.m.Lock() cursorId := iter.op.cursorId iter.op.cursorId = 0 err := iter.err iter.m.Unlock() if cursorId == 0 { if err == ErrNotFound { return nil } return err } socket, err := iter.acquireSocket() if err == nil { // TODO Batch kills. err = socket.Query(&killCursorsOp{[]int64{cursorId}}) socket.Release() } iter.m.Lock() if err != nil && (iter.err == nil || iter.err == ErrNotFound) { iter.err = err } else if iter.err != ErrNotFound { err = iter.err } iter.m.Unlock() return err } // Timeout returns true if Next returned false due to a timeout of // a tailable cursor. In those cases, Next may be called again to continue // the iteration at the previous cursor position. func (iter *Iter) Timeout() bool { iter.m.Lock() result := iter.timedout iter.m.Unlock() return result } // Next retrieves the next document from the result set, blocking if necessary. // This method will also automatically retrieve another batch of documents from // the server when the current one is exhausted, or before that in background // if pre-fetching is enabled (see the Query.Prefetch and Session.SetPrefetch // methods). // // Next returns true if a document was successfully unmarshalled onto result, // and false at the end of the result set or if an error happened. // When Next returns false, the Err method should be called to verify if // there was an error during iteration. // // For example: // // iter := collection.Find(nil).Iter() // for iter.Next(&result) { // fmt.Printf("Result: %v\n", result.Id) // } // if err := iter.Close(); err != nil { // return err // } // func (iter *Iter) Next(result interface{}) bool { iter.m.Lock() iter.timedout = false timeout := time.Time{} for iter.err == nil && iter.docData.Len() == 0 && (iter.docsToReceive > 0 || iter.op.cursorId != 0) { if iter.docsToReceive == 0 { if iter.timeout >= 0 { if timeout.IsZero() { timeout = time.Now().Add(iter.timeout) } if time.Now().After(timeout) { iter.timedout = true iter.m.Unlock() return false } } iter.getMore() if iter.err != nil { break } } iter.gotReply.Wait() } // Exhaust available data before reporting any errors. if docData, ok := iter.docData.Pop().([]byte); ok { close := false if iter.limit > 0 { iter.limit-- if iter.limit == 0 { if iter.docData.Len() > 0 { iter.m.Unlock() panic(fmt.Errorf("data remains after limit exhausted: %d", iter.docData.Len())) } iter.err = ErrNotFound close = true } } if iter.op.cursorId != 0 && iter.err == nil { iter.docsBeforeMore-- if iter.docsBeforeMore == -1 { iter.getMore() } } iter.m.Unlock() if close { iter.Close() } err := bson.Unmarshal(docData, result) if err != nil { debugf("Iter %p document unmarshaling failed: %#v", iter, err) iter.m.Lock() if iter.err == nil { iter.err = err } iter.m.Unlock() return false } debugf("Iter %p document unmarshaled: %#v", iter, result) // XXX Only have to check first document for a query error? err = checkQueryError(iter.op.collection, docData) if err != nil { iter.m.Lock() if iter.err == nil { iter.err = err } iter.m.Unlock() return false } return true } else if iter.err != nil { debugf("Iter %p returning false: %s", iter, iter.err) iter.m.Unlock() return false } else if iter.op.cursorId == 0 { iter.err = ErrNotFound debugf("Iter %p exhausted with cursor=0", iter) iter.m.Unlock() return false } panic("unreachable") } // All retrieves all documents from the result set into the provided slice // and closes the iterator. // // The result argument must necessarily be the address for a slice. The slice // may be nil or previously allocated. // // WARNING: Obviously, All must not be used with result sets that may be // potentially large, since it may consume all memory until the system // crashes. Consider building the query with a Limit clause to ensure the // result size is bounded. // // For instance: // // var result []struct{ Value int } // iter := collection.Find(nil).Limit(100).Iter() // err := iter.All(&result) // if err != nil { // return err // } // func (iter *Iter) All(result interface{}) error { resultv := reflect.ValueOf(result) if resultv.Kind() != reflect.Ptr || resultv.Elem().Kind() != reflect.Slice { panic("result argument must be a slice address") } slicev := resultv.Elem() slicev = slicev.Slice(0, slicev.Cap()) elemt := slicev.Type().Elem() i := 0 for { if slicev.Len() == i { elemp := reflect.New(elemt) if !iter.Next(elemp.Interface()) { break } slicev = reflect.Append(slicev, elemp.Elem()) slicev = slicev.Slice(0, slicev.Cap()) } else { if !iter.Next(slicev.Index(i).Addr().Interface()) { break } } i++ } resultv.Elem().Set(slicev.Slice(0, i)) return iter.Close() } // All works like Iter.All. func (q *Query) All(result interface{}) error { return q.Iter().All(result) } // The For method is obsolete and will be removed in a future release. // See Iter as an elegant replacement. func (q *Query) For(result interface{}, f func() error) error { return q.Iter().For(result, f) } // The For method is obsolete and will be removed in a future release. // See Iter as an elegant replacement. func (iter *Iter) For(result interface{}, f func() error) (err error) { valid := false v := reflect.ValueOf(result) if v.Kind() == reflect.Ptr { v = v.Elem() switch v.Kind() { case reflect.Map, reflect.Ptr, reflect.Interface, reflect.Slice: valid = v.IsNil() } } if !valid { panic("For needs a pointer to nil reference value. See the documentation.") } zero := reflect.Zero(v.Type()) for { v.Set(zero) if !iter.Next(result) { break } err = f() if err != nil { return err } } return iter.Err() } // acquireSocket acquires a socket from the same server that the iterator // cursor was obtained from. // // WARNING: This method must not be called with iter.m locked. Acquiring the // socket depends on the cluster sync loop, and the cluster sync loop might // attempt actions which cause replyFunc to be called, inducing a deadlock. func (iter *Iter) acquireSocket() (*mongoSocket, error) { socket, err := iter.session.acquireSocket(true) if err != nil { return nil, err } if socket.Server() != iter.server { // Socket server changed during iteration. This may happen // with Eventual sessions, if a Refresh is done, or if a // monotonic session gets a write and shifts from secondary // to primary. Our cursor is in a specific server, though. iter.session.m.Lock() sockTimeout := iter.session.sockTimeout iter.session.m.Unlock() socket.Release() socket, _, err = iter.server.AcquireSocket(0, sockTimeout) if err != nil { return nil, err } err := iter.session.socketLogin(socket) if err != nil { socket.Release() return nil, err } } return socket, nil } func (iter *Iter) getMore() { // Increment now so that unlocking the iterator won't cause a // different goroutine to get here as well. iter.docsToReceive++ iter.m.Unlock() socket, err := iter.acquireSocket() iter.m.Lock() if err != nil { iter.err = err return } defer socket.Release() debugf("Iter %p requesting more documents", iter) if iter.limit > 0 { // The -1 below accounts for the fact docsToReceive was incremented above. limit := iter.limit - int32(iter.docsToReceive-1) - int32(iter.docData.Len()) if limit < iter.op.limit { iter.op.limit = limit } } var op interface{} if iter.findCmd { op = iter.getMoreCmd() } else { op = &iter.op } if err := socket.Query(op); err != nil { iter.docsToReceive-- iter.err = err } } func (iter *Iter) getMoreCmd() *queryOp { // TODO: Define the query statically in the Iter type, next to getMoreOp. nameDot := strings.Index(iter.op.collection, ".") if nameDot < 0 { panic("invalid query collection name: " + iter.op.collection) } getMore := getMoreCmd{ CursorId: iter.op.cursorId, Collection: iter.op.collection[nameDot+1:], BatchSize: iter.op.limit, } var op queryOp op.collection = iter.op.collection[:nameDot] + ".$cmd" op.query = &getMore op.limit = -1 op.replyFunc = iter.op.replyFunc return &op } type countCmd struct { Count string Query interface{} Limit int32 ",omitempty" Skip int32 ",omitempty" } // Count returns the total number of documents in the result set. func (q *Query) Count() (n int, err error) { q.m.Lock() session := q.session op := q.op limit := q.limit q.m.Unlock() c := strings.Index(op.collection, ".") if c < 0 { return 0, errors.New("Bad collection name: " + op.collection) } dbname := op.collection[:c] cname := op.collection[c+1:] query := op.query if query == nil { query = bson.D{} } result := struct{ N int }{} err = session.DB(dbname).Run(countCmd{cname, query, limit, op.skip}, &result) return result.N, err } // Count returns the total number of documents in the collection. func (c *Collection) Count() (n int, err error) { return c.Find(nil).Count() } type distinctCmd struct { Collection string "distinct" Key string Query interface{} ",omitempty" } // Distinct unmarshals into result the list of distinct values for the given key. // // For example: // // var result []int // err := collection.Find(bson.M{"gender": "F"}).Distinct("age", &result) // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/Aggregation // func (q *Query) Distinct(key string, result interface{}) error { q.m.Lock() session := q.session op := q.op // Copy. q.m.Unlock() c := strings.Index(op.collection, ".") if c < 0 { return errors.New("Bad collection name: " + op.collection) } dbname := op.collection[:c] cname := op.collection[c+1:] var doc struct{ Values bson.Raw } err := session.DB(dbname).Run(distinctCmd{cname, key, op.query}, &doc) if err != nil { return err } return doc.Values.Unmarshal(result) } type mapReduceCmd struct { Collection string "mapreduce" Map string ",omitempty" Reduce string ",omitempty" Finalize string ",omitempty" Limit int32 ",omitempty" Out interface{} Query interface{} ",omitempty" Sort interface{} ",omitempty" Scope interface{} ",omitempty" Verbose bool ",omitempty" } type mapReduceResult struct { Results bson.Raw Result bson.Raw TimeMillis int64 "timeMillis" Counts struct{ Input, Emit, Output int } Ok bool Err string Timing *MapReduceTime } type MapReduce struct { Map string // Map Javascript function code (required) Reduce string // Reduce Javascript function code (required) Finalize string // Finalize Javascript function code (optional) Out interface{} // Output collection name or document. If nil, results are inlined into the result parameter. Scope interface{} // Optional global scope for Javascript functions Verbose bool } type MapReduceInfo struct { InputCount int // Number of documents mapped EmitCount int // Number of times reduce called emit OutputCount int // Number of documents in resulting collection Database string // Output database, if results are not inlined Collection string // Output collection, if results are not inlined Time int64 // Time to run the job, in nanoseconds VerboseTime *MapReduceTime // Only defined if Verbose was true } type MapReduceTime struct { Total int64 // Total time, in nanoseconds Map int64 "mapTime" // Time within map function, in nanoseconds EmitLoop int64 "emitLoop" // Time within the emit/map loop, in nanoseconds } // MapReduce executes a map/reduce job for documents covered by the query. // That kind of job is suitable for very flexible bulk aggregation of data // performed at the server side via Javascript functions. // // Results from the job may be returned as a result of the query itself // through the result parameter in case they'll certainly fit in memory // and in a single document. If there's the possibility that the amount // of data might be too large, results must be stored back in an alternative // collection or even a separate database, by setting the Out field of the // provided MapReduce job. In that case, provide nil as the result parameter. // // These are some of the ways to set Out: // // nil // Inline results into the result parameter. // // bson.M{"replace": "mycollection"} // The output will be inserted into a collection which replaces any // existing collection with the same name. // // bson.M{"merge": "mycollection"} // This option will merge new data into the old output collection. In // other words, if the same key exists in both the result set and the // old collection, the new key will overwrite the old one. // // bson.M{"reduce": "mycollection"} // If documents exist for a given key in the result set and in the old // collection, then a reduce operation (using the specified reduce // function) will be performed on the two values and the result will be // written to the output collection. If a finalize function was // provided, this will be run after the reduce as well. // // bson.M{...., "db": "mydb"} // Any of the above options can have the "db" key included for doing // the respective action in a separate database. // // The following is a trivial example which will count the number of // occurrences of a field named n on each document in a collection, and // will return results inline: // // job := &mgo.MapReduce{ // Map: "function() { emit(this.n, 1) }", // Reduce: "function(key, values) { return Array.sum(values) }", // } // var result []struct { Id int "_id"; Value int } // _, err := collection.Find(nil).MapReduce(job, &result) // if err != nil { // return err // } // for _, item := range result { // fmt.Println(item.Value) // } // // This function is compatible with MongoDB 1.7.4+. // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/MapReduce // func (q *Query) MapReduce(job *MapReduce, result interface{}) (info *MapReduceInfo, err error) { q.m.Lock() session := q.session op := q.op // Copy. limit := q.limit q.m.Unlock() c := strings.Index(op.collection, ".") if c < 0 { return nil, errors.New("Bad collection name: " + op.collection) } dbname := op.collection[:c] cname := op.collection[c+1:] cmd := mapReduceCmd{ Collection: cname, Map: job.Map, Reduce: job.Reduce, Finalize: job.Finalize, Out: fixMROut(job.Out), Scope: job.Scope, Verbose: job.Verbose, Query: op.query, Sort: op.options.OrderBy, Limit: limit, } if cmd.Out == nil { cmd.Out = bson.D{{"inline", 1}} } var doc mapReduceResult err = session.DB(dbname).Run(&cmd, &doc) if err != nil { return nil, err } if doc.Err != "" { return nil, errors.New(doc.Err) } info = &MapReduceInfo{ InputCount: doc.Counts.Input, EmitCount: doc.Counts.Emit, OutputCount: doc.Counts.Output, Time: doc.TimeMillis * 1e6, } if doc.Result.Kind == 0x02 { err = doc.Result.Unmarshal(&info.Collection) info.Database = dbname } else if doc.Result.Kind == 0x03 { var v struct{ Collection, Db string } err = doc.Result.Unmarshal(&v) info.Collection = v.Collection info.Database = v.Db } if doc.Timing != nil { info.VerboseTime = doc.Timing info.VerboseTime.Total *= 1e6 info.VerboseTime.Map *= 1e6 info.VerboseTime.EmitLoop *= 1e6 } if err != nil { return nil, err } if result != nil { return info, doc.Results.Unmarshal(result) } return info, nil } // The "out" option in the MapReduce command must be ordered. This was // found after the implementation was accepting maps for a long time, // so rather than breaking the API, we'll fix the order if necessary. // Details about the order requirement may be seen in MongoDB's code: // // http://goo.gl/L8jwJX // func fixMROut(out interface{}) interface{} { outv := reflect.ValueOf(out) if outv.Kind() != reflect.Map || outv.Type().Key() != reflect.TypeOf("") { return out } outs := make(bson.D, outv.Len()) outTypeIndex := -1 for i, k := range outv.MapKeys() { ks := k.String() outs[i].Name = ks outs[i].Value = outv.MapIndex(k).Interface() switch ks { case "normal", "replace", "merge", "reduce", "inline": outTypeIndex = i } } if outTypeIndex > 0 { outs[0], outs[outTypeIndex] = outs[outTypeIndex], outs[0] } return outs } // Change holds fields for running a findAndModify MongoDB command via // the Query.Apply method. type Change struct { Update interface{} // The update document Upsert bool // Whether to insert in case the document isn't found Remove bool // Whether to remove the document found rather than updating ReturnNew bool // Should the modified document be returned rather than the old one } type findModifyCmd struct { Collection string "findAndModify" Query, Update, Sort, Fields interface{} ",omitempty" Upsert, Remove, New bool ",omitempty" } type valueResult struct { Value bson.Raw LastError LastError "lastErrorObject" } // Apply runs the findAndModify MongoDB command, which allows updating, upserting // or removing a document matching a query and atomically returning either the old // version (the default) or the new version of the document (when ReturnNew is true). // If no objects are found Apply returns ErrNotFound. // // The Sort and Select query methods affect the result of Apply. In case // multiple documents match the query, Sort enables selecting which document to // act upon by ordering it first. Select enables retrieving only a selection // of fields of the new or old document. // // This simple example increments a counter and prints its new value: // // change := mgo.Change{ // Update: bson.M{"$inc": bson.M{"n": 1}}, // ReturnNew: true, // } // info, err = col.Find(M{"_id": id}).Apply(change, &doc) // fmt.Println(doc.N) // // This method depends on MongoDB >= 2.0 to work properly. // // Relevant documentation: // // http://www.mongodb.org/display/DOCS/findAndModify+Command // http://www.mongodb.org/display/DOCS/Updating // http://www.mongodb.org/display/DOCS/Atomic+Operations // func (q *Query) Apply(change Change, result interface{}) (info *ChangeInfo, err error) { q.m.Lock() session := q.session op := q.op // Copy. q.m.Unlock() c := strings.Index(op.collection, ".") if c < 0 { return nil, errors.New("bad collection name: " + op.collection) } dbname := op.collection[:c] cname := op.collection[c+1:] cmd := findModifyCmd{ Collection: cname, Update: change.Update, Upsert: change.Upsert, Remove: change.Remove, New: change.ReturnNew, Query: op.query, Sort: op.options.OrderBy, Fields: op.selector, } session = session.Clone() defer session.Close() session.SetMode(Strong, false) var doc valueResult err = session.DB(dbname).Run(&cmd, &doc) if err != nil { if qerr, ok := err.(*QueryError); ok && qerr.Message == "No matching object found" { return nil, ErrNotFound } return nil, err } if doc.LastError.N == 0 { return nil, ErrNotFound } if doc.Value.Kind != 0x0A && result != nil { err = doc.Value.Unmarshal(result) if err != nil { return nil, err } } info = &ChangeInfo{} lerr := &doc.LastError if lerr.UpdatedExisting { info.Updated = lerr.N info.Matched = lerr.N } else if change.Remove { info.Removed = lerr.N info.Matched = lerr.N } else if change.Upsert { info.UpsertedId = lerr.UpsertedId } return info, nil } // The BuildInfo type encapsulates details about the running MongoDB server. // // Note that the VersionArray field was introduced in MongoDB 2.0+, but it is // internally assembled from the Version information for previous versions. // In both cases, VersionArray is guaranteed to have at least 4 entries. type BuildInfo struct { Version string VersionArray []int `bson:"versionArray"` // On MongoDB 2.0+; assembled from Version otherwise GitVersion string `bson:"gitVersion"` OpenSSLVersion string `bson:"OpenSSLVersion"` SysInfo string `bson:"sysInfo"` // Deprecated and empty on MongoDB 3.2+. Bits int Debug bool MaxObjectSize int `bson:"maxBsonObjectSize"` } // VersionAtLeast returns whether the BuildInfo version is greater than or // equal to the provided version number. If more than one number is // provided, numbers will be considered as major, minor, and so on. func (bi *BuildInfo) VersionAtLeast(version ...int) bool { for i := range version { if i == len(bi.VersionArray) { return false } if bi.VersionArray[i] < version[i] { return false } } return true } // BuildInfo retrieves the version and other details about the // running MongoDB server. func (s *Session) BuildInfo() (info BuildInfo, err error) { err = s.Run(bson.D{{"buildInfo", "1"}}, &info) if len(info.VersionArray) == 0 { for _, a := range strings.Split(info.Version, ".") { i, err := strconv.Atoi(a) if err != nil { break } info.VersionArray = append(info.VersionArray, i) } } for len(info.VersionArray) < 4 { info.VersionArray = append(info.VersionArray, 0) } if i := strings.IndexByte(info.GitVersion, ' '); i >= 0 { // Strip off the " modules: enterprise" suffix. This is a _git version_. // That information may be moved to another field if people need it. info.GitVersion = info.GitVersion[:i] } if info.SysInfo == "deprecated" { info.SysInfo = "" } return } // --------------------------------------------------------------------------- // Internal session handling helpers. func (s *Session) acquireSocket(slaveOk bool) (*mongoSocket, error) { // Read-only lock to check for previously reserved socket. s.m.RLock() // If there is a slave socket reserved and its use is acceptable, take it as long // as there isn't a master socket which would be preferred by the read preference mode. if s.slaveSocket != nil && s.slaveOk && slaveOk && (s.masterSocket == nil || s.consistency != PrimaryPreferred && s.consistency != Monotonic) { socket := s.slaveSocket socket.Acquire() s.m.RUnlock() return socket, nil } if s.masterSocket != nil { socket := s.masterSocket socket.Acquire() s.m.RUnlock() return socket, nil } s.m.RUnlock() // No go. We may have to request a new socket and change the session, // so try again but with an exclusive lock now. s.m.Lock() defer s.m.Unlock() if s.slaveSocket != nil && s.slaveOk && slaveOk && (s.masterSocket == nil || s.consistency != PrimaryPreferred && s.consistency != Monotonic) { s.slaveSocket.Acquire() return s.slaveSocket, nil } if s.masterSocket != nil { s.masterSocket.Acquire() return s.masterSocket, nil } // Still not good. We need a new socket. sock, err := s.cluster().AcquireSocket(s.consistency, slaveOk && s.slaveOk, s.syncTimeout, s.sockTimeout, s.queryConfig.op.serverTags, s.poolLimit) if err != nil { return nil, err } // Authenticate the new socket. if err = s.socketLogin(sock); err != nil { sock.Release() return nil, err } // Keep track of the new socket, if necessary. // Note that, as a special case, if the Eventual session was // not refreshed (s.slaveSocket != nil), it means the developer // asked to preserve an existing reserved socket, so we'll // keep a master one around too before a Refresh happens. if s.consistency != Eventual || s.slaveSocket != nil { s.setSocket(sock) } // Switch over a Monotonic session to the master. if !slaveOk && s.consistency == Monotonic { s.slaveOk = false } return sock, nil } // setSocket binds socket to this section. func (s *Session) setSocket(socket *mongoSocket) { info := socket.Acquire() if info.Master { if s.masterSocket != nil { panic("setSocket(master) with existing master socket reserved") } s.masterSocket = socket } else { if s.slaveSocket != nil { panic("setSocket(slave) with existing slave socket reserved") } s.slaveSocket = socket } } // unsetSocket releases any slave and/or master sockets reserved. func (s *Session) unsetSocket() { if s.masterSocket != nil { s.masterSocket.Release() } if s.slaveSocket != nil { s.slaveSocket.Release() } s.masterSocket = nil s.slaveSocket = nil } func (iter *Iter) replyFunc() replyFunc { return func(err error, op *replyOp, docNum int, docData []byte) { iter.m.Lock() iter.docsToReceive-- if err != nil { iter.err = err debugf("Iter %p received an error: %s", iter, err.Error()) } else if docNum == -1 { debugf("Iter %p received no documents (cursor=%d).", iter, op.cursorId) if op != nil && op.cursorId != 0 { // It's a tailable cursor. iter.op.cursorId = op.cursorId } else if op != nil && op.cursorId == 0 && op.flags&1 == 1 { // Cursor likely timed out. iter.err = ErrCursor } else { iter.err = ErrNotFound } } else if iter.findCmd { debugf("Iter %p received reply document %d/%d (cursor=%d)", iter, docNum+1, int(op.replyDocs), op.cursorId) var findReply struct { Ok bool Code int Errmsg string Cursor cursorData } if err := bson.Unmarshal(docData, &findReply); err != nil { iter.err = err } else if !findReply.Ok && findReply.Errmsg != "" { iter.err = &QueryError{Code: findReply.Code, Message: findReply.Errmsg} } else if len(findReply.Cursor.FirstBatch) == 0 && len(findReply.Cursor.NextBatch) == 0 { iter.err = ErrNotFound } else { batch := findReply.Cursor.FirstBatch if len(batch) == 0 { batch = findReply.Cursor.NextBatch } rdocs := len(batch) for _, raw := range batch { iter.docData.Push(raw.Data) } iter.docsToReceive = 0 docsToProcess := iter.docData.Len() if iter.limit == 0 || int32(docsToProcess) < iter.limit { iter.docsBeforeMore = docsToProcess - int(iter.prefetch*float64(rdocs)) } else { iter.docsBeforeMore = -1 } iter.op.cursorId = findReply.Cursor.Id } } else { rdocs := int(op.replyDocs) if docNum == 0 { iter.docsToReceive += rdocs - 1 docsToProcess := iter.docData.Len() + rdocs if iter.limit == 0 || int32(docsToProcess) < iter.limit { iter.docsBeforeMore = docsToProcess - int(iter.prefetch*float64(rdocs)) } else { iter.docsBeforeMore = -1 } iter.op.cursorId = op.cursorId } debugf("Iter %p received reply document %d/%d (cursor=%d)", iter, docNum+1, rdocs, op.cursorId) iter.docData.Push(docData) } iter.gotReply.Broadcast() iter.m.Unlock() } } type writeCmdResult struct { Ok bool N int NModified int `bson:"nModified"` Upserted []struct { Index int Id interface{} `_id` } ConcernError writeConcernError `bson:"writeConcernError"` Errors []writeCmdError `bson:"writeErrors"` } type writeConcernError struct { Code int ErrMsg string } type writeCmdError struct { Index int Code int ErrMsg string } func (r *writeCmdResult) BulkErrorCases() []BulkErrorCase { ecases := make([]BulkErrorCase, len(r.Errors)) for i, err := range r.Errors { ecases[i] = BulkErrorCase{err.Index, &QueryError{Code: err.Code, Message: err.ErrMsg}} } return ecases } // writeOp runs the given modifying operation, potentially followed up // by a getLastError command in case the session is in safe mode. The // LastError result is made available in lerr, and if lerr.Err is set it // will also be returned as err. func (c *Collection) writeOp(op interface{}, ordered bool) (lerr *LastError, err error) { s := c.Database.Session socket, err := s.acquireSocket(c.Database.Name == "local") if err != nil { return nil, err } defer socket.Release() s.m.RLock() safeOp := s.safeOp bypassValidation := s.bypassValidation s.m.RUnlock() if socket.ServerInfo().MaxWireVersion >= 2 { // Servers with a more recent write protocol benefit from write commands. if op, ok := op.(*insertOp); ok && len(op.documents) > 1000 { var lerr LastError // Maximum batch size is 1000. Must split out in separate operations for compatibility. all := op.documents for i := 0; i < len(all); i += 1000 { l := i + 1000 if l > len(all) { l = len(all) } op.documents = all[i:l] oplerr, err := c.writeOpCommand(socket, safeOp, op, ordered, bypassValidation) lerr.N += oplerr.N lerr.modified += oplerr.modified if err != nil { for ei := range lerr.ecases { oplerr.ecases[ei].Index += i } lerr.ecases = append(lerr.ecases, oplerr.ecases...) if op.flags&1 == 0 { return &lerr, err } } } if len(lerr.ecases) != 0 { return &lerr, lerr.ecases[0].Err } return &lerr, nil } return c.writeOpCommand(socket, safeOp, op, ordered, bypassValidation) } else if updateOps, ok := op.(bulkUpdateOp); ok { var lerr LastError for i, updateOp := range updateOps { oplerr, err := c.writeOpQuery(socket, safeOp, updateOp, ordered) lerr.N += oplerr.N lerr.modified += oplerr.modified if err != nil { lerr.ecases = append(lerr.ecases, BulkErrorCase{i, err}) if ordered { break } } } if len(lerr.ecases) != 0 { return &lerr, lerr.ecases[0].Err } return &lerr, nil } else if deleteOps, ok := op.(bulkDeleteOp); ok { var lerr LastError for i, deleteOp := range deleteOps { oplerr, err := c.writeOpQuery(socket, safeOp, deleteOp, ordered) lerr.N += oplerr.N lerr.modified += oplerr.modified if err != nil { lerr.ecases = append(lerr.ecases, BulkErrorCase{i, err}) if ordered { break } } } if len(lerr.ecases) != 0 { return &lerr, lerr.ecases[0].Err } return &lerr, nil } return c.writeOpQuery(socket, safeOp, op, ordered) } func (c *Collection) writeOpQuery(socket *mongoSocket, safeOp *queryOp, op interface{}, ordered bool) (lerr *LastError, err error) { if safeOp == nil { return nil, socket.Query(op) } var mutex sync.Mutex var replyData []byte var replyErr error mutex.Lock() query := *safeOp // Copy the data. query.collection = c.Database.Name + ".$cmd" query.replyFunc = func(err error, reply *replyOp, docNum int, docData []byte) { replyData = docData replyErr = err mutex.Unlock() } err = socket.Query(op, &query) if err != nil { return nil, err } mutex.Lock() // Wait. if replyErr != nil { return nil, replyErr // XXX TESTME } if hasErrMsg(replyData) { // Looks like getLastError itself failed. err = checkQueryError(query.collection, replyData) if err != nil { return nil, err } } result := &LastError{} bson.Unmarshal(replyData, &result) debugf("Result from writing query: %#v", result) if result.Err != "" { result.ecases = []BulkErrorCase{{Index: 0, Err: result}} if insert, ok := op.(*insertOp); ok && len(insert.documents) > 1 { result.ecases[0].Index = -1 } return result, result } // With MongoDB <2.6 we don't know how many actually changed, so make it the same as matched. result.modified = result.N return result, nil } func (c *Collection) writeOpCommand(socket *mongoSocket, safeOp *queryOp, op interface{}, ordered, bypassValidation bool) (lerr *LastError, err error) { var writeConcern interface{} if safeOp == nil { writeConcern = bson.D{{"w", 0}} } else { writeConcern = safeOp.query.(*getLastError) } var cmd bson.D switch op := op.(type) { case *insertOp: // http://docs.mongodb.org/manual/reference/command/insert cmd = bson.D{ {"insert", c.Name}, {"documents", op.documents}, {"writeConcern", writeConcern}, {"ordered", op.flags&1 == 0}, } case *updateOp: // http://docs.mongodb.org/manual/reference/command/update cmd = bson.D{ {"update", c.Name}, {"updates", []interface{}{op}}, {"writeConcern", writeConcern}, {"ordered", ordered}, } case bulkUpdateOp: // http://docs.mongodb.org/manual/reference/command/update cmd = bson.D{ {"update", c.Name}, {"updates", op}, {"writeConcern", writeConcern}, {"ordered", ordered}, } case *deleteOp: // http://docs.mongodb.org/manual/reference/command/delete cmd = bson.D{ {"delete", c.Name}, {"deletes", []interface{}{op}}, {"writeConcern", writeConcern}, {"ordered", ordered}, } case bulkDeleteOp: // http://docs.mongodb.org/manual/reference/command/delete cmd = bson.D{ {"delete", c.Name}, {"deletes", op}, {"writeConcern", writeConcern}, {"ordered", ordered}, } } if bypassValidation { cmd = append(cmd, bson.DocElem{"bypassDocumentValidation", true}) } var result writeCmdResult err = c.Database.run(socket, cmd, &result) debugf("Write command result: %#v (err=%v)", result, err) ecases := result.BulkErrorCases() lerr = &LastError{ UpdatedExisting: result.N > 0 && len(result.Upserted) == 0, N: result.N, modified: result.NModified, ecases: ecases, } if len(result.Upserted) > 0 { lerr.UpsertedId = result.Upserted[0].Id } if len(result.Errors) > 0 { e := result.Errors[0] lerr.Code = e.Code lerr.Err = e.ErrMsg err = lerr } else if result.ConcernError.Code != 0 { e := result.ConcernError lerr.Code = e.Code lerr.Err = e.ErrMsg err = lerr } if err == nil && safeOp == nil { return nil, nil } return lerr, err } func hasErrMsg(d []byte) bool { l := len(d) for i := 0; i+8 < l; i++ { if d[i] == '\x02' && d[i+1] == 'e' && d[i+2] == 'r' && d[i+3] == 'r' && d[i+4] == 'm' && d[i+5] == 's' && d[i+6] == 'g' && d[i+7] == '\x00' { return true } } return false }
flynn/flynn
vendor/gopkg.in/mgo.v2/session.go
GO
bsd-3-clause
144,946
<!-- @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> <link rel="import" href="../polymer/polymer.html"> <link rel="import" href="../iron-resizable-behavior/iron-resizable-behavior.html"> <!-- `paper-scroll-header-panel` contains a header section and a content section. The header is initially on the top part of the view but it scrolls away with the rest of the scrollable content. Upon scrolling slightly up at any point, the header scrolls back into view. This saves screen space and allows users to access important controls by easily moving them back to the view. __Important:__ The `paper-scroll-header-panel` will not display if its parent does not have a height. Using [layout attributes](http://www.polymer-project.org/docs/polymer/layout-attrs.html), you can easily make the `paper-scroll-header-panel` fill the screen <body class="fullbleed layout vertical"> <paper-scroll-header-panel class="flex"> <paper-toolbar> <div>Hello World!</div> </paper-toolbar> </paper-scroll-header-panel> </body> or, if you would prefer to do it in CSS, just give `html`, `body`, and `paper-scroll-header-panel` a height of 100%: html, body { height: 100%; margin: 0; } paper-scroll-header-panel { height: 100%; } `paper-scroll-header-panel` works well with `paper-toolbar` but can use any element that represents a header by adding a `paper-header` class to it. <paper-scroll-header-panel> <paper-toolbar>Header</paper-toolbar> <div>Content goes here...</div> </paper-scroll-header-panel> Styling scroll-header-panel: To change background for toolbar when it is at its full size: paper-scroll-header-panel { --paper-scroll-header-panel-full-header: { background-color: red; }; } To change the background for toolbar when it is condensed: paper-scroll-header-panel { --paper-scroll-header-panel-condensed-header: { background-color: #f4b400; }; } @group Paper Element @element paper-scrollheader-panel @demo demo/index.html @hero hero.svg --> <dom-module id="paper-scroll-header-panel"> <style> :host { display: block; position: relative; overflow: hidden; } #mainContainer { position: absolute; top: 0; right: 0; bottom: 0; left: 0; box-sizing: border-box; -moz-box-sizing: border-box; -webkit-overflow-scrolling: touch; overflow-x: hidden; overflow-_y: auto; -webkit-transform: translateZ(0); transform: translateZ(0); } #headerContainer { position: absolute; top: 0; right: 0; left: 0; } .bg-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; } #headerBg { @apply(--paper-scroll-header-panel-full-header); } #condensedHeaderBg { @apply(--paper-scroll-header-panel-condensed-header); } #headerBg, #condensedHeaderBg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-repeat: no-repeat; background-size: cover; background-position: center center; } #condensedHeaderBg { opacity: 0; } </style> <template> <div id="mainContainer"> <content id="mainContent" select=":not(paper-toolbar):not(.paper-header)"></content> </div> <div id="headerContainer"> <div class="bg-container"> <div id="condensedHeaderBg"></div> <div id="headerBg"></div> </div> <content id="headerContent" select="paper-toolbar, .paper-header"></content> </div> </template> </dom-module> <script> (function() { 'use strict'; Polymer({ /** * Fired when the content has been scrolled. * * @event content-scroll */ /** * Fired when the header is transformed. * * @event paper-header-transform */ is: 'paper-scroll-header-panel', behaviors: [ Polymer.IronResizableBehavior ], properties: { /** * If true, the header's height will condense to `_condensedHeaderHeight` * as the user scrolls down from the top of the content area. */ condenses: { type: Boolean, value: false, observer: '_condensesChanged' }, /** * If true, no cross-fade transition from one background to another. */ noDissolve: { type: Boolean, value: false }, /** * If true, the header doesn't slide back in when scrolling back up. */ noReveal: { type: Boolean, value: false }, /** * If true, the header is fixed to the top and never moves away. */ fixed: { type: Boolean, value: false }, /** * If true, the condensed header is always shown and does not move away. */ keepCondensedHeader: { type: Boolean, value: false }, /** * The height of the header when it is at its full size. * * By default, the height will be measured when it is ready. If the height * changes later the user needs to either set this value to reflect the * new height or invoke `measureHeaderHeight()`. */ headerHeight: { type: Number, value: 0 }, /** * The height of the header when it is condensed. * * By default, `_condensedHeaderHeight` is 1/3 of `headerHeight` unless * this is specified. */ condensedHeaderHeight: { type: Number, value: 0 }, /** * By default, the top part of the header stays when the header is being * condensed. Set this to true if you want the top part of the header * to be scrolled away. */ scrollAwayTopbar: { type: Boolean, value: false }, _headerMargin: { type: Number }, _prevScrollTop: { type: Number }, _y: { type: Number } }, observers: [ '_setup(_headerMargin, headerHeight, fixed)', '_headerHeightChanged(headerHeight, condensedHeaderHeight)', '_condensedHeaderHeightChanged(headerHeight, condensedHeaderHeight)' ], listeners: { 'iron-resize': 'measureHeaderHeight' }, ready: function() { this.async(this.measureHeaderHeight, 5); this._scrollHandler = this._scroll.bind(this); this.scroller.addEventListener('scroll', this._scrollHandler); }, detached: function() { this.scroller.removeEventListener('scroll', this._scrollHandler); }, /** * Returns the header element. * * @property header * @type Object */ get header() { return Polymer.dom(this.$.headerContent).getDistributedNodes()[0]; }, /** * Returns the content element. * * @property content * @type Object */ get content() { return Polymer.dom(this.$.mainContent).getDistributedNodes()[0]; }, /** * Returns the scrollable element. * * @property scroller * @type Object */ get scroller() { return this.$.mainContainer; }, /** * Invoke this to tell `paper-scroll-header-panel` to re-measure the header's * height. * * @method measureHeaderHeight */ measureHeaderHeight: function() { var header = this.header; if (header && header.offsetHeight) { this.headerHeight = header.offsetHeight; } }, _headerHeightChanged: function() { if (!this.condensedHeaderHeight) { // assume condensedHeaderHeight is 1/3 of the headerHeight this.condensedHeaderHeight = this.headerHeight * 1 / 3; } }, _condensedHeaderHeightChanged: function() { if (this.headerHeight) { this._headerMargin = this.headerHeight - this.condensedHeaderHeight; } }, _condensesChanged: function() { if (this.condenses) { this._scroll(); } else { // reset transform/opacity set on the header this._condenseHeader(null); } }, _setup: function() { var s = this.scroller.style; s.paddingTop = this.fixed ? '' : this.headerHeight + 'px'; s.top = this.fixed ? this.headerHeight + 'px' : ''; if (this.fixed) { this._transformHeader(null); } else { this._scroll(); } }, _transformHeader: function(y) { var s = this.$.headerContainer.style; this._translateY(s, -y); if (this.condenses) { this._condenseHeader(y); } this.fire('paper-header-transform', {y: y, height: this.headerHeight, condensedHeight: this.condensedHeaderHeight}); }, _condenseHeader: function(y) { var reset = (y === null); // adjust top bar in paper-header so the top bar stays at the top if (!this.scrollAwayTopbar && this.header.$ && this.header.$.topBar) { this._translateY(this.header.$.topBar.style, reset ? null : Math.min(y, this._headerMargin)); } // transition header bg var hbg = this.$.headerBg.style; if (!this.noDissolve) { hbg.opacity = reset ? '' : (this._headerMargin - y) / this._headerMargin; } // adjust header bg so it stays at the center this._translateY(hbg, reset ? null : y / 2); // transition condensed header bg if (!this.noDissolve) { var chbg = this.$.condensedHeaderBg.style; chbg = this.$.condensedHeaderBg.style; chbg.opacity = reset ? '' : y / this._headerMargin; // adjust condensed header bg so it stays at the center this._translateY(chbg, reset ? null : y / 2); } }, _translateY: function(s, y) { var t = (y === null) ? '' : 'translate3d(0, ' + y + 'px, 0)'; setTransform(s, t); }, /** @param {Event=} event */ _scroll: function(event) { if (!this.header) { return; } var sTop = this.scroller.scrollTop; this._y = this._y || 0; this._prevScrollTop = this._prevScrollTop || 0; var y = Math.min(this.keepCondensedHeader ? this._headerMargin : this.headerHeight, Math.max(0, (this.noReveal ? sTop : this._y + sTop - this._prevScrollTop))); if (this.condenses && this._prevScrollTop >= sTop && sTop > this._headerMargin) { y = Math.max(y, this._headerMargin); } if (!event || !this.fixed && y !== this._y) { this._transformHeader(y); } this._prevScrollTop = Math.max(sTop, 0); this._y = y; if (event) { this.fire('content-scroll', {target: this.scroller}, {cancelable: false}); } } }); //determine proper transform mechanizm if (document.documentElement.style.transform !== undefined) { var setTransform = function(style, string) { style.transform = string; } } else { var setTransform = function(style, string) { style.webkitTransform = string; } } })(); </script>
abhinavzspace/notebookApp
app/bower_components/paper-scroll-header-panel/paper-scroll-header-panel.html
HTML
bsd-3-clause
11,661
<?php /** * PhpThumb GD Thumb Class Definition File * * This file contains the definition for the GdThumb object * * PHP Version 5 with GD 2.0+ * PhpThumb : PHP Thumb Library <http://phpthumb.gxdlabs.com> * Copyright (c) 2009, Ian Selby/Gen X Design * * Author(s): Ian Selby <ian@gen-x-design.com> * * Licensed under the MIT License * Redistributions of files must retain the above copyright notice. * * @author Ian Selby <ian@gen-x-design.com> * @copyright Copyright (c) 2009 Gen X Design * @link http://phpthumb.gxdlabs.com * @license http://www.opensource.org/licenses/mit-license.php The MIT License * @version 3.0 * @package PhpThumb * @filesource */ /** * GdThumb Class Definition * * This is the GD Implementation of the PHP Thumb library. * * @package PhpThumb * @subpackage Core */ class GdThumb extends ThumbBase { /** * The prior image (before manipulation) * * @var resource */ protected $oldImage; /** * The working image (used during manipulation) * * @var resource */ protected $workingImage; /** * The current dimensions of the image * * @var array */ protected $currentDimensions; /** * The new, calculated dimensions of the image * * @var array */ protected $newDimensions; /** * The options for this class * * This array contains various options that determine the behavior in * various functions throughout the class. Functions note which specific * option key / values are used in their documentation * * @var array */ protected $options; /** * The maximum width an image can be after resizing (in pixels) * * @var int */ protected $maxWidth; /** * The maximum height an image can be after resizing (in pixels) * * @var int */ protected $maxHeight; /** * The percentage to resize the image by * * @var int */ protected $percent; /** * Class Constructor * * @return GdThumb * @param string $fileName */ public function __construct ($fileName, $options = array(), $isDataStream = false) { parent::__construct($fileName, $isDataStream); $this->determineFormat(); if ($this->isDataStream === false) { $this->verifyFormatCompatiblity(); } switch ($this->format) { case 'GIF': $this->oldImage = imagecreatefromgif($this->fileName); break; case 'JPG': $this->oldImage = imagecreatefromjpeg($this->fileName); break; case 'PNG': $this->oldImage = imagecreatefrompng($this->fileName); break; case 'STRING': $this->oldImage = imagecreatefromstring($this->fileName); break; } $this->currentDimensions = array ( 'width' => imagesx($this->oldImage), 'height' => imagesy($this->oldImage) ); $this->setOptions($options); // TODO: Port gatherImageMeta to a separate function that can be called to extract exif data } /** * Class Destructor * */ public function __destruct () { if (is_resource($this->oldImage)) { imagedestroy($this->oldImage); } if (is_resource($this->workingImage)) { imagedestroy($this->workingImage); } } ############################## # ----- API FUNCTIONS ------ # ############################## /** * Resizes an image to be no larger than $maxWidth or $maxHeight * * If either param is set to zero, then that dimension will not be considered as a part of the resize. * Additionally, if $this->options['resizeUp'] is set to true (false by default), then this function will * also scale the image up to the maximum dimensions provided. * * @param int $maxWidth The maximum width of the image in pixels * @param int $maxHeight The maximum height of the image in pixels * @return GdThumb */ public function resize ($maxWidth = 0, $maxHeight = 0) { // make sure our arguments are valid if (!is_numeric($maxWidth)) { throw new InvalidArgumentException('$maxWidth must be numeric'); } if (!is_numeric($maxHeight)) { throw new InvalidArgumentException('$maxHeight must be numeric'); } // make sure we're not exceeding our image size if we're not supposed to if ($this->options['resizeUp'] === false) { $this->maxHeight = (intval($maxHeight) > $this->currentDimensions['height']) ? $this->currentDimensions['height'] : $maxHeight; $this->maxWidth = (intval($maxWidth) > $this->currentDimensions['width']) ? $this->currentDimensions['width'] : $maxWidth; } else { $this->maxHeight = intval($maxHeight); $this->maxWidth = intval($maxWidth); } // get the new dimensions... $this->calcImageSize($this->currentDimensions['width'], $this->currentDimensions['height']); // create the working image if (function_exists('imagecreatetruecolor')) { $this->workingImage = imagecreatetruecolor($this->newDimensions['newWidth'], $this->newDimensions['newHeight']); } else { $this->workingImage = imagecreate($this->newDimensions['newWidth'], $this->newDimensions['newHeight']); } $this->preserveAlpha(); // and create the newly sized image imagecopyresampled ( $this->workingImage, $this->oldImage, 0, 0, 0, 0, $this->newDimensions['newWidth'], $this->newDimensions['newHeight'], $this->currentDimensions['width'], $this->currentDimensions['height'] ); // update all the variables and resources to be correct $this->oldImage = $this->workingImage; $this->currentDimensions['width'] = $this->newDimensions['newWidth']; $this->currentDimensions['height'] = $this->newDimensions['newHeight']; return $this; } /** * Adaptively Resizes the Image * * This function attempts to get the image to as close to the provided dimensions as possible, and then crops the * remaining overflow (from the center) to get the image to be the size specified * * @param int $maxWidth * @param int $maxHeight * @return GdThumb */ public function adaptiveResize ($width, $height) { // make sure our arguments are valid if ((!is_numeric($width) || $width == 0) && (!is_numeric($height) || $height == 0)) { throw new InvalidArgumentException('$width and $height must be numeric and greater than zero'); } if (!is_numeric($width) || $width == 0) { $width = ( $height * $this->currentDimensions['width'] ) / $this->currentDimensions['height']; } if (!is_numeric($height) || $height == 0) { $height = ( $width * $this->currentDimensions['height'] ) / $this->currentDimensions['width']; } // make sure we're not exceeding our image size if we're not supposed to if ($this->options['resizeUp'] === false) { $this->maxHeight = (intval($height) > $this->currentDimensions['height']) ? $this->currentDimensions['height'] : $height; $this->maxWidth = (intval($width) > $this->currentDimensions['width']) ? $this->currentDimensions['width'] : $width; } else { $this->maxHeight = intval($height); $this->maxWidth = intval($width); } $this->calcImageSizeStrict($this->currentDimensions['width'], $this->currentDimensions['height']); // resize the image to be close to our desired dimensions $this->resize($this->newDimensions['newWidth'], $this->newDimensions['newHeight']); // reset the max dimensions... if ($this->options['resizeUp'] === false) { $this->maxHeight = (intval($height) > $this->currentDimensions['height']) ? $this->currentDimensions['height'] : $height; $this->maxWidth = (intval($width) > $this->currentDimensions['width']) ? $this->currentDimensions['width'] : $width; } else { $this->maxHeight = intval($height); $this->maxWidth = intval($width); } // create the working image if (function_exists('imagecreatetruecolor')) { $this->workingImage = imagecreatetruecolor($this->maxWidth, $this->maxHeight); } else { $this->workingImage = imagecreate($this->maxWidth, $this->maxHeight); } $this->preserveAlpha(); $cropWidth = $this->maxWidth; $cropHeight = $this->maxHeight; $cropX = 0; $cropY = 0; // now, figure out how to crop the rest of the image... if ($this->currentDimensions['width'] > $this->maxWidth) { $cropX = intval(($this->currentDimensions['width'] - $this->maxWidth) / 2); } elseif ($this->currentDimensions['height'] > $this->maxHeight) { $cropY = intval(($this->currentDimensions['height'] - $this->maxHeight) / 2); } imagecopyresampled ( $this->workingImage, $this->oldImage, 0, 0, $cropX, $cropY, $cropWidth, $cropHeight, $cropWidth, $cropHeight ); // update all the variables and resources to be correct $this->oldImage = $this->workingImage; $this->currentDimensions['width'] = $this->maxWidth; $this->currentDimensions['height'] = $this->maxHeight; return $this; } /** * Adaptively Resizes the Image and Crops Using a Percentage * * This function attempts to get the image to as close to the provided dimensions as possible, and then crops the * remaining overflow using a provided percentage to get the image to be the size specified. * * The percentage mean different things depending on the orientation of the original image. * * For Landscape images: * --------------------- * * A percentage of 1 would crop the image all the way to the left, which would be the same as * using adaptiveResizeQuadrant() with $quadrant = 'L' * * A percentage of 50 would crop the image to the center which would be the same as using * adaptiveResizeQuadrant() with $quadrant = 'C', or even the original adaptiveResize() * * A percentage of 100 would crop the image to the image all the way to the right, etc, etc. * Note that you can use any percentage between 1 and 100. * * For Portrait images: * -------------------- * * This works the same as for Landscape images except that a percentage of 1 means top and 100 means bottom * * @param int $maxWidth * @param int $maxHeight * @param int $percent * @return GdThumb */ public function adaptiveResizePercent ($width, $height, $percent = 50) { // make sure our arguments are valid if (!is_numeric($width) || $width == 0) { throw new InvalidArgumentException('$width must be numeric and greater than zero'); } if (!is_numeric($height) || $height == 0) { throw new InvalidArgumentException('$height must be numeric and greater than zero'); } // make sure we're not exceeding our image size if we're not supposed to if ($this->options['resizeUp'] === false) { $this->maxHeight = (intval($height) > $this->currentDimensions['height']) ? $this->currentDimensions['height'] : $height; $this->maxWidth = (intval($width) > $this->currentDimensions['width']) ? $this->currentDimensions['width'] : $width; } else { $this->maxHeight = intval($height); $this->maxWidth = intval($width); } $this->calcImageSizeStrict($this->currentDimensions['width'], $this->currentDimensions['height']); // resize the image to be close to our desired dimensions $this->resize($this->newDimensions['newWidth'], $this->newDimensions['newHeight']); // reset the max dimensions... if ($this->options['resizeUp'] === false) { $this->maxHeight = (intval($height) > $this->currentDimensions['height']) ? $this->currentDimensions['height'] : $height; $this->maxWidth = (intval($width) > $this->currentDimensions['width']) ? $this->currentDimensions['width'] : $width; } else { $this->maxHeight = intval($height); $this->maxWidth = intval($width); } // create the working image if (function_exists('imagecreatetruecolor')) { $this->workingImage = imagecreatetruecolor($this->maxWidth, $this->maxHeight); } else { $this->workingImage = imagecreate($this->maxWidth, $this->maxHeight); } $this->preserveAlpha(); $cropWidth = $this->maxWidth; $cropHeight = $this->maxHeight; $cropX = 0; $cropY = 0; // Crop the rest of the image using the quadrant if ($percent > 100) { $percent = 100; } elseif ($percent < 1) { $percent = 1; } if ($this->currentDimensions['width'] > $this->maxWidth) { // Image is landscape $maxCropX = $this->currentDimensions['width'] - $this->maxWidth; $cropX = intval(($percent / 100) * $maxCropX); } elseif ($this->currentDimensions['height'] > $this->maxHeight) { // Image is portrait $maxCropY = $this->currentDimensions['height'] - $this->maxHeight; $cropY = intval(($percent / 100) * $maxCropY); } imagecopyresampled ( $this->workingImage, $this->oldImage, 0, 0, $cropX, $cropY, $cropWidth, $cropHeight, $cropWidth, $cropHeight ); // update all the variables and resources to be correct $this->oldImage = $this->workingImage; $this->currentDimensions['width'] = $this->maxWidth; $this->currentDimensions['height'] = $this->maxHeight; return $this; } /** * Adaptively Resizes the Image and Crops Using a Quadrant * * This function attempts to get the image to as close to the provided dimensions as possible, and then crops the * remaining overflow using the quadrant to get the image to be the size specified. * * The quadrants available are Top, Bottom, Center, Left, and Right: * * * +---+---+---+ * | | T | | * +---+---+---+ * | L | C | R | * +---+---+---+ * | | B | | * +---+---+---+ * * Note that if your image is Landscape and you choose either of the Top or Bottom quadrants (which won't * make sence since only the Left and Right would be available, then the Center quadrant will be used * to crop. This would have exactly the same result as using adaptiveResize(). * The same goes if your image is portrait and you choose either the Left or Right quadrants. * * @param int $maxWidth * @param int $maxHeight * @param string $quadrant T, B, C, L, R * @return GdThumb */ public function adaptiveResizeQuadrant ($width, $height, $quadrant = 'C') { // make sure our arguments are valid if (!is_numeric($width) || $width == 0) { throw new InvalidArgumentException('$width must be numeric and greater than zero'); } if (!is_numeric($height) || $height == 0) { throw new InvalidArgumentException('$height must be numeric and greater than zero'); } // make sure we're not exceeding our image size if we're not supposed to if ($this->options['resizeUp'] === false) { $this->maxHeight = (intval($height) > $this->currentDimensions['height']) ? $this->currentDimensions['height'] : $height; $this->maxWidth = (intval($width) > $this->currentDimensions['width']) ? $this->currentDimensions['width'] : $width; } else { $this->maxHeight = intval($height); $this->maxWidth = intval($width); } $this->calcImageSizeStrict($this->currentDimensions['width'], $this->currentDimensions['height']); // resize the image to be close to our desired dimensions $this->resize($this->newDimensions['newWidth'], $this->newDimensions['newHeight']); // reset the max dimensions... if ($this->options['resizeUp'] === false) { $this->maxHeight = (intval($height) > $this->currentDimensions['height']) ? $this->currentDimensions['height'] : $height; $this->maxWidth = (intval($width) > $this->currentDimensions['width']) ? $this->currentDimensions['width'] : $width; } else { $this->maxHeight = intval($height); $this->maxWidth = intval($width); } // create the working image if (function_exists('imagecreatetruecolor')) { $this->workingImage = imagecreatetruecolor($this->maxWidth, $this->maxHeight); } else { $this->workingImage = imagecreate($this->maxWidth, $this->maxHeight); } $this->preserveAlpha(); $cropWidth = $this->maxWidth; $cropHeight = $this->maxHeight; $cropX = 0; $cropY = 0; // Crop the rest of the image using the quadrant if ($this->currentDimensions['width'] > $this->maxWidth) { // Image is landscape switch ($quadrant) { case 'L': $cropX = 0; break; case 'R': $cropX = intval(($this->currentDimensions['width'] - $this->maxWidth)); break; case 'C': default: $cropX = intval(($this->currentDimensions['width'] - $this->maxWidth) / 2); break; } } elseif ($this->currentDimensions['height'] > $this->maxHeight) { // Image is portrait switch ($quadrant) { case 'T': $cropY = 0; break; case 'B': $cropY = intval(($this->currentDimensions['height'] - $this->maxHeight)); break; case 'C': default: $cropY = intval(($this->currentDimensions['height'] - $this->maxHeight) / 2); break; } } imagecopyresampled ( $this->workingImage, $this->oldImage, 0, 0, $cropX, $cropY, $cropWidth, $cropHeight, $cropWidth, $cropHeight ); // update all the variables and resources to be correct $this->oldImage = $this->workingImage; $this->currentDimensions['width'] = $this->maxWidth; $this->currentDimensions['height'] = $this->maxHeight; return $this; } /** * Resizes an image by a given percent uniformly * * Percentage should be whole number representation (i.e. 1-100) * * @param int $percent * @return GdThumb */ public function resizePercent ($percent = 0) { if (!is_numeric($percent)) { throw new InvalidArgumentException ('$percent must be numeric'); } $this->percent = intval($percent); $this->calcImageSizePercent($this->currentDimensions['width'], $this->currentDimensions['height']); if (function_exists('imagecreatetruecolor')) { $this->workingImage = imagecreatetruecolor($this->newDimensions['newWidth'], $this->newDimensions['newHeight']); } else { $this->workingImage = imagecreate($this->newDimensions['newWidth'], $this->newDimensions['newHeight']); } $this->preserveAlpha(); ImageCopyResampled( $this->workingImage, $this->oldImage, 0, 0, 0, 0, $this->newDimensions['newWidth'], $this->newDimensions['newHeight'], $this->currentDimensions['width'], $this->currentDimensions['height'] ); $this->oldImage = $this->workingImage; $this->currentDimensions['width'] = $this->newDimensions['newWidth']; $this->currentDimensions['height'] = $this->newDimensions['newHeight']; return $this; } /** * Crops an image from the center with provided dimensions * * If no height is given, the width will be used as a height, thus creating a square crop * * @param int $cropWidth * @param int $cropHeight * @return GdThumb */ public function cropFromCenter ($cropWidth, $cropHeight = null) { if (!is_numeric($cropWidth)) { throw new InvalidArgumentException('$cropWidth must be numeric'); } if ($cropHeight !== null && !is_numeric($cropHeight)) { throw new InvalidArgumentException('$cropHeight must be numeric'); } if ($cropHeight === null) { $cropHeight = $cropWidth; } $cropWidth = ($this->currentDimensions['width'] < $cropWidth) ? $this->currentDimensions['width'] : $cropWidth; $cropHeight = ($this->currentDimensions['height'] < $cropHeight) ? $this->currentDimensions['height'] : $cropHeight; $cropX = intval(($this->currentDimensions['width'] - $cropWidth) / 2); $cropY = intval(($this->currentDimensions['height'] - $cropHeight) / 2); $this->crop($cropX, $cropY, $cropWidth, $cropHeight); return $this; } /** * Vanilla Cropping - Crops from x,y with specified width and height * * @param int $startX * @param int $startY * @param int $cropWidth * @param int $cropHeight * @return GdThumb */ public function crop ($startX, $startY, $cropWidth, $cropHeight) { // validate input if (!is_numeric($startX)) { throw new InvalidArgumentException('$startX must be numeric'); } if (!is_numeric($startY)) { throw new InvalidArgumentException('$startY must be numeric'); } if (!is_numeric($cropWidth)) { throw new InvalidArgumentException('$cropWidth must be numeric'); } if (!is_numeric($cropHeight)) { throw new InvalidArgumentException('$cropHeight must be numeric'); } // do some calculations $cropWidth = ($this->currentDimensions['width'] < $cropWidth) ? $this->currentDimensions['width'] : $cropWidth; $cropHeight = ($this->currentDimensions['height'] < $cropHeight) ? $this->currentDimensions['height'] : $cropHeight; // ensure everything's in bounds if (($startX + $cropWidth) > $this->currentDimensions['width']) { $startX = ($this->currentDimensions['width'] - $cropWidth); } if (($startY + $cropHeight) > $this->currentDimensions['height']) { $startY = ($this->currentDimensions['height'] - $cropHeight); } if ($startX < 0) { $startX = 0; } if ($startY < 0) { $startY = 0; } // create the working image if (function_exists('imagecreatetruecolor')) { $this->workingImage = imagecreatetruecolor($cropWidth, $cropHeight); } else { $this->workingImage = imagecreate($cropWidth, $cropHeight); } $this->preserveAlpha(); imagecopyresampled ( $this->workingImage, $this->oldImage, 0, 0, $startX, $startY, $cropWidth, $cropHeight, $cropWidth, $cropHeight ); $this->oldImage = $this->workingImage; $this->currentDimensions['width'] = $cropWidth; $this->currentDimensions['height'] = $cropHeight; return $this; } /** * Rotates image either 90 degrees clockwise or counter-clockwise * * @param string $direction * @retunrn GdThumb */ public function rotateImage ($direction = 'CW') { if ($direction == 'CW') { $this->rotateImageNDegrees(90); } else { $this->rotateImageNDegrees(-90); } return $this; } /** * Rotates image specified number of degrees * * @param int $degrees * @return GdThumb */ public function rotateImageNDegrees ($degrees) { if (!is_numeric($degrees)) { throw new InvalidArgumentException('$degrees must be numeric'); } if (!function_exists('imagerotate')) { throw new RuntimeException('Your version of GD does not support image rotation.'); } $this->workingImage = imagerotate($this->oldImage, $degrees, 0); $newWidth = $this->currentDimensions['height']; $newHeight = $this->currentDimensions['width']; $this->oldImage = $this->workingImage; $this->currentDimensions['width'] = $newWidth; $this->currentDimensions['height'] = $newHeight; return $this; } /** * Shows an image * * This function will show the current image by first sending the appropriate header * for the format, and then outputting the image data. If headers have already been sent, * a runtime exception will be thrown * * @param bool $rawData Whether or not the raw image stream should be output * @return GdThumb */ public function show ($rawData = false) { if (headers_sent()) { throw new RuntimeException('Cannot show image, headers have already been sent'); } switch ($this->format) { case 'GIF': if ($rawData === false) { header('Content-type: image/gif'); } imagegif($this->oldImage); break; case 'JPG': if ($rawData === false) { header('Content-type: image/jpeg'); } imagejpeg($this->oldImage, null, $this->options['jpegQuality']); break; case 'PNG': case 'STRING': if ($rawData === false) { header('Content-type: image/png'); } imagepng($this->oldImage); break; } return $this; } /** * Returns the Working Image as a String * * This function is useful for getting the raw image data as a string for storage in * a database, or other similar things. * * @return string */ public function getImageAsString () { $data = null; ob_start(); $this->show(true); $data = ob_get_contents(); ob_end_clean(); return $data; } /** * Saves an image * * This function will make sure the target directory is writeable, and then save the image. * * If the target directory is not writeable, the function will try to correct the permissions (if allowed, this * is set as an option ($this->options['correctPermissions']). If the target cannot be made writeable, then a * RuntimeException is thrown. * * TODO: Create additional paramter for color matte when saving images with alpha to non-alpha formats (i.e. PNG => JPG) * * @param string $fileName The full path and filename of the image to save * @param string $format The format to save the image in (optional, must be one of [GIF,JPG,PNG] * @return GdThumb */ public function save ($fileName, $format = null) { $validFormats = array('GIF', 'JPG', 'PNG'); $format = ($format !== null) ? strtoupper($format) : $this->format; if (!in_array($format, $validFormats)) { throw new InvalidArgumentException ('Invalid format type specified in save function: ' . $format); } // make sure the directory is writeable if (!is_writeable(dirname($fileName))) { // try to correct the permissions if ($this->options['correctPermissions'] === true) { @chmod(dirname($fileName), 0777); // throw an exception if not writeable if (!is_writeable(dirname($fileName))) { throw new RuntimeException ('File is not writeable, and could not correct permissions: ' . $fileName); } } // throw an exception if not writeable else { throw new RuntimeException ('File not writeable: ' . $fileName); } } switch ($format) { case 'GIF': imagegif($this->oldImage, $fileName); break; case 'JPG': imagejpeg($this->oldImage, $fileName, $this->options['jpegQuality']); break; case 'PNG': imagepng($this->oldImage, $fileName); break; } return $this; } ################################# # ----- GETTERS / SETTERS ----- # ################################# /** * Sets $this->options to $options * * @param array $options */ public function setOptions ($options = array()) { // make sure we've got an array for $this->options (could be null) if (!is_array($this->options)) { $this->options = array(); } // make sure we've gotten a proper argument if (!is_array($options)) { throw new InvalidArgumentException ('setOptions requires an array'); } // we've yet to init the default options, so create them here if (sizeof($this->options) == 0) { $defaultOptions = array ( 'resizeUp' => false, 'jpegQuality' => 100, 'correctPermissions' => false, 'preserveAlpha' => true, 'alphaMaskColor' => array (255, 255, 255), 'preserveTransparency' => true, 'transparencyMaskColor' => array (0, 0, 0) ); } // otherwise, let's use what we've got already else { $defaultOptions = $this->options; } $this->options = array_merge($defaultOptions, $options); } /** * Returns $currentDimensions. * * @see GdThumb::$currentDimensions */ public function getCurrentDimensions () { return $this->currentDimensions; } /** * Sets $currentDimensions. * * @param object $currentDimensions * @see GdThumb::$currentDimensions */ public function setCurrentDimensions ($currentDimensions) { $this->currentDimensions = $currentDimensions; } /** * Returns $maxHeight. * * @see GdThumb::$maxHeight */ public function getMaxHeight () { return $this->maxHeight; } /** * Sets $maxHeight. * * @param object $maxHeight * @see GdThumb::$maxHeight */ public function setMaxHeight ($maxHeight) { $this->maxHeight = $maxHeight; } /** * Returns $maxWidth. * * @see GdThumb::$maxWidth */ public function getMaxWidth () { return $this->maxWidth; } /** * Sets $maxWidth. * * @param object $maxWidth * @see GdThumb::$maxWidth */ public function setMaxWidth ($maxWidth) { $this->maxWidth = $maxWidth; } /** * Returns $newDimensions. * * @see GdThumb::$newDimensions */ public function getNewDimensions () { return $this->newDimensions; } /** * Sets $newDimensions. * * @param object $newDimensions * @see GdThumb::$newDimensions */ public function setNewDimensions ($newDimensions) { $this->newDimensions = $newDimensions; } /** * Returns $options. * * @see GdThumb::$options */ public function getOptions () { return $this->options; } /** * Returns $percent. * * @see GdThumb::$percent */ public function getPercent () { return $this->percent; } /** * Sets $percent. * * @param object $percent * @see GdThumb::$percent */ public function setPercent ($percent) { $this->percent = $percent; } /** * Returns $oldImage. * * @see GdThumb::$oldImage */ public function getOldImage () { return $this->oldImage; } /** * Sets $oldImage. * * @param object $oldImage * @see GdThumb::$oldImage */ public function setOldImage ($oldImage) { $this->oldImage = $oldImage; } /** * Returns $workingImage. * * @see GdThumb::$workingImage */ public function getWorkingImage () { return $this->workingImage; } /** * Sets $workingImage. * * @param object $workingImage * @see GdThumb::$workingImage */ public function setWorkingImage ($workingImage) { $this->workingImage = $workingImage; } ################################# # ----- UTILITY FUNCTIONS ----- # ################################# /** * Calculates a new width and height for the image based on $this->maxWidth and the provided dimensions * * @return array * @param int $width * @param int $height */ protected function calcWidth ($width, $height) { $newWidthPercentage = (100 * $this->maxWidth) / $width; $newHeight = ($height * $newWidthPercentage) / 100; return array ( 'newWidth' => intval($this->maxWidth), 'newHeight' => intval($newHeight) ); } /** * Calculates a new width and height for the image based on $this->maxWidth and the provided dimensions * * @return array * @param int $width * @param int $height */ protected function calcHeight ($width, $height) { $newHeightPercentage = (100 * $this->maxHeight) / $height; $newWidth = ($width * $newHeightPercentage) / 100; return array ( 'newWidth' => ceil($newWidth), 'newHeight' => ceil($this->maxHeight) ); } /** * Calculates a new width and height for the image based on $this->percent and the provided dimensions * * @return array * @param int $width * @param int $height */ protected function calcPercent ($width, $height) { $newWidth = ($width * $this->percent) / 100; $newHeight = ($height * $this->percent) / 100; return array ( 'newWidth' => ceil($newWidth), 'newHeight' => ceil($newHeight) ); } /** * Calculates the new image dimensions * * These calculations are based on both the provided dimensions and $this->maxWidth and $this->maxHeight * * @param int $width * @param int $height */ protected function calcImageSize ($width, $height) { $newSize = array ( 'newWidth' => $width, 'newHeight' => $height ); if ($this->maxWidth > 0) { $newSize = $this->calcWidth($width, $height); if ($this->maxHeight > 0 && $newSize['newHeight'] > $this->maxHeight) { $newSize = $this->calcHeight($newSize['newWidth'], $newSize['newHeight']); } } if ($this->maxHeight > 0) { $newSize = $this->calcHeight($width, $height); if ($this->maxWidth > 0 && $newSize['newWidth'] > $this->maxWidth) { $newSize = $this->calcWidth($newSize['newWidth'], $newSize['newHeight']); } } $this->newDimensions = $newSize; } /** * Calculates new image dimensions, not allowing the width and height to be less than either the max width or height * * @param int $width * @param int $height */ protected function calcImageSizeStrict ($width, $height) { // first, we need to determine what the longest resize dimension is.. if ($this->maxWidth >= $this->maxHeight) { // and determine the longest original dimension if ($width > $height) { $newDimensions = $this->calcHeight($width, $height); if ($newDimensions['newWidth'] < $this->maxWidth) { $newDimensions = $this->calcWidth($width, $height); } } elseif ($height >= $width) { $newDimensions = $this->calcWidth($width, $height); if ($newDimensions['newHeight'] < $this->maxHeight) { $newDimensions = $this->calcHeight($width, $height); } } } elseif ($this->maxHeight > $this->maxWidth) { if ($width >= $height) { $newDimensions = $this->calcWidth($width, $height); if ($newDimensions['newHeight'] < $this->maxHeight) { $newDimensions = $this->calcHeight($width, $height); } } elseif ($height > $width) { $newDimensions = $this->calcHeight($width, $height); if ($newDimensions['newWidth'] < $this->maxWidth) { $newDimensions = $this->calcWidth($width, $height); } } } $this->newDimensions = $newDimensions; } /** * Calculates new dimensions based on $this->percent and the provided dimensions * * @param int $width * @param int $height */ protected function calcImageSizePercent ($width, $height) { if ($this->percent > 0) { $this->newDimensions = $this->calcPercent($width, $height); } } /** * Determines the file format by mime-type * * This function will throw exceptions for invalid images / mime-types * */ protected function determineFormat () { if ($this->isDataStream === true) { $this->format = 'STRING'; return; } $formatInfo = getimagesize($this->fileName); // non-image files will return false if ($formatInfo === false) { if ($this->remoteImage) { $this->triggerError('Could not determine format of remote image: ' . $this->fileName); } else { $this->triggerError('File is not a valid image: ' . $this->fileName); } // make sure we really stop execution return; } $mimeType = isset($formatInfo['mime']) ? $formatInfo['mime'] : null; switch ($mimeType) { case 'image/gif': $this->format = 'GIF'; break; case 'image/jpeg': $this->format = 'JPG'; break; case 'image/png': $this->format = 'PNG'; break; default: $this->triggerError('Image format not supported: ' . $mimeType); } } /** * Makes sure the correct GD implementation exists for the file type * */ protected function verifyFormatCompatiblity () { $isCompatible = true; $gdInfo = gd_info(); switch ($this->format) { case 'GIF': $isCompatible = $gdInfo['GIF Create Support']; break; case 'JPG': $isCompatible = (isset($gdInfo['JPG Support']) || isset($gdInfo['JPEG Support'])) ? true : false; break; case 'PNG': $isCompatible = $gdInfo[$this->format . ' Support']; break; default: $isCompatible = false; } if (!$isCompatible) { // one last check for "JPEG" instead $isCompatible = $gdInfo['JPEG Support']; if (!$isCompatible) { $this->triggerError('Your GD installation does not support ' . $this->format . ' image types'); } } } /** * Preserves the alpha or transparency for PNG and GIF files * * Alpha / transparency will not be preserved if the appropriate options are set to false. * Also, the GIF transparency is pretty skunky (the results aren't awesome), but it works like a * champ... that's the nature of GIFs tho, so no huge surprise. * * This functionality was originally suggested by commenter Aimi (no links / site provided) - Thanks! :) * */ protected function preserveAlpha () { if ($this->format == 'PNG' && $this->options['preserveAlpha'] === true) { imagealphablending($this->workingImage, false); $colorTransparent = imagecolorallocatealpha ( $this->workingImage, $this->options['alphaMaskColor'][0], $this->options['alphaMaskColor'][1], $this->options['alphaMaskColor'][2], 0 ); imagefill($this->workingImage, 0, 0, $colorTransparent); imagesavealpha($this->workingImage, true); } // preserve transparency in GIFs... this is usually pretty rough tho if ($this->format == 'GIF' && $this->options['preserveTransparency'] === true) { $colorTransparent = imagecolorallocate ( $this->workingImage, $this->options['transparencyMaskColor'][0], $this->options['transparencyMaskColor'][1], $this->options['transparencyMaskColor'][2] ); imagecolortransparent($this->workingImage, $colorTransparent); imagetruecolortopalette($this->workingImage, true, 256); } } }
chemezov/zexed
protected/modules/yupe/extensions/EPhpThumb/lib/phpThumb/src/GdThumb.inc.php
PHP
bsd-3-clause
37,274
# -*- coding: utf-8 -*- # Tests for the contrib/localflavor/ generic form fields. tests = r""" ## Generic DateField ########################################################## >>> from django.contrib.localflavor.generic.forms import * A DateField that uses generic dd/mm/yy dates instead of mm/dd/yy where appropriate. >>> import datetime >>> f = DateField() >>> f.clean(datetime.date(2006, 10, 25)) datetime.date(2006, 10, 25) >>> f.clean(datetime.datetime(2006, 10, 25, 14, 30)) datetime.date(2006, 10, 25) >>> f.clean(datetime.datetime(2006, 10, 25, 14, 30, 59)) datetime.date(2006, 10, 25) >>> f.clean(datetime.datetime(2006, 10, 25, 14, 30, 59, 200)) datetime.date(2006, 10, 25) >>> f.clean('2006-10-25') datetime.date(2006, 10, 25) >>> f.clean('25/10/2006') datetime.date(2006, 10, 25) >>> f.clean('25/10/06') datetime.date(2006, 10, 25) >>> f.clean('Oct 25 2006') datetime.date(2006, 10, 25) >>> f.clean('October 25 2006') datetime.date(2006, 10, 25) >>> f.clean('October 25, 2006') datetime.date(2006, 10, 25) >>> f.clean('25 October 2006') datetime.date(2006, 10, 25) >>> f.clean('25 October, 2006') datetime.date(2006, 10, 25) >>> f.clean('2006-4-31') Traceback (most recent call last): ... ValidationError: [u'Enter a valid date.'] >>> f.clean('200a-10-25') Traceback (most recent call last): ... ValidationError: [u'Enter a valid date.'] >>> f.clean('10/25/06') Traceback (most recent call last): ... ValidationError: [u'Enter a valid date.'] >>> f.clean(None) Traceback (most recent call last): ... ValidationError: [u'This field is required.'] >>> f = DateField(required=False) >>> f.clean(None) >>> repr(f.clean(None)) 'None' >>> f.clean('') >>> repr(f.clean('')) 'None' DateField accepts an optional input_formats parameter: >>> f = DateField(input_formats=['%Y %m %d']) >>> f.clean(datetime.date(2006, 10, 25)) datetime.date(2006, 10, 25) >>> f.clean(datetime.datetime(2006, 10, 25, 14, 30)) datetime.date(2006, 10, 25) >>> f.clean('2006 10 25') datetime.date(2006, 10, 25) The input_formats parameter overrides all default input formats, so the default formats won't work unless you specify them: >>> f.clean('2006-10-25') Traceback (most recent call last): ... ValidationError: [u'Enter a valid date.'] >>> f.clean('25/10/2006') Traceback (most recent call last): ... ValidationError: [u'Enter a valid date.'] >>> f.clean('25/10/06') Traceback (most recent call last): ... ValidationError: [u'Enter a valid date.'] ## Generic DateTimeField ###################################################### A DateField that uses generic dd/mm/yy dates instead of mm/dd/yy where appropriate. >>> import datetime >>> f = DateTimeField() >>> f.clean(datetime.date(2006, 10, 25)) datetime.datetime(2006, 10, 25, 0, 0) >>> f.clean(datetime.datetime(2006, 10, 25, 14, 30)) datetime.datetime(2006, 10, 25, 14, 30) >>> f.clean(datetime.datetime(2006, 10, 25, 14, 30, 59)) datetime.datetime(2006, 10, 25, 14, 30, 59) >>> f.clean(datetime.datetime(2006, 10, 25, 14, 30, 59, 200)) datetime.datetime(2006, 10, 25, 14, 30, 59, 200) >>> f.clean('2006-10-25 14:30:45') datetime.datetime(2006, 10, 25, 14, 30, 45) >>> f.clean('2006-10-25 14:30:00') datetime.datetime(2006, 10, 25, 14, 30) >>> f.clean('2006-10-25 14:30') datetime.datetime(2006, 10, 25, 14, 30) >>> f.clean('2006-10-25') datetime.datetime(2006, 10, 25, 0, 0) >>> f.clean('25/10/2006 14:30:45') datetime.datetime(2006, 10, 25, 14, 30, 45) >>> f.clean('25/10/2006 14:30:00') datetime.datetime(2006, 10, 25, 14, 30) >>> f.clean('25/10/2006 14:30') datetime.datetime(2006, 10, 25, 14, 30) >>> f.clean('25/10/2006') datetime.datetime(2006, 10, 25, 0, 0) >>> f.clean('25/10/06 14:30:45') datetime.datetime(2006, 10, 25, 14, 30, 45) >>> f.clean('25/10/06 14:30:00') datetime.datetime(2006, 10, 25, 14, 30) >>> f.clean('25/10/06 14:30') datetime.datetime(2006, 10, 25, 14, 30) >>> f.clean('25/10/06') datetime.datetime(2006, 10, 25, 0, 0) >>> f.clean('hello') Traceback (most recent call last): ... ValidationError: [u'Enter a valid date/time.'] >>> f.clean('2006-10-25 4:30 p.m.') Traceback (most recent call last): ... ValidationError: [u'Enter a valid date/time.'] DateField accepts an optional input_formats parameter: >>> f = DateTimeField(input_formats=['%Y %m %d %I:%M %p']) >>> f.clean(datetime.date(2006, 10, 25)) datetime.datetime(2006, 10, 25, 0, 0) >>> f.clean(datetime.datetime(2006, 10, 25, 14, 30)) datetime.datetime(2006, 10, 25, 14, 30) >>> f.clean(datetime.datetime(2006, 10, 25, 14, 30, 59)) datetime.datetime(2006, 10, 25, 14, 30, 59) >>> f.clean(datetime.datetime(2006, 10, 25, 14, 30, 59, 200)) datetime.datetime(2006, 10, 25, 14, 30, 59, 200) >>> f.clean('2006 10 25 2:30 PM') datetime.datetime(2006, 10, 25, 14, 30) The input_formats parameter overrides all default input formats, so the default formats won't work unless you specify them: >>> f.clean('2006-10-25 14:30:45') Traceback (most recent call last): ... ValidationError: [u'Enter a valid date/time.'] >>> f = DateTimeField(required=False) >>> f.clean(None) >>> repr(f.clean(None)) 'None' >>> f.clean('') >>> repr(f.clean('')) 'None' """
iguzu/gae-django
tests/regressiontests/forms/localflavor/generic.py
Python
bsd-3-clause
5,083
/*---------------------------------------------------------------------------- * Copyright (c) <2013-2015>, <Huawei Technologies Co., Ltd> * All rights reserved. * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * 3. Neither the name of the copyright holder 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 HOLDER 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. *---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------- * Notice of Export Control Law * =============================================== * Huawei LiteOS may be subject to applicable export control laws and regulations, which might * include those applicable to Huawei LiteOS of U.S. and the country in which you are located. * Import, export and usage of Huawei LiteOS in any manner by you shall be in compliance with such * applicable export control laws and regulations. *---------------------------------------------------------------------------*/ #include "los_event.inc" #include "los_priqueue.ph" #include "los_task.ph" #include "los_hw.h" #include "los_hwi.h" #ifdef __cplusplus #if __cplusplus extern "C"{ #endif #endif /* __cplusplus */ LITE_OS_SEC_TEXT_INIT UINT32 LOS_EventInit(PEVENT_CB_S pstEventCB) { if (pstEventCB == NULL) { return LOS_ERRNO_EVENT_PTR_NULL; } pstEventCB->uwEventID = 0; LOS_ListInit(&pstEventCB->stEventList); return LOS_OK; } LITE_OS_SEC_TEXT UINT32 LOS_EventPoll(UINT32 *uwEventID, UINT32 uwEventMask, UINT32 uwMode) { UINT32 uwRet = 0; UINTPTR uvIntSave; uvIntSave = LOS_IntLock(); if (uwMode & LOS_WAITMODE_OR) { if (0 != (*uwEventID & uwEventMask)) { uwRet = *uwEventID & uwEventMask; } } else { if ((uwEventMask != 0) && (uwEventMask == (*uwEventID & uwEventMask))) { uwRet = *uwEventID & uwEventMask; } } if (uwRet && (LOS_WAITMODE_CLR & uwMode)) { *uwEventID = *uwEventID & ~(uwRet); } LOS_IntRestore(uvIntSave); return uwRet; } LITE_OS_SEC_TEXT UINT32 LOS_EventRead(PEVENT_CB_S pstEventCB, UINT32 uwEventMask, UINT32 uwMode, UINT32 uwTimeOut) { UINT32 uwRet = 0; UINTPTR uvIntSave; LOS_TASK_CB *pstRunTsk; LOS_DL_LIST *pstPendObj; if (pstEventCB == NULL) { return LOS_ERRNO_EVENT_PTR_NULL; } if (uwEventMask == 0) { return LOS_ERRNO_EVENT_EVENTMASK_INVALID; } if (uwEventMask & LOS_ERRTYPE_ERROR) { return LOS_ERRNO_EVENT_SETBIT_INVALID; } if (((uwMode & LOS_WAITMODE_OR) && (uwMode & LOS_WAITMODE_AND)) || uwMode & ~(LOS_WAITMODE_OR | LOS_WAITMODE_AND | LOS_WAITMODE_CLR) || !(uwMode & (LOS_WAITMODE_OR | LOS_WAITMODE_AND))) { return LOS_ERRNO_EVENT_FLAGS_INVALID; } if (OS_INT_ACTIVE) { return LOS_ERRNO_EVENT_READ_IN_INTERRUPT; } uvIntSave = LOS_IntLock(); uwRet = LOS_EventPoll(&(pstEventCB->uwEventID), uwEventMask, uwMode); if (uwRet == 0) { if (uwTimeOut == 0){ (VOID)LOS_IntRestore(uvIntSave); return uwRet; } if (g_usLosTaskLock) { (VOID)LOS_IntRestore(uvIntSave); return LOS_ERRNO_EVENT_READ_IN_LOCK; } pstRunTsk = g_stLosTask.pstRunTask; LOS_PriqueueDequeue(&pstRunTsk->stPendList); pstRunTsk->usTaskStatus &= (~OS_TASK_STATUS_READY); pstPendObj = &pstRunTsk->stPendList; pstRunTsk->usTaskStatus |= OS_TASK_STATUS_PEND; pstRunTsk->uwEventMask = uwEventMask; pstRunTsk->uwEventMode = uwMode; LOS_ListTailInsert(&pstEventCB->stEventList,pstPendObj); if ((uwTimeOut != 0) && (uwTimeOut != LOS_WAIT_FOREVER)) { pstRunTsk->usTaskStatus |= OS_TASK_STATUS_TIMEOUT; osTaskAdd2TimerList((LOS_TASK_CB *)pstRunTsk, uwTimeOut); (VOID)LOS_IntRestore(uvIntSave); LOS_Schedule(); } else { pstRunTsk->usTaskStatus &= (~OS_TASK_STATUS_TIMEOUT); (VOID)LOS_IntRestore(uvIntSave); LOS_Schedule(); } if (pstRunTsk->usTaskStatus & OS_TASK_STATUS_TIMEOUT) { uvIntSave = LOS_IntLock(); pstRunTsk->usTaskStatus &= (~OS_TASK_STATUS_TIMEOUT); (VOID)LOS_IntRestore(uvIntSave); return LOS_ERRNO_EVENT_READ_TIMEOUT; } uvIntSave = LOS_IntLock(); uwRet = LOS_EventPoll(&pstEventCB->uwEventID,uwEventMask,uwMode); (VOID)LOS_IntRestore(uvIntSave); } else { (VOID)LOS_IntRestore(uvIntSave); } return uwRet; } LITE_OS_SEC_TEXT UINT32 LOS_EventWrite(PEVENT_CB_S pstEventCB, UINT32 uwEvents) { LOS_TASK_CB *pstResumedTask; LOS_TASK_CB *pstNextTask = (LOS_TASK_CB *)NULL; UINTPTR uvIntSave; UINT8 ucExitFlag = 0; if (pstEventCB == NULL) { return LOS_ERRNO_EVENT_PTR_NULL; } if (uwEvents & LOS_ERRTYPE_ERROR) { return LOS_ERRNO_EVENT_SETBIT_INVALID; } uvIntSave = LOS_IntLock(); pstEventCB->uwEventID |= uwEvents; if (!LOS_ListEmpty(&pstEventCB->stEventList)) { for (pstResumedTask = LOS_DL_LIST_ENTRY((&pstEventCB->stEventList)->pstNext, LOS_TASK_CB, stPendList);/*lint !e413*/ &pstResumedTask->stPendList != (&pstEventCB->stEventList);) { pstNextTask = LOS_DL_LIST_ENTRY(pstResumedTask->stPendList.pstNext, LOS_TASK_CB, stPendList); /*lint !e413*/ if (((pstResumedTask->uwEventMode & LOS_WAITMODE_OR) && (pstResumedTask->uwEventMask & uwEvents) != 0) || ((pstResumedTask->uwEventMode & LOS_WAITMODE_AND) && (pstResumedTask->uwEventMask & pstEventCB->uwEventID) == pstResumedTask->uwEventMask)) { ucExitFlag = 1; LOS_ListDelete(&(pstResumedTask->stPendList)); pstResumedTask->usTaskStatus &= (~OS_TASK_STATUS_PEND); if (pstResumedTask->usTaskStatus & OS_TASK_STATUS_TIMEOUT) { osTimerListDelete(pstResumedTask); pstResumedTask->usTaskStatus &= (~OS_TASK_STATUS_TIMEOUT); } if (!(pstResumedTask->usTaskStatus & OS_TASK_STATUS_SUSPEND)) { pstResumedTask->usTaskStatus |= OS_TASK_STATUS_READY; LOS_PriqueueEnqueue(&pstResumedTask->stPendList, pstResumedTask->usPriority); } } pstResumedTask = pstNextTask; } if (ucExitFlag == 1) { (VOID)LOS_IntRestore(uvIntSave); LOS_Schedule(); } else { (VOID)LOS_IntRestore(uvIntSave); } } else { (VOID)LOS_IntRestore(uvIntSave); } return LOS_OK; } LITE_OS_SEC_TEXT_INIT UINT32 LOS_EventDestory(PEVENT_CB_S pstEventCB) { if (pstEventCB == NULL) { return LOS_ERRNO_EVENT_PTR_NULL; } pstEventCB->stEventList.pstNext = (LOS_DL_LIST *)NULL; pstEventCB->stEventList.pstPrev = (LOS_DL_LIST *)NULL; return LOS_OK; } LITE_OS_SEC_TEXT_MINOR UINT32 LOS_EventClear(PEVENT_CB_S pstEventCB, UINT32 uwEvents) { UINTPTR uvIntSave; if (pstEventCB == NULL) { return LOS_ERRNO_EVENT_PTR_NULL; } uvIntSave = LOS_IntLock(); pstEventCB->uwEventID &= uwEvents; (VOID)LOS_IntRestore(uvIntSave); return LOS_OK; } #ifdef __cplusplus #if __cplusplus } #endif #endif /* __cplusplus */
LITEOS/LiteOS_Hackathon
Hackethon_170108_master_hozemonitor/Huawei_LiteOS/kernel/base/ipc/los_event.c
C
bsd-3-clause
8,966
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.test import TestCase from .models import Article, Bar, Base, Child, Foo, Whiz class StringLookupTests(TestCase): def test_string_form_referencing(self): """ Regression test for #1661 and #1662 Check that string form referencing of models works, both as pre and post reference, on all RelatedField types. """ f1 = Foo(name="Foo1") f1.save() f2 = Foo(name="Foo2") f2.save() w1 = Whiz(name="Whiz1") w1.save() b1 = Bar(name="Bar1", normal=f1, fwd=w1, back=f2) b1.save() self.assertEqual(b1.normal, f1) self.assertEqual(b1.fwd, w1) self.assertEqual(b1.back, f2) base1 = Base(name="Base1") base1.save() child1 = Child(name="Child1", parent=base1) child1.save() self.assertEqual(child1.parent, base1) def test_unicode_chars_in_queries(self): """ Regression tests for #3937 make sure we can use unicode characters in queries. If these tests fail on MySQL, it's a problem with the test setup. A properly configured UTF-8 database can handle this. """ fx = Foo(name='Bjorn', friend='François') fx.save() self.assertEqual(Foo.objects.get(friend__contains='\xe7'), fx) # We can also do the above query using UTF-8 strings. self.assertEqual(Foo.objects.get(friend__contains=b'\xc3\xa7'), fx) def test_queries_on_textfields(self): """ Regression tests for #5087 make sure we can perform queries on TextFields. """ a = Article(name='Test', text='The quick brown fox jumps over the lazy dog.') a.save() self.assertEqual(Article.objects.get(text__exact='The quick brown fox jumps over the lazy dog.'), a) self.assertEqual(Article.objects.get(text__contains='quick brown fox'), a) def test_ipaddress_on_postgresql(self): """ Regression test for #708 "like" queries on IP address fields require casting with HOST() (on PostgreSQL). """ a = Article(name='IP test', text='The body', submitted_from='192.0.2.100') a.save() self.assertEqual(repr(Article.objects.filter(submitted_from__contains='192.0.2')), repr([a])) # Test that the searches do not match the subnet mask (/32 in this case) self.assertEqual(Article.objects.filter(submitted_from__contains='32').count(), 0)
ojengwa/django-1
tests/string_lookup/tests.py
Python
bsd-3-clause
2,573
<!DOCTYPE html> <html> <head> <title>CSS Test: Image shape on a left float</title> <link rel="author" title="Bem Jones-Bey" href="bjonesbe@adobe.com"/> <link rel="help" href="http://www.w3.org/TR/css-shapes-1/#shapes-from-image"/> <link rel="help" href="http://www.w3.org/TR/css-shapes-1/#shape-outside-property"/> <link rel="match" href="reference/shape-image-002-ref.html"/> <meta name="flags" content="ahem image"/> <meta name="assert" content="This test verifies that a shape specified as a svg image in a data uri is properly interpreted as a shape."/> <style type="text/css"> .container { position: relative; font-family: Ahem; font-size: 50px; line-height: 50px; } #test { width: 100px; color: rgb(0, 100, 0); background-color: red; } #image { float: left; shape-outside: url('data:image/svg+xml;utf8,<svg width="100px" height="100px" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#006400" d=" M 0.00 0.00 L 50.00 0.00 C 50.00 33.33 50.00 66.67 50.00 100.00 L 0.00 100.00 L 0.00 0.00 Z" /></svg>'); } </style> </head> <body> <p> The test passes if you see a solid green square. There should be no red. </p> <div id="test" class="container"> <img id="image" src='data:image/svg+xml;utf8,<svg width="100px" height="100px" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#006400" d=" M 0.00 0.00 L 50.00 0.00 C 50.00 33.33 50.00 66.67 50.00 100.00 L 0.00 100.00 L 0.00 0.00 Z" /></svg>'/> X X </div> </body> </html>
XiaosongWei/blink-crosswalk
LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/shape-image/shape-image-002.html
HTML
bsd-3-clause
1,680
<?php /** * This view is used by console/controllers/MigrateController.php * The following variables are available in this view: * @since 2.0.7 * @deprecated since 2.0.8 */ /* @var $className string the new migration class name */ /* @var $table string the name table */ /* @var $field_first string the name field first */ /* @var $field_second string the name field second */ echo "<?php\n"; ?> use yii\db\Migration; /** * Handles the creation of table `<?= $table ?>` which is a junction between * table `<?= $field_first ?>` and table `<?= $field_second ?>`. */ class <?= $className ?> extends Migration { /** * @inheritdoc */ public function up() { $this->createTable('<?= $table ?>', [ '<?= $field_first ?>_id' => $this->integer(), '<?= $field_second ?>_id' => $this->integer(), 'PRIMARY KEY(<?= $field_first ?>_id, <?= $field_second ?>_id)', ]); $this->createIndex( 'idx-<?= $table . '-' . $field_first ?>_id', '<?= $table ?>', '<?= $field_first ?>_id' ); $this->createIndex( 'idx-<?= $table . '-' . $field_second ?>_id', '<?= $table ?>', '<?= $field_second ?>_id' ); $this->addForeignKey( 'fk-<?= $table . '-' . $field_first ?>_id', '<?= $table ?>', '<?= $field_first ?>_id', '<?= $field_first ?>', 'id', 'CASCADE' ); $this->addForeignKey( 'fk-<?= $table . '-' . $field_second ?>_id', '<?= $table ?>', '<?= $field_second ?>_id', '<?= $field_second ?>', 'id', 'CASCADE' ); } /** * @inheritdoc */ public function down() { $this->dropTable('<?= $table ?>'); } }
pizza8/mysite
vendor/yiisoft/yii2/views/createJunctionMigration.php
PHP
bsd-3-clause
1,874
<?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 Zend\Http\Header; /** * Retry-After HTTP Header * * @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.37 */ class RetryAfter extends AbstractDate { /** * Value of header in delta-seconds * By default set to 1 hour * * @var int */ protected $deltaSeconds = 3600; /** * Create Retry-After header from string * * @param string $headerLine * @return RetryAfter * @throws Exception\InvalidArgumentException */ public static function fromString($headerLine) { $dateHeader = new static(); list($name, $date) = GenericHeader::splitHeaderLine($headerLine); // check to ensure proper header type for this factory if (strtolower($name) !== strtolower($dateHeader->getFieldName())) { throw new Exception\InvalidArgumentException( 'Invalid header line for "' . $dateHeader->getFieldName() . '" header string' ); } if (is_numeric($date)) { $dateHeader->setDeltaSeconds($date); } else { $dateHeader->setDate($date); } return $dateHeader; } /** * Set number of seconds * * @param int $delta * @return RetryAfter */ public function setDeltaSeconds($delta) { $this->deltaSeconds = (int) $delta; return $this; } /** * Get number of seconds * * @return int */ public function getDeltaSeconds() { return $this->deltaSeconds; } /** * Get header name * * @return string */ public function getFieldName() { return 'Retry-After'; } /** * Returns date if it's set, or number of seconds * * @return int|string */ public function getFieldValue() { return ($this->date === null) ? $this->deltaSeconds : $this->getDate(); } /** * Return header line * * @return string */ public function toString() { return 'Retry-After: ' . $this->getFieldValue(); } }
jpcodezur/tesisenlinea
vendor/zendframework/zendframework/library/Zend/Http/Header/RetryAfter.php
PHP
bsd-3-clause
2,430
<?php /* * This file is part of the Predis package. * * (c) Daniele Alessandri <suppakilla@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Predis\Cluster\Distribution; /** * @todo To be improved. */ class KetamaPureRingTest extends PredisDistributorTestCase { /** * {@inheritdoc} */ public function getDistributorInstance() { return new KetamaPureRing(); } /** * @group disconnected */ public function testHash() { $ring = $this->getDistributorInstance(); list(, $hash) = unpack('V', md5('foobar', true)); $this->assertEquals($hash, $ring->hash('foobar')); } /** * @group disconnected */ public function testSingleNodeInRing() { $node = '127.0.0.1:7000'; $ring = $this->getDistributorInstance(); $ring->add($node); $expected = array_fill(0, 20, $node); $actual = $this->getNodes($ring, 20); $this->assertSame($expected, $actual); } /** * @group disconnected */ public function testMultipleNodesInRing() { $nodes = array( '127.0.0.1:7000', '127.0.0.1:7001', '127.0.0.1:7002', ); $ring = $this->getDistributorInstance(); foreach ($nodes as $node) { $ring->add($node); } $expected = array( '127.0.0.1:7000', '127.0.0.1:7001', '127.0.0.1:7000', '127.0.0.1:7002', '127.0.0.1:7000', '127.0.0.1:7001', '127.0.0.1:7000', '127.0.0.1:7001', '127.0.0.1:7000', '127.0.0.1:7002', '127.0.0.1:7000', '127.0.0.1:7000', '127.0.0.1:7001', '127.0.0.1:7000', '127.0.0.1:7001', '127.0.0.1:7002', '127.0.0.1:7000', '127.0.0.1:7002', '127.0.0.1:7001', '127.0.0.1:7002', ); $actual = $this->getNodes($ring, 20); $this->assertSame($expected, $actual); } /** * @group disconnected */ public function testSubsequendAddAndRemoveFromRing() { $ring = $this->getDistributorInstance(); $expected1 = array_fill(0, 10, '127.0.0.1:7000'); $expected3 = array_fill(0, 10, '127.0.0.1:7001'); $expected2 = array( '127.0.0.1:7000', '127.0.0.1:7001', '127.0.0.1:7000', '127.0.0.1:7001', '127.0.0.1:7000', '127.0.0.1:7001', '127.0.0.1:7000', '127.0.0.1:7001', '127.0.0.1:7000', '127.0.0.1:7001', ); $ring->add('127.0.0.1:7000'); $actual1 = $this->getNodes($ring, 10); $ring->add('127.0.0.1:7001'); $actual2 = $this->getNodes($ring, 10); $ring->remove('127.0.0.1:7000'); $actual3 = $this->getNodes($ring, 10); $this->assertSame($expected1, $actual1); $this->assertSame($expected2, $actual2); $this->assertSame($expected3, $actual3); } /** * @todo This tests should be moved in Predis\Cluster\Distribution\DistributionStrategyTestCase * @group disconnected */ public function testCallbackToGetNodeHash() { $node = '127.0.0.1:7000'; $callable = $this->getMock('stdClass', array('__invoke')); $callable->expects($this->once()) ->method('__invoke') ->with($node) ->will($this->returnValue($node)); $ring = new KetamaPureRing($callable); $ring->add($node); $this->getNodes($ring); } }
heiglandreas/joindin-web2
vendor/predis/predis/tests/Predis/Cluster/Distribution/KetamaPureRingTest.php
PHP
bsd-3-clause
3,805
/* Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang("a11yhelp","de",{title:"Barrierefreiheitinformationen",contents:"Hilfeinhalt. Um den Dialog zu schliessen die Taste 'ESC' drücken.",legend:[{name:"Allgemein",items:[{name:"Editor Symbolleiste",legend:"Drücken Sie ${toolbarFocus} auf der Symbolleiste. Gehen Sie zur nächsten oder vorherigen Symbolleistengruppe mit TAB und SHIFT-TAB. Gehen Sie zur nächsten oder vorherigen Symbolleiste auf die Schaltfläche mit dem RECHTS- oder LINKS-Pfeil. Drücken Sie die Leertaste oder Eingabetaste, um die Schaltfläche in der Symbolleiste aktivieren."}, {name:"Editor Dialog",legend:"Innerhalb des Dialogs drücken Sie TAB um zum nächsten Dialogfeld zu gelangen, drücken Sie SHIFT-TAG um zum vorherigen Feld zu wechseln, drücken Sie ENTER um den Dialog abzusenden und ESC um den Dialog zu abzubrechen. Um zwischen den Reitern innerhalb eines Dialogs zu wechseln drücken sie ALT-F10. Um zum nächsten Reiter zu gelangen können Sie TAB oder die rechte Pfeiltaste. Zurück gelangt man mit SHIFT-TAB oder der linken Pfeiltaste. Mit der Leertaste oder Enter kann man den Reiter auswählen."}, {name:"Editor Kontextmenü",legend:"Dürcken Sie ${contextMenu} oder die Anwendungstaste um das Kontextmenü zu öffnen. Man kann die Pfeiltasten zum Wechsel benutzen. Mit der Leertaste oder der Enter-Taste kann man den Menüpunkt aufrufen. Schliessen Sie das Kontextmenü mit der ESC-Taste."},{name:"Editor Listen",legend:"Innerhalb einer Listenbox kann man mit der TAB-Taste oder den Pfeilrunter-Taste den nächsten Menüeintrag wählen. Mit der Shift-TAB Tastenkombination oder der Pfeilhoch-Taste gelangt man zum vorherigen Menüpunkt. Mit der Leertaste oder Enter kann man den Menüpunkt auswählen. Drücken Sie ESC zum Verlassen des Menüs."}, {name:"Editor Elementpfadleiste",legend:"Drücken Sie ${elementsPathFocus} um sich durch die Pfadleiste zu bewegen. Um zum nächsten Element zu gelangen drücken Sie TAB oder die Pfeilrechts-Taste. Zum vorherigen Element gelangen Sie mit der SHIFT-TAB oder der Pfeillinks-Taste. Drücken Sie die Leertaste oder Enter um das Element auszuwählen."}]},{name:"Befehle",items:[{name:"Wiederholen Befehl",legend:"Drücken Sie ${undo}"},{name:"Rückgängig Befehl",legend:"Drücken Sie ${redo}"},{name:"Fettschrift Befehl", legend:"Drücken Sie ${bold}"},{name:"Italic Befehl",legend:"Drücken Sie ${italic}"},{name:"Unterstreichung Befehl",legend:"Drücken Sie ${underline}"},{name:"Link Befehl",legend:"Drücken Sie ${link}"},{name:"Symbolleiste zuammenklappen Befehl",legend:"Drücken Sie ${toolbarCollapse}"},{name:"Zugang bisheriger Fokussierung Raumbefehl ",legend:"Drücken Sie ${accessPreviousSpace} auf den am nächsten nicht erreichbar Fokus-Abstand vor die Einfügemarke zugreifen: zwei benachbarte HR-Elemente. Wiederholen Sie die Tastenkombination um entfernte Fokusräume zu erreichen. "}, {name:"Zugang nächster Schwerpunkt Raumbefehl ",legend:"Drücken Sie $ { accessNextSpace }, um den nächsten unerreichbar Fokus Leerzeichen nach dem Cursor zum Beispiel auf: zwei benachbarten HR Elemente. Wiederholen Sie die Tastenkombination zum fernen Fokus Bereiche zu erreichen. "},{name:"Eingabehilfen",legend:"Drücken Sie ${a11yHelp}"}]}]});
dzenjoga/yii2_adv
backend/web/js/ckeditor/plugins/a11yhelp/dialogs/lang/de.js
JavaScript
bsd-3-clause
3,358
<?php /** * This file contains the base application component class. * * @author Qiang Xue <qiang.xue@gmail.com> * @link http://www.yiiframework.com/ * @copyright Copyright &copy; 2008-2011 Yii Software LLC * @license http://www.yiiframework.com/license/ */ /** * CApplicationComponent is the base class for application component classes. * * CApplicationComponent implements the basic methods required by {@link IApplicationComponent}. * * When developing an application component, try to put application component initialization code in * the {@link init()} method instead of the constructor. This has the advantage that * the application component can be customized through application configuration. * * @property boolean $isInitialized Whether this application component has been initialized (ie, {@link init()} is invoked). * * @author Qiang Xue <qiang.xue@gmail.com> * @version $Id: CApplicationComponent.php 3515 2011-12-28 12:29:24Z mdomba $ * @package system.base * @since 1.0 */ abstract class CApplicationComponent extends CComponent implements IApplicationComponent { /** * @var array the behaviors that should be attached to this component. * The behaviors will be attached to the component when {@link init} is called. * Please refer to {@link CModel::behaviors} on how to specify the value of this property. */ public $behaviors=array(); private $_initialized=false; /** * Initializes the application component. * This method is required by {@link IApplicationComponent} and is invoked by application. * If you override this method, make sure to call the parent implementation * so that the application component can be marked as initialized. */ public function init() { $this->attachBehaviors($this->behaviors); $this->_initialized=true; } /** * Checks if this application component bas been initialized. * @return boolean whether this application component has been initialized (ie, {@link init()} is invoked). */ public function getIsInitialized() { return $this->_initialized; } }
joyplus/joyplus-cms
yii/framework/base/CApplicationComponent.php
PHP
bsd-3-clause
2,068
/* line 1 "./ragel/tsip_parser_header_Contact.jrl" */ /* * Copyright (C) 2012-2015 Doubango Telecom <http://www.doubango.org> * License: BSD * This file is part of Open Source sipML5 solution <http://www.sipml5.org> */ tsip_header_Contact.prototype = Object.create(tsip_header.prototype); /* line 74 "./ragel/tsip_parser_header_Contact.jrl" */ /* line 16 "./src/headers/tsip_header_Contact.js" */ _tsip_machine_parser_header_Contact_actions = [ 0, 1, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 2, 1, 0, 2, 3, 6, 2, 4, 6, 2, 5, 6 ]; _tsip_machine_parser_header_Contact_key_offsets = [ 0, 0, 4, 6, 8, 10, 12, 14, 16, 19, 40, 41, 43, 64, 65, 67, 71, 74, 75, 79, 91, 94, 96, 99, 104, 109, 110, 112, 116, 137, 138, 140, 161, 162, 164, 167, 184, 202, 206, 207, 209, 217, 218, 220, 224, 230, 250, 269, 274, 276, 283, 302, 303, 305, 323, 341, 347, 348, 350, 355, 374, 375, 377, 396, 397, 399, 402, 410, 411, 413, 418, 424, 441, 448, 456, 464, 472, 474, 481, 490, 492, 495, 497, 500, 502, 505, 508, 509, 512, 513, 516, 517, 526, 535, 543, 551, 559, 567, 569, 575, 584, 593, 602, 604, 607, 610, 611, 612, 632, 652, 672, 692, 712, 732, 750, 756, 757, 759, 764, 783, 784, 786, 805, 812, 829, 847, 851 ]; _tsip_machine_parser_header_Contact_trans_keys = [ 67, 77, 99, 109, 79, 111, 78, 110, 84, 116, 65, 97, 67, 99, 84, 116, 9, 32, 58, 9, 13, 32, 33, 34, 37, 39, 42, 43, 60, 126, 45, 46, 48, 57, 65, 90, 95, 96, 97, 122, 10, 9, 32, 9, 13, 32, 33, 34, 37, 39, 42, 43, 60, 126, 45, 46, 48, 57, 65, 90, 95, 96, 97, 122, 10, 9, 32, 9, 32, 42, 60, 9, 13, 32, 10, 65, 90, 97, 122, 9, 32, 43, 58, 45, 46, 48, 57, 65, 90, 97, 122, 9, 32, 58, 0, 65535, 62, 0, 65535, 9, 13, 32, 44, 59, 9, 13, 32, 44, 59, 10, 9, 32, 9, 32, 44, 59, 9, 13, 32, 33, 34, 37, 39, 60, 126, 42, 43, 45, 46, 48, 57, 65, 90, 95, 96, 97, 122, 10, 9, 32, 9, 13, 32, 33, 34, 37, 39, 60, 126, 42, 43, 45, 46, 48, 57, 65, 90, 95, 96, 97, 122, 10, 9, 32, 9, 32, 60, 9, 13, 32, 33, 37, 39, 126, 42, 43, 45, 46, 48, 57, 65, 90, 95, 122, 9, 13, 32, 33, 37, 39, 60, 126, 42, 43, 45, 46, 48, 57, 65, 90, 95, 122, 9, 13, 32, 60, 10, 9, 32, 9, 13, 34, 92, 32, 126, 128, 255, 10, 9, 32, 9, 13, 32, 60, 0, 9, 11, 12, 14, 127, 9, 13, 32, 33, 37, 39, 42, 43, 58, 126, 45, 46, 48, 57, 65, 90, 95, 96, 97, 122, 9, 13, 32, 33, 37, 39, 58, 60, 126, 42, 43, 45, 46, 48, 57, 65, 90, 95, 122, 9, 13, 32, 58, 60, 0, 65535, 9, 13, 32, 44, 59, 0, 65535, 9, 13, 32, 33, 37, 39, 69, 101, 126, 42, 43, 45, 46, 48, 57, 65, 90, 95, 122, 10, 9, 32, 9, 32, 33, 37, 39, 69, 101, 126, 42, 43, 45, 46, 48, 57, 65, 90, 95, 122, 9, 13, 32, 33, 37, 39, 44, 59, 61, 126, 42, 46, 48, 57, 65, 90, 95, 122, 9, 13, 32, 44, 59, 61, 10, 9, 32, 9, 32, 44, 59, 61, 9, 13, 32, 33, 34, 37, 39, 91, 126, 42, 43, 45, 46, 48, 57, 65, 90, 95, 122, 10, 9, 32, 9, 13, 32, 33, 34, 37, 39, 91, 126, 42, 43, 45, 46, 48, 57, 65, 90, 95, 122, 10, 9, 32, 9, 32, 34, 9, 13, 34, 92, 32, 126, 128, 255, 10, 9, 32, 9, 13, 32, 44, 59, 0, 9, 11, 12, 14, 127, 9, 13, 32, 33, 37, 39, 44, 59, 126, 42, 46, 48, 57, 65, 90, 95, 122, 58, 48, 57, 65, 70, 97, 102, 58, 93, 48, 57, 65, 70, 97, 102, 58, 93, 48, 57, 65, 70, 97, 102, 58, 93, 48, 57, 65, 70, 97, 102, 58, 93, 58, 48, 57, 65, 70, 97, 102, 46, 58, 93, 48, 57, 65, 70, 97, 102, 48, 57, 46, 48, 57, 48, 57, 46, 48, 57, 48, 57, 93, 48, 57, 93, 48, 57, 93, 46, 48, 57, 46, 46, 48, 57, 46, 46, 58, 93, 48, 57, 65, 70, 97, 102, 46, 58, 93, 48, 57, 65, 70, 97, 102, 58, 93, 48, 57, 65, 70, 97, 102, 58, 93, 48, 57, 65, 70, 97, 102, 58, 93, 48, 57, 65, 70, 97, 102, 58, 93, 48, 57, 65, 70, 97, 102, 58, 93, 48, 57, 65, 70, 97, 102, 46, 58, 93, 48, 57, 65, 70, 97, 102, 46, 58, 93, 48, 57, 65, 70, 97, 102, 46, 58, 93, 48, 57, 65, 70, 97, 102, 48, 57, 46, 48, 57, 46, 48, 57, 46, 58, 9, 13, 32, 33, 37, 39, 44, 59, 61, 88, 120, 126, 42, 46, 48, 57, 65, 90, 95, 122, 9, 13, 32, 33, 37, 39, 44, 59, 61, 80, 112, 126, 42, 46, 48, 57, 65, 90, 95, 122, 9, 13, 32, 33, 37, 39, 44, 59, 61, 73, 105, 126, 42, 46, 48, 57, 65, 90, 95, 122, 9, 13, 32, 33, 37, 39, 44, 59, 61, 82, 114, 126, 42, 46, 48, 57, 65, 90, 95, 122, 9, 13, 32, 33, 37, 39, 44, 59, 61, 69, 101, 126, 42, 46, 48, 57, 65, 90, 95, 122, 9, 13, 32, 33, 37, 39, 44, 59, 61, 83, 115, 126, 42, 46, 48, 57, 65, 90, 95, 122, 9, 13, 32, 33, 37, 39, 44, 59, 61, 126, 42, 46, 48, 57, 65, 90, 95, 122, 9, 13, 32, 44, 59, 61, 10, 9, 32, 9, 32, 44, 59, 61, 9, 13, 32, 33, 34, 37, 39, 91, 126, 42, 43, 45, 46, 48, 57, 65, 90, 95, 122, 10, 9, 32, 9, 13, 32, 33, 34, 37, 39, 91, 126, 42, 43, 45, 46, 48, 57, 65, 90, 95, 122, 9, 13, 32, 44, 59, 48, 57, 9, 13, 32, 33, 37, 39, 126, 42, 43, 45, 46, 48, 57, 65, 90, 95, 122, 9, 13, 32, 33, 37, 39, 60, 126, 42, 43, 45, 46, 48, 57, 65, 90, 95, 122, 9, 13, 32, 60, 0 ]; _tsip_machine_parser_header_Contact_single_lengths = [ 0, 4, 2, 2, 2, 2, 2, 2, 3, 11, 1, 2, 11, 1, 2, 4, 3, 1, 0, 4, 3, 0, 1, 5, 5, 1, 2, 4, 9, 1, 2, 9, 1, 2, 3, 7, 8, 4, 1, 2, 4, 1, 2, 4, 0, 10, 9, 5, 0, 5, 9, 1, 2, 8, 10, 6, 1, 2, 5, 9, 1, 2, 9, 1, 2, 3, 4, 1, 2, 5, 0, 9, 1, 2, 2, 2, 2, 1, 3, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 3, 3, 2, 2, 2, 2, 2, 0, 3, 3, 3, 0, 1, 1, 1, 1, 12, 12, 12, 12, 12, 12, 10, 6, 1, 2, 5, 9, 1, 2, 9, 5, 7, 8, 4, 0 ]; _tsip_machine_parser_header_Contact_range_lengths = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 5, 0, 0, 0, 0, 0, 2, 4, 0, 1, 1, 0, 0, 0, 0, 0, 6, 0, 0, 6, 0, 0, 0, 5, 5, 0, 0, 0, 2, 0, 0, 0, 3, 5, 5, 0, 1, 1, 5, 0, 0, 5, 4, 0, 0, 0, 0, 5, 0, 0, 5, 0, 0, 0, 2, 0, 0, 0, 3, 4, 3, 3, 3, 3, 0, 3, 3, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 1, 1, 1, 0, 0, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 5, 0, 0, 5, 1, 5, 5, 0, 0 ]; _tsip_machine_parser_header_Contact_index_offsets = [ 0, 0, 5, 8, 11, 14, 17, 20, 23, 27, 44, 46, 49, 66, 68, 71, 76, 80, 82, 85, 94, 98, 100, 103, 109, 115, 117, 120, 125, 141, 143, 146, 162, 164, 167, 171, 184, 198, 203, 205, 208, 215, 217, 220, 225, 229, 245, 260, 266, 268, 275, 290, 292, 295, 309, 324, 331, 333, 336, 342, 357, 359, 362, 377, 379, 382, 386, 393, 395, 398, 404, 408, 422, 427, 433, 439, 445, 448, 453, 460, 462, 465, 467, 470, 472, 475, 478, 480, 483, 485, 488, 490, 497, 504, 510, 516, 522, 528, 531, 535, 542, 549, 556, 558, 561, 564, 566, 568, 585, 602, 619, 636, 653, 670, 685, 692, 694, 697, 703, 718, 720, 723, 738, 745, 758, 772, 777 ]; _tsip_machine_parser_header_Contact_indicies = [ 0, 2, 0, 2, 1, 3, 3, 1, 4, 4, 1, 5, 5, 1, 6, 6, 1, 7, 7, 1, 2, 2, 1, 2, 2, 8, 1, 9, 10, 9, 11, 12, 11, 11, 13, 11, 14, 11, 11, 11, 15, 11, 15, 1, 16, 1, 17, 17, 1, 18, 19, 18, 11, 12, 11, 11, 13, 11, 14, 11, 11, 11, 15, 11, 15, 1, 20, 1, 21, 21, 1, 21, 21, 22, 23, 1, 22, 24, 22, 1, 25, 1, 26, 26, 1, 27, 27, 28, 29, 28, 28, 28, 28, 1, 27, 27, 29, 1, 30, 1, 31, 30, 1, 32, 33, 32, 34, 35, 1, 36, 37, 36, 38, 35, 1, 39, 1, 40, 40, 1, 40, 40, 38, 35, 1, 41, 42, 41, 11, 12, 11, 11, 14, 11, 11, 11, 11, 15, 11, 15, 1, 43, 1, 44, 44, 1, 45, 46, 45, 11, 12, 11, 11, 14, 11, 11, 11, 11, 15, 11, 15, 1, 47, 1, 48, 48, 1, 48, 48, 23, 1, 49, 50, 49, 51, 51, 51, 51, 51, 51, 51, 51, 51, 1, 52, 53, 52, 51, 51, 51, 54, 51, 51, 51, 51, 51, 51, 1, 55, 56, 55, 23, 1, 57, 1, 49, 49, 1, 58, 59, 60, 61, 58, 58, 1, 62, 1, 58, 58, 1, 52, 53, 52, 54, 1, 58, 58, 58, 1, 63, 50, 63, 51, 51, 51, 51, 64, 65, 51, 64, 64, 64, 51, 64, 1, 66, 53, 66, 51, 51, 51, 65, 54, 51, 51, 51, 51, 51, 51, 1, 67, 56, 67, 65, 23, 1, 68, 1, 69, 70, 69, 71, 72, 68, 1, 35, 73, 35, 74, 74, 74, 75, 75, 74, 74, 74, 74, 74, 74, 1, 76, 1, 77, 77, 1, 77, 77, 74, 74, 74, 75, 75, 74, 74, 74, 74, 74, 74, 1, 78, 79, 78, 80, 80, 80, 81, 82, 83, 80, 80, 80, 80, 80, 1, 84, 85, 84, 38, 35, 83, 1, 86, 1, 87, 87, 1, 87, 87, 38, 35, 83, 1, 83, 88, 83, 89, 90, 89, 89, 91, 89, 89, 89, 89, 89, 89, 1, 92, 1, 93, 93, 1, 93, 94, 93, 89, 90, 89, 89, 91, 89, 89, 89, 89, 89, 89, 1, 95, 1, 96, 96, 1, 96, 96, 90, 1, 90, 97, 98, 99, 90, 90, 1, 100, 1, 90, 90, 1, 101, 79, 101, 81, 82, 1, 90, 90, 90, 1, 101, 79, 101, 89, 89, 89, 81, 82, 89, 89, 89, 89, 89, 1, 103, 102, 102, 102, 1, 105, 98, 104, 104, 104, 1, 105, 98, 106, 106, 106, 1, 105, 98, 107, 107, 107, 1, 105, 98, 1, 109, 108, 102, 102, 1, 110, 105, 98, 111, 104, 104, 1, 112, 1, 113, 114, 1, 115, 1, 116, 117, 1, 118, 1, 98, 119, 1, 98, 120, 1, 98, 1, 116, 121, 1, 116, 1, 113, 122, 1, 113, 1, 110, 105, 98, 123, 106, 106, 1, 110, 105, 98, 107, 107, 107, 1, 125, 98, 124, 124, 124, 1, 127, 98, 126, 126, 126, 1, 127, 98, 128, 128, 128, 1, 127, 98, 129, 129, 129, 1, 127, 98, 1, 130, 124, 124, 1, 110, 127, 98, 131, 126, 126, 1, 110, 127, 98, 132, 128, 128, 1, 110, 127, 98, 129, 129, 129, 1, 133, 1, 110, 134, 1, 110, 135, 1, 110, 1, 109, 1, 78, 79, 78, 80, 80, 80, 81, 82, 83, 136, 136, 80, 80, 80, 80, 80, 1, 78, 79, 78, 80, 80, 80, 81, 82, 83, 137, 137, 80, 80, 80, 80, 80, 1, 78, 79, 78, 80, 80, 80, 81, 82, 83, 138, 138, 80, 80, 80, 80, 80, 1, 78, 79, 78, 80, 80, 80, 81, 82, 83, 139, 139, 80, 80, 80, 80, 80, 1, 78, 79, 78, 80, 80, 80, 81, 82, 83, 140, 140, 80, 80, 80, 80, 80, 1, 78, 79, 78, 80, 80, 80, 81, 82, 83, 141, 141, 80, 80, 80, 80, 80, 1, 142, 79, 142, 80, 80, 80, 81, 82, 143, 80, 80, 80, 80, 80, 1, 144, 145, 144, 38, 35, 143, 1, 146, 1, 147, 147, 1, 147, 147, 38, 35, 143, 1, 143, 148, 143, 89, 90, 89, 89, 91, 89, 89, 89, 149, 89, 89, 1, 150, 1, 151, 151, 1, 151, 94, 151, 89, 90, 89, 89, 91, 89, 89, 89, 149, 89, 89, 1, 152, 153, 152, 154, 156, 155, 1, 157, 24, 157, 51, 51, 51, 51, 51, 51, 51, 51, 51, 1, 158, 24, 158, 51, 51, 51, 54, 51, 51, 51, 51, 51, 51, 1, 159, 24, 159, 23, 1, 1, 0 ]; _tsip_machine_parser_header_Contact_trans_targs = [ 2, 0, 8, 3, 4, 5, 6, 7, 9, 9, 10, 35, 40, 123, 18, 45, 11, 12, 12, 13, 14, 15, 16, 18, 17, 126, 19, 20, 19, 21, 22, 23, 24, 17, 28, 50, 24, 25, 28, 26, 27, 28, 29, 30, 31, 31, 32, 33, 34, 36, 38, 35, 37, 32, 18, 37, 32, 39, 40, 41, 43, 44, 42, 46, 45, 48, 47, 47, 49, 24, 17, 28, 50, 51, 54, 107, 52, 53, 55, 17, 54, 28, 50, 59, 55, 56, 57, 58, 60, 71, 66, 72, 61, 62, 63, 64, 65, 67, 69, 70, 68, 24, 73, 106, 74, 77, 75, 76, 78, 93, 79, 91, 80, 81, 89, 82, 83, 87, 84, 85, 86, 88, 90, 92, 94, 102, 95, 98, 96, 97, 99, 100, 101, 103, 104, 105, 108, 109, 110, 111, 112, 113, 114, 118, 114, 115, 116, 117, 119, 122, 120, 121, 24, 17, 28, 122, 50, 124, 125, 125 ]; _tsip_machine_parser_header_Contact_trans_actions = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 17, 17, 17, 3, 17, 0, 0, 3, 3, 0, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 7, 13, 13, 13, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 0, 0, 0, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 20, 20, 20, 7, 0, 1, 1, 0, 0, 26, 26, 0, 26, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, 0, 0, 0, 1, 0, 0, 23, 23, 23, 0, 9, 0, 5, 0 ]; tsip_machine_parser_header_Contact_start = 1; tsip_machine_parser_header_Contact_first_final = 126; tsip_machine_parser_header_Contact_error = 0; tsip_machine_parser_header_Contact_en_main = 1; /* line 78 "./ragel/tsip_parser_header_Contact.jrl" */ function tsip_header_Contact(){ tsip_header.call(this, tsip_header_type_e.Contact); this.s_display_name = null; this.o_uri = null; this.i_expires = -1; } tsip_header_Contact.prototype.toString = function(){ var s_str = tsip_uri_tostring(this.o_uri, true, true); if(s_str && this.i_expires >= 0){ s_str += tsk_string_format(";expires={0}", this.i_expires); } return s_str; } // returns an array of 'Contact' headers tsip_header_Contact.prototype.Parse = function(s_str){ var cs = 0; var p = 0; var pe = s_str.length; var eof = pe; var data = tsk_buff_str2ib(s_str); var i_i_tag_start; var hdr_contacts = new Array(); var curr_contact = null; /* line 393 "./src/headers/tsip_header_Contact.js" */ { cs = tsip_machine_parser_header_Contact_start; } /* JSCodeGen::writeInit */ /* line 106 "./ragel/tsip_parser_header_Contact.jrl" */ /* line 400 "./src/headers/tsip_header_Contact.js" */ { var _klen, _trans, _keys, _ps, _widec, _acts, _nacts; var _goto_level, _resume, _eof_trans, _again, _test_eof; var _out; _klen = _trans = _keys = _acts = _nacts = null; _goto_level = 0; _resume = 10; _eof_trans = 15; _again = 20; _test_eof = 30; _out = 40; while (true) { _trigger_goto = false; if (_goto_level <= 0) { if (p == pe) { _goto_level = _test_eof; continue; } if (cs == 0) { _goto_level = _out; continue; } } if (_goto_level <= _resume) { _keys = _tsip_machine_parser_header_Contact_key_offsets[cs]; _trans = _tsip_machine_parser_header_Contact_index_offsets[cs]; _klen = _tsip_machine_parser_header_Contact_single_lengths[cs]; _break_match = false; do { if (_klen > 0) { _lower = _keys; _upper = _keys + _klen - 1; while (true) { if (_upper < _lower) { break; } _mid = _lower + ( (_upper - _lower) >> 1 ); if (data[p] < _tsip_machine_parser_header_Contact_trans_keys[_mid]) { _upper = _mid - 1; } else if (data[p] > _tsip_machine_parser_header_Contact_trans_keys[_mid]) { _lower = _mid + 1; } else { _trans += (_mid - _keys); _break_match = true; break; }; } /* while */ if (_break_match) { break; } _keys += _klen; _trans += _klen; } _klen = _tsip_machine_parser_header_Contact_range_lengths[cs]; if (_klen > 0) { _lower = _keys; _upper = _keys + (_klen << 1) - 2; while (true) { if (_upper < _lower) { break; } _mid = _lower + (((_upper-_lower) >> 1) & ~1); if (data[p] < _tsip_machine_parser_header_Contact_trans_keys[_mid]) { _upper = _mid - 2; } else if (data[p] > _tsip_machine_parser_header_Contact_trans_keys[_mid+1]) { _lower = _mid + 2; } else { _trans += ((_mid - _keys) >> 1); _break_match = true; break; } } /* while */ if (_break_match) { break; } _trans += _klen } } while (false); _trans = _tsip_machine_parser_header_Contact_indicies[_trans]; cs = _tsip_machine_parser_header_Contact_trans_targs[_trans]; if (_tsip_machine_parser_header_Contact_trans_actions[_trans] != 0) { _acts = _tsip_machine_parser_header_Contact_trans_actions[_trans]; _nacts = _tsip_machine_parser_header_Contact_actions[_acts]; _acts += 1; while (_nacts > 0) { _nacts -= 1; _acts += 1; switch (_tsip_machine_parser_header_Contact_actions[_acts - 1]) { case 0: /* line 13 "./ragel/tsip_parser_header_Contact.jrl" */ i_tag_start = p; break; case 1: /* line 17 "./ragel/tsip_parser_header_Contact.jrl" */ if(!curr_contact){ curr_contact = new tsip_header_Contact(); } break; case 2: /* line 23 "./ragel/tsip_parser_header_Contact.jrl" */ if(curr_contact){ curr_contact.s_display_name = tsk_ragel_parser_get_string(s_str, p, i_tag_start); curr_contact.s_display_name = tsk_string_unquote_2(curr_contact.s_display_name); } break; case 3: /* line 30 "./ragel/tsip_parser_header_Contact.jrl" */ if(curr_contact && !curr_contact.o_uri){ var s_uri = tsk_ragel_parser_get_string(s_str, p, i_tag_start); if((curr_contact.o_uri = tsip_uri.prototype.Parse(s_uri)) && curr_contact.s_display_name){ curr_contact.o_uri.s_display_name = tsk_strdup(curr_contact.s_display_name); } } break; case 4: /* line 39 "./ragel/tsip_parser_header_Contact.jrl" */ if(curr_contact){ curr_contact.i_expires = tsk_ragel_parser_get_int(s_str, p, i_tag_start); } break; case 5: /* line 45 "./ragel/tsip_parser_header_Contact.jrl" */ if(curr_contact){ tsk_ragel_add_param(s_str, p, i_tag_start, curr_contact.ao_params); } break; case 6: /* line 51 "./ragel/tsip_parser_header_Contact.jrl" */ if(curr_contact){ hdr_contacts.push(curr_contact); curr_contact = null; } break; case 7: /* line 58 "./ragel/tsip_parser_header_Contact.jrl" */ break; /* line 540 "./src/headers/tsip_header_Contact.js" */ } /* action switch */ } } if (_trigger_goto) { continue; } } if (_goto_level <= _again) { if (cs == 0) { _goto_level = _out; continue; } p += 1; if (p != pe) { _goto_level = _resume; continue; } } if (_goto_level <= _test_eof) { } if (_goto_level <= _out) { break; } } } /* line 107 "./ragel/tsip_parser_header_Contact.jrl" */ if( cs < /* line 570 "./src/headers/tsip_header_Contact.js" */ 126 /* line 108 "./ragel/tsip_parser_header_Contact.jrl" */ ){ tsk_utils_log_error("Failed to parse 'Contact' header: " + s_str); return null; } return hdr_contacts; }
daninnitel/sipml5
src/tinySIP/src/headers/tsip_header_Contact.js
JavaScript
bsd-3-clause
17,164
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Ordinary Least Squares and Ridge Regression Variance ========================================================= Due to the few points in each dimension and the straight line that linear regression uses to follow these points as well as it can, noise on the observations will cause great variance as shown in the first plot. Every line's slope can vary quite a bit for each prediction due to the noise induced in the observations. Ridge regression is basically minimizing a penalised version of the least-squared function. The penalising `shrinks` the value of the regression coefficients. Despite the few data points in each dimension, the slope of the prediction is much more stable and the variance in the line itself is greatly reduced, in comparison to that of the standard linear regression """ print(__doc__) # Code source: Gaël Varoquaux # Modified for documentation by Jaques Grobler # License: BSD 3 clause import numpy as np import matplotlib.pyplot as plt from sklearn import linear_model X_train = np.c_[.5, 1].T y_train = [.5, 1] X_test = np.c_[0, 2].T np.random.seed(0) classifiers = dict(ols=linear_model.LinearRegression(), ridge=linear_model.Ridge(alpha=.1)) for name, clf in classifiers.items(): fig, ax = plt.subplots(figsize=(4, 3)) for _ in range(6): this_X = .1 * np.random.normal(size=(2, 1)) + X_train clf.fit(this_X, y_train) ax.plot(X_test, clf.predict(X_test), color='gray') ax.scatter(this_X, y_train, s=3, c='gray', marker='o', zorder=10) clf.fit(X_train, y_train) ax.plot(X_test, clf.predict(X_test), linewidth=2, color='blue') ax.scatter(X_train, y_train, s=30, c='red', marker='+', zorder=10) ax.set_title(name) ax.set_xlim(0, 2) ax.set_ylim((0, 1.6)) ax.set_xlabel('X') ax.set_ylabel('y') fig.tight_layout() plt.show()
glemaitre/scikit-learn
examples/linear_model/plot_ols_ridge_variance.py
Python
bsd-3-clause
1,968
/* ---------------------------------------------------------------------------- * ATMEL Microcontroller Software Support * ---------------------------------------------------------------------------- * Copyright (c) 2008, Atmel Corporation * * 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 disclaimer below. * * Atmel's name may not be used to endorse or promote products derived from * this software without specific prior written permission. * * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE * DISCLAIMED. IN NO EVENT SHALL ATMEL 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. * ---------------------------------------------------------------------------- */ //------------------------------------------------------------------------------ // Headers //------------------------------------------------------------------------------ #include "rtt.h" #include <utility/assert.h> //------------------------------------------------------------------------------ // Exported functions //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ /// Changes the prescaler value of the given RTT and restarts it. This function /// disables RTT interrupt sources. /// \param rtt Pointer to a AT91S_RTTC instance. /// \param prescaler Prescaler value for the RTT. //------------------------------------------------------------------------------ void RTT_SetPrescaler(AT91S_RTTC *rtt, unsigned short prescaler) { rtt->RTTC_RTMR = (prescaler | AT91C_RTTC_RTTRST); } //------------------------------------------------------------------------------ /// Returns the current value of the RTT timer value. /// \param rtt Pointer to a AT91S_RTTC instance. //------------------------------------------------------------------------------ unsigned int RTT_GetTime(AT91S_RTTC *rtt) { return rtt->RTTC_RTVR; } //------------------------------------------------------------------------------ /// Enables the specified RTT interrupt sources. /// \param rtt Pointer to a AT91S_RTTC instance. /// \param sources Bitmask of interrupts to enable. //------------------------------------------------------------------------------ void RTT_EnableIT(AT91S_RTTC *rtt, unsigned int sources) { ASSERT((sources & 0x0004FFFF) == 0, "RTT_EnableIT: Wrong sources value.\n\r"); rtt->RTTC_RTMR |= sources; } //------------------------------------------------------------------------------ /// Returns the status register value of the given RTT. /// \param rtt Pointer to an AT91S_RTTC instance. //------------------------------------------------------------------------------ unsigned int RTT_GetStatus(AT91S_RTTC *rtt) { return rtt->RTTC_RTSR; } //------------------------------------------------------------------------------ /// Configures the RTT to generate an alarm at the given time. /// \param pRtt Pointer to an AT91S_RTTC instance. /// \param time Alarm time. //------------------------------------------------------------------------------ void RTT_SetAlarm(AT91S_RTTC *pRtt, unsigned int time) { SANITY_CHECK(time > 0); pRtt->RTTC_RTAR = time - 1; }
jedediahfrey/STM32F4-Discovery_FW_V1.1.0_Makefiles
FreeRTOS/FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR/AT91Lib/peripherals/rtt/rtt.c
C
bsd-3-clause
4,172
/* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "gm.h" #include "SkCanvas.h" #include "SkPath.h" #include "SkRandom.h" namespace skiagm { class ComplexClip2GM : public GM { public: ComplexClip2GM(bool doPaths, bool antiAlias) : fDoPaths(doPaths) , fAntiAlias(antiAlias) { this->setBGColor(SkColorSetRGB(0xDD,0xA0,0xDD)); // offset the rects a bit so we get antialiasing even in the rect case SkScalar xA = SkFloatToScalar(0.65f); SkScalar xB = SkFloatToScalar(10.65f); SkScalar xC = SkFloatToScalar(20.65f); SkScalar xD = SkFloatToScalar(30.65f); SkScalar xE = SkFloatToScalar(40.65f); SkScalar xF = SkFloatToScalar(50.65f); SkScalar yA = SkFloatToScalar(0.65f); SkScalar yB = SkFloatToScalar(10.65f); SkScalar yC = SkFloatToScalar(20.65f); SkScalar yD = SkFloatToScalar(30.65f); SkScalar yE = SkFloatToScalar(40.65f); SkScalar yF = SkFloatToScalar(50.65f); fWidth = xF - xA; fHeight = yF - yA; fRects[0].set(xB, yB, xE, yE); fPaths[0].addRoundRect(fRects[0], SkIntToScalar(5), SkIntToScalar(5)); fRectColors[0] = SK_ColorRED; fRects[1].set(xA, yA, xD, yD); fPaths[1].addRoundRect(fRects[1], SkIntToScalar(5), SkIntToScalar(5)); fRectColors[1] = SK_ColorGREEN; fRects[2].set(xC, yA, xF, yD); fPaths[2].addRoundRect(fRects[2], SkIntToScalar(5), SkIntToScalar(5)); fRectColors[2] = SK_ColorBLUE; fRects[3].set(xA, yC, xD, yF); fPaths[3].addRoundRect(fRects[3], SkIntToScalar(5), SkIntToScalar(5)); fRectColors[3] = SK_ColorYELLOW; fRects[4].set(xC, yC, xF, yF); fPaths[4].addRoundRect(fRects[4], SkIntToScalar(5), SkIntToScalar(5)); fRectColors[4] = SK_ColorCYAN; fTotalWidth = kCols * fWidth + SK_Scalar1 * (kCols + 1) * kPadX; fTotalHeight = kRows * fHeight + SK_Scalar1 * (kRows + 1) * kPadY; SkRegion::Op ops[] = { SkRegion::kDifference_Op, SkRegion::kIntersect_Op, SkRegion::kUnion_Op, SkRegion::kXOR_Op, SkRegion::kReverseDifference_Op, SkRegion::kReplace_Op, }; SkRandom r; for (int i = 0; i < kRows; ++i) { for (int j = 0; j < kCols; ++j) { for (int k = 0; k < 5; ++k) { fOps[j*kRows+i][k] = ops[r.nextU() % SK_ARRAY_COUNT(ops)]; } } } } protected: static const int kRows = 5; static const int kCols = 5; static const int kPadX = 20; static const int kPadY = 20; virtual SkString onShortName() { if (!fDoPaths && !fAntiAlias) { return SkString("complexclip2"); } SkString str; str.printf("complexclip2_%s_%s", fDoPaths ? "path" : "rect", fAntiAlias ? "aa" : "bw"); return str; } virtual SkISize onISize() { return make_isize(SkScalarRoundToInt(fTotalWidth), SkScalarRoundToInt(fTotalHeight)); } virtual void onDraw(SkCanvas* canvas) { SkPaint rectPaint; rectPaint.setStyle(SkPaint::kStroke_Style); rectPaint.setStrokeWidth(-1); SkPaint fillPaint; fillPaint.setColor(SkColorSetRGB(0xA0,0xDD,0xA0)); for (int i = 0; i < kRows; ++i) { for (int j = 0; j < kCols; ++j) { canvas->save(); canvas->translate(kPadX * SK_Scalar1 + (fWidth + kPadX * SK_Scalar1)*j, kPadY * SK_Scalar1 + (fHeight + kPadY * SK_Scalar1)*i); // draw the original shapes first so we can see the // antialiasing on the clipped draw for (int k = 0; k < 5; ++k) { rectPaint.setColor(fRectColors[k]); if (fDoPaths) { canvas->drawPath(fPaths[k], rectPaint); } else { canvas->drawRect(fRects[k], rectPaint); } } for (int k = 0; k < 5; ++k) { if (fDoPaths) { canvas->clipPath(fPaths[k], fOps[j*kRows+i][k], fAntiAlias); } else { canvas->clipRect(fRects[k], fOps[j*kRows+i][k], fAntiAlias); } } canvas->drawRect(SkRect::MakeWH(fWidth, fHeight), fillPaint); canvas->restore(); } } } private: bool fDoPaths; bool fAntiAlias; SkRect fRects[5]; SkPath fPaths[5]; SkColor fRectColors[5]; SkRegion::Op fOps[kRows * kCols][5]; SkScalar fWidth; SkScalar fHeight; SkScalar fTotalWidth; SkScalar fTotalHeight; typedef GM INHERITED; }; ////////////////////////////////////////////////////////////////////////////// // bw rects static GM* MyFactory(void*) { return new ComplexClip2GM(false, false); } static GMRegistry reg(MyFactory); // bw paths static GM* MyFactory2(void*) { return new ComplexClip2GM(true, false); } static GMRegistry reg2(MyFactory2); // aa rects static GM* MyFactory3(void*) { return new ComplexClip2GM(false, true); } static GMRegistry reg3(MyFactory3); // aa paths static GM* MyFactory4(void*) { return new ComplexClip2GM(true, true); } static GMRegistry reg4(MyFactory4); }
IllusionRom-deprecated/android_platform_external_skia
gm/complexclip2.cpp
C++
bsd-3-clause
5,742
<?php // +------------------------------------------------------------------------+ // | class.upload.zh_TW.php | // +------------------------------------------------------------------------+ // | Copyright (c) Yang Chih-Wen 2009. All rights reserved. | // | Version 0.28 | // | Last modified 15/08/2009 | // | Email chihwen.yang@gmail.com | // | Web http://www.doubleservice.com/ | // +------------------------------------------------------------------------+ // | This program is free software; you can redistribute it and/or modify | // | it under the terms of the GNU General Public License version 2 as | // | published by the Free Software Foundation. | // | | // | 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 | // | | // | Please give credit on sites that use class.upload and submit changes | // | of the script so other people can use them as well. | // | This script is free to use, don't abuse. | // +------------------------------------------------------------------------+ /** * Class upload Traditional Chinese translation * * @version 0.28 * @author Yang Chih-Wen (chihwen.yang@gmail.com) * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @copyright Yang Chih-Wen * @package cmf * @subpackage external */ $translation = array(); $translation['file_error'] = '檔案錯誤,請重試。'; $translation['local_file_missing'] = '本地端的檔案不存在。'; $translation['local_file_not_readable'] = '本地端的檔案不可讀取。'; $translation['uploaded_too_big_ini'] = '檔案上傳出錯 (上傳的檔案超過了 php.ini 中 upload_max_filesize 指定的大小)。'; $translation['uploaded_too_big_html'] = '檔案上傳出錯 (上傳的檔案超過了 HTML 表單中 MAX_FILE_SIZE 指定的大小)。'; $translation['uploaded_partial'] = '檔案上傳出錯 (只有部份的檔案被上傳)。'; $translation['uploaded_missing'] = '檔案上傳出錯 (沒有檔案被上傳)。'; $translation['uploaded_no_tmp_dir'] = '檔案上傳出錯 (找不到暫存目錄)。'; $translation['uploaded_cant_write'] = '檔案上傳出錯 (檔案寫入失敗)。'; $translation['uploaded_err_extension'] = '檔案上傳出錯 (檔案上傳被 extension 中斷)。'; $translation['uploaded_unknown'] = '檔案上傳出錯 (未知的錯誤)。'; $translation['try_again'] = '檔案上傳出錯,請重試。'; $translation['file_too_big'] = '檔案太大了。'; $translation['no_mime'] = '未知的 MIME Type 檔案類型。'; $translation['incorrect_file'] = '不正確的 MIME Type 檔案類型。'; $translation['image_too_wide'] = '圖片寬度太大。'; $translation['image_too_narrow'] = '圖片寬度太小。'; $translation['image_too_high'] = '圖片高度太大。'; $translation['image_too_short'] = '圖片高度太小。'; $translation['ratio_too_high'] = '圖片寬高比率太大 (圖片寬度太大)。'; $translation['ratio_too_low'] = '圖片寬高比率太小 (圖片高度太大)。'; $translation['too_many_pixels'] = '圖片像素太多。'; $translation['not_enough_pixels'] = '圖片像素太少。'; $translation['file_not_uploaded'] = '檔案未上傳,無法繼續進行處理。'; $translation['already_exists'] = '%s 已經存在,請更改檔名。'; $translation['temp_file_missing'] = '暫存的原始檔案不正確,無法繼續進行處理。'; $translation['source_missing'] = '已上傳的原始檔案不正確,無法繼續進行處理。'; $translation['destination_dir'] = '無法創建目標目錄,無法繼續進行處理。'; $translation['destination_dir_missing'] = '目標目錄不存在,無法繼續進行處理。'; $translation['destination_path_not_dir'] = '目標路徑不是一個有效的目錄,無法繼續進行處理。'; $translation['destination_dir_write'] = '目標目錄不能設定為可寫入,無法繼續進行處理。'; $translation['destination_path_write'] = '目錄路徑不可寫入,無法繼續進行處理。'; $translation['temp_file'] = '不能創建暫存檔案,無法繼續進行處理。'; $translation['source_not_readable'] = '原始檔案不可讀取,無法繼續進行處理。'; $translation['no_create_support'] = '不支援 %s 創建功能。'; $translation['create_error'] = '從原始檔案創建 %s 圖片過程中出錯。'; $translation['source_invalid'] = '無法讀取原始圖片,請確認是否為正確的圖片檔?'; $translation['gd_missing'] = '無法使用 GD 函式庫。'; $translation['watermark_no_create_support'] = '不支援 %s 創建功能,無法讀取浮水印。'; $translation['watermark_create_error'] = '不支援 %s 讀取功能,無法創建浮水印。'; $translation['watermark_invalid'] = '未知的圖片格式,無法讀取浮水印。'; $translation['file_create'] = '不支援 %s 創建功能。'; $translation['no_conversion_type'] = '未定義的轉換類型。'; $translation['copy_failed'] = '在伺服端複製檔案時出錯,copy() 操作失敗。'; $translation['reading_failed'] = '讀檔過程中出錯。'; ?>
manguiatmarvin/extreme
vendor/MarvinFileUploadUtils/UploadClass/lang/class.upload.zh_TW.php
PHP
bsd-3-clause
6,827
<?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace Zend\Validator\Barcode; class Code93 extends AbstractAdapter { /** * Note that the characters !"§& are only synonyms * @var array */ protected $check = array( '0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, '7' => 7, '8' => 8, '9' => 9, 'A' => 10, 'B' => 11, 'C' => 12, 'D' => 13, 'E' => 14, 'F' => 15, 'G' => 16, 'H' => 17, 'I' => 18, 'J' => 19, 'K' => 20, 'L' => 21, 'M' => 22, 'N' => 23, 'O' => 24, 'P' => 25, 'Q' => 26, 'R' => 27, 'S' => 28, 'T' => 29, 'U' => 30, 'V' => 31, 'W' => 32, 'X' => 33, 'Y' => 34, 'Z' => 35, '-' => 36, '.' => 37, ' ' => 38, '$' => 39, '/' => 40, '+' => 41, '%' => 42, '!' => 43, '"' => 44, '§' => 45, '&' => 46, ); /** * Constructor for this barcode adapter */ public function __construct() { $this->setLength(-1); $this->setCharacters('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ -.$/+%'); $this->setChecksum('code93'); $this->useChecksum(false); } /** * Validates the checksum (Modulo CK) * * @param string $value The barcode to validate * @return bool */ protected function code93($value) { $checksum = substr($value, -2, 2); $value = str_split(substr($value, 0, -2)); $count = 0; $length = count($value) % 20; foreach ($value as $char) { if ($length == 0) { $length = 20; } $count += $this->check[$char] * $length; --$length; } $check = array_search(($count % 47), $this->check); $value[] = $check; $count = 0; $length = count($value) % 15; foreach ($value as $char) { if ($length == 0) { $length = 15; } $count += $this->check[$char] * $length; --$length; } $check .= array_search(($count % 47), $this->check); if ($check == $checksum) { return true; } return false; } }
corner82/sanalFabrika
vendor/zendframework/zend-validator/src/Barcode/Code93.php
PHP
bsd-3-clause
2,427
// Created by cgo -godefs - DO NOT EDIT // cgo -godefs defs_freebsd.go package route const ( sysAF_UNSPEC = 0x0 sysAF_INET = 0x2 sysAF_ROUTE = 0x11 sysAF_LINK = 0x12 sysAF_INET6 = 0x1c sysNET_RT_DUMP = 0x1 sysNET_RT_FLAGS = 0x2 sysNET_RT_IFLIST = 0x3 sysNET_RT_IFMALIST = 0x4 sysNET_RT_IFLISTL = 0x5 ) const ( sysCTL_MAXNAME = 0x18 sysCTL_UNSPEC = 0x0 sysCTL_KERN = 0x1 sysCTL_VM = 0x2 sysCTL_VFS = 0x3 sysCTL_NET = 0x4 sysCTL_DEBUG = 0x5 sysCTL_HW = 0x6 sysCTL_MACHDEP = 0x7 sysCTL_USER = 0x8 sysCTL_P1003_1B = 0x9 ) const ( sysRTM_VERSION = 0x5 sysRTM_ADD = 0x1 sysRTM_DELETE = 0x2 sysRTM_CHANGE = 0x3 sysRTM_GET = 0x4 sysRTM_LOSING = 0x5 sysRTM_REDIRECT = 0x6 sysRTM_MISS = 0x7 sysRTM_LOCK = 0x8 sysRTM_RESOLVE = 0xb sysRTM_NEWADDR = 0xc sysRTM_DELADDR = 0xd sysRTM_IFINFO = 0xe sysRTM_NEWMADDR = 0xf sysRTM_DELMADDR = 0x10 sysRTM_IFANNOUNCE = 0x11 sysRTM_IEEE80211 = 0x12 sysRTA_DST = 0x1 sysRTA_GATEWAY = 0x2 sysRTA_NETMASK = 0x4 sysRTA_GENMASK = 0x8 sysRTA_IFP = 0x10 sysRTA_IFA = 0x20 sysRTA_AUTHOR = 0x40 sysRTA_BRD = 0x80 sysRTAX_DST = 0x0 sysRTAX_GATEWAY = 0x1 sysRTAX_NETMASK = 0x2 sysRTAX_GENMASK = 0x3 sysRTAX_IFP = 0x4 sysRTAX_IFA = 0x5 sysRTAX_AUTHOR = 0x6 sysRTAX_BRD = 0x7 sysRTAX_MAX = 0x8 ) const ( sizeofIfMsghdrlFreeBSD10 = 0xb0 sizeofIfaMsghdrFreeBSD10 = 0x14 sizeofIfaMsghdrlFreeBSD10 = 0xb0 sizeofIfmaMsghdrFreeBSD10 = 0x10 sizeofIfAnnouncemsghdrFreeBSD10 = 0x18 sizeofRtMsghdrFreeBSD10 = 0x98 sizeofRtMetricsFreeBSD10 = 0x70 sizeofIfMsghdrFreeBSD7 = 0xa8 sizeofIfMsghdrFreeBSD8 = 0xa8 sizeofIfMsghdrFreeBSD9 = 0xa8 sizeofIfMsghdrFreeBSD10 = 0xa8 sizeofIfMsghdrFreeBSD11 = 0xa8 sizeofIfDataFreeBSD7 = 0x98 sizeofIfDataFreeBSD8 = 0x98 sizeofIfDataFreeBSD9 = 0x98 sizeofIfDataFreeBSD10 = 0x98 sizeofIfDataFreeBSD11 = 0x98 sizeofIfMsghdrlFreeBSD10Emu = 0xb0 sizeofIfaMsghdrFreeBSD10Emu = 0x14 sizeofIfaMsghdrlFreeBSD10Emu = 0xb0 sizeofIfmaMsghdrFreeBSD10Emu = 0x10 sizeofIfAnnouncemsghdrFreeBSD10Emu = 0x18 sizeofRtMsghdrFreeBSD10Emu = 0x98 sizeofRtMetricsFreeBSD10Emu = 0x70 sizeofIfMsghdrFreeBSD7Emu = 0xa8 sizeofIfMsghdrFreeBSD8Emu = 0xa8 sizeofIfMsghdrFreeBSD9Emu = 0xa8 sizeofIfMsghdrFreeBSD10Emu = 0xa8 sizeofIfMsghdrFreeBSD11Emu = 0xa8 sizeofIfDataFreeBSD7Emu = 0x98 sizeofIfDataFreeBSD8Emu = 0x98 sizeofIfDataFreeBSD9Emu = 0x98 sizeofIfDataFreeBSD10Emu = 0x98 sizeofIfDataFreeBSD11Emu = 0x98 )
VhatAmI/Go
src/vendor/golang_org/x/net/route/zsys_freebsd_amd64.go
GO
bsd-3-clause
2,643
# -*- coding: utf-8 -*- """ Attracting components. """ # Copyright (C) 2004-2015 by # Aric Hagberg <hagberg@lanl.gov> # Dan Schult <dschult@colgate.edu> # Pieter Swart <swart@lanl.gov> # All rights reserved. # BSD license. import networkx as nx from networkx.utils.decorators import not_implemented_for __authors__ = "\n".join(['Christopher Ellison']) __all__ = ['number_attracting_components', 'attracting_components', 'is_attracting_component', 'attracting_component_subgraphs', ] @not_implemented_for('undirected') def attracting_components(G): """Generates a list of attracting components in `G`. An attracting component in a directed graph `G` is a strongly connected component with the property that a random walker on the graph will never leave the component, once it enters the component. The nodes in attracting components can also be thought of as recurrent nodes. If a random walker enters the attractor containing the node, then the node will be visited infinitely often. Parameters ---------- G : DiGraph, MultiDiGraph The graph to be analyzed. Returns ------- attractors : generator of sets A generator of sets of nodes, one for each attracting component of G. See Also -------- number_attracting_components is_attracting_component attracting_component_subgraphs """ scc = list(nx.strongly_connected_components(G)) cG = nx.condensation(G, scc) for n in cG: if cG.out_degree(n) == 0: yield scc[n] @not_implemented_for('undirected') def number_attracting_components(G): """Returns the number of attracting components in `G`. Parameters ---------- G : DiGraph, MultiDiGraph The graph to be analyzed. Returns ------- n : int The number of attracting components in G. See Also -------- attracting_components is_attracting_component attracting_component_subgraphs """ n = len(list(attracting_components(G))) return n @not_implemented_for('undirected') def is_attracting_component(G): """Returns True if `G` consists of a single attracting component. Parameters ---------- G : DiGraph, MultiDiGraph The graph to be analyzed. Returns ------- attracting : bool True if `G` has a single attracting component. Otherwise, False. See Also -------- attracting_components number_attracting_components attracting_component_subgraphs """ ac = list(attracting_components(G)) if len(ac[0]) == len(G): attracting = True else: attracting = False return attracting @not_implemented_for('undirected') def attracting_component_subgraphs(G, copy=True): """Generates a list of attracting component subgraphs from `G`. Parameters ---------- G : DiGraph, MultiDiGraph The graph to be analyzed. Returns ------- subgraphs : list A list of node-induced subgraphs of the attracting components of `G`. copy : bool If copy is True, graph, node, and edge attributes are copied to the subgraphs. See Also -------- attracting_components number_attracting_components is_attracting_component """ for ac in attracting_components(G): if copy: yield G.subgraph(ac).copy() else: yield G.subgraph(ac)
sharifulgeo/networkx
networkx/algorithms/components/attracting.py
Python
bsd-3-clause
3,496
<?php /* Message Interface in Swift Mailer. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ //@require 'Swift/Mime/MimeEntity.php'; /** * A Message (RFC 2822) object. * * @package Swift * @subpackage Mime * * @author Chris Corbyn */ interface Swift_Mime_Message extends Swift_Mime_MimeEntity { /** * Generates a valid Message-ID and switches to it. * * @return string */ public function generateId(); /** * Set the subject of the message. * * @param string $subject */ public function setSubject($subject); /** * Get the subject of the message. * * @return string */ public function getSubject(); /** * Set the origination date of the message as a UNIX timestamp. * * @param int $date */ public function setDate($date); /** * Get the origination date of the message as a UNIX timestamp. * * @return int */ public function getDate(); /** * Set the return-path (bounce-detect) address. * * @param string $address */ public function setReturnPath($address); /** * Get the return-path (bounce-detect) address. * * @return string */ public function getReturnPath(); /** * Set the sender of this message. * * If multiple addresses are present in the From field, this SHOULD be set. * * According to RFC 2822 it is a requirement when there are multiple From * addresses, but Swift itself does not require it directly. * * An associative array (with one element!) can be used to provide a display- * name: i.e. array('email@address' => 'Real Name'). * * If the second parameter is provided and the first is a string, then $name * is associated with the address. * * @param mixed $address * @param string $name optional */ public function setSender($address, $name = null); /** * Get the sender address for this message. * * This has a higher significance than the From address. * * @return string */ public function getSender(); /** * Set the From address of this message. * * It is permissible for multiple From addresses to be set using an array. * * If multiple From addresses are used, you SHOULD set the Sender address and * according to RFC 2822, MUST set the sender address. * * An array can be used if display names are to be provided: i.e. * array('email@address.com' => 'Real Name'). * * If the second parameter is provided and the first is a string, then $name * is associated with the address. * * @param mixed $addresses * @param string $name optional */ public function setFrom($addresses, $name = null); /** * Get the From address(es) of this message. * * This method always returns an associative array where the keys are the * addresses. * * @return string[] */ public function getFrom(); /** * Set the Reply-To address(es). * * Any replies from the receiver will be sent to this address. * * It is permissible for multiple reply-to addresses to be set using an array. * * This method has the same synopsis as {@link setFrom()} and {@link setTo()}. * * If the second parameter is provided and the first is a string, then $name * is associated with the address. * * @param mixed $addresses * @param string $name optional */ public function setReplyTo($addresses, $name = null); /** * Get the Reply-To addresses for this message. * * This method always returns an associative array where the keys provide the * email addresses. * * @return string[] */ public function getReplyTo(); /** * Set the To address(es). * * Recipients set in this field will receive a copy of this message. * * This method has the same synopsis as {@link setFrom()} and {@link setCc()}. * * If the second parameter is provided and the first is a string, then $name * is associated with the address. * * @param mixed $addresses * @param string $name optional */ public function setTo($addresses, $name = null); /** * Get the To addresses for this message. * * This method always returns an associative array, whereby the keys provide * the actual email addresses. * * @return string[] */ public function getTo(); /** * Set the Cc address(es). * * Recipients set in this field will receive a 'carbon-copy' of this message. * * This method has the same synopsis as {@link setFrom()} and {@link setTo()}. * * @param mixed $addresses * @param string $name optional */ public function setCc($addresses, $name = null); /** * Get the Cc addresses for this message. * * This method always returns an associative array, whereby the keys provide * the actual email addresses. * * @return string[] */ public function getCc(); /** * Set the Bcc address(es). * * Recipients set in this field will receive a 'blind-carbon-copy' of this * message. * * In other words, they will get the message, but any other recipients of the * message will have no such knowledge of their receipt of it. * * This method has the same synopsis as {@link setFrom()} and {@link setTo()}. * * @param mixed $addresses * @param string $name optional */ public function setBcc($addresses, $name = null); /** * Get the Bcc addresses for this message. * * This method always returns an associative array, whereby the keys provide * the actual email addresses. * * @return string[] */ public function getBcc(); }
ProNWE/version-1.0
modules/email/vendor/swift/classes/Swift/Mime/Message.php
PHP
bsd-3-clause
6,276
// Copyright 2011 Google Inc. All Rights Reserved. // // Use of this source code is governed by a BSD-style license // that can be found in the COPYING file in the root of the source // tree. An additional intellectual property rights grant can be found // in the file PATENTS. All contributing project authors may // be found in the AUTHORS file in the root of the source tree. // ----------------------------------------------------------------------------- // // CPU detection // // Author: Christian Duvivier (cduvivier@google.com) #include "./dsp.h" #if defined(__ANDROID__) #include <cpu-features.h> #endif //------------------------------------------------------------------------------ // SSE2 detection. // // apple/darwin gcc-4.0.1 defines __PIC__, but not __pic__ with -fPIC. #if (defined(__pic__) || defined(__PIC__)) && defined(__i386__) static WEBP_INLINE void GetCPUInfo(int cpu_info[4], int info_type) { __asm__ volatile ( "mov %%ebx, %%edi\n" "cpuid\n" "xchg %%edi, %%ebx\n" : "=a"(cpu_info[0]), "=D"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3]) : "a"(info_type), "c"(0)); } #elif defined(__i386__) || defined(__x86_64__) static WEBP_INLINE void GetCPUInfo(int cpu_info[4], int info_type) { __asm__ volatile ( "cpuid\n" : "=a"(cpu_info[0]), "=b"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3]) : "a"(info_type), "c"(0)); } #elif (defined(_M_X64) || defined(_M_IX86)) && \ defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 150030729 // >= VS2008 SP1 #include <intrin.h> #define GetCPUInfo(info, type) __cpuidex(info, type, 0) // set ecx=0 #elif defined(WEBP_MSC_SSE2) #define GetCPUInfo __cpuid #endif // NaCl has no support for xgetbv or the raw opcode. #if !defined(__native_client__) && (defined(__i386__) || defined(__x86_64__)) static WEBP_INLINE uint64_t xgetbv(void) { const uint32_t ecx = 0; uint32_t eax, edx; // Use the raw opcode for xgetbv for compatibility with older toolchains. __asm__ volatile ( ".byte 0x0f, 0x01, 0xd0\n" : "=a"(eax), "=d"(edx) : "c" (ecx)); return ((uint64_t)edx << 32) | eax; } #elif (defined(_M_X64) || defined(_M_IX86)) && \ defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 160040219 // >= VS2010 SP1 #include <immintrin.h> #define xgetbv() _xgetbv(0) #elif defined(_MSC_VER) && defined(_M_IX86) static WEBP_INLINE uint64_t xgetbv(void) { uint32_t eax_, edx_; __asm { xor ecx, ecx // ecx = 0 // Use the raw opcode for xgetbv for compatibility with older toolchains. __asm _emit 0x0f __asm _emit 0x01 __asm _emit 0xd0 mov eax_, eax mov edx_, edx } return ((uint64_t)edx_ << 32) | eax_; } #else #define xgetbv() 0U // no AVX for older x64 or unrecognized toolchains. #endif #if defined(__i386__) || defined(__x86_64__) || defined(WEBP_MSC_SSE2) static int x86CPUInfo(CPUFeature feature) { int cpu_info[4]; GetCPUInfo(cpu_info, 1); if (feature == kSSE2) { return 0 != (cpu_info[3] & 0x04000000); } if (feature == kSSE3) { return 0 != (cpu_info[2] & 0x00000001); } if (feature == kAVX) { // bits 27 (OSXSAVE) & 28 (256-bit AVX) if ((cpu_info[2] & 0x18000000) == 0x18000000) { // XMM state and YMM state enabled by the OS. return (xgetbv() & 0x6) == 0x6; } } if (feature == kAVX2) { if (x86CPUInfo(kAVX)) { GetCPUInfo(cpu_info, 7); return ((cpu_info[1] & 0x00000020) == 0x00000020); } } return 0; } VP8CPUInfo VP8GetCPUInfo = x86CPUInfo; #elif defined(WEBP_ANDROID_NEON) // NB: needs to be before generic NEON test. static int AndroidCPUInfo(CPUFeature feature) { const AndroidCpuFamily cpu_family = android_getCpuFamily(); const uint64_t cpu_features = android_getCpuFeatures(); if (feature == kNEON) { return (cpu_family == ANDROID_CPU_FAMILY_ARM && 0 != (cpu_features & ANDROID_CPU_ARM_FEATURE_NEON)); } return 0; } VP8CPUInfo VP8GetCPUInfo = AndroidCPUInfo; #elif defined(WEBP_USE_NEON) // define a dummy function to enable turning off NEON at runtime by setting // VP8DecGetCPUInfo = NULL static int armCPUInfo(CPUFeature feature) { (void)feature; return 1; } VP8CPUInfo VP8GetCPUInfo = armCPUInfo; #elif defined(WEBP_USE_MIPS32) static int mipsCPUInfo(CPUFeature feature) { (void)feature; return 1; } VP8CPUInfo VP8GetCPUInfo = mipsCPUInfo; #else VP8CPUInfo VP8GetCPUInfo = NULL; #endif
SaschaMester/delicium
third_party/libwebp/dsp/cpu.c
C
bsd-3-clause
4,353
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SwitchIOS */ 'use strict'; var React = require('React'); var StyleSheet = require('StyleSheet'); var Text = require('Text'); var View = require('View'); var DummySwitchIOS = React.createClass({ render: function() { return ( <View style={[styles.dummySwitchIOS, this.props.style]}> <Text style={styles.text}>SwitchIOS is not supported on this platform!</Text> </View> ); }, }); var styles = StyleSheet.create({ dummySwitchIOS: { width: 120, height: 50, backgroundColor: '#ffbcbc', borderWidth: 1, borderColor: 'red', alignItems: 'center', justifyContent: 'center', }, text: { color: '#333333', margin: 5, fontSize: 10, } }); module.exports = DummySwitchIOS;
21451061/react-native
Libraries/Components/SwitchIOS/SwitchIOS.android.js
JavaScript
bsd-3-clause
1,070
<!DOCTYPE html> <script src="../../../resources/js-test.js"></script> <div id="container"></div> <script> description('Tests the element upgrade algorithm.'); // "Element Upgrade" is the processing of custom elements which were // created before their definition was available, when the definition // becomes available. The following scenarios cover a lot but are not // exhaustive. // Scenario A: Custom tag; upgrade candidate is not in the document; // upgrade candidate did not have a JavaScript wrapper at upgrade // time; custom element does not have a created callback. var host = document.createElement('div'); host.innerHTML = '<x-a></x-a>'; // Using innerHTML avoids wrapping x-a var A = document.registerElement('x-a', {prototype: Object.create(HTMLElement.prototype)}); shouldBeTrue('host.firstChild instanceof A'); // Scenario B: Type extension; upgrade candidate is in the document; // upgrade candidate did have a JavaScript wrapper at upgrade time; // custom element has a created callback. var element = document.createElement('span', 'x-b'); var proto = Object.create(HTMLSpanElement.prototype); var callCount = 0; proto.createdCallback = function () { callCount++; }; var B = document.registerElement('x-b', {extends: 'span', prototype: proto}); shouldBeTrue('element instanceof B'); shouldBe('callCount', '1'); // Scenario C: The candidate is a custom tag but the definition is a // type extension. Upgrade should not happen. element = document.createElement('x-c'); var C = document.registerElement('x-c', {extends: 'span', prototype: Object.create(HTMLSpanElement.prototype)}); shouldBeFalse('element instanceof C'); shouldBe('Object.getPrototypeOf(element)', 'HTMLElement.prototype'); // Scenario D: The candidate is a type extension, but the definition // extends a different tag. Upgrade should not happen. document.body.appendChild(host); host.innerHTML = '<span is="x-d"></span>'; var D = document.registerElement('x-d', {extends: 'div', prototype: Object.create(HTMLDivElement.prototype)}); shouldBeFalse('host.firstChild instanceof D'); shouldBe('document.querySelector(":unresolved")', 'host.firstChild'); // Scenario E: The order of upgrades should be the order of completing parsing. // Use a good number of elements to avoid false positives from random correct ordering. host.innerHTML = '<x-e id="e1"><x-e id="e2"></x-e></x-e><x-e id="e3"></x-e><x-e id="e4"></x-e><x-e id="e5"></x-e>'; var upgradedOrder = []; var protoE = Object.create(HTMLElement.prototype); protoE.createdCallback = function() { upgradedOrder.push(this.id); }; document.registerElement('x-e', {prototype: protoE}); shouldBe('upgradedOrder', '["e1","e2","e3","e4","e5"]'); successfullyParsed = true; </script>
XiaosongWei/blink-crosswalk
LayoutTests/fast/dom/custom/element-upgrade.html
HTML
bsd-3-clause
2,722
// 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. cr.define('print_preview', function() { 'use strict'; /** * Toggles visibility of the specified printing options sections. * @param {!print_preview.DestinationStore} destinationStore To listen for * destination changes. * @param {!Array<print_preview.SettingsSection>} settingsSections Sections * to toggle by this component. * @constructor * @extends {print_preview.Component} */ function MoreSettings(destinationStore, settingsSections) { print_preview.Component.call(this); /** @private {!print_preview.DestinationStore} */ this.destinationStore_ = destinationStore; /** @private {!Array<print_preview.SettingsSection>} */ this.settingsSections_ = settingsSections; /** @private {MoreSettings.SettingsToShow} */ this.settingsToShow_ = MoreSettings.SettingsToShow.MOST_POPULAR; /** @private {boolean} */ this.capabilitiesReady_ = false; /** @private {boolean} */ this.firstDestinationReady_ = false; /** * Used to record usage statistics. * @private {!print_preview.PrintSettingsUiMetricsContext} */ this.metrics_ = new print_preview.PrintSettingsUiMetricsContext(); }; /** * Which settings are visible to the user. * @enum {number} */ MoreSettings.SettingsToShow = { MOST_POPULAR: 1, ALL: 2 }; MoreSettings.prototype = { __proto__: print_preview.Component.prototype, /** @return {boolean} Returns {@code true} if settings are expanded. */ get isExpanded() { return this.settingsToShow_ == MoreSettings.SettingsToShow.ALL; }, /** @override */ enterDocument: function() { print_preview.Component.prototype.enterDocument.call(this); this.tracker.add(this.getElement(), 'click', this.onClick_.bind(this)); this.tracker.add( this.destinationStore_, print_preview.DestinationStore.EventType.DESTINATION_SELECT, this.onDestinationChanged_.bind(this)); this.tracker.add( this.destinationStore_, print_preview.DestinationStore.EventType. SELECTED_DESTINATION_CAPABILITIES_READY, this.onDestinationCapabilitiesReady_.bind(this)); this.settingsSections_.forEach(function(section) { this.tracker.add( section, print_preview.SettingsSection.EventType.COLLAPSIBLE_CONTENT_CHANGED, this.updateState_.bind(this)); }.bind(this)); this.updateState_(true); }, /** * Toggles "more/fewer options" state and notifies all the options sections * to reflect the new state. * @private */ onClick_: function() { this.settingsToShow_ = this.settingsToShow_ == MoreSettings.SettingsToShow.MOST_POPULAR ? MoreSettings.SettingsToShow.ALL : MoreSettings.SettingsToShow.MOST_POPULAR; this.updateState_(false); this.metrics_.record(this.isExpanded ? print_preview.Metrics.PrintSettingsUiBucket.MORE_SETTINGS_CLICKED : print_preview.Metrics.PrintSettingsUiBucket.LESS_SETTINGS_CLICKED); }, /** * Called when the destination selection has changed. Updates UI elements. * @private */ onDestinationChanged_: function() { this.firstDestinationReady_ = true; this.capabilitiesReady_ = false; this.updateState_(false); }, /** * Called when the destination selection has changed. Updates UI elements. * @private */ onDestinationCapabilitiesReady_: function() { this.capabilitiesReady_ = true; this.updateState_(false); }, /** * Updates the component appearance according to the current state. * @param {boolean} noAnimation Whether section visibility transitions * should not be animated. * @private */ updateState_: function(noAnimation) { if (!this.firstDestinationReady_) { fadeOutElement(this.getElement()); return; } // When capabilities are not known yet, don't change the state to avoid // unnecessary fade in/out cycles. if (!this.capabilitiesReady_) return; var all = this.settingsToShow_ == MoreSettings.SettingsToShow.ALL; this.getChildElement('.more-settings-label').textContent = loadTimeData.getString(all ? 'lessOptionsLabel' : 'moreOptionsLabel'); var iconEl = this.getChildElement('.more-settings-icon'); iconEl.classList.toggle('more-settings-icon-plus', !all); iconEl.classList.toggle('more-settings-icon-minus', all); var availableSections = this.settingsSections_.reduce( function(count, section) { return count + (section.isAvailable() ? 1 : 0); }, 0); // Magic 6 is chosen as the number of sections when it still feels like // manageable and not too crowded. var hasSectionsToToggle = availableSections > 6 && this.settingsSections_.some(function(section) { return section.hasCollapsibleContent(); }); if (hasSectionsToToggle) fadeInElement(this.getElement(), noAnimation); else fadeOutElement(this.getElement()); var collapseContent = this.settingsToShow_ == MoreSettings.SettingsToShow.MOST_POPULAR && hasSectionsToToggle; this.settingsSections_.forEach(function(section) { section.setCollapseContent(collapseContent, noAnimation); }); } }; // Export return { MoreSettings: MoreSettings }; });
mou4e/zirconium
chrome/browser/resources/print_preview/settings/more_settings.js
JavaScript
bsd-3-clause
5,710
/** ****************************************************************************** * @file stm32f4xx_syscfg.c * @author MCD Application Team * @version V1.0.2 * @date 05-March-2012 * @brief This file provides firmware functions to manage the SYSCFG peripheral. * * @verbatim * * =================================================================== * How to use this driver * =================================================================== * * This driver provides functions for: * * 1. Remapping the memory accessible in the code area using SYSCFG_MemoryRemapConfig() * * 2. Manage the EXTI lines connection to the GPIOs using SYSCFG_EXTILineConfig() * * 3. Select the ETHERNET media interface (RMII/RII) using SYSCFG_ETH_MediaInterfaceConfig() * * @note SYSCFG APB clock must be enabled to get write access to SYSCFG registers, * using RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); * * @endverbatim * ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2> * * Licensed under MCD-ST Liberty SW License Agreement V2, (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.st.com/software_license_agreement_liberty_v2 * * 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. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "stm32f4xx_syscfg.h" #include "stm32f4xx_rcc.h" /** @addtogroup STM32F4xx_StdPeriph_Driver * @{ */ /** @defgroup SYSCFG * @brief SYSCFG driver modules * @{ */ /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* ------------ RCC registers bit address in the alias region ----------- */ #define SYSCFG_OFFSET (SYSCFG_BASE - PERIPH_BASE) /* --- PMC Register ---*/ /* Alias word address of MII_RMII_SEL bit */ #define PMC_OFFSET (SYSCFG_OFFSET + 0x04) #define MII_RMII_SEL_BitNumber ((uint8_t)0x17) #define PMC_MII_RMII_SEL_BB (PERIPH_BB_BASE + (PMC_OFFSET * 32) + (MII_RMII_SEL_BitNumber * 4)) /* --- CMPCR Register ---*/ /* Alias word address of CMP_PD bit */ #define CMPCR_OFFSET (SYSCFG_OFFSET + 0x20) #define CMP_PD_BitNumber ((uint8_t)0x00) #define CMPCR_CMP_PD_BB (PERIPH_BB_BASE + (CMPCR_OFFSET * 32) + (CMP_PD_BitNumber * 4)) /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /** @defgroup SYSCFG_Private_Functions * @{ */ /** * @brief Deinitializes the Alternate Functions (remap and EXTI configuration) * registers to their default reset values. * @param None * @retval None */ void SYSCFG_DeInit(void) { RCC_APB2PeriphResetCmd(RCC_APB2Periph_SYSCFG, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_SYSCFG, DISABLE); } /** * @brief Changes the mapping of the specified pin. * @param SYSCFG_Memory: selects the memory remapping. * This parameter can be one of the following values: * @arg SYSCFG_MemoryRemap_Flash: Main Flash memory mapped at 0x00000000 * @arg SYSCFG_MemoryRemap_SystemFlash: System Flash memory mapped at 0x00000000 * @arg SYSCFG_MemoryRemap_FSMC: FSMC (Bank1 (NOR/PSRAM 1 and 2) mapped at 0x00000000 * @arg SYSCFG_MemoryRemap_SRAM: Embedded SRAM (112kB) mapped at 0x00000000 * @retval None */ void SYSCFG_MemoryRemapConfig(uint8_t SYSCFG_MemoryRemap) { /* Check the parameters */ assert_param(IS_SYSCFG_MEMORY_REMAP_CONFING(SYSCFG_MemoryRemap)); SYSCFG->MEMRMP = SYSCFG_MemoryRemap; } /** * @brief Selects the GPIO pin used as EXTI Line. * @param EXTI_PortSourceGPIOx : selects the GPIO port to be used as source for * EXTI lines where x can be (A..I). * @param EXTI_PinSourcex: specifies the EXTI line to be configured. * This parameter can be EXTI_PinSourcex where x can be (0..15, except * for EXTI_PortSourceGPIOI x can be (0..11). * @retval None */ void SYSCFG_EXTILineConfig(uint8_t EXTI_PortSourceGPIOx, uint8_t EXTI_PinSourcex) { uint32_t tmp = 0x00; /* Check the parameters */ assert_param(IS_EXTI_PORT_SOURCE(EXTI_PortSourceGPIOx)); assert_param(IS_EXTI_PIN_SOURCE(EXTI_PinSourcex)); tmp = ((uint32_t)0x0F) << (0x04 * (EXTI_PinSourcex & (uint8_t)0x03)); SYSCFG->EXTICR[EXTI_PinSourcex >> 0x02] &= ~tmp; SYSCFG->EXTICR[EXTI_PinSourcex >> 0x02] |= (((uint32_t)EXTI_PortSourceGPIOx) << (0x04 * (EXTI_PinSourcex & (uint8_t)0x03))); } /** * @brief Selects the ETHERNET media interface * @param SYSCFG_ETH_MediaInterface: specifies the Media Interface mode. * This parameter can be one of the following values: * @arg SYSCFG_ETH_MediaInterface_MII: MII mode selected * @arg SYSCFG_ETH_MediaInterface_RMII: RMII mode selected * @retval None */ void SYSCFG_ETH_MediaInterfaceConfig(uint32_t SYSCFG_ETH_MediaInterface) { assert_param(IS_SYSCFG_ETH_MEDIA_INTERFACE(SYSCFG_ETH_MediaInterface)); /* Configure MII_RMII selection bit */ *(__IO uint32_t *) PMC_MII_RMII_SEL_BB = SYSCFG_ETH_MediaInterface; } /** * @brief Enables or disables the I/O Compensation Cell. * @note The I/O compensation cell can be used only when the device supply * voltage ranges from 2.4 to 3.6 V. * @param NewState: new state of the I/O Compensation Cell. * This parameter can be one of the following values: * @arg ENABLE: I/O compensation cell enabled * @arg DISABLE: I/O compensation cell power-down mode * @retval None */ void SYSCFG_CompensationCellCmd(FunctionalState NewState) { /* Check the parameters */ assert_param(IS_FUNCTIONAL_STATE(NewState)); *(__IO uint32_t *) CMPCR_CMP_PD_BB = (uint32_t)NewState; } /** * @brief Checks whether the I/O Compensation Cell ready flag is set or not. * @param None * @retval The new state of the I/O Compensation Cell ready flag (SET or RESET) */ FlagStatus SYSCFG_GetCompensationCellStatus(void) { FlagStatus bitstatus = RESET; if ((SYSCFG->CMPCR & SYSCFG_CMPCR_READY ) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; } /** * @} */ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
otsaregorodtsev/walkgeek
bsp/3rd_party/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_syscfg.c
C
bsd-3-clause
7,400
'use strict' function formatHostname(hostname) { // canonicalize the hostname, so that 'oogle.com' won't match 'google.com' return hostname.replace(/^\.*/, '.').toLowerCase() } function parseNoProxyZone(zone) { zone = zone.trim().toLowerCase() var zoneParts = zone.split(':', 2) , zoneHost = formatHostname(zoneParts[0]) , zonePort = zoneParts[1] , hasPort = zone.indexOf(':') > -1 return {hostname: zoneHost, port: zonePort, hasPort: hasPort} } function uriInNoProxy(uri, noProxy) { var port = uri.port || (uri.protocol === 'https:' ? '443' : '80') , hostname = formatHostname(uri.hostname) , noProxyList = noProxy.split(',') // iterate through the noProxyList until it finds a match. return noProxyList.map(parseNoProxyZone).some(function(noProxyZone) { var isMatchedAt = hostname.indexOf(noProxyZone.hostname) , hostnameMatched = ( isMatchedAt > -1 && (isMatchedAt === hostname.length - noProxyZone.hostname.length) ) if (noProxyZone.hasPort) { return (port === noProxyZone.port) && hostnameMatched } return hostnameMatched }) } function getProxyFromURI(uri) { // Decide the proper request proxy to use based on the request URI object and the // environmental variables (NO_PROXY, HTTP_PROXY, etc.) // respect NO_PROXY environment variables (see: http://lynx.isc.org/current/breakout/lynx_help/keystrokes/environments.html) var noProxy = process.env.NO_PROXY || process.env.no_proxy || '' // if the noProxy is a wildcard then return null if (noProxy === '*') { return null } // if the noProxy is not empty and the uri is found return null if (noProxy !== '' && uriInNoProxy(uri, noProxy)) { return null } // Check for HTTP or HTTPS Proxy in environment Else default to null if (uri.protocol === 'http:') { return process.env.HTTP_PROXY || process.env.http_proxy || null } if (uri.protocol === 'https:') { return process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy || null } // if none of that works, return null // (What uri protocol are you using then?) return null } module.exports = getProxyFromURI
tudousi/daily
ui/node_modules/request/lib/getProxyFromURI.js
JavaScript
bsd-3-clause
2,268
define( //begin v1.x content { "field-sat-relative+0": "今週の土曜日", "field-sat-relative+1": "来週の土曜日", "field-dayperiod": "午前/午後", "field-sun-relative+-1": "先週の日曜日", "field-mon-relative+-1": "先週の月曜日", "field-minute": "分", "field-day-relative+-1": "昨日", "field-weekday": "曜日", "field-day-relative+-2": "一昨日", "months-standAlone-narrow": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13" ], "field-era": "時代", "field-hour": "時", "field-sun-relative+0": "今週の日曜日", "field-sun-relative+1": "来週の日曜日", "months-standAlone-abbr": [ "トウト", "ババ", "ハトール", "キアック", "トーバ", "アムシール", "バラムハート", "バラモウダ", "バシャンス", "パオーナ", "エペープ", "メスラ", "ナシエ" ], "field-wed-relative+-1": "先週の水曜日", "field-day-relative+0": "今日", "field-day-relative+1": "明日", "field-day-relative+2": "明後日", "field-tue-relative+0": "今週の火曜日", "field-zone": "タイムゾーン", "field-tue-relative+1": "来週の火曜日", "field-week-relative+-1": "先週", "field-year-relative+0": "今年", "field-year-relative+1": "翌年", "field-sat-relative+-1": "先週の土曜日", "field-year-relative+-1": "昨年", "field-year": "年", "field-fri-relative+0": "今週の金曜日", "field-fri-relative+1": "来週の金曜日", "months-standAlone-wide": [ "トウト", "ババ", "ハトール", "キアック", "トーバ", "アムシール", "バラムハート", "バラモウダ", "バシャンス", "パオーナ", "エペープ", "メスラ", "ナシエ" ], "field-week": "週", "field-week-relative+0": "今週", "field-week-relative+1": "翌週", "months-format-abbr": [ "トウト", "ババ", "ハトール", "キアック", "トーバ", "アムシール", "バラムハート", "バラモウダ", "バシャンス", "パオーナ", "エペープ", "メスラ", "ナシエ" ], "field-month-relative+0": "今月", "field-month": "月", "field-month-relative+1": "翌月", "field-fri-relative+-1": "先週の金曜日", "field-second": "秒", "field-tue-relative+-1": "先週の火曜日", "field-day": "日", "months-format-narrow": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13" ], "field-mon-relative+0": "今週の月曜日", "field-mon-relative+1": "来週の月曜日", "field-thu-relative+0": "今週の木曜日", "field-second-relative+0": "今すぐ", "field-thu-relative+1": "来週の木曜日", "months-format-wide": [ "トウト", "ババ", "ハトール", "キアック", "トーバ", "アムシール", "バラムハート", "バラモウダ", "バシャンス", "パオーナ", "エペープ", "メスラ", "ナシエ" ], "field-wed-relative+0": "今週の水曜日", "field-wed-relative+1": "来週の水曜日", "field-month-relative+-1": "先月", "field-thu-relative+-1": "先週の木曜日" } //end v1.x content );
victorynox/TestR
public/scripts/dojo/dojo/cldr/nls/ja/coptic.js
JavaScript
bsd-3-clause
3,183
<?php /* vim: set expandtab sw=4 ts=4 sts=4: */ /** * Produce a PDF report (export) from a query * * @package PhpMyAdmin-Export * @subpackage PDF */ namespace PMA\libraries\plugins\export; use PMA\libraries\plugins\ExportPlugin; use PMA\libraries\properties\plugins\ExportPluginProperties; use PMA\libraries\properties\options\groups\OptionsPropertyMainGroup; use PMA\libraries\properties\options\groups\OptionsPropertyRootGroup; use PMA\libraries\plugins\export\PMA_ExportPdf; use PMA\libraries\properties\options\items\RadioPropertyItem; use PMA\libraries\properties\options\items\TextPropertyItem; /** * Skip the plugin if TCPDF is not available. */ if (!@file_exists(TCPDF_INC)) { $GLOBALS['skip_import'] = true; return; } require_once 'libraries/transformations.lib.php'; /** * Handles the export for the PDF class * * @package PhpMyAdmin-Export * @subpackage PDF */ class ExportPdf extends ExportPlugin { /** * PMA\libraries\plugins\export\PMA_ExportPdf instance * * @var PMA_ExportPdf */ private $_pdf; /** * PDF Report Title * * @var string */ private $_pdfReportTitle; /** * Constructor */ public function __construct() { // initialize the specific export PDF variables $this->initSpecificVariables(); $this->setProperties(); } /** * Initialize the local variables that are used for export PDF * * @return void */ protected function initSpecificVariables() { if (!empty($_POST['pdf_report_title'])) { $this->_setPdfReportTitle($_POST['pdf_report_title']); } $this->_setPdf(new PMA_ExportPdf('L', 'pt', 'A3')); } /** * Sets the export PDF properties * * @return void */ protected function setProperties() { $exportPluginProperties = new ExportPluginProperties(); $exportPluginProperties->setText('PDF'); $exportPluginProperties->setExtension('pdf'); $exportPluginProperties->setMimeType('application/pdf'); $exportPluginProperties->setForceFile(true); $exportPluginProperties->setOptionsText(__('Options')); // create the root group that will be the options field for // $exportPluginProperties // this will be shown as "Format specific options" $exportSpecificOptions = new OptionsPropertyRootGroup( "Format Specific Options" ); // general options main group $generalOptions = new OptionsPropertyMainGroup("general_opts"); // create primary items and add them to the group $leaf = new TextPropertyItem( "report_title", __('Report title:') ); $generalOptions->addProperty($leaf); // add the group to the root group $exportSpecificOptions->addProperty($generalOptions); // what to dump (structure/data/both) main group $dumpWhat = new OptionsPropertyMainGroup( "dump_what", __('Dump table') ); $leaf = new RadioPropertyItem("structure_or_data"); $leaf->setValues( array( 'structure' => __('structure'), 'data' => __('data'), 'structure_and_data' => __('structure and data'), ) ); $dumpWhat->addProperty($leaf); // add the group to the root group $exportSpecificOptions->addProperty($dumpWhat); // set the options for the export plugin property item $exportPluginProperties->setOptions($exportSpecificOptions); $this->properties = $exportPluginProperties; } /** * Outputs export header * * @return bool Whether it succeeded */ public function exportHeader() { $pdf_report_title = $this->_getPdfReportTitle(); $pdf = $this->_getPdf(); $pdf->Open(); $attr = array('titleFontSize' => 18, 'titleText' => $pdf_report_title); $pdf->setAttributes($attr); $pdf->setTopMargin(30); return true; } /** * Outputs export footer * * @return bool Whether it succeeded */ public function exportFooter() { $pdf = $this->_getPdf(); // instead of $pdf->Output(): if (!PMA_exportOutputHandler($pdf->getPDFData())) { return false; } return true; } /** * Outputs database header * * @param string $db Database name * @param string $db_alias Aliases of db * * @return bool Whether it succeeded */ public function exportDBHeader($db, $db_alias = '') { return true; } /** * Outputs database footer * * @param string $db Database name * * @return bool Whether it succeeded */ public function exportDBFooter($db) { return true; } /** * Outputs CREATE DATABASE statement * * @param string $db Database name * @param string $export_type 'server', 'database', 'table' * @param string $db_alias Aliases of db * * @return bool Whether it succeeded */ public function exportDBCreate($db, $export_type, $db_alias = '') { return true; } /** * Outputs the content of a table in NHibernate format * * @param string $db database name * @param string $table table name * @param string $crlf the end of line sequence * @param string $error_url the url to go back in case of error * @param string $sql_query SQL query for obtaining data * @param array $aliases Aliases of db/table/columns * * @return bool Whether it succeeded */ public function exportData( $db, $table, $crlf, $error_url, $sql_query, $aliases = array() ) { $db_alias = $db; $table_alias = $table; $this->initAlias($aliases, $db_alias, $table_alias); $pdf = $this->_getPdf(); $attr = array( 'currentDb' => $db, 'currentTable' => $table, 'dbAlias' => $db_alias, 'tableAlias' => $table_alias, 'aliases' => $aliases, ); $pdf->setAttributes($attr); $pdf->purpose = __('Dumping data'); $pdf->mysqlReport($sql_query); return true; } // end of the 'PMA_exportData()' function /** * Outputs table structure * * @param string $db database name * @param string $table table name * @param string $crlf the end of line sequence * @param string $error_url the url to go back in case of error * @param string $export_mode 'create_table', 'triggers', 'create_view', * 'stand_in' * @param string $export_type 'server', 'database', 'table' * @param bool $do_relation whether to include relation comments * @param bool $do_comments whether to include the pmadb-style column * comments as comments in the structure; * this is deprecated but the parameter is * left here because export.php calls * PMA_exportStructure() also for other * export types which use this parameter * @param bool $do_mime whether to include mime comments * @param bool $dates whether to include creation/update/check dates * @param array $aliases aliases for db/table/columns * * @return bool Whether it succeeded */ public function exportStructure( $db, $table, $crlf, $error_url, $export_mode, $export_type, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $aliases = array() ) { $db_alias = $db; $table_alias = $table; $this->initAlias($aliases, $db_alias, $table_alias); $pdf = $this->_getPdf(); // getting purpose to show at top switch ($export_mode) { case 'create_table': $purpose = __('Table structure'); break; case 'triggers': $purpose = __('Triggers'); break; case 'create_view': $purpose = __('View structure'); break; case 'stand_in': $purpose = __('Stand in'); } // end switch $attr = array( 'currentDb' => $db, 'currentTable' => $table, 'dbAlias' => $db_alias, 'tableAlias' => $table_alias, 'aliases' => $aliases, 'purpose' => $purpose, ); $pdf->setAttributes($attr); /** * comment display set true as presently in pdf * format, no option is present to take user input. */ $do_comments = true; switch ($export_mode) { case 'create_table': $pdf->getTableDef( $db, $table, $do_relation, $do_comments, $do_mime, false, $aliases ); break; case 'triggers': $pdf->getTriggers($db, $table); break; case 'create_view': $pdf->getTableDef( $db, $table, $do_relation, $do_comments, $do_mime, false, $aliases ); break; case 'stand_in': /* export a stand-in definition to resolve view dependencies * Yet to develop this function * $pdf->getTableDefStandIn($db, $table, $crlf); */ } // end switch return true; } /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */ /** * Gets the PMA\libraries\plugins\export\PMA_ExportPdf instance * * @return PMA_ExportPdf */ private function _getPdf() { return $this->_pdf; } /** * Instantiates the PMA\libraries\plugins\export\PMA_ExportPdf class * * @param PMA_ExportPdf $pdf The instance * * @return void */ private function _setPdf($pdf) { $this->_pdf = $pdf; } /** * Gets the PDF report title * * @return string */ private function _getPdfReportTitle() { return $this->_pdfReportTitle; } /** * Sets the PDF report title * * @param string $pdfReportTitle PDF report title * * @return void */ private function _setPdfReportTitle($pdfReportTitle) { $this->_pdfReportTitle = $pdfReportTitle; } }
N-Vitas/logistic
frontend/web/phpMyAdmin/libraries/plugins/export/ExportPdf.php
PHP
bsd-3-clause
10,978
import "../core/functor"; import "../core/source"; import "../core/target"; import "../math/trigonometry"; import "arc"; import "svg"; d3.svg.chord = function() { var source = d3_source, target = d3_target, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle; // TODO Allow control point to be customized. function chord(d, i) { var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i); return "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.r, s.p1, s.r, s.p0) : curve(s.r, s.p1, t.r, t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(t.r, t.p1, s.r, s.p0)) + "Z"; } function subgroup(self, f, d, i) { var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) - halfπ, a1 = endAngle.call(self, subgroup, i) - halfπ; return { r: r, a0: a0, a1: a1, p0: [r * Math.cos(a0), r * Math.sin(a0)], p1: [r * Math.cos(a1), r * Math.sin(a1)] }; } function equals(a, b) { return a.a0 == b.a0 && a.a1 == b.a1; } function arc(r, p, a) { return "A" + r + "," + r + " 0 " + +(a > π) + ",1 " + p; } function curve(r0, p0, r1, p1) { return "Q 0,0 " + p1; } chord.radius = function(v) { if (!arguments.length) return radius; radius = d3_functor(v); return chord; }; chord.source = function(v) { if (!arguments.length) return source; source = d3_functor(v); return chord; }; chord.target = function(v) { if (!arguments.length) return target; target = d3_functor(v); return chord; }; chord.startAngle = function(v) { if (!arguments.length) return startAngle; startAngle = d3_functor(v); return chord; }; chord.endAngle = function(v) { if (!arguments.length) return endAngle; endAngle = d3_functor(v); return chord; }; return chord; }; function d3_svg_chordRadius(d) { return d.radius; }
10000TB/d3
src/svg/chord.js
JavaScript
bsd-3-clause
2,067
# -*- coding: utf-8 -*- from django.conf import settings from jingo import Loader as JingoLoader, Template class Loader(JingoLoader): """Use JINGO_EXCLUDE_PATHS to exclude templates based on their path. jingo.Loader has a JINGO_EXCLUDE_APPS that only allows to provide the "app" part of a template (the part before the first "/"). It doesn't allow avoiding specific templates, for example mail templates that we would like Django's template loader to render. Using this loader, we may use the JINGO_EXCLUDE_PATHS settings to decide whether a template should be rendered by Jingo or not. Example usage: JINGO_EXCLUDE_PATHS = ( 'foo/bar', ) This will exclude all templates starting with 'foo/bar', but not 'foo/baz' nor 'quux/foo/bar'. """ def _valid_template(self, template_name): """Don't load templates if their name start with a prefix from JINGO_EXCLUDE_PATHS.""" if isinstance(template_name, Template): # It's already a Template. return True jingo_valid = super(Loader, self)._valid_template(template_name) if not jingo_valid: return False for path_prefix in getattr(settings, 'JINGO_EXCLUDE_PATHS', []): if path_prefix in template_name: return False return True
jinankjain/zamboni
lib/template_loader.py
Python
bsd-3-clause
1,354