code
stringlengths
3
1.05M
repo_name
stringlengths
4
116
path
stringlengths
4
991
language
stringclasses
9 values
license
stringclasses
15 values
size
int32
3
1.05M
<?php namespace Bolt\Tests\Composer\Action; use Bolt\Composer\Action\BoltExtendJson; use Bolt\Composer\PackageManager; use Bolt\Tests\BoltUnitTest; /** * Class to test src/Composer/Action/BoltExtendJson. * * @author Ross Riley <riley.ross@gmail.com> */ class BoltExtendJsonTest extends BoltUnitTest { public $options; public function setup() { $app = $this->getApp(); $this->options = array( 'basedir' => $app['resources']->getPath('extensions'), 'composerjson' => $app['resources']->getPath('extensions') . '/composer.json', ); } public function testConstruct() { $action = new BoltExtendJson($this->options); $this->assertArrayHasKey('basedir', \PHPUnit_Framework_Assert::readAttribute($action, 'options')); $this->assertArrayHasKey('composerjson', \PHPUnit_Framework_Assert::readAttribute($action, 'options')); } public function testWrite() { $app = $this->getApp(); @unlink($app['resources']->getPath('extensions') . '/composer.json'); $manager = new PackageManager($app); $action = new BoltExtendJson($manager->getOptions()); $action->updateJson($app); } public function testExecute() { $action = new BoltExtendJson($this->options); $action->execute($this->options['composerjson'], array('extra' => array('bolt-test' => true))); } }
GDmac/bolt
tests/phpunit/unit/Composer/Action/BoltExtendJsonTest.php
PHP
mit
1,475
using UnityEngine; using System; using LuaInterface; using SLua; using System.Collections.Generic; public class Lua_UnityEngine_UI_Toggle : LuaObject { [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int Rebuild(IntPtr l) { try { UnityEngine.UI.Toggle self=(UnityEngine.UI.Toggle)checkSelf(l); UnityEngine.UI.CanvasUpdate a1; checkEnum(l,2,out a1); self.Rebuild(a1); return 0; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int OnPointerClick(IntPtr l) { try { UnityEngine.UI.Toggle self=(UnityEngine.UI.Toggle)checkSelf(l); UnityEngine.EventSystems.PointerEventData a1; checkType(l,2,out a1); self.OnPointerClick(a1); return 0; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int OnSubmit(IntPtr l) { try { UnityEngine.UI.Toggle self=(UnityEngine.UI.Toggle)checkSelf(l); UnityEngine.EventSystems.BaseEventData a1; checkType(l,2,out a1); self.OnSubmit(a1); return 0; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int get_toggleTransition(IntPtr l) { try { UnityEngine.UI.Toggle self=(UnityEngine.UI.Toggle)checkSelf(l); pushEnum(l,(int)self.toggleTransition); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int set_toggleTransition(IntPtr l) { try { UnityEngine.UI.Toggle self=(UnityEngine.UI.Toggle)checkSelf(l); UnityEngine.UI.Toggle.ToggleTransition v; checkEnum(l,2,out v); self.toggleTransition=v; return 0; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int get_graphic(IntPtr l) { try { UnityEngine.UI.Toggle self=(UnityEngine.UI.Toggle)checkSelf(l); pushValue(l,self.graphic); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int set_graphic(IntPtr l) { try { UnityEngine.UI.Toggle self=(UnityEngine.UI.Toggle)checkSelf(l); UnityEngine.UI.Graphic v; checkType(l,2,out v); self.graphic=v; return 0; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int get_onValueChanged(IntPtr l) { try { UnityEngine.UI.Toggle self=(UnityEngine.UI.Toggle)checkSelf(l); pushValue(l,self.onValueChanged); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int set_onValueChanged(IntPtr l) { try { UnityEngine.UI.Toggle self=(UnityEngine.UI.Toggle)checkSelf(l); UnityEngine.UI.Toggle.ToggleEvent v; checkType(l,2,out v); self.onValueChanged=v; return 0; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int get_group(IntPtr l) { try { UnityEngine.UI.Toggle self=(UnityEngine.UI.Toggle)checkSelf(l); pushValue(l,self.group); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int set_group(IntPtr l) { try { UnityEngine.UI.Toggle self=(UnityEngine.UI.Toggle)checkSelf(l); UnityEngine.UI.ToggleGroup v; checkType(l,2,out v); self.group=v; return 0; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int get_isOn(IntPtr l) { try { UnityEngine.UI.Toggle self=(UnityEngine.UI.Toggle)checkSelf(l); pushValue(l,self.isOn); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int set_isOn(IntPtr l) { try { UnityEngine.UI.Toggle self=(UnityEngine.UI.Toggle)checkSelf(l); bool v; checkType(l,2,out v); self.isOn=v; return 0; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } static public void reg(IntPtr l) { getTypeTable(l,"UnityEngine.UI.Toggle"); addMember(l,Rebuild); addMember(l,OnPointerClick); addMember(l,OnSubmit); addMember(l,"toggleTransition",get_toggleTransition,set_toggleTransition,true); addMember(l,"graphic",get_graphic,set_graphic,true); addMember(l,"onValueChanged",get_onValueChanged,set_onValueChanged,true); addMember(l,"group",get_group,set_group,true); addMember(l,"isOn",get_isOn,set_isOn,true); createTypeMetatable(l,null, typeof(UnityEngine.UI.Toggle),typeof(UnityEngine.UI.Selectable)); } }
LunaFramework/Luna
luna/Assets/LuaObject/Unity/Lua_UnityEngine_UI_Toggle.cs
C#
mit
5,110
require 'spec_helper' describe SCSSLint::Linter::MergeableSelector do context 'when single root' do let(:scss) { <<-SCSS } p { } SCSS it { should_not report_lint } end context 'when different roots' do let(:scss) { <<-SCSS } p { background: #000; margin: 5px; } a { background: #000; margin: 5px; } SCSS it { should_not report_lint } end context 'when different roots with matching inner rules' do let(:scss) { <<-SCSS } p { background: #000; margin: 5px; .foo { color: red; } } a { background: #000; margin: 5px; .foo { color: red; } } SCSS it { should_not report_lint } end context 'when multi-selector roots and parital rule match' do let(:scss) { <<-SCSS } p, a { background: #000; margin: 5px; .foo { color: red; } } a { background: #000; margin: 5px; .foo { color: red; } } SCSS it { should_not report_lint } end context 'when nested and unnested selectors match' do let(:scss) { <<-SCSS } a.current { background: #000; margin: 5px; .foo { color: red; } } a { &.current { background: #000; margin: 5px; .foo { color: red; } } } SCSS context 'when force_nesting is enabled' do let(:linter_config) { { 'force_nesting' => true } } it { should report_lint } end context 'when force_nesting is disabled' do let(:linter_config) { { 'force_nesting' => false } } it { should_not report_lint } end end context 'when same class roots' do let(:scss) { <<-SCSS } .warn { font-weight: bold; } .warn { color: #f00; @extend .warn; a { color: #ccc; } } SCSS it { should report_lint } end context 'when same compond selector roots' do let(:scss) { <<-SCSS } .warn .alert { font-weight: bold; } .warn .alert { color: #f00; @extend .warn; a { color: #ccc; } } SCSS it { should report_lint } end context 'when same class roots separated by another class' do let(:scss) { <<-SCSS } .warn { font-weight: bold; } .foo { color: red; } .warn { color: #f00; @extend .warn; a { color: #ccc; } } SCSS it { should report_lint } end context 'when rule in a mixin @include matches a root root' do let(:scss) { <<-SCSS } p { font-weight: bold; } @include enhance(small-tablet) { p { font-weight: normal; } } SCSS it { should_not report_lint } end context 'when rule in a mixin definition matches a root rule' do let(:scss) { <<-SCSS } p { font-weight: bold; } @mixin my-mixin { p { font-weight: normal; } } SCSS it { should_not report_lint } end context 'when rule in a media directive matches a root rule' do let(:scss) { <<-SCSS } p { font-weight: bold; } @media only screen and (min-device-pixel-ratio: 1.5) { p { font-weight: normal; } } SCSS it { should_not report_lint } end context 'when rule in a keyframes directive matches a root rule' do let(:scss) { <<-SCSS } @keyframes slideouttoleft { from { transform: translateX(0); } to { transform: translateX(-100%); } } @keyframes slideouttoright { from { transform: translateX(0); } to { transform: translateX(100%); } } SCSS it { should_not report_lint } end context 'when there are duplicate rules nested in a rule set' do let(:scss) { <<-SCSS } .foo { .bar { font-weight: bold; } .baz { font-weight: bold; } .bar { color: #ff0; } } SCSS it { should report_lint } end context 'when there are two parent selectors in a single selector' do let(:scss) { <<-SCSS } .b-some { &__image { width: 100%; } &__image + &__buttons { margin-top: 14px; } } SCSS it { should_not report_lint } end context 'when force_nesting is enabled' do let(:linter_config) { { 'force_nesting' => true } } context 'when one of the duplicate rules is in a comma sequence' do let(:scss) { <<-SCSS } .foo, .bar { color: #000; } .foo { color: #f00; } SCSS it { should_not report_lint } end context 'when rules start with the same prefix but are not the same' do let(:scss) { <<-SCSS } .foo { color: #000; } .foobar { color: #f00; } SCSS it { should_not report_lint } end context 'when a rule contains interpolation' do let(:scss) { <<-SCSS } .\#{$class-name} {} .foobar {} SCSS it { should_not report_lint } end end context 'when a whitelist list is defined' do let(:linter_config) { { 'whitelist' => ['polyfill-rule'] } } context 'when a rule is found in the whitelist' do let(:scss) { <<-SCSS } polyfill-rule { content: '.foo'; color: red; } polyfill-rule { content: '.foo'; color: red; } SCSS it { should_not report_lint } end context 'when a rule is not found in the whitelist' do let(:scss) { <<-SCSS } .foo polyfill-rule { content: '.foo'; color: red; } .foo polyfill-rule { content: '.foo'; color: red; } SCSS it { should report_lint } end end context 'when a single whitelist selector is defined' do let(:linter_config) { { 'whitelist' => 'polyfill-rule' } } context 'when a rule is found in the whitelist' do let(:scss) { <<-SCSS } polyfill-rule { content: '.foo'; color: red; } polyfill-rule { content: '.foo'; color: red; } SCSS it { should_not report_lint } end context 'when a rule is not found in the whitelist' do let(:scss) { <<-SCSS } .foo polyfill-rule { content: '.foo'; color: red; } .foo polyfill-rule { content: '.foo'; color: red; } SCSS it { should report_lint } end end end
teoljungberg/scss-lint
spec/scss_lint/linter/mergeable_selector_spec.rb
Ruby
mit
6,820
<?php /** * StatusRepository. * * @author Katsuhiro Ogawa <fivestar@nequal.jp> */ class StatusRepository extends DbRepository { public function insert($user_id, $body) { $now = new DateTime(); $sql = " INSERT INTO status(user_id, body, created_at) VALUES(:user_id, :body, :created_at) "; $stmt = $this->execute($sql, array( ':user_id' => $user_id, ':body' => $body, ':created_at' => $now->format('Y-m-d H:i:s'), )); } public function fetchAllPersonalArchivesByUserId($user_id) { $sql = " SELECT a.*, u.user_name FROM status a LEFT JOIN user u ON a.user_id = u.id LEFT JOIN following f ON f.following_id = a.user_id AND f.user_id = :user_id WHERE f.user_id = :user_id OR u.id = :user_id ORDER BY a.created_at DESC "; return $this->fetchAll($sql, array(':user_id' => $user_id)); } public function fetchAllByUserId($user_id) { $sql = " SELECT a.*, u.user_name FROM status a LEFT JOIN user u ON a.user_id = u.id WHERE u.id = :user_id ORDER BY a.created_at DESC "; return $this->fetchAll($sql, array(':user_id' => $user_id)); } public function fetchByIdAndUserName($id, $user_name) { $sql = " SELECT a.* , u.user_name FROM status a LEFT JOIN user u ON u.id = a.user_id WHERE a.id = :id AND u.user_name = :user_name "; return $this->fetch($sql, array( ':id' => $id, ':user_name' => $user_name, )); } }
titoro/soccerviewproj
models/StatusRepository.php
PHP
mit
1,853
/* Copyright (C) 2009 Volker Berlin (vberlin@inetsoftware.de) This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Jeroen Frijters jeroen@frijters.net */ using System; using System.Collections.Generic; using System.Text; using System.IO; namespace ikvm.debugger { class DebuggerUtils { /// <summary> /// Read the buffer full. /// </summary> /// <param name="stream">the stream to read</param> /// <param name="buffer">the buffer that should be fill</param> /// <exception cref="IOException"> /// If the stream ends. /// </exception> internal static void ReadFully(Stream stream, byte[] buffer) { int offset = 0; int needed = buffer.Length; while (needed > 0) { int count = stream.Read(buffer, offset, needed - offset); if (count == 0) { throw new IOException("protocol error - premature EOF"); } needed -= count; offset += count; } } /// <summary> /// Convert a JNI signature of the class (for example, "Ljava/lang/String;"). /// </summary> /// <param name="jniName"></param> /// <returns></returns> internal static String ConvertJniClassName(String jniName) { String name = jniName.Substring(1, jniName.Length-2).Replace('/', '.'); return name; } } }
swi-to-yap/swicli
src/Debugger.Core.JDWP/Debugger.Core/JDWP/DebuggerUtils.cs
C#
cc0-1.0
2,325
# # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2002-2006 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # gen.filters.rules/Place/_HasNoLatOrLon.py #------------------------------------------------------------------------- # # Standard Python modules # #------------------------------------------------------------------------- from ....const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext #------------------------------------------------------------------------- # # Gramps modules # #------------------------------------------------------------------------- from .. import Rule #------------------------------------------------------------------------- # # HasNoLatOrLon # #------------------------------------------------------------------------- class HasNoLatOrLon(Rule): """Rule that checks if Latitude or Longitude are not given""" labels = [] name = _('Places with no latitude or longitude given') description = _("Matches places with empty latitude or longitude") category = _('Position filters') def apply(self,db,place): if place.get_latitude().strip and place.get_longitude().strip(): return False return True
sam-m888/gramps
gramps/gen/filters/rules/place/_hasnolatorlon.py
Python
gpl-2.0
1,902
/* * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. * */ #include "precompiled.hpp" #include "classfile/systemDictionary.hpp" #include "code/codeCache.hpp" #include "code/icBuffer.hpp" #include "code/nmethod.hpp" #include "code/vtableStubs.hpp" #include "compiler/compileBroker.hpp" #include "compiler/disassembler.hpp" #include "gc_implementation/shared/markSweep.hpp" #include "gc_interface/collectedHeap.hpp" #include "interpreter/bytecodeHistogram.hpp" #include "interpreter/interpreter.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" #include "oops/oop.inline.hpp" #include "prims/privilegedStack.hpp" #include "runtime/arguments.hpp" #include "runtime/frame.hpp" #include "runtime/java.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/stubCodeGenerator.hpp" #include "runtime/stubRoutines.hpp" #include "runtime/thread.inline.hpp" #include "runtime/vframe.hpp" #include "services/heapDumper.hpp" #include "utilities/defaultStream.hpp" #include "utilities/events.hpp" #include "utilities/top.hpp" #include "utilities/vmError.hpp" #ifdef TARGET_OS_FAMILY_linux # include "os_linux.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_solaris # include "os_solaris.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_windows # include "os_windows.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_bsd # include "os_bsd.inline.hpp" #endif #ifndef ASSERT # ifdef _DEBUG // NOTE: don't turn the lines below into a comment -- if you're getting // a compile error here, change the settings to define ASSERT ASSERT should be defined when _DEBUG is defined. It is not intended to be used for debugging functions that do not slow down the system too much and thus can be left in optimized code. On the other hand, the code should not be included in a production version. # endif // _DEBUG #endif // ASSERT #ifdef _DEBUG # ifndef ASSERT configuration error: ASSERT must be defined in debug version # endif // ASSERT #endif // _DEBUG #ifdef PRODUCT # if -defined _DEBUG || -defined ASSERT configuration error: ASSERT et al. must not be defined in PRODUCT version # endif #endif // PRODUCT PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC FormatBufferResource::FormatBufferResource(const char * format, ...) : FormatBufferBase((char*)resource_allocate_bytes(RES_BUFSZ)) { va_list argp; va_start(argp, format); jio_vsnprintf(_buf, RES_BUFSZ, format, argp); va_end(argp); } ATTRIBUTE_PRINTF(1, 2) void warning(const char* format, ...) { if (PrintWarnings) { FILE* const err = defaultStream::error_stream(); jio_fprintf(err, "%s warning: ", VM_Version::vm_name()); va_list ap; va_start(ap, format); vfprintf(err, format, ap); va_end(ap); fputc('\n', err); } if (BreakAtWarning) BREAKPOINT; } #ifndef PRODUCT #define is_token_break(ch) (isspace(ch) || (ch) == ',') static const char* last_file_name = NULL; static int last_line_no = -1; // assert/guarantee/... may happen very early during VM initialization. // Don't rely on anything that is initialized by Threads::create_vm(). For // example, don't use tty. bool error_is_suppressed(const char* file_name, int line_no) { // The following 1-element cache requires that passed-in // file names are always only constant literals. if (file_name == last_file_name && line_no == last_line_no) return true; int file_name_len = (int)strlen(file_name); char separator = os::file_separator()[0]; const char* base_name = strrchr(file_name, separator); if (base_name == NULL) base_name = file_name; // scan the SuppressErrorAt option const char* cp = SuppressErrorAt; for (;;) { const char* sfile; int sfile_len; int sline; bool noisy; while ((*cp) != '\0' && is_token_break(*cp)) cp++; if ((*cp) == '\0') break; sfile = cp; while ((*cp) != '\0' && !is_token_break(*cp) && (*cp) != ':') cp++; sfile_len = cp - sfile; if ((*cp) == ':') cp++; sline = 0; while ((*cp) != '\0' && isdigit(*cp)) { sline *= 10; sline += (*cp) - '0'; cp++; } // "file:line!" means the assert suppression is not silent noisy = ((*cp) == '!'); while ((*cp) != '\0' && !is_token_break(*cp)) cp++; // match the line if (sline != 0) { if (sline != line_no) continue; } // match the file if (sfile_len > 0) { const char* look = file_name; const char* look_max = file_name + file_name_len - sfile_len; const char* foundp; bool match = false; while (!match && (foundp = strchr(look, sfile[0])) != NULL && foundp <= look_max) { match = true; for (int i = 1; i < sfile_len; i++) { if (sfile[i] != foundp[i]) { match = false; break; } } look = foundp + 1; } if (!match) continue; } // got a match! if (noisy) { fdStream out(defaultStream::output_fd()); out.print_raw("[error suppressed at "); out.print_raw(base_name); char buf[16]; jio_snprintf(buf, sizeof(buf), ":%d]", line_no); out.print_raw_cr(buf); } else { // update 1-element cache for fast silent matches last_file_name = file_name; last_line_no = line_no; } return true; } if (!is_error_reported()) { // print a friendly hint: fdStream out(defaultStream::output_fd()); out.print_raw_cr("# To suppress the following error report, specify this argument"); out.print_raw ("# after -XX: or in .hotspotrc: SuppressErrorAt="); out.print_raw (base_name); char buf[16]; jio_snprintf(buf, sizeof(buf), ":%d", line_no); out.print_raw_cr(buf); } return false; } #undef is_token_break #else // Place-holder for non-existent suppression check: #define error_is_suppressed(file_name, line_no) (false) #endif // !PRODUCT void report_vm_error(const char* file, int line, const char* error_msg, const char* detail_msg) { if (Debugging || error_is_suppressed(file, line)) return; Thread* const thread = ThreadLocalStorage::get_thread_slow(); VMError err(thread, file, line, error_msg, detail_msg); err.report_and_die(); } void report_fatal(const char* file, int line, const char* message) { report_vm_error(file, line, "fatal error", message); } void report_vm_out_of_memory(const char* file, int line, size_t size, VMErrorType vm_err_type, const char* message) { if (Debugging) return; Thread* thread = ThreadLocalStorage::get_thread_slow(); VMError(thread, file, line, size, vm_err_type, message).report_and_die(); // The UseOSErrorReporting option in report_and_die() may allow a return // to here. If so then we'll have to figure out how to handle it. guarantee(false, "report_and_die() should not return here"); } void report_should_not_call(const char* file, int line) { report_vm_error(file, line, "ShouldNotCall()"); } void report_should_not_reach_here(const char* file, int line) { report_vm_error(file, line, "ShouldNotReachHere()"); } void report_unimplemented(const char* file, int line) { report_vm_error(file, line, "Unimplemented()"); } void report_untested(const char* file, int line, const char* message) { #ifndef PRODUCT warning("Untested: %s in %s: %d\n", message, file, line); #endif // !PRODUCT } void report_out_of_shared_space(SharedSpaceType shared_space) { static const char* name[] = { "native memory for metadata", "shared read only space", "shared read write space", "shared miscellaneous data space", "shared miscellaneous code space" }; static const char* flag[] = { "Metaspace", "SharedReadOnlySize", "SharedReadWriteSize", "SharedMiscDataSize", "SharedMiscCodeSize" }; warning("\nThe %s is not large enough\n" "to preload requested classes. Use -XX:%s=<size>\n" "to increase the initial size of %s.\n", name[shared_space], flag[shared_space], name[shared_space]); exit(2); } void report_java_out_of_memory(const char* message) { static jint out_of_memory_reported = 0; // A number of threads may attempt to report OutOfMemoryError at around the // same time. To avoid dumping the heap or executing the data collection // commands multiple times we just do it once when the first threads reports // the error. if (Atomic::cmpxchg(1, &out_of_memory_reported, 0) == 0) { // create heap dump before OnOutOfMemoryError commands are executed if (HeapDumpOnOutOfMemoryError) { tty->print_cr("java.lang.OutOfMemoryError: %s", message); HeapDumper::dump_heap_from_oome(); } if (OnOutOfMemoryError && OnOutOfMemoryError[0]) { VMError err(message); err.report_java_out_of_memory(); } if (CrashOnOutOfMemoryError) { tty->print_cr("Aborting due to java.lang.OutOfMemoryError: %s", message); fatal(err_msg("OutOfMemory encountered: %s", message)); } if (ExitOnOutOfMemoryError) { tty->print_cr("Terminating due to java.lang.OutOfMemoryError: %s", message); exit(3); } } } static bool error_reported = false; // call this when the VM is dying--it might loosen some asserts void set_error_reported() { error_reported = true; } bool is_error_reported() { return error_reported; } #ifndef PRODUCT #include <signal.h> void test_error_handler() { uintx test_num = ErrorHandlerTest; if (test_num == 0) return; // If asserts are disabled, use the corresponding guarantee instead. size_t n = test_num; NOT_DEBUG(if (n <= 2) n += 2); const char* const str = "hello"; const size_t num = (size_t)os::vm_page_size(); const char* const eol = os::line_separator(); const char* const msg = "this message should be truncated during formatting"; char * const dataPtr = NULL; // bad data pointer const void (*funcPtr)(void) = (const void(*)()) 0xF; // bad function pointer // Keep this in sync with test/runtime/6888954/vmerrors.sh. switch (n) { case 1: assert(str == NULL, "expected null"); case 2: assert(num == 1023 && *str == 'X', err_msg("num=" SIZE_FORMAT " str=\"%s\"", num, str)); case 3: guarantee(str == NULL, "expected null"); case 4: guarantee(num == 1023 && *str == 'X', err_msg("num=" SIZE_FORMAT " str=\"%s\"", num, str)); case 5: fatal("expected null"); case 6: fatal(err_msg("num=" SIZE_FORMAT " str=\"%s\"", num, str)); case 7: fatal(err_msg("%s%s# %s%s# %s%s# %s%s# %s%s# " "%s%s# %s%s# %s%s# %s%s# %s%s# " "%s%s# %s%s# %s%s# %s%s# %s", msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, msg)); case 8: vm_exit_out_of_memory(num, OOM_MALLOC_ERROR, "ChunkPool::allocate"); case 9: ShouldNotCallThis(); case 10: ShouldNotReachHere(); case 11: Unimplemented(); // There's no guarantee the bad data pointer will crash us // so "break" out to the ShouldNotReachHere(). case 12: *dataPtr = '\0'; break; // There's no guarantee the bad function pointer will crash us // so "break" out to the ShouldNotReachHere(). case 13: (*funcPtr)(); break; default: tty->print_cr("ERROR: %d: unexpected test_num value.", n); } ShouldNotReachHere(); } #endif // !PRODUCT // ------ helper functions for debugging go here ------------ // All debug entries should be wrapped with a stack allocated // Command object. It makes sure a resource mark is set and // flushes the logfile to prevent file sharing problems. class Command : public StackObj { private: ResourceMark rm; ResetNoHandleMark rnhm; HandleMark hm; bool debug_save; public: static int level; Command(const char* str) { debug_save = Debugging; Debugging = true; if (level++ > 0) return; tty->cr(); tty->print_cr("\"Executing %s\"", str); } ~Command() { tty->flush(); Debugging = debug_save; level--; } }; int Command::level = 0; #ifndef PRODUCT extern "C" void blob(CodeBlob* cb) { Command c("blob"); cb->print(); } extern "C" void dump_vtable(address p) { Command c("dump_vtable"); Klass* k = (Klass*)p; InstanceKlass::cast(k)->vtable()->print(); } extern "C" void nm(intptr_t p) { // Actually we look through all CodeBlobs (the nm name has been kept for backwards compatability) Command c("nm"); CodeBlob* cb = CodeCache::find_blob((address)p); if (cb == NULL) { tty->print_cr("NULL"); } else { cb->print(); } } extern "C" void disnm(intptr_t p) { Command c("disnm"); CodeBlob* cb = CodeCache::find_blob((address) p); nmethod* nm = cb->as_nmethod_or_null(); if (nm) { nm->print(); Disassembler::decode(nm); } else { cb->print(); Disassembler::decode(cb); } } extern "C" void printnm(intptr_t p) { char buffer[256]; sprintf(buffer, "printnm: " INTPTR_FORMAT, p); Command c(buffer); CodeBlob* cb = CodeCache::find_blob((address) p); if (cb->is_nmethod()) { nmethod* nm = (nmethod*)cb; nm->print_nmethod(true); } } extern "C" void universe() { Command c("universe"); Universe::print(); } extern "C" void verify() { // try to run a verify on the entire system // note: this may not be safe if we're not at a safepoint; for debugging, // this manipulates the safepoint settings to avoid assertion failures Command c("universe verify"); bool safe = SafepointSynchronize::is_at_safepoint(); if (!safe) { tty->print_cr("warning: not at safepoint -- verify may fail"); SafepointSynchronize::set_is_at_safepoint(); } // Ensure Eden top is correct before verification Universe::heap()->prepare_for_verify(); Universe::verify(); if (!safe) SafepointSynchronize::set_is_not_at_safepoint(); } extern "C" void pp(void* p) { Command c("pp"); FlagSetting fl(PrintVMMessages, true); FlagSetting f2(DisplayVMOutput, true); if (Universe::heap()->is_in(p)) { oop obj = oop(p); obj->print(); } else { tty->print(PTR_FORMAT, p); } } // pv: print vm-printable object extern "C" void pa(intptr_t p) { ((AllocatedObj*) p)->print(); } extern "C" void findpc(intptr_t x); #endif // !PRODUCT extern "C" void ps() { // print stack if (Thread::current() == NULL) return; Command c("ps"); // Prints the stack of the current Java thread JavaThread* p = JavaThread::active(); tty->print(" for thread: "); p->print(); tty->cr(); if (p->has_last_Java_frame()) { // If the last_Java_fp is set we are in C land and // can call the standard stack_trace function. #ifdef PRODUCT p->print_stack(); } else { tty->print_cr("Cannot find the last Java frame, printing stack disabled."); #else // !PRODUCT p->trace_stack(); } else { frame f = os::current_frame(); RegisterMap reg_map(p); f = f.sender(&reg_map); tty->print("(guessing starting frame id=%#p based on current fp)\n", f.id()); p->trace_stack_from(vframe::new_vframe(&f, &reg_map, p)); pd_ps(f); #endif // PRODUCT } } extern "C" void pfl() { // print frame layout Command c("pfl"); JavaThread* p = JavaThread::active(); tty->print(" for thread: "); p->print(); tty->cr(); if (p->has_last_Java_frame()) { p->print_frame_layout(); } } #ifndef PRODUCT extern "C" void psf() { // print stack frames { Command c("psf"); JavaThread* p = JavaThread::active(); tty->print(" for thread: "); p->print(); tty->cr(); if (p->has_last_Java_frame()) { p->trace_frames(); } } } extern "C" void threads() { Command c("threads"); Threads::print(false, true); } extern "C" void psd() { Command c("psd"); SystemDictionary::print(); } extern "C" void safepoints() { Command c("safepoints"); SafepointSynchronize::print_state(); } #endif // !PRODUCT extern "C" void pss() { // print all stacks if (Thread::current() == NULL) return; Command c("pss"); Threads::print(true, PRODUCT_ONLY(false) NOT_PRODUCT(true)); } #ifndef PRODUCT extern "C" void debug() { // to set things up for compiler debugging Command c("debug"); WizardMode = true; PrintVMMessages = PrintCompilation = true; PrintInlining = PrintAssembly = true; tty->flush(); } extern "C" void ndebug() { // undo debug() Command c("ndebug"); PrintCompilation = false; PrintInlining = PrintAssembly = false; tty->flush(); } extern "C" void flush() { Command c("flush"); tty->flush(); } extern "C" void events() { Command c("events"); Events::print(); } extern "C" Method* findm(intptr_t pc) { Command c("findm"); nmethod* nm = CodeCache::find_nmethod((address)pc); return (nm == NULL) ? (Method*)NULL : nm->method(); } extern "C" nmethod* findnm(intptr_t addr) { Command c("findnm"); return CodeCache::find_nmethod((address)addr); } // Another interface that isn't ambiguous in dbx. // Can we someday rename the other find to hsfind? extern "C" void hsfind(intptr_t x) { Command c("hsfind"); os::print_location(tty, x, false); } extern "C" void find(intptr_t x) { Command c("find"); os::print_location(tty, x, false); } extern "C" void findpc(intptr_t x) { Command c("findpc"); os::print_location(tty, x, true); } // Need method pointer to find bcp, when not in permgen. extern "C" void findbcp(intptr_t method, intptr_t bcp) { Command c("findbcp"); Method* mh = (Method*)method; if (!mh->is_native()) { tty->print_cr("bci_from(%p) = %d; print_codes():", mh, mh->bci_from(address(bcp))); mh->print_codes_on(tty); } } // int versions of all methods to avoid having to type type casts in the debugger void pp(intptr_t p) { pp((void*)p); } void pp(oop p) { pp((void*)p); } void help() { Command c("help"); tty->print_cr("basic"); tty->print_cr(" pp(void* p) - try to make sense of p"); tty->print_cr(" pv(intptr_t p)- ((PrintableResourceObj*) p)->print()"); tty->print_cr(" ps() - print current thread stack"); tty->print_cr(" pss() - print all thread stacks"); tty->print_cr(" pm(int pc) - print Method* given compiled PC"); tty->print_cr(" findm(intptr_t pc) - finds Method*"); tty->print_cr(" find(intptr_t x) - finds & prints nmethod/stub/bytecode/oop based on pointer into it"); tty->print_cr(" pns(void* sp, void* fp, void* pc) - print native (i.e. mixed) stack trace. E.g."); tty->print_cr(" pns($sp, $rbp, $pc) on Linux/amd64 and Solaris/amd64 or"); tty->print_cr(" pns($sp, $ebp, $pc) on Linux/x86 or"); tty->print_cr(" pns($sp, 0, $pc) on Linux/ppc64 or"); tty->print_cr(" pns($sp + 0x7ff, 0, $pc) on Solaris/SPARC"); tty->print_cr(" - in gdb do 'set overload-resolution off' before calling pns()"); tty->print_cr(" - in dbx do 'frame 1' before calling pns()"); tty->print_cr("misc."); tty->print_cr(" flush() - flushes the log file"); tty->print_cr(" events() - dump events from ring buffers"); tty->print_cr("compiler debugging"); tty->print_cr(" debug() - to set things up for compiler debugging"); tty->print_cr(" ndebug() - undo debug"); } #endif // !PRODUCT void print_native_stack(outputStream* st, frame fr, Thread* t, char* buf, int buf_size) { // see if it's a valid frame if (fr.pc()) { st->print_cr("Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)"); int count = 0; while (count++ < StackPrintLimit) { fr.print_on_error(st, buf, buf_size); st->cr(); // Compiled code may use EBP register on x86 so it looks like // non-walkable C frame. Use frame.sender() for java frames. if (t && t->is_Java_thread()) { // Catch very first native frame by using stack address. // For JavaThread stack_base and stack_size should be set. if (!t->on_local_stack((address)(fr.real_fp() + 1))) { break; } if (fr.is_java_frame() || fr.is_native_frame() || fr.is_runtime_frame()) { RegisterMap map((JavaThread*)t, false); // No update fr = fr.sender(&map); } else { fr = os::get_sender_for_C_frame(&fr); } } else { // is_first_C_frame() does only simple checks for frame pointer, // it will pass if java compiled code has a pointer in EBP. if (os::is_first_C_frame(&fr)) break; fr = os::get_sender_for_C_frame(&fr); } } if (count > StackPrintLimit) { st->print_cr("...<more frames>..."); } st->cr(); } } #ifndef PRODUCT extern "C" void pns(void* sp, void* fp, void* pc) { // print native stack Command c("pns"); static char buf[O_BUFLEN]; Thread* t = ThreadLocalStorage::get_thread_slow(); // Call generic frame constructor (certain arguments may be ignored) frame fr(sp, fp, pc); print_native_stack(tty, fr, t, buf, sizeof(buf)); } #endif // !PRODUCT
lizhekang/TCJDK
sources/openjdk8/hotspot/src/share/vm/utilities/debug.cpp
C++
gpl-2.0
22,254
# -*- coding: utf-8 -*- # ****************************************************************************** # # Copyright (C) 2008-2010 Olivier Tilloy <olivier@tilloy.net> # # This file is part of the pyexiv2 distribution. # # pyexiv2 is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # pyexiv2 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 pyexiv2; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. # # Author: Olivier Tilloy <olivier@tilloy.net> # # ****************************************************************************** import unittest from pyexiv2.utils import Rational class TestRational(unittest.TestCase): def test_constructor(self): r = Rational(2, 1) self.assertEqual(r.numerator, 2) self.assertEqual(r.denominator, 1) self.assertRaises(ZeroDivisionError, Rational, 1, 0) def test_read_only(self): r = Rational(3, 4) try: r.numerator = 5 except AttributeError: pass else: self.fail('Numerator is not read-only.') try: r.denominator = 5 except AttributeError: pass else: self.fail('Denominator is not read-only.') def test_match_string(self): self.assertEqual(Rational.match_string('4/3'), (4, 3)) self.assertEqual(Rational.match_string('-4/3'), (-4, 3)) self.assertEqual(Rational.match_string('0/3'), (0, 3)) self.assertEqual(Rational.match_string('0/0'), (0, 0)) self.assertRaises(ValueError, Rational.match_string, '+3/5') self.assertRaises(ValueError, Rational.match_string, '3 / 5') self.assertRaises(ValueError, Rational.match_string, '3/-5') self.assertRaises(ValueError, Rational.match_string, 'invalid') def test_from_string(self): self.assertEqual(Rational.from_string('4/3'), Rational(4, 3)) self.assertEqual(Rational.from_string('-4/3'), Rational(-4, 3)) self.assertRaises(ValueError, Rational.from_string, '+3/5') self.assertRaises(ValueError, Rational.from_string, '3 / 5') self.assertRaises(ValueError, Rational.from_string, '3/-5') self.assertRaises(ValueError, Rational.from_string, 'invalid') self.assertRaises(ZeroDivisionError, Rational.from_string, '1/0') self.assertRaises(ZeroDivisionError, Rational.from_string, '0/0') def test_to_string(self): self.assertEqual(str(Rational(3, 5)), '3/5') self.assertEqual(str(Rational(-3, 5)), '-3/5') def test_repr(self): self.assertEqual(repr(Rational(3, 5)), 'Rational(3, 5)') self.assertEqual(repr(Rational(-3, 5)), 'Rational(-3, 5)') self.assertEqual(repr(Rational(0, 3)), 'Rational(0, 3)') def test_to_float(self): self.assertEqual(Rational(3, 6).to_float(), 0.5) self.assertEqual(Rational(11, 11).to_float(), 1.0) self.assertEqual(Rational(-2, 8).to_float(), -0.25) self.assertEqual(Rational(0, 3).to_float(), 0.0) def test_equality(self): r1 = Rational(2, 1) r2 = Rational(2, 1) r3 = Rational(8, 4) r4 = Rational(3, 2) self.assertEqual(r1, r2) self.assertEqual(r1, r3) self.assertNotEqual(r1, r4)
pridkett/pyexiv2
test/rational.py
Python
gpl-2.0
3,750
/* * Copyright (c) 1998-2012 Caucho Technology -- all rights reserved * * This file is part of Resin(R) Open Source * * Each copy or derived work must preserve the copyright notice and this * notice unmodified. * * Resin Open Source is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Resin Open Source 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, or any warranty * of NON-INFRINGEMENT. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License * along with Resin Open Source; if not, write to the * * Free Software Foundation, Inc. * 59 Temple Place, Suite 330 * Boston, MA 02111-1307 USA * * @author Scott Ferguson */ package com.caucho.jsp.java; import com.caucho.jsp.JspParseException; import com.caucho.util.L10N; import com.caucho.vfs.WriteStream; import com.caucho.xml.QName; import java.io.IOException; public class JspOutput extends JspNode { static final L10N L = new L10N(JspOutput.class); static final private QName OMIT_XML_DECLARATION = new QName("omit-xml-declaration"); static final private QName DOCTYPE_SYSTEM = new QName("doctype-system"); static final private QName DOCTYPE_PUBLIC = new QName("doctype-public"); static final private QName DOCTYPE_ROOT_ELEMENT = new QName("doctype-root-element"); private boolean _omitXmlDeclaration; private String _doctypeSystem; private String _doctypePublic; private String _doctypeRootElement; /** * Adds an attribute. * * @param name the attribute name * @param value the attribute value */ public void addAttribute(QName name, String value) throws JspParseException { if (! _gen.isXml()) throw error(L.l("jsp:output is only allowed in jspx files.")); if (OMIT_XML_DECLARATION.equals(name)) { _gen.setOmitXmlDeclaration(attributeToBoolean(name.getName(), value)); } else if (DOCTYPE_SYSTEM.equals(name)) { String oldValue = _gen.getDoctypeSystem(); if (oldValue != null && ! oldValue.equals(value)) { throw error(L.l("jsp:output doctype-system '{0}' conflicts with previous value '{1}'. The doctype-system attribute may only be specified once.", value, oldValue)); } _gen.setDoctypeSystem(value); _doctypeSystem = value; } else if (DOCTYPE_PUBLIC.equals(name)) { String oldValue = _gen.getDoctypePublic(); if (oldValue != null && ! oldValue.equals(value)) { throw error(L.l("jsp:output doctype-public '{0}' conflicts with previous value '{1}'. The doctype-public attribute may only be specified once.", value, oldValue)); } _gen.setDoctypePublic(value); _doctypePublic = value; } else if (DOCTYPE_ROOT_ELEMENT.equals(name)) { String oldValue = _gen.getDoctypeRootElement(); if (oldValue != null && ! oldValue.equals(value)) { throw error(L.l("jsp:output doctype-root-element '{0}' conflicts with previous value '{1}'. The doctype-root-element attribute may only be specified once.", value, oldValue)); } _gen.setDoctypeRootElement(value); _doctypeRootElement = value; } else { throw error(L.l("'{0}' is an unknown jsp:output attribute. Value attributes are: doctype-public, doctype-system, doctype-root-element.", name.getName())); } } /** * When the element completes. */ public void endElement() throws JspParseException { if (_doctypeSystem != null && _doctypeRootElement == null) { throw error(L.l("<jsp:output> with a 'doctype-system' attribute requires a 'doctype-root-element' attribute.")); } if (_doctypePublic != null && _doctypeSystem == null) { throw error(L.l("<jsp:output> with a 'doctype-public' attribute requires a 'doctype-system' attribute.")); } if (_doctypeRootElement != null && _doctypeSystem == null) { throw error(L.l("<jsp:output> with a 'doctype-root-element' attribute requires a 'doctype-system' attribute.")); } _gen.setDoctypeSystem(_doctypeSystem); _gen.setDoctypePublic(_doctypePublic); _gen.setDoctypeRootElement(_doctypeRootElement); } /** * Return true if the node only has static text. */ public boolean isStatic() { return true; } /** * Generates the XML text representation for the tag validation. * * @param os write stream to the generated XML. */ public void printXml(WriteStream os) throws IOException { } /** * Generates the code for the tag * * @param out the output writer for the generated java. */ public void generate(JspJavaWriter out) throws Exception { } }
WelcomeHUME/svn-caucho-com-resin
modules/resin/src/com/caucho/jsp/java/JspOutput.java
Java
gpl-2.0
5,096
/* * Copyright (C) 2007-2017 Paul Davis <paul@linuxaudiosystems.com> * Copyright (C) 2008-2011 David Robillard <d@drobilla.net> * Copyright (C) 2010 Carl Hetherington <carl@carlh.net> * Copyright (C) 2013-2016 John Emmas <john@creativepost.co.uk> * Copyright (C) 2015-2016 Robin Gareus <robin@gareus.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "pbd/error.h" #include "ardour/resampled_source.h" #include "pbd/failed_constructor.h" #include "pbd/i18n.h" using namespace ARDOUR; using namespace PBD; #ifdef PLATFORM_WINDOWS const uint32_t ResampledImportableSource::blocksize = 524288U; #else const uint32_t ResampledImportableSource::blocksize = 16384U; #endif ResampledImportableSource::ResampledImportableSource (boost::shared_ptr<ImportableSource> src, samplecnt_t rate, SrcQuality srcq) : source (src) , _src_state (0) { _src_type = SRC_SINC_BEST_QUALITY; switch (srcq) { case SrcBest: _src_type = SRC_SINC_BEST_QUALITY; break; case SrcGood: _src_type = SRC_SINC_MEDIUM_QUALITY; break; case SrcQuick: _src_type = SRC_SINC_FASTEST; break; case SrcFast: _src_type = SRC_ZERO_ORDER_HOLD; break; case SrcFastest: _src_type = SRC_LINEAR; break; } _input = new float[blocksize]; seek (0); _src_data.src_ratio = ((float) rate) / source->samplerate(); } ResampledImportableSource::~ResampledImportableSource () { _src_state = src_delete (_src_state) ; delete [] _input; } samplecnt_t ResampledImportableSource::read (Sample* output, samplecnt_t nframes) { int err; size_t bs = floor ((float)(blocksize / source->channels())) * source->channels(); /* If the input buffer is empty, refill it. */ if (_src_data.input_frames == 0) { _src_data.input_frames = source->read (_input, bs); /* The last read will not be a full buffer, so set end_of_input. */ if ((size_t) _src_data.input_frames < bs) { _end_of_input = true; } _src_data.input_frames /= source->channels(); _src_data.data_in = _input; } _src_data.data_out = output; _src_data.output_frames = nframes / source->channels(); if (_end_of_input && _src_data.input_frames * _src_data.src_ratio <= _src_data.output_frames) { /* only set src_data.end_of_input for the last cycle. * * The flag only affects writing out remaining data in the * internal buffer of src_state. * SRC is not aware of data bufered here in _src_data.input * which needs to be processed first. */ _src_data.end_of_input = true; } if ((err = src_process (_src_state, &_src_data))) { error << string_compose(_("Import: %1"), src_strerror (err)) << endmsg ; return 0 ; } /* Terminate if at end */ if (_src_data.end_of_input && _src_data.output_frames_gen == 0) { return 0; } _src_data.data_in += _src_data.input_frames_used * source->channels(); _src_data.input_frames -= _src_data.input_frames_used ; return _src_data.output_frames_gen * source->channels(); } void ResampledImportableSource::seek (samplepos_t pos) { source->seek (pos); /* and reset things so that we start from scratch with the conversion */ if (_src_state) { src_delete (_src_state); } int err; if ((_src_state = src_new (_src_type, source->channels(), &err)) == 0) { error << string_compose(_("Import: src_new() failed : %1"), src_strerror (err)) << endmsg ; throw failed_constructor (); } _src_data.input_frames = 0; _src_data.data_in = _input; _src_data.end_of_input = 0; _end_of_input = false; } samplepos_t ResampledImportableSource::natural_position () const { return source->natural_position() * ratio (); }
Ardour/ardour
libs/ardour/resampled_source.cc
C++
gpl-2.0
4,247
<?php // Template Name: 100% Width get_header(); ?> <div id="content" class="full-width"> <?php while(have_posts()): the_post(); ?> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <span class="entry-title" style="display: none;"><?php the_title(); ?></span> <span class="vcard" style="display: none;"><span class="fn"><?php the_author_posts_link(); ?></span></span> <span class="updated" style="display: none;"><?php the_time('c'); ?></span> <?php global $data; if(!$data['featured_images_pages'] ): ?> <?php if($data['legacy_posts_slideshow']): $args = array( 'post_type' => 'attachment', 'numberposts' => $data['posts_slideshow_number']-1, 'post_status' => null, 'post_parent' => $post->ID, 'orderby' => 'menu_order', 'order' => 'ASC', 'post_mime_type' => 'image', 'exclude' => get_post_thumbnail_id() ); $attachments = get_posts($args); if((has_post_thumbnail() || get_post_meta($post->ID, 'pyre_video', true))): ?> <div class="flexslider post-slideshow"> <ul class="slides"> <?php if(!$data['posts_slideshow']): ?> <?php if(get_post_meta($post->ID, 'pyre_video', true)): ?> <li> <div class="full-video"> <?php echo get_post_meta($post->ID, 'pyre_video', true); ?> </div> </li> <?php elseif(has_post_thumbnail() ): ?> <?php $attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); ?> <?php $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); ?> <?php $attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id()); ?> <li> <a href="<?php echo $full_image[0]; ?>" rel="prettyPhoto[gallery<?php the_ID(); ?>]" title="<?php echo get_post_field('post_excerpt', get_post_thumbnail_id()); ?>"><img src="<?php echo $attachment_image[0]; ?>" alt="<?php echo get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true); ?>" /></a> </li> <?php endif; ?> <?php else: ?> <?php if(get_post_meta($post->ID, 'pyre_video', true)): ?> <li> <div class="full-video"> <?php echo get_post_meta($post->ID, 'pyre_video', true); ?> </div> </li> <?php endif; ?> <?php if(has_post_thumbnail() && !get_post_meta($post->ID, 'pyre_video', true)): ?> <?php $attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); ?> <?php $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); ?> <?php $attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id()); ?> <li> <a href="<?php echo $full_image[0]; ?>" rel="prettyPhoto[gallery<?php the_ID(); ?>]" title="<?php echo get_post_field('post_excerpt', get_post_thumbnail_id()); ?>"><img src="<?php echo $attachment_image[0]; ?>" alt="<?php echo get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true); ?>" /></a> </li> <?php endif; ?> <?php foreach($attachments as $attachment): ?> <?php $attachment_image = wp_get_attachment_image_src($attachment->ID, 'full'); ?> <?php $full_image = wp_get_attachment_image_src($attachment->ID, 'full'); ?> <?php $attachment_data = wp_get_attachment_metadata($attachment->ID); ?> <li> <a href="<?php echo $full_image[0]; ?>" rel="prettyPhoto[gallery<?php the_ID(); ?>]" title="<?php echo get_post_field('post_excerpt', $attachment->ID); ?>"><img src="<?php echo $attachment_image[0]; ?>" alt="<?php echo get_post_meta($attachment->ID, '_wp_attachment_image_alt', true); ?>" /></a> </li> <?php endforeach; ?> <?php endif; ?> </ul> </div> <?php endif; ?> <?php else: ?> <?php if((has_post_thumbnail() || get_post_meta($post->ID, 'pyre_video', true))): ?> <div class="flexslider post-slideshow"> <ul class="slides"> <?php if(!$data['posts_slideshow']): ?> <?php if(get_post_meta($post->ID, 'pyre_video', true)): ?> <li> <div class="full-video"> <?php echo get_post_meta($post->ID, 'pyre_video', true); ?> </div> </li> <?php elseif(has_post_thumbnail() ): ?> <?php $attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); ?> <?php $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); ?> <?php $attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id()); ?> <li> <a href="<?php echo $full_image[0]; ?>" rel="prettyPhoto[gallery<?php the_ID(); ?>]" title="<?php echo get_post_field('post_excerpt', get_post_thumbnail_id()); ?>"><img src="<?php echo $attachment_image[0]; ?>" alt="<?php echo get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true); ?>" /></a> </li> <?php endif; ?> <?php else: ?> <?php if(get_post_meta($post->ID, 'pyre_video', true)): ?> <li> <div class="full-video"> <?php echo get_post_meta($post->ID, 'pyre_video', true); ?> </div> </li> <?php endif; ?> <?php if(has_post_thumbnail() ): ?> <?php $attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); ?> <?php $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); ?> <?php $attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id()); ?> <li> <a href="<?php echo $full_image[0]; ?>" rel="prettyPhoto[gallery<?php the_ID(); ?>]" title="<?php echo get_post_field('post_excerpt', get_post_thumbnail_id()); ?>"><img src="<?php echo $attachment_image[0]; ?>" alt="<?php echo get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true); ?>" /></a> </li> <?php endif; ?> <?php $i = 2; while($i <= $data['posts_slideshow_number']): $attachment_new_id = kd_mfi_get_featured_image_id('featured-image-'.$i, 'page'); if($attachment_new_id): ?> <?php $attachment_image = wp_get_attachment_image_src($attachment_new_id, 'full'); ?> <?php $full_image = wp_get_attachment_image_src($attachment_new_id, 'full'); ?> <?php $attachment_data = wp_get_attachment_metadata($attachment_new_id); ?> <li> <a href="<?php echo $full_image[0]; ?>" rel="prettyPhoto[gallery<?php the_ID(); ?>]" title="<?php echo get_post_field('post_excerpt', $attachment_new_id); ?>"><img src="<?php echo $attachment_image[0]; ?>" alt="<?php echo get_post_meta($attachment_new_id, '_wp_attachment_image_alt', true); ?>" /></a> </li> <?php endif; $i++; endwhile; ?> <?php endif; ?> </ul> </div> <?php endif; ?> <?php endif; ?> <?php endif; ?> <div class="post-content"> <?php the_content(); ?> <?php wp_link_pages(); ?> </div> <?php if($data['comments_pages']): ?> <?php wp_reset_query(); ?> <?php comments_template(); ?> <?php endif; ?> </div> <?php endwhile; ?> </div> <?php get_footer(); ?>
FelixNong1990/wp-3.8
wp-content/themes/avada/100-width.php
PHP
gpl-2.0
6,869
/* * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "stdafx.hpp" #include "PassiveAI.h" #include "ReactorAI.h" #include "CombatAI.h" #include "GuardAI.h" #include "PetAI.h" #include "TotemAI.h" #include "CreatureEventAI.h" #include "RandomMovementGenerator.h" #include "MovementGeneratorImpl.h" #include "CreatureAIRegistry.h" #include "WaypointMovementGenerator.h" #include "CreatureAIFactory.h" #include "SmartAI.h" namespace AIRegistry { void Initialize() { (new CreatureAIFactory<NullCreatureAI>("NullCreatureAI"))->RegisterSelf(); (new CreatureAIFactory<TriggerAI>("TriggerAI"))->RegisterSelf(); (new CreatureAIFactory<AggressorAI>("AggressorAI"))->RegisterSelf(); (new CreatureAIFactory<ReactorAI>("ReactorAI"))->RegisterSelf(); (new CreatureAIFactory<PassiveAI>("PassiveAI"))->RegisterSelf(); (new CreatureAIFactory<CritterAI>("CritterAI"))->RegisterSelf(); (new CreatureAIFactory<GuardAI>("GuardAI"))->RegisterSelf(); (new CreatureAIFactory<PetAI>("PetAI"))->RegisterSelf(); (new CreatureAIFactory<TotemAI>("TotemAI"))->RegisterSelf(); (new CreatureAIFactory<CombatAI>("CombatAI"))->RegisterSelf(); (new CreatureAIFactory<ArcherAI>("ArcherAI"))->RegisterSelf(); (new CreatureAIFactory<TurretAI>("TurretAI"))->RegisterSelf(); (new CreatureAIFactory<CreatureEventAI>("EventAI"))->RegisterSelf(); (new CreatureAIFactory<VehicleAI>("VehicleAI"))->RegisterSelf(); (new CreatureAIFactory<SmartAI>("SmartAI"))->RegisterSelf(); (new GameObjectAIFactory<GameObjectAI>("GameObjectAI"))->RegisterSelf(); (new GameObjectAIFactory<SmartGameObjectAI>("SmartGameObjectAI"))->RegisterSelf(); (new MovementGeneratorFactory<RandomMovementGenerator<Creature> >(RANDOM_MOTION_TYPE))->RegisterSelf(); (new MovementGeneratorFactory<WaypointMovementGenerator<Creature> >(WAYPOINT_MOTION_TYPE))->RegisterSelf(); } }
Riztazz/trinitycore-m4a
src/server/game/AI/CreatureAIRegistry.cpp
C++
gpl-2.0
2,707
using System; using System.Data.Linq; using System.Data.Linq.Mapping; using System.Data; using System.Collections.Generic; using System.Reflection; using System.Linq; using System.Linq.Expressions; using System.ComponentModel; namespace CmsData.View { [Table(Name="OrganizationsByPerson")] public partial class OrganizationsByPerson { private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); private int _OrganizationId; private string _OrganizationName; private string _Location; private int? _LeaderId; private string _LeaderFirst; private string _LeaderLast; private string _ScheduleName; public OrganizationsByPerson() { } [Column(Name="ORGANIZATION_ID", Storage="_OrganizationId", DbType="int NOT NULL")] public int OrganizationId { get { return this._OrganizationId; } set { if (this._OrganizationId != value) this._OrganizationId = value; } } [Column(Name="ORGANIZATION_NAME", Storage="_OrganizationName", DbType="varchar(40) NOT NULL")] public string OrganizationName { get { return this._OrganizationName; } set { if (this._OrganizationName != value) this._OrganizationName = value; } } [Column(Name="LOCATION", Storage="_Location", DbType="varchar(40)")] public string Location { get { return this._Location; } set { if (this._Location != value) this._Location = value; } } [Column(Name="LeaderId", Storage="_LeaderId", DbType="int")] public int? LeaderId { get { return this._LeaderId; } set { if (this._LeaderId != value) this._LeaderId = value; } } [Column(Name="LeaderFirst", Storage="_LeaderFirst", DbType="varchar(15)")] public string LeaderFirst { get { return this._LeaderFirst; } set { if (this._LeaderFirst != value) this._LeaderFirst = value; } } [Column(Name="LeaderLast", Storage="_LeaderLast", DbType="varchar(20)")] public string LeaderLast { get { return this._LeaderLast; } set { if (this._LeaderLast != value) this._LeaderLast = value; } } [Column(Name="SCHEDULE_NAME", Storage="_ScheduleName", DbType="varchar(40)")] public string ScheduleName { get { return this._ScheduleName; } set { if (this._ScheduleName != value) this._ScheduleName = value; } } } }
alexserdyuk/bvcms
CmsData/Generated/Functions/OrganizationsByPerson.cs
C#
gpl-2.0
2,523
#!/usr/bin/env python2 # coding=utf-8 # # Copyright 2014 Sascha Schirra # # This file is part of Ropper. # # Ropper 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. # # Ropper 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/>.
idl3r/Ropper
ropperapp/loaders/pe_intern/__init__.py
Python
gpl-2.0
729
package com.bill.mygitosc.utils; /** * Created by liaobb on 2015/8/3. */ public class StringUtils { public static boolean ignoreCaseContain(String s1, String s2) { return s1.toLowerCase().indexOf(s2.toLowerCase()) >= 0; } }
winiceo/my-oscgit-android
mygitosc/src/main/java/com/bill/mygitosc/utils/StringUtils.java
Java
gpl-2.0
244
/* * Copyright (c) 1998-2012 Caucho Technology -- all rights reserved * * This file is part of Resin(R) Open Source * * Each copy or derived work must preserve the copyright notice and this * notice unmodified. * * Resin Open Source is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Resin Open Source 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, or any warranty * of NON-INFRINGEMENT. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License * along with Resin Open Source; if not, write to the * * Free Software Foundation, Inc. * 59 Temple Place, Suite 330 * Boston, MA 02111-1307 USA * * @author Scott Ferguson */ package com.caucho.db.sql; import java.sql.SQLException; import java.util.ArrayList; import java.util.logging.Logger; final class DoubleNeqExpr extends AbstractBinaryBooleanExpr { private final Expr _left; private final Expr _right; DoubleNeqExpr(Expr left, Expr right) { _left = left; _right = right; } @Override public final Expr getLeft() { return _left; } @Override public final Expr getRight() { return _right; } @Override public Expr create(Expr left, Expr right) { return new DoubleNeqExpr(left, right); } @Override public final boolean isSelect(final QueryContext context) throws SQLException { if (_left.isNull(context) || _right.isNull(context)) return false; return (_left.evalDouble(context) != _right.evalDouble(context)); } @Override public final int evalBoolean(final QueryContext context) throws SQLException { if (_left.isNull(context) || _right.isNull(context)) return UNKNOWN; if (_left.evalDouble(context) != _right.evalDouble(context)) return TRUE; else return FALSE; } @Override public String toString() { return "(" + _left + " != " + _right + ")"; } }
mdaniel/svn-caucho-com-resin
modules/resin/src/com/caucho/db/sql/DoubleNeqExpr.java
Java
gpl-2.0
2,255
<?php namespace Drupal\views_ui; use Drupal\Component\Utility\Html; use Drupal\Component\Utility\Timer; use Drupal\Core\EventSubscriber\AjaxResponseSubscriber; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Link; use Drupal\Core\TempStore\Lock; use Drupal\views\Views; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\views\ViewExecutable; use Drupal\Core\Database\Database; use Drupal\Core\Session\AccountInterface; use Drupal\views\Plugin\views\query\Sql; use Drupal\views\Entity\View; use Drupal\views\ViewEntityInterface; use Symfony\Cmf\Component\Routing\RouteObjectInterface; use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\Request; /** * Stores UI related temporary settings. */ class ViewUI implements ViewEntityInterface { /** * Indicates if a view is currently being edited. * * @var bool */ public $editing = FALSE; /** * Stores an array of displays that have been changed. * * @var array */ public $changed_display; /** * How long the view takes to render in microseconds. * * @var float */ public $render_time; /** * If this view is locked for editing. * * If this view is locked it will contain the result of * \Drupal\Core\TempStore\SharedTempStore::getMetadata(). * * For backwards compatibility, public access to this property is provided by * ::__set() and ::__get(). * * @var \Drupal\Core\TempStore\Lock|null */ private $lock; /** * If this view has been changed. * * @var bool */ public $changed; /** * Stores options temporarily while editing. * * @var array */ public $temporary_options; /** * Stores a stack of UI forms to display. * * @var array */ public $stack; /** * Is the view run in a context of the preview in the admin interface. * * @var bool */ public $live_preview; public $renderPreview = FALSE; /** * The View storage object. * * @var \Drupal\views\ViewEntityInterface */ protected $storage; /** * Stores a list of database queries run beside the main one from views. * * @var array * * @see \Drupal\Core\Database\Log */ protected $additionalQueries; /** * Contains an array of form keys and their respective classes. * * @var array */ public static $forms = [ 'add-handler' => '\Drupal\views_ui\Form\Ajax\AddItem', 'analyze' => '\Drupal\views_ui\Form\Ajax\Analyze', 'handler' => '\Drupal\views_ui\Form\Ajax\ConfigHandler', 'handler-extra' => '\Drupal\views_ui\Form\Ajax\ConfigHandlerExtra', 'handler-group' => '\Drupal\views_ui\Form\Ajax\ConfigHandlerGroup', 'display' => '\Drupal\views_ui\Form\Ajax\Display', 'edit-details' => '\Drupal\views_ui\Form\Ajax\EditDetails', 'rearrange' => '\Drupal\views_ui\Form\Ajax\Rearrange', 'rearrange-filter' => '\Drupal\views_ui\Form\Ajax\RearrangeFilter', 'reorder-displays' => '\Drupal\views_ui\Form\Ajax\ReorderDisplays', ]; /** * Whether the config is being created, updated or deleted through the * import process. * * @var bool */ private $isSyncing = FALSE; /** * Whether the config is being deleted through the uninstall process. * * @var bool */ private $isUninstalling = FALSE; /** * Constructs a View UI object. * * @param \Drupal\views\ViewEntityInterface $storage * The View storage object to wrap. */ public function __construct(ViewEntityInterface $storage) { $this->entityType = 'view'; $this->storage = $storage; } /** * {@inheritdoc} */ public function get($property_name, $langcode = NULL) { if (property_exists($this->storage, $property_name)) { return $this->storage->get($property_name, $langcode); } return isset($this->{$property_name}) ? $this->{$property_name} : NULL; } /** * {@inheritdoc} */ public function setStatus($status) { return $this->storage->setStatus($status); } /** * {@inheritdoc} */ public function set($property_name, $value, $notify = TRUE) { if (property_exists($this->storage, $property_name)) { $this->storage->set($property_name, $value); } else { $this->{$property_name} = $value; } } /** * {@inheritdoc} */ public function setSyncing($syncing) { $this->isSyncing = $syncing; } /** * {@inheritdoc} */ public function setUninstalling($isUninstalling) { $this->isUninstalling = $isUninstalling; } /** * {@inheritdoc} */ public function isSyncing() { return $this->isSyncing; } /** * {@inheritdoc} */ public function isUninstalling() { return $this->isUninstalling; } /** * Basic submit handler applicable to all 'standard' forms. * * This submit handler determines whether the user wants the submitted changes * to apply to the default display or to the current display, and dispatches * control appropriately. */ public function standardSubmit($form, FormStateInterface $form_state) { // Determine whether the values the user entered are intended to apply to // the current display or the default display. list($was_defaulted, $is_defaulted, $revert) = $this->getOverrideValues($form, $form_state); // Based on the user's choice in the display dropdown, determine which display // these changes apply to. $display_id = $form_state->get('display_id'); if ($revert) { // If it's revert just change the override and return. $display = &$this->getExecutable()->displayHandlers->get($display_id); $display->optionsOverride($form, $form_state); // Don't execute the normal submit handling but still store the changed view into cache. $this->cacheSet(); return; } elseif ($was_defaulted === $is_defaulted) { // We're not changing which display these form values apply to. // Run the regular submit handler for this form. } elseif ($was_defaulted && !$is_defaulted) { // We were using the default display's values, but we're now overriding // the default display and saving values specific to this display. $display = &$this->getExecutable()->displayHandlers->get($display_id); // optionsOverride toggles the override of this section. $display->optionsOverride($form, $form_state); $display->submitOptionsForm($form, $form_state); } elseif (!$was_defaulted && $is_defaulted) { // We used to have an override for this display, but the user now wants // to go back to the default display. // Overwrite the default display with the current form values, and make // the current display use the new default values. $display = &$this->getExecutable()->displayHandlers->get($display_id); // optionsOverride toggles the override of this section. $display->optionsOverride($form, $form_state); $display->submitOptionsForm($form, $form_state); } $submit_handler = [$form_state->getFormObject(), 'submitForm']; call_user_func_array($submit_handler, [&$form, $form_state]); } /** * Submit handler for cancel button */ public function standardCancel($form, FormStateInterface $form_state) { if (!empty($this->changed) && isset($this->form_cache)) { unset($this->form_cache); $this->cacheSet(); } $form_state->setRedirectUrl($this->toUrl('edit-form')); } /** * Provide a standard set of Apply/Cancel/OK buttons for the forms. Also provide * a hidden op operator because the forms plugin doesn't seem to properly * provide which button was clicked. * * TODO: Is the hidden op operator still here somewhere, or is that part of the * docblock outdated? */ public function getStandardButtons(&$form, FormStateInterface $form_state, $form_id, $name = NULL) { $form['actions'] = [ '#type' => 'actions', ]; if (empty($name)) { $name = t('Apply'); if (!empty($this->stack) && count($this->stack) > 1) { $name = t('Apply and continue'); } $names = [t('Apply'), t('Apply and continue')]; } // Forms that are purely informational set an ok_button flag, so we know not // to create an "Apply" button for them. if (!$form_state->get('ok_button')) { $form['actions']['submit'] = [ '#type' => 'submit', '#value' => $name, '#id' => 'edit-submit-' . Html::getUniqueId($form_id), // The regular submit handler ($form_id . '_submit') does not apply if // we're updating the default display. It does apply if we're updating // the current display. Since we have no way of knowing at this point // which display the user wants to update, views_ui_standard_submit will // take care of running the regular submit handler as appropriate. '#submit' => [[$this, 'standardSubmit']], '#button_type' => 'primary', ]; // Form API button click detection requires the button's #value to be the // same between the form build of the initial page request, and the // initial form build of the request processing the form submission. // Ideally, the button's #value shouldn't change until the form rebuild // step. However, \Drupal\views_ui\Form\Ajax\ViewsFormBase::getForm() // implements a different multistep form workflow than the Form API does, // and adjusts $view->stack prior to form processing, so we compensate by // extending button click detection code to support any of the possible // button labels. if (isset($names)) { $form['actions']['submit']['#values'] = $names; $form['actions']['submit']['#process'] = array_merge(['views_ui_form_button_was_clicked'], \Drupal::service('element_info')->getInfoProperty($form['actions']['submit']['#type'], '#process', [])); } // If a validation handler exists for the form, assign it to this button. $form['actions']['submit']['#validate'][] = [$form_state->getFormObject(), 'validateForm']; } // Create a "Cancel" button. For purely informational forms, label it "OK". $cancel_submit = function_exists($form_id . '_cancel') ? $form_id . '_cancel' : [$this, 'standardCancel']; $form['actions']['cancel'] = [ '#type' => 'submit', '#value' => !$form_state->get('ok_button') ? t('Cancel') : t('Ok'), '#submit' => [$cancel_submit], '#validate' => [], '#limit_validation_errors' => [], ]; // Compatibility, to be removed later: // TODO: When is "later"? // We used to set these items on the form, but now we want them on the $form_state: if (isset($form['#title'])) { $form_state->set('title', $form['#title']); } if (isset($form['#section'])) { $form_state->set('#section', $form['#section']); } // Finally, we never want these cached -- our object cache does that for us. $form['#no_cache'] = TRUE; } /** * Return the was_defaulted, is_defaulted and revert state of a form. */ public function getOverrideValues($form, FormStateInterface $form_state) { // Make sure the dropdown exists in the first place. if ($form_state->hasValue(['override', 'dropdown'])) { // #default_value is used to determine whether it was the default value or not. // So the available options are: $display, 'default' and 'default_revert', not 'defaults'. $was_defaulted = ($form['override']['dropdown']['#default_value'] === 'defaults'); $dropdown = $form_state->getValue(['override', 'dropdown']); $is_defaulted = ($dropdown === 'default'); $revert = ($dropdown === 'default_revert'); if ($was_defaulted !== $is_defaulted && isset($form['#section'])) { // We're changing which display these values apply to. // Update the #section so it knows what to mark changed. $form['#section'] = str_replace('default-', $form_state->get('display_id') . '-', $form['#section']); } } else { // The user didn't get the dropdown for overriding the default display. $was_defaulted = FALSE; $is_defaulted = FALSE; $revert = FALSE; } return [$was_defaulted, $is_defaulted, $revert]; } /** * Add another form to the stack; clicking 'apply' will go to this form * rather than closing the ajax popup. */ public function addFormToStack($key, $display_id, $type, $id = NULL, $top = FALSE, $rebuild_keys = FALSE) { // Reset the cache of IDs. Drupal rather aggressively prevents ID // duplication but this causes it to remember IDs that are no longer even // being used. Html::resetSeenIds(); if (empty($this->stack)) { $this->stack = []; } $stack = [implode('-', array_filter([$key, $this->id(), $display_id, $type, $id])), $key, $display_id, $type, $id]; // If we're being asked to add this form to the bottom of the stack, no // special logic is required. Our work is equally easy if we were asked to add // to the top of the stack, but there's nothing in it yet. if (!$top || empty($this->stack)) { $this->stack[] = $stack; } // If we're adding to the top of an existing stack, we have to maintain the // existing integer keys, so they can be used for the "2 of 3" progress // indicator (which will now read "2 of 4"). else { $keys = array_keys($this->stack); $first = current($keys); $last = end($keys); for ($i = $last; $i >= $first; $i--) { if (!isset($this->stack[$i])) { continue; } // Move form number $i to the next position in the stack. $this->stack[$i + 1] = $this->stack[$i]; unset($this->stack[$i]); } // Now that the previously $first slot is free, move the new form into it. $this->stack[$first] = $stack; ksort($this->stack); // Start the keys from 0 again, if requested. if ($rebuild_keys) { $this->stack = array_values($this->stack); } } } /** * Submit handler for adding new item(s) to a view. */ public function submitItemAdd($form, FormStateInterface $form_state) { $type = $form_state->get('type'); $types = ViewExecutable::getHandlerTypes(); $section = $types[$type]['plural']; $display_id = $form_state->get('display_id'); // Handle the override select. list($was_defaulted, $is_defaulted) = $this->getOverrideValues($form, $form_state); if ($was_defaulted && !$is_defaulted) { // We were using the default display's values, but we're now overriding // the default display and saving values specific to this display. $display = &$this->getExecutable()->displayHandlers->get($display_id); // setOverride toggles the override of this section. $display->setOverride($section); } elseif (!$was_defaulted && $is_defaulted) { // We used to have an override for this display, but the user now wants // to go back to the default display. // Overwrite the default display with the current form values, and make // the current display use the new default values. $display = &$this->getExecutable()->displayHandlers->get($display_id); // optionsOverride toggles the override of this section. $display->setOverride($section); } if (!$form_state->isValueEmpty('name') && is_array($form_state->getValue('name'))) { // Loop through each of the items that were checked and add them to the view. foreach (array_keys(array_filter($form_state->getValue('name'))) as $field) { list($table, $field) = explode('.', $field, 2); if ($cut = strpos($field, '$')) { $field = substr($field, 0, $cut); } $id = $this->getExecutable()->addHandler($display_id, $type, $table, $field); // check to see if we have group by settings $key = $type; // Footer,header and empty text have a different internal handler type(area). if (isset($types[$type]['type'])) { $key = $types[$type]['type']; } $item = [ 'table' => $table, 'field' => $field, ]; $handler = Views::handlerManager($key)->getHandler($item); if ($this->getExecutable()->displayHandlers->get('default')->useGroupBy() && $handler->usesGroupBy()) { $this->addFormToStack('handler-group', $display_id, $type, $id); } // check to see if this type has settings, if so add the settings form first if ($handler && $handler->hasExtraOptions()) { $this->addFormToStack('handler-extra', $display_id, $type, $id); } // Then add the form to the stack $this->addFormToStack('handler', $display_id, $type, $id); } } if (isset($this->form_cache)) { unset($this->form_cache); } // Store in cache $this->cacheSet(); } /** * Set up query capturing. * * \Drupal\Core\Database\Database stores the queries that it runs, if logging * is enabled. * * @see ViewUI::endQueryCapture() */ public function startQueryCapture() { Database::startLog('views'); } /** * Add the list of queries run during render to buildinfo. * * @see ViewUI::startQueryCapture() */ public function endQueryCapture() { $queries = Database::getLog('views'); $this->additionalQueries = $queries; } public function renderPreview($display_id, $args = []) { // Save the current path so it can be restored before returning from this function. $request_stack = \Drupal::requestStack(); $current_request = $request_stack->getCurrentRequest(); $executable = $this->getExecutable(); // Determine where the query and performance statistics should be output. $config = \Drupal::config('views.settings'); $show_query = $config->get('ui.show.sql_query.enabled'); $show_info = $config->get('ui.show.preview_information'); $show_location = $config->get('ui.show.sql_query.where'); $show_stats = $config->get('ui.show.performance_statistics'); if ($show_stats) { $show_stats = $config->get('ui.show.sql_query.where'); } $combined = $show_query && $show_stats; $rows = ['query' => [], 'statistics' => []]; $errors = $executable->validate(); $executable->destroy(); if (empty($errors)) { $this->ajax = TRUE; $executable->live_preview = TRUE; // AJAX happens via HTTP POST but everything expects exposed data to // be in GET. Copy stuff but remove ajax-framework specific keys. // If we're clicking on links in a preview, though, we could actually // have some input in the query parameters, so we merge request() and // query() to ensure we get it all. $exposed_input = array_merge(\Drupal::request()->request->all(), \Drupal::request()->query->all()); foreach (['view_name', 'view_display_id', 'view_args', 'view_path', 'view_dom_id', 'pager_element', 'view_base_path', AjaxResponseSubscriber::AJAX_REQUEST_PARAMETER, 'ajax_page_state', 'form_id', 'form_build_id', 'form_token'] as $key) { if (isset($exposed_input[$key])) { unset($exposed_input[$key]); } } $executable->setExposedInput($exposed_input); if (!$executable->setDisplay($display_id)) { return [ '#markup' => t('Invalid display id @display', ['@display' => $display_id]), ]; } $executable->setArguments($args); // Store the current view URL for later use: if ($executable->hasUrl() && $executable->display_handler->getOption('path')) { $path = $executable->getUrl(); } // Make view links come back to preview. // Also override the current path so we get the pager, and make sure the // Request object gets all of the proper values from $_SERVER. $request = Request::createFromGlobals(); $request->attributes->set(RouteObjectInterface::ROUTE_NAME, 'entity.view.preview_form'); $request->attributes->set(RouteObjectInterface::ROUTE_OBJECT, \Drupal::service('router.route_provider')->getRouteByName('entity.view.preview_form')); $request->attributes->set('view', $this->storage); $request->attributes->set('display_id', $display_id); $raw_parameters = new ParameterBag(); $raw_parameters->set('view', $this->id()); $raw_parameters->set('display_id', $display_id); $request->attributes->set('_raw_variables', $raw_parameters); foreach ($args as $key => $arg) { $request->attributes->set('arg_' . $key, $arg); } $request_stack->push($request); // Suppress contextual links of entities within the result set during a // Preview. // @todo We'll want to add contextual links specific to editing the View, so // the suppression may need to be moved deeper into the Preview pipeline. views_ui_contextual_links_suppress_push(); $show_additional_queries = $config->get('ui.show.additional_queries'); Timer::start('entity.view.preview_form'); if ($show_additional_queries) { $this->startQueryCapture(); } // Execute/get the view preview. $preview = $executable->preview($display_id, $args); if ($show_additional_queries) { $this->endQueryCapture(); } $this->render_time = Timer::stop('entity.view.preview_form')['time']; views_ui_contextual_links_suppress_pop(); // Prepare the query information and statistics to show either above or // below the view preview. // Initialize the empty rows arrays so we can safely merge them later. $rows['query'] = []; $rows['statistics'] = []; if ($show_info || $show_query || $show_stats) { // Get information from the preview for display. if (!empty($executable->build_info['query'])) { if ($show_query) { $query_string = $executable->build_info['query']; // Only the sql default class has a method getArguments. $quoted = []; if ($executable->query instanceof Sql) { $quoted = $query_string->getArguments(); $connection = Database::getConnection(); foreach ($quoted as $key => $val) { if (is_array($val)) { $quoted[$key] = implode(', ', array_map([$connection, 'quote'], $val)); } else { $quoted[$key] = $connection->quote($val); } } } $rows['query'][] = [ [ 'data' => [ '#type' => 'inline_template', '#template' => "<strong>{% trans 'Query' %}</strong>", ], ], [ 'data' => [ '#type' => 'inline_template', '#template' => '<pre>{{ query }}</pre>', '#context' => ['query' => strtr($query_string, $quoted)], ], ], ]; if (!empty($this->additionalQueries)) { $queries[] = [ '#prefix' => '<strong>', '#markup' => t('These queries were run during view rendering:'), '#suffix' => '</strong>', ]; foreach ($this->additionalQueries as $query) { $query_string = strtr($query['query'], $query['args']); $queries[] = [ '#prefix' => "\n", '#markup' => t('[@time ms] @query', ['@time' => round($query['time'] * 100000, 1) / 100000.0, '@query' => $query_string]), ]; } $rows['query'][] = [ [ 'data' => [ '#type' => 'inline_template', '#template' => "<strong>{% trans 'Other queries' %}</strong>", ], ], [ 'data' => [ '#prefix' => '<pre>', 'queries' => $queries, '#suffix' => '</pre>', ], ], ]; } } if ($show_info) { $rows['query'][] = [ [ 'data' => [ '#type' => 'inline_template', '#template' => "<strong>{% trans 'Title' %}</strong>", ], ], [ 'data' => [ '#markup' => $executable->getTitle(), ], ], ]; if (isset($path)) { // @todo Views should expect and store a leading /. See: // https://www.drupal.org/node/2423913 $path = Link::fromTextAndUrl($path->toString(), $path)->toString(); } else { $path = t('This display has no path.'); } $rows['query'][] = [ [ 'data' => [ '#prefix' => '<strong>', '#markup' => t('Path'), '#suffix' => '</strong>', ], ], [ 'data' => [ '#markup' => $path, ], ], ]; } if ($show_stats) { $rows['statistics'][] = [ [ 'data' => [ '#type' => 'inline_template', '#template' => "<strong>{% trans 'Query build time' %}</strong>", ], ], t('@time ms', ['@time' => intval($executable->build_time * 100000) / 100]), ]; $rows['statistics'][] = [ [ 'data' => [ '#type' => 'inline_template', '#template' => "<strong>{% trans 'Query execute time' %}</strong>", ], ], t('@time ms', ['@time' => intval($executable->execute_time * 100000) / 100]), ]; $rows['statistics'][] = [ [ 'data' => [ '#type' => 'inline_template', '#template' => "<strong>{% trans 'View render time' %}</strong>", ], ], t('@time ms', ['@time' => intval($this->render_time * 100) / 100]), ]; } \Drupal::moduleHandler()->alter('views_preview_info', $rows, $executable); } else { // No query was run. Display that information in place of either the // query or the performance statistics, whichever comes first. if ($combined || ($show_location === 'above')) { $rows['query'][] = [ [ 'data' => [ '#prefix' => '<strong>', '#markup' => t('Query'), '#suffix' => '</strong>', ], ], [ 'data' => [ '#markup' => t('No query was run'), ], ], ]; } else { $rows['statistics'][] = [ [ 'data' => [ '#prefix' => '<strong>', '#markup' => t('Query'), '#suffix' => '</strong>', ], ], [ 'data' => [ '#markup' => t('No query was run'), ], ], ]; } } } } else { foreach ($errors as $display_errors) { foreach ($display_errors as $error) { \Drupal::messenger()->addError($error); } } $preview = ['#markup' => t('Unable to preview due to validation errors.')]; } // Assemble the preview, the query info, and the query statistics in the // requested order. $table = [ '#type' => 'table', '#prefix' => '<div class="views-query-info">', '#suffix' => '</div>', '#rows' => array_merge($rows['query'], $rows['statistics']), ]; if ($show_location == 'above') { $output = [ 'table' => $table, 'preview' => $preview, ]; } else { $output = [ 'preview' => $preview, 'table' => $table, ]; } // Ensure that we just remove an additional request we pushed earlier. // This could happen if $errors was not empty. if ($request_stack->getCurrentRequest() != $current_request) { $request_stack->pop(); } return $output; } /** * Get the user's current progress through the form stack. * * @return * FALSE if the user is not currently in a multiple-form stack. Otherwise, * an associative array with the following keys: * - current: The number of the current form on the stack. * - total: The total number of forms originally on the stack. */ public function getFormProgress() { $progress = FALSE; if (!empty($this->stack)) { // The forms on the stack have integer keys that don't change as the forms // are completed, so we can see which ones are still left. $keys = array_keys($this->stack); // Add 1 to the array keys for the benefit of humans, who start counting // from 1 and not 0. $current = reset($keys) + 1; $total = end($keys) + 1; if ($total > 1) { $progress = []; $progress['current'] = $current; $progress['total'] = $total; } } return $progress; } /** * Sets a cached view object in the shared tempstore. */ public function cacheSet() { if ($this->isLocked()) { \Drupal::messenger()->addError(t('Changes cannot be made to a locked view.')); return; } // Let any future object know that this view has changed. $this->changed = TRUE; $executable = $this->getExecutable(); if (isset($executable->current_display)) { // Add the knowledge of the changed display, too. $this->changed_display[$executable->current_display] = TRUE; $executable->current_display = NULL; } // Unset handlers. We don't want to write these into the cache. $executable->display_handler = NULL; $executable->default_display = NULL; $executable->query = NULL; $executable->displayHandlers = NULL; \Drupal::service('tempstore.shared')->get('views')->set($this->id(), $this); } /** * Returns whether the current view is locked. * * @return bool * TRUE if the view is locked, FALSE otherwise. */ public function isLocked() { $lock = $this->getLock(); return $lock && $lock->getOwnerId() != \Drupal::currentUser()->id(); } /** * Passes through all unknown calls onto the storage object. */ public function __call($method, $args) { return call_user_func_array([$this->storage, $method], $args); } /** * {@inheritdoc} */ public function &getDisplay($display_id) { return $this->storage->getDisplay($display_id); } /** * {@inheritdoc} */ public function id() { return $this->storage->id(); } /** * {@inheritdoc} */ public function uuid() { return $this->storage->uuid(); } /** * {@inheritdoc} */ public function isNew() { return $this->storage->isNew(); } /** * {@inheritdoc} */ public function getEntityTypeId() { return $this->storage->getEntityTypeId(); } /** * {@inheritdoc} */ public function bundle() { return $this->storage->bundle(); } /** * {@inheritdoc} */ public function getEntityType() { return $this->storage->getEntityType(); } /** * {@inheritdoc} */ public function createDuplicate() { return $this->storage->createDuplicate(); } /** * {@inheritdoc} */ public static function load($id) { return View::load($id); } /** * {@inheritdoc} */ public static function loadMultiple(array $ids = NULL) { return View::loadMultiple($ids); } /** * {@inheritdoc} */ public static function create(array $values = []) { return View::create($values); } /** * {@inheritdoc} */ public function delete() { return $this->storage->delete(); } /** * {@inheritdoc} */ public function save() { return $this->storage->save(); } /** * {@inheritdoc} */ public function urlInfo($rel = 'edit-form', array $options = []) { return $this->storage->toUrl($rel, $options); } /** * {@inheritdoc} */ public function toUrl($rel = 'edit-form', array $options = []) { return $this->storage->toUrl($rel, $options); } /** * {@inheritdoc} */ public function link($text = NULL, $rel = 'edit-form', array $options = []) { return $this->storage->link($text, $rel, $options); } /** * {@inheritdoc} */ public function toLink($text = NULL, $rel = 'edit-form', array $options = []) { return $this->storage->toLink($text, $rel, $options); } /** * {@inheritdoc} */ public function label() { return $this->storage->label(); } /** * {@inheritdoc} */ public function enforceIsNew($value = TRUE) { return $this->storage->enforceIsNew($value); } /** * {@inheritdoc} */ public function toArray() { return $this->storage->toArray(); } /** * {@inheritdoc} */ public function language() { return $this->storage->language(); } /** * {@inheritdoc} */ public function access($operation = 'view', AccountInterface $account = NULL, $return_as_object = FALSE) { return $this->storage->access($operation, $account, $return_as_object); } /** * {@inheritdoc} */ public function enable() { return $this->storage->enable(); } /** * {@inheritdoc} */ public function disable() { return $this->storage->disable(); } /** * {@inheritdoc} */ public function status() { return $this->storage->status(); } /** * {@inheritdoc} */ public function getOriginalId() { return $this->storage->getOriginalId(); } /** * {@inheritdoc} */ public function setOriginalId($id) { return $this->storage->setOriginalId($id); } /** * {@inheritdoc} */ public function preSave(EntityStorageInterface $storage) { $this->storage->presave($storage); } /** * {@inheritdoc} */ public function postSave(EntityStorageInterface $storage, $update = TRUE) { $this->storage->postSave($storage, $update); } /** * {@inheritdoc} */ public static function preCreate(EntityStorageInterface $storage, array &$values) { } /** * {@inheritdoc} */ public function postCreate(EntityStorageInterface $storage) { $this->storage->postCreate($storage); } /** * {@inheritdoc} */ public static function preDelete(EntityStorageInterface $storage, array $entities) { } /** * {@inheritdoc} */ public static function postDelete(EntityStorageInterface $storage, array $entities) { } /** * {@inheritdoc} */ public static function postLoad(EntityStorageInterface $storage, array &$entities) { } /** * {@inheritdoc} */ public function getExecutable() { return $this->storage->getExecutable(); } /** * {@inheritdoc} */ public function duplicateDisplayAsType($old_display_id, $new_display_type) { return $this->storage->duplicateDisplayAsType($old_display_id, $new_display_type); } /** * {@inheritdoc} */ public function mergeDefaultDisplaysOptions() { $this->storage->mergeDefaultDisplaysOptions(); } /** * {@inheritdoc} */ public function uriRelationships() { return $this->storage->uriRelationships(); } /** * {@inheritdoc} */ public function referencedEntities() { return $this->storage->referencedEntities(); } /** * {@inheritdoc} */ public function url($rel = 'edit-form', $options = []) { return $this->storage->url($rel, $options); } /** * {@inheritdoc} */ public function hasLinkTemplate($key) { return $this->storage->hasLinkTemplate($key); } /** * {@inheritdoc} */ public function calculateDependencies() { $this->storage->calculateDependencies(); return $this; } /** * {@inheritdoc} */ public function getConfigDependencyKey() { return $this->storage->getConfigDependencyKey(); } /** * {@inheritdoc} */ public function getConfigDependencyName() { return $this->storage->getConfigDependencyName(); } /** * {@inheritdoc} */ public function getConfigTarget() { return $this->storage->getConfigTarget(); } /** * {@inheritdoc} */ public function onDependencyRemoval(array $dependencies) { return $this->storage->onDependencyRemoval($dependencies); } /** * {@inheritdoc} */ public function getDependencies() { return $this->storage->getDependencies(); } /** * {@inheritdoc} */ public function getCacheContexts() { return $this->storage->getCacheContexts(); } /** * {@inheritdoc} */ public function getCacheTags() { return $this->storage->getCacheTags(); } /** * {@inheritdoc} */ public function getCacheMaxAge() { return $this->storage->getCacheMaxAge(); } /** * {@inheritdoc} */ public function getTypedData() { $this->storage->getTypedData(); } /** * {@inheritdoc} */ public function addDisplay($plugin_id = 'page', $title = NULL, $id = NULL) { return $this->storage->addDisplay($plugin_id, $title, $id); } /** * {@inheritdoc} */ public function isInstallable() { return $this->storage->isInstallable(); } /** * {@inheritdoc} */ public function setThirdPartySetting($module, $key, $value) { return $this->storage->setThirdPartySetting($module, $key, $value); } /** * {@inheritdoc} */ public function getThirdPartySetting($module, $key, $default = NULL) { return $this->storage->getThirdPartySetting($module, $key, $default); } /** * {@inheritdoc} */ public function getThirdPartySettings($module) { return $this->storage->getThirdPartySettings($module); } /** * {@inheritdoc} */ public function unsetThirdPartySetting($module, $key) { return $this->storage->unsetThirdPartySetting($module, $key); } /** * {@inheritdoc} */ public function getThirdPartyProviders() { return $this->storage->getThirdPartyProviders(); } /** * {@inheritdoc} */ public function trustData() { return $this->storage->trustData(); } /** * {@inheritdoc} */ public function hasTrustedData() { return $this->storage->hasTrustedData(); } /** * {@inheritdoc} */ public function addCacheableDependency($other_object) { $this->storage->addCacheableDependency($other_object); return $this; } /** * {@inheritdoc} */ public function addCacheContexts(array $cache_contexts) { return $this->storage->addCacheContexts($cache_contexts); } /** * {@inheritdoc} */ public function mergeCacheMaxAge($max_age) { return $this->storage->mergeCacheMaxAge($max_age); } /** * {@inheritdoc} */ public function getCacheTagsToInvalidate() { return $this->storage->getCacheTagsToInvalidate(); } /** * {@inheritdoc} */ public function addCacheTags(array $cache_tags) { return $this->storage->addCacheTags($cache_tags); } /** * Gets the lock on this View. * * @return \Drupal\Core\TempStore\Lock|null * The lock, if one exists. */ public function getLock() { return $this->lock; } /** * Sets a lock on this View. * * @param \Drupal\Core\TempStore\Lock $lock * The lock object. * * @return $this */ public function setLock(Lock $lock) { $this->lock = $lock; return $this; } /** * Unsets the lock on this View. * * @return $this */ public function unsetLock() { $this->lock = NULL; return $this; } /** * {@inheritdoc} */ public function __set($name, $value) { if ($name === 'lock') { @trigger_error('Using the "lock" public property of a View is deprecated in Drupal 8.7.0 and will not be allowed in Drupal 9.0.0. Use \Drupal\views_ui\ViewUI::setLock() instead. See https://www.drupal.org/node/3025869.', E_USER_DEPRECATED); if ($value instanceof \stdClass && property_exists($value, 'owner') && property_exists($value, 'updated')) { $value = new Lock($value->owner, $value->updated); } $this->setLock($value); } else { $this->{$name} = $value; } } /** * {@inheritdoc} */ public function __get($name) { if ($name === 'lock') { @trigger_error('Using the "lock" public property of a View is deprecated in Drupal 8.7.0 and will not be allowed in Drupal 9.0.0. Use \Drupal\views_ui\ViewUI::getLock() instead. See https://www.drupal.org/node/3025869.', E_USER_DEPRECATED); return $this->getLock(); } } }
maskedjellybean/tee-prop
web/core/modules/views_ui/src/ViewUI.php
PHP
gpl-2.0
41,201
<?php defined( '_JEXEC') or die( 'Restricted Access' ); /** * 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_Pdf * @subpackage FileParser * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Image.php 23775 2011-03-01 17:25:24Z ralph $ */ /** Internally used classes */ /** Zend_Pdf_Image */ require_once 'Zend/Pdf/Image.php'; /** Zend_Pdf_FileParser */ require_once 'Zend/Pdf/FileParser.php'; /** * FileParser for Zend_Pdf_Image subclasses. * * @package Zend_Pdf * @subpackage FileParser * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Pdf_FileParser_Image extends Zend_Pdf_FileParser { /** * Image Type * * @var integer */ protected $imageType; /** * Object constructor. * * Validates the data source and enables debug logging if so configured. * * @param Zend_Pdf_FileParserDataSource $dataSource * @throws Zend_Pdf_Exception */ public function __construct(Zend_Pdf_FileParserDataSource $dataSource) { parent::__construct($dataSource); $this->imageType = Zend_Pdf_Image::TYPE_UNKNOWN; } }
epireve/joomla
plugins/system/zend/Zend/Pdf/FileParser/Image.php
PHP
gpl-2.0
1,820
#!/usr/bin/env python # -*- coding: utf-8 -*- # # || ____ _ __ # +------+ / __ )(_) /_______________ _____ ___ # | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \ # +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/ # || || /_____/_/\__/\___/_/ \__,_/ /___/\___/ # # Copyright (C) 2014 Bitcraze AB # # Crazyflie Nano Quadcopter Client # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. """ Find all the available input interfaces and try to initialize them. """ import os import glob import logging from ..inputreaderinterface import InputReaderInterface __author__ = 'Bitcraze AB' __all__ = ['InputInterface'] logger = logging.getLogger(__name__) found_interfaces = [os.path.splitext(os.path.basename(f))[0] for f in glob.glob(os.path.dirname(__file__) + "/[A-Za-z]*.py")] if len(found_interfaces) == 0: found_interfaces = [os.path.splitext(os.path.basename(f))[0] for f in glob.glob(os.path.dirname(__file__) + "/[A-Za-z]*.pyc")] logger.info("Found interfaces: {}".format(found_interfaces)) initialized_interfaces = [] available_interfaces = [] for interface in found_interfaces: try: module = __import__(interface, globals(), locals(), [interface], 1) main_name = getattr(module, "MODULE_MAIN") initialized_interfaces.append(getattr(module, main_name)()) logger.info("Successfully initialized [{}]".format(interface)) except Exception as e: logger.info("Could not initialize [{}]: {}".format(interface, e)) def devices(): # Todo: Support rescanning and adding/removing devices if len(available_interfaces) == 0: for reader in initialized_interfaces: devs = reader.devices() for dev in devs: available_interfaces.append(InputInterface( dev["name"], dev["id"], reader)) return available_interfaces class InputInterface(InputReaderInterface): def __init__(self, dev_name, dev_id, dev_reader): super(InputInterface, self).__init__(dev_name, dev_id, dev_reader) # These devices cannot be mapped and configured self.supports_mapping = False # Ask the reader if it wants to limit # roll/pitch/yaw/thrust for all devices self.limit_rp = dev_reader.limit_rp self.limit_thrust = dev_reader.limit_thrust self.limit_yaw = dev_reader.limit_yaw def open(self): self._reader.open(self.id) def close(self): self._reader.close(self.id) def read(self, include_raw=False): mydata = self._reader.read(self.id) # Merge interface returned data into InputReader Data Item for key in list(mydata.keys()): self.data.set(key, mydata[key]) return self.data
manojngb/Crazyfly_simple_lift
src/cfclient/utils/input/inputinterfaces/__init__.py
Python
gpl-2.0
3,515
<?php namespace Drupal\key\Element; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Render\Element\Select; use Drupal\Core\Url; /** * Provides a select form element that displays available keys. * * Properties: * - #empty_option: The label that will be displayed to denote no selection. * - #empty_value: The value of the option that is used to denote no selection. * - #key_filters: An array of filters to apply to the list of keys. * - #key_description: A boolean value that determines if information about * keys is added to the element's description. * * @FormElement("key_select") */ class KeySelect extends Select { /** * {@inheritdoc} */ public function getInfo() { $info = parent::getInfo(); $class = get_class($this); // Add a process function. array_unshift($info['#process'], [$class, 'processKeySelect']); // Add a property for key filters. $info['#key_filters'] = []; // Add a property for key description. $info['#key_description'] = TRUE; return $info; } /** * Processes a key select list form element. * * @param array $element * The form element to process. * @param \Drupal\Core\Form\FormStateInterface $form_state * The current state of the form. * @param array $complete_form * The complete form structure. * * @return array * The processed element. */ public static function processKeySelect(&$element, FormStateInterface $form_state, &$complete_form) { // Get the list of available keys and define the options. $options = \Drupal::service('key.repository')->getKeyNamesAsOptions($element['#key_filters']); $element['#options'] = $options; // Prefix the default description with information about keys, // unless disabled. if ($element['#key_description']) { $original_description = (isset($element['#description'])) ? $element['#description'] : ''; // @todo this causes escaping. $key_description = t('Choose an available key. If the desired key is not listed, <a href=":link">create a new key</a>.', [':link' => Url::fromRoute('entity.key.add_form')->toString()]); $element['#description'] = $key_description . ' ' . $original_description; } return $element; } }
CCI-Studios/ODEN
modules/key/src/Element/KeySelect.php
PHP
gpl-2.0
2,274
#include "libplatform/impl.h" namespace mp4v2 { namespace platform { namespace io { /////////////////////////////////////////////////////////////////////////////// class StandardFileProvider : public FileProvider { public: StandardFileProvider(); bool open( std::string name, Mode mode ); bool seek( Size pos ); bool read( void* buffer, Size size, Size& nin, Size maxChunkSize ); bool write( const void* buffer, Size size, Size& nout, Size maxChunkSize ); bool close(); private: bool _seekg; bool _seekp; std::fstream _fstream; }; /////////////////////////////////////////////////////////////////////////////// StandardFileProvider::StandardFileProvider() : _seekg ( false ) , _seekp ( false ) { } bool StandardFileProvider::open( std::string name, Mode mode ) { ios::openmode om = ios::binary; switch( mode ) { case MODE_UNDEFINED: case MODE_READ: default: om |= ios::in; _seekg = true; _seekp = false; break; case MODE_MODIFY: om |= ios::in | ios::out; _seekg = true; _seekp = true; break; case MODE_CREATE: om |= ios::in | ios::out | ios::trunc; _seekg = true; _seekp = true; break; } _fstream.open( name.c_str(), om ); return _fstream.fail(); } bool StandardFileProvider::seek( Size pos ) { if( _seekg ) _fstream.seekg( pos, ios::beg ); if( _seekp ) _fstream.seekp( pos, ios::beg ); return _fstream.fail(); } bool StandardFileProvider::read( void* buffer, Size size, Size& nin, Size maxChunkSize ) { _fstream.read( (char*)buffer, size ); if( _fstream.fail() ) return true; nin = _fstream.gcount(); return false; } bool StandardFileProvider::write( const void* buffer, Size size, Size& nout, Size maxChunkSize ) { _fstream.write( (const char*)buffer, size ); if( _fstream.fail() ) return true; nout = size; return false; } bool StandardFileProvider::close() { _fstream.close(); return _fstream.fail(); } /////////////////////////////////////////////////////////////////////////////// FileProvider& FileProvider::standard() { return *new StandardFileProvider(); } /////////////////////////////////////////////////////////////////////////////// }}} // namespace mp4v2::platform::io
opsemanthano/aacgain
mp4v2/libplatform/io/File_posix.cpp
C++
gpl-2.0
2,454
// Returns function that returns deferred or promise object. // // 1. If invoked without arguments then deferred object is returned // Deferred object consist of promise (unresolved) function and resolve // function through which we resolve promise // 2. If invoked with one argument then promise is returned which resolved value // is given argument. Argument may be any value (even undefined), // if it's promise then same promise is returned // 3. If invoked with more than one arguments then promise that resolves with // array of all resolved arguments is returned. 'use strict'; var isError = require('es5-ext/lib/Error/is-error') , validError = require('es5-ext/lib/Error/valid-error') , noop = require('es5-ext/lib/Function/noop') , isPromise = require('./is-promise') , every = Array.prototype.every, push = Array.prototype.push , Deferred, createDeferred, count = 0, timeout, extendShim, ext , protoSupported = Boolean(isPromise.__proto__); extendShim = function (promise) { ext._names.forEach(function (name) { promise[name] = function () { return promise.__proto__[name].apply(promise, arguments); }; }); promise.returnsPromise = true; promise.resolved = promise.__proto__.resolved; }; Deferred = function () { var promise = function (win, fail) { return promise.then(win, fail); }; if (!count) { timeout = setTimeout(noop, 1e9); } ++count; if (createDeferred._monitor) { promise.monitor = createDeferred._monitor(); } promise.__proto__ = ext._unresolved; if (!protoSupported) { extendShim(promise); } createDeferred._profile && createDeferred._profile(); this.promise = promise; this.resolve = this.resolve.bind(this); this.reject = this.reject.bind(this); }; Deferred.prototype = { resolved: false, resolve: function (value) { var i, name, data; if (this.resolved) { return this.promise; } this.resolved = true; if (!--count) { clearTimeout(timeout); } if (this.promise.monitor) { clearTimeout(this.promise.monitor); } if (isPromise(value)) { if (!value.resolved) { if (!value.dependencies) { value.dependencies = []; } value.dependencies.push(this.promise); if (this.promise.pending) { if (value.pending) { push.apply(value.pending, this.promise.pending); this.promise.pending = value.pending; if (this.promise.dependencies) { this.promise.dependencies.forEach(function self(dPromise) { dPromise.pending = value.pending; if (dPromise.dependencies) { dPromise.dependencies.forEach(self); } }); } } else { value.pending = this.promise.pending; } } else if (value.pending) { this.promise.pending = value.pending; } else { this.promise.pending = value.pending = []; } return this.promise; } else { value = value.value; } } this.promise.value = value; this.promise.failed = (value && isError(value)) || false; this.promise.__proto__ = ext._resolved; if (!protoSupported) { this.promise.resolved = true; } if (this.promise.dependencies) { this.promise.dependencies.forEach(function self(dPromise) { dPromise.value = value; dPromise.failed = this.failed; dPromise.__proto__ = ext._resolved; if (!protoSupported) { dPromise.resolved = true; } delete dPromise.pending; if (dPromise.dependencies) { dPromise.dependencies.forEach(self, this); delete dPromise.dependencies; } }, this.promise); delete this.promise.dependencies; } if ((data = this.promise.pending)) { for (i = 0; (name = data[i]); ++i) { ext._onresolve[name].apply(this.promise, data[++i]); } delete this.promise.pending; } return this.promise; }, reject: function (error) { return this.resolve(validError(error)); } }; module.exports = createDeferred = function (value) { var l, d, waiting, initialized, result, promise; if ((l = arguments.length)) { if (l > 1) { d = new Deferred(); waiting = 0; result = new Array(l); every.call(arguments, function (value, index) { if (isPromise(value)) { ++waiting; value.end(function (value) { result[index] = value; if (!--waiting && initialized) { d.resolve(result); } }, d.resolve); } else if (isError(value)) { d.resolve(value); return false; } else { result[index] = value; } return true; }); initialized = true; if (!waiting) { d.resolve(result); } return d.promise; } else if (isPromise(value)) { return value; } else { promise = function (win, fail) { return promise.then(win, fail); }; promise.value = value; promise.failed = isError(value); promise.__proto__ = ext._resolved; if (!protoSupported) { extendShim(promise); } createDeferred._profile && createDeferred._profile(true); return promise; } } return new Deferred(); }; createDeferred.Deferred = Deferred; ext = require('./_ext');
OliveAwesomesauz/pipe.js
node_modules/webmake/node_modules/deferred/lib/deferred.js
JavaScript
gpl-2.0
4,997
<?php /** * Very simple tooltip implementation for admin pages. * * Example usage: * <code> * if (!class_exists('WpmuDev_HelpTooltips')) require_once YOUR_PLUGIN_BASE_DIR . '/lib/external/class_wd_help_tooltips.php'; * $tips = new WpmuDev_HelpTooltips(); * $tips->set_icon_url("URL_TO_YOUR_ICON"); * echo $tips->add_tip("Tip 1 text here"); * // ... * echo $tips->add_tip("Tip 2 text here"); * </code> * This is a basic usage scenario. * * Alternative usage example: * <code> * if (!class_exists('WpmuDev_HelpTooltips')) require_once YOUR_PLUGIN_BASE_DIR . '/lib/external/class_wd_help_tooltips.php'; * $tips = new WpmuDev_HelpTooltips(); * $tips->set_icon_url("URL_TO_YOUR_ICON"); * $tips->bind_tip('My tip text here', '.icon32:first ~h2'); * // Note that you don't echo anything in this usage example - the tip will be * // added automatically next to the supplied selector (second argument) * </code> * This scenario may be useful for e.g. adding our tips to UI elements created by WP or other plugins. * You can freely alternate between add_tip() and bind_tip() methods, * just remember to echo add_tip() and *not* echo bind_tip(). * * Another alternative usage example, setting tips for multiple pages in one place: * <code> * if (!class_exists('WpmuDev_HelpTooltips')) require_once YOUR_PLUGIN_BASE_DIR . '/lib/external/class_wd_help_tooltips.php'; * // Tips added to $tips1 object will only show on Social Marketing add/edit advert page * $tips1 = new WpmuDev_HelpTooltips(); * $tips1->set_icon_url("URL_TO_YOUR_ICON"); * $tips1->set_screen_id("social_marketing_ad"); * $tips1->bind_tip('My tip 1 text here', '.icon32:first ~h2'); * // ... * // Tips added to $tips2 object will only show on Social Marketing getting started page * $tips2 = new WpmuDev_HelpTooltips(); * $tips2->set_icon_url("URL_TO_YOUR_ICON"); * $tips2->set_screen_id("social_marketing_ad_page_wdsm-get_started"); * $tips2->bind_tip('My tip 2 text here', '.icon32:first ~h2'); * </code> * Using add_tip() method will do nothing in this last scenario, as it doesn't make sense in that context. * This scenario may be useful for adding tooltips to all pages in one central location. * E.g. for adding tooltips in a plugin add-on. */ class WpmuDev_HelpTooltips { /** * Holds an array of inline tips: used as dependency inclusion switch. */ private $_inline_tips = array(); /** * Holds an array of bound tips: used as dependency inclusion switch and bound tips buffer. */ private $_bound_tips = array(); /** * Holds an array of bound tips selectors: used as bound tips selectors buffer. */ private $_bound_selectors = array(); /** * Full URL to help icon, which is used as tip anchor * and as notice background image. */ private $_icon_url; /** * Flag that determines do we want to use notices * (tips expanded on click). * Defaults to true. */ private $_use_notice = true; /** * Limits tip output to a screen (page). * Optional. * Works best with bind_tip() method. */ private $_screen_id = false; /** * Bind to footer hooks when instantiated. */ public function __construct () { global $wp_version; $version = preg_replace('/-.*$/', '', $wp_version); if (version_compare($version, '3.3', '>=')) { add_action('admin_footer', array($this, 'add_bound_tips'), 999); add_action('admin_print_footer_scripts', array($this, 'initialize')); } } /** * Sets icon URL. * @param string $icon_url Full URL to help anchor icon */ public function set_icon_url ($icon_url) { $this->_icon_url = $icon_url; } /** * Set show notices (tips expanded on click) flag. * @param bool $use_notice True to use notices (default), false otherwise. */ public function set_use_notice ($use_notice=true) { $this->_use_notice = $use_notice; } /** * Set screen limiting flag. * @param $screen_id Screen ID that tips in this object apply to. */ public function set_screen_id ($screen_id) { $this->_screen_id = $screen_id; } /** * Returns inline tip markup. * Scenario: for echoing inline tips next to elements on the page. * Usage example: * <code> * echo $tips->add_tip('My tip text here'); * </code> * @param string $tip Tip text * @return string Inline tip markup */ public function add_tip ($tip) { if (!$this->_check_screen()) return false; $this->_inline_tips[] = $tip; return $this->_get_tip_markup($tip); } /** * Binds a tip to selector. * This is different from inline tips, as you don't have to output them yourself. * Scenario: for adding help tips next to elements determined by the selector on page load time. * Usage example: * <code> * $tips->bind_tip('My tip text here', '.icon32:first ~h2'); * </code> * @param string $tip Tip text * @param string $selector jQuery selector of the element that tip is related to. */ public function bind_tip ($tip, $bind_to_selector) { $tip_id = 'wpmudev-help-tip-for-' . md5($bind_to_selector); $this->_bound_tips[$tip_id] = $tip; $this->_bound_selectors[$tip_id] = $bind_to_selector; } /** * Bounded tips injection handler. * Will queue up the bounded tips. */ function add_bound_tips () { if (!$this->_check_screen()) return false; if (!$this->_bound_tips) return false; foreach ($this->_bound_tips as $id => $tip) { echo $this->_get_tip_markup($tip, 'id="' . $id . '" style=display:none'); } } /** * Dependency injection handler. * Will only add dependencies if there are actual tooltips to show. */ function initialize () { if (!$this->_check_screen()) return false; if (!$this->_inline_tips && !$this->_bound_tips) return false; $this->_print_styles(); $this->_print_scripts(); } /** * Screen limitation check. * @return bool True if we're good to go, false if we're on a wrong screen. */ private function _check_screen () { if (!$this->_screen_id) return true; // No screen dependency $screen = get_current_screen(); if (!is_object($screen)) return false; // Actually older then 3.3 if ($this->_screen_id != @$screen->id) return false; // Not for this screen return true; } private function _get_tip_markup ($tip, $arg='') { return "<span class='wpmudev-help' {$arg}>{$tip}</span>"; } /** * Private helper method that prints style dependencies. */ private function _print_styles () { // Have we already done this? if (!defined('WPMUDEV_TOOLTIPS_CSS_ADDED')) define('WPMUDEV_TOOLTIPS_CSS_ADDED', true); else return false; ?> <style type="text/css"> .wpmudev-help { display: block; background-color: #ffffe0; border: 1px solid #e6db55; padding: 1em 1em; -moz-border-radius:3px; -khtml-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; } <?php if ($this->_icon_url) { ?> .wpmudev-help { background: url(<?php echo $this->_icon_url; ?>) no-repeat scroll 10px center #ffffe0; padding-left: 40px; } .wpmudev-help-trigger span { display: block; position: absolute; left: -12000000px; } .wpmudev-help-trigger { position: relative; background: url(<?php echo $this->_icon_url; ?>) no-repeat scroll center bottom transparent; padding: 1px 12px; text-decoration: none; } <?php } ?> #wpmudev-tooltip-source { margin: 0 13px; padding: 8px; background: #fff; border-style: solid; border-width: 1px; /* Fallback for non-rgba-compliant browsers */ border-color: #dfdfdf; /* Use rgba to look better against non-white backgrounds. */ border-color: rgba(0,0,0,.125); -webkit-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: 0 2px 4px rgba(0,0,0,.19); -moz-box-shadow: 0 2px 4px rgba(0,0,0,.19); box-shadow: 0 2px 4px rgba(0,0,0,.19); } .wpmudev-left_pointer { float: left; width: 14px; height: 30px; margin-top: 8px; background: url(<?php echo site_url("/wp-includes/images/arrow-pointer-blue.png");?>) 0 -15px no-repeat; } .wpmudev-right_pointer { float: right; width: 14px; height: 30px; margin-top: 8px; background: url(<?php echo site_url("/wp-includes/images/arrow-pointer-blue.png");?>) -16px -15px no-repeat; } </style> <?php } /** * Private helper method that prints javascript dependencies. */ private function _print_scripts () { // Have we already done this? if (!defined('WPMUDEV_TOOLTIPS_JS_ADDED')) define('WPMUDEV_TOOLTIPS_JS_ADDED', true); else return false; // Initialize bound selectors $selectors = json_encode($this->_bound_selectors); ?> <script type="text/javascript"> (function ($) { /** * Converts help text placeholders to tooltip items. */ function initialize_help_item ($me) { var $prev = $me.prev(); var help = '&nbsp;<a class="wpmudev-help-trigger" href="#help"><span><?php _e('Help');?></span></a>'; $prev = $prev.length ? $prev.after(help) : $me.before(help) ; $me.hide(); } /** * Finds a help block corresponding to trigger. */ function get_help_block ($me) { var $parent = $me.parent(); return $parent.find('.wpmudev-help'); } /** * Handles help block visibility. */ function show_help_block ($me) { var $help = get_help_block($me); if (!$help.length) return false; if ($("#wpmudev-tooltip").length) $("#wpmudev-tooltip").remove(); if ($help.is(":visible")) $help.hide('fast'); else $help.show('fast'); } /** * Pops tooltip open. */ function open_tooltip ($me) { var $help = get_help_block($me); if ($help.is(":visible")) return false; if ($("#wpmudev-tooltip").length) $("#wpmudev-tooltip").remove(); if (!$("#wpmudev-tooltip").length) $("body").append('<div id="wpmudev-tooltip"><div class="wpmudev-pointer wpmudev-left_pointer"></div><div id="wpmudev-tooltip-source"></div></div>'); var $tip = $("#wpmudev-tooltip"); if (!$tip.length) return false; var width = 200; var margin = 20; var src_pos = $me.offset(); var top_pos = src_pos.top + ($me.height() / 2); var left_pos = src_pos.left + margin; var $pointer = $tip.find(".wpmudev-pointer"); // Setup left/right orientation <?php if (!is_rtl()) { ?> if ((left_pos+width+60) >= $(window).width()) { left_pos = src_pos.left - ($me.outerWidth()+width+margin); $pointer .removeClass("wpmudev-left_pointer") .addClass("wpmudev-right_pointer") ; } <?php } else { ?> var min_left = left_pos - (width+60); if (min_left > 0) { left_pos = min_left; $pointer .removeClass("wpmudev-left_pointer") .addClass("wpmudev-right_pointer") ; } <?php } ?> // IE safeguard if ($.browser.msie) { var $pointer_left = $tip.find(".wpmudev-left_pointer"); if ($pointer_left.length) $pointer_left.css("position", "absolute"); } $tip // Populate tip text .find("#wpmudev-tooltip-source") .width(width) .html($help.html()) .end() // Position tip .css({ "position": "absolute", }) .offset({ "top": top_pos - ($tip.height()/2), "left": left_pos }) // Vertically align pointer .find(".wpmudev-pointer") .css({ "margin-top": ($tip.height() - 32) / 2 }) .end() // Show entire tip .show() ; } /** * Closes tooltip. */ function close_tooltip () { if (!$("#wpmudev-tooltip").length) return false; // IE conditional alternate removal if ($.browser.msie) { $("#wpmudev-tooltip").hide('fast'); } else { // Not IE, do regular transparency animation $("#wpmudev-tooltip") .animate({ "opacity": 0 }, 'fast', function () { $(this).remove(); } ); } } // Init $(function () { // Populate and place bound tips $.each($.parseJSON('<?php echo $selectors; ?>'), function (tip_id, selector) { var $tip = $("#" + tip_id); if (!$tip.length) return true; var $selector = $(selector); if (!$selector.length) return true; $selector.append($tip); }); // Initialize help and add handles $(".wpmudev-help").each(function () { initialize_help_item($(this)); }); // Handle help requests $(".wpmudev-help-trigger") .click(function (e) { <?php if ($this->_use_notice) { ?> show_help_block($(this)); <?php } ?> return false; }) .mouseover(function (e) { open_tooltip($(this)); }) .mouseout(close_tooltip) ; }); })(jQuery); </script> <?php } }
m-godefroid76/devrestofactory
wp-content/plugins/wpmu-dev-facebook/lib/external/class_wd_help_tooltips.php
PHP
gpl-2.0
12,505
/** * ScriptDev2 is an extension for mangos providing enhanced features for * area triggers, creatures, game objects, instances, items, and spells beyond * the default database scripting in mangos. * * Copyright (C) 2006-2013 ScriptDev2 <http://www.scriptdev2.com/> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * World of Warcraft, and all World of Warcraft or Warcraft art, images, * and lore are copyrighted by Blizzard Entertainment, Inc. */ /** * ScriptData * SDName: Teldrassil * SD%Complete: 100 * SDComment: Quest support: 938 * SDCategory: Teldrassil * EndScriptData */ /** * ContentData * npc_mist * EndContentData */ #include "precompiled.h" #include "follower_ai.h" /*#### # npc_mist ####*/ enum { SAY_AT_HOME = -1000323, EMOTE_AT_HOME = -1000324, QUEST_MIST = 938, NPC_ARYNIA = 3519, FACTION_DARNASSUS = 79 }; struct npc_mistAI : public FollowerAI { npc_mistAI(Creature* pCreature) : FollowerAI(pCreature) { Reset(); } void Reset() override { } void MoveInLineOfSight(Unit* pWho) override { FollowerAI::MoveInLineOfSight(pWho); if (!m_creature->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_ARYNIA) { if (m_creature->IsWithinDistInMap(pWho, 10.0f)) { DoScriptText(SAY_AT_HOME, pWho); DoComplete(); } } } void DoComplete() { DoScriptText(EMOTE_AT_HOME, m_creature); if (Player* pPlayer = GetLeaderForFollower()) { if (pPlayer->GetQuestStatus(QUEST_MIST) == QUEST_STATUS_INCOMPLETE) { pPlayer->GroupEventHappens(QUEST_MIST, m_creature); } } // The follow is over (and for later development, run off to the woods before really end) SetFollowComplete(); } // call not needed here, no known abilities /*void UpdateFollowerAI(const uint32 uiDiff) override { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; DoMeleeAttackIfReady(); }*/ }; CreatureAI* GetAI_npc_mist(Creature* pCreature) { return new npc_mistAI(pCreature); } bool QuestAccept_npc_mist(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { if (pQuest->GetQuestId() == QUEST_MIST) { if (npc_mistAI* pMistAI = dynamic_cast<npc_mistAI*>(pCreature->AI())) { pMistAI->StartFollow(pPlayer, FACTION_DARNASSUS, pQuest); } } return true; } void AddSC_teldrassil() { Script* pNewScript; pNewScript = new Script; pNewScript->Name = "npc_mist"; pNewScript->GetAI = &GetAI_npc_mist; pNewScript->pQuestAcceptNPC = &QuestAccept_npc_mist; pNewScript->RegisterSelf(); }
lucasdnd/mangoszero-bots-test
src/modules/SD2/scripts/kalimdor/teldrassil.cpp
C++
gpl-2.0
3,543
<?php /** * Accepts file uploads from swfupload or other asynchronous upload methods. * * @package WordPress * @subpackage Administration */ define('WP_ADMIN', true); if ( defined('ABSPATH') ) require_once(ABSPATH . 'wp-load.php'); else require_once('../wp-load.php'); // Flash often fails to send cookies with the POST or upload, so we need to pass it in GET or POST instead if ( is_ssl() && empty($_COOKIE[SECURE_AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) ) $_COOKIE[SECURE_AUTH_COOKIE] = $_REQUEST['auth_cookie']; elseif ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) ) $_COOKIE[AUTH_COOKIE] = $_REQUEST['auth_cookie']; if ( empty($_COOKIE[LOGGED_IN_COOKIE]) && !empty($_REQUEST['logged_in_cookie']) ) $_COOKIE[LOGGED_IN_COOKIE] = $_REQUEST['logged_in_cookie']; unset($current_user); require_once('./admin.php'); header('Content-Type: text/plain; charset=' . get_option('blog_charset')); if ( !current_user_can('upload_files') ) wp_die(__('You do not have permission to upload files.')); // just fetch the detail form for that attachment if ( isset($_REQUEST['attachment_id']) && ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) { if ( 2 == $_REQUEST['fetch'] ) { add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2); echo get_media_item($id, array( 'send' => false, 'delete' => true )); } else { add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2); echo get_media_item($id); } exit; } check_admin_referer('media-form'); $id = media_handle_upload('async-upload', $_REQUEST['post_id']); if ( is_wp_error($id) ) { echo '<div class="error-div"> <a class="dismiss" href="#" onclick="jQuery(this).parents(\'div.media-item\').slideUp(200, function(){jQuery(this).remove();});">' . __('Dismiss') . '</a> <strong>' . sprintf(__('&#8220;%s&#8221; has failed to upload due to an error'), esc_html($_FILES['async-upload']['name']) ) . '</strong><br />' . esc_html($id->get_error_message()) . '</div>'; exit; } if ( $_REQUEST['short'] ) { // short form response - attachment ID only echo $id; } else { // long form response - big chunk o html $type = $_REQUEST['type']; echo apply_filters("async_upload_{$type}", $id); } ?>
yodanielo/madara
wp-admin/async-upload.php
PHP
gpl-2.0
2,344
// Copyright 2014 Dolphin Emulator Project // Licensed under GPLv2 // Refer to the license.txt file included. #include "Common/Arm64Emitter.h" #include "Common/Common.h" #include "Core/Core.h" #include "Core/CoreTiming.h" #include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PPCTables.h" #include "Core/PowerPC/JitArm64/Jit.h" #include "Core/PowerPC/JitArm64/JitArm64_RegCache.h" #include "Core/PowerPC/JitArm64/JitAsm.h" using namespace Arm64Gen; void JitArm64::ComputeRC(ARM64Reg reg, int crf) { ARM64Reg WA = gpr.GetReg(); ARM64Reg XA = EncodeRegTo64(WA); SXTW(XA, reg); STR(INDEX_UNSIGNED, XA, X29, PPCSTATE_OFF(cr_val[crf])); gpr.Unlock(WA); } void JitArm64::ComputeRC(u32 imm, int crf) { ARM64Reg WA = gpr.GetReg(); ARM64Reg XA = EncodeRegTo64(WA); MOVI2R(XA, imm); if (imm & 0x80000000) SXTW(XA, WA); STR(INDEX_UNSIGNED, XA, X29, PPCSTATE_OFF(cr_val[crf])); gpr.Unlock(WA); } void JitArm64::ComputeCarry(bool Carry) { if (Carry) { ARM64Reg WA = gpr.GetReg(); MOVI2R(WA, 1); STRB(INDEX_UNSIGNED, WA, X29, PPCSTATE_OFF(xer_ca)); gpr.Unlock(WA); return; } STRB(INDEX_UNSIGNED, WSP, X29, PPCSTATE_OFF(xer_ca)); } void JitArm64::ComputeCarry() { ARM64Reg WA = gpr.GetReg(); CSINC(WA, WSP, WSP, CC_CC); STRB(INDEX_UNSIGNED, WA, X29, PPCSTATE_OFF(xer_ca)); gpr.Unlock(WA); } // Following static functions are used in conjunction with reg_imm static u32 Add(u32 a, u32 b) { return a + b; } static u32 Or(u32 a, u32 b) { return a | b; } static u32 And(u32 a, u32 b) { return a & b; } static u32 Xor(u32 a, u32 b) { return a ^ b; } void JitArm64::reg_imm(u32 d, u32 a, bool binary, u32 value, Operation do_op, void (ARM64XEmitter::*op)(ARM64Reg, ARM64Reg, ARM64Reg, ArithOption), bool Rc) { if (a || binary) { if (gpr.IsImm(a)) { gpr.SetImmediate(d, do_op(gpr.GetImm(a), value)); if (Rc) ComputeRC(gpr.GetImm(d)); } else { gpr.BindToRegister(d, d == a); ARM64Reg WA = gpr.GetReg(); MOVI2R(WA, value); (this->*op)(gpr.R(d), gpr.R(a), WA, ArithOption(WA, ST_LSL, 0)); gpr.Unlock(WA); if (Rc) ComputeRC(gpr.R(d), 0); } } else if (do_op == Add) { // a == 0, implies zero register gpr.SetImmediate(d, value); if (Rc) ComputeRC(value, 0); } else { _assert_msg_(DYNA_REC, false, "Hit impossible condition in reg_imm!"); } } void JitArm64::arith_imm(UGeckoInstruction inst) { INSTRUCTION_START JITDISABLE(bJITIntegerOff); u32 d = inst.RD, a = inst.RA, s = inst.RS; switch (inst.OPCD) { case 14: // addi reg_imm(d, a, false, (u32)(s32)inst.SIMM_16, Add, &ARM64XEmitter::ADD); break; case 15: // addis reg_imm(d, a, false, (u32)inst.SIMM_16 << 16, Add, &ARM64XEmitter::ADD); break; case 24: // ori if (a == 0 && s == 0 && inst.UIMM == 0 && !inst.Rc) //check for nop { // NOP return; } reg_imm(a, s, true, inst.UIMM, Or, &ARM64XEmitter::ORR); break; case 25: // oris reg_imm(a, s, true, inst.UIMM << 16, Or, &ARM64XEmitter::ORR); break; case 28: // andi reg_imm(a, s, true, inst.UIMM, And, &ARM64XEmitter::AND, true); break; case 29: // andis reg_imm(a, s, true, inst.UIMM << 16, And, &ARM64XEmitter::AND, true); break; case 26: // xori reg_imm(a, s, true, inst.UIMM, Xor, &ARM64XEmitter::EOR); break; case 27: // xoris reg_imm(a, s, true, inst.UIMM << 16, Xor, &ARM64XEmitter::EOR); break; } } void JitArm64::boolX(UGeckoInstruction inst) { INSTRUCTION_START JITDISABLE(bJITIntegerOff); int a = inst.RA, s = inst.RS, b = inst.RB; if (gpr.IsImm(s) && gpr.IsImm(b)) { if (inst.SUBOP10 == 28) // andx gpr.SetImmediate(a, (u32)gpr.GetImm(s) & (u32)gpr.GetImm(b)); else if (inst.SUBOP10 == 476) // nandx gpr.SetImmediate(a, ~((u32)gpr.GetImm(s) & (u32)gpr.GetImm(b))); else if (inst.SUBOP10 == 60) // andcx gpr.SetImmediate(a, (u32)gpr.GetImm(s) & (~(u32)gpr.GetImm(b))); else if (inst.SUBOP10 == 444) // orx gpr.SetImmediate(a, (u32)gpr.GetImm(s) | (u32)gpr.GetImm(b)); else if (inst.SUBOP10 == 124) // norx gpr.SetImmediate(a, ~((u32)gpr.GetImm(s) | (u32)gpr.GetImm(b))); else if (inst.SUBOP10 == 412) // orcx gpr.SetImmediate(a, (u32)gpr.GetImm(s) | (~(u32)gpr.GetImm(b))); else if (inst.SUBOP10 == 316) // xorx gpr.SetImmediate(a, (u32)gpr.GetImm(s) ^ (u32)gpr.GetImm(b)); else if (inst.SUBOP10 == 284) // eqvx gpr.SetImmediate(a, ~((u32)gpr.GetImm(s) ^ (u32)gpr.GetImm(b))); if (inst.Rc) ComputeRC(gpr.GetImm(a), 0); } else if (s == b) { if ((inst.SUBOP10 == 28 /* andx */) || (inst.SUBOP10 == 444 /* orx */)) { if (a != s) { gpr.BindToRegister(a, false); MOV(gpr.R(a), gpr.R(s)); } if (inst.Rc) ComputeRC(gpr.R(a)); } else if ((inst.SUBOP10 == 476 /* nandx */) || (inst.SUBOP10 == 124 /* norx */)) { gpr.BindToRegister(a, a == s); MVN(gpr.R(a), gpr.R(s)); if (inst.Rc) ComputeRC(gpr.R(a)); } else if ((inst.SUBOP10 == 412 /* orcx */) || (inst.SUBOP10 == 284 /* eqvx */)) { gpr.SetImmediate(a, 0xFFFFFFFF); if (inst.Rc) ComputeRC(gpr.GetImm(a), 0); } else if ((inst.SUBOP10 == 60 /* andcx */) || (inst.SUBOP10 == 316 /* xorx */)) { gpr.SetImmediate(a, 0); if (inst.Rc) ComputeRC(gpr.GetImm(a), 0); } else { PanicAlert("WTF!"); } } else { gpr.BindToRegister(a, (a == s) || (a == b)); if (inst.SUBOP10 == 28) // andx { AND(gpr.R(a), gpr.R(s), gpr.R(b), ArithOption(gpr.R(a), ST_LSL, 0)); } else if (inst.SUBOP10 == 476) // nandx { AND(gpr.R(a), gpr.R(s), gpr.R(b), ArithOption(gpr.R(a), ST_LSL, 0)); MVN(gpr.R(a), gpr.R(a)); } else if (inst.SUBOP10 == 60) // andcx { BIC(gpr.R(a), gpr.R(s), gpr.R(b), ArithOption(gpr.R(a), ST_LSL, 0)); } else if (inst.SUBOP10 == 444) // orx { ORR(gpr.R(a), gpr.R(s), gpr.R(b), ArithOption(gpr.R(a), ST_LSL, 0)); } else if (inst.SUBOP10 == 124) // norx { ORR(gpr.R(a), gpr.R(s), gpr.R(b), ArithOption(gpr.R(a), ST_LSL, 0)); MVN(gpr.R(a), gpr.R(a)); } else if (inst.SUBOP10 == 412) // orcx { ORN(gpr.R(a), gpr.R(s), gpr.R(b), ArithOption(gpr.R(a), ST_LSL, 0)); } else if (inst.SUBOP10 == 316) // xorx { EOR(gpr.R(a), gpr.R(s), gpr.R(b), ArithOption(gpr.R(a), ST_LSL, 0)); } else if (inst.SUBOP10 == 284) // eqvx { EON(gpr.R(a), gpr.R(b), gpr.R(s), ArithOption(gpr.R(a), ST_LSL, 0)); } else { PanicAlert("WTF!"); } if (inst.Rc) ComputeRC(gpr.R(a), 0); } } void JitArm64::addx(UGeckoInstruction inst) { INSTRUCTION_START JITDISABLE(bJITIntegerOff); FALLBACK_IF(inst.OE); int a = inst.RA, b = inst.RB, d = inst.RD; if (gpr.IsImm(a) && gpr.IsImm(b)) { s32 i = (s32)gpr.GetImm(a), j = (s32)gpr.GetImm(b); gpr.SetImmediate(d, i + j); if (inst.Rc) ComputeRC(gpr.GetImm(d), 0); } else { ADD(gpr.R(d), gpr.R(a), gpr.R(b)); if (inst.Rc) ComputeRC(gpr.R(d), 0); } } void JitArm64::extsXx(UGeckoInstruction inst) { INSTRUCTION_START JITDISABLE(bJITIntegerOff); int a = inst.RA, s = inst.RS; int size = inst.SUBOP10 == 922 ? 16 : 8; gpr.BindToRegister(a, a == s); if (gpr.IsImm(s)) { gpr.SetImmediate(a, (u32)(s32)(size == 16 ? (s16)gpr.GetImm(s) : (s8)gpr.GetImm(s))); if (inst.Rc) ComputeRC(gpr.GetImm(a), 0); } else { SBFM(gpr.R(a), gpr.R(s), 0, size - 1); if (inst.Rc) ComputeRC(gpr.R(a), 0); } } void JitArm64::cntlzwx(UGeckoInstruction inst) { INSTRUCTION_START JITDISABLE(bJITIntegerOff); int a = inst.RA; int s = inst.RS; gpr.BindToRegister(a, a == s); if (gpr.IsImm(s)) { gpr.SetImmediate(a, __builtin_clz(gpr.GetImm(s))); if (inst.Rc) ComputeRC(gpr.GetImm(a), 0); } else { CLZ(gpr.R(a), gpr.R(s)); if (inst.Rc) ComputeRC(gpr.R(a), 0); } } void JitArm64::negx(UGeckoInstruction inst) { INSTRUCTION_START JITDISABLE(bJITIntegerOff); int a = inst.RA; int d = inst.RD; FALLBACK_IF(inst.OE); gpr.BindToRegister(d, d == a); if (gpr.IsImm(a)) { gpr.SetImmediate(d, ~((u32)gpr.GetImm(a)) + 1); if (inst.Rc) ComputeRC(gpr.GetImm(d), 0); } else { SUB(gpr.R(d), WSP, gpr.R(a), ArithOption(gpr.R(a), ST_LSL, 0)); if (inst.Rc) ComputeRC(gpr.R(d), 0); } } void JitArm64::cmp(UGeckoInstruction inst) { INSTRUCTION_START JITDISABLE(bJITIntegerOff); int crf = inst.CRFD; u32 a = inst.RA, b = inst.RB; if (gpr.IsImm(a) && gpr.IsImm(b)) { ComputeRC((s32)gpr.GetImm(a) - (s32)gpr.GetImm(b), crf); return; } ARM64Reg WA = gpr.GetReg(); ARM64Reg WB = gpr.GetReg(); ARM64Reg XA = EncodeRegTo64(WA); ARM64Reg XB = EncodeRegTo64(WB); ARM64Reg RA = gpr.R(a); ARM64Reg RB = gpr.R(b); SXTW(XA, RA); SXTW(XB, RB); SUB(XA, XA, XB); STR(INDEX_UNSIGNED, XA, X29, PPCSTATE_OFF(cr_val[0]) + (sizeof(PowerPC::ppcState.cr_val[0]) * crf)); gpr.Unlock(WA, WB); } void JitArm64::cmpl(UGeckoInstruction inst) { INSTRUCTION_START JITDISABLE(bJITIntegerOff); int crf = inst.CRFD; u32 a = inst.RA, b = inst.RB; if (gpr.IsImm(a) && gpr.IsImm(b)) { ComputeRC(gpr.GetImm(a) - gpr.GetImm(b), crf); return; } else if (gpr.IsImm(b) && !gpr.GetImm(b)) { ComputeRC(gpr.R(a), crf); return; } ARM64Reg WA = gpr.GetReg(); ARM64Reg XA = EncodeRegTo64(WA); SUB(XA, EncodeRegTo64(gpr.R(a)), EncodeRegTo64(gpr.R(b))); STR(INDEX_UNSIGNED, XA, X29, PPCSTATE_OFF(cr_val[0]) + (sizeof(PowerPC::ppcState.cr_val[0]) * crf)); gpr.Unlock(WA); } void JitArm64::cmpi(UGeckoInstruction inst) { INSTRUCTION_START JITDISABLE(bJITIntegerOff); u32 a = inst.RA; int crf = inst.CRFD; if (gpr.IsImm(a)) { ComputeRC((s32)gpr.GetImm(a) - inst.SIMM_16, crf); return; } ARM64Reg WA = gpr.GetReg(); if (inst.SIMM_16 >= 0 && inst.SIMM_16 < 4096) { SUB(WA, gpr.R(a), inst.SIMM_16); } else { MOVI2R(WA, inst.SIMM_16); SUB(WA, gpr.R(a), WA); } ComputeRC(WA, crf); gpr.Unlock(WA); } void JitArm64::cmpli(UGeckoInstruction inst) { INSTRUCTION_START JITDISABLE(bJITIntegerOff); u32 a = inst.RA; int crf = inst.CRFD; if (gpr.IsImm(a)) { ComputeRC(gpr.GetImm(a) - inst.UIMM, crf); return; } if (!inst.UIMM) { ComputeRC(gpr.R(a), crf); return; } ARM64Reg WA = gpr.GetReg(); ARM64Reg XA = EncodeRegTo64(WA); if (inst.UIMM < 4096) { SUB(XA, EncodeRegTo64(gpr.R(a)), inst.UIMM); } else { MOVI2R(WA, inst.UIMM); SUB(XA, EncodeRegTo64(gpr.R(a)), XA); } STR(INDEX_UNSIGNED, XA, X29, PPCSTATE_OFF(cr_val[0]) + (sizeof(PowerPC::ppcState.cr_val[0]) * crf)); gpr.Unlock(WA); } void JitArm64::rlwinmx(UGeckoInstruction inst) { INSTRUCTION_START JITDISABLE(bJITIntegerOff); u32 mask = Helper_Mask(inst.MB,inst.ME); if (gpr.IsImm(inst.RS)) { gpr.SetImmediate(inst.RA, _rotl(gpr.GetImm(inst.RS), inst.SH) & mask); if (inst.Rc) ComputeRC(gpr.GetImm(inst.RA), 0); return; } gpr.BindToRegister(inst.RA, inst.RA == inst.RS); ARM64Reg WA = gpr.GetReg(); ArithOption Shift(gpr.R(inst.RS), ST_ROR, 32 - inst.SH); MOVI2R(WA, mask); AND(gpr.R(inst.RA), WA, gpr.R(inst.RS), Shift); gpr.Unlock(WA); if (inst.Rc) ComputeRC(gpr.R(inst.RA), 0); } void JitArm64::srawix(UGeckoInstruction inst) { INSTRUCTION_START JITDISABLE(bJITIntegerOff); int a = inst.RA; int s = inst.RS; int amount = inst.SH; if (gpr.IsImm(s)) { s32 imm = (s32)gpr.GetImm(s); gpr.SetImmediate(a, imm >> amount); if (amount != 0 && (imm < 0) && (imm << (32 - amount))) ComputeCarry(true); else ComputeCarry(false); } else if (amount != 0) { gpr.BindToRegister(a, a == s); ARM64Reg RA = gpr.R(a); ARM64Reg RS = gpr.R(s); ARM64Reg WA = gpr.GetReg(); ORR(WA, WSP, RS, ArithOption(RS, ST_LSL, 32 - amount)); ORR(RA, WSP, RS, ArithOption(RS, ST_ASR, amount)); if (inst.Rc) ComputeRC(RA, 0); ANDS(WSP, WA, RA, ArithOption(RA, ST_LSL, 0)); CSINC(WA, WSP, WSP, CC_EQ); STRB(INDEX_UNSIGNED, WA, X29, PPCSTATE_OFF(xer_ca)); gpr.Unlock(WA); } else { gpr.BindToRegister(a, a == s); ARM64Reg RA = gpr.R(a); ARM64Reg RS = gpr.R(s); MOV(RA, RS); STRB(INDEX_UNSIGNED, WSP, X29, PPCSTATE_OFF(xer_ca)); } } void JitArm64::addic(UGeckoInstruction inst) { INSTRUCTION_START JITDISABLE(bJITIntegerOff); int a = inst.RA, d = inst.RD; bool rc = inst.OPCD == 13; s32 simm = inst.SIMM_16; u32 imm = (u32)simm; if (gpr.IsImm(a)) { u32 i = gpr.GetImm(a); gpr.SetImmediate(d, i + imm); bool has_carry = Interpreter::Helper_Carry(i, imm); ComputeCarry(has_carry); if (rc) ComputeRC(gpr.GetImm(d), 0); } else { gpr.BindToRegister(d, d == a); if (imm < 4096) { ADDS(gpr.R(d), gpr.R(a), imm); } else if (simm > -4096 && simm < 0) { SUBS(gpr.R(d), gpr.R(a), std::abs(simm)); } else { ARM64Reg WA = gpr.GetReg(); MOVI2R(WA, imm); ADDS(gpr.R(d), gpr.R(a), WA); gpr.Unlock(WA); } ComputeCarry(); if (rc) ComputeRC(gpr.R(d), 0); } } void JitArm64::mulli(UGeckoInstruction inst) { INSTRUCTION_START JITDISABLE(bJITIntegerOff); FALLBACK_IF(inst.OE); int a = inst.RA, d = inst.RD; if (gpr.IsImm(a)) { s32 i = (s32)gpr.GetImm(a); gpr.SetImmediate(d, i * inst.SIMM_16); } else { gpr.BindToRegister(d, d == a); ARM64Reg WA = gpr.GetReg(); MOVI2R(WA, (u32)(s32)inst.SIMM_16); MUL(gpr.R(d), gpr.R(a), WA); gpr.Unlock(WA); } } void JitArm64::mullwx(UGeckoInstruction inst) { INSTRUCTION_START JITDISABLE(bJITIntegerOff); FALLBACK_IF(inst.OE); int a = inst.RA, b = inst.RB, d = inst.RD; if (gpr.IsImm(a) && gpr.IsImm(b)) { s32 i = (s32)gpr.GetImm(a), j = (s32)gpr.GetImm(b); gpr.SetImmediate(d, i * j); if (inst.Rc) ComputeRC(gpr.GetImm(d), 0); } else { gpr.BindToRegister(d, d == a || d == b); MUL(gpr.R(d), gpr.R(a), gpr.R(b)); if (inst.Rc) ComputeRC(gpr.R(d), 0); } } void JitArm64::addzex(UGeckoInstruction inst) { INSTRUCTION_START JITDISABLE(bJITIntegerOff); FALLBACK_IF(inst.OE); int a = inst.RA, d = inst.RD; gpr.BindToRegister(d, d == a); ARM64Reg WA = gpr.GetReg(); LDRB(INDEX_UNSIGNED, WA, X29, PPCSTATE_OFF(xer_ca)); CMP(WA, 0); CSINC(gpr.R(d), gpr.R(a), gpr.R(a), CC_EQ); CMP(gpr.R(d), 0); gpr.Unlock(WA); ComputeCarry(); if (inst.Rc) ComputeRC(gpr.R(d), 0); } void JitArm64::subfx(UGeckoInstruction inst) { INSTRUCTION_START JITDISABLE(bJITIntegerOff); FALLBACK_IF(inst.OE); int a = inst.RA, b = inst.RB, d = inst.RD; if (gpr.IsImm(a) && gpr.IsImm(b)) { u32 i = gpr.GetImm(a), j = gpr.GetImm(b); gpr.SetImmediate(d, j - i); if (inst.Rc) ComputeRC(gpr.GetImm(d), 0); } else { SUB(gpr.R(d), gpr.R(b), gpr.R(a)); if (inst.Rc) ComputeRC(gpr.R(d), 0); } } void JitArm64::addcx(UGeckoInstruction inst) { INSTRUCTION_START JITDISABLE(bJITIntegerOff); FALLBACK_IF(inst.OE); int a = inst.RA, b = inst.RB, d = inst.RD; if (gpr.IsImm(a) && gpr.IsImm(b)) { u32 i = gpr.GetImm(a), j = gpr.GetImm(b); gpr.SetImmediate(d, i + j); bool has_carry = Interpreter::Helper_Carry(i, j); ComputeCarry(has_carry); if (inst.Rc) ComputeRC(gpr.GetImm(d), 0); } else { gpr.BindToRegister(d, d == a || d == b); ADDS(gpr.R(d), gpr.R(a), gpr.R(b)); ComputeCarry(); if (inst.Rc) ComputeRC(gpr.R(d), 0); } }
dragonbane0/dolphin
Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp
C++
gpl-2.0
15,006
<?=form_open($action.($is_private ? AMP.'private=true' : ''))?> <?php if ( ! $is_private): ?> <table class="rte-toolset-settings" cellspacing="0" cellpadding="0" border="0"> <tr> <td><label for="toolset_name"><?=lang('toolset_name')?></label></td> <td><?=form_input(array('name'=>'toolset_name','id'=>'toolset_name','value'=>$toolset_name))?></td> </tr> </table> <?php else: ?> <input type="hidden" name="private" value="true"/> <input type="hidden" name="toolset_name" value="<?=lang('my_toolset')?>"/> <?php endif; ?> <div class="rte-toolset-builder ui-widget"> <input type="hidden" id="rte-toolset-tools" name="selected_tools"/> <div class="notice"></div> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td class="rte-toolset-builder-pane"> <strong><?=lang('available_tools')?></strong> <div class="rte-toolset-builder-scrollpane" tabindex="0"> <ul id="rte-tools-unused" class="rte-tools-connected"> <?php foreach ($unused_tools as $tool): ?> <li class="rte-tool" data-tool-id="<?=$tool['tool_id']?>"><?=$tool['name']?></li> <?php endforeach; ?> </ul> </div> </td> <td class="rte-toolset-builder-divider"> </td> <td class="rte-toolset-builder-pane"> <strong><?=lang('tools_in_toolset')?></strong> <div class="rte-toolset-builder-scrollpane" tabindex="0"> <ul id="rte-tools-selected" class="rte-tools-connected ui-sortable"> <?php foreach ($used_tools as $tool): ?> <li class="rte-tool" data-tool-id="<?=$tool['tool_id']?>"><?=$tool['name']?></li> <?php endforeach; ?> </ul> </div> </td> </tr> </table> </div> <p> <?=form_submit(array('name' => 'submit', 'value' => lang('submit'), 'class' => 'submit'));?> &nbsp; <?=lang('or')?> <a id="rte-builder-closer"><?=lang('cancel')?></a> </p> <?=form_close();?>
runrobrun/ee-xc-site
xcrunner/expressionengine/modules/rte/views/edit_toolset.php
PHP
gpl-2.0
1,859
<?php /** * Kunena Component * @package Kunena.Template.Crypsis * @subpackage Pages.Announcement * * @copyright (C) 2008 - 2016 Kunena Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL * @link https://www.kunena.org **/ defined('_JEXEC') or die; $content = $this->execute('Announcement/Edit'); $this->addBreadcrumb( JText::_('COM_KUNENA_ANN_ANNOUNCEMENTS'), 'index.php?option=com_kunena&view=announcement&layout=list' ); echo $content;
roman-sergeenko/patent
components/com_kunena/template/crypsisb3/pages/announcement/create/default.php
PHP
gpl-2.0
500
#include <ctype.h> #include "driver.h" #include "sound/samples.h" #include "info.h" #include "datafile.h" /* Output format indentation */ /* Indentation */ #define INDENT "\t" /* Possible output format */ #define OUTPUT_FORMAT_UNFORMATTED 0 #define OUTPUT_FORMAT_ONE_LEVEL 1 #define OUTPUT_FORMAT_TWO_LEVEL 2 /* Output format */ #define OUTPUT_FORMAT OUTPUT_FORMAT_ONE_LEVEL /* Output format configuration L list 1,2 levels B,S,E Begin, Separator, End */ #if OUTPUT_FORMAT == OUTPUT_FORMAT_UNFORMATTED #define L1B "(" #define L1P " " #define L1N "" #define L1E ")" #define L2B "(" #define L2P " " #define L2N "" #define L2E ")" #elif OUTPUT_FORMAT == OUTPUT_FORMAT_ONE_LEVEL #define L1B " (\n" #define L1P INDENT #define L1N "\n" #define L1E ")\n\n" #define L2B " (" #define L2P " " #define L2N "" #define L2E " )" #elif OUTPUT_FORMAT == OUTPUT_FORMAT_TWO_LEVEL #define L1B " (\n" #define L1P INDENT #define L1N "\n" #define L1E ")\n\n" #define L2B " (\n" #define L2P INDENT INDENT #define L2N "\n" #define L2E INDENT ")" #else #error Wrong OUTPUT_FORMAT #endif /* Print a string in C format */ static void print_c_string(FILE* out, const char* s) { fprintf(out, "\""); if (s) { while (*s) { switch (*s) { case '\a' : fprintf(out, "\\a"); break; case '\b' : fprintf(out, "\\b"); break; case '\f' : fprintf(out, "\\f"); break; case '\n' : fprintf(out, "\\n"); break; case '\r' : fprintf(out, "\\r"); break; case '\t' : fprintf(out, "\\t"); break; case '\v' : fprintf(out, "\\v"); break; case '\\' : fprintf(out, "\\\\"); break; case '\"' : fprintf(out, "\\\""); break; default: if (*s>=' ' && *s<='~') fprintf(out, "%c", *s); else fprintf(out, "\\x%02x", (unsigned)(unsigned char)*s); } ++s; } } fprintf(out, "\""); } /* Print a string in statement format (remove space, parentesis, ") */ static void print_statement_string(FILE* out, const char* s) { if (s) { while (*s) { if (isspace(*s)) { fprintf(out, "_"); } else { switch (*s) { case '(' : case ')' : case '"' : fprintf(out, "_"); break; default: fprintf(out, "%c", *s); } } ++s; } } else { fprintf(out, "null"); } } static void print_game_switch(FILE* out, const struct GameDriver* game) { const struct InputPortTiny* input = game->input_ports; while ((input->type & ~IPF_MASK) != IPT_END) { if ((input->type & ~IPF_MASK)==IPT_DIPSWITCH_NAME) { int def = input->default_value; const char* def_name = 0; fprintf(out, L1P "dipswitch" L2B); fprintf(out, L2P "name " ); print_c_string(out,input->name); fprintf(out, "%s", L2N); ++input; while ((input->type & ~IPF_MASK)==IPT_DIPSWITCH_SETTING) { if (def == input->default_value) def_name = input->name; fprintf(out, L2P "entry " ); print_c_string(out,input->name); fprintf(out, "%s", L2N); ++input; } if (def_name) { fprintf(out, L2P "default "); print_c_string(out,def_name); fprintf(out, "%s", L2N); } fprintf(out, L2E L1N); } else ++input; } } static void print_game_input(FILE* out, const struct GameDriver* game) { const struct InputPortTiny* input = game->input_ports; int nplayer = 0; const char* control = 0; int nbutton = 0; int ncoin = 0; const char* service = 0; const char* tilt = 0; while ((input->type & ~IPF_MASK) != IPT_END) { switch (input->type & IPF_PLAYERMASK) { case IPF_PLAYER1: if (nplayer<1) nplayer = 1; break; case IPF_PLAYER2: if (nplayer<2) nplayer = 2; break; case IPF_PLAYER3: if (nplayer<3) nplayer = 3; break; case IPF_PLAYER4: if (nplayer<4) nplayer = 4; break; } switch (input->type & ~IPF_MASK) { case IPT_JOYSTICK_UP: case IPT_JOYSTICK_DOWN: case IPT_JOYSTICK_LEFT: case IPT_JOYSTICK_RIGHT: if (input->type & IPF_2WAY) control = "joy2way"; else if (input->type & IPF_4WAY) control = "joy4way"; else control = "joy8way"; break; case IPT_JOYSTICKRIGHT_UP: case IPT_JOYSTICKRIGHT_DOWN: case IPT_JOYSTICKRIGHT_LEFT: case IPT_JOYSTICKRIGHT_RIGHT: case IPT_JOYSTICKLEFT_UP: case IPT_JOYSTICKLEFT_DOWN: case IPT_JOYSTICKLEFT_LEFT: case IPT_JOYSTICKLEFT_RIGHT: if (input->type & IPF_2WAY) control = "doublejoy2way"; else if (input->type & IPF_4WAY) control = "doublejoy4way"; else control = "doublejoy8way"; break; case IPT_BUTTON1: if (nbutton<1) nbutton = 1; break; case IPT_BUTTON2: if (nbutton<2) nbutton = 2; break; case IPT_BUTTON3: if (nbutton<3) nbutton = 3; break; case IPT_BUTTON4: if (nbutton<4) nbutton = 4; break; case IPT_BUTTON5: if (nbutton<5) nbutton = 5; break; case IPT_BUTTON6: if (nbutton<6) nbutton = 6; break; case IPT_BUTTON7: if (nbutton<7) nbutton = 7; break; case IPT_BUTTON8: if (nbutton<8) nbutton = 8; break; case IPT_PADDLE: control = "paddle"; break; case IPT_DIAL: control = "dial"; break; case IPT_TRACKBALL_X: case IPT_TRACKBALL_Y: control = "trackball"; break; case IPT_AD_STICK_X: case IPT_AD_STICK_Y: control = "stick"; break; case IPT_COIN1: if (ncoin < 1) ncoin = 1; break; case IPT_COIN2: if (ncoin < 2) ncoin = 2; break; case IPT_COIN3: if (ncoin < 3) ncoin = 3; break; case IPT_COIN4: if (ncoin < 4) ncoin = 4; break; case IPT_SERVICE : service = "yes"; break; case IPT_TILT : tilt = "yes"; break; } ++input; } fprintf(out, L1P "input" L2B); fprintf(out, L2P "players %d" L2N, nplayer ); if (control) fprintf(out, L2P "control %s" L2N, control ); if (nbutton) fprintf(out, L2P "buttons %d" L2N, nbutton ); if (ncoin) fprintf(out, L2P "coins %d" L2N, ncoin ); if (service) fprintf(out, L2P "service %s" L2N, service ); if (tilt) fprintf(out, L2P "tilt %s" L2N, tilt ); fprintf(out, L2E L1N); } static void print_game_rom(FILE* out, const struct GameDriver* game) { const struct RomModule *rom = game->rom, *p_rom = NULL; extern struct GameDriver driver_0; if (!rom) return; if (game->clone_of && game->clone_of != &driver_0) { fprintf(out, L1P "romof %s" L1N, game->clone_of->name); } while (rom->name || rom->offset || rom->length) { int region = rom->crc; rom++; while (rom->length) { char name[100]; int offset, length, crc, in_parent; sprintf(name,rom->name,game->name); offset = rom->offset; crc = rom->crc; in_parent = 0; length = 0; do { if (rom->name == (char *)-1) length = 0; /* restart */ length += rom->length & ~ROMFLAG_MASK; rom++; } while (rom->length && (rom->name == 0 || rom->name == (char *)-1)); if(game->clone_of && crc) { p_rom = game->clone_of->rom; if (p_rom) while( !in_parent && (p_rom->name || p_rom->offset || p_rom->length) ) { p_rom++; while(!in_parent && p_rom->length) { do { if (p_rom->crc == crc) in_parent = 1; else p_rom++; } while (!in_parent && p_rom->length && (p_rom->name == 0 || p_rom->name == (char *)-1)); } } } fprintf(out, L1P "rom" L2B); if (*name) fprintf(out, L2P "name %s" L2N, name); if(in_parent && p_rom && p_rom->name) fprintf(out, L2P "merge %s" L2N, p_rom->name); fprintf(out, L2P "size %d" L2N, length); fprintf(out, L2P "crc %08x" L2N, crc); switch (region & ~REGIONFLAG_MASK) { case REGION_CPU1: fprintf(out, L2P "region cpu1" L2N); break; case REGION_CPU2: fprintf(out, L2P "region cpu2" L2N); break; case REGION_CPU3: fprintf(out, L2P "region cpu3" L2N); break; case REGION_CPU4: fprintf(out, L2P "region cpu4" L2N); break; case REGION_CPU5: fprintf(out, L2P "region cpu5" L2N); break; case REGION_CPU6: fprintf(out, L2P "region cpu6" L2N); break; case REGION_CPU7: fprintf(out, L2P "region cpu7" L2N); break; case REGION_CPU8: fprintf(out, L2P "region cpu8" L2N); break; case REGION_GFX1: fprintf(out, L2P "region gfx1" L2N); break; case REGION_GFX2: fprintf(out, L2P "region gfx2" L2N); break; case REGION_GFX3: fprintf(out, L2P "region gfx3" L2N); break; case REGION_GFX4: fprintf(out, L2P "region gfx4" L2N); break; case REGION_GFX5: fprintf(out, L2P "region gfx5" L2N); break; case REGION_GFX6: fprintf(out, L2P "region gfx6" L2N); break; case REGION_GFX7: fprintf(out, L2P "region gfx7" L2N); break; case REGION_GFX8: fprintf(out, L2P "region gfx8" L2N); break; case REGION_PROMS: fprintf(out, L2P "region proms" L2N); break; case REGION_SOUND1: fprintf(out, L2P "region sound1" L2N); break; case REGION_SOUND2: fprintf(out, L2P "region sound2" L2N); break; case REGION_SOUND3: fprintf(out, L2P "region sound3" L2N); break; case REGION_SOUND4: fprintf(out, L2P "region sound4" L2N); break; case REGION_SOUND5: fprintf(out, L2P "region sound5" L2N); break; case REGION_SOUND6: fprintf(out, L2P "region sound6" L2N); break; case REGION_SOUND7: fprintf(out, L2P "region sound7" L2N); break; case REGION_SOUND8: fprintf(out, L2P "region sound8" L2N); break; case REGION_USER1: fprintf(out, L2P "region user1" L2N); break; case REGION_USER2: fprintf(out, L2P "region user2" L2N); break; case REGION_USER3: fprintf(out, L2P "region user3" L2N); break; case REGION_USER4: fprintf(out, L2P "region user4" L2N); break; case REGION_USER5: fprintf(out, L2P "region user5" L2N); break; case REGION_USER6: fprintf(out, L2P "region user6" L2N); break; case REGION_USER7: fprintf(out, L2P "region user7" L2N); break; case REGION_USER8: fprintf(out, L2P "region user8" L2N); break; default: fprintf(out, L2P "region 0x%x" L2N, region & ~REGIONFLAG_MASK); } switch (region & REGIONFLAG_MASK) { case 0: break; case REGIONFLAG_SOUNDONLY: fprintf(out, L2P "flags soundonly" L2N); break; case REGIONFLAG_DISPOSE: fprintf(out, L2P "flags dispose" L2N); break; default: fprintf(out, L2P "flags 0x%x" L2N, region & REGIONFLAG_MASK); } fprintf(out, L2P "offs %x", offset); fprintf(out, L2E L1N); } } } static void print_game_sample(FILE* out, const struct GameDriver* game) { #if (HAS_SAMPLES) int i; for( i = 0; game->drv->sound[i].sound_type && i < MAX_SOUND; i++ ) { const char **samplenames = NULL; if( game->drv->sound[i].sound_type != SOUND_SAMPLES ) continue; samplenames = ((struct Samplesinterface *)game->drv->sound[i].sound_interface)->samplenames; if (samplenames != 0 && samplenames[0] != 0) { int k = 0; if (samplenames[k][0]=='*') { /* output sampleof only if different from game name */ if (strcmp(samplenames[k] + 1, game->name)!=0) { fprintf(out, L1P "sampleof %s" L1N, samplenames[k] + 1); } ++k; } while (samplenames[k] != 0) { /* Check if is not empty */ if (*samplenames[k]) { /* Check if sample is duplicate */ int l = 0; while (l<k && strcmp(samplenames[k],samplenames[l])!=0) ++l; if (l==k) { fprintf(out, L1P "sample %s" L1N, samplenames[k]); } } ++k; } } } #endif } static void print_game_micro(FILE* out, const struct GameDriver* game) { const struct MachineDriver* driver = game->drv; const struct MachineCPU* cpu = driver->cpu; const struct MachineSound* sound = driver->sound; int j; for(j=0;j<MAX_CPU;++j) { if (cpu[j].cpu_type!=0) { fprintf(out, L1P "chip" L2B); if (cpu[j].cpu_type & CPU_AUDIO_CPU) fprintf(out, L2P "type cpu flags audio" L2N); else fprintf(out, L2P "type cpu" L2N); fprintf(out, L2P "name "); print_statement_string(out, cputype_name(cpu[j].cpu_type)); fprintf(out, "%s", L2N); fprintf(out, L2P "clock %d" L2N, cpu[j].cpu_clock); fprintf(out, L2E L1N); } } for(j=0;j<MAX_SOUND;++j) if (sound[j].sound_type) { if (sound[j].sound_type) { int num = sound_num(&sound[j]); int l; if (num == 0) num = 1; for(l=0;l<num;++l) { fprintf(out, L1P "chip" L2B); fprintf(out, L2P "type audio" L2N); fprintf(out, L2P "name "); print_statement_string(out, sound_name(&sound[j])); fprintf(out, "%s", L2N); if (sound_clock(&sound[j])) fprintf(out, L2P "clock %d" L2N, sound_clock(&sound[j])); fprintf(out, L2E L1N); } } } } static void print_game_video(FILE* out, const struct GameDriver* game) { const struct MachineDriver* driver = game->drv; int dx; int dy; int showxy; int orientation; fprintf(out, L1P "video" L2B); if (driver->video_attributes & VIDEO_TYPE_VECTOR) { fprintf(out, L2P "screen vector" L2N); showxy = 0; } else { fprintf(out, L2P "screen raster" L2N); showxy = 1; } if (game->flags & ORIENTATION_SWAP_XY) { dx = driver->default_visible_area.max_y - driver->default_visible_area.min_y + 1; dy = driver->default_visible_area.max_x - driver->default_visible_area.min_x + 1; orientation = 1; } else { dx = driver->default_visible_area.max_x - driver->default_visible_area.min_x + 1; dy = driver->default_visible_area.max_y - driver->default_visible_area.min_y + 1; orientation = 0; } fprintf(out, L2P "orientation %s" L2N, orientation ? "vertical" : "horizontal" ); if (showxy) { fprintf(out, L2P "x %d" L2N, dx); fprintf(out, L2P "y %d" L2N, dy); } fprintf(out, L2P "colors %d" L2N, driver->total_colors); fprintf(out, L2P "freq %f" L2N, driver->frames_per_second); fprintf(out, L2E L1N); } static void print_game_sound(FILE* out, const struct GameDriver* game) { const struct MachineDriver* driver = game->drv; const struct MachineCPU* cpu = driver->cpu; const struct MachineSound* sound = driver->sound; /* check if the game have sound emulation */ int has_sound = 0; int i; i = 0; while (i < MAX_SOUND && !has_sound) { if (sound[i].sound_type) has_sound = 1; ++i; } i = 0; while (i < MAX_CPU && !has_sound) { if ((cpu[i].cpu_type & CPU_AUDIO_CPU)!=0) has_sound = 1; ++i; } fprintf(out, L1P "sound" L2B); /* sound channel */ if (has_sound) { if (driver->sound_attributes & SOUND_SUPPORTS_STEREO) fprintf(out, L2P "channels 2" L2N); else fprintf(out, L2P "channels 1" L2N); } else fprintf(out, L2P "channels 0" L2N); fprintf(out, L2E L1N); } #define HISTORY_BUFFER_MAX 16384 static void print_game_history(FILE* out, const struct GameDriver* game) { char buffer[HISTORY_BUFFER_MAX]; if (load_driver_history(game,buffer,HISTORY_BUFFER_MAX)==0) { fprintf(out, L1P "history "); print_c_string(out, buffer); fprintf(out, "%s", L1N); } } static void print_game_driver(FILE* out, const struct GameDriver* game) { fprintf(out, L1P "driver" L2B); if (game->flags & GAME_NOT_WORKING) fprintf(out, L2P "status preliminary" L2N); else fprintf(out, L2P "status good" L2N); if (game->flags & GAME_WRONG_COLORS) fprintf(out, L2P "color preliminary" L2N); else if (game->flags & GAME_IMPERFECT_COLORS) fprintf(out, L2P "color imperfect" L2N); else fprintf(out, L2P "color good" L2N); if (game->flags & GAME_NO_SOUND) fprintf(out, L2P "sound preliminary" L2N); else if (game->flags & GAME_IMPERFECT_SOUND) fprintf(out, L2P "sound imperfect" L2N); else fprintf(out, L2P "sound good" L2N); if (game->flags & GAME_REQUIRES_16BIT) fprintf(out, L2P "colordeep 16" L2N); else fprintf(out, L2P "colordeep 8" L2N); fprintf(out, L2E L1N); } /* Print the MAME info record for a game */ static void print_game_info(FILE* out, const struct GameDriver* game) { #ifndef MESS fprintf(out, "game" L1B ); #else fprintf(out, "machine" L1B ); #endif fprintf(out, L1P "name %s" L1N, game->name ); if (game->description) { fprintf(out, L1P "description "); print_c_string(out, game->description ); fprintf(out, "%s", L1N); } /* print the year only if is a number */ if (game->year && strspn(game->year,"0123456789")==strlen(game->year)) { fprintf(out, L1P "year %s" L1N, game->year ); } if (game->manufacturer) { fprintf(out, L1P "manufacturer "); print_c_string(out, game->manufacturer ); fprintf(out, "%s", L1N); } print_game_history(out,game); if (game->clone_of && !(game->clone_of->flags & NOT_A_DRIVER)) { fprintf(out, L1P "cloneof %s" L1N, game->clone_of->name); } print_game_rom(out,game); print_game_sample(out,game); print_game_micro(out,game); print_game_video(out,game); print_game_sound(out,game); print_game_input(out,game); print_game_switch(out,game); print_game_driver(out,game); fprintf(out, L1E); } /* Print all the MAME info database */ void print_mame_info(FILE* out, const struct GameDriver* games[]) { int j; for(j=0;games[j];++j) print_game_info( out, games[j] ); #ifndef MESS /* addictional fixed record */ fprintf(out, "resource" L1B); fprintf(out, L1P "name neogeo" L1N); fprintf(out, L1P "description \"Neo Geo BIOS\"" L1N); fprintf(out, L1P "rom" L2B); fprintf(out, L2P "name neo-geo.rom" L2N); fprintf(out, L2P "size 131072" L2N); fprintf(out, L2P "crc 9036d879" L2N); fprintf(out, L2E L1N); fprintf(out, L1P "rom" L2B); fprintf(out, L2P "name ng-sm1.rom" L2N); fprintf(out, L2P "size 131072" L2N); fprintf(out, L2P "crc 97cf998b" L2N); fprintf(out, L2E L1N); fprintf(out, L1P "rom" L2B); fprintf(out, L2P "name ng-sfix.rom" L2N); fprintf(out, L2P "size 131072" L2N); fprintf(out, L2P "crc 354029fc" L2N); fprintf(out, L2E L1N); fprintf(out, L1E); #endif }
skeezix/compo4all
stevem/mame4all/src/info.cpp
C++
gpl-2.0
18,177
/* Generated By:JavaCC: Do not edit this line. PTAParser.java */ package pta.parser; import java.io.*; import java.util.*; import pta.*; import prism.PrismLangException; public class PTAParser implements PTAParserConstants { //----------------------------------------------------------------------------------- // Main method for testing purposes //----------------------------------------------------------------------------------- public static void main(String[] args) { PTAParser p = null; InputStream str = null; String src = null; try { p = new PTAParser(); str = (args.length > 0) ? new FileInputStream(args[0]) : System.in; src = (args.length > 0) ? "file "+args[0] : "stdin"; System.out.println("Reading from "+src+"...\u005cn"); PTA pta = p.parsePTA(str); System.out.print(pta); } catch (PrismLangException e) { System.out.println("Error in "+src+": " + e.getMessage()+"."); System.exit(1); } catch (FileNotFoundException e) { System.out.println(e); System.exit(1); } } //----------------------------------------------------------------------------------- // Methods called by Prism //----------------------------------------------------------------------------------- // Constructor public PTAParser() { // Call default constructor this(System.in); } // Parse PTA public PTA parsePTA(InputStream str) throws PrismLangException { astPTA pta = null; // (Re)start parser ReInit(str); // Parse try { pta = PTA(); } catch (ParseException e) { throw new PrismLangException(e.getMessage()); } return pta.createDataStructures(); } //------------------------------------------------------------------------------ // Abstract syntax tree classes //------------------------------------------------------------------------------ // Classes used to build AST representing PTA. // Note: locations are indexed by name here, not integer as in the normal PTA class // (this is the main reason for needing separate AST classes here). // For clocks, this approach is not needed: we just take the ordering of the clocks // to be as they appear in the file (unlike locations, which have an explicit ordering // combined with possible forward references). static class astPTA { // Data public ArrayList<String> clockNames; public ArrayList<String> locationNames; public HashMap<String,LinkedHashSet<Constraint>> invariants; public HashMap<String,ArrayList<astTransition>> transitions; // Methods public astPTA() { clockNames = new ArrayList<String>(); locationNames = new ArrayList<String>(); invariants = new HashMap<String,LinkedHashSet<Constraint>>(); transitions = new HashMap<String,ArrayList<astTransition>>(); } public int getOrAddClock(String name) { int i = clockNames.indexOf(name); if (i == -1) { clockNames.add(name); return clockNames.size(); } else return i+1; } public void addLocation(String name) { locationNames.add(name); invariants.put(name, new LinkedHashSet<Constraint>()); transitions.put(name, new ArrayList<astTransition>()); } public void addInvariantCondition(String locName, Constraint c) { invariants.get(locName).add(c); } public void setInvariantConditions(String locName, LinkedHashSet<Constraint> cs) { invariants.put(locName, cs); } public astTransition addTransition(String locName) { astTransition t = new astTransition(); transitions.get(locName).add(t); return t; } public int getLocationIndex(String name) { return locationNames.indexOf(name); } // Conversion to pta classes public PTA createDataStructures() { int i, n; String name; PTA pta; Transition trans; pta = new PTA(); // Add all clocks n = clockNames.size(); for (i = 0; i < n; i++) pta.addClock(clockNames.get(i)); // Add all locations n = locationNames.size(); for (i = 0; i < n; i++) pta.addLocation(locationNames.get(i)); // Add invariants/transitions to locations n = locationNames.size(); for (i = 0; i < n; i++) { name = locationNames.get(i); pta.setInvariantConditions(i, invariants.get(name)); ArrayList<astTransition> tt = transitions.get(name); if (tt == null || tt.isEmpty()) continue; for (astTransition t : tt) { if (!(t.edges.isEmpty())) { trans = pta.addTransition(i, t.action); t.createDataStructures(this, trans); } } } return pta; } } static class astTransition { // Data private String action = null; private ArrayList<Constraint> guard; public ArrayList<astEdge> edges; // Methods public astTransition() { guard = new ArrayList<Constraint>(); edges = new ArrayList<astEdge>(); } public void setAction(String action) { this.action = action; } public void addGuardConstraint(Constraint c) { guard.add(c); } public astEdge addEdge(double prob, String dest) { astEdge e = new astEdge(prob, dest); edges.add(e); return e; } // Conversion to pta classes public void createDataStructures(astPTA pta, Transition trans) { for (Constraint c : guard) trans.addGuardConstraint(c); for (astEdge e : edges) e.createDataStructures(pta, trans); } } static class astEdge { // Data public double prob; public String dest; public HashMap<Integer,Integer> resets; // Methods public astEdge(double prob, String dest) { this.prob = prob; this.dest = dest; resets = new HashMap<Integer,Integer>(); } public void addReset(int clock, int val) { resets.put(clock, val); } // Conversion to pta classes public void createDataStructures(astPTA pta, Transition trans) { int d = pta.getLocationIndex(dest); if (d == -1) { System.err.println("Error: Location \u005c""+dest+"\u005c" does not exist"); System.exit(1); } Edge edge = trans.addEdge(prob, d); for (Map.Entry<Integer,Integer> e : resets.entrySet()) edge.addReset(e.getKey(), e.getValue()); } } //----------------------------------------------------------------------------------- // Top-level production //----------------------------------------------------------------------------------- // PTA static final public astPTA PTA() throws ParseException { astPTA pta = new astPTA(); label_1: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACE: ; break; default: jj_la1[0] = jj_gen; break label_1; } Location(pta); } jj_consume_token(0); {if (true) return pta;} throw new Error("Missing return statement in function"); } static final public void Location(astPTA pta) throws ParseException { String name; LinkedHashSet<Constraint> constrs; jj_consume_token(LBRACE); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INIT: jj_consume_token(INIT); break; default: jj_la1[1] = jj_gen; ; } jj_consume_token(NODE); name = Identifier(); pta.addLocation(name); jj_consume_token(SEMICOLON); constrs = ConstraintList(pta); pta.setInvariantConditions(name, constrs); label_2: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACKET: ; break; default: jj_la1[2] = jj_gen; break label_2; } Transition(pta, name); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case RBRACE: jj_consume_token(RBRACE); break; case TIMES: jj_consume_token(TIMES); break; default: jj_la1[3] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } static final public void Transition(astPTA pta, String locName) throws ParseException { astTransition tr; jj_consume_token(LBRACKET); tr = pta.addTransition(locName); label_3: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case TRAN: case REG_IDENT: ; break; default: jj_la1[4] = jj_gen; break label_3; } Edge(pta, tr); } jj_consume_token(RBRACKET); } static final public void Edge(astPTA pta, astTransition tr) throws ParseException { LinkedHashSet<Constraint> constrs; String action = null, dest; double p; astEdge edge; HashMap<Integer,Integer> resets; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case REG_IDENT: action = Identifier(); jj_consume_token(OR); jj_consume_token(OR); break; default: jj_la1[5] = jj_gen; ; } jj_consume_token(TRAN); dest = Identifier(); jj_consume_token(SEMICOLON); constrs = ConstraintList(pta); jj_consume_token(SEMICOLON); resets = Resets(pta); jj_consume_token(SEMICOLON); p = Probability(); tr.setAction(action); edge = tr.addEdge(p, dest); for (Map.Entry<Integer,Integer> e : resets.entrySet()) edge.addReset(e.getKey(), e.getValue()); for (Constraint c : constrs) tr.addGuardConstraint(c); } static final public LinkedHashSet<Constraint> ConstraintList(astPTA pta) throws ParseException { LinkedHashSet<Constraint> constrs = new LinkedHashSet<Constraint>(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case REG_IDENT: Constraint(pta, constrs); label_4: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: jj_la1[6] = jj_gen; break label_4; } jj_consume_token(COMMA); Constraint(pta, constrs); } break; case TRUE: jj_consume_token(TRUE); break; default: jj_la1[7] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return constrs;} throw new Error("Missing return statement in function"); } static final public void Constraint(astPTA pta, LinkedHashSet<Constraint> constrs) throws ParseException { String clock1Name, clock2Name; int clock1, clock2, val; Token t; clock1Name = Identifier(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LT: t = jj_consume_token(LT); break; case LE: t = jj_consume_token(LE); break; case GT: t = jj_consume_token(GT); break; case GE: t = jj_consume_token(GE); break; case EQ: t = jj_consume_token(EQ); break; default: jj_la1[8] = jj_gen; jj_consume_token(-1); throw new ParseException(); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case REG_INT: val = Integer(); clock1 = pta.getOrAddClock(clock1Name); switch (t.kind) { case PTAParserConstants.LT: constrs.add(Constraint.buildLt(clock1, val)); break; case PTAParserConstants.LE: constrs.add(Constraint.buildLeq(clock1, val)); break; case PTAParserConstants.GT: constrs.add(Constraint.buildGt(clock1, val)); break; case PTAParserConstants.GE: constrs.add(Constraint.buildGeq(clock1, val)); break; case PTAParserConstants.EQ: constrs.add(Constraint.buildLeq(clock1, val)); constrs.add(Constraint.buildGeq(clock1, val)); break; } break; case REG_IDENT: clock2Name = Identifier(); clock1 = pta.getOrAddClock(clock1Name); clock2 = pta.getOrAddClock(clock2Name); switch (t.kind) { case PTAParserConstants.LT: constrs.add(Constraint.buildLt(clock1, clock2)); break; default: System.err.println("Error: Unsupported constraint type"); System.exit(1); } break; default: jj_la1[9] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } static final public HashMap<Integer,Integer> Resets(astPTA pta) throws ParseException { HashMap<Integer,Integer> resets = new HashMap<Integer,Integer>(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case REG_IDENT: Reset(pta, resets); label_5: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: jj_la1[10] = jj_gen; break label_5; } jj_consume_token(COMMA); Reset(pta, resets); } break; case NULL: jj_consume_token(NULL); break; default: jj_la1[11] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return resets;} throw new Error("Missing return statement in function"); } static final public void Reset(astPTA pta, HashMap<Integer,Integer> resets) throws ParseException { String clockName; int clock; int val; clockName = Identifier(); jj_consume_token(EQ); val = Integer(); clock = pta.getOrAddClock(clockName); resets.put(clock, val); } static final public double Probability() throws ParseException { Token t; double d; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case REG_DOUBLE: t = jj_consume_token(REG_DOUBLE); break; case REG_INT: t = jj_consume_token(REG_INT); break; default: jj_la1[12] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return Double.parseDouble(t.image);} throw new Error("Missing return statement in function"); } //----------------------------------------------------------------------------------- // Miscellaneous stuff //----------------------------------------------------------------------------------- // Identifier (returns String) static final public String Identifier() throws ParseException { jj_consume_token(REG_IDENT); {if (true) return getToken(0).image;} throw new Error("Missing return statement in function"); } // Integer static final public int Integer() throws ParseException { jj_consume_token(REG_INT); {if (true) return Integer.parseInt(getToken(0).image);} throw new Error("Missing return statement in function"); } static private boolean jj_initialized_once = false; /** Generated Token Manager. */ static public PTAParserTokenManager token_source; static SimpleCharStream jj_input_stream; /** Current token. */ static public Token token; /** Next token. */ static public Token jj_nt; static private int jj_ntk; static private int jj_gen; static final private int[] jj_la1 = new int[13]; static private int[] jj_la1_0; static private int[] jj_la1_1; static { jj_la1_init_0(); jj_la1_init_1(); } private static void jj_la1_init_0() { jj_la1_0 = new int[] {0x200000,0x8,0x80000,0x80400000,0x40,0x0,0x8000,0x80,0x1e800000,0x0,0x8000,0x20,0x0,}; } private static void jj_la1_init_1() { jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x100,0x100,0x0,0x100,0x0,0x120,0x0,0x100,0x60,}; } /** Constructor with InputStream. */ public PTAParser(java.io.InputStream stream) { this(stream, null); } /** Constructor with InputStream and supplied encoding */ public PTAParser(java.io.InputStream stream, String encoding) { if (jj_initialized_once) { System.out.println("ERROR: Second call to constructor of static parser. "); System.out.println(" You must either use ReInit() or set the JavaCC option STATIC to false"); System.out.println(" during parser generation."); throw new Error(); } jj_initialized_once = true; try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source = new PTAParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 13; i++) jj_la1[i] = -1; } /** Reinitialise. */ static public void ReInit(java.io.InputStream stream) { ReInit(stream, null); } /** Reinitialise. */ static public void ReInit(java.io.InputStream stream, String encoding) { try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 13; i++) jj_la1[i] = -1; } /** Constructor. */ public PTAParser(java.io.Reader stream) { if (jj_initialized_once) { System.out.println("ERROR: Second call to constructor of static parser. "); System.out.println(" You must either use ReInit() or set the JavaCC option STATIC to false"); System.out.println(" during parser generation."); throw new Error(); } jj_initialized_once = true; jj_input_stream = new SimpleCharStream(stream, 1, 1); token_source = new PTAParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 13; i++) jj_la1[i] = -1; } /** Reinitialise. */ static public void ReInit(java.io.Reader stream) { jj_input_stream.ReInit(stream, 1, 1); token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 13; i++) jj_la1[i] = -1; } /** Constructor with generated Token Manager. */ public PTAParser(PTAParserTokenManager tm) { if (jj_initialized_once) { System.out.println("ERROR: Second call to constructor of static parser. "); System.out.println(" You must either use ReInit() or set the JavaCC option STATIC to false"); System.out.println(" during parser generation."); throw new Error(); } jj_initialized_once = true; token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 13; i++) jj_la1[i] = -1; } /** Reinitialise. */ public void ReInit(PTAParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 13; i++) jj_la1[i] = -1; } static private Token jj_consume_token(int kind) throws ParseException { Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == kind) { jj_gen++; return token; } token = oldToken; jj_kind = kind; throw generateParseException(); } /** Get the next Token. */ static final public Token getNextToken() { if (token.next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; jj_gen++; return token; } /** Get the specific Token. */ static final public Token getToken(int index) { Token t = token; for (int i = 0; i < index; i++) { if (t.next != null) t = t.next; else t = t.next = token_source.getNextToken(); } return t; } static private int jj_ntk() { if ((jj_nt=token.next) == null) return (jj_ntk = (token.next=token_source.getNextToken()).kind); else return (jj_ntk = jj_nt.kind); } static private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>(); static private int[] jj_expentry; static private int jj_kind = -1; /** Generate ParseException. */ static public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[42]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 13; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1<<j)) != 0) { la1tokens[j] = true; } if ((jj_la1_1[i] & (1<<j)) != 0) { la1tokens[32+j] = true; } } } } for (int i = 0; i < 42; i++) { if (la1tokens[i]) { jj_expentry = new int[1]; jj_expentry[0] = i; jj_expentries.add(jj_expentry); } } int[][] exptokseq = new int[jj_expentries.size()][]; for (int i = 0; i < jj_expentries.size(); i++) { exptokseq[i] = jj_expentries.get(i); } return new ParseException(token, exptokseq, tokenImage); } /** Enable tracing. */ static final public void enable_tracing() { } /** Disable tracing. */ static final public void disable_tracing() { } }
nicodelpiano/prism
src/pta/parser/PTAParser.java
Java
gpl-2.0
23,388
/* * Copyright (C) 2004, 2005, 2007, 2009 Apple Inc. All rights reserved. * (C) 2005 Rob Buis <buis@kde.org> * (C) 2006 Alexander Kellett <lypanov@kde.org> * Copyright (C) Research In Motion Limited 2010. 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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 "config.h" #if ENABLE(SVG) #include "SVGRenderTreeAsText.h" #include "GraphicsTypes.h" #include "HTMLNames.h" #include "InlineTextBox.h" #include "LinearGradientAttributes.h" #include "NodeRenderStyle.h" #include "Path.h" #include "PatternAttributes.h" #include "RadialGradientAttributes.h" #include "RenderImage.h" #include "RenderSVGContainer.h" #include "RenderSVGGradientStop.h" #include "RenderSVGImage.h" #include "RenderSVGInlineText.h" #include "RenderSVGPath.h" #include "RenderSVGResourceClipper.h" #include "RenderSVGResourceFilter.h" #include "RenderSVGResourceGradient.h" #include "RenderSVGResourceLinearGradient.h" #include "RenderSVGResourceMarker.h" #include "RenderSVGResourceMasker.h" #include "RenderSVGResourcePattern.h" #include "RenderSVGResourceRadialGradient.h" #include "RenderSVGResourceSolidColor.h" #include "RenderSVGRoot.h" #include "RenderSVGShape.h" #include "RenderSVGText.h" #include "RenderTreeAsText.h" #include "SVGCircleElement.h" #include "SVGEllipseElement.h" #include "SVGInlineTextBox.h" #include "SVGLineElement.h" #include "SVGLinearGradientElement.h" #include "SVGNames.h" #include "SVGPathElement.h" #include "SVGPathUtilities.h" #include "SVGPatternElement.h" #include "SVGPointList.h" #include "SVGPolyElement.h" #include "SVGRadialGradientElement.h" #include "SVGRectElement.h" #include "SVGRootInlineBox.h" #include "SVGStopElement.h" #include "SVGStyledElement.h" #include <math.h> namespace WebCore { /** class + iomanip to help streaming list separators, i.e. ", " in string "a, b, c, d" * Can be used in cases where you don't know which item in the list is the first * one to be printed, but still want to avoid strings like ", b, c". */ class TextStreamSeparator { public: TextStreamSeparator(const String& s) : m_separator(s) , m_needToSeparate(false) { } private: friend TextStream& operator<<(TextStream&, TextStreamSeparator&); String m_separator; bool m_needToSeparate; }; TextStream& operator<<(TextStream& ts, TextStreamSeparator& sep) { if (sep.m_needToSeparate) ts << sep.m_separator; else sep.m_needToSeparate = true; return ts; } template<typename ValueType> static void writeNameValuePair(TextStream& ts, const char* name, ValueType value) { ts << " [" << name << "=" << value << "]"; } template<typename ValueType> static void writeNameAndQuotedValue(TextStream& ts, const char* name, ValueType value) { ts << " [" << name << "=\"" << value << "\"]"; } static void writeIfNotEmpty(TextStream& ts, const char* name, const String& value) { if (!value.isEmpty()) writeNameValuePair(ts, name, value); } template<typename ValueType> static void writeIfNotDefault(TextStream& ts, const char* name, ValueType value, ValueType defaultValue) { if (value != defaultValue) writeNameValuePair(ts, name, value); } TextStream& operator<<(TextStream& ts, const FloatRect& r) { ts << "at (" << TextStream::FormatNumberRespectingIntegers(r.x()); ts << "," << TextStream::FormatNumberRespectingIntegers(r.y()); ts << ") size " << TextStream::FormatNumberRespectingIntegers(r.width()); ts << "x" << TextStream::FormatNumberRespectingIntegers(r.height()); return ts; } TextStream& operator<<(TextStream& ts, const AffineTransform& transform) { if (transform.isIdentity()) ts << "identity"; else ts << "{m=((" << transform.a() << "," << transform.b() << ")(" << transform.c() << "," << transform.d() << ")) t=(" << transform.e() << "," << transform.f() << ")}"; return ts; } static TextStream& operator<<(TextStream& ts, const WindRule rule) { switch (rule) { case RULE_NONZERO: ts << "NON-ZERO"; break; case RULE_EVENODD: ts << "EVEN-ODD"; break; } return ts; } static TextStream& operator<<(TextStream& ts, const SVGUnitTypes::SVGUnitType& unitType) { ts << SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::toString(unitType); return ts; } static TextStream& operator<<(TextStream& ts, const SVGMarkerUnitsType& markerUnit) { ts << SVGPropertyTraits<SVGMarkerUnitsType>::toString(markerUnit); return ts; } TextStream& operator<<(TextStream& ts, const Color& c) { return ts << c.nameForRenderTreeAsText(); } // FIXME: Maybe this should be in KCanvasRenderingStyle.cpp static TextStream& operator<<(TextStream& ts, const DashArray& a) { ts << "{"; DashArray::const_iterator end = a.end(); for (DashArray::const_iterator it = a.begin(); it != end; ++it) { if (it != a.begin()) ts << ", "; ts << *it; } ts << "}"; return ts; } // FIXME: Maybe this should be in GraphicsTypes.cpp static TextStream& operator<<(TextStream& ts, LineCap style) { switch (style) { case ButtCap: ts << "BUTT"; break; case RoundCap: ts << "ROUND"; break; case SquareCap: ts << "SQUARE"; break; } return ts; } // FIXME: Maybe this should be in GraphicsTypes.cpp static TextStream& operator<<(TextStream& ts, LineJoin style) { switch (style) { case MiterJoin: ts << "MITER"; break; case RoundJoin: ts << "ROUND"; break; case BevelJoin: ts << "BEVEL"; break; } return ts; } static TextStream& operator<<(TextStream& ts, const SVGSpreadMethodType& type) { ts << SVGPropertyTraits<SVGSpreadMethodType>::toString(type).upper(); return ts; } static void writeSVGPaintingResource(TextStream& ts, RenderSVGResource* resource) { if (resource->resourceType() == SolidColorResourceType) { ts << "[type=SOLID] [color=" << static_cast<RenderSVGResourceSolidColor*>(resource)->color() << "]"; return; } // All other resources derive from RenderSVGResourceContainer RenderSVGResourceContainer* container = static_cast<RenderSVGResourceContainer*>(resource); Node* node = container->node(); ASSERT(node); ASSERT(node->isSVGElement()); if (resource->resourceType() == PatternResourceType) ts << "[type=PATTERN]"; else if (resource->resourceType() == LinearGradientResourceType) ts << "[type=LINEAR-GRADIENT]"; else if (resource->resourceType() == RadialGradientResourceType) ts << "[type=RADIAL-GRADIENT]"; ts << " [id=\"" << toSVGElement(node)->getIdAttribute() << "\"]"; } static void writeStyle(TextStream& ts, const RenderObject& object) { const RenderStyle* style = object.style(); const SVGRenderStyle* svgStyle = style->svgStyle(); if (!object.localTransform().isIdentity()) writeNameValuePair(ts, "transform", object.localTransform()); writeIfNotDefault(ts, "image rendering", style->imageRendering(), RenderStyle::initialImageRendering()); writeIfNotDefault(ts, "opacity", style->opacity(), RenderStyle::initialOpacity()); if (object.isSVGShape()) { const RenderSVGShape& shape = static_cast<const RenderSVGShape&>(object); ASSERT(shape.node()); ASSERT(shape.node()->isSVGElement()); Color fallbackColor; if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(const_cast<RenderSVGShape*>(&shape), shape.style(), fallbackColor)) { TextStreamSeparator s(" "); ts << " [stroke={" << s; writeSVGPaintingResource(ts, strokePaintingResource); SVGLengthContext lengthContext(toSVGElement(shape.node())); double dashOffset = svgStyle->strokeDashOffset().value(lengthContext); double strokeWidth = svgStyle->strokeWidth().value(lengthContext); const Vector<SVGLength>& dashes = svgStyle->strokeDashArray(); DashArray dashArray; const Vector<SVGLength>::const_iterator end = dashes.end(); for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; ++it) dashArray.append((*it).value(lengthContext)); writeIfNotDefault(ts, "opacity", svgStyle->strokeOpacity(), 1.0f); writeIfNotDefault(ts, "stroke width", strokeWidth, 1.0); writeIfNotDefault(ts, "miter limit", svgStyle->strokeMiterLimit(), 4.0f); writeIfNotDefault(ts, "line cap", svgStyle->capStyle(), ButtCap); writeIfNotDefault(ts, "line join", svgStyle->joinStyle(), MiterJoin); writeIfNotDefault(ts, "dash offset", dashOffset, 0.0); if (!dashArray.isEmpty()) writeNameValuePair(ts, "dash array", dashArray); ts << "}]"; } if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(const_cast<RenderSVGShape*>(&shape), shape.style(), fallbackColor)) { TextStreamSeparator s(" "); ts << " [fill={" << s; writeSVGPaintingResource(ts, fillPaintingResource); writeIfNotDefault(ts, "opacity", svgStyle->fillOpacity(), 1.0f); writeIfNotDefault(ts, "fill rule", svgStyle->fillRule(), RULE_NONZERO); ts << "}]"; } writeIfNotDefault(ts, "clip rule", svgStyle->clipRule(), RULE_NONZERO); } writeIfNotEmpty(ts, "start marker", svgStyle->markerStartResource()); writeIfNotEmpty(ts, "middle marker", svgStyle->markerMidResource()); writeIfNotEmpty(ts, "end marker", svgStyle->markerEndResource()); } static TextStream& writePositionAndStyle(TextStream& ts, const RenderObject& object) { ts << " " << enclosingIntRect(const_cast<RenderObject&>(object).absoluteClippedOverflowRect()); writeStyle(ts, object); return ts; } static TextStream& operator<<(TextStream& ts, const RenderSVGShape& shape) { writePositionAndStyle(ts, shape); ASSERT(shape.node()->isSVGElement()); SVGElement* svgElement = toSVGElement(shape.node()); SVGLengthContext lengthContext(svgElement); if (svgElement->hasTagName(SVGNames::rectTag)) { SVGRectElement* element = static_cast<SVGRectElement*>(svgElement); writeNameValuePair(ts, "x", element->x().value(lengthContext)); writeNameValuePair(ts, "y", element->y().value(lengthContext)); writeNameValuePair(ts, "width", element->width().value(lengthContext)); writeNameValuePair(ts, "height", element->height().value(lengthContext)); } else if (svgElement->hasTagName(SVGNames::lineTag)) { SVGLineElement* element = static_cast<SVGLineElement*>(svgElement); writeNameValuePair(ts, "x1", element->x1().value(lengthContext)); writeNameValuePair(ts, "y1", element->y1().value(lengthContext)); writeNameValuePair(ts, "x2", element->x2().value(lengthContext)); writeNameValuePair(ts, "y2", element->y2().value(lengthContext)); } else if (svgElement->hasTagName(SVGNames::ellipseTag)) { SVGEllipseElement* element = static_cast<SVGEllipseElement*>(svgElement); writeNameValuePair(ts, "cx", element->cx().value(lengthContext)); writeNameValuePair(ts, "cy", element->cy().value(lengthContext)); writeNameValuePair(ts, "rx", element->rx().value(lengthContext)); writeNameValuePair(ts, "ry", element->ry().value(lengthContext)); } else if (svgElement->hasTagName(SVGNames::circleTag)) { SVGCircleElement* element = static_cast<SVGCircleElement*>(svgElement); writeNameValuePair(ts, "cx", element->cx().value(lengthContext)); writeNameValuePair(ts, "cy", element->cy().value(lengthContext)); writeNameValuePair(ts, "r", element->r().value(lengthContext)); } else if (svgElement->hasTagName(SVGNames::polygonTag) || svgElement->hasTagName(SVGNames::polylineTag)) { SVGPolyElement* element = static_cast<SVGPolyElement*>(svgElement); writeNameAndQuotedValue(ts, "points", element->pointList().valueAsString()); } else if (svgElement->hasTagName(SVGNames::pathTag)) { SVGPathElement* element = static_cast<SVGPathElement*>(svgElement); String pathString; // FIXME: We should switch to UnalteredParsing here - this will affect the path dumping output of dozens of tests. buildStringFromByteStream(element->pathByteStream(), pathString, NormalizedParsing); writeNameAndQuotedValue(ts, "data", pathString); } else ASSERT_NOT_REACHED(); return ts; } static TextStream& operator<<(TextStream& ts, const RenderSVGRoot& root) { return writePositionAndStyle(ts, root); } static void writeRenderSVGTextBox(TextStream& ts, const RenderSVGText& text) { SVGRootInlineBox* box = static_cast<SVGRootInlineBox*>(text.firstRootBox()); if (!box) return; ts << " " << enclosingIntRect(FloatRect(text.location(), FloatSize(box->logicalWidth(), box->logicalHeight()))); // FIXME: Remove this hack, once the new text layout engine is completly landed. We want to preserve the old layout test results for now. ts << " contains 1 chunk(s)"; if (text.parent() && (text.parent()->style()->visitedDependentColor(CSSPropertyColor) != text.style()->visitedDependentColor(CSSPropertyColor))) writeNameValuePair(ts, "color", text.style()->visitedDependentColor(CSSPropertyColor).nameForRenderTreeAsText()); } static inline void writeSVGInlineTextBox(TextStream& ts, SVGInlineTextBox* textBox, int indent) { Vector<SVGTextFragment>& fragments = textBox->textFragments(); if (fragments.isEmpty()) return; RenderSVGInlineText* textRenderer = toRenderSVGInlineText(textBox->textRenderer()); ASSERT(textRenderer); const SVGRenderStyle* svgStyle = textRenderer->style()->svgStyle(); String text = textBox->textRenderer()->text(); unsigned fragmentsSize = fragments.size(); for (unsigned i = 0; i < fragmentsSize; ++i) { SVGTextFragment& fragment = fragments.at(i); writeIndent(ts, indent + 1); unsigned startOffset = fragment.characterOffset; unsigned endOffset = fragment.characterOffset + fragment.length; // FIXME: Remove this hack, once the new text layout engine is completly landed. We want to preserve the old layout test results for now. ts << "chunk 1 "; ETextAnchor anchor = svgStyle->textAnchor(); bool isVerticalText = svgStyle->isVerticalWritingMode(); if (anchor == TA_MIDDLE) { ts << "(middle anchor"; if (isVerticalText) ts << ", vertical"; ts << ") "; } else if (anchor == TA_END) { ts << "(end anchor"; if (isVerticalText) ts << ", vertical"; ts << ") "; } else if (isVerticalText) ts << "(vertical) "; startOffset -= textBox->start(); endOffset -= textBox->start(); // </hack> ts << "text run " << i + 1 << " at (" << fragment.x << "," << fragment.y << ")"; ts << " startOffset " << startOffset << " endOffset " << endOffset; if (isVerticalText) ts << " height " << fragment.height; else ts << " width " << fragment.width; if (!textBox->isLeftToRightDirection() || textBox->dirOverride()) { ts << (textBox->isLeftToRightDirection() ? " LTR" : " RTL"); if (textBox->dirOverride()) ts << " override"; } ts << ": " << quoteAndEscapeNonPrintables(text.substring(fragment.characterOffset, fragment.length)) << "\n"; } } static inline void writeSVGInlineTextBoxes(TextStream& ts, const RenderText& text, int indent) { for (InlineTextBox* box = text.firstTextBox(); box; box = box->nextTextBox()) { if (!box->isSVGInlineTextBox()) continue; writeSVGInlineTextBox(ts, static_cast<SVGInlineTextBox*>(box), indent); } } static void writeStandardPrefix(TextStream& ts, const RenderObject& object, int indent) { writeIndent(ts, indent); ts << object.renderName(); if (object.node()) ts << " {" << object.node()->nodeName() << "}"; } static void writeChildren(TextStream& ts, const RenderObject& object, int indent) { for (RenderObject* child = object.firstChild(); child; child = child->nextSibling()) write(ts, *child, indent + 1); } static inline void writeCommonGradientProperties(TextStream& ts, SVGSpreadMethodType spreadMethod, const AffineTransform& gradientTransform, SVGUnitTypes::SVGUnitType gradientUnits) { writeNameValuePair(ts, "gradientUnits", gradientUnits); if (spreadMethod != SVGSpreadMethodPad) ts << " [spreadMethod=" << spreadMethod << "]"; if (!gradientTransform.isIdentity()) ts << " [gradientTransform=" << gradientTransform << "]"; } void writeSVGResourceContainer(TextStream& ts, const RenderObject& object, int indent) { writeStandardPrefix(ts, object, indent); Element* element = toElement(object.node()); const AtomicString& id = element->getIdAttribute(); writeNameAndQuotedValue(ts, "id", id); RenderSVGResourceContainer* resource = const_cast<RenderObject&>(object).toRenderSVGResourceContainer(); ASSERT(resource); if (resource->resourceType() == MaskerResourceType) { RenderSVGResourceMasker* masker = static_cast<RenderSVGResourceMasker*>(resource); writeNameValuePair(ts, "maskUnits", masker->maskUnits()); writeNameValuePair(ts, "maskContentUnits", masker->maskContentUnits()); ts << "\n"; #if ENABLE(FILTERS) } else if (resource->resourceType() == FilterResourceType) { RenderSVGResourceFilter* filter = static_cast<RenderSVGResourceFilter*>(resource); writeNameValuePair(ts, "filterUnits", filter->filterUnits()); writeNameValuePair(ts, "primitiveUnits", filter->primitiveUnits()); ts << "\n"; // Creating a placeholder filter which is passed to the builder. FloatRect dummyRect; RefPtr<SVGFilter> dummyFilter = SVGFilter::create(AffineTransform(), dummyRect, dummyRect, dummyRect, true); if (RefPtr<SVGFilterBuilder> builder = filter->buildPrimitives(dummyFilter.get())) { if (FilterEffect* lastEffect = builder->lastEffect()) lastEffect->externalRepresentation(ts, indent + 1); } #endif } else if (resource->resourceType() == ClipperResourceType) { RenderSVGResourceClipper* clipper = static_cast<RenderSVGResourceClipper*>(resource); writeNameValuePair(ts, "clipPathUnits", clipper->clipPathUnits()); ts << "\n"; } else if (resource->resourceType() == MarkerResourceType) { RenderSVGResourceMarker* marker = static_cast<RenderSVGResourceMarker*>(resource); writeNameValuePair(ts, "markerUnits", marker->markerUnits()); ts << " [ref at " << marker->referencePoint() << "]"; ts << " [angle="; if (marker->angle() == -1) ts << "auto" << "]\n"; else ts << marker->angle() << "]\n"; } else if (resource->resourceType() == PatternResourceType) { RenderSVGResourcePattern* pattern = static_cast<RenderSVGResourcePattern*>(resource); // Dump final results that are used for rendering. No use in asking SVGPatternElement for its patternUnits(), as it may // link to other patterns using xlink:href, we need to build the full inheritance chain, aka. collectPatternProperties() PatternAttributes attributes; static_cast<SVGPatternElement*>(pattern->node())->collectPatternAttributes(attributes); writeNameValuePair(ts, "patternUnits", attributes.patternUnits()); writeNameValuePair(ts, "patternContentUnits", attributes.patternContentUnits()); AffineTransform transform = attributes.patternTransform(); if (!transform.isIdentity()) ts << " [patternTransform=" << transform << "]"; ts << "\n"; } else if (resource->resourceType() == LinearGradientResourceType) { RenderSVGResourceLinearGradient* gradient = static_cast<RenderSVGResourceLinearGradient*>(resource); // Dump final results that are used for rendering. No use in asking SVGGradientElement for its gradientUnits(), as it may // link to other gradients using xlink:href, we need to build the full inheritance chain, aka. collectGradientProperties() SVGLinearGradientElement* linearGradientElement = static_cast<SVGLinearGradientElement*>(gradient->node()); LinearGradientAttributes attributes; linearGradientElement->collectGradientAttributes(attributes); writeCommonGradientProperties(ts, attributes.spreadMethod(), attributes.gradientTransform(), attributes.gradientUnits()); ts << " [start=" << gradient->startPoint(attributes) << "] [end=" << gradient->endPoint(attributes) << "]\n"; } else if (resource->resourceType() == RadialGradientResourceType) { RenderSVGResourceRadialGradient* gradient = static_cast<RenderSVGResourceRadialGradient*>(resource); // Dump final results that are used for rendering. No use in asking SVGGradientElement for its gradientUnits(), as it may // link to other gradients using xlink:href, we need to build the full inheritance chain, aka. collectGradientProperties() SVGRadialGradientElement* radialGradientElement = static_cast<SVGRadialGradientElement*>(gradient->node()); RadialGradientAttributes attributes; radialGradientElement->collectGradientAttributes(attributes); writeCommonGradientProperties(ts, attributes.spreadMethod(), attributes.gradientTransform(), attributes.gradientUnits()); FloatPoint focalPoint = gradient->focalPoint(attributes); FloatPoint centerPoint = gradient->centerPoint(attributes); float radius = gradient->radius(attributes); float focalRadius = gradient->focalRadius(attributes); ts << " [center=" << centerPoint << "] [focal=" << focalPoint << "] [radius=" << radius << "] [focalRadius=" << focalRadius << "]\n"; } else ts << "\n"; writeChildren(ts, object, indent); } void writeSVGContainer(TextStream& ts, const RenderObject& container, int indent) { // Currently RenderSVGResourceFilterPrimitive has no meaningful output. if (container.isSVGResourceFilterPrimitive()) return; writeStandardPrefix(ts, container, indent); writePositionAndStyle(ts, container); ts << "\n"; writeResources(ts, container, indent); writeChildren(ts, container, indent); } void write(TextStream& ts, const RenderSVGRoot& root, int indent) { writeStandardPrefix(ts, root, indent); ts << root << "\n"; writeChildren(ts, root, indent); } void writeSVGText(TextStream& ts, const RenderSVGText& text, int indent) { writeStandardPrefix(ts, text, indent); writeRenderSVGTextBox(ts, text); ts << "\n"; writeResources(ts, text, indent); writeChildren(ts, text, indent); } void writeSVGInlineText(TextStream& ts, const RenderSVGInlineText& text, int indent) { writeStandardPrefix(ts, text, indent); ts << " " << enclosingIntRect(FloatRect(text.firstRunOrigin(), text.floatLinesBoundingBox().size())) << "\n"; writeResources(ts, text, indent); writeSVGInlineTextBoxes(ts, text, indent); } void writeSVGImage(TextStream& ts, const RenderSVGImage& image, int indent) { writeStandardPrefix(ts, image, indent); writePositionAndStyle(ts, image); ts << "\n"; writeResources(ts, image, indent); } void write(TextStream& ts, const RenderSVGShape& shape, int indent) { writeStandardPrefix(ts, shape, indent); ts << shape << "\n"; writeResources(ts, shape, indent); } void writeSVGGradientStop(TextStream& ts, const RenderSVGGradientStop& stop, int indent) { writeStandardPrefix(ts, stop, indent); SVGStopElement* stopElement = static_cast<SVGStopElement*>(stop.node()); ASSERT(stopElement); RenderStyle* style = stop.style(); if (!style) return; ts << " [offset=" << stopElement->offset() << "] [color=" << stopElement->stopColorIncludingOpacity() << "]\n"; } void writeResources(TextStream& ts, const RenderObject& object, int indent) { const RenderStyle* style = object.style(); const SVGRenderStyle* svgStyle = style->svgStyle(); // FIXME: We want to use SVGResourcesCache to determine which resources are present, instead of quering the resource <-> id cache. // For now leave the DRT output as is, but later on we should change this so cycles are properly ignored in the DRT output. RenderObject& renderer = const_cast<RenderObject&>(object); if (!svgStyle->maskerResource().isEmpty()) { if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(object.document(), svgStyle->maskerResource())) { writeIndent(ts, indent); ts << " "; writeNameAndQuotedValue(ts, "masker", svgStyle->maskerResource()); ts << " "; writeStandardPrefix(ts, *masker, 0); ts << " " << masker->resourceBoundingBox(&renderer) << "\n"; } } if (!svgStyle->clipperResource().isEmpty()) { if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(object.document(), svgStyle->clipperResource())) { writeIndent(ts, indent); ts << " "; writeNameAndQuotedValue(ts, "clipPath", svgStyle->clipperResource()); ts << " "; writeStandardPrefix(ts, *clipper, 0); ts << " " << clipper->resourceBoundingBox(&renderer) << "\n"; } } #if ENABLE(FILTERS) if (!svgStyle->filterResource().isEmpty()) { if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(object.document(), svgStyle->filterResource())) { writeIndent(ts, indent); ts << " "; writeNameAndQuotedValue(ts, "filter", svgStyle->filterResource()); ts << " "; writeStandardPrefix(ts, *filter, 0); ts << " " << filter->resourceBoundingBox(&renderer) << "\n"; } } #endif } } // namespace WebCore #endif // ENABLE(SVG)
maiklos-mirrors/jfx78
modules/web/src/main/native/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp
C++
gpl-2.0
27,726
<?php /** * @copyright Copyright (C) eZ Systems AS. All rights reserved. * @license For full copyright and license information view LICENSE file distributed with this source code. */ declare(strict_types=1); namespace eZ\Publish\API\Repository\Values\Content\RelationList\Item; use eZ\Publish\API\Repository\Lists\UnauthorizedListItem; use eZ\Publish\API\Repository\Values\Content\RelationList\RelationListItemInterface; use eZ\Publish\API\Repository\Values\Content\Relation; /** * Item of relation list. */ final class UnauthorizedRelationListItem extends UnauthorizedListItem implements RelationListItemInterface { public function getRelation(): ?Relation { return null; } public function hasRelation(): bool { return false; } }
ezsystems/ezpublish-kernel
eZ/Publish/API/Repository/Values/Content/RelationList/Item/UnauthorizedRelationListItem.php
PHP
gpl-2.0
781
#include "dnsdist.hh" #include "lock.hh" unsigned int Rings::numDistinctRequestors() { std::set<ComboAddress, ComboAddress::addressOnlyLessThan> s; WriteLock wl(&queryLock); for(const auto& q : queryRing) s.insert(q.requestor); return s.size(); } vector<pair<unsigned int,ComboAddress> > Rings::getTopBandwidth(unsigned int numentries) { map<ComboAddress, unsigned int, ComboAddress::addressOnlyLessThan> counts; { WriteLock wl(&queryLock); for(const auto& q : queryRing) counts[q.requestor]+=q.size; } { std::lock_guard<std::mutex> lock(respMutex); for(const auto& r : respRing) counts[r.requestor]+=r.size; } typedef vector<pair<unsigned int, ComboAddress>> ret_t; ret_t ret; for(const auto& p : counts) ret.push_back({p.second, p.first}); numentries = ret.size() < numentries ? ret.size() : numentries; partial_sort(ret.begin(), ret.begin()+numentries, ret.end(), [](const ret_t::value_type&a, const ret_t::value_type&b) { return(b.second < a.second); }); ret.resize(numentries); return ret; }
nlyan/pdns
pdns/dnsdist-rings.cc
C++
gpl-2.0
1,088
// This file is part of Hermes2D. // // Hermes2D is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // Hermes2D 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 Hermes2D. If not, see <http://www.gnu.org/licenses/>. #include "common.h" #include "shapeset.h" #include "shapeset_common.h" #include "shapeset_l2_all.h" //// quad legendre shapeset ///////////////////////////////////////////////////////////////// static double leg_quad_l0_l0(double x, double y) { return Legendre0(x) * Legendre0(y); } static double leg_quad_l0_l0x(double x, double y) { return Legendre0x(x) * Legendre0(y); } static double leg_quad_l0_l0y(double x, double y) { return Legendre0(x) * Legendre0x(y); } static double leg_quad_l0_l0xx(double x, double y) { return Legendre0xx(x) * Legendre0(y); } static double leg_quad_l0_l0xy(double x, double y) { return Legendre0x(x) * Legendre0x(y); } static double leg_quad_l0_l0yy(double x, double y) { return Legendre0(x) * Legendre0xx(y); } static double leg_quad_l0_l1(double x, double y) { return Legendre0(x) * Legendre1(y); } static double leg_quad_l0_l1x(double x, double y) { return Legendre0x(x) * Legendre1(y); } static double leg_quad_l0_l1y(double x, double y) { return Legendre0(x) * Legendre1x(y); } static double leg_quad_l0_l1xx(double x, double y) { return Legendre0xx(x) * Legendre1(y); } static double leg_quad_l0_l1xy(double x, double y) { return Legendre0x(x) * Legendre1x(y); } static double leg_quad_l0_l1yy(double x, double y) { return Legendre0(x) * Legendre1xx(y); } static double leg_quad_l0_l2(double x, double y) { return Legendre0(x) * Legendre2(y); } static double leg_quad_l0_l2x(double x, double y) { return Legendre0x(x) * Legendre2(y); } static double leg_quad_l0_l2y(double x, double y) { return Legendre0(x) * Legendre2x(y); } static double leg_quad_l0_l2xx(double x, double y) { return Legendre0xx(x) * Legendre2(y); } static double leg_quad_l0_l2xy(double x, double y) { return Legendre0x(x) * Legendre2x(y); } static double leg_quad_l0_l2yy(double x, double y) { return Legendre0(x) * Legendre2xx(y); } static double leg_quad_l0_l3(double x, double y) { return Legendre0(x) * Legendre3(y); } static double leg_quad_l0_l3x(double x, double y) { return Legendre0x(x) * Legendre3(y); } static double leg_quad_l0_l3y(double x, double y) { return Legendre0(x) * Legendre3x(y); } static double leg_quad_l0_l3xx(double x, double y) { return Legendre0xx(x) * Legendre3(y); } static double leg_quad_l0_l3xy(double x, double y) { return Legendre0x(x) * Legendre3x(y); } static double leg_quad_l0_l3yy(double x, double y) { return Legendre0(x) * Legendre3xx(y); } static double leg_quad_l0_l4(double x, double y) { return Legendre0(x) * Legendre4(y); } static double leg_quad_l0_l4x(double x, double y) { return Legendre0x(x) * Legendre4(y); } static double leg_quad_l0_l4y(double x, double y) { return Legendre0(x) * Legendre4x(y); } static double leg_quad_l0_l4xx(double x, double y) { return Legendre0xx(x) * Legendre4(y); } static double leg_quad_l0_l4xy(double x, double y) { return Legendre0x(x) * Legendre4x(y); } static double leg_quad_l0_l4yy(double x, double y) { return Legendre0(x) * Legendre4xx(y); } static double leg_quad_l0_l5(double x, double y) { return Legendre0(x) * Legendre5(y); } static double leg_quad_l0_l5x(double x, double y) { return Legendre0x(x) * Legendre5(y); } static double leg_quad_l0_l5y(double x, double y) { return Legendre0(x) * Legendre5x(y); } static double leg_quad_l0_l5xx(double x, double y) { return Legendre0xx(x) * Legendre5(y); } static double leg_quad_l0_l5xy(double x, double y) { return Legendre0x(x) * Legendre5x(y); } static double leg_quad_l0_l5yy(double x, double y) { return Legendre0(x) * Legendre5xx(y); } static double leg_quad_l0_l6(double x, double y) { return Legendre0(x) * Legendre6(y); } static double leg_quad_l0_l6x(double x, double y) { return Legendre0x(x) * Legendre6(y); } static double leg_quad_l0_l6y(double x, double y) { return Legendre0(x) * Legendre6x(y); } static double leg_quad_l0_l6xx(double x, double y) { return Legendre0xx(x) * Legendre6(y); } static double leg_quad_l0_l6xy(double x, double y) { return Legendre0x(x) * Legendre6x(y); } static double leg_quad_l0_l6yy(double x, double y) { return Legendre0(x) * Legendre6xx(y); } static double leg_quad_l0_l7(double x, double y) { return Legendre0(x) * Legendre7(y); } static double leg_quad_l0_l7x(double x, double y) { return Legendre0x(x) * Legendre7(y); } static double leg_quad_l0_l7y(double x, double y) { return Legendre0(x) * Legendre7x(y); } static double leg_quad_l0_l7xx(double x, double y) { return Legendre0xx(x) * Legendre7(y); } static double leg_quad_l0_l7xy(double x, double y) { return Legendre0x(x) * Legendre7x(y); } static double leg_quad_l0_l7yy(double x, double y) { return Legendre0(x) * Legendre7xx(y); } static double leg_quad_l0_l8(double x, double y) { return Legendre0(x) * Legendre8(y); } static double leg_quad_l0_l8x(double x, double y) { return Legendre0x(x) * Legendre8(y); } static double leg_quad_l0_l8y(double x, double y) { return Legendre0(x) * Legendre8x(y); } static double leg_quad_l0_l8xx(double x, double y) { return Legendre0xx(x) * Legendre8(y); } static double leg_quad_l0_l8xy(double x, double y) { return Legendre0x(x) * Legendre8x(y); } static double leg_quad_l0_l8yy(double x, double y) { return Legendre0(x) * Legendre8xx(y); } static double leg_quad_l0_l9(double x, double y) { return Legendre0(x) * Legendre9(y); } static double leg_quad_l0_l9x(double x, double y) { return Legendre0x(x) * Legendre9(y); } static double leg_quad_l0_l9y(double x, double y) { return Legendre0(x) * Legendre9x(y); } static double leg_quad_l0_l9xx(double x, double y) { return Legendre0xx(x) * Legendre9(y); } static double leg_quad_l0_l9xy(double x, double y) { return Legendre0x(x) * Legendre9x(y); } static double leg_quad_l0_l9yy(double x, double y) { return Legendre0(x) * Legendre9xx(y); } static double leg_quad_l0_l10(double x, double y) { return Legendre0(x) * Legendre10(y); } static double leg_quad_l0_l10x(double x, double y) { return Legendre0x(x) * Legendre10(y); } static double leg_quad_l0_l10y(double x, double y) { return Legendre0(x) * Legendre10x(y); } static double leg_quad_l0_l10xx(double x, double y) { return Legendre0xx(x) * Legendre10(y); } static double leg_quad_l0_l10xy(double x, double y) { return Legendre0x(x) * Legendre10x(y); } static double leg_quad_l0_l10yy(double x, double y) { return Legendre0(x) * Legendre10xx(y); } static double leg_quad_l1_l0(double x, double y) { return Legendre1(x) * Legendre0(y); } static double leg_quad_l1_l0x(double x, double y) { return Legendre1x(x) * Legendre0(y); } static double leg_quad_l1_l0y(double x, double y) { return Legendre1(x) * Legendre0x(y); } static double leg_quad_l1_l0xx(double x, double y) { return Legendre1xx(x) * Legendre0(y); } static double leg_quad_l1_l0xy(double x, double y) { return Legendre1x(x) * Legendre0x(y); } static double leg_quad_l1_l0yy(double x, double y) { return Legendre1(x) * Legendre0xx(y); } static double leg_quad_l1_l1(double x, double y) { return Legendre1(x) * Legendre1(y); } static double leg_quad_l1_l1x(double x, double y) { return Legendre1x(x) * Legendre1(y); } static double leg_quad_l1_l1y(double x, double y) { return Legendre1(x) * Legendre1x(y); } static double leg_quad_l1_l1xx(double x, double y) { return Legendre1xx(x) * Legendre1(y); } static double leg_quad_l1_l1xy(double x, double y) { return Legendre1x(x) * Legendre1x(y); } static double leg_quad_l1_l1yy(double x, double y) { return Legendre1(x) * Legendre1xx(y); } static double leg_quad_l1_l2(double x, double y) { return Legendre1(x) * Legendre2(y); } static double leg_quad_l1_l2x(double x, double y) { return Legendre1x(x) * Legendre2(y); } static double leg_quad_l1_l2y(double x, double y) { return Legendre1(x) * Legendre2x(y); } static double leg_quad_l1_l2xx(double x, double y) { return Legendre1xx(x) * Legendre2(y); } static double leg_quad_l1_l2xy(double x, double y) { return Legendre1x(x) * Legendre2x(y); } static double leg_quad_l1_l2yy(double x, double y) { return Legendre1(x) * Legendre2xx(y); } static double leg_quad_l1_l3(double x, double y) { return Legendre1(x) * Legendre3(y); } static double leg_quad_l1_l3x(double x, double y) { return Legendre1x(x) * Legendre3(y); } static double leg_quad_l1_l3y(double x, double y) { return Legendre1(x) * Legendre3x(y); } static double leg_quad_l1_l3xx(double x, double y) { return Legendre1xx(x) * Legendre3(y); } static double leg_quad_l1_l3xy(double x, double y) { return Legendre1x(x) * Legendre3x(y); } static double leg_quad_l1_l3yy(double x, double y) { return Legendre1(x) * Legendre3xx(y); } static double leg_quad_l1_l4(double x, double y) { return Legendre1(x) * Legendre4(y); } static double leg_quad_l1_l4x(double x, double y) { return Legendre1x(x) * Legendre4(y); } static double leg_quad_l1_l4y(double x, double y) { return Legendre1(x) * Legendre4x(y); } static double leg_quad_l1_l4xx(double x, double y) { return Legendre1xx(x) * Legendre4(y); } static double leg_quad_l1_l4xy(double x, double y) { return Legendre1x(x) * Legendre4x(y); } static double leg_quad_l1_l4yy(double x, double y) { return Legendre1(x) * Legendre4xx(y); } static double leg_quad_l1_l5(double x, double y) { return Legendre1(x) * Legendre5(y); } static double leg_quad_l1_l5x(double x, double y) { return Legendre1x(x) * Legendre5(y); } static double leg_quad_l1_l5y(double x, double y) { return Legendre1(x) * Legendre5x(y); } static double leg_quad_l1_l5xx(double x, double y) { return Legendre1xx(x) * Legendre5(y); } static double leg_quad_l1_l5xy(double x, double y) { return Legendre1x(x) * Legendre5x(y); } static double leg_quad_l1_l5yy(double x, double y) { return Legendre1(x) * Legendre5xx(y); } static double leg_quad_l1_l6(double x, double y) { return Legendre1(x) * Legendre6(y); } static double leg_quad_l1_l6x(double x, double y) { return Legendre1x(x) * Legendre6(y); } static double leg_quad_l1_l6y(double x, double y) { return Legendre1(x) * Legendre6x(y); } static double leg_quad_l1_l6xx(double x, double y) { return Legendre1xx(x) * Legendre6(y); } static double leg_quad_l1_l6xy(double x, double y) { return Legendre1x(x) * Legendre6x(y); } static double leg_quad_l1_l6yy(double x, double y) { return Legendre1(x) * Legendre6xx(y); } static double leg_quad_l1_l7(double x, double y) { return Legendre1(x) * Legendre7(y); } static double leg_quad_l1_l7x(double x, double y) { return Legendre1x(x) * Legendre7(y); } static double leg_quad_l1_l7y(double x, double y) { return Legendre1(x) * Legendre7x(y); } static double leg_quad_l1_l7xx(double x, double y) { return Legendre1xx(x) * Legendre7(y); } static double leg_quad_l1_l7xy(double x, double y) { return Legendre1x(x) * Legendre7x(y); } static double leg_quad_l1_l7yy(double x, double y) { return Legendre1(x) * Legendre7xx(y); } static double leg_quad_l1_l8(double x, double y) { return Legendre1(x) * Legendre8(y); } static double leg_quad_l1_l8x(double x, double y) { return Legendre1x(x) * Legendre8(y); } static double leg_quad_l1_l8y(double x, double y) { return Legendre1(x) * Legendre8x(y); } static double leg_quad_l1_l8xx(double x, double y) { return Legendre1xx(x) * Legendre8(y); } static double leg_quad_l1_l8xy(double x, double y) { return Legendre1x(x) * Legendre8x(y); } static double leg_quad_l1_l8yy(double x, double y) { return Legendre1(x) * Legendre8xx(y); } static double leg_quad_l1_l9(double x, double y) { return Legendre1(x) * Legendre9(y); } static double leg_quad_l1_l9x(double x, double y) { return Legendre1x(x) * Legendre9(y); } static double leg_quad_l1_l9y(double x, double y) { return Legendre1(x) * Legendre9x(y); } static double leg_quad_l1_l9xx(double x, double y) { return Legendre1xx(x) * Legendre9(y); } static double leg_quad_l1_l9xy(double x, double y) { return Legendre1x(x) * Legendre9x(y); } static double leg_quad_l1_l9yy(double x, double y) { return Legendre1(x) * Legendre9xx(y); } static double leg_quad_l1_l10(double x, double y) { return Legendre1(x) * Legendre10(y); } static double leg_quad_l1_l10x(double x, double y) { return Legendre1x(x) * Legendre10(y); } static double leg_quad_l1_l10y(double x, double y) { return Legendre1(x) * Legendre10x(y); } static double leg_quad_l1_l10xx(double x, double y) { return Legendre1xx(x) * Legendre10(y); } static double leg_quad_l1_l10xy(double x, double y) { return Legendre1x(x) * Legendre10x(y); } static double leg_quad_l1_l10yy(double x, double y) { return Legendre1(x) * Legendre10xx(y); } static double leg_quad_l2_l0(double x, double y) { return Legendre2(x) * Legendre0(y); } static double leg_quad_l2_l0x(double x, double y) { return Legendre2x(x) * Legendre0(y); } static double leg_quad_l2_l0y(double x, double y) { return Legendre2(x) * Legendre0x(y); } static double leg_quad_l2_l0xx(double x, double y) { return Legendre2xx(x) * Legendre0(y); } static double leg_quad_l2_l0xy(double x, double y) { return Legendre2x(x) * Legendre0x(y); } static double leg_quad_l2_l0yy(double x, double y) { return Legendre2(x) * Legendre0xx(y); } static double leg_quad_l2_l1(double x, double y) { return Legendre2(x) * Legendre1(y); } static double leg_quad_l2_l1x(double x, double y) { return Legendre2x(x) * Legendre1(y); } static double leg_quad_l2_l1y(double x, double y) { return Legendre2(x) * Legendre1x(y); } static double leg_quad_l2_l1xx(double x, double y) { return Legendre2xx(x) * Legendre1(y); } static double leg_quad_l2_l1xy(double x, double y) { return Legendre2x(x) * Legendre1x(y); } static double leg_quad_l2_l1yy(double x, double y) { return Legendre2(x) * Legendre1xx(y); } static double leg_quad_l2_l2(double x, double y) { return Legendre2(x) * Legendre2(y); } static double leg_quad_l2_l2x(double x, double y) { return Legendre2x(x) * Legendre2(y); } static double leg_quad_l2_l2y(double x, double y) { return Legendre2(x) * Legendre2x(y); } static double leg_quad_l2_l2xx(double x, double y) { return Legendre2xx(x) * Legendre2(y); } static double leg_quad_l2_l2xy(double x, double y) { return Legendre2x(x) * Legendre2x(y); } static double leg_quad_l2_l2yy(double x, double y) { return Legendre2(x) * Legendre2xx(y); } static double leg_quad_l2_l3(double x, double y) { return Legendre2(x) * Legendre3(y); } static double leg_quad_l2_l3x(double x, double y) { return Legendre2x(x) * Legendre3(y); } static double leg_quad_l2_l3y(double x, double y) { return Legendre2(x) * Legendre3x(y); } static double leg_quad_l2_l3xx(double x, double y) { return Legendre2xx(x) * Legendre3(y); } static double leg_quad_l2_l3xy(double x, double y) { return Legendre2x(x) * Legendre3x(y); } static double leg_quad_l2_l3yy(double x, double y) { return Legendre2(x) * Legendre3xx(y); } static double leg_quad_l2_l4(double x, double y) { return Legendre2(x) * Legendre4(y); } static double leg_quad_l2_l4x(double x, double y) { return Legendre2x(x) * Legendre4(y); } static double leg_quad_l2_l4y(double x, double y) { return Legendre2(x) * Legendre4x(y); } static double leg_quad_l2_l4xx(double x, double y) { return Legendre2xx(x) * Legendre4(y); } static double leg_quad_l2_l4xy(double x, double y) { return Legendre2x(x) * Legendre4x(y); } static double leg_quad_l2_l4yy(double x, double y) { return Legendre2(x) * Legendre4xx(y); } static double leg_quad_l2_l5(double x, double y) { return Legendre2(x) * Legendre5(y); } static double leg_quad_l2_l5x(double x, double y) { return Legendre2x(x) * Legendre5(y); } static double leg_quad_l2_l5y(double x, double y) { return Legendre2(x) * Legendre5x(y); } static double leg_quad_l2_l5xx(double x, double y) { return Legendre2xx(x) * Legendre5(y); } static double leg_quad_l2_l5xy(double x, double y) { return Legendre2x(x) * Legendre5x(y); } static double leg_quad_l2_l5yy(double x, double y) { return Legendre2(x) * Legendre5xx(y); } static double leg_quad_l2_l6(double x, double y) { return Legendre2(x) * Legendre6(y); } static double leg_quad_l2_l6x(double x, double y) { return Legendre2x(x) * Legendre6(y); } static double leg_quad_l2_l6y(double x, double y) { return Legendre2(x) * Legendre6x(y); } static double leg_quad_l2_l6xx(double x, double y) { return Legendre2xx(x) * Legendre6(y); } static double leg_quad_l2_l6xy(double x, double y) { return Legendre2x(x) * Legendre6x(y); } static double leg_quad_l2_l6yy(double x, double y) { return Legendre2(x) * Legendre6xx(y); } static double leg_quad_l2_l7(double x, double y) { return Legendre2(x) * Legendre7(y); } static double leg_quad_l2_l7x(double x, double y) { return Legendre2x(x) * Legendre7(y); } static double leg_quad_l2_l7y(double x, double y) { return Legendre2(x) * Legendre7x(y); } static double leg_quad_l2_l7xx(double x, double y) { return Legendre2xx(x) * Legendre7(y); } static double leg_quad_l2_l7xy(double x, double y) { return Legendre2x(x) * Legendre7x(y); } static double leg_quad_l2_l7yy(double x, double y) { return Legendre2(x) * Legendre7xx(y); } static double leg_quad_l2_l8(double x, double y) { return Legendre2(x) * Legendre8(y); } static double leg_quad_l2_l8x(double x, double y) { return Legendre2x(x) * Legendre8(y); } static double leg_quad_l2_l8y(double x, double y) { return Legendre2(x) * Legendre8x(y); } static double leg_quad_l2_l8xx(double x, double y) { return Legendre2xx(x) * Legendre8(y); } static double leg_quad_l2_l8xy(double x, double y) { return Legendre2x(x) * Legendre8x(y); } static double leg_quad_l2_l8yy(double x, double y) { return Legendre2(x) * Legendre8xx(y); } static double leg_quad_l2_l9(double x, double y) { return Legendre2(x) * Legendre9(y); } static double leg_quad_l2_l9x(double x, double y) { return Legendre2x(x) * Legendre9(y); } static double leg_quad_l2_l9y(double x, double y) { return Legendre2(x) * Legendre9x(y); } static double leg_quad_l2_l9xx(double x, double y) { return Legendre2xx(x) * Legendre9(y); } static double leg_quad_l2_l9xy(double x, double y) { return Legendre2x(x) * Legendre9x(y); } static double leg_quad_l2_l9yy(double x, double y) { return Legendre2(x) * Legendre9xx(y); } static double leg_quad_l2_l10(double x, double y) { return Legendre2(x) * Legendre10(y); } static double leg_quad_l2_l10x(double x, double y) { return Legendre2x(x) * Legendre10(y); } static double leg_quad_l2_l10y(double x, double y) { return Legendre2(x) * Legendre10x(y); } static double leg_quad_l2_l10xx(double x, double y) { return Legendre2xx(x) * Legendre10(y); } static double leg_quad_l2_l10xy(double x, double y) { return Legendre2x(x) * Legendre10x(y); } static double leg_quad_l2_l10yy(double x, double y) { return Legendre2(x) * Legendre10xx(y); } static double leg_quad_l3_l0(double x, double y) { return Legendre3(x) * Legendre0(y); } static double leg_quad_l3_l0x(double x, double y) { return Legendre3x(x) * Legendre0(y); } static double leg_quad_l3_l0y(double x, double y) { return Legendre3(x) * Legendre0x(y); } static double leg_quad_l3_l0xx(double x, double y) { return Legendre3xx(x) * Legendre0(y); } static double leg_quad_l3_l0xy(double x, double y) { return Legendre3x(x) * Legendre0x(y); } static double leg_quad_l3_l0yy(double x, double y) { return Legendre3(x) * Legendre0xx(y); } static double leg_quad_l3_l1(double x, double y) { return Legendre3(x) * Legendre1(y); } static double leg_quad_l3_l1x(double x, double y) { return Legendre3x(x) * Legendre1(y); } static double leg_quad_l3_l1y(double x, double y) { return Legendre3(x) * Legendre1x(y); } static double leg_quad_l3_l1xx(double x, double y) { return Legendre3xx(x) * Legendre1(y); } static double leg_quad_l3_l1xy(double x, double y) { return Legendre3x(x) * Legendre1x(y); } static double leg_quad_l3_l1yy(double x, double y) { return Legendre3(x) * Legendre1xx(y); } static double leg_quad_l3_l2(double x, double y) { return Legendre3(x) * Legendre2(y); } static double leg_quad_l3_l2x(double x, double y) { return Legendre3x(x) * Legendre2(y); } static double leg_quad_l3_l2y(double x, double y) { return Legendre3(x) * Legendre2x(y); } static double leg_quad_l3_l2xx(double x, double y) { return Legendre3xx(x) * Legendre2(y); } static double leg_quad_l3_l2xy(double x, double y) { return Legendre3x(x) * Legendre2x(y); } static double leg_quad_l3_l2yy(double x, double y) { return Legendre3(x) * Legendre2xx(y); } static double leg_quad_l3_l3(double x, double y) { return Legendre3(x) * Legendre3(y); } static double leg_quad_l3_l3x(double x, double y) { return Legendre3x(x) * Legendre3(y); } static double leg_quad_l3_l3y(double x, double y) { return Legendre3(x) * Legendre3x(y); } static double leg_quad_l3_l3xx(double x, double y) { return Legendre3xx(x) * Legendre3(y); } static double leg_quad_l3_l3xy(double x, double y) { return Legendre3x(x) * Legendre3x(y); } static double leg_quad_l3_l3yy(double x, double y) { return Legendre3(x) * Legendre3xx(y); } static double leg_quad_l3_l4(double x, double y) { return Legendre3(x) * Legendre4(y); } static double leg_quad_l3_l4x(double x, double y) { return Legendre3x(x) * Legendre4(y); } static double leg_quad_l3_l4y(double x, double y) { return Legendre3(x) * Legendre4x(y); } static double leg_quad_l3_l4xx(double x, double y) { return Legendre3xx(x) * Legendre4(y); } static double leg_quad_l3_l4xy(double x, double y) { return Legendre3x(x) * Legendre4x(y); } static double leg_quad_l3_l4yy(double x, double y) { return Legendre3(x) * Legendre4xx(y); } static double leg_quad_l3_l5(double x, double y) { return Legendre3(x) * Legendre5(y); } static double leg_quad_l3_l5x(double x, double y) { return Legendre3x(x) * Legendre5(y); } static double leg_quad_l3_l5y(double x, double y) { return Legendre3(x) * Legendre5x(y); } static double leg_quad_l3_l5xx(double x, double y) { return Legendre3xx(x) * Legendre5(y); } static double leg_quad_l3_l5xy(double x, double y) { return Legendre3x(x) * Legendre5x(y); } static double leg_quad_l3_l5yy(double x, double y) { return Legendre3(x) * Legendre5xx(y); } static double leg_quad_l3_l6(double x, double y) { return Legendre3(x) * Legendre6(y); } static double leg_quad_l3_l6x(double x, double y) { return Legendre3x(x) * Legendre6(y); } static double leg_quad_l3_l6y(double x, double y) { return Legendre3(x) * Legendre6x(y); } static double leg_quad_l3_l6xx(double x, double y) { return Legendre3xx(x) * Legendre6(y); } static double leg_quad_l3_l6xy(double x, double y) { return Legendre3x(x) * Legendre6x(y); } static double leg_quad_l3_l6yy(double x, double y) { return Legendre3(x) * Legendre6xx(y); } static double leg_quad_l3_l7(double x, double y) { return Legendre3(x) * Legendre7(y); } static double leg_quad_l3_l7x(double x, double y) { return Legendre3x(x) * Legendre7(y); } static double leg_quad_l3_l7y(double x, double y) { return Legendre3(x) * Legendre7x(y); } static double leg_quad_l3_l7xx(double x, double y) { return Legendre3xx(x) * Legendre7(y); } static double leg_quad_l3_l7xy(double x, double y) { return Legendre3x(x) * Legendre7x(y); } static double leg_quad_l3_l7yy(double x, double y) { return Legendre3(x) * Legendre7xx(y); } static double leg_quad_l3_l8(double x, double y) { return Legendre3(x) * Legendre8(y); } static double leg_quad_l3_l8x(double x, double y) { return Legendre3x(x) * Legendre8(y); } static double leg_quad_l3_l8y(double x, double y) { return Legendre3(x) * Legendre8x(y); } static double leg_quad_l3_l8xx(double x, double y) { return Legendre3xx(x) * Legendre8(y); } static double leg_quad_l3_l8xy(double x, double y) { return Legendre3x(x) * Legendre8x(y); } static double leg_quad_l3_l8yy(double x, double y) { return Legendre3(x) * Legendre8xx(y); } static double leg_quad_l3_l9(double x, double y) { return Legendre3(x) * Legendre9(y); } static double leg_quad_l3_l9x(double x, double y) { return Legendre3x(x) * Legendre9(y); } static double leg_quad_l3_l9y(double x, double y) { return Legendre3(x) * Legendre9x(y); } static double leg_quad_l3_l9xx(double x, double y) { return Legendre3xx(x) * Legendre9(y); } static double leg_quad_l3_l9xy(double x, double y) { return Legendre3x(x) * Legendre9x(y); } static double leg_quad_l3_l9yy(double x, double y) { return Legendre3(x) * Legendre9xx(y); } static double leg_quad_l3_l10(double x, double y) { return Legendre3(x) * Legendre10(y); } static double leg_quad_l3_l10x(double x, double y) { return Legendre3x(x) * Legendre10(y); } static double leg_quad_l3_l10y(double x, double y) { return Legendre3(x) * Legendre10x(y); } static double leg_quad_l3_l10xx(double x, double y) { return Legendre3xx(x) * Legendre10(y); } static double leg_quad_l3_l10xy(double x, double y) { return Legendre3x(x) * Legendre10x(y); } static double leg_quad_l3_l10yy(double x, double y) { return Legendre3(x) * Legendre10xx(y); } static double leg_quad_l4_l0(double x, double y) { return Legendre4(x) * Legendre0(y); } static double leg_quad_l4_l0x(double x, double y) { return Legendre4x(x) * Legendre0(y); } static double leg_quad_l4_l0y(double x, double y) { return Legendre4(x) * Legendre0x(y); } static double leg_quad_l4_l0xx(double x, double y) { return Legendre4xx(x) * Legendre0(y); } static double leg_quad_l4_l0xy(double x, double y) { return Legendre4x(x) * Legendre0x(y); } static double leg_quad_l4_l0yy(double x, double y) { return Legendre4(x) * Legendre0xx(y); } static double leg_quad_l4_l1(double x, double y) { return Legendre4(x) * Legendre1(y); } static double leg_quad_l4_l1x(double x, double y) { return Legendre4x(x) * Legendre1(y); } static double leg_quad_l4_l1y(double x, double y) { return Legendre4(x) * Legendre1x(y); } static double leg_quad_l4_l1xx(double x, double y) { return Legendre4xx(x) * Legendre1(y); } static double leg_quad_l4_l1xy(double x, double y) { return Legendre4x(x) * Legendre1x(y); } static double leg_quad_l4_l1yy(double x, double y) { return Legendre4(x) * Legendre1xx(y); } static double leg_quad_l4_l2(double x, double y) { return Legendre4(x) * Legendre2(y); } static double leg_quad_l4_l2x(double x, double y) { return Legendre4x(x) * Legendre2(y); } static double leg_quad_l4_l2y(double x, double y) { return Legendre4(x) * Legendre2x(y); } static double leg_quad_l4_l2xx(double x, double y) { return Legendre4xx(x) * Legendre2(y); } static double leg_quad_l4_l2xy(double x, double y) { return Legendre4x(x) * Legendre2x(y); } static double leg_quad_l4_l2yy(double x, double y) { return Legendre4(x) * Legendre2xx(y); } static double leg_quad_l4_l3(double x, double y) { return Legendre4(x) * Legendre3(y); } static double leg_quad_l4_l3x(double x, double y) { return Legendre4x(x) * Legendre3(y); } static double leg_quad_l4_l3y(double x, double y) { return Legendre4(x) * Legendre3x(y); } static double leg_quad_l4_l3xx(double x, double y) { return Legendre4xx(x) * Legendre3(y); } static double leg_quad_l4_l3xy(double x, double y) { return Legendre4x(x) * Legendre3x(y); } static double leg_quad_l4_l3yy(double x, double y) { return Legendre4(x) * Legendre3xx(y); } static double leg_quad_l4_l4(double x, double y) { return Legendre4(x) * Legendre4(y); } static double leg_quad_l4_l4x(double x, double y) { return Legendre4x(x) * Legendre4(y); } static double leg_quad_l4_l4y(double x, double y) { return Legendre4(x) * Legendre4x(y); } static double leg_quad_l4_l4xx(double x, double y) { return Legendre4xx(x) * Legendre4(y); } static double leg_quad_l4_l4xy(double x, double y) { return Legendre4x(x) * Legendre4x(y); } static double leg_quad_l4_l4yy(double x, double y) { return Legendre4(x) * Legendre4xx(y); } static double leg_quad_l4_l5(double x, double y) { return Legendre4(x) * Legendre5(y); } static double leg_quad_l4_l5x(double x, double y) { return Legendre4x(x) * Legendre5(y); } static double leg_quad_l4_l5y(double x, double y) { return Legendre4(x) * Legendre5x(y); } static double leg_quad_l4_l5xx(double x, double y) { return Legendre4xx(x) * Legendre5(y); } static double leg_quad_l4_l5xy(double x, double y) { return Legendre4x(x) * Legendre5x(y); } static double leg_quad_l4_l5yy(double x, double y) { return Legendre4(x) * Legendre5xx(y); } static double leg_quad_l4_l6(double x, double y) { return Legendre4(x) * Legendre6(y); } static double leg_quad_l4_l6x(double x, double y) { return Legendre4x(x) * Legendre6(y); } static double leg_quad_l4_l6y(double x, double y) { return Legendre4(x) * Legendre6x(y); } static double leg_quad_l4_l6xx(double x, double y) { return Legendre4xx(x) * Legendre6(y); } static double leg_quad_l4_l6xy(double x, double y) { return Legendre4x(x) * Legendre6x(y); } static double leg_quad_l4_l6yy(double x, double y) { return Legendre4(x) * Legendre6xx(y); } static double leg_quad_l4_l7(double x, double y) { return Legendre4(x) * Legendre7(y); } static double leg_quad_l4_l7x(double x, double y) { return Legendre4x(x) * Legendre7(y); } static double leg_quad_l4_l7y(double x, double y) { return Legendre4(x) * Legendre7x(y); } static double leg_quad_l4_l7xx(double x, double y) { return Legendre4xx(x) * Legendre7(y); } static double leg_quad_l4_l7xy(double x, double y) { return Legendre4x(x) * Legendre7x(y); } static double leg_quad_l4_l7yy(double x, double y) { return Legendre4(x) * Legendre7xx(y); } static double leg_quad_l4_l8(double x, double y) { return Legendre4(x) * Legendre8(y); } static double leg_quad_l4_l8x(double x, double y) { return Legendre4x(x) * Legendre8(y); } static double leg_quad_l4_l8y(double x, double y) { return Legendre4(x) * Legendre8x(y); } static double leg_quad_l4_l8xx(double x, double y) { return Legendre4xx(x) * Legendre8(y); } static double leg_quad_l4_l8xy(double x, double y) { return Legendre4x(x) * Legendre8x(y); } static double leg_quad_l4_l8yy(double x, double y) { return Legendre4(x) * Legendre8xx(y); } static double leg_quad_l4_l9(double x, double y) { return Legendre4(x) * Legendre9(y); } static double leg_quad_l4_l9x(double x, double y) { return Legendre4x(x) * Legendre9(y); } static double leg_quad_l4_l9y(double x, double y) { return Legendre4(x) * Legendre9x(y); } static double leg_quad_l4_l9xx(double x, double y) { return Legendre4xx(x) * Legendre9(y); } static double leg_quad_l4_l9xy(double x, double y) { return Legendre4x(x) * Legendre9x(y); } static double leg_quad_l4_l9yy(double x, double y) { return Legendre4(x) * Legendre9xx(y); } static double leg_quad_l4_l10(double x, double y) { return Legendre4(x) * Legendre10(y); } static double leg_quad_l4_l10x(double x, double y) { return Legendre4x(x) * Legendre10(y); } static double leg_quad_l4_l10y(double x, double y) { return Legendre4(x) * Legendre10x(y); } static double leg_quad_l4_l10xx(double x, double y) { return Legendre4xx(x) * Legendre10(y); } static double leg_quad_l4_l10xy(double x, double y) { return Legendre4x(x) * Legendre10x(y); } static double leg_quad_l4_l10yy(double x, double y) { return Legendre4(x) * Legendre10xx(y); } static double leg_quad_l5_l0(double x, double y) { return Legendre5(x) * Legendre0(y); } static double leg_quad_l5_l0x(double x, double y) { return Legendre5x(x) * Legendre0(y); } static double leg_quad_l5_l0y(double x, double y) { return Legendre5(x) * Legendre0x(y); } static double leg_quad_l5_l0xx(double x, double y) { return Legendre5xx(x) * Legendre0(y); } static double leg_quad_l5_l0xy(double x, double y) { return Legendre5x(x) * Legendre0x(y); } static double leg_quad_l5_l0yy(double x, double y) { return Legendre5(x) * Legendre0xx(y); } static double leg_quad_l5_l1(double x, double y) { return Legendre5(x) * Legendre1(y); } static double leg_quad_l5_l1x(double x, double y) { return Legendre5x(x) * Legendre1(y); } static double leg_quad_l5_l1y(double x, double y) { return Legendre5(x) * Legendre1x(y); } static double leg_quad_l5_l1xx(double x, double y) { return Legendre5xx(x) * Legendre1(y); } static double leg_quad_l5_l1xy(double x, double y) { return Legendre5x(x) * Legendre1x(y); } static double leg_quad_l5_l1yy(double x, double y) { return Legendre5(x) * Legendre1xx(y); } static double leg_quad_l5_l2(double x, double y) { return Legendre5(x) * Legendre2(y); } static double leg_quad_l5_l2x(double x, double y) { return Legendre5x(x) * Legendre2(y); } static double leg_quad_l5_l2y(double x, double y) { return Legendre5(x) * Legendre2x(y); } static double leg_quad_l5_l2xx(double x, double y) { return Legendre5xx(x) * Legendre2(y); } static double leg_quad_l5_l2xy(double x, double y) { return Legendre5x(x) * Legendre2x(y); } static double leg_quad_l5_l2yy(double x, double y) { return Legendre5(x) * Legendre2xx(y); } static double leg_quad_l5_l3(double x, double y) { return Legendre5(x) * Legendre3(y); } static double leg_quad_l5_l3x(double x, double y) { return Legendre5x(x) * Legendre3(y); } static double leg_quad_l5_l3y(double x, double y) { return Legendre5(x) * Legendre3x(y); } static double leg_quad_l5_l3xx(double x, double y) { return Legendre5xx(x) * Legendre3(y); } static double leg_quad_l5_l3xy(double x, double y) { return Legendre5x(x) * Legendre3x(y); } static double leg_quad_l5_l3yy(double x, double y) { return Legendre5(x) * Legendre3xx(y); } static double leg_quad_l5_l4(double x, double y) { return Legendre5(x) * Legendre4(y); } static double leg_quad_l5_l4x(double x, double y) { return Legendre5x(x) * Legendre4(y); } static double leg_quad_l5_l4y(double x, double y) { return Legendre5(x) * Legendre4x(y); } static double leg_quad_l5_l4xx(double x, double y) { return Legendre5xx(x) * Legendre4(y); } static double leg_quad_l5_l4xy(double x, double y) { return Legendre5x(x) * Legendre4x(y); } static double leg_quad_l5_l4yy(double x, double y) { return Legendre5(x) * Legendre4xx(y); } static double leg_quad_l5_l5(double x, double y) { return Legendre5(x) * Legendre5(y); } static double leg_quad_l5_l5x(double x, double y) { return Legendre5x(x) * Legendre5(y); } static double leg_quad_l5_l5y(double x, double y) { return Legendre5(x) * Legendre5x(y); } static double leg_quad_l5_l5xx(double x, double y) { return Legendre5xx(x) * Legendre5(y); } static double leg_quad_l5_l5xy(double x, double y) { return Legendre5x(x) * Legendre5x(y); } static double leg_quad_l5_l5yy(double x, double y) { return Legendre5(x) * Legendre5xx(y); } static double leg_quad_l5_l6(double x, double y) { return Legendre5(x) * Legendre6(y); } static double leg_quad_l5_l6x(double x, double y) { return Legendre5x(x) * Legendre6(y); } static double leg_quad_l5_l6y(double x, double y) { return Legendre5(x) * Legendre6x(y); } static double leg_quad_l5_l6xx(double x, double y) { return Legendre5xx(x) * Legendre6(y); } static double leg_quad_l5_l6xy(double x, double y) { return Legendre5x(x) * Legendre6x(y); } static double leg_quad_l5_l6yy(double x, double y) { return Legendre5(x) * Legendre6xx(y); } static double leg_quad_l5_l7(double x, double y) { return Legendre5(x) * Legendre7(y); } static double leg_quad_l5_l7x(double x, double y) { return Legendre5x(x) * Legendre7(y); } static double leg_quad_l5_l7y(double x, double y) { return Legendre5(x) * Legendre7x(y); } static double leg_quad_l5_l7xx(double x, double y) { return Legendre5xx(x) * Legendre7(y); } static double leg_quad_l5_l7xy(double x, double y) { return Legendre5x(x) * Legendre7x(y); } static double leg_quad_l5_l7yy(double x, double y) { return Legendre5(x) * Legendre7xx(y); } static double leg_quad_l5_l8(double x, double y) { return Legendre5(x) * Legendre8(y); } static double leg_quad_l5_l8x(double x, double y) { return Legendre5x(x) * Legendre8(y); } static double leg_quad_l5_l8y(double x, double y) { return Legendre5(x) * Legendre8x(y); } static double leg_quad_l5_l8xx(double x, double y) { return Legendre5xx(x) * Legendre8(y); } static double leg_quad_l5_l8xy(double x, double y) { return Legendre5x(x) * Legendre8x(y); } static double leg_quad_l5_l8yy(double x, double y) { return Legendre5(x) * Legendre8xx(y); } static double leg_quad_l5_l9(double x, double y) { return Legendre5(x) * Legendre9(y); } static double leg_quad_l5_l9x(double x, double y) { return Legendre5x(x) * Legendre9(y); } static double leg_quad_l5_l9y(double x, double y) { return Legendre5(x) * Legendre9x(y); } static double leg_quad_l5_l9xx(double x, double y) { return Legendre5xx(x) * Legendre9(y); } static double leg_quad_l5_l9xy(double x, double y) { return Legendre5x(x) * Legendre9x(y); } static double leg_quad_l5_l9yy(double x, double y) { return Legendre5(x) * Legendre9xx(y); } static double leg_quad_l5_l10(double x, double y) { return Legendre5(x) * Legendre10(y); } static double leg_quad_l5_l10x(double x, double y) { return Legendre5x(x) * Legendre10(y); } static double leg_quad_l5_l10y(double x, double y) { return Legendre5(x) * Legendre10x(y); } static double leg_quad_l5_l10xx(double x, double y) { return Legendre5xx(x) * Legendre10(y); } static double leg_quad_l5_l10xy(double x, double y) { return Legendre5x(x) * Legendre10x(y); } static double leg_quad_l5_l10yy(double x, double y) { return Legendre5(x) * Legendre10xx(y); } static double leg_quad_l6_l0(double x, double y) { return Legendre6(x) * Legendre0(y); } static double leg_quad_l6_l0x(double x, double y) { return Legendre6x(x) * Legendre0(y); } static double leg_quad_l6_l0y(double x, double y) { return Legendre6(x) * Legendre0x(y); } static double leg_quad_l6_l0xx(double x, double y) { return Legendre6xx(x) * Legendre0(y); } static double leg_quad_l6_l0xy(double x, double y) { return Legendre6x(x) * Legendre0x(y); } static double leg_quad_l6_l0yy(double x, double y) { return Legendre6(x) * Legendre0xx(y); } static double leg_quad_l6_l1(double x, double y) { return Legendre6(x) * Legendre1(y); } static double leg_quad_l6_l1x(double x, double y) { return Legendre6x(x) * Legendre1(y); } static double leg_quad_l6_l1y(double x, double y) { return Legendre6(x) * Legendre1x(y); } static double leg_quad_l6_l1xx(double x, double y) { return Legendre6xx(x) * Legendre1(y); } static double leg_quad_l6_l1xy(double x, double y) { return Legendre6x(x) * Legendre1x(y); } static double leg_quad_l6_l1yy(double x, double y) { return Legendre6(x) * Legendre1xx(y); } static double leg_quad_l6_l2(double x, double y) { return Legendre6(x) * Legendre2(y); } static double leg_quad_l6_l2x(double x, double y) { return Legendre6x(x) * Legendre2(y); } static double leg_quad_l6_l2y(double x, double y) { return Legendre6(x) * Legendre2x(y); } static double leg_quad_l6_l2xx(double x, double y) { return Legendre6xx(x) * Legendre2(y); } static double leg_quad_l6_l2xy(double x, double y) { return Legendre6x(x) * Legendre2x(y); } static double leg_quad_l6_l2yy(double x, double y) { return Legendre6(x) * Legendre2xx(y); } static double leg_quad_l6_l3(double x, double y) { return Legendre6(x) * Legendre3(y); } static double leg_quad_l6_l3x(double x, double y) { return Legendre6x(x) * Legendre3(y); } static double leg_quad_l6_l3y(double x, double y) { return Legendre6(x) * Legendre3x(y); } static double leg_quad_l6_l3xx(double x, double y) { return Legendre6xx(x) * Legendre3(y); } static double leg_quad_l6_l3xy(double x, double y) { return Legendre6x(x) * Legendre3x(y); } static double leg_quad_l6_l3yy(double x, double y) { return Legendre6(x) * Legendre3xx(y); } static double leg_quad_l6_l4(double x, double y) { return Legendre6(x) * Legendre4(y); } static double leg_quad_l6_l4x(double x, double y) { return Legendre6x(x) * Legendre4(y); } static double leg_quad_l6_l4y(double x, double y) { return Legendre6(x) * Legendre4x(y); } static double leg_quad_l6_l4xx(double x, double y) { return Legendre6xx(x) * Legendre4(y); } static double leg_quad_l6_l4xy(double x, double y) { return Legendre6x(x) * Legendre4x(y); } static double leg_quad_l6_l4yy(double x, double y) { return Legendre6(x) * Legendre4xx(y); } static double leg_quad_l6_l5(double x, double y) { return Legendre6(x) * Legendre5(y); } static double leg_quad_l6_l5x(double x, double y) { return Legendre6x(x) * Legendre5(y); } static double leg_quad_l6_l5y(double x, double y) { return Legendre6(x) * Legendre5x(y); } static double leg_quad_l6_l5xx(double x, double y) { return Legendre6xx(x) * Legendre5(y); } static double leg_quad_l6_l5xy(double x, double y) { return Legendre6x(x) * Legendre5x(y); } static double leg_quad_l6_l5yy(double x, double y) { return Legendre6(x) * Legendre5xx(y); } static double leg_quad_l6_l6(double x, double y) { return Legendre6(x) * Legendre6(y); } static double leg_quad_l6_l6x(double x, double y) { return Legendre6x(x) * Legendre6(y); } static double leg_quad_l6_l6y(double x, double y) { return Legendre6(x) * Legendre6x(y); } static double leg_quad_l6_l6xx(double x, double y) { return Legendre6xx(x) * Legendre6(y); } static double leg_quad_l6_l6xy(double x, double y) { return Legendre6x(x) * Legendre6x(y); } static double leg_quad_l6_l6yy(double x, double y) { return Legendre6(x) * Legendre6xx(y); } static double leg_quad_l6_l7(double x, double y) { return Legendre6(x) * Legendre7(y); } static double leg_quad_l6_l7x(double x, double y) { return Legendre6x(x) * Legendre7(y); } static double leg_quad_l6_l7y(double x, double y) { return Legendre6(x) * Legendre7x(y); } static double leg_quad_l6_l7xx(double x, double y) { return Legendre6xx(x) * Legendre7(y); } static double leg_quad_l6_l7xy(double x, double y) { return Legendre6x(x) * Legendre7x(y); } static double leg_quad_l6_l7yy(double x, double y) { return Legendre6(x) * Legendre7xx(y); } static double leg_quad_l6_l8(double x, double y) { return Legendre6(x) * Legendre8(y); } static double leg_quad_l6_l8x(double x, double y) { return Legendre6x(x) * Legendre8(y); } static double leg_quad_l6_l8y(double x, double y) { return Legendre6(x) * Legendre8x(y); } static double leg_quad_l6_l8xx(double x, double y) { return Legendre6xx(x) * Legendre8(y); } static double leg_quad_l6_l8xy(double x, double y) { return Legendre6x(x) * Legendre8x(y); } static double leg_quad_l6_l8yy(double x, double y) { return Legendre6(x) * Legendre8xx(y); } static double leg_quad_l6_l9(double x, double y) { return Legendre6(x) * Legendre9(y); } static double leg_quad_l6_l9x(double x, double y) { return Legendre6x(x) * Legendre9(y); } static double leg_quad_l6_l9y(double x, double y) { return Legendre6(x) * Legendre9x(y); } static double leg_quad_l6_l9xx(double x, double y) { return Legendre6xx(x) * Legendre9(y); } static double leg_quad_l6_l9xy(double x, double y) { return Legendre6x(x) * Legendre9x(y); } static double leg_quad_l6_l9yy(double x, double y) { return Legendre6(x) * Legendre9xx(y); } static double leg_quad_l6_l10(double x, double y) { return Legendre6(x) * Legendre10(y); } static double leg_quad_l6_l10x(double x, double y) { return Legendre6x(x) * Legendre10(y); } static double leg_quad_l6_l10y(double x, double y) { return Legendre6(x) * Legendre10x(y); } static double leg_quad_l6_l10xx(double x, double y) { return Legendre6xx(x) * Legendre10(y); } static double leg_quad_l6_l10xy(double x, double y) { return Legendre6x(x) * Legendre10x(y); } static double leg_quad_l6_l10yy(double x, double y) { return Legendre6(x) * Legendre10xx(y); } static double leg_quad_l7_l0(double x, double y) { return Legendre7(x) * Legendre0(y); } static double leg_quad_l7_l0x(double x, double y) { return Legendre7x(x) * Legendre0(y); } static double leg_quad_l7_l0y(double x, double y) { return Legendre7(x) * Legendre0x(y); } static double leg_quad_l7_l0xx(double x, double y) { return Legendre7xx(x) * Legendre0(y); } static double leg_quad_l7_l0xy(double x, double y) { return Legendre7x(x) * Legendre0x(y); } static double leg_quad_l7_l0yy(double x, double y) { return Legendre7(x) * Legendre0xx(y); } static double leg_quad_l7_l1(double x, double y) { return Legendre7(x) * Legendre1(y); } static double leg_quad_l7_l1x(double x, double y) { return Legendre7x(x) * Legendre1(y); } static double leg_quad_l7_l1y(double x, double y) { return Legendre7(x) * Legendre1x(y); } static double leg_quad_l7_l1xx(double x, double y) { return Legendre7xx(x) * Legendre1(y); } static double leg_quad_l7_l1xy(double x, double y) { return Legendre7x(x) * Legendre1x(y); } static double leg_quad_l7_l1yy(double x, double y) { return Legendre7(x) * Legendre1xx(y); } static double leg_quad_l7_l2(double x, double y) { return Legendre7(x) * Legendre2(y); } static double leg_quad_l7_l2x(double x, double y) { return Legendre7x(x) * Legendre2(y); } static double leg_quad_l7_l2y(double x, double y) { return Legendre7(x) * Legendre2x(y); } static double leg_quad_l7_l2xx(double x, double y) { return Legendre7xx(x) * Legendre2(y); } static double leg_quad_l7_l2xy(double x, double y) { return Legendre7x(x) * Legendre2x(y); } static double leg_quad_l7_l2yy(double x, double y) { return Legendre7(x) * Legendre2xx(y); } static double leg_quad_l7_l3(double x, double y) { return Legendre7(x) * Legendre3(y); } static double leg_quad_l7_l3x(double x, double y) { return Legendre7x(x) * Legendre3(y); } static double leg_quad_l7_l3y(double x, double y) { return Legendre7(x) * Legendre3x(y); } static double leg_quad_l7_l3xx(double x, double y) { return Legendre7xx(x) * Legendre3(y); } static double leg_quad_l7_l3xy(double x, double y) { return Legendre7x(x) * Legendre3x(y); } static double leg_quad_l7_l3yy(double x, double y) { return Legendre7(x) * Legendre3xx(y); } static double leg_quad_l7_l4(double x, double y) { return Legendre7(x) * Legendre4(y); } static double leg_quad_l7_l4x(double x, double y) { return Legendre7x(x) * Legendre4(y); } static double leg_quad_l7_l4y(double x, double y) { return Legendre7(x) * Legendre4x(y); } static double leg_quad_l7_l4xx(double x, double y) { return Legendre7xx(x) * Legendre4(y); } static double leg_quad_l7_l4xy(double x, double y) { return Legendre7x(x) * Legendre4x(y); } static double leg_quad_l7_l4yy(double x, double y) { return Legendre7(x) * Legendre4xx(y); } static double leg_quad_l7_l5(double x, double y) { return Legendre7(x) * Legendre5(y); } static double leg_quad_l7_l5x(double x, double y) { return Legendre7x(x) * Legendre5(y); } static double leg_quad_l7_l5y(double x, double y) { return Legendre7(x) * Legendre5x(y); } static double leg_quad_l7_l5xx(double x, double y) { return Legendre7xx(x) * Legendre5(y); } static double leg_quad_l7_l5xy(double x, double y) { return Legendre7x(x) * Legendre5x(y); } static double leg_quad_l7_l5yy(double x, double y) { return Legendre7(x) * Legendre5xx(y); } static double leg_quad_l7_l6(double x, double y) { return Legendre7(x) * Legendre6(y); } static double leg_quad_l7_l6x(double x, double y) { return Legendre7x(x) * Legendre6(y); } static double leg_quad_l7_l6y(double x, double y) { return Legendre7(x) * Legendre6x(y); } static double leg_quad_l7_l6xx(double x, double y) { return Legendre7xx(x) * Legendre6(y); } static double leg_quad_l7_l6xy(double x, double y) { return Legendre7x(x) * Legendre6x(y); } static double leg_quad_l7_l6yy(double x, double y) { return Legendre7(x) * Legendre6xx(y); } static double leg_quad_l7_l7(double x, double y) { return Legendre7(x) * Legendre7(y); } static double leg_quad_l7_l7x(double x, double y) { return Legendre7x(x) * Legendre7(y); } static double leg_quad_l7_l7y(double x, double y) { return Legendre7(x) * Legendre7x(y); } static double leg_quad_l7_l7xx(double x, double y) { return Legendre7xx(x) * Legendre7(y); } static double leg_quad_l7_l7xy(double x, double y) { return Legendre7x(x) * Legendre7x(y); } static double leg_quad_l7_l7yy(double x, double y) { return Legendre7(x) * Legendre7xx(y); } static double leg_quad_l7_l8(double x, double y) { return Legendre7(x) * Legendre8(y); } static double leg_quad_l7_l8x(double x, double y) { return Legendre7x(x) * Legendre8(y); } static double leg_quad_l7_l8y(double x, double y) { return Legendre7(x) * Legendre8x(y); } static double leg_quad_l7_l8xx(double x, double y) { return Legendre7xx(x) * Legendre8(y); } static double leg_quad_l7_l8xy(double x, double y) { return Legendre7x(x) * Legendre8x(y); } static double leg_quad_l7_l8yy(double x, double y) { return Legendre7(x) * Legendre8xx(y); } static double leg_quad_l7_l9(double x, double y) { return Legendre7(x) * Legendre9(y); } static double leg_quad_l7_l9x(double x, double y) { return Legendre7x(x) * Legendre9(y); } static double leg_quad_l7_l9y(double x, double y) { return Legendre7(x) * Legendre9x(y); } static double leg_quad_l7_l9xx(double x, double y) { return Legendre7xx(x) * Legendre9(y); } static double leg_quad_l7_l9xy(double x, double y) { return Legendre7x(x) * Legendre9x(y); } static double leg_quad_l7_l9yy(double x, double y) { return Legendre7(x) * Legendre9xx(y); } static double leg_quad_l7_l10(double x, double y) { return Legendre7(x) * Legendre10(y); } static double leg_quad_l7_l10x(double x, double y) { return Legendre7x(x) * Legendre10(y); } static double leg_quad_l7_l10y(double x, double y) { return Legendre7(x) * Legendre10x(y); } static double leg_quad_l7_l10xx(double x, double y) { return Legendre7xx(x) * Legendre10(y); } static double leg_quad_l7_l10xy(double x, double y) { return Legendre7x(x) * Legendre10x(y); } static double leg_quad_l7_l10yy(double x, double y) { return Legendre7(x) * Legendre10xx(y); } static double leg_quad_l8_l0(double x, double y) { return Legendre8(x) * Legendre0(y); } static double leg_quad_l8_l0x(double x, double y) { return Legendre8x(x) * Legendre0(y); } static double leg_quad_l8_l0y(double x, double y) { return Legendre8(x) * Legendre0x(y); } static double leg_quad_l8_l0xx(double x, double y) { return Legendre8xx(x) * Legendre0(y); } static double leg_quad_l8_l0xy(double x, double y) { return Legendre8x(x) * Legendre0x(y); } static double leg_quad_l8_l0yy(double x, double y) { return Legendre8(x) * Legendre0xx(y); } static double leg_quad_l8_l1(double x, double y) { return Legendre8(x) * Legendre1(y); } static double leg_quad_l8_l1x(double x, double y) { return Legendre8x(x) * Legendre1(y); } static double leg_quad_l8_l1y(double x, double y) { return Legendre8(x) * Legendre1x(y); } static double leg_quad_l8_l1xx(double x, double y) { return Legendre8xx(x) * Legendre1(y); } static double leg_quad_l8_l1xy(double x, double y) { return Legendre8x(x) * Legendre1x(y); } static double leg_quad_l8_l1yy(double x, double y) { return Legendre8(x) * Legendre1xx(y); } static double leg_quad_l8_l2(double x, double y) { return Legendre8(x) * Legendre2(y); } static double leg_quad_l8_l2x(double x, double y) { return Legendre8x(x) * Legendre2(y); } static double leg_quad_l8_l2y(double x, double y) { return Legendre8(x) * Legendre2x(y); } static double leg_quad_l8_l2xx(double x, double y) { return Legendre8xx(x) * Legendre2(y); } static double leg_quad_l8_l2xy(double x, double y) { return Legendre8x(x) * Legendre2x(y); } static double leg_quad_l8_l2yy(double x, double y) { return Legendre8(x) * Legendre2xx(y); } static double leg_quad_l8_l3(double x, double y) { return Legendre8(x) * Legendre3(y); } static double leg_quad_l8_l3x(double x, double y) { return Legendre8x(x) * Legendre3(y); } static double leg_quad_l8_l3y(double x, double y) { return Legendre8(x) * Legendre3x(y); } static double leg_quad_l8_l3xx(double x, double y) { return Legendre8xx(x) * Legendre3(y); } static double leg_quad_l8_l3xy(double x, double y) { return Legendre8x(x) * Legendre3x(y); } static double leg_quad_l8_l3yy(double x, double y) { return Legendre8(x) * Legendre3xx(y); } static double leg_quad_l8_l4(double x, double y) { return Legendre8(x) * Legendre4(y); } static double leg_quad_l8_l4x(double x, double y) { return Legendre8x(x) * Legendre4(y); } static double leg_quad_l8_l4y(double x, double y) { return Legendre8(x) * Legendre4x(y); } static double leg_quad_l8_l4xx(double x, double y) { return Legendre8xx(x) * Legendre4(y); } static double leg_quad_l8_l4xy(double x, double y) { return Legendre8x(x) * Legendre4x(y); } static double leg_quad_l8_l4yy(double x, double y) { return Legendre8(x) * Legendre4xx(y); } static double leg_quad_l8_l5(double x, double y) { return Legendre8(x) * Legendre5(y); } static double leg_quad_l8_l5x(double x, double y) { return Legendre8x(x) * Legendre5(y); } static double leg_quad_l8_l5y(double x, double y) { return Legendre8(x) * Legendre5x(y); } static double leg_quad_l8_l5xx(double x, double y) { return Legendre8xx(x) * Legendre5(y); } static double leg_quad_l8_l5xy(double x, double y) { return Legendre8x(x) * Legendre5x(y); } static double leg_quad_l8_l5yy(double x, double y) { return Legendre8(x) * Legendre5xx(y); } static double leg_quad_l8_l6(double x, double y) { return Legendre8(x) * Legendre6(y); } static double leg_quad_l8_l6x(double x, double y) { return Legendre8x(x) * Legendre6(y); } static double leg_quad_l8_l6y(double x, double y) { return Legendre8(x) * Legendre6x(y); } static double leg_quad_l8_l6xx(double x, double y) { return Legendre8xx(x) * Legendre6(y); } static double leg_quad_l8_l6xy(double x, double y) { return Legendre8x(x) * Legendre6x(y); } static double leg_quad_l8_l6yy(double x, double y) { return Legendre8(x) * Legendre6xx(y); } static double leg_quad_l8_l7(double x, double y) { return Legendre8(x) * Legendre7(y); } static double leg_quad_l8_l7x(double x, double y) { return Legendre8x(x) * Legendre7(y); } static double leg_quad_l8_l7y(double x, double y) { return Legendre8(x) * Legendre7x(y); } static double leg_quad_l8_l7xx(double x, double y) { return Legendre8xx(x) * Legendre7(y); } static double leg_quad_l8_l7xy(double x, double y) { return Legendre8x(x) * Legendre7x(y); } static double leg_quad_l8_l7yy(double x, double y) { return Legendre8(x) * Legendre7xx(y); } static double leg_quad_l8_l8(double x, double y) { return Legendre8(x) * Legendre8(y); } static double leg_quad_l8_l8x(double x, double y) { return Legendre8x(x) * Legendre8(y); } static double leg_quad_l8_l8y(double x, double y) { return Legendre8(x) * Legendre8x(y); } static double leg_quad_l8_l8xx(double x, double y) { return Legendre8xx(x) * Legendre8(y); } static double leg_quad_l8_l8xy(double x, double y) { return Legendre8x(x) * Legendre8x(y); } static double leg_quad_l8_l8yy(double x, double y) { return Legendre8(x) * Legendre8xx(y); } static double leg_quad_l8_l9(double x, double y) { return Legendre8(x) * Legendre9(y); } static double leg_quad_l8_l9x(double x, double y) { return Legendre8x(x) * Legendre9(y); } static double leg_quad_l8_l9y(double x, double y) { return Legendre8(x) * Legendre9x(y); } static double leg_quad_l8_l9xx(double x, double y) { return Legendre8xx(x) * Legendre9(y); } static double leg_quad_l8_l9xy(double x, double y) { return Legendre8x(x) * Legendre9x(y); } static double leg_quad_l8_l9yy(double x, double y) { return Legendre8(x) * Legendre9xx(y); } static double leg_quad_l8_l10(double x, double y) { return Legendre8(x) * Legendre10(y); } static double leg_quad_l8_l10x(double x, double y) { return Legendre8x(x) * Legendre10(y); } static double leg_quad_l8_l10y(double x, double y) { return Legendre8(x) * Legendre10x(y); } static double leg_quad_l8_l10xx(double x, double y) { return Legendre8xx(x) * Legendre10(y); } static double leg_quad_l8_l10xy(double x, double y) { return Legendre8x(x) * Legendre10x(y); } static double leg_quad_l8_l10yy(double x, double y) { return Legendre8(x) * Legendre10xx(y); } static double leg_quad_l9_l0(double x, double y) { return Legendre9(x) * Legendre0(y); } static double leg_quad_l9_l0x(double x, double y) { return Legendre9x(x) * Legendre0(y); } static double leg_quad_l9_l0y(double x, double y) { return Legendre9(x) * Legendre0x(y); } static double leg_quad_l9_l0xx(double x, double y) { return Legendre9xx(x) * Legendre0(y); } static double leg_quad_l9_l0xy(double x, double y) { return Legendre9x(x) * Legendre0x(y); } static double leg_quad_l9_l0yy(double x, double y) { return Legendre9(x) * Legendre0xx(y); } static double leg_quad_l9_l1(double x, double y) { return Legendre9(x) * Legendre1(y); } static double leg_quad_l9_l1x(double x, double y) { return Legendre9x(x) * Legendre1(y); } static double leg_quad_l9_l1y(double x, double y) { return Legendre9(x) * Legendre1x(y); } static double leg_quad_l9_l1xx(double x, double y) { return Legendre9xx(x) * Legendre1(y); } static double leg_quad_l9_l1xy(double x, double y) { return Legendre9x(x) * Legendre1x(y); } static double leg_quad_l9_l1yy(double x, double y) { return Legendre9(x) * Legendre1xx(y); } static double leg_quad_l9_l2(double x, double y) { return Legendre9(x) * Legendre2(y); } static double leg_quad_l9_l2x(double x, double y) { return Legendre9x(x) * Legendre2(y); } static double leg_quad_l9_l2y(double x, double y) { return Legendre9(x) * Legendre2x(y); } static double leg_quad_l9_l2xx(double x, double y) { return Legendre9xx(x) * Legendre2(y); } static double leg_quad_l9_l2xy(double x, double y) { return Legendre9x(x) * Legendre2x(y); } static double leg_quad_l9_l2yy(double x, double y) { return Legendre9(x) * Legendre2xx(y); } static double leg_quad_l9_l3(double x, double y) { return Legendre9(x) * Legendre3(y); } static double leg_quad_l9_l3x(double x, double y) { return Legendre9x(x) * Legendre3(y); } static double leg_quad_l9_l3y(double x, double y) { return Legendre9(x) * Legendre3x(y); } static double leg_quad_l9_l3xx(double x, double y) { return Legendre9xx(x) * Legendre3(y); } static double leg_quad_l9_l3xy(double x, double y) { return Legendre9x(x) * Legendre3x(y); } static double leg_quad_l9_l3yy(double x, double y) { return Legendre9(x) * Legendre3xx(y); } static double leg_quad_l9_l4(double x, double y) { return Legendre9(x) * Legendre4(y); } static double leg_quad_l9_l4x(double x, double y) { return Legendre9x(x) * Legendre4(y); } static double leg_quad_l9_l4y(double x, double y) { return Legendre9(x) * Legendre4x(y); } static double leg_quad_l9_l4xx(double x, double y) { return Legendre9xx(x) * Legendre4(y); } static double leg_quad_l9_l4xy(double x, double y) { return Legendre9x(x) * Legendre4x(y); } static double leg_quad_l9_l4yy(double x, double y) { return Legendre9(x) * Legendre4xx(y); } static double leg_quad_l9_l5(double x, double y) { return Legendre9(x) * Legendre5(y); } static double leg_quad_l9_l5x(double x, double y) { return Legendre9x(x) * Legendre5(y); } static double leg_quad_l9_l5y(double x, double y) { return Legendre9(x) * Legendre5x(y); } static double leg_quad_l9_l5xx(double x, double y) { return Legendre9xx(x) * Legendre5(y); } static double leg_quad_l9_l5xy(double x, double y) { return Legendre9x(x) * Legendre5x(y); } static double leg_quad_l9_l5yy(double x, double y) { return Legendre9(x) * Legendre5xx(y); } static double leg_quad_l9_l6(double x, double y) { return Legendre9(x) * Legendre6(y); } static double leg_quad_l9_l6x(double x, double y) { return Legendre9x(x) * Legendre6(y); } static double leg_quad_l9_l6y(double x, double y) { return Legendre9(x) * Legendre6x(y); } static double leg_quad_l9_l6xx(double x, double y) { return Legendre9xx(x) * Legendre6(y); } static double leg_quad_l9_l6xy(double x, double y) { return Legendre9x(x) * Legendre6x(y); } static double leg_quad_l9_l6yy(double x, double y) { return Legendre9(x) * Legendre6xx(y); } static double leg_quad_l9_l7(double x, double y) { return Legendre9(x) * Legendre7(y); } static double leg_quad_l9_l7x(double x, double y) { return Legendre9x(x) * Legendre7(y); } static double leg_quad_l9_l7y(double x, double y) { return Legendre9(x) * Legendre7x(y); } static double leg_quad_l9_l7xx(double x, double y) { return Legendre9xx(x) * Legendre7(y); } static double leg_quad_l9_l7xy(double x, double y) { return Legendre9x(x) * Legendre7x(y); } static double leg_quad_l9_l7yy(double x, double y) { return Legendre9(x) * Legendre7xx(y); } static double leg_quad_l9_l8(double x, double y) { return Legendre9(x) * Legendre8(y); } static double leg_quad_l9_l8x(double x, double y) { return Legendre9x(x) * Legendre8(y); } static double leg_quad_l9_l8y(double x, double y) { return Legendre9(x) * Legendre8x(y); } static double leg_quad_l9_l8xx(double x, double y) { return Legendre9xx(x) * Legendre8(y); } static double leg_quad_l9_l8xy(double x, double y) { return Legendre9x(x) * Legendre8x(y); } static double leg_quad_l9_l8yy(double x, double y) { return Legendre9(x) * Legendre8xx(y); } static double leg_quad_l9_l9(double x, double y) { return Legendre9(x) * Legendre9(y); } static double leg_quad_l9_l9x(double x, double y) { return Legendre9x(x) * Legendre9(y); } static double leg_quad_l9_l9y(double x, double y) { return Legendre9(x) * Legendre9x(y); } static double leg_quad_l9_l9xx(double x, double y) { return Legendre9xx(x) * Legendre9(y); } static double leg_quad_l9_l9xy(double x, double y) { return Legendre9x(x) * Legendre9x(y); } static double leg_quad_l9_l9yy(double x, double y) { return Legendre9(x) * Legendre9xx(y); } static double leg_quad_l9_l10(double x, double y) { return Legendre9(x) * Legendre10(y); } static double leg_quad_l9_l10x(double x, double y) { return Legendre9x(x) * Legendre10(y); } static double leg_quad_l9_l10y(double x, double y) { return Legendre9(x) * Legendre10x(y); } static double leg_quad_l9_l10xx(double x, double y) { return Legendre9xx(x) * Legendre10(y); } static double leg_quad_l9_l10xy(double x, double y) { return Legendre9x(x) * Legendre10x(y); } static double leg_quad_l9_l10yy(double x, double y) { return Legendre9(x) * Legendre10xx(y); } static double leg_quad_l10_l0(double x, double y) { return Legendre10(x) * Legendre0(y); } static double leg_quad_l10_l0x(double x, double y) { return Legendre10x(x) * Legendre0(y); } static double leg_quad_l10_l0y(double x, double y) { return Legendre10(x) * Legendre0x(y); } static double leg_quad_l10_l0xx(double x, double y) { return Legendre10xx(x) * Legendre0(y); } static double leg_quad_l10_l0xy(double x, double y) { return Legendre10x(x) * Legendre0x(y); } static double leg_quad_l10_l0yy(double x, double y) { return Legendre10(x) * Legendre0xx(y); } static double leg_quad_l10_l1(double x, double y) { return Legendre10(x) * Legendre1(y); } static double leg_quad_l10_l1x(double x, double y) { return Legendre10x(x) * Legendre1(y); } static double leg_quad_l10_l1y(double x, double y) { return Legendre10(x) * Legendre1x(y); } static double leg_quad_l10_l1xx(double x, double y) { return Legendre10xx(x) * Legendre1(y); } static double leg_quad_l10_l1xy(double x, double y) { return Legendre10x(x) * Legendre1x(y); } static double leg_quad_l10_l1yy(double x, double y) { return Legendre10(x) * Legendre1xx(y); } static double leg_quad_l10_l2(double x, double y) { return Legendre10(x) * Legendre2(y); } static double leg_quad_l10_l2x(double x, double y) { return Legendre10x(x) * Legendre2(y); } static double leg_quad_l10_l2y(double x, double y) { return Legendre10(x) * Legendre2x(y); } static double leg_quad_l10_l2xx(double x, double y) { return Legendre10xx(x) * Legendre2(y); } static double leg_quad_l10_l2xy(double x, double y) { return Legendre10x(x) * Legendre2x(y); } static double leg_quad_l10_l2yy(double x, double y) { return Legendre10(x) * Legendre2xx(y); } static double leg_quad_l10_l3(double x, double y) { return Legendre10(x) * Legendre3(y); } static double leg_quad_l10_l3x(double x, double y) { return Legendre10x(x) * Legendre3(y); } static double leg_quad_l10_l3y(double x, double y) { return Legendre10(x) * Legendre3x(y); } static double leg_quad_l10_l3xx(double x, double y) { return Legendre10xx(x) * Legendre3(y); } static double leg_quad_l10_l3xy(double x, double y) { return Legendre10x(x) * Legendre3x(y); } static double leg_quad_l10_l3yy(double x, double y) { return Legendre10(x) * Legendre3xx(y); } static double leg_quad_l10_l4(double x, double y) { return Legendre10(x) * Legendre4(y); } static double leg_quad_l10_l4x(double x, double y) { return Legendre10x(x) * Legendre4(y); } static double leg_quad_l10_l4y(double x, double y) { return Legendre10(x) * Legendre4x(y); } static double leg_quad_l10_l4xx(double x, double y) { return Legendre10xx(x) * Legendre4(y); } static double leg_quad_l10_l4xy(double x, double y) { return Legendre10x(x) * Legendre4x(y); } static double leg_quad_l10_l4yy(double x, double y) { return Legendre10(x) * Legendre4xx(y); } static double leg_quad_l10_l5(double x, double y) { return Legendre10(x) * Legendre5(y); } static double leg_quad_l10_l5x(double x, double y) { return Legendre10x(x) * Legendre5(y); } static double leg_quad_l10_l5y(double x, double y) { return Legendre10(x) * Legendre5x(y); } static double leg_quad_l10_l5xx(double x, double y) { return Legendre10xx(x) * Legendre5(y); } static double leg_quad_l10_l5xy(double x, double y) { return Legendre10x(x) * Legendre5x(y); } static double leg_quad_l10_l5yy(double x, double y) { return Legendre10(x) * Legendre5xx(y); } static double leg_quad_l10_l6(double x, double y) { return Legendre10(x) * Legendre6(y); } static double leg_quad_l10_l6x(double x, double y) { return Legendre10x(x) * Legendre6(y); } static double leg_quad_l10_l6y(double x, double y) { return Legendre10(x) * Legendre6x(y); } static double leg_quad_l10_l6xx(double x, double y) { return Legendre10xx(x) * Legendre6(y); } static double leg_quad_l10_l6xy(double x, double y) { return Legendre10x(x) * Legendre6x(y); } static double leg_quad_l10_l6yy(double x, double y) { return Legendre10(x) * Legendre6xx(y); } static double leg_quad_l10_l7(double x, double y) { return Legendre10(x) * Legendre7(y); } static double leg_quad_l10_l7x(double x, double y) { return Legendre10x(x) * Legendre7(y); } static double leg_quad_l10_l7y(double x, double y) { return Legendre10(x) * Legendre7x(y); } static double leg_quad_l10_l7xx(double x, double y) { return Legendre10xx(x) * Legendre7(y); } static double leg_quad_l10_l7xy(double x, double y) { return Legendre10x(x) * Legendre7x(y); } static double leg_quad_l10_l7yy(double x, double y) { return Legendre10(x) * Legendre7xx(y); } static double leg_quad_l10_l8(double x, double y) { return Legendre10(x) * Legendre8(y); } static double leg_quad_l10_l8x(double x, double y) { return Legendre10x(x) * Legendre8(y); } static double leg_quad_l10_l8y(double x, double y) { return Legendre10(x) * Legendre8x(y); } static double leg_quad_l10_l8xx(double x, double y) { return Legendre10xx(x) * Legendre8(y); } static double leg_quad_l10_l8xy(double x, double y) { return Legendre10x(x) * Legendre8x(y); } static double leg_quad_l10_l8yy(double x, double y) { return Legendre10(x) * Legendre8xx(y); } static double leg_quad_l10_l9(double x, double y) { return Legendre10(x) * Legendre9(y); } static double leg_quad_l10_l9x(double x, double y) { return Legendre10x(x) * Legendre9(y); } static double leg_quad_l10_l9y(double x, double y) { return Legendre10(x) * Legendre9x(y); } static double leg_quad_l10_l9xx(double x, double y) { return Legendre10xx(x) * Legendre9(y); } static double leg_quad_l10_l9xy(double x, double y) { return Legendre10x(x) * Legendre9x(y); } static double leg_quad_l10_l9yy(double x, double y) { return Legendre10(x) * Legendre9xx(y); } static double leg_quad_l10_l10(double x, double y) { return Legendre10(x) * Legendre10(y); } static double leg_quad_l10_l10x(double x, double y) { return Legendre10x(x) * Legendre10(y); } static double leg_quad_l10_l10y(double x, double y) { return Legendre10(x) * Legendre10x(y); } static double leg_quad_l10_l10xx(double x, double y) { return Legendre10xx(x) * Legendre10(y); } static double leg_quad_l10_l10xy(double x, double y) { return Legendre10x(x) * Legendre10x(y); } static double leg_quad_l10_l10yy(double x, double y) { return Legendre10(x) * Legendre10xx(y); } static Shapeset::shape_fn_t leg_quad_fn[] = { leg_quad_l0_l0, leg_quad_l0_l1, leg_quad_l0_l2, leg_quad_l0_l3, leg_quad_l0_l4, leg_quad_l0_l5, leg_quad_l0_l6, leg_quad_l0_l7, leg_quad_l0_l8, leg_quad_l0_l9, leg_quad_l0_l10, leg_quad_l1_l0, leg_quad_l1_l1, leg_quad_l1_l2, leg_quad_l1_l3, leg_quad_l1_l4, leg_quad_l1_l5, leg_quad_l1_l6, leg_quad_l1_l7, leg_quad_l1_l8, leg_quad_l1_l9, leg_quad_l1_l10, leg_quad_l2_l0, leg_quad_l2_l1, leg_quad_l2_l2, leg_quad_l2_l3, leg_quad_l2_l4, leg_quad_l2_l5, leg_quad_l2_l6, leg_quad_l2_l7, leg_quad_l2_l8, leg_quad_l2_l9, leg_quad_l2_l10, leg_quad_l3_l0, leg_quad_l3_l1, leg_quad_l3_l2, leg_quad_l3_l3, leg_quad_l3_l4, leg_quad_l3_l5, leg_quad_l3_l6, leg_quad_l3_l7, leg_quad_l3_l8, leg_quad_l3_l9, leg_quad_l3_l10, leg_quad_l4_l0, leg_quad_l4_l1, leg_quad_l4_l2, leg_quad_l4_l3, leg_quad_l4_l4, leg_quad_l4_l5, leg_quad_l4_l6, leg_quad_l4_l7, leg_quad_l4_l8, leg_quad_l4_l9, leg_quad_l4_l10, leg_quad_l5_l0, leg_quad_l5_l1, leg_quad_l5_l2, leg_quad_l5_l3, leg_quad_l5_l4, leg_quad_l5_l5, leg_quad_l5_l6, leg_quad_l5_l7, leg_quad_l5_l8, leg_quad_l5_l9, leg_quad_l5_l10, leg_quad_l6_l0, leg_quad_l6_l1, leg_quad_l6_l2, leg_quad_l6_l3, leg_quad_l6_l4, leg_quad_l6_l5, leg_quad_l6_l6, leg_quad_l6_l7, leg_quad_l6_l8, leg_quad_l6_l9, leg_quad_l6_l10, leg_quad_l7_l0, leg_quad_l7_l1, leg_quad_l7_l2, leg_quad_l7_l3, leg_quad_l7_l4, leg_quad_l7_l5, leg_quad_l7_l6, leg_quad_l7_l7, leg_quad_l7_l8, leg_quad_l7_l9, leg_quad_l7_l10, leg_quad_l8_l0, leg_quad_l8_l1, leg_quad_l8_l2, leg_quad_l8_l3, leg_quad_l8_l4, leg_quad_l8_l5, leg_quad_l8_l6, leg_quad_l8_l7, leg_quad_l8_l8, leg_quad_l8_l9, leg_quad_l8_l10, leg_quad_l9_l0, leg_quad_l9_l1, leg_quad_l9_l2, leg_quad_l9_l3, leg_quad_l9_l4, leg_quad_l9_l5, leg_quad_l9_l6, leg_quad_l9_l7, leg_quad_l9_l8, leg_quad_l9_l9, leg_quad_l9_l10, leg_quad_l10_l0, leg_quad_l10_l1, leg_quad_l10_l2, leg_quad_l10_l3, leg_quad_l10_l4, leg_quad_l10_l5, leg_quad_l10_l6, leg_quad_l10_l7, leg_quad_l10_l8, leg_quad_l10_l9, leg_quad_l10_l10, }; static Shapeset::shape_fn_t leg_quad_fn_dx[] = { leg_quad_l0_l0x, leg_quad_l0_l1x, leg_quad_l0_l2x, leg_quad_l0_l3x, leg_quad_l0_l4x, leg_quad_l0_l5x, leg_quad_l0_l6x, leg_quad_l0_l7x, leg_quad_l0_l8x, leg_quad_l0_l9x, leg_quad_l0_l10x, leg_quad_l1_l0x, leg_quad_l1_l1x, leg_quad_l1_l2x, leg_quad_l1_l3x, leg_quad_l1_l4x, leg_quad_l1_l5x, leg_quad_l1_l6x, leg_quad_l1_l7x, leg_quad_l1_l8x, leg_quad_l1_l9x, leg_quad_l1_l10x, leg_quad_l2_l0x, leg_quad_l2_l1x, leg_quad_l2_l2x, leg_quad_l2_l3x, leg_quad_l2_l4x, leg_quad_l2_l5x, leg_quad_l2_l6x, leg_quad_l2_l7x, leg_quad_l2_l8x, leg_quad_l2_l9x, leg_quad_l2_l10x, leg_quad_l3_l0x, leg_quad_l3_l1x, leg_quad_l3_l2x, leg_quad_l3_l3x, leg_quad_l3_l4x, leg_quad_l3_l5x, leg_quad_l3_l6x, leg_quad_l3_l7x, leg_quad_l3_l8x, leg_quad_l3_l9x, leg_quad_l3_l10x, leg_quad_l4_l0x, leg_quad_l4_l1x, leg_quad_l4_l2x, leg_quad_l4_l3x, leg_quad_l4_l4x, leg_quad_l4_l5x, leg_quad_l4_l6x, leg_quad_l4_l7x, leg_quad_l4_l8x, leg_quad_l4_l9x, leg_quad_l4_l10x, leg_quad_l5_l0x, leg_quad_l5_l1x, leg_quad_l5_l2x, leg_quad_l5_l3x, leg_quad_l5_l4x, leg_quad_l5_l5x, leg_quad_l5_l6x, leg_quad_l5_l7x, leg_quad_l5_l8x, leg_quad_l5_l9x, leg_quad_l5_l10x, leg_quad_l6_l0x, leg_quad_l6_l1x, leg_quad_l6_l2x, leg_quad_l6_l3x, leg_quad_l6_l4x, leg_quad_l6_l5x, leg_quad_l6_l6x, leg_quad_l6_l7x, leg_quad_l6_l8x, leg_quad_l6_l9x, leg_quad_l6_l10x, leg_quad_l7_l0x, leg_quad_l7_l1x, leg_quad_l7_l2x, leg_quad_l7_l3x, leg_quad_l7_l4x, leg_quad_l7_l5x, leg_quad_l7_l6x, leg_quad_l7_l7x, leg_quad_l7_l8x, leg_quad_l7_l9x, leg_quad_l7_l10x, leg_quad_l8_l0x, leg_quad_l8_l1x, leg_quad_l8_l2x, leg_quad_l8_l3x, leg_quad_l8_l4x, leg_quad_l8_l5x, leg_quad_l8_l6x, leg_quad_l8_l7x, leg_quad_l8_l8x, leg_quad_l8_l9x, leg_quad_l8_l10x, leg_quad_l9_l0x, leg_quad_l9_l1x, leg_quad_l9_l2x, leg_quad_l9_l3x, leg_quad_l9_l4x, leg_quad_l9_l5x, leg_quad_l9_l6x, leg_quad_l9_l7x, leg_quad_l9_l8x, leg_quad_l9_l9x, leg_quad_l9_l10x, leg_quad_l10_l0x, leg_quad_l10_l1x, leg_quad_l10_l2x, leg_quad_l10_l3x, leg_quad_l10_l4x, leg_quad_l10_l5x, leg_quad_l10_l6x, leg_quad_l10_l7x, leg_quad_l10_l8x, leg_quad_l10_l9x, leg_quad_l10_l10x, }; static Shapeset::shape_fn_t leg_quad_fn_dy[] = { leg_quad_l0_l0y, leg_quad_l0_l1y, leg_quad_l0_l2y, leg_quad_l0_l3y, leg_quad_l0_l4y, leg_quad_l0_l5y, leg_quad_l0_l6y, leg_quad_l0_l7y, leg_quad_l0_l8y, leg_quad_l0_l9y, leg_quad_l0_l10y, leg_quad_l1_l0y, leg_quad_l1_l1y, leg_quad_l1_l2y, leg_quad_l1_l3y, leg_quad_l1_l4y, leg_quad_l1_l5y, leg_quad_l1_l6y, leg_quad_l1_l7y, leg_quad_l1_l8y, leg_quad_l1_l9y, leg_quad_l1_l10y, leg_quad_l2_l0y, leg_quad_l2_l1y, leg_quad_l2_l2y, leg_quad_l2_l3y, leg_quad_l2_l4y, leg_quad_l2_l5y, leg_quad_l2_l6y, leg_quad_l2_l7y, leg_quad_l2_l8y, leg_quad_l2_l9y, leg_quad_l2_l10y, leg_quad_l3_l0y, leg_quad_l3_l1y, leg_quad_l3_l2y, leg_quad_l3_l3y, leg_quad_l3_l4y, leg_quad_l3_l5y, leg_quad_l3_l6y, leg_quad_l3_l7y, leg_quad_l3_l8y, leg_quad_l3_l9y, leg_quad_l3_l10y, leg_quad_l4_l0y, leg_quad_l4_l1y, leg_quad_l4_l2y, leg_quad_l4_l3y, leg_quad_l4_l4y, leg_quad_l4_l5y, leg_quad_l4_l6y, leg_quad_l4_l7y, leg_quad_l4_l8y, leg_quad_l4_l9y, leg_quad_l4_l10y, leg_quad_l5_l0y, leg_quad_l5_l1y, leg_quad_l5_l2y, leg_quad_l5_l3y, leg_quad_l5_l4y, leg_quad_l5_l5y, leg_quad_l5_l6y, leg_quad_l5_l7y, leg_quad_l5_l8y, leg_quad_l5_l9y, leg_quad_l5_l10y, leg_quad_l6_l0y, leg_quad_l6_l1y, leg_quad_l6_l2y, leg_quad_l6_l3y, leg_quad_l6_l4y, leg_quad_l6_l5y, leg_quad_l6_l6y, leg_quad_l6_l7y, leg_quad_l6_l8y, leg_quad_l6_l9y, leg_quad_l6_l10y, leg_quad_l7_l0y, leg_quad_l7_l1y, leg_quad_l7_l2y, leg_quad_l7_l3y, leg_quad_l7_l4y, leg_quad_l7_l5y, leg_quad_l7_l6y, leg_quad_l7_l7y, leg_quad_l7_l8y, leg_quad_l7_l9y, leg_quad_l7_l10y, leg_quad_l8_l0y, leg_quad_l8_l1y, leg_quad_l8_l2y, leg_quad_l8_l3y, leg_quad_l8_l4y, leg_quad_l8_l5y, leg_quad_l8_l6y, leg_quad_l8_l7y, leg_quad_l8_l8y, leg_quad_l8_l9y, leg_quad_l8_l10y, leg_quad_l9_l0y, leg_quad_l9_l1y, leg_quad_l9_l2y, leg_quad_l9_l3y, leg_quad_l9_l4y, leg_quad_l9_l5y, leg_quad_l9_l6y, leg_quad_l9_l7y, leg_quad_l9_l8y, leg_quad_l9_l9y, leg_quad_l9_l10y, leg_quad_l10_l0y, leg_quad_l10_l1y, leg_quad_l10_l2y, leg_quad_l10_l3y, leg_quad_l10_l4y, leg_quad_l10_l5y, leg_quad_l10_l6y, leg_quad_l10_l7y, leg_quad_l10_l8y, leg_quad_l10_l9y, leg_quad_l10_l10y, }; static Shapeset::shape_fn_t leg_quad_fn_dxx[] = { leg_quad_l0_l0xx, leg_quad_l0_l1xx, leg_quad_l0_l2xx, leg_quad_l0_l3xx, leg_quad_l0_l4xx, leg_quad_l0_l5xx, leg_quad_l0_l6xx, leg_quad_l0_l7xx, leg_quad_l0_l8xx, leg_quad_l0_l9xx, leg_quad_l0_l10xx, leg_quad_l1_l0xx, leg_quad_l1_l1xx, leg_quad_l1_l2xx, leg_quad_l1_l3xx, leg_quad_l1_l4xx, leg_quad_l1_l5xx, leg_quad_l1_l6xx, leg_quad_l1_l7xx, leg_quad_l1_l8xx, leg_quad_l1_l9xx, leg_quad_l1_l10xx, leg_quad_l2_l0xx, leg_quad_l2_l1xx, leg_quad_l2_l2xx, leg_quad_l2_l3xx, leg_quad_l2_l4xx, leg_quad_l2_l5xx, leg_quad_l2_l6xx, leg_quad_l2_l7xx, leg_quad_l2_l8xx, leg_quad_l2_l9xx, leg_quad_l2_l10xx, leg_quad_l3_l0xx, leg_quad_l3_l1xx, leg_quad_l3_l2xx, leg_quad_l3_l3xx, leg_quad_l3_l4xx, leg_quad_l3_l5xx, leg_quad_l3_l6xx, leg_quad_l3_l7xx, leg_quad_l3_l8xx, leg_quad_l3_l9xx, leg_quad_l3_l10xx, leg_quad_l4_l0xx, leg_quad_l4_l1xx, leg_quad_l4_l2xx, leg_quad_l4_l3xx, leg_quad_l4_l4xx, leg_quad_l4_l5xx, leg_quad_l4_l6xx, leg_quad_l4_l7xx, leg_quad_l4_l8xx, leg_quad_l4_l9xx, leg_quad_l4_l10xx, leg_quad_l5_l0xx, leg_quad_l5_l1xx, leg_quad_l5_l2xx, leg_quad_l5_l3xx, leg_quad_l5_l4xx, leg_quad_l5_l5xx, leg_quad_l5_l6xx, leg_quad_l5_l7xx, leg_quad_l5_l8xx, leg_quad_l5_l9xx, leg_quad_l5_l10xx, leg_quad_l6_l0xx, leg_quad_l6_l1xx, leg_quad_l6_l2xx, leg_quad_l6_l3xx, leg_quad_l6_l4xx, leg_quad_l6_l5xx, leg_quad_l6_l6xx, leg_quad_l6_l7xx, leg_quad_l6_l8xx, leg_quad_l6_l9xx, leg_quad_l6_l10xx, leg_quad_l7_l0xx, leg_quad_l7_l1xx, leg_quad_l7_l2xx, leg_quad_l7_l3xx, leg_quad_l7_l4xx, leg_quad_l7_l5xx, leg_quad_l7_l6xx, leg_quad_l7_l7xx, leg_quad_l7_l8xx, leg_quad_l7_l9xx, leg_quad_l7_l10xx, leg_quad_l8_l0xx, leg_quad_l8_l1xx, leg_quad_l8_l2xx, leg_quad_l8_l3xx, leg_quad_l8_l4xx, leg_quad_l8_l5xx, leg_quad_l8_l6xx, leg_quad_l8_l7xx, leg_quad_l8_l8xx, leg_quad_l8_l9xx, leg_quad_l8_l10xx, leg_quad_l9_l0xx, leg_quad_l9_l1xx, leg_quad_l9_l2xx, leg_quad_l9_l3xx, leg_quad_l9_l4xx, leg_quad_l9_l5xx, leg_quad_l9_l6xx, leg_quad_l9_l7xx, leg_quad_l9_l8xx, leg_quad_l9_l9xx, leg_quad_l9_l10xx, leg_quad_l10_l0xx, leg_quad_l10_l1xx, leg_quad_l10_l2xx, leg_quad_l10_l3xx, leg_quad_l10_l4xx, leg_quad_l10_l5xx, leg_quad_l10_l6xx, leg_quad_l10_l7xx, leg_quad_l10_l8xx, leg_quad_l10_l9xx, leg_quad_l10_l10xx, }; static Shapeset::shape_fn_t leg_quad_fn_dxy[] = { leg_quad_l0_l0xy, leg_quad_l0_l1xy, leg_quad_l0_l2xy, leg_quad_l0_l3xy, leg_quad_l0_l4xy, leg_quad_l0_l5xy, leg_quad_l0_l6xy, leg_quad_l0_l7xy, leg_quad_l0_l8xy, leg_quad_l0_l9xy, leg_quad_l0_l10xy, leg_quad_l1_l0xy, leg_quad_l1_l1xy, leg_quad_l1_l2xy, leg_quad_l1_l3xy, leg_quad_l1_l4xy, leg_quad_l1_l5xy, leg_quad_l1_l6xy, leg_quad_l1_l7xy, leg_quad_l1_l8xy, leg_quad_l1_l9xy, leg_quad_l1_l10xy, leg_quad_l2_l0xy, leg_quad_l2_l1xy, leg_quad_l2_l2xy, leg_quad_l2_l3xy, leg_quad_l2_l4xy, leg_quad_l2_l5xy, leg_quad_l2_l6xy, leg_quad_l2_l7xy, leg_quad_l2_l8xy, leg_quad_l2_l9xy, leg_quad_l2_l10xy, leg_quad_l3_l0xy, leg_quad_l3_l1xy, leg_quad_l3_l2xy, leg_quad_l3_l3xy, leg_quad_l3_l4xy, leg_quad_l3_l5xy, leg_quad_l3_l6xy, leg_quad_l3_l7xy, leg_quad_l3_l8xy, leg_quad_l3_l9xy, leg_quad_l3_l10xy, leg_quad_l4_l0xy, leg_quad_l4_l1xy, leg_quad_l4_l2xy, leg_quad_l4_l3xy, leg_quad_l4_l4xy, leg_quad_l4_l5xy, leg_quad_l4_l6xy, leg_quad_l4_l7xy, leg_quad_l4_l8xy, leg_quad_l4_l9xy, leg_quad_l4_l10xy, leg_quad_l5_l0xy, leg_quad_l5_l1xy, leg_quad_l5_l2xy, leg_quad_l5_l3xy, leg_quad_l5_l4xy, leg_quad_l5_l5xy, leg_quad_l5_l6xy, leg_quad_l5_l7xy, leg_quad_l5_l8xy, leg_quad_l5_l9xy, leg_quad_l5_l10xy, leg_quad_l6_l0xy, leg_quad_l6_l1xy, leg_quad_l6_l2xy, leg_quad_l6_l3xy, leg_quad_l6_l4xy, leg_quad_l6_l5xy, leg_quad_l6_l6xy, leg_quad_l6_l7xy, leg_quad_l6_l8xy, leg_quad_l6_l9xy, leg_quad_l6_l10xy, leg_quad_l7_l0xy, leg_quad_l7_l1xy, leg_quad_l7_l2xy, leg_quad_l7_l3xy, leg_quad_l7_l4xy, leg_quad_l7_l5xy, leg_quad_l7_l6xy, leg_quad_l7_l7xy, leg_quad_l7_l8xy, leg_quad_l7_l9xy, leg_quad_l7_l10xy, leg_quad_l8_l0xy, leg_quad_l8_l1xy, leg_quad_l8_l2xy, leg_quad_l8_l3xy, leg_quad_l8_l4xy, leg_quad_l8_l5xy, leg_quad_l8_l6xy, leg_quad_l8_l7xy, leg_quad_l8_l8xy, leg_quad_l8_l9xy, leg_quad_l8_l10xy, leg_quad_l9_l0xy, leg_quad_l9_l1xy, leg_quad_l9_l2xy, leg_quad_l9_l3xy, leg_quad_l9_l4xy, leg_quad_l9_l5xy, leg_quad_l9_l6xy, leg_quad_l9_l7xy, leg_quad_l9_l8xy, leg_quad_l9_l9xy, leg_quad_l9_l10xy, leg_quad_l10_l0xy, leg_quad_l10_l1xy, leg_quad_l10_l2xy, leg_quad_l10_l3xy, leg_quad_l10_l4xy, leg_quad_l10_l5xy, leg_quad_l10_l6xy, leg_quad_l10_l7xy, leg_quad_l10_l8xy, leg_quad_l10_l9xy, leg_quad_l10_l10xy, }; static Shapeset::shape_fn_t leg_quad_fn_dyy[] = { leg_quad_l0_l0yy, leg_quad_l0_l1yy, leg_quad_l0_l2yy, leg_quad_l0_l3yy, leg_quad_l0_l4yy, leg_quad_l0_l5yy, leg_quad_l0_l6yy, leg_quad_l0_l7yy, leg_quad_l0_l8yy, leg_quad_l0_l9yy, leg_quad_l0_l10yy, leg_quad_l1_l0yy, leg_quad_l1_l1yy, leg_quad_l1_l2yy, leg_quad_l1_l3yy, leg_quad_l1_l4yy, leg_quad_l1_l5yy, leg_quad_l1_l6yy, leg_quad_l1_l7yy, leg_quad_l1_l8yy, leg_quad_l1_l9yy, leg_quad_l1_l10yy, leg_quad_l2_l0yy, leg_quad_l2_l1yy, leg_quad_l2_l2yy, leg_quad_l2_l3yy, leg_quad_l2_l4yy, leg_quad_l2_l5yy, leg_quad_l2_l6yy, leg_quad_l2_l7yy, leg_quad_l2_l8yy, leg_quad_l2_l9yy, leg_quad_l2_l10yy, leg_quad_l3_l0yy, leg_quad_l3_l1yy, leg_quad_l3_l2yy, leg_quad_l3_l3yy, leg_quad_l3_l4yy, leg_quad_l3_l5yy, leg_quad_l3_l6yy, leg_quad_l3_l7yy, leg_quad_l3_l8yy, leg_quad_l3_l9yy, leg_quad_l3_l10yy, leg_quad_l4_l0yy, leg_quad_l4_l1yy, leg_quad_l4_l2yy, leg_quad_l4_l3yy, leg_quad_l4_l4yy, leg_quad_l4_l5yy, leg_quad_l4_l6yy, leg_quad_l4_l7yy, leg_quad_l4_l8yy, leg_quad_l4_l9yy, leg_quad_l4_l10yy, leg_quad_l5_l0yy, leg_quad_l5_l1yy, leg_quad_l5_l2yy, leg_quad_l5_l3yy, leg_quad_l5_l4yy, leg_quad_l5_l5yy, leg_quad_l5_l6yy, leg_quad_l5_l7yy, leg_quad_l5_l8yy, leg_quad_l5_l9yy, leg_quad_l5_l10yy, leg_quad_l6_l0yy, leg_quad_l6_l1yy, leg_quad_l6_l2yy, leg_quad_l6_l3yy, leg_quad_l6_l4yy, leg_quad_l6_l5yy, leg_quad_l6_l6yy, leg_quad_l6_l7yy, leg_quad_l6_l8yy, leg_quad_l6_l9yy, leg_quad_l6_l10yy, leg_quad_l7_l0yy, leg_quad_l7_l1yy, leg_quad_l7_l2yy, leg_quad_l7_l3yy, leg_quad_l7_l4yy, leg_quad_l7_l5yy, leg_quad_l7_l6yy, leg_quad_l7_l7yy, leg_quad_l7_l8yy, leg_quad_l7_l9yy, leg_quad_l7_l10yy, leg_quad_l8_l0yy, leg_quad_l8_l1yy, leg_quad_l8_l2yy, leg_quad_l8_l3yy, leg_quad_l8_l4yy, leg_quad_l8_l5yy, leg_quad_l8_l6yy, leg_quad_l8_l7yy, leg_quad_l8_l8yy, leg_quad_l8_l9yy, leg_quad_l8_l10yy, leg_quad_l9_l0yy, leg_quad_l9_l1yy, leg_quad_l9_l2yy, leg_quad_l9_l3yy, leg_quad_l9_l4yy, leg_quad_l9_l5yy, leg_quad_l9_l6yy, leg_quad_l9_l7yy, leg_quad_l9_l8yy, leg_quad_l9_l9yy, leg_quad_l9_l10yy, leg_quad_l10_l0yy, leg_quad_l10_l1yy, leg_quad_l10_l2yy, leg_quad_l10_l3yy, leg_quad_l10_l4yy, leg_quad_l10_l5yy, leg_quad_l10_l6yy, leg_quad_l10_l7yy, leg_quad_l10_l8yy, leg_quad_l10_l9yy, leg_quad_l10_l10yy, }; Shapeset::shape_fn_t* leg_quad_shape_fn_table[1] = { leg_quad_fn }; Shapeset::shape_fn_t* leg_quad_shape_fn_table_dx[1] = { leg_quad_fn_dx }; Shapeset::shape_fn_t* leg_quad_shape_fn_table_dy[1] = { leg_quad_fn_dy }; Shapeset::shape_fn_t* leg_quad_shape_fn_table_dxx[1] = { leg_quad_fn_dxx }; Shapeset::shape_fn_t* leg_quad_shape_fn_table_dxy[1] = { leg_quad_fn_dxy }; Shapeset::shape_fn_t* leg_quad_shape_fn_table_dyy[1] = { leg_quad_fn_dyy }; static int qb_0_0[] = { 0,}; static int qb_0_1[] = { 0,1,}; static int qb_0_2[] = { 0,1,2,}; static int qb_0_3[] = { 0,1,2,3,}; static int qb_0_4[] = { 0,1,2,3,4,}; static int qb_0_5[] = { 0,1,2,3,4,5,}; static int qb_0_6[] = { 0,1,2,3,4,5,6,}; static int qb_0_7[] = { 0,1,2,3,4,5,6,7,}; static int qb_0_8[] = { 0,1,2,3,4,5,6,7,8,}; static int qb_0_9[] = { 0,1,2,3,4,5,6,7,8,9,}; static int qb_0_10[] = { 0,1,2,3,4,5,6,7,8,9,10,}; static int qb_1_0[] = { 0,11,}; static int qb_1_1[] = { 0,1,11,12,}; static int qb_1_2[] = { 0,1,2,11,12,13,}; static int qb_1_3[] = { 0,1,2,3,11,12,13,14,}; static int qb_1_4[] = { 0,1,2,3,4,11,12,13,14,15,}; static int qb_1_5[] = { 0,1,2,3,4,5,11,12,13,14,15,16,}; static int qb_1_6[] = { 0,1,2,3,4,5,6,11,12,13,14,15,16,17,}; static int qb_1_7[] = { 0,1,2,3,4,5,6,7,11,12,13,14,15,16,17,18,}; static int qb_1_8[] = { 0,1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18,19,}; static int qb_1_9[] = { 0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20,}; static int qb_1_10[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,}; static int qb_2_0[] = { 0,11,22,}; static int qb_2_1[] = { 0,1,11,12,22,23,}; static int qb_2_2[] = { 0,1,2,11,12,13,22,23,24,}; static int qb_2_3[] = { 0,1,2,3,11,12,13,14,22,23,24,25,}; static int qb_2_4[] = { 0,1,2,3,4,11,12,13,14,15,22,23,24,25,26,}; static int qb_2_5[] = { 0,1,2,3,4,5,11,12,13,14,15,16,22,23,24,25,26,27,}; static int qb_2_6[] = { 0,1,2,3,4,5,6,11,12,13,14,15,16,17,22,23,24,25,26,27,28,}; static int qb_2_7[] = { 0,1,2,3,4,5,6,7,11,12,13,14,15,16,17,18,22,23,24,25,26,27,28,29,}; static int qb_2_8[] = { 0,1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18,19,22,23,24,25,26,27,28,29,30,}; static int qb_2_9[] = { 0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,}; static int qb_2_10[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,}; static int qb_3_0[] = { 0,11,22,33,}; static int qb_3_1[] = { 0,1,11,12,22,23,33,34,}; static int qb_3_2[] = { 0,1,2,11,12,13,22,23,24,33,34,35,}; static int qb_3_3[] = { 0,1,2,3,11,12,13,14,22,23,24,25,33,34,35,36,}; static int qb_3_4[] = { 0,1,2,3,4,11,12,13,14,15,22,23,24,25,26,33,34,35,36,37,}; static int qb_3_5[] = { 0,1,2,3,4,5,11,12,13,14,15,16,22,23,24,25,26,27,33,34,35,36,37,38,}; static int qb_3_6[] = { 0,1,2,3,4,5,6,11,12,13,14,15,16,17,22,23,24,25,26,27,28,33,34,35,36,37,38,39,}; static int qb_3_7[] = { 0,1,2,3,4,5,6,7,11,12,13,14,15,16,17,18,22,23,24,25,26,27,28,29,33,34,35,36,37,38,39,40,}; static int qb_3_8[] = { 0,1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18,19,22,23,24,25,26,27,28,29,30,33,34,35,36,37,38,39,40,41,}; static int qb_3_9[] = { 0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38,39,40,41,42,}; static int qb_3_10[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,}; static int qb_4_0[] = { 0,11,22,33,44,}; static int qb_4_1[] = { 0,1,11,12,22,23,33,34,44,45,}; static int qb_4_2[] = { 0,1,2,11,12,13,22,23,24,33,34,35,44,45,46,}; static int qb_4_3[] = { 0,1,2,3,11,12,13,14,22,23,24,25,33,34,35,36,44,45,46,47,}; static int qb_4_4[] = { 0,1,2,3,4,11,12,13,14,15,22,23,24,25,26,33,34,35,36,37,44,45,46,47,48,}; static int qb_4_5[] = { 0,1,2,3,4,5,11,12,13,14,15,16,22,23,24,25,26,27,33,34,35,36,37,38,44,45,46,47,48,49,}; static int qb_4_6[] = { 0,1,2,3,4,5,6,11,12,13,14,15,16,17,22,23,24,25,26,27,28,33,34,35,36,37,38,39,44,45,46,47,48,49,50,}; static int qb_4_7[] = { 0,1,2,3,4,5,6,7,11,12,13,14,15,16,17,18,22,23,24,25,26,27,28,29,33,34,35,36,37,38,39,40,44,45,46,47,48,49,50,51,}; static int qb_4_8[] = { 0,1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18,19,22,23,24,25,26,27,28,29,30,33,34,35,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,}; static int qb_4_9[] = { 0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,}; static int qb_4_10[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,}; static int qb_5_0[] = { 0,11,22,33,44,55,}; static int qb_5_1[] = { 0,1,11,12,22,23,33,34,44,45,55,56,}; static int qb_5_2[] = { 0,1,2,11,12,13,22,23,24,33,34,35,44,45,46,55,56,57,}; static int qb_5_3[] = { 0,1,2,3,11,12,13,14,22,23,24,25,33,34,35,36,44,45,46,47,55,56,57,58,}; static int qb_5_4[] = { 0,1,2,3,4,11,12,13,14,15,22,23,24,25,26,33,34,35,36,37,44,45,46,47,48,55,56,57,58,59,}; static int qb_5_5[] = { 0,1,2,3,4,5,11,12,13,14,15,16,22,23,24,25,26,27,33,34,35,36,37,38,44,45,46,47,48,49,55,56,57,58,59,60,}; static int qb_5_6[] = { 0,1,2,3,4,5,6,11,12,13,14,15,16,17,22,23,24,25,26,27,28,33,34,35,36,37,38,39,44,45,46,47,48,49,50,55,56,57,58,59,60,61,}; static int qb_5_7[] = { 0,1,2,3,4,5,6,7,11,12,13,14,15,16,17,18,22,23,24,25,26,27,28,29,33,34,35,36,37,38,39,40,44,45,46,47,48,49,50,51,55,56,57,58,59,60,61,62,}; static int qb_5_8[] = { 0,1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18,19,22,23,24,25,26,27,28,29,30,33,34,35,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,55,56,57,58,59,60,61,62,63,}; static int qb_5_9[] = { 0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,55,56,57,58,59,60,61,62,63,64,}; static int qb_5_10[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,}; static int qb_6_0[] = { 0,11,22,33,44,55,66,}; static int qb_6_1[] = { 0,1,11,12,22,23,33,34,44,45,55,56,66,67,}; static int qb_6_2[] = { 0,1,2,11,12,13,22,23,24,33,34,35,44,45,46,55,56,57,66,67,68,}; static int qb_6_3[] = { 0,1,2,3,11,12,13,14,22,23,24,25,33,34,35,36,44,45,46,47,55,56,57,58,66,67,68,69,}; static int qb_6_4[] = { 0,1,2,3,4,11,12,13,14,15,22,23,24,25,26,33,34,35,36,37,44,45,46,47,48,55,56,57,58,59,66,67,68,69,70,}; static int qb_6_5[] = { 0,1,2,3,4,5,11,12,13,14,15,16,22,23,24,25,26,27,33,34,35,36,37,38,44,45,46,47,48,49,55,56,57,58,59,60,66,67,68,69,70,71,}; static int qb_6_6[] = { 0,1,2,3,4,5,6,11,12,13,14,15,16,17,22,23,24,25,26,27,28,33,34,35,36,37,38,39,44,45,46,47,48,49,50,55,56,57,58,59,60,61,66,67,68,69,70,71,72,}; static int qb_6_7[] = { 0,1,2,3,4,5,6,7,11,12,13,14,15,16,17,18,22,23,24,25,26,27,28,29,33,34,35,36,37,38,39,40,44,45,46,47,48,49,50,51,55,56,57,58,59,60,61,62,66,67,68,69,70,71,72,73,}; static int qb_6_8[] = { 0,1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18,19,22,23,24,25,26,27,28,29,30,33,34,35,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,55,56,57,58,59,60,61,62,63,66,67,68,69,70,71,72,73,74,}; static int qb_6_9[] = { 0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,55,56,57,58,59,60,61,62,63,64,66,67,68,69,70,71,72,73,74,75,}; static int qb_6_10[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,}; static int qb_7_0[] = { 0,11,22,33,44,55,66,77,}; static int qb_7_1[] = { 0,1,11,12,22,23,33,34,44,45,55,56,66,67,77,78,}; static int qb_7_2[] = { 0,1,2,11,12,13,22,23,24,33,34,35,44,45,46,55,56,57,66,67,68,77,78,79,}; static int qb_7_3[] = { 0,1,2,3,11,12,13,14,22,23,24,25,33,34,35,36,44,45,46,47,55,56,57,58,66,67,68,69,77,78,79,80,}; static int qb_7_4[] = { 0,1,2,3,4,11,12,13,14,15,22,23,24,25,26,33,34,35,36,37,44,45,46,47,48,55,56,57,58,59,66,67,68,69,70,77,78,79,80,81,}; static int qb_7_5[] = { 0,1,2,3,4,5,11,12,13,14,15,16,22,23,24,25,26,27,33,34,35,36,37,38,44,45,46,47,48,49,55,56,57,58,59,60,66,67,68,69,70,71,77,78,79,80,81,82,}; static int qb_7_6[] = { 0,1,2,3,4,5,6,11,12,13,14,15,16,17,22,23,24,25,26,27,28,33,34,35,36,37,38,39,44,45,46,47,48,49,50,55,56,57,58,59,60,61,66,67,68,69,70,71,72,77,78,79,80,81,82,83,}; static int qb_7_7[] = { 0,1,2,3,4,5,6,7,11,12,13,14,15,16,17,18,22,23,24,25,26,27,28,29,33,34,35,36,37,38,39,40,44,45,46,47,48,49,50,51,55,56,57,58,59,60,61,62,66,67,68,69,70,71,72,73,77,78,79,80,81,82,83,84,}; static int qb_7_8[] = { 0,1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18,19,22,23,24,25,26,27,28,29,30,33,34,35,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,55,56,57,58,59,60,61,62,63,66,67,68,69,70,71,72,73,74,77,78,79,80,81,82,83,84,85,}; static int qb_7_9[] = { 0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,55,56,57,58,59,60,61,62,63,64,66,67,68,69,70,71,72,73,74,75,77,78,79,80,81,82,83,84,85,86,}; static int qb_7_10[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,}; static int qb_8_0[] = { 0,11,22,33,44,55,66,77,88,}; static int qb_8_1[] = { 0,1,11,12,22,23,33,34,44,45,55,56,66,67,77,78,88,89,}; static int qb_8_2[] = { 0,1,2,11,12,13,22,23,24,33,34,35,44,45,46,55,56,57,66,67,68,77,78,79,88,89,90,}; static int qb_8_3[] = { 0,1,2,3,11,12,13,14,22,23,24,25,33,34,35,36,44,45,46,47,55,56,57,58,66,67,68,69,77,78,79,80,88,89,90,91,}; static int qb_8_4[] = { 0,1,2,3,4,11,12,13,14,15,22,23,24,25,26,33,34,35,36,37,44,45,46,47,48,55,56,57,58,59,66,67,68,69,70,77,78,79,80,81,88,89,90,91,92,}; static int qb_8_5[] = { 0,1,2,3,4,5,11,12,13,14,15,16,22,23,24,25,26,27,33,34,35,36,37,38,44,45,46,47,48,49,55,56,57,58,59,60,66,67,68,69,70,71,77,78,79,80,81,82,88,89,90,91,92,93,}; static int qb_8_6[] = { 0,1,2,3,4,5,6,11,12,13,14,15,16,17,22,23,24,25,26,27,28,33,34,35,36,37,38,39,44,45,46,47,48,49,50,55,56,57,58,59,60,61,66,67,68,69,70,71,72,77,78,79,80,81,82,83,88,89,90,91,92,93,94,}; static int qb_8_7[] = { 0,1,2,3,4,5,6,7,11,12,13,14,15,16,17,18,22,23,24,25,26,27,28,29,33,34,35,36,37,38,39,40,44,45,46,47,48,49,50,51,55,56,57,58,59,60,61,62,66,67,68,69,70,71,72,73,77,78,79,80,81,82,83,84,88,89,90,91,92,93,94,95,}; static int qb_8_8[] = { 0,1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18,19,22,23,24,25,26,27,28,29,30,33,34,35,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,55,56,57,58,59,60,61,62,63,66,67,68,69,70,71,72,73,74,77,78,79,80,81,82,83,84,85,88,89,90,91,92,93,94,95,96,}; static int qb_8_9[] = { 0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,55,56,57,58,59,60,61,62,63,64,66,67,68,69,70,71,72,73,74,75,77,78,79,80,81,82,83,84,85,86,88,89,90,91,92,93,94,95,96,97,}; static int qb_8_10[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,}; static int qb_9_0[] = { 0,11,22,33,44,55,66,77,88,99,}; static int qb_9_1[] = { 0,1,11,12,22,23,33,34,44,45,55,56,66,67,77,78,88,89,99,100,}; static int qb_9_2[] = { 0,1,2,11,12,13,22,23,24,33,34,35,44,45,46,55,56,57,66,67,68,77,78,79,88,89,90,99,100,101,}; static int qb_9_3[] = { 0,1,2,3,11,12,13,14,22,23,24,25,33,34,35,36,44,45,46,47,55,56,57,58,66,67,68,69,77,78,79,80,88,89,90,91,99,100,101,102,}; static int qb_9_4[] = { 0,1,2,3,4,11,12,13,14,15,22,23,24,25,26,33,34,35,36,37,44,45,46,47,48,55,56,57,58,59,66,67,68,69,70,77,78,79,80,81,88,89,90,91,92,99,100,101,102,103,}; static int qb_9_5[] = { 0,1,2,3,4,5,11,12,13,14,15,16,22,23,24,25,26,27,33,34,35,36,37,38,44,45,46,47,48,49,55,56,57,58,59,60,66,67,68,69,70,71,77,78,79,80,81,82,88,89,90,91,92,93,99,100,101,102,103,104,}; static int qb_9_6[] = { 0,1,2,3,4,5,6,11,12,13,14,15,16,17,22,23,24,25,26,27,28,33,34,35,36,37,38,39,44,45,46,47,48,49,50,55,56,57,58,59,60,61,66,67,68,69,70,71,72,77,78,79,80,81,82,83,88,89,90,91,92,93,94,99,100,101,102,103,104,105,}; static int qb_9_7[] = { 0,1,2,3,4,5,6,7,11,12,13,14,15,16,17,18,22,23,24,25,26,27,28,29,33,34,35,36,37,38,39,40,44,45,46,47,48,49,50,51,55,56,57,58,59,60,61,62,66,67,68,69,70,71,72,73,77,78,79,80,81,82,83,84,88,89,90,91,92,93,94,95,99,100,101,102,103,104,105,106,}; static int qb_9_8[] = { 0,1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18,19,22,23,24,25,26,27,28,29,30,33,34,35,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,55,56,57,58,59,60,61,62,63,66,67,68,69,70,71,72,73,74,77,78,79,80,81,82,83,84,85,88,89,90,91,92,93,94,95,96,99,100,101,102,103,104,105,106,107,}; static int qb_9_9[] = { 0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,55,56,57,58,59,60,61,62,63,64,66,67,68,69,70,71,72,73,74,75,77,78,79,80,81,82,83,84,85,86,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,104,105,106,107,108,}; static int qb_9_10[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,}; static int qb_10_0[] = { 0,11,22,33,44,55,66,77,88,99,110,}; static int qb_10_1[] = { 0,1,11,12,22,23,33,34,44,45,55,56,66,67,77,78,88,89,99,100,110,111,}; static int qb_10_2[] = { 0,1,2,11,12,13,22,23,24,33,34,35,44,45,46,55,56,57,66,67,68,77,78,79,88,89,90,99,100,101,110,111,112,}; static int qb_10_3[] = { 0,1,2,3,11,12,13,14,22,23,24,25,33,34,35,36,44,45,46,47,55,56,57,58,66,67,68,69,77,78,79,80,88,89,90,91,99,100,101,102,110,111,112,113,}; static int qb_10_4[] = { 0,1,2,3,4,11,12,13,14,15,22,23,24,25,26,33,34,35,36,37,44,45,46,47,48,55,56,57,58,59,66,67,68,69,70,77,78,79,80,81,88,89,90,91,92,99,100,101,102,103,110,111,112,113,114,}; static int qb_10_5[] = { 0,1,2,3,4,5,11,12,13,14,15,16,22,23,24,25,26,27,33,34,35,36,37,38,44,45,46,47,48,49,55,56,57,58,59,60,66,67,68,69,70,71,77,78,79,80,81,82,88,89,90,91,92,93,99,100,101,102,103,104,110,111,112,113,114,115,}; static int qb_10_6[] = { 0,1,2,3,4,5,6,11,12,13,14,15,16,17,22,23,24,25,26,27,28,33,34,35,36,37,38,39,44,45,46,47,48,49,50,55,56,57,58,59,60,61,66,67,68,69,70,71,72,77,78,79,80,81,82,83,88,89,90,91,92,93,94,99,100,101,102,103,104,105,110,111,112,113,114,115,116,}; static int qb_10_7[] = { 0,1,2,3,4,5,6,7,11,12,13,14,15,16,17,18,22,23,24,25,26,27,28,29,33,34,35,36,37,38,39,40,44,45,46,47,48,49,50,51,55,56,57,58,59,60,61,62,66,67,68,69,70,71,72,73,77,78,79,80,81,82,83,84,88,89,90,91,92,93,94,95,99,100,101,102,103,104,105,106,110,111,112,113,114,115,116,117,}; static int qb_10_8[] = { 0,1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18,19,22,23,24,25,26,27,28,29,30,33,34,35,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,55,56,57,58,59,60,61,62,63,66,67,68,69,70,71,72,73,74,77,78,79,80,81,82,83,84,85,88,89,90,91,92,93,94,95,96,99,100,101,102,103,104,105,106,107,110,111,112,113,114,115,116,117,118,}; static int qb_10_9[] = { 0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,55,56,57,58,59,60,61,62,63,64,66,67,68,69,70,71,72,73,74,75,77,78,79,80,81,82,83,84,85,86,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,104,105,106,107,108,110,111,112,113,114,115,116,117,118,119,}; static int qb_10_10[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,}; #define NULL16 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL int* leg_quad_bubble_indices[] = { qb_0_0, qb_0_1, qb_0_2, qb_0_3, qb_0_4, qb_0_5, qb_0_6, qb_0_7, qb_0_8, qb_0_9, qb_0_10, NULL, NULL, NULL, NULL, NULL, NULL16, qb_1_0, qb_1_1, qb_1_2, qb_1_3, qb_1_4, qb_1_5, qb_1_6, qb_1_7, qb_1_8, qb_1_9, qb_1_10, NULL, NULL, NULL, NULL, NULL, NULL16, qb_2_0, qb_2_1, qb_2_2, qb_2_3, qb_2_4, qb_2_5, qb_2_6, qb_2_7, qb_2_8, qb_2_9, qb_2_10, NULL, NULL, NULL, NULL, NULL, NULL16, qb_3_0, qb_3_1, qb_3_2, qb_3_3, qb_3_4, qb_3_5, qb_3_6, qb_3_7, qb_3_8, qb_3_9, qb_3_10, NULL, NULL, NULL, NULL, NULL, NULL16, qb_4_0, qb_4_1, qb_4_2, qb_4_3, qb_4_4, qb_4_5, qb_4_6, qb_4_7, qb_4_8, qb_4_9, qb_4_10, NULL, NULL, NULL, NULL, NULL, NULL16, qb_5_0, qb_5_1, qb_5_2, qb_5_3, qb_5_4, qb_5_5, qb_5_6, qb_5_7, qb_5_8, qb_5_9, qb_5_10, NULL, NULL, NULL, NULL, NULL, NULL16, qb_6_0, qb_6_1, qb_6_2, qb_6_3, qb_6_4, qb_6_5, qb_6_6, qb_6_7, qb_6_8, qb_6_9, qb_6_10, NULL, NULL, NULL, NULL, NULL, NULL16, qb_7_0, qb_7_1, qb_7_2, qb_7_3, qb_7_4, qb_7_5, qb_7_6, qb_7_7, qb_7_8, qb_7_9, qb_7_10, NULL, NULL, NULL, NULL, NULL, NULL16, qb_8_0, qb_8_1, qb_8_2, qb_8_3, qb_8_4, qb_8_5, qb_8_6, qb_8_7, qb_8_8, qb_8_9, qb_8_10, NULL, NULL, NULL, NULL, NULL, NULL16, qb_9_0, qb_9_1, qb_9_2, qb_9_3, qb_9_4, qb_9_5, qb_9_6, qb_9_7, qb_9_8, qb_9_9, qb_9_10, NULL, NULL, NULL, NULL, NULL, NULL16, qb_10_0, qb_10_1, qb_10_2, qb_10_3, qb_10_4, qb_10_5, qb_10_6, qb_10_7, qb_10_8, qb_10_9, qb_10_10, NULL, NULL, NULL, NULL, NULL, NULL16, }; #define zero16 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 int leg_quad_bubble_count[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 0, 0, 0, 0, zero16, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 0, 0, 0, 0, 0, zero16, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 0, 0, 0, 0, 0, zero16, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 0, 0, 0, 0, 0, zero16, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 0, 0, 0, 0, 0, zero16, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 0, 0, 0, 0, 0, zero16, 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 0, 0, 0, 0, 0, zero16, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 0, 0, 0, 0, 0, zero16, 9, 18, 27, 36, 45, 54, 63, 72, 81, 90, 99, 0, 0, 0, 0, 0, zero16, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 0, 0, 0, 0, 0, zero16, 11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 121, 0, 0, 0, 0, 0, zero16, }; int leg_quad_vertex_indices[4] = { -1, -1, -1, -1 }; static int leg_quad_edge_indices_0[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; static int leg_quad_edge_indices_1[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; static int leg_quad_edge_indices_2[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; static int leg_quad_edge_indices_3[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; int* leg_quad_edge_indices[4] = { leg_quad_edge_indices_0, leg_quad_edge_indices_1, leg_quad_edge_indices_2, leg_quad_edge_indices_3 }; #define oo H2D_MAKE_QUAD_ORDER #define XX(a,b) oo(a,b), oo(a,b) int leg_quad_index_to_order[] = { oo(1,1), oo(1,1), oo(1,2), oo(1,3), oo(1,4), oo(1,5), oo(1,6), oo(1,7), oo(1,8), oo(1,9), oo(1,10), oo(1,1), oo(1,1), oo(1,2), oo(1,3), oo(1,4), oo(1,5), oo(1,6), oo(1,7), oo(1,8), oo(1,9), oo(1,10), oo(2,1), oo(2,1), oo(2,2), oo(2,3), oo(2,4), oo(2,5), oo(2,6), oo(2,7), oo(2,8), oo(2,9), oo(2,10), oo(3,1), oo(3,1), oo(3,2), oo(3,3), oo(3,4), oo(3,5), oo(3,6), oo(3,7), oo(3,8), oo(3,9), oo(3,10), oo(4,1), oo(4,1), oo(4,2), oo(4,3), oo(4,4), oo(4,5), oo(4,6), oo(4,7), oo(4,8), oo(4,9), oo(4,10), oo(5,1), oo(5,1), oo(5,2), oo(5,3), oo(5,4), oo(5,5), oo(5,6), oo(5,7), oo(5,8), oo(5,9), oo(5,10), oo(6,1), oo(6,1), oo(6,2), oo(6,3), oo(6,4), oo(6,5), oo(6,6), oo(6,7), oo(6,8), oo(6,9), oo(6,10), oo(7,1), oo(7,1), oo(7,2), oo(7,3), oo(7,4), oo(7,5), oo(7,6), oo(7,7), oo(7,8), oo(7,9), oo(7,10), oo(8,1), oo(8,1), oo(8,2), oo(8,3), oo(8,4), oo(8,5), oo(8,6), oo(8,7), oo(8,8), oo(8,9), oo(8,10), oo(9,1), oo(9,1), oo(9,2), oo(9,3), oo(9,4), oo(9,5), oo(9,6), oo(9,7), oo(9,8), oo(9,9), oo(9,10), oo(10,1), oo(10,1), oo(10,2), oo(10,3), oo(10,4), oo(10,5), oo(10,6), oo(10,7), oo(10,8), oo(10,9), oo(10,10), }; //// triangle legendre shapeset ///////////////////////////////////////////////////////////////// static double leg_tri_l0_l0(double x, double y) { return Legendre0(lambda3(x,y) - lambda2(x,y)) * Legendre0(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l0_l0x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre0(l3 - l2), L1x = Legendre0x(l3 - l2); double L2 = Legendre0(l2 - l1), L2x = Legendre0x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l0_l0y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre0(l3 - l2), L1y = Legendre0x(l3 - l2); double L2 = Legendre0(l2 - l1), L2y = Legendre0x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l0_l1(double x, double y) { return Legendre0(lambda3(x,y) - lambda2(x,y)) * Legendre1(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l0_l1x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre0(l3 - l2), L1x = Legendre1x(l3 - l2); double L2 = Legendre0(l2 - l1), L2x = Legendre1x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l0_l1y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre0(l3 - l2), L1y = Legendre1x(l3 - l2); double L2 = Legendre0(l2 - l1), L2y = Legendre1x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l1_l0(double x, double y) { return Legendre1(lambda3(x,y) - lambda2(x,y)) * Legendre0(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l1_l0x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre1(l3 - l2), L1x = Legendre0x(l3 - l2); double L2 = Legendre1(l2 - l1), L2x = Legendre0x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l1_l0y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre1(l3 - l2), L1y = Legendre0x(l3 - l2); double L2 = Legendre1(l2 - l1), L2y = Legendre0x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l0_l2(double x, double y) { return Legendre0(lambda3(x,y) - lambda2(x,y)) * Legendre2(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l0_l2x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre0(l3 - l2), L1x = Legendre2x(l3 - l2); double L2 = Legendre0(l2 - l1), L2x = Legendre2x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l0_l2y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre0(l3 - l2), L1y = Legendre2x(l3 - l2); double L2 = Legendre0(l2 - l1), L2y = Legendre2x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l2_l0(double x, double y) { return Legendre2(lambda3(x,y) - lambda2(x,y)) * Legendre0(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l2_l0x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre2(l3 - l2), L1x = Legendre0x(l3 - l2); double L2 = Legendre2(l2 - l1), L2x = Legendre0x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l2_l0y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre2(l3 - l2), L1y = Legendre0x(l3 - l2); double L2 = Legendre2(l2 - l1), L2y = Legendre0x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l0_l3(double x, double y) { return Legendre0(lambda3(x,y) - lambda2(x,y)) * Legendre3(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l0_l3x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre0(l3 - l2), L1x = Legendre3x(l3 - l2); double L2 = Legendre0(l2 - l1), L2x = Legendre3x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l0_l3y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre0(l3 - l2), L1y = Legendre3x(l3 - l2); double L2 = Legendre0(l2 - l1), L2y = Legendre3x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l3_l0(double x, double y) { return Legendre3(lambda3(x,y) - lambda2(x,y)) * Legendre0(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l3_l0x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre3(l3 - l2), L1x = Legendre0x(l3 - l2); double L2 = Legendre3(l2 - l1), L2x = Legendre0x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l3_l0y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre3(l3 - l2), L1y = Legendre0x(l3 - l2); double L2 = Legendre3(l2 - l1), L2y = Legendre0x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l0_l4(double x, double y) { return Legendre0(lambda3(x,y) - lambda2(x,y)) * Legendre4(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l0_l4x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre0(l3 - l2), L1x = Legendre4x(l3 - l2); double L2 = Legendre0(l2 - l1), L2x = Legendre4x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l0_l4y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre0(l3 - l2), L1y = Legendre4x(l3 - l2); double L2 = Legendre0(l2 - l1), L2y = Legendre4x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l4_l0(double x, double y) { return Legendre4(lambda3(x,y) - lambda2(x,y)) * Legendre0(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l4_l0x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre4(l3 - l2), L1x = Legendre0x(l3 - l2); double L2 = Legendre4(l2 - l1), L2x = Legendre0x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l4_l0y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre4(l3 - l2), L1y = Legendre0x(l3 - l2); double L2 = Legendre4(l2 - l1), L2y = Legendre0x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l0_l5(double x, double y) { return Legendre0(lambda3(x,y) - lambda2(x,y)) * Legendre5(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l0_l5x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre0(l3 - l2), L1x = Legendre5x(l3 - l2); double L2 = Legendre0(l2 - l1), L2x = Legendre5x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l0_l5y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre0(l3 - l2), L1y = Legendre5x(l3 - l2); double L2 = Legendre0(l2 - l1), L2y = Legendre5x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l5_l0(double x, double y) { return Legendre5(lambda3(x,y) - lambda2(x,y)) * Legendre0(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l5_l0x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre5(l3 - l2), L1x = Legendre0x(l3 - l2); double L2 = Legendre5(l2 - l1), L2x = Legendre0x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l5_l0y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre5(l3 - l2), L1y = Legendre0x(l3 - l2); double L2 = Legendre5(l2 - l1), L2y = Legendre0x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l0_l6(double x, double y) { return Legendre0(lambda3(x,y) - lambda2(x,y)) * Legendre6(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l0_l6x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre0(l3 - l2), L1x = Legendre6x(l3 - l2); double L2 = Legendre0(l2 - l1), L2x = Legendre6x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l0_l6y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre0(l3 - l2), L1y = Legendre6x(l3 - l2); double L2 = Legendre0(l2 - l1), L2y = Legendre6x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l6_l0(double x, double y) { return Legendre6(lambda3(x,y) - lambda2(x,y)) * Legendre0(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l6_l0x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre6(l3 - l2), L1x = Legendre0x(l3 - l2); double L2 = Legendre6(l2 - l1), L2x = Legendre0x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l6_l0y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre6(l3 - l2), L1y = Legendre0x(l3 - l2); double L2 = Legendre6(l2 - l1), L2y = Legendre0x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l0_l7(double x, double y) { return Legendre0(lambda3(x,y) - lambda2(x,y)) * Legendre7(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l0_l7x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre0(l3 - l2), L1x = Legendre7x(l3 - l2); double L2 = Legendre0(l2 - l1), L2x = Legendre7x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l0_l7y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre0(l3 - l2), L1y = Legendre7x(l3 - l2); double L2 = Legendre0(l2 - l1), L2y = Legendre7x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l7_l0(double x, double y) { return Legendre7(lambda3(x,y) - lambda2(x,y)) * Legendre0(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l7_l0x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre7(l3 - l2), L1x = Legendre0x(l3 - l2); double L2 = Legendre7(l2 - l1), L2x = Legendre0x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l7_l0y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre7(l3 - l2), L1y = Legendre0x(l3 - l2); double L2 = Legendre7(l2 - l1), L2y = Legendre0x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l0_l8(double x, double y) { return Legendre0(lambda3(x,y) - lambda2(x,y)) * Legendre8(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l0_l8x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre0(l3 - l2), L1x = Legendre8x(l3 - l2); double L2 = Legendre0(l2 - l1), L2x = Legendre8x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l0_l8y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre0(l3 - l2), L1y = Legendre8x(l3 - l2); double L2 = Legendre0(l2 - l1), L2y = Legendre8x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l8_l0(double x, double y) { return Legendre8(lambda3(x,y) - lambda2(x,y)) * Legendre0(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l8_l0x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre8(l3 - l2), L1x = Legendre0x(l3 - l2); double L2 = Legendre8(l2 - l1), L2x = Legendre0x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l8_l0y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre8(l3 - l2), L1y = Legendre0x(l3 - l2); double L2 = Legendre8(l2 - l1), L2y = Legendre0x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l0_l9(double x, double y) { return Legendre0(lambda3(x,y) - lambda2(x,y)) * Legendre9(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l0_l9x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre0(l3 - l2), L1x = Legendre9x(l3 - l2); double L2 = Legendre0(l2 - l1), L2x = Legendre9x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l0_l9y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre0(l3 - l2), L1y = Legendre9x(l3 - l2); double L2 = Legendre0(l2 - l1), L2y = Legendre9x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l9_l0(double x, double y) { return Legendre9(lambda3(x,y) - lambda2(x,y)) * Legendre0(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l9_l0x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre9(l3 - l2), L1x = Legendre0x(l3 - l2); double L2 = Legendre9(l2 - l1), L2x = Legendre0x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l9_l0y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre9(l3 - l2), L1y = Legendre0x(l3 - l2); double L2 = Legendre9(l2 - l1), L2y = Legendre0x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l0_l10(double x, double y) { return Legendre0(lambda3(x,y) - lambda2(x,y)) * Legendre10(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l0_l10x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre0(l3 - l2), L1x = Legendre10x(l3 - l2); double L2 = Legendre0(l2 - l1), L2x = Legendre10x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l0_l10y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre0(l3 - l2), L1y = Legendre10x(l3 - l2); double L2 = Legendre0(l2 - l1), L2y = Legendre10x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l10_l0(double x, double y) { return Legendre10(lambda3(x,y) - lambda2(x,y)) * Legendre0(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l10_l0x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre10(l3 - l2), L1x = Legendre0x(l3 - l2); double L2 = Legendre10(l2 - l1), L2x = Legendre0x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l10_l0y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre10(l3 - l2), L1y = Legendre0x(l3 - l2); double L2 = Legendre10(l2 - l1), L2y = Legendre0x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l1_l1(double x, double y) { return Legendre1(lambda3(x,y) - lambda2(x,y)) * Legendre1(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l1_l1x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre1(l3 - l2), L1x = Legendre1x(l3 - l2); double L2 = Legendre1(l2 - l1), L2x = Legendre1x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l1_l1y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre1(l3 - l2), L1y = Legendre1x(l3 - l2); double L2 = Legendre1(l2 - l1), L2y = Legendre1x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l1_l2(double x, double y) { return Legendre1(lambda3(x,y) - lambda2(x,y)) * Legendre2(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l1_l2x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre1(l3 - l2), L1x = Legendre2x(l3 - l2); double L2 = Legendre1(l2 - l1), L2x = Legendre2x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l1_l2y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre1(l3 - l2), L1y = Legendre2x(l3 - l2); double L2 = Legendre1(l2 - l1), L2y = Legendre2x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l2_l1(double x, double y) { return Legendre2(lambda3(x,y) - lambda2(x,y)) * Legendre1(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l2_l1x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre2(l3 - l2), L1x = Legendre1x(l3 - l2); double L2 = Legendre2(l2 - l1), L2x = Legendre1x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l2_l1y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre2(l3 - l2), L1y = Legendre1x(l3 - l2); double L2 = Legendre2(l2 - l1), L2y = Legendre1x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l1_l3(double x, double y) { return Legendre1(lambda3(x,y) - lambda2(x,y)) * Legendre3(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l1_l3x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre1(l3 - l2), L1x = Legendre3x(l3 - l2); double L2 = Legendre1(l2 - l1), L2x = Legendre3x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l1_l3y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre1(l3 - l2), L1y = Legendre3x(l3 - l2); double L2 = Legendre1(l2 - l1), L2y = Legendre3x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l3_l1(double x, double y) { return Legendre3(lambda3(x,y) - lambda2(x,y)) * Legendre1(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l3_l1x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre3(l3 - l2), L1x = Legendre1x(l3 - l2); double L2 = Legendre3(l2 - l1), L2x = Legendre1x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l3_l1y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre3(l3 - l2), L1y = Legendre1x(l3 - l2); double L2 = Legendre3(l2 - l1), L2y = Legendre1x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l1_l4(double x, double y) { return Legendre1(lambda3(x,y) - lambda2(x,y)) * Legendre4(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l1_l4x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre1(l3 - l2), L1x = Legendre4x(l3 - l2); double L2 = Legendre1(l2 - l1), L2x = Legendre4x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l1_l4y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre1(l3 - l2), L1y = Legendre4x(l3 - l2); double L2 = Legendre1(l2 - l1), L2y = Legendre4x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l4_l1(double x, double y) { return Legendre4(lambda3(x,y) - lambda2(x,y)) * Legendre1(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l4_l1x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre4(l3 - l2), L1x = Legendre1x(l3 - l2); double L2 = Legendre4(l2 - l1), L2x = Legendre1x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l4_l1y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre4(l3 - l2), L1y = Legendre1x(l3 - l2); double L2 = Legendre4(l2 - l1), L2y = Legendre1x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l1_l5(double x, double y) { return Legendre1(lambda3(x,y) - lambda2(x,y)) * Legendre5(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l1_l5x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre1(l3 - l2), L1x = Legendre5x(l3 - l2); double L2 = Legendre1(l2 - l1), L2x = Legendre5x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l1_l5y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre1(l3 - l2), L1y = Legendre5x(l3 - l2); double L2 = Legendre1(l2 - l1), L2y = Legendre5x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l5_l1(double x, double y) { return Legendre5(lambda3(x,y) - lambda2(x,y)) * Legendre1(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l5_l1x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre5(l3 - l2), L1x = Legendre1x(l3 - l2); double L2 = Legendre5(l2 - l1), L2x = Legendre1x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l5_l1y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre5(l3 - l2), L1y = Legendre1x(l3 - l2); double L2 = Legendre5(l2 - l1), L2y = Legendre1x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l1_l6(double x, double y) { return Legendre1(lambda3(x,y) - lambda2(x,y)) * Legendre6(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l1_l6x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre1(l3 - l2), L1x = Legendre6x(l3 - l2); double L2 = Legendre1(l2 - l1), L2x = Legendre6x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l1_l6y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre1(l3 - l2), L1y = Legendre6x(l3 - l2); double L2 = Legendre1(l2 - l1), L2y = Legendre6x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l6_l1(double x, double y) { return Legendre6(lambda3(x,y) - lambda2(x,y)) * Legendre1(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l6_l1x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre6(l3 - l2), L1x = Legendre1x(l3 - l2); double L2 = Legendre6(l2 - l1), L2x = Legendre1x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l6_l1y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre6(l3 - l2), L1y = Legendre1x(l3 - l2); double L2 = Legendre6(l2 - l1), L2y = Legendre1x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l1_l7(double x, double y) { return Legendre1(lambda3(x,y) - lambda2(x,y)) * Legendre7(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l1_l7x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre1(l3 - l2), L1x = Legendre7x(l3 - l2); double L2 = Legendre1(l2 - l1), L2x = Legendre7x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l1_l7y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre1(l3 - l2), L1y = Legendre7x(l3 - l2); double L2 = Legendre1(l2 - l1), L2y = Legendre7x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l7_l1(double x, double y) { return Legendre7(lambda3(x,y) - lambda2(x,y)) * Legendre1(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l7_l1x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre7(l3 - l2), L1x = Legendre1x(l3 - l2); double L2 = Legendre7(l2 - l1), L2x = Legendre1x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l7_l1y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre7(l3 - l2), L1y = Legendre1x(l3 - l2); double L2 = Legendre7(l2 - l1), L2y = Legendre1x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l1_l8(double x, double y) { return Legendre1(lambda3(x,y) - lambda2(x,y)) * Legendre8(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l1_l8x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre1(l3 - l2), L1x = Legendre8x(l3 - l2); double L2 = Legendre1(l2 - l1), L2x = Legendre8x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l1_l8y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre1(l3 - l2), L1y = Legendre8x(l3 - l2); double L2 = Legendre1(l2 - l1), L2y = Legendre8x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l8_l1(double x, double y) { return Legendre8(lambda3(x,y) - lambda2(x,y)) * Legendre1(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l8_l1x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre8(l3 - l2), L1x = Legendre1x(l3 - l2); double L2 = Legendre8(l2 - l1), L2x = Legendre1x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l8_l1y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre8(l3 - l2), L1y = Legendre1x(l3 - l2); double L2 = Legendre8(l2 - l1), L2y = Legendre1x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l1_l9(double x, double y) { return Legendre1(lambda3(x,y) - lambda2(x,y)) * Legendre9(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l1_l9x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre1(l3 - l2), L1x = Legendre9x(l3 - l2); double L2 = Legendre1(l2 - l1), L2x = Legendre9x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l1_l9y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre1(l3 - l2), L1y = Legendre9x(l3 - l2); double L2 = Legendre1(l2 - l1), L2y = Legendre9x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l9_l1(double x, double y) { return Legendre9(lambda3(x,y) - lambda2(x,y)) * Legendre1(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l9_l1x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre9(l3 - l2), L1x = Legendre1x(l3 - l2); double L2 = Legendre9(l2 - l1), L2x = Legendre1x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l9_l1y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre9(l3 - l2), L1y = Legendre1x(l3 - l2); double L2 = Legendre9(l2 - l1), L2y = Legendre1x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l2_l2(double x, double y) { return Legendre2(lambda3(x,y) - lambda2(x,y)) * Legendre2(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l2_l2x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre2(l3 - l2), L1x = Legendre2x(l3 - l2); double L2 = Legendre2(l2 - l1), L2x = Legendre2x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l2_l2y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre2(l3 - l2), L1y = Legendre2x(l3 - l2); double L2 = Legendre2(l2 - l1), L2y = Legendre2x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l2_l3(double x, double y) { return Legendre2(lambda3(x,y) - lambda2(x,y)) * Legendre3(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l2_l3x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre2(l3 - l2), L1x = Legendre3x(l3 - l2); double L2 = Legendre2(l2 - l1), L2x = Legendre3x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l2_l3y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre2(l3 - l2), L1y = Legendre3x(l3 - l2); double L2 = Legendre2(l2 - l1), L2y = Legendre3x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l3_l2(double x, double y) { return Legendre3(lambda3(x,y) - lambda2(x,y)) * Legendre2(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l3_l2x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre3(l3 - l2), L1x = Legendre2x(l3 - l2); double L2 = Legendre3(l2 - l1), L2x = Legendre2x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l3_l2y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre3(l3 - l2), L1y = Legendre2x(l3 - l2); double L2 = Legendre3(l2 - l1), L2y = Legendre2x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l2_l4(double x, double y) { return Legendre2(lambda3(x,y) - lambda2(x,y)) * Legendre4(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l2_l4x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre2(l3 - l2), L1x = Legendre4x(l3 - l2); double L2 = Legendre2(l2 - l1), L2x = Legendre4x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l2_l4y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre2(l3 - l2), L1y = Legendre4x(l3 - l2); double L2 = Legendre2(l2 - l1), L2y = Legendre4x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l4_l2(double x, double y) { return Legendre4(lambda3(x,y) - lambda2(x,y)) * Legendre2(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l4_l2x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre4(l3 - l2), L1x = Legendre2x(l3 - l2); double L2 = Legendre4(l2 - l1), L2x = Legendre2x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l4_l2y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre4(l3 - l2), L1y = Legendre2x(l3 - l2); double L2 = Legendre4(l2 - l1), L2y = Legendre2x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l2_l5(double x, double y) { return Legendre2(lambda3(x,y) - lambda2(x,y)) * Legendre5(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l2_l5x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre2(l3 - l2), L1x = Legendre5x(l3 - l2); double L2 = Legendre2(l2 - l1), L2x = Legendre5x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l2_l5y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre2(l3 - l2), L1y = Legendre5x(l3 - l2); double L2 = Legendre2(l2 - l1), L2y = Legendre5x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l5_l2(double x, double y) { return Legendre5(lambda3(x,y) - lambda2(x,y)) * Legendre2(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l5_l2x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre5(l3 - l2), L1x = Legendre2x(l3 - l2); double L2 = Legendre5(l2 - l1), L2x = Legendre2x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l5_l2y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre5(l3 - l2), L1y = Legendre2x(l3 - l2); double L2 = Legendre5(l2 - l1), L2y = Legendre2x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l2_l6(double x, double y) { return Legendre2(lambda3(x,y) - lambda2(x,y)) * Legendre6(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l2_l6x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre2(l3 - l2), L1x = Legendre6x(l3 - l2); double L2 = Legendre2(l2 - l1), L2x = Legendre6x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l2_l6y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre2(l3 - l2), L1y = Legendre6x(l3 - l2); double L2 = Legendre2(l2 - l1), L2y = Legendre6x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l6_l2(double x, double y) { return Legendre6(lambda3(x,y) - lambda2(x,y)) * Legendre2(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l6_l2x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre6(l3 - l2), L1x = Legendre2x(l3 - l2); double L2 = Legendre6(l2 - l1), L2x = Legendre2x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l6_l2y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre6(l3 - l2), L1y = Legendre2x(l3 - l2); double L2 = Legendre6(l2 - l1), L2y = Legendre2x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l2_l7(double x, double y) { return Legendre2(lambda3(x,y) - lambda2(x,y)) * Legendre7(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l2_l7x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre2(l3 - l2), L1x = Legendre7x(l3 - l2); double L2 = Legendre2(l2 - l1), L2x = Legendre7x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l2_l7y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre2(l3 - l2), L1y = Legendre7x(l3 - l2); double L2 = Legendre2(l2 - l1), L2y = Legendre7x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l7_l2(double x, double y) { return Legendre7(lambda3(x,y) - lambda2(x,y)) * Legendre2(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l7_l2x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre7(l3 - l2), L1x = Legendre2x(l3 - l2); double L2 = Legendre7(l2 - l1), L2x = Legendre2x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l7_l2y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre7(l3 - l2), L1y = Legendre2x(l3 - l2); double L2 = Legendre7(l2 - l1), L2y = Legendre2x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l2_l8(double x, double y) { return Legendre2(lambda3(x,y) - lambda2(x,y)) * Legendre8(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l2_l8x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre2(l3 - l2), L1x = Legendre8x(l3 - l2); double L2 = Legendre2(l2 - l1), L2x = Legendre8x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l2_l8y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre2(l3 - l2), L1y = Legendre8x(l3 - l2); double L2 = Legendre2(l2 - l1), L2y = Legendre8x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l8_l2(double x, double y) { return Legendre8(lambda3(x,y) - lambda2(x,y)) * Legendre2(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l8_l2x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre8(l3 - l2), L1x = Legendre2x(l3 - l2); double L2 = Legendre8(l2 - l1), L2x = Legendre2x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l8_l2y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre8(l3 - l2), L1y = Legendre2x(l3 - l2); double L2 = Legendre8(l2 - l1), L2y = Legendre2x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l3_l3(double x, double y) { return Legendre3(lambda3(x,y) - lambda2(x,y)) * Legendre3(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l3_l3x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre3(l3 - l2), L1x = Legendre3x(l3 - l2); double L2 = Legendre3(l2 - l1), L2x = Legendre3x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l3_l3y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre3(l3 - l2), L1y = Legendre3x(l3 - l2); double L2 = Legendre3(l2 - l1), L2y = Legendre3x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l3_l4(double x, double y) { return Legendre3(lambda3(x,y) - lambda2(x,y)) * Legendre4(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l3_l4x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre3(l3 - l2), L1x = Legendre4x(l3 - l2); double L2 = Legendre3(l2 - l1), L2x = Legendre4x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l3_l4y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre3(l3 - l2), L1y = Legendre4x(l3 - l2); double L2 = Legendre3(l2 - l1), L2y = Legendre4x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l4_l3(double x, double y) { return Legendre4(lambda3(x,y) - lambda2(x,y)) * Legendre3(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l4_l3x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre4(l3 - l2), L1x = Legendre3x(l3 - l2); double L2 = Legendre4(l2 - l1), L2x = Legendre3x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l4_l3y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre4(l3 - l2), L1y = Legendre3x(l3 - l2); double L2 = Legendre4(l2 - l1), L2y = Legendre3x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l3_l5(double x, double y) { return Legendre3(lambda3(x,y) - lambda2(x,y)) * Legendre5(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l3_l5x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre3(l3 - l2), L1x = Legendre5x(l3 - l2); double L2 = Legendre3(l2 - l1), L2x = Legendre5x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l3_l5y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre3(l3 - l2), L1y = Legendre5x(l3 - l2); double L2 = Legendre3(l2 - l1), L2y = Legendre5x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l5_l3(double x, double y) { return Legendre5(lambda3(x,y) - lambda2(x,y)) * Legendre3(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l5_l3x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre5(l3 - l2), L1x = Legendre3x(l3 - l2); double L2 = Legendre5(l2 - l1), L2x = Legendre3x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l5_l3y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre5(l3 - l2), L1y = Legendre3x(l3 - l2); double L2 = Legendre5(l2 - l1), L2y = Legendre3x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l3_l6(double x, double y) { return Legendre3(lambda3(x,y) - lambda2(x,y)) * Legendre6(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l3_l6x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre3(l3 - l2), L1x = Legendre6x(l3 - l2); double L2 = Legendre3(l2 - l1), L2x = Legendre6x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l3_l6y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre3(l3 - l2), L1y = Legendre6x(l3 - l2); double L2 = Legendre3(l2 - l1), L2y = Legendre6x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l6_l3(double x, double y) { return Legendre6(lambda3(x,y) - lambda2(x,y)) * Legendre3(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l6_l3x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre6(l3 - l2), L1x = Legendre3x(l3 - l2); double L2 = Legendre6(l2 - l1), L2x = Legendre3x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l6_l3y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre6(l3 - l2), L1y = Legendre3x(l3 - l2); double L2 = Legendre6(l2 - l1), L2y = Legendre3x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l3_l7(double x, double y) { return Legendre3(lambda3(x,y) - lambda2(x,y)) * Legendre7(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l3_l7x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre3(l3 - l2), L1x = Legendre7x(l3 - l2); double L2 = Legendre3(l2 - l1), L2x = Legendre7x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l3_l7y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre3(l3 - l2), L1y = Legendre7x(l3 - l2); double L2 = Legendre3(l2 - l1), L2y = Legendre7x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l7_l3(double x, double y) { return Legendre7(lambda3(x,y) - lambda2(x,y)) * Legendre3(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l7_l3x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre7(l3 - l2), L1x = Legendre3x(l3 - l2); double L2 = Legendre7(l2 - l1), L2x = Legendre3x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l7_l3y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre7(l3 - l2), L1y = Legendre3x(l3 - l2); double L2 = Legendre7(l2 - l1), L2y = Legendre3x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l4_l4(double x, double y) { return Legendre4(lambda3(x,y) - lambda2(x,y)) * Legendre4(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l4_l4x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre4(l3 - l2), L1x = Legendre4x(l3 - l2); double L2 = Legendre4(l2 - l1), L2x = Legendre4x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l4_l4y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre4(l3 - l2), L1y = Legendre4x(l3 - l2); double L2 = Legendre4(l2 - l1), L2y = Legendre4x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l4_l5(double x, double y) { return Legendre4(lambda3(x,y) - lambda2(x,y)) * Legendre5(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l4_l5x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre4(l3 - l2), L1x = Legendre5x(l3 - l2); double L2 = Legendre4(l2 - l1), L2x = Legendre5x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l4_l5y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre4(l3 - l2), L1y = Legendre5x(l3 - l2); double L2 = Legendre4(l2 - l1), L2y = Legendre5x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l5_l4(double x, double y) { return Legendre5(lambda3(x,y) - lambda2(x,y)) * Legendre4(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l5_l4x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre5(l3 - l2), L1x = Legendre4x(l3 - l2); double L2 = Legendre5(l2 - l1), L2x = Legendre4x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l5_l4y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre5(l3 - l2), L1y = Legendre4x(l3 - l2); double L2 = Legendre5(l2 - l1), L2y = Legendre4x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l4_l6(double x, double y) { return Legendre4(lambda3(x,y) - lambda2(x,y)) * Legendre6(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l4_l6x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre4(l3 - l2), L1x = Legendre6x(l3 - l2); double L2 = Legendre4(l2 - l1), L2x = Legendre6x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l4_l6y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre4(l3 - l2), L1y = Legendre6x(l3 - l2); double L2 = Legendre4(l2 - l1), L2y = Legendre6x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l6_l4(double x, double y) { return Legendre6(lambda3(x,y) - lambda2(x,y)) * Legendre4(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l6_l4x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre6(l3 - l2), L1x = Legendre4x(l3 - l2); double L2 = Legendre6(l2 - l1), L2x = Legendre4x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l6_l4y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre6(l3 - l2), L1y = Legendre4x(l3 - l2); double L2 = Legendre6(l2 - l1), L2y = Legendre4x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static double leg_tri_l5_l5(double x, double y) { return Legendre5(lambda3(x,y) - lambda2(x,y)) * Legendre5(lambda2(x,y) - lambda1(x,y)); } static double leg_tri_l5_l5x(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre5(l3 - l2), L1x = Legendre5x(l3 - l2); double L2 = Legendre5(l2 - l1), L2x = Legendre5x(l2 - l1); return L1x * (lambda3x(x,y) - lambda2x(x,y)) * L2 + L1 * L2x * (lambda2x(x,y) - lambda1x(x,y)); } static double leg_tri_l5_l5y(double x, double y) { double l1 = lambda1(x,y), l2 = lambda2(x,y), l3 = lambda3(x,y); double L1 = Legendre5(l3 - l2), L1y = Legendre5x(l3 - l2); double L2 = Legendre5(l2 - l1), L2y = Legendre5x(l2 - l1); return L1y * (lambda3y(x,y) - lambda2y(x,y)) * L2 + L1 * L2y * (lambda2y(x,y) - lambda1y(x,y)); } static Shapeset::shape_fn_t leg_tri_fn[] = { leg_tri_l0_l0, leg_tri_l0_l1, leg_tri_l1_l0, leg_tri_l0_l2, leg_tri_l2_l0, leg_tri_l0_l3, leg_tri_l3_l0, leg_tri_l0_l4, leg_tri_l4_l0, leg_tri_l0_l5, leg_tri_l5_l0, leg_tri_l0_l6, leg_tri_l6_l0, leg_tri_l0_l7, leg_tri_l7_l0, leg_tri_l0_l8, leg_tri_l8_l0, leg_tri_l0_l9, leg_tri_l9_l0, leg_tri_l0_l10, leg_tri_l10_l0, leg_tri_l1_l1, leg_tri_l1_l2, leg_tri_l2_l1, leg_tri_l1_l3, leg_tri_l3_l1, leg_tri_l1_l4, leg_tri_l4_l1, leg_tri_l1_l5, leg_tri_l5_l1, leg_tri_l1_l6, leg_tri_l6_l1, leg_tri_l1_l7, leg_tri_l7_l1, leg_tri_l1_l8, leg_tri_l8_l1, leg_tri_l1_l9, leg_tri_l9_l1, leg_tri_l2_l2, leg_tri_l2_l3, leg_tri_l3_l2, leg_tri_l2_l4, leg_tri_l4_l2, leg_tri_l2_l5, leg_tri_l5_l2, leg_tri_l2_l6, leg_tri_l6_l2, leg_tri_l2_l7, leg_tri_l7_l2, leg_tri_l2_l8, leg_tri_l8_l2, leg_tri_l3_l3, leg_tri_l3_l4, leg_tri_l4_l3, leg_tri_l3_l5, leg_tri_l5_l3, leg_tri_l3_l6, leg_tri_l6_l3, leg_tri_l3_l7, leg_tri_l7_l3, leg_tri_l4_l4, leg_tri_l4_l5, leg_tri_l5_l4, leg_tri_l4_l6, leg_tri_l6_l4, leg_tri_l5_l5, }; static Shapeset::shape_fn_t leg_tri_fn_dx[] = { leg_tri_l0_l0x, leg_tri_l0_l1x, leg_tri_l1_l0x, leg_tri_l0_l2x, leg_tri_l2_l0x, leg_tri_l0_l3x, leg_tri_l3_l0x, leg_tri_l0_l4x, leg_tri_l4_l0x, leg_tri_l0_l5x, leg_tri_l5_l0x, leg_tri_l0_l6x, leg_tri_l6_l0x, leg_tri_l0_l7x, leg_tri_l7_l0x, leg_tri_l0_l8x, leg_tri_l8_l0x, leg_tri_l0_l9x, leg_tri_l9_l0x, leg_tri_l0_l10x, leg_tri_l10_l0x, leg_tri_l1_l1x, leg_tri_l1_l2x, leg_tri_l2_l1x, leg_tri_l1_l3x, leg_tri_l3_l1x, leg_tri_l1_l4x, leg_tri_l4_l1x, leg_tri_l1_l5x, leg_tri_l5_l1x, leg_tri_l1_l6x, leg_tri_l6_l1x, leg_tri_l1_l7x, leg_tri_l7_l1x, leg_tri_l1_l8x, leg_tri_l8_l1x, leg_tri_l1_l9x, leg_tri_l9_l1x, leg_tri_l2_l2x, leg_tri_l2_l3x, leg_tri_l3_l2x, leg_tri_l2_l4x, leg_tri_l4_l2x, leg_tri_l2_l5x, leg_tri_l5_l2x, leg_tri_l2_l6x, leg_tri_l6_l2x, leg_tri_l2_l7x, leg_tri_l7_l2x, leg_tri_l2_l8x, leg_tri_l8_l2x, leg_tri_l3_l3x, leg_tri_l3_l4x, leg_tri_l4_l3x, leg_tri_l3_l5x, leg_tri_l5_l3x, leg_tri_l3_l6x, leg_tri_l6_l3x, leg_tri_l3_l7x, leg_tri_l7_l3x, leg_tri_l4_l4x, leg_tri_l4_l5x, leg_tri_l5_l4x, leg_tri_l4_l6x, leg_tri_l6_l4x, leg_tri_l5_l5x, }; static Shapeset::shape_fn_t leg_tri_fn_dy[] = { leg_tri_l0_l0y, leg_tri_l0_l1y, leg_tri_l1_l0y, leg_tri_l0_l2y, leg_tri_l2_l0y, leg_tri_l0_l3y, leg_tri_l3_l0y, leg_tri_l0_l4y, leg_tri_l4_l0y, leg_tri_l0_l5y, leg_tri_l5_l0y, leg_tri_l0_l6y, leg_tri_l6_l0y, leg_tri_l0_l7y, leg_tri_l7_l0y, leg_tri_l0_l8y, leg_tri_l8_l0y, leg_tri_l0_l9y, leg_tri_l9_l0y, leg_tri_l0_l10y, leg_tri_l10_l0y, leg_tri_l1_l1y, leg_tri_l1_l2y, leg_tri_l2_l1y, leg_tri_l1_l3y, leg_tri_l3_l1y, leg_tri_l1_l4y, leg_tri_l4_l1y, leg_tri_l1_l5y, leg_tri_l5_l1y, leg_tri_l1_l6y, leg_tri_l6_l1y, leg_tri_l1_l7y, leg_tri_l7_l1y, leg_tri_l1_l8y, leg_tri_l8_l1y, leg_tri_l1_l9y, leg_tri_l9_l1y, leg_tri_l2_l2y, leg_tri_l2_l3y, leg_tri_l3_l2y, leg_tri_l2_l4y, leg_tri_l4_l2y, leg_tri_l2_l5y, leg_tri_l5_l2y, leg_tri_l2_l6y, leg_tri_l6_l2y, leg_tri_l2_l7y, leg_tri_l7_l2y, leg_tri_l2_l8y, leg_tri_l8_l2y, leg_tri_l3_l3y, leg_tri_l3_l4y, leg_tri_l4_l3y, leg_tri_l3_l5y, leg_tri_l5_l3y, leg_tri_l3_l6y, leg_tri_l6_l3y, leg_tri_l3_l7y, leg_tri_l7_l3y, leg_tri_l4_l4y, leg_tri_l4_l5y, leg_tri_l5_l4y, leg_tri_l4_l6y, leg_tri_l6_l4y, leg_tri_l5_l5y, }; Shapeset::shape_fn_t* leg_tri_shape_fn_table[1] = { leg_tri_fn }; Shapeset::shape_fn_t* leg_tri_shape_fn_table_dx[1] = { leg_tri_fn_dx }; Shapeset::shape_fn_t* leg_tri_shape_fn_table_dy[1] = { leg_tri_fn_dy }; static int qb_0[] = { 0, }; static int qb_1[] = { 0, 1, 2, }; static int qb_2[] = { 0, 1, 2, 3, 4, 21, }; static int qb_3[] = { 0, 1, 2, 3, 4, 5, 6, 21, 22, 23, }; static int qb_4[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 21, 22, 23, 24, 25, 38, }; static int qb_5[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 21, 22, 23, 24, 25, 26, 27, 38, 39, 40, }; static int qb_6[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 21, 22, 23, 24, 25, 26, 27, 28, 29, 38, 39, 40, 41, 42, 51, }; static int qb_7[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 38, 39, 40, 41, 42, 43, 44, 51, 52, 53, }; static int qb_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 46, 51, 52, 53, 54, 55, 60, }; static int qb_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 51, 52, 53, 54, 55, 56, 57, 60, 61, 62, }; static int qb_10[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, }; int* leg_tri_bubble_indices[11] = { qb_0, qb_1, qb_2, qb_3, qb_4, qb_5, qb_6, qb_7, qb_8, qb_9, qb_10 }; int leg_tri_bubble_count[11] = { 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66 }; int leg_tri_vertex_indices[4] = { -1, -1, -1, -1 }; static int leg_tri_edge_indices_0[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; static int leg_tri_edge_indices_1[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; static int leg_tri_edge_indices_2[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; static int leg_tri_edge_indices_3[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; int* leg_tri_edge_indices[4] = { leg_tri_edge_indices_0, leg_tri_edge_indices_1, leg_tri_edge_indices_2, leg_tri_edge_indices_3 }; int leg_tri_index_to_order[] = { 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 6, 7, 7, 8, 8, 9, 9, 10, 10, 8, 9, 9, 10, 10, 10, }; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// static Shapeset::shape_fn_t** leg_shape_fn_table[2] = { leg_tri_shape_fn_table, leg_quad_shape_fn_table }; static Shapeset::shape_fn_t** leg_shape_fn_table_dx[2] = { leg_tri_shape_fn_table_dx, leg_quad_shape_fn_table_dx }; static Shapeset::shape_fn_t** leg_shape_fn_table_dy[2] = { leg_tri_shape_fn_table_dy, leg_quad_shape_fn_table_dy }; static Shapeset::shape_fn_t** leg_shape_fn_table_dxx[2] = { NULL, leg_quad_shape_fn_table_dxx }; static Shapeset::shape_fn_t** leg_shape_fn_table_dyy[2] = { NULL, leg_quad_shape_fn_table_dyy }; static Shapeset::shape_fn_t** leg_shape_fn_table_dxy[2] = { NULL, leg_quad_shape_fn_table_dxy }; static int* leg_vertex_indices[2] = { leg_tri_vertex_indices, leg_quad_vertex_indices }; static int** leg_edge_indices[2] = { leg_tri_edge_indices, leg_quad_edge_indices }; static int** leg_bubble_indices[2] = { leg_tri_bubble_indices, leg_quad_bubble_indices }; static int* leg_bubble_count[2] = { leg_tri_bubble_count, leg_quad_bubble_count }; static int* leg_index_to_order[2] = { leg_tri_index_to_order, leg_quad_index_to_order }; L2ShapesetLegendre::L2ShapesetLegendre() { shape_table[0] = leg_shape_fn_table; shape_table[1] = leg_shape_fn_table_dx; shape_table[2] = leg_shape_fn_table_dy; shape_table[3] = leg_shape_fn_table_dxx; shape_table[4] = leg_shape_fn_table_dyy; shape_table[5] = leg_shape_fn_table_dxy; vertex_indices = leg_vertex_indices; edge_indices = leg_edge_indices; bubble_indices = leg_bubble_indices; bubble_count = leg_bubble_count; index_to_order = leg_index_to_order; ref_vert[0][0][0] = -1.0; ref_vert[0][0][1] = -1.0; ref_vert[0][1][0] = 1.0; ref_vert[0][1][1] = -1.0; ref_vert[0][2][0] = -1.0; ref_vert[0][2][1] = 1.0; ref_vert[1][0][0] = -1.0; ref_vert[1][0][1] = -1.0; ref_vert[1][1][0] = 1.0; ref_vert[1][1][1] = -1.0; ref_vert[1][2][0] = 1.0; ref_vert[1][2][1] = 1.0; ref_vert[1][3][0] = -1.0; ref_vert[1][3][1] = 1.0; max_order = 10; num_components = 1; max_index[0] = 66; max_index[1] = 121; ebias = 2; comb_table = NULL; set_mode(H2D_MODE_TRIANGLE); }
certik/hermes2d
src/shapeset_l2_legendre.cpp
C++
gpl-2.0
168,913
<?php get_header(); ?> <div id="content"> <div id="inner-content" class="wrap clearfix"> <div id="main" class="eightcol first clearfix" role="main"> <h1 class="archive-title"><span>Search Results for:</span> <?php echo esc_attr(get_search_query()); ?></h1> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article"> <header class="article-header"> <h3 class="search-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3> <p class="meta"><?php _e("Posted", "bonestheme"); ?> <time datetime="<?php echo the_time('Y-m-j'); ?>" pubdate><?php the_time('F jS, Y'); ?></time> <?php _e("by", "bonestheme"); ?> <?php the_author_posts_link(); ?> <span class="amp">&</span> <?php _e("filed under", "bonestheme"); ?> <?php the_category(', '); ?>.</p> </header> <!-- end article header --> <section class="post-content"> <?php the_excerpt('<span class="read-more">Read more &raquo;</span>'); ?> </section> <!-- end article section --> <footer class="article-footer"> </footer> <!-- end article footer --> </article> <!-- end article --> <?php endwhile; ?> <?php if (function_exists('bones_page_navi')) { // if expirimental feature is active ?> <?php bones_page_navi(); // use the page navi function ?> <?php } else { // if it is disabled, display regular wp prev & next links ?> <nav class="wp-prev-next"> <ul class="clearfix"> <li class="prev-link"><?php next_posts_link(_e('&laquo; Older Entries', "bonestheme")) ?></li> <li class="next-link"><?php previous_posts_link(_e('Newer Entries &raquo;', "bonestheme")) ?></li> </ul> </nav> <?php } ?> <?php else : ?> <article id="post-not-found" class="hentry clearfix"> <header class="article-header"> <h1><?php _e("Sorry, No Results.", "bonestheme"); ?></h1> </header> <section class="post-content"> <p><?php _e("Try your search again.", "bonestheme"); ?></p> </section> <footer class="article-footer"> <p><?php _e("This is the error message in the search.php template.", "bonestheme"); ?></p> </footer> </article> <?php endif; ?> </div> <!-- end #main --> <?php get_sidebar(); // sidebar 1 ?> </div> <!-- end #inner-content --> </div> <!-- end #content --> <?php get_footer(); ?>
cameronscott137/rustbuilt
wp-content/themes/rustbuilt/search.php
PHP
gpl-2.0
2,904
<?php /** * @package EasySocial * @copyright Copyright (C) 2010 - 2014 Stack Ideas Sdn Bhd. All rights reserved. * @license GNU/GPL, see LICENSE.php * EasySocial is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ defined( '_JEXEC' ) or die( 'Unauthorized Access' ); ?> <!-- Field title --> <label class="col-sm-3 control-label" for="es-fields-<?php echo $field->id;?>"> <?php if( ( isset( $options['required'] ) && $options['required'] ) || ( !isset( $options['required'] ) && $field->isRequired() ) ){ ?> <span><?php echo JText::_( 'COM_EASYSOCIAL_REGISTRATION_REQUIRED_SYMBOL' );?></span> <?php } ?> <?php echo JText::_( $params->get( 'title' ) ); ?>: </label>
cuongnd/banhangonline88_joomla
components/com_easysocial/themes/wireframe/fields/title.php
PHP
gpl-2.0
932
<?php $settings = ""; $tabs = array(); $selected_context = get_input("widget_context", "profile"); foreach(array("profile", "dashboard", "groups") as $key => $context){ $selected = false; if($selected_context === $context){ $selected = true; } $tabs_options= array( "title" => elgg_echo($context), "selected" => $selected, "url" => "admin/widgets/manage?widget_context=" . $context ); $tabs[] = $tabs_options; } $body = elgg_view("navigation/tabs", array("tabs" => $tabs)); $body .= elgg_view("widget_manager/forms/settings", array("widget_context" => $selected_context)); echo $body;
amcfarlane1251/portal
mod/widget_manager_4.3/views/default/admin/widgets/manage.php
PHP
gpl-2.0
610
<style type="text/css"> <?php if ($css_profile_card_bg) { print ".um-$form_id .um-member { background: $css_profile_card_bg; }"; } if ( isset( $css_card_thickness ) ) { print ".um-$form_id .um-member { border-width: $css_card_thickness; }"; } if ($css_profile_card_text) { print ".um-$form_id .um-member-card * { color: $css_profile_card_text; }"; } if ($css_card_bordercolor) { print ".um-$form_id .um-member { border-color: $css_card_bordercolor; }"; } if ($css_img_bordercolor) { print ".um-$form_id .um-member-photo img { border-color: $css_img_bordercolor; }"; } ?> </style>
frammawiliansyah/web
wp-content/plugins/ultimate-member/assets/dynamic_css/dynamic_directory.php
PHP
gpl-2.0
600
/* * Copyright Andrey Semashev 2007 - 2015. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) */ /*! * \file windows_version.hpp * \author Andrey Semashev * \date 07.03.2009 * * \brief This header is the Boost.Log library implementation, see the library documentation * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html. */ #ifndef BOOST_LOG_WINDOWS_VERSION_HPP_INCLUDED_ #define BOOST_LOG_WINDOWS_VERSION_HPP_INCLUDED_ #include <boost/log/detail/config.hpp> #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) #if defined(BOOST_LOG_USE_WINNT6_API) #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0600 // _WIN32_WINNT_LONGHORN #endif #elif !defined(_WIN32_WINNT) // Use the default WinAPI version #include <boost/detail/winapi/config.hpp> #if !defined(_WIN32_WINNT) #define _WIN32_WINNT BOOST_USE_WINAPI_VERSION #endif #endif // BOOST_LOG_USE_WINNT6_API // This is to make Boost.ASIO happy #ifndef __USE_W32_SOCKETS #define __USE_W32_SOCKETS #endif #ifndef NOMINMAX #define NOMINMAX #endif #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) #endif // BOOST_LOG_WINDOWS_VERSION_HPP_INCLUDED_
Bloodyaugust/missilewarcpp
lib/boost/libs/log/src/windows_version.hpp
C++
gpl-2.0
1,391
namespace APITest { partial class Form1 { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.groupBox1 = new System.Windows.Forms.GroupBox(); this.btnAbort = new System.Windows.Forms.Button(); this.btnLogout = new System.Windows.Forms.Button(); this.btnLogin = new System.Windows.Forms.Button(); this.txtPassword = new System.Windows.Forms.TextBox(); this.txtUsername = new System.Windows.Forms.TextBox(); this.txtURL = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.btnProtect = new System.Windows.Forms.Button(); this.btnMove = new System.Windows.Forms.Button(); this.btnDelete = new System.Windows.Forms.Button(); this.chkWatch = new System.Windows.Forms.CheckBox(); this.chkMinor = new System.Windows.Forms.CheckBox(); this.label5 = new System.Windows.Forms.Label(); this.txtSummary = new System.Windows.Forms.TextBox(); this.txtEdit = new System.Windows.Forms.TextBox(); this.txtTitle = new System.Windows.Forms.TextBox(); this.btnOpen = new System.Windows.Forms.Button(); this.btnSave = new System.Windows.Forms.Button(); this.label4 = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // // groupBox1 // this.groupBox1.Controls.Add(this.btnAbort); this.groupBox1.Controls.Add(this.btnLogout); this.groupBox1.Controls.Add(this.btnLogin); this.groupBox1.Controls.Add(this.txtPassword); this.groupBox1.Controls.Add(this.txtUsername); this.groupBox1.Controls.Add(this.txtURL); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Location = new System.Drawing.Point(12, 12); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(654, 100); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; this.groupBox1.Text = "Login"; // // btnAbort // this.btnAbort.Location = new System.Drawing.Point(521, 69); this.btnAbort.Name = "btnAbort"; this.btnAbort.Size = new System.Drawing.Size(127, 23); this.btnAbort.TabIndex = 2; this.btnAbort.Text = "Abort"; this.btnAbort.UseVisualStyleBackColor = true; this.btnAbort.Click += new System.EventHandler(this.btnAbort_Click); // // btnLogout // this.btnLogout.Location = new System.Drawing.Point(521, 43); this.btnLogout.Name = "btnLogout"; this.btnLogout.Size = new System.Drawing.Size(127, 23); this.btnLogout.TabIndex = 7; this.btnLogout.Text = "Logout"; this.btnLogout.UseVisualStyleBackColor = true; this.btnLogout.Click += new System.EventHandler(this.btnLogout_Click); // // btnLogin // this.btnLogin.Location = new System.Drawing.Point(521, 17); this.btnLogin.Name = "btnLogin"; this.btnLogin.Size = new System.Drawing.Size(127, 23); this.btnLogin.TabIndex = 6; this.btnLogin.Text = "Login"; this.btnLogin.UseVisualStyleBackColor = true; this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click); // // txtPassword // this.txtPassword.Location = new System.Drawing.Point(93, 71); this.txtPassword.Name = "txtPassword"; this.txtPassword.PasswordChar = '*'; this.txtPassword.Size = new System.Drawing.Size(342, 20); this.txtPassword.TabIndex = 5; // // txtUsername // this.txtUsername.Location = new System.Drawing.Point(93, 45); this.txtUsername.Name = "txtUsername"; this.txtUsername.Size = new System.Drawing.Size(342, 20); this.txtUsername.TabIndex = 4; // // txtURL // this.txtURL.Location = new System.Drawing.Point(93, 19); this.txtURL.Name = "txtURL"; this.txtURL.Size = new System.Drawing.Size(342, 20); this.txtURL.TabIndex = 3; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(6, 74); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(53, 13); this.label3.TabIndex = 2; this.label3.Text = "Password"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(6, 48); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(55, 13); this.label2.TabIndex = 1; this.label2.Text = "Username"; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(6, 22); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(50, 13); this.label1.TabIndex = 0; this.label1.Text = "Site URL"; // // groupBox2 // this.groupBox2.Controls.Add(this.btnProtect); this.groupBox2.Controls.Add(this.btnMove); this.groupBox2.Controls.Add(this.btnDelete); this.groupBox2.Controls.Add(this.chkWatch); this.groupBox2.Controls.Add(this.chkMinor); this.groupBox2.Controls.Add(this.label5); this.groupBox2.Controls.Add(this.txtSummary); this.groupBox2.Controls.Add(this.txtEdit); this.groupBox2.Controls.Add(this.txtTitle); this.groupBox2.Controls.Add(this.btnOpen); this.groupBox2.Controls.Add(this.btnSave); this.groupBox2.Controls.Add(this.label4); this.groupBox2.Enabled = false; this.groupBox2.Location = new System.Drawing.Point(12, 118); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(654, 327); this.groupBox2.TabIndex = 1; this.groupBox2.TabStop = false; this.groupBox2.Text = "Edit"; // // btnProtect // this.btnProtect.Location = new System.Drawing.Point(168, 298); this.btnProtect.Name = "btnProtect"; this.btnProtect.Size = new System.Drawing.Size(75, 23); this.btnProtect.TabIndex = 11; this.btnProtect.Text = "Protect"; this.btnProtect.UseVisualStyleBackColor = true; this.btnProtect.Click += new System.EventHandler(this.btnProtect_Click); // // btnMove // this.btnMove.Location = new System.Drawing.Point(87, 298); this.btnMove.Name = "btnMove"; this.btnMove.Size = new System.Drawing.Size(75, 23); this.btnMove.TabIndex = 10; this.btnMove.Text = "Move"; this.btnMove.UseVisualStyleBackColor = true; this.btnMove.Click += new System.EventHandler(this.btnMove_Click); // // btnDelete // this.btnDelete.Location = new System.Drawing.Point(6, 298); this.btnDelete.Name = "btnDelete"; this.btnDelete.Size = new System.Drawing.Size(75, 23); this.btnDelete.TabIndex = 9; this.btnDelete.Text = "Delete"; this.btnDelete.UseVisualStyleBackColor = true; this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click); // // chkWatch // this.chkWatch.AutoSize = true; this.chkWatch.Location = new System.Drawing.Point(492, 49); this.chkWatch.Name = "chkWatch"; this.chkWatch.Size = new System.Drawing.Size(104, 17); this.chkWatch.TabIndex = 8; this.chkWatch.Text = "Watch this page"; this.chkWatch.UseVisualStyleBackColor = true; // // chkMinor // this.chkMinor.AutoSize = true; this.chkMinor.Location = new System.Drawing.Point(414, 50); this.chkMinor.Name = "chkMinor"; this.chkMinor.Size = new System.Drawing.Size(72, 17); this.chkMinor.TabIndex = 7; this.chkMinor.Text = "Minor edit"; this.chkMinor.UseVisualStyleBackColor = true; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(6, 50); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(50, 13); this.label5.TabIndex = 6; this.label5.Text = "Summary"; // // txtSummary // this.txtSummary.Location = new System.Drawing.Point(82, 47); this.txtSummary.Name = "txtSummary"; this.txtSummary.Size = new System.Drawing.Size(306, 20); this.txtSummary.TabIndex = 5; this.txtSummary.Text = "API test"; // // txtEdit // this.txtEdit.Location = new System.Drawing.Point(6, 74); this.txtEdit.Multiline = true; this.txtEdit.Name = "txtEdit"; this.txtEdit.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.txtEdit.Size = new System.Drawing.Size(642, 218); this.txtEdit.TabIndex = 4; // // txtTitle // this.txtTitle.Location = new System.Drawing.Point(82, 21); this.txtTitle.Name = "txtTitle"; this.txtTitle.Size = new System.Drawing.Size(404, 20); this.txtTitle.TabIndex = 3; this.txtTitle.Text = "Sandbox"; // // btnOpen // this.btnOpen.Location = new System.Drawing.Point(492, 19); this.btnOpen.Name = "btnOpen"; this.btnOpen.Size = new System.Drawing.Size(75, 23); this.btnOpen.TabIndex = 2; this.btnOpen.Text = "Open"; this.btnOpen.UseVisualStyleBackColor = true; this.btnOpen.Click += new System.EventHandler(this.btnOpen_Click); // // btnSave // this.btnSave.Enabled = false; this.btnSave.Location = new System.Drawing.Point(573, 19); this.btnSave.Name = "btnSave"; this.btnSave.Size = new System.Drawing.Size(75, 23); this.btnSave.TabIndex = 1; this.btnSave.Text = "Save"; this.btnSave.UseVisualStyleBackColor = true; this.btnSave.Click += new System.EventHandler(this.btnSave_Click); // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(6, 24); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(51, 13); this.label4.TabIndex = 0; this.label4.Text = "Page title"; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(678, 458); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Name = "Form1"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.ResumeLayout(false); } #endregion private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.TextBox txtPassword; private System.Windows.Forms.TextBox txtUsername; private System.Windows.Forms.TextBox txtURL; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.Button btnLogin; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.TextBox txtEdit; private System.Windows.Forms.TextBox txtTitle; private System.Windows.Forms.Button btnOpen; private System.Windows.Forms.Button btnSave; private System.Windows.Forms.Label label4; private System.Windows.Forms.CheckBox chkWatch; private System.Windows.Forms.CheckBox chkMinor; private System.Windows.Forms.Label label5; private System.Windows.Forms.TextBox txtSummary; private System.Windows.Forms.Button btnLogout; private System.Windows.Forms.Button btnDelete; private System.Windows.Forms.Button btnProtect; private System.Windows.Forms.Button btnMove; private System.Windows.Forms.Button btnAbort; } }
svn2github/autowikibrowser
tags/ServerPlugin/APIEdit/APITest/Form1.Designer.cs
C#
gpl-2.0
15,213
<?php /** * @package SP Page Builder * @author JoomShaper http://www.joomshaper.com * @copyright Copyright (c) 2010 - 2015 JoomShaper * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later */ //no direct accees defined ('_JEXEC') or die ('restricted aceess'); $required_min_php_version = '5.4.0'; if (version_compare(PHP_VERSION,$required_min_php_version, '<')) { (include_once JPATH_SITE . '/administrator/components/com_sppagebuilder/views/phpversion.tmpl.php') or die('Your PHP version is too old for this component.'); return; } require_once JPATH_COMPONENT.'/helpers/route.php'; jimport('joomla.application.component.controller'); $controller = JControllerLegacy::getInstance('Sppagebuilder'); $controller->execute(JFactory::getApplication()->input->get('task')); $controller->redirect();
cchin013/uecsite2017
components/com_sppagebuilder/sppagebuilder.php
PHP
gpl-2.0
823
<?php /* * @package Joomla * @copyright Copyright (C) Open Source Matters. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * @component Phoca Gallery * @copyright Copyright (C) Jan Pavelka www.phoca.cz * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL */ defined('_JEXEC') or die; $task = 'phocagallerycoimg'; JHtml::_('behavior.tooltip'); JHtml::_('behavior.formvalidation'); JHtml::_('behavior.keepalive'); JHtml::_('formbehavior.chosen', 'select'); $r = new PhocaGalleryRenderAdminView(); $app = JFactory::getApplication(); $option = $app->input->get('option'); $OPT = strtoupper($option); ?> <script type="text/javascript"> Joomla.submitbutton = function(task) { if (task == '<?php echo $task ?>.cancel' || document.formvalidator.isValid(document.id('adminForm'))) { <?php echo $this->form->getField('comment')->save(); ?> Joomla.submitform(task, document.getElementById('adminForm')); } else { alert('<?php echo JText::_('JGLOBAL_VALIDATION_FORM_FAILED', true);?>'); } } </script><?php echo $r->startForm($option, $task, $this->item->id, 'adminForm', 'adminForm'); // First Column echo '<div class="span10 form-horizontal">'; $tabs = array ( 'general' => JText::_($OPT.'_GENERAL_OPTIONS'), 'publishing' => JText::_($OPT.'_PUBLISHING_OPTIONS')); echo $r->navigation($tabs); echo '<div class="tab-content">'. "\n"; echo '<div class="tab-pane active" id="general">'."\n"; $formArray = array ('title', 'usertitle', 'cattitle', 'imagetitle', 'ordering'); echo $r->group($this->form, $formArray); $formArray = array('comment'); echo $r->group($this->form, $formArray, 1); echo '</div>'. "\n"; echo '<div class="tab-pane" id="publishing">'."\n"; foreach($this->form->getFieldset('publish') as $field) { echo '<div class="control-group">'; if (!$field->hidden) { echo '<div class="control-label">'.$field->label.'</div>'; } echo '<div class="controls">'; echo $field->input; echo '</div></div>'; } echo '</div>'; // Second Column echo '<div class="span2"></div>';//end span2 echo $r->formInputs(); echo $r->endForm(); ?>
xbegault/clrh-idf
tmp/install_56542e012168b/views/phocagallerycoimg/tmpl/edit.php
PHP
gpl-2.0
2,124
<?php namespace OpenCloud\Common\Exceptions; class NetworkError extends \Exception {}
sbaldwin24/Helps
wp-content/plugins/updraftplus/oc/rs/lib/OpenCloud/Common/Exceptions/NetworkError.php
PHP
gpl-2.0
93
# Partname: ATmega644A # generated automatically, do not edit MCUREGS = { 'ADCSRB': '&123', 'ADCSRB_ACME': '$40', 'ACSR': '&80', 'ACSR_ACD': '$80', 'ACSR_ACBG': '$40', 'ACSR_ACO': '$20', 'ACSR_ACI': '$10', 'ACSR_ACIE': '$08', 'ACSR_ACIC': '$04', 'ACSR_ACIS': '$03', 'DIDR1': '&127', 'DIDR1_AIN1D': '$02', 'DIDR1_AIN0D': '$01', 'UDR0': '&198', 'UCSR0A': '&192', 'UCSR0A_RXC0': '$80', 'UCSR0A_TXC0': '$40', 'UCSR0A_UDRE0': '$20', 'UCSR0A_FE0': '$10', 'UCSR0A_DOR0': '$08', 'UCSR0A_UPE0': '$04', 'UCSR0A_U2X0': '$02', 'UCSR0A_MPCM0': '$01', 'UCSR0B': '&193', 'UCSR0B_RXCIE0': '$80', 'UCSR0B_TXCIE0': '$40', 'UCSR0B_UDRIE0': '$20', 'UCSR0B_RXEN0': '$10', 'UCSR0B_TXEN0': '$08', 'UCSR0B_UCSZ02': '$04', 'UCSR0B_RXB80': '$02', 'UCSR0B_TXB80': '$01', 'UCSR0C': '&194', 'UCSR0C_UMSEL0': '$C0', 'UCSR0C_UPM0': '$30', 'UCSR0C_USBS0': '$08', 'UCSR0C_UCSZ0': '$06', 'UCSR0C_UCPOL0': '$01', 'UBRR0': '&196', 'PORTA': '&34', 'DDRA': '&33', 'PINA': '&32', 'PORTB': '&37', 'DDRB': '&36', 'PINB': '&35', 'PORTC': '&40', 'DDRC': '&39', 'PINC': '&38', 'PORTD': '&43', 'DDRD': '&42', 'PIND': '&41', 'OCR0B': '&72', 'OCR0A': '&71', 'TCNT0': '&70', 'TCCR0B': '&69', 'TCCR0B_FOC0A': '$80', 'TCCR0B_FOC0B': '$40', 'TCCR0B_WGM02': '$08', 'TCCR0B_CS0': '$07', 'TCCR0A': '&68', 'TCCR0A_COM0A': '$C0', 'TCCR0A_COM0B': '$30', 'TCCR0A_WGM0': '$03', 'TIMSK0': '&110', 'TIMSK0_OCIE0B': '$04', 'TIMSK0_OCIE0A': '$02', 'TIMSK0_TOIE0': '$01', 'TIFR0': '&53', 'TIFR0_OCF0B': '$04', 'TIFR0_OCF0A': '$02', 'TIFR0_TOV0': '$01', 'GTCCR': '&67', 'GTCCR_TSM': '$80', 'GTCCR_PSRSYNC': '$01', 'TIMSK2': '&112', 'TIMSK2_OCIE2B': '$04', 'TIMSK2_OCIE2A': '$02', 'TIMSK2_TOIE2': '$01', 'TIFR2': '&55', 'TIFR2_OCF2B': '$04', 'TIFR2_OCF2A': '$02', 'TIFR2_TOV2': '$01', 'TCCR2A': '&176', 'TCCR2A_COM2A': '$C0', 'TCCR2A_COM2B': '$30', 'TCCR2A_WGM2': '$03', 'TCCR2B': '&177', 'TCCR2B_FOC2A': '$80', 'TCCR2B_FOC2B': '$40', 'TCCR2B_WGM22': '$08', 'TCCR2B_CS2': '$07', 'TCNT2': '&178', 'OCR2B': '&180', 'OCR2A': '&179', 'ASSR': '&182', 'ASSR_EXCLK': '$40', 'ASSR_AS2': '$20', 'ASSR_TCN2UB': '$10', 'ASSR_OCR2AUB': '$08', 'ASSR_OCR2BUB': '$04', 'ASSR_TCR2AUB': '$02', 'ASSR_TCR2BUB': '$01', 'WDTCSR': '&96', 'WDTCSR_WDIF': '$80', 'WDTCSR_WDIE': '$40', 'WDTCSR_WDP': '$27', 'WDTCSR_WDCE': '$10', 'WDTCSR_WDE': '$08', 'OCDR': '&81', 'MCUCR': '&85', 'MCUCR_JTD': '$80', 'MCUSR': '&84', 'MCUSR_JTRF': '$10', 'SPMCSR': '&87', 'SPMCSR_SPMIE': '$80', 'SPMCSR_RWWSB': '$40', 'SPMCSR_SIGRD': '$20', 'SPMCSR_RWWSRE': '$10', 'SPMCSR_BLBSET': '$08', 'SPMCSR_PGWRT': '$04', 'SPMCSR_PGERS': '$02', 'SPMCSR_SPMEN': '$01', 'EICRA': '&105', 'EICRA_ISC2': '$30', 'EICRA_ISC1': '$0C', 'EICRA_ISC0': '$03', 'EIMSK': '&61', 'EIMSK_INT': '$07', 'EIFR': '&60', 'EIFR_INTF': '$07', 'PCMSK3': '&115', 'PCMSK3_PCINT': '$FF', 'PCMSK2': '&109', 'PCMSK2_PCINT': '$FF', 'PCMSK1': '&108', 'PCMSK1_PCINT': '$FF', 'PCMSK0': '&107', 'PCMSK0_PCINT': '$FF', 'PCIFR': '&59', 'PCIFR_PCIF': '$0F', 'PCICR': '&104', 'PCICR_PCIE': '$0F', 'ADMUX': '&124', 'ADMUX_REFS': '$C0', 'ADMUX_ADLAR': '$20', 'ADMUX_MUX': '$1F', 'ADC': '&120', 'ADCSRA': '&122', 'ADCSRA_ADEN': '$80', 'ADCSRA_ADSC': '$40', 'ADCSRA_ADATE': '$20', 'ADCSRA_ADIF': '$10', 'ADCSRA_ADIE': '$08', 'ADCSRA_ADPS': '$07', 'DIDR0': '&126', 'DIDR0_ADC7D': '$80', 'DIDR0_ADC6D': '$40', 'DIDR0_ADC5D': '$20', 'DIDR0_ADC4D': '$10', 'DIDR0_ADC3D': '$08', 'DIDR0_ADC2D': '$04', 'DIDR0_ADC1D': '$02', 'DIDR0_ADC0D': '$01', 'TIMSK1': '&111', 'TIMSK1_ICIE1': '$20', 'TIMSK1_OCIE1B': '$04', 'TIMSK1_OCIE1A': '$02', 'TIMSK1_TOIE1': '$01', 'TIFR1': '&54', 'TIFR1_ICF1': '$20', 'TIFR1_OCF1B': '$04', 'TIFR1_OCF1A': '$02', 'TIFR1_TOV1': '$01', 'TCCR1A': '&128', 'TCCR1A_COM1A': '$C0', 'TCCR1A_COM1B': '$30', 'TCCR1A_WGM1': '$03', 'TCCR1B': '&129', 'TCCR1B_ICNC1': '$80', 'TCCR1B_ICES1': '$40', 'TCCR1B_WGM1': '$18', 'TCCR1B_CS1': '$07', 'TCCR1C': '&130', 'TCCR1C_FOC1A': '$80', 'TCCR1C_FOC1B': '$40', 'TCNT1': '&132', 'OCR1A': '&136', 'OCR1B': '&138', 'ICR1': '&134', 'EEAR': '&65', 'EEDR': '&64', 'EECR': '&63', 'EECR_EEPM': '$30', 'EECR_EERIE': '$08', 'EECR_EEMPE': '$04', 'EECR_EEPE': '$02', 'EECR_EERE': '$01', 'TWAMR': '&189', 'TWAMR_TWAM': '$FE', 'TWBR': '&184', 'TWCR': '&188', 'TWCR_TWINT': '$80', 'TWCR_TWEA': '$40', 'TWCR_TWSTA': '$20', 'TWCR_TWSTO': '$10', 'TWCR_TWWC': '$08', 'TWCR_TWEN': '$04', 'TWCR_TWIE': '$01', 'TWSR': '&185', 'TWSR_TWS': '$F8', 'TWSR_TWPS': '$03', 'TWDR': '&187', 'TWAR': '&186', 'TWAR_TWA': '$FE', 'TWAR_TWGCE': '$01', 'UDR1': '&206', 'UCSR1A': '&200', 'UCSR1A_RXC1': '$80', 'UCSR1A_TXC1': '$40', 'UCSR1A_UDRE1': '$20', 'UCSR1A_FE1': '$10', 'UCSR1A_DOR1': '$08', 'UCSR1A_UPE1': '$04', 'UCSR1A_U2X1': '$02', 'UCSR1A_MPCM1': '$01', 'UCSR1B': '&201', 'UCSR1B_RXCIE1': '$80', 'UCSR1B_TXCIE1': '$40', 'UCSR1B_UDRIE1': '$20', 'UCSR1B_RXEN1': '$10', 'UCSR1B_TXEN1': '$08', 'UCSR1B_UCSZ12': '$04', 'UCSR1B_RXB81': '$02', 'UCSR1B_TXB81': '$01', 'UCSR1C': '&202', 'UCSR1C_UMSEL1': '$C0', 'UCSR1C_UPM1': '$30', 'UCSR1C_USBS1': '$08', 'UCSR1C_UCSZ1': '$06', 'UCSR1C_UCPOL1': '$01', 'UBRR1': '&204', 'SPDR': '&78', 'SPSR': '&77', 'SPSR_SPIF': '$80', 'SPSR_WCOL': '$40', 'SPSR_SPI2X': '$01', 'SPCR': '&76', 'SPCR_SPIE': '$80', 'SPCR_SPE': '$40', 'SPCR_DORD': '$20', 'SPCR_MSTR': '$10', 'SPCR_CPOL': '$08', 'SPCR_CPHA': '$04', 'SPCR_SPR': '$03', 'SREG': '&95', 'SREG_I': '$80', 'SREG_T': '$40', 'SREG_H': '$20', 'SREG_S': '$10', 'SREG_V': '$08', 'SREG_N': '$04', 'SREG_Z': '$02', 'SREG_C': '$01', 'SP': '&93', 'OSCCAL': '&102', 'CLKPR': '&97', 'CLKPR_CLKPCE': '$80', 'CLKPR_CLKPS': '$0F', 'SMCR': '&83', 'SMCR_SM': '$0E', 'SMCR_SE': '$01', 'GPIOR2': '&75', 'GPIOR2_GPIOR': '$FF', 'GPIOR1': '&74', 'GPIOR1_GPIOR': '$FF', 'GPIOR0': '&62', 'GPIOR0_GPIOR07': '$80', 'GPIOR0_GPIOR06': '$40', 'GPIOR0_GPIOR05': '$20', 'GPIOR0_GPIOR04': '$10', 'GPIOR0_GPIOR03': '$08', 'GPIOR0_GPIOR02': '$04', 'GPIOR0_GPIOR01': '$02', 'GPIOR0_GPIOR00': '$01', 'PRR0': '&100', 'PRR0_PRTWI': '$80', 'PRR0_PRTIM2': '$40', 'PRR0_PRTIM0': '$20', 'PRR0_PRUSART': '$12', 'PRR0_PRTIM1': '$08', 'PRR0_PRSPI': '$04', 'PRR0_PRADC': '$01', 'INT0Addr': '2', 'INT1Addr': '4', 'INT2Addr': '6', 'PCINT0Addr': '8', 'PCINT1Addr': '10', 'PCINT2Addr': '12', 'PCINT3Addr': '14', 'WDTAddr': '16', 'TIMER2_COMPAAddr': '18', 'TIMER2_COMPBAddr': '20', 'TIMER2_OVFAddr': '22', 'TIMER1_CAPTAddr': '24', 'TIMER1_COMPAAddr': '26', 'TIMER1_COMPBAddr': '28', 'TIMER1_OVFAddr': '30', 'TIMER0_COMPAAddr': '32', 'TIMER0_COMPBAddr': '34', 'TIMER0_OVFAddr': '36', 'SPI__STCAddr': '38', 'USART0__RXAddr': '40', 'USART0__UDREAddr': '42', 'USART0__TXAddr': '44', 'ANALOG_COMPAddr': '46', 'ADCAddr': '48', 'EE_READYAddr': '50', 'TWIAddr': '52', 'SPM_READYAddr': '54', 'USART1_RXAddr': '56', 'USART1_UDREAddr': '58', 'USART1_TXAddr': '60' }
hickey/amforth
core/devices/atmega644a/device.py
Python
gpl-2.0
7,375
/* * Copyright 2017 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE 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. */ #include "sdk/android/src/jni/pc/video.h" #include <jni.h> #include <memory> #include "api/video_codecs/video_decoder_factory.h" #include "api/video_codecs/video_encoder_factory.h" #include "rtc_base/logging.h" #include "rtc_base/ref_counted_object.h" #include "sdk/android/native_api/jni/java_types.h" #include "sdk/android/src/jni/android_video_track_source.h" #include "sdk/android/src/jni/video_decoder_factory_wrapper.h" #include "sdk/android/src/jni/video_encoder_factory_wrapper.h" namespace webrtc { namespace jni { VideoEncoderFactory* CreateVideoEncoderFactory( JNIEnv* jni, const JavaRef<jobject>& j_encoder_factory) { return IsNull(jni, j_encoder_factory) ? nullptr : new VideoEncoderFactoryWrapper(jni, j_encoder_factory); } VideoDecoderFactory* CreateVideoDecoderFactory( JNIEnv* jni, const JavaRef<jobject>& j_decoder_factory) { return IsNull(jni, j_decoder_factory) ? nullptr : new VideoDecoderFactoryWrapper(jni, j_decoder_factory); } void* CreateVideoSource(JNIEnv* env, rtc::Thread* signaling_thread, rtc::Thread* worker_thread, jboolean is_screencast, jboolean align_timestamps) { auto source = rtc::make_ref_counted<AndroidVideoTrackSource>( signaling_thread, env, is_screencast, align_timestamps); return source.release(); } } // namespace jni } // namespace webrtc
Telegram-FOSS-Team/Telegram-FOSS
TMessagesProj/jni/voip/webrtc/sdk/android/src/jni/pc/video.cc
C++
gpl-2.0
1,885
# -*- coding: utf-8 -*- """ /*************************************************************************** Name : DB Manager Description : Database manager plugin for QGIS Date : May 23, 2011 copyright : (C) 2011 by Giuseppe Sucameli email : brush.tyler@gmail.com The content of this file is based on - PG_Manager by Martin Dobias (GPLv2 license) ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ """ from PyQt4.QtCore import Qt, QObject, QSettings, QByteArray, SIGNAL, pyqtSignal from PyQt4.QtGui import QDialog, QWidget, QAction, QKeySequence, \ QDialogButtonBox, QApplication, QCursor, QMessageBox, QClipboard, QInputDialog, QIcon from PyQt4.Qsci import QsciAPIs from qgis.core import QgsProject from .db_plugins.plugin import BaseError from .dlg_db_error import DlgDbError from .dlg_query_builder import QueryBuilderDlg try: from qgis.gui import QgsCodeEditorSQL except: from .sqledit import SqlEdit from qgis import gui gui.QgsCodeEditorSQL = SqlEdit from .ui.ui_DlgSqlWindow import Ui_DbManagerDlgSqlWindow as Ui_Dialog import re class DlgSqlWindow(QWidget, Ui_Dialog): nameChanged = pyqtSignal(str) def __init__(self, iface, db, parent=None): QWidget.__init__(self, parent) self.iface = iface self.db = db self.setupUi(self) self.setWindowTitle( u"%s - %s [%s]" % (self.windowTitle(), db.connection().connectionName(), db.connection().typeNameString())) self.defaultLayerName = 'QueryLayer' self.editSql.setFocus() self.editSql.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) self.initCompleter() # allow to copy results copyAction = QAction("copy", self) self.viewResult.addAction(copyAction) copyAction.setShortcuts(QKeySequence.Copy) copyAction.triggered.connect(self.copySelectedResults) self.btnExecute.clicked.connect(self.executeSql) self.btnClear.clicked.connect(self.clearSql) self.presetStore.clicked.connect(self.storePreset) self.presetDelete.clicked.connect(self.deletePreset) self.presetCombo.activated[str].connect(self.loadPreset) self.presetCombo.activated[str].connect(self.presetName.setText) self.updatePresetsCombobox() # hide the load query as layer if feature is not supported self._loadAsLayerAvailable = self.db.connector.hasCustomQuerySupport() self.loadAsLayerGroup.setVisible(self._loadAsLayerAvailable) if self._loadAsLayerAvailable: self.layerTypeWidget.hide() # show if load as raster is supported self.loadLayerBtn.clicked.connect(self.loadSqlLayer) self.getColumnsBtn.clicked.connect(self.fillColumnCombos) self.loadAsLayerGroup.toggled.connect(self.loadAsLayerToggled) self.loadAsLayerToggled(False) self._createViewAvailable = self.db.connector.hasCreateSpatialViewSupport() self.btnCreateView.setVisible(self._createViewAvailable) if self._createViewAvailable: self.btnCreateView.clicked.connect(self.createView) self.queryBuilderFirst = True self.queryBuilderBtn.setIcon(QIcon(":/db_manager/icons/sql.gif")) self.queryBuilderBtn.clicked.connect(self.displayQueryBuilder) self.presetName.textChanged.connect(self.nameChanged) def updatePresetsCombobox(self): self.presetCombo.clear() names = [] entries = QgsProject.instance().subkeyList('DBManager', 'savedQueries') for entry in entries: name = QgsProject.instance().readEntry('DBManager', 'savedQueries/' + entry + '/name')[0] names.append(name) for name in sorted(names): self.presetCombo.addItem(name) self.presetCombo.setCurrentIndex(-1) def storePreset(self): query = self._getSqlQuery() if query == "": return name = self.presetName.text() QgsProject.instance().writeEntry('DBManager', 'savedQueries/q' + unicode(name.__hash__()) + '/name', name) QgsProject.instance().writeEntry('DBManager', 'savedQueries/q' + unicode(name.__hash__()) + '/query', query) index = self.presetCombo.findText(name) if index == -1: self.presetCombo.addItem(name) self.presetCombo.setCurrentIndex(self.presetCombo.count() - 1) else: self.presetCombo.setCurrentIndex(index) def deletePreset(self): name = self.presetCombo.currentText() QgsProject.instance().removeEntry('DBManager', 'savedQueries/q' + unicode(name.__hash__())) self.presetCombo.removeItem(self.presetCombo.findText(name)) self.presetCombo.setCurrentIndex(-1) def loadPreset(self, name): query = QgsProject.instance().readEntry('DBManager', 'savedQueries/q' + unicode(name.__hash__()) + '/query')[0] name = QgsProject.instance().readEntry('DBManager', 'savedQueries/q' + unicode(name.__hash__()) + '/name')[0] self.editSql.setText(query) def loadAsLayerToggled(self, checked): self.loadAsLayerGroup.setChecked(checked) self.loadAsLayerWidget.setVisible(checked) def clearSql(self): self.editSql.clear() self.editSql.setFocus() def executeSql(self): sql = self._getSqlQuery() if sql == "": return QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) # delete the old model old_model = self.viewResult.model() self.viewResult.setModel(None) if old_model: old_model.deleteLater() self.uniqueCombo.clear() self.geomCombo.clear() try: # set the new model model = self.db.sqlResultModel(sql, self) self.viewResult.setModel(model) self.lblResult.setText(self.tr("%d rows, %.1f seconds") % (model.affectedRows(), model.secs())) except BaseError as e: QApplication.restoreOverrideCursor() DlgDbError.showError(e, self) return cols = sorted(self.viewResult.model().columnNames()) self.uniqueCombo.addItems(cols) self.geomCombo.addItems(cols) self.update() QApplication.restoreOverrideCursor() def loadSqlLayer(self): hasUniqueField = self.uniqueColumnCheck.checkState() == Qt.Checked if hasUniqueField: uniqueFieldName = self.uniqueCombo.currentText() else: uniqueFieldName = None hasGeomCol = self.hasGeometryCol.checkState() == Qt.Checked if hasGeomCol: geomFieldName = self.geomCombo.currentText() else: geomFieldName = None query = self._getSqlQuery() if query == "": return # remove a trailing ';' from query if present if query.strip().endswith(';'): query = query.strip()[:-1] QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) from qgis.core import QgsMapLayer, QgsMapLayerRegistry layerType = QgsMapLayer.VectorLayer if self.vectorRadio.isChecked() else QgsMapLayer.RasterLayer # get a new layer name names = [] for layer in QgsMapLayerRegistry.instance().mapLayers().values(): names.append(layer.name()) layerName = self.layerNameEdit.text() if layerName == "": layerName = self.defaultLayerName newLayerName = layerName index = 1 while newLayerName in names: index += 1 newLayerName = u"%s_%d" % (layerName, index) # create the layer layer = self.db.toSqlLayer(query, geomFieldName, uniqueFieldName, newLayerName, layerType, self.avoidSelectById.isChecked()) if layer.isValid(): QgsMapLayerRegistry.instance().addMapLayers([layer], True) QApplication.restoreOverrideCursor() def fillColumnCombos(self): query = self._getSqlQuery() if query == "": return QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) self.uniqueCombo.clear() self.geomCombo.clear() # get a new alias aliasIndex = 0 while True: alias = "_%s__%d" % ("subQuery", aliasIndex) escaped = re.compile('\\b("?)' + re.escape(alias) + '\\1\\b') if not escaped.search(query): break aliasIndex += 1 # remove a trailing ';' from query if present if query.strip().endswith(';'): query = query.strip()[:-1] # get all the columns cols = [] connector = self.db.connector sql = u"SELECT * FROM (%s\n) AS %s LIMIT 0" % (unicode(query), connector.quoteId(alias)) c = None try: c = connector._execute(None, sql) cols = connector._get_cursor_columns(c) except BaseError as e: QApplication.restoreOverrideCursor() DlgDbError.showError(e, self) return finally: if c: c.close() del c # get sensible default columns. do this before sorting in case there's hints in the column order (eg, id is more likely to be first) try: defaultGeomCol = next(col for col in cols if col in ['geom', 'geometry', 'the_geom', 'way']) except: defaultGeomCol = None try: defaultUniqueCol = [col for col in cols if 'id' in col][0] except: defaultUniqueCol = None cols.sort() self.uniqueCombo.addItems(cols) self.geomCombo.addItems(cols) # set sensible default columns try: self.geomCombo.setCurrentIndex(cols.index(defaultGeomCol)) except: pass try: self.uniqueCombo.setCurrentIndex(cols.index(defaultUniqueCol)) except: pass QApplication.restoreOverrideCursor() def copySelectedResults(self): if len(self.viewResult.selectedIndexes()) <= 0: return model = self.viewResult.model() # convert to string using tab as separator text = model.headerToString("\t") for idx in self.viewResult.selectionModel().selectedRows(): text += "\n" + model.rowToString(idx.row(), "\t") QApplication.clipboard().setText(text, QClipboard.Selection) QApplication.clipboard().setText(text, QClipboard.Clipboard) def initCompleter(self): dictionary = None if self.db: dictionary = self.db.connector.getSqlDictionary() if not dictionary: # use the generic sql dictionary from .sql_dictionary import getSqlDictionary dictionary = getSqlDictionary() wordlist = [] for name, value in dictionary.iteritems(): wordlist += value # concat lists wordlist = list(set(wordlist)) # remove duplicates api = QsciAPIs(self.editSql.lexer()) for word in wordlist: api.add(word) api.prepare() self.editSql.lexer().setAPIs(api) def displayQueryBuilder(self): dlg = QueryBuilderDlg(self.iface, self.db, self, reset=self.queryBuilderFirst) self.queryBuilderFirst = False r = dlg.exec_() if r == QDialog.Accepted: self.editSql.setText(dlg.query) def createView(self): name, ok = QInputDialog.getText(None, "View name", "View name") if ok: try: self.db.connector.createSpatialView(name, self._getSqlQuery()) except BaseError as e: DlgDbError.showError(e, self) def _getSqlQuery(self): sql = self.editSql.selectedText() if len(sql) == 0: sql = self.editSql.text() return sql
jarped/QGIS
python/plugins/db_manager/dlg_sql_window.py
Python
gpl-2.0
12,633
from django.contrib.auth import get_user_model User = get_user_model() from rest_framework import serializers from nodeshot.core.base.serializers import ModelValidationSerializer from nodeshot.community.profiles.serializers import ProfileRelationSerializer from .models import Comment, Vote, Rating, NodeRatingCount __all__ = ['CommentSerializer', 'RatingSerializer', 'CommentRelationSerializer', 'VoteSerializer', 'ParticipationSerializer'] class AutoNodeMixin(object): """ automatically adds node to validated_data the node info is taken from views that extend NodeRelationViewMixin """ def validate(self, data): data['node'] = self.context['view'].node return super(AutoNodeMixin, self).validate(data) class CommentSerializer(AutoNodeMixin, ModelValidationSerializer): """ Comment serializer """ node = serializers.ReadOnlyField(source='node.name') username = serializers.ReadOnlyField(source='user.username') class Meta: model = Comment fields = ('node', 'username', 'text', 'added') read_only_fields = ('added',) class CommentRelationSerializer(serializers.ModelSerializer): """ display user info """ user = ProfileRelationSerializer() class Meta: model = Comment fields = ('user', 'text', 'added',) class RatingSerializer(AutoNodeMixin, ModelValidationSerializer): """ Rating serializer """ node = serializers.ReadOnlyField(source='node.name') username = serializers.ReadOnlyField(source='user.username') class Meta: model = Rating fields = ('node', 'username', 'value',) read_only_fields = ('added',) class VoteSerializer(AutoNodeMixin, ModelValidationSerializer): node = serializers.ReadOnlyField(source='node.name') username = serializers.ReadOnlyField(source='user.username') class Meta: model = Vote fields = ('node', 'username', 'vote',) read_only_fields = ('added',) class ParticipationSerializer(serializers.ModelSerializer): class Meta: model = NodeRatingCount fields = ('likes', 'dislikes', 'rating_count', 'rating_avg', 'comment_count')
SCORE42/nodeshot
nodeshot/community/participation/serializers.py
Python
gpl-3.0
2,237
/* Copyright (c) 2010, Carl Burch. License information is located in the * com.cburch.logisim.Main source code and at www.cburch.com/logisim/. */ package com.cburch.logisim.tools; import java.awt.Color; import java.awt.Cursor; import java.awt.Graphics; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import javax.swing.Icon; import javax.swing.JOptionPane; import com.cburch.logisim.LogisimVersion; import com.cburch.logisim.circuit.Circuit; import com.cburch.logisim.circuit.CircuitException; import com.cburch.logisim.circuit.CircuitMutation; import com.cburch.logisim.circuit.SubcircuitFactory; import com.cburch.logisim.comp.Component; import com.cburch.logisim.comp.ComponentFactory; import com.cburch.logisim.comp.ComponentDrawContext; import com.cburch.logisim.data.Attribute; import com.cburch.logisim.data.AttributeEvent; import com.cburch.logisim.data.AttributeListener; import com.cburch.logisim.data.AttributeSet; import com.cburch.logisim.data.Bounds; import com.cburch.logisim.data.Direction; import com.cburch.logisim.data.Location; import com.cburch.logisim.gui.main.Canvas; import com.cburch.logisim.gui.main.SelectionActions; import com.cburch.logisim.gui.main.ToolAttributeAction; import com.cburch.logisim.prefs.AppPreferences; import com.cburch.logisim.proj.Action; import com.cburch.logisim.proj.Dependencies; import com.cburch.logisim.proj.Project; import com.cburch.logisim.tools.key.KeyConfigurationEvent; import com.cburch.logisim.tools.key.KeyConfigurator; import com.cburch.logisim.tools.key.KeyConfigurationResult; import static com.cburch.logisim.util.LocaleString.*; public class AddTool extends Tool { private static int INVALID_COORD = Integer.MIN_VALUE; private static int SHOW_NONE = 0; private static int SHOW_GHOST = 1; private static int SHOW_ADD = 2; private static int SHOW_ADD_NO = 3; private static Cursor cursor = Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR); private class MyAttributeListener implements AttributeListener { @Override public void attributeListChanged(AttributeEvent e) { bounds = null; } @Override public void attributeValueChanged(AttributeEvent e) { bounds = null; } } private Class<? extends Library> descriptionBase; private FactoryDescription description; private boolean sourceLoadAttempted; private ComponentFactory factory; private AttributeSet attrs; private Bounds bounds; private boolean shouldSnap; private int lastX = INVALID_COORD; private int lastY = INVALID_COORD; private int state = SHOW_GHOST; private Action lastAddition; private boolean keyHandlerTried; private KeyConfigurator keyHandler; public AddTool(Class<? extends Library> base, FactoryDescription description) { this.descriptionBase = base; this.description = description; this.sourceLoadAttempted = false; this.shouldSnap = true; this.attrs = new FactoryAttributes(base, description); attrs.addAttributeListener(new MyAttributeListener()); this.keyHandlerTried = false; } public AddTool(ComponentFactory source) { this.description = null; this.sourceLoadAttempted = true; this.factory = source; this.bounds = null; this.attrs = new FactoryAttributes(source); attrs.addAttributeListener(new MyAttributeListener()); Boolean value = (Boolean) source.getFeature(ComponentFactory.SHOULD_SNAP, attrs); this.shouldSnap = value == null ? true : value.booleanValue(); } private AddTool(AddTool base) { this.descriptionBase = base.descriptionBase; this.description = base.description; this.sourceLoadAttempted = base.sourceLoadAttempted; this.factory = base.factory; this.bounds = base.bounds; this.shouldSnap = base.shouldSnap; this.attrs = (AttributeSet) base.attrs.clone(); attrs.addAttributeListener(new MyAttributeListener()); } @Override public boolean equals(Object other) { if (!(other instanceof AddTool)) { return false; } AddTool o = (AddTool) other; if (this.description != null) { return this.descriptionBase == o.descriptionBase && this.description.equals(o.description); } else { return this.factory.equals(o.factory); } } @Override public int hashCode() { FactoryDescription desc = description; return desc != null ? desc.hashCode() : factory.hashCode(); } @Override public boolean sharesSource(Tool other) { if (!(other instanceof AddTool)) { return false; } AddTool o = (AddTool) other; if (this.sourceLoadAttempted && o.sourceLoadAttempted) { return this.factory.equals(o.factory); } if (this.description == null) { return o.description == null; } return this.description.equals(o.description); } public ComponentFactory getFactory(boolean forceLoad) { return forceLoad ? getFactory() : factory; } public ComponentFactory getFactory() { ComponentFactory ret = factory; if (ret != null || sourceLoadAttempted) { return ret; } ret = description.getFactory(descriptionBase); if (ret != null) { AttributeSet base = getBaseAttributes(); Boolean value = (Boolean) ret.getFeature(ComponentFactory.SHOULD_SNAP, base); shouldSnap = value == null ? true : value.booleanValue(); } factory = ret; sourceLoadAttempted = true; return ret; } @Override public String getName() { FactoryDescription desc = description; return desc == null ? factory.getName() : desc.getName(); } @Override public String getDisplayName() { FactoryDescription desc = description; return desc == null ? factory.getDisplayName() : desc.getDisplayName(); } @Override public String getDescription() { String ret; FactoryDescription desc = description; if (desc != null) { ret = desc.getToolTip(); } else { ComponentFactory source = getFactory(); if (source != null) { ret = (String) source.getFeature(ComponentFactory.TOOL_TIP, getAttributeSet()); } else { ret = null; } } if (ret == null) { ret = getFromLocale("addToolText", getDisplayName()); } return ret; } @Override public Tool cloneTool() { return new AddTool(this); } @Override public AttributeSet getAttributeSet() { return attrs; } @Override public boolean isAllDefaultValues(AttributeSet attrs, LogisimVersion ver) { return this.attrs == attrs && attrs instanceof FactoryAttributes && !((FactoryAttributes) attrs).isFactoryInstantiated(); } @Override public Object getDefaultAttributeValue(Attribute<?> attr, LogisimVersion ver) { return getFactory().getDefaultAttributeValue(attr, ver); } @Override public void draw(Canvas canvas, ComponentDrawContext context) { // next "if" suggested roughly by Kevin Walsh of Cornell to take care of // repaint problems on OpenJDK under Ubuntu int x = lastX; int y = lastY; if (x == INVALID_COORD || y == INVALID_COORD) { return; } ComponentFactory source = getFactory(); if (source == null) { return; } if (state == SHOW_GHOST) { source.drawGhost(context, Color.GRAY, x, y, getBaseAttributes()); } else if (state == SHOW_ADD) { source.drawGhost(context, Color.BLACK, x, y, getBaseAttributes()); } } private AttributeSet getBaseAttributes() { AttributeSet ret = attrs; if (ret instanceof FactoryAttributes) { ret = ((FactoryAttributes) ret).getBase(); } return ret; } public void cancelOp() { } @Override public void select(Canvas canvas) { setState(canvas, SHOW_GHOST); bounds = null; } @Override public void deselect(Canvas canvas) { setState(canvas, SHOW_GHOST); moveTo(canvas, canvas.getGraphics(), INVALID_COORD, INVALID_COORD); bounds = null; lastAddition = null; } private synchronized void moveTo(Canvas canvas, Graphics g, int x, int y) { if (state != SHOW_NONE) { expose(canvas, lastX, lastY); } lastX = x; lastY = y; if (state != SHOW_NONE) { expose(canvas, lastX, lastY); } } @Override public void mouseEntered(Canvas canvas, Graphics g, MouseEvent e) { if (state == SHOW_GHOST || state == SHOW_NONE) { setState(canvas, SHOW_GHOST); canvas.requestFocusInWindow(); } else if (state == SHOW_ADD_NO) { setState(canvas, SHOW_ADD); canvas.requestFocusInWindow(); } } @Override public void mouseExited(Canvas canvas, Graphics g, MouseEvent e) { if (state == SHOW_GHOST) { moveTo(canvas, canvas.getGraphics(), INVALID_COORD, INVALID_COORD); setState(canvas, SHOW_NONE); } else if (state == SHOW_ADD) { moveTo(canvas, canvas.getGraphics(), INVALID_COORD, INVALID_COORD); setState(canvas, SHOW_ADD_NO); } } @Override public void mouseMoved(Canvas canvas, Graphics g, MouseEvent e) { if (state != SHOW_NONE) { if (shouldSnap) { Canvas.snapToGrid(e); } moveTo(canvas, g, e.getX(), e.getY()); } } @Override public void mousePressed(Canvas canvas, Graphics g, MouseEvent e) { // verify the addition would be valid Circuit circ = canvas.getCircuit(); if (!canvas.getProject().getLogisimFile().contains(circ)) { canvas.setErrorMessage(getFromLocale("cannotModifyError"), 0, 0); return; } if (factory instanceof SubcircuitFactory) { SubcircuitFactory circFact = (SubcircuitFactory) factory; Dependencies depends = canvas.getProject().getDependencies(); if (!depends.canAdd(circ, circFact.getSubcircuit())) { canvas.setErrorMessage(getFromLocale("circularError"), 0, 0); return; } } if (shouldSnap) { Canvas.snapToGrid(e); } moveTo(canvas, g, e.getX(), e.getY()); setState(canvas, SHOW_ADD); } @Override public void mouseDragged(Canvas canvas, Graphics g, MouseEvent e) { if (state != SHOW_NONE) { if (shouldSnap) { Canvas.snapToGrid(e); } moveTo(canvas, g, e.getX(), e.getY()); } } @Override public void mouseReleased(Canvas canvas, Graphics g, MouseEvent e) { Component added = null; if (state == SHOW_ADD) { Circuit circ = canvas.getCircuit(); if (!canvas.getProject().getLogisimFile().contains(circ)) { return; } if (shouldSnap) { Canvas.snapToGrid(e); } moveTo(canvas, g, e.getX(), e.getY()); Location loc = Location.create(e.getX(), e.getY()); AttributeSet attrsCopy = (AttributeSet) attrs.clone(); ComponentFactory source = getFactory(); if (source == null) { return; } Component c = source.createComponent(loc, attrsCopy); if (circ.hasConflict(c)) { canvas.setErrorMessage(getFromLocale("exclusiveError"), 0, 0); return; } Bounds bds = c.getBounds(g); if (bds.getX() < 0 || bds.getY() < 0) { canvas.setErrorMessage(getFromLocale("negativeCoordError"), 0, 0); return; } try { CircuitMutation mutation = new CircuitMutation(circ); mutation.add(c); Action action = mutation.toAction(getFromLocale("addComponentAction", factory.getDisplayGetter())); canvas.getProject().doAction(action); lastAddition = action; added = c; } catch (CircuitException ex) { JOptionPane.showMessageDialog(canvas.getProject().getFrame(), ex.getMessage()); } setState(canvas, SHOW_GHOST); } else if (state == SHOW_ADD_NO) { setState(canvas, SHOW_NONE); } Project proj = canvas.getProject(); Tool next = determineNext(proj); if (next != null) { proj.setTool(next); Action act = SelectionActions.dropAll(canvas.getSelection()); if (act != null) { proj.doAction(act); } if (added != null) { canvas.getSelection().add(added); } } } private Tool determineNext(Project proj) { String afterAdd = AppPreferences.ADD_AFTER.get(); if (afterAdd.equals(AppPreferences.ADD_AFTER_UNCHANGED)) { return null; // switch to Edit Tool } else { Library base = proj.getLogisimFile().getLibrary("Base"); if (base == null) { return null; } else { return base.getTool("Edit Tool"); } } } @Override public void keyPressed(Canvas canvas, KeyEvent event) { processKeyEvent(canvas, event, KeyConfigurationEvent.KEY_PRESSED); if (!event.isConsumed() && event.getModifiersEx() == 0) { switch (event.getKeyCode()) { case KeyEvent.VK_UP: setFacing(canvas, Direction.NORTH); break; case KeyEvent.VK_DOWN: setFacing(canvas, Direction.SOUTH); break; case KeyEvent.VK_LEFT: setFacing(canvas, Direction.WEST); break; case KeyEvent.VK_RIGHT: setFacing(canvas, Direction.EAST); break; case KeyEvent.VK_BACK_SPACE: if (lastAddition != null && canvas.getProject().getLastAction() == lastAddition) { canvas.getProject().undoAction(); lastAddition = null; } } } } @Override public void keyReleased(Canvas canvas, KeyEvent event) { processKeyEvent(canvas, event, KeyConfigurationEvent.KEY_RELEASED); } @Override public void keyTyped(Canvas canvas, KeyEvent event) { processKeyEvent(canvas, event, KeyConfigurationEvent.KEY_TYPED); } private void processKeyEvent(Canvas canvas, KeyEvent event, int type) { KeyConfigurator handler = keyHandler; if (!keyHandlerTried) { ComponentFactory source = getFactory(); AttributeSet baseAttrs = getBaseAttributes(); handler = (KeyConfigurator) source.getFeature(KeyConfigurator.class, baseAttrs); keyHandler = handler; keyHandlerTried = true; } if (handler != null) { AttributeSet baseAttrs = getBaseAttributes(); KeyConfigurationEvent e = new KeyConfigurationEvent(type, baseAttrs, event, this); KeyConfigurationResult r = handler.keyEventReceived(e); if (r != null) { Action act = ToolAttributeAction.create(r); canvas.getProject().doAction(act); } } } private void setFacing(Canvas canvas, Direction facing) { ComponentFactory source = getFactory(); if (source == null) { return; } AttributeSet base = getBaseAttributes(); Object feature = source.getFeature(ComponentFactory.FACING_ATTRIBUTE_KEY, base); @SuppressWarnings("unchecked") Attribute<Direction> attr = (Attribute<Direction>) feature; if (attr != null) { Action act = ToolAttributeAction.create(this, attr, facing); canvas.getProject().doAction(act); } } @Override public void paintIcon(ComponentDrawContext c, int x, int y) { FactoryDescription desc = description; if (desc != null && !desc.isFactoryLoaded()) { Icon icon = desc.getIcon(); if (icon != null) { icon.paintIcon(c.getDestination(), c.getGraphics(), x + 2, y + 2); return; } } ComponentFactory source = getFactory(); if (source != null) { AttributeSet base = getBaseAttributes(); source.paintIcon(c, x, y, base); } } private void expose(java.awt.Component c, int x, int y) { Bounds bds = getBounds(); c.repaint(x + bds.getX(), y + bds.getY(), bds.getWidth(), bds.getHeight()); } @Override public Cursor getCursor() { return cursor; } private void setState(Canvas canvas, int value) { if (value == SHOW_GHOST) { if (canvas.getProject().getLogisimFile().contains(canvas.getCircuit()) && AppPreferences.ADD_SHOW_GHOSTS.getBoolean()) { state = SHOW_GHOST; } else { state = SHOW_NONE; } } else { state = value; } } private Bounds getBounds() { Bounds ret = bounds; if (ret == null) { ComponentFactory source = getFactory(); if (source == null) { ret = Bounds.EMPTY_BOUNDS; } else { AttributeSet base = getBaseAttributes(); ret = source.getOffsetBounds(base).expand(5); } bounds = ret; } return ret; } }
lawrancej/logisim
src/main/java/com/cburch/logisim/tools/AddTool.java
Java
gpl-3.0
18,224
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- #include "Copter.h" #if POSHOLD_ENABLED == ENABLED /* * control_poshold.pde - init and run calls for PosHold flight mode * PosHold tries to improve upon regular loiter by mixing the pilot input with the loiter controller */ #define POSHOLD_SPEED_0 10 // speed below which it is always safe to switch to loiter // 400hz loop update rate #define POSHOLD_BRAKE_TIME_ESTIMATE_MAX (600*4) // max number of cycles the brake will be applied before we switch to loiter #define POSHOLD_BRAKE_TO_LOITER_TIMER (150*4) // Number of cycles to transition from brake mode to loiter mode. Must be lower than POSHOLD_LOITER_STAB_TIMER #define POSHOLD_WIND_COMP_START_TIMER (150*4) // Number of cycles to start wind compensation update after loiter is engaged #define POSHOLD_CONTROLLER_TO_PILOT_MIX_TIMER (50*4) // Set it from 100 to 200, the number of centiseconds loiter and manual commands are mixed to make a smooth transition. #define POSHOLD_SMOOTH_RATE_FACTOR 0.0125f // filter applied to pilot's roll/pitch input as it returns to center. A lower number will cause the roll/pitch to return to zero more slowly if the brake_rate is also low. #define POSHOLD_WIND_COMP_TIMER_10HZ 40 // counter value used to reduce wind compensation to 10hz #define LOOP_RATE_FACTOR 4 // used to adapt PosHold params to loop_rate #define TC_WIND_COMP 0.0025f // Time constant for poshold_update_wind_comp_estimate() // definitions that are independent of main loop rate #define POSHOLD_STICK_RELEASE_SMOOTH_ANGLE 1800 // max angle required (in centi-degrees) after which the smooth stick release effect is applied #define POSHOLD_WIND_COMP_ESTIMATE_SPEED_MAX 10 // wind compensation estimates will only run when velocity is at or below this speed in cm/s // mission state enumeration enum poshold_rp_mode { POSHOLD_PILOT_OVERRIDE=0, // pilot is controlling this axis (i.e. roll or pitch) POSHOLD_BRAKE, // this axis is braking towards zero POSHOLD_BRAKE_READY_TO_LOITER, // this axis has completed braking and is ready to enter loiter mode (both modes must be this value before moving to next stage) POSHOLD_BRAKE_TO_LOITER, // both vehicle's axis (roll and pitch) are transitioning from braking to loiter mode (braking and loiter controls are mixed) POSHOLD_LOITER, // both vehicle axis are holding position POSHOLD_CONTROLLER_TO_PILOT_OVERRIDE // pilot has input controls on this axis and this axis is transitioning to pilot override (other axis will transition to brake if no pilot input) }; static struct { poshold_rp_mode roll_mode : 3; // roll mode: pilot override, brake or loiter poshold_rp_mode pitch_mode : 3; // pitch mode: pilot override, brake or loiter uint8_t braking_time_updated_roll : 1; // true once we have re-estimated the braking time. This is done once as the vehicle begins to flatten out after braking uint8_t braking_time_updated_pitch : 1; // true once we have re-estimated the braking time. This is done once as the vehicle begins to flatten out after braking uint8_t loiter_reset_I : 1; // true the very first time PosHold enters loiter, thereafter we trust the i terms loiter has // pilot input related variables float pilot_roll; // pilot requested roll angle (filtered to slow returns to zero) float pilot_pitch; // pilot requested roll angle (filtered to slow returns to zero) // braking related variables float brake_gain; // gain used during conversion of vehicle's velocity to lean angle during braking (calculated from brake_rate) int16_t brake_roll; // target roll angle during braking periods int16_t brake_pitch; // target pitch angle during braking periods int16_t brake_timeout_roll; // number of cycles allowed for the braking to complete, this timeout will be updated at half-braking int16_t brake_timeout_pitch; // number of cycles allowed for the braking to complete, this timeout will be updated at half-braking int16_t brake_angle_max_roll; // maximum lean angle achieved during braking. Used to determine when the vehicle has begun to flatten out so that we can re-estimate the braking time int16_t brake_angle_max_pitch; // maximum lean angle achieved during braking Used to determine when the vehicle has begun to flatten out so that we can re-estimate the braking time int16_t brake_to_loiter_timer; // cycles to mix brake and loiter controls in POSHOLD_BRAKE_TO_LOITER // loiter related variables int16_t controller_to_pilot_timer_roll; // cycles to mix controller and pilot controls in POSHOLD_CONTROLLER_TO_PILOT int16_t controller_to_pilot_timer_pitch; // cycles to mix controller and pilot controls in POSHOLD_CONTROLLER_TO_PILOT int16_t controller_final_roll; // final roll angle from controller as we exit brake or loiter mode (used for mixing with pilot input) int16_t controller_final_pitch; // final pitch angle from controller as we exit brake or loiter mode (used for mixing with pilot input) // wind compensation related variables Vector2f wind_comp_ef; // wind compensation in earth frame, filtered lean angles from position controller int16_t wind_comp_roll; // roll angle to compensate for wind int16_t wind_comp_pitch; // pitch angle to compensate for wind uint16_t wind_comp_start_timer; // counter to delay start of wind compensation for a short time after loiter is engaged int8_t wind_comp_timer; // counter to reduce wind comp roll/pitch lean angle calcs to 10hz // final output int16_t roll; // final roll angle sent to attitude controller int16_t pitch; // final pitch angle sent to attitude controller } poshold; // poshold_init - initialise PosHold controller bool Copter::poshold_init(bool ignore_checks) { // fail to initialise PosHold mode if no GPS lock if (!position_ok() && !ignore_checks) { return false; } // initialize vertical speeds and acceleration pos_control.set_speed_z(-g.pilot_velocity_z_max, g.pilot_velocity_z_max); pos_control.set_accel_z(g.pilot_accel_z); // initialise position and desired velocity pos_control.set_alt_target(inertial_nav.get_altitude()); pos_control.set_desired_velocity_z(inertial_nav.get_velocity_z()); // initialise lean angles to current attitude poshold.pilot_roll = 0; poshold.pilot_pitch = 0; // compute brake_gain poshold.brake_gain = (15.0f * (float)g.poshold_brake_rate + 95.0f) / 100.0f; if (ap.land_complete) { // if landed begin in loiter mode poshold.roll_mode = POSHOLD_LOITER; poshold.pitch_mode = POSHOLD_LOITER; // set target to current position // only init here as we can switch to PosHold in flight with a velocity <> 0 that will be used as _last_vel in PosControl and never updated again as we inhibit Reset_I wp_nav.init_loiter_target(); }else{ // if not landed start in pilot override to avoid hard twitch poshold.roll_mode = POSHOLD_PILOT_OVERRIDE; poshold.pitch_mode = POSHOLD_PILOT_OVERRIDE; } // loiter's I terms should be reset the first time only poshold.loiter_reset_I = true; // initialise wind_comp each time PosHold is switched on poshold.wind_comp_ef.zero(); poshold.wind_comp_roll = 0; poshold.wind_comp_pitch = 0; poshold.wind_comp_timer = 0; return true; } // poshold_run - runs the PosHold controller // should be called at 100hz or more void Copter::poshold_run() { float target_roll, target_pitch; // pilot's roll and pitch angle inputs float target_yaw_rate = 0; // pilot desired yaw rate in centi-degrees/sec float target_climb_rate = 0; // pilot desired climb rate in centimeters/sec float takeoff_climb_rate = 0.0f; // takeoff induced climb rate float brake_to_loiter_mix; // mix of brake and loiter controls. 0 = fully brake controls, 1 = fully loiter controls float controller_to_pilot_roll_mix; // mix of controller and pilot controls. 0 = fully last controller controls, 1 = fully pilot controls float controller_to_pilot_pitch_mix; // mix of controller and pilot controls. 0 = fully last controller controls, 1 = fully pilot controls float vel_fw, vel_right; // vehicle's current velocity in body-frame forward and right directions const Vector3f& vel = inertial_nav.get_velocity(); // initialize vertical speeds and acceleration pos_control.set_speed_z(-g.pilot_velocity_z_max, g.pilot_velocity_z_max); pos_control.set_accel_z(g.pilot_accel_z); // if not auto armed or motor interlock not enabled set throttle to zero and exit immediately if (!motors.armed() || !ap.auto_armed || !motors.get_interlock()) { motors.set_desired_spool_state(AP_Motors::DESIRED_SPIN_WHEN_ARMED); wp_nav.init_loiter_target(); attitude_control.set_throttle_out_unstabilized(0,true,g.throttle_filt); pos_control.relax_alt_hold_controllers(get_throttle_pre_takeoff(channel_throttle->control_in)-throttle_average); return; } // process pilot inputs if (!failsafe.radio) { // apply SIMPLE mode transform to pilot inputs update_simple_mode(); // get pilot's desired yaw rate target_yaw_rate = get_pilot_desired_yaw_rate(channel_yaw->control_in); // get pilot desired climb rate (for alt-hold mode and take-off) target_climb_rate = get_pilot_desired_climb_rate(channel_throttle->control_in); target_climb_rate = constrain_float(target_climb_rate, -g.pilot_velocity_z_max, g.pilot_velocity_z_max); // get takeoff adjusted pilot and takeoff climb rates takeoff_get_climb_rates(target_climb_rate, takeoff_climb_rate); // check for take-off if (ap.land_complete && (takeoff_state.running || channel_throttle->control_in > get_takeoff_trigger_throttle())) { if (!takeoff_state.running) { takeoff_timer_start(constrain_float(g.pilot_takeoff_alt,0.0f,1000.0f)); } // indicate we are taking off set_land_complete(false); // clear i term when we're taking off set_throttle_takeoff(); } } // relax loiter target if we might be landed if (ap.land_complete_maybe) { wp_nav.loiter_soften_for_landing(); } // if landed initialise loiter targets, set throttle to zero and exit if (ap.land_complete) { // if throttle zero reset attitude and exit immediately if (ap.throttle_zero) { motors.set_desired_spool_state(AP_Motors::DESIRED_SPIN_WHEN_ARMED); }else{ motors.set_desired_spool_state(AP_Motors::DESIRED_THROTTLE_UNLIMITED); } wp_nav.init_loiter_target(); // move throttle to between minimum and non-takeoff-throttle to keep us on the ground attitude_control.set_throttle_out(get_throttle_pre_takeoff(channel_throttle->control_in),false,g.throttle_filt); pos_control.relax_alt_hold_controllers(get_throttle_pre_takeoff(channel_throttle->control_in)-throttle_average); return; }else{ // convert pilot input to lean angles get_pilot_desired_lean_angles(channel_roll->control_in, channel_pitch->control_in, target_roll, target_pitch, aparm.angle_max); // convert inertial nav earth-frame velocities to body-frame // To-Do: move this to AP_Math (or perhaps we already have a function to do this) vel_fw = vel.x*ahrs.cos_yaw() + vel.y*ahrs.sin_yaw(); vel_right = -vel.x*ahrs.sin_yaw() + vel.y*ahrs.cos_yaw(); // If not in LOITER, retrieve latest wind compensation lean angles related to current yaw if (poshold.roll_mode != POSHOLD_LOITER || poshold.pitch_mode != POSHOLD_LOITER) poshold_get_wind_comp_lean_angles(poshold.wind_comp_roll, poshold.wind_comp_pitch); // Roll state machine // Each state (aka mode) is responsible for: // 1. dealing with pilot input // 2. calculating the final roll output to the attitude controller // 3. checking if the state (aka mode) should be changed and if 'yes' perform any required initialisation for the new state switch (poshold.roll_mode) { case POSHOLD_PILOT_OVERRIDE: // update pilot desired roll angle using latest radio input // this filters the input so that it returns to zero no faster than the brake-rate poshold_update_pilot_lean_angle(poshold.pilot_roll, target_roll); // switch to BRAKE mode for next iteration if no pilot input if (is_zero(target_roll) && (fabsf(poshold.pilot_roll) < 2 * g.poshold_brake_rate)) { // initialise BRAKE mode poshold.roll_mode = POSHOLD_BRAKE; // Set brake roll mode poshold.brake_roll = 0; // initialise braking angle to zero poshold.brake_angle_max_roll = 0; // reset brake_angle_max so we can detect when vehicle begins to flatten out during braking poshold.brake_timeout_roll = POSHOLD_BRAKE_TIME_ESTIMATE_MAX; // number of cycles the brake will be applied, updated during braking mode. poshold.braking_time_updated_roll = false; // flag the braking time can be re-estimated } // final lean angle should be pilot input plus wind compensation poshold.roll = poshold.pilot_roll + poshold.wind_comp_roll; break; case POSHOLD_BRAKE: case POSHOLD_BRAKE_READY_TO_LOITER: // calculate brake_roll angle to counter-act velocity poshold_update_brake_angle_from_velocity(poshold.brake_roll, vel_right); // update braking time estimate if (!poshold.braking_time_updated_roll) { // check if brake angle is increasing if (abs(poshold.brake_roll) >= poshold.brake_angle_max_roll) { poshold.brake_angle_max_roll = abs(poshold.brake_roll); } else { // braking angle has started decreasing so re-estimate braking time poshold.brake_timeout_roll = 1+(uint16_t)(LOOP_RATE_FACTOR*15L*(int32_t)(abs(poshold.brake_roll))/(10L*(int32_t)g.poshold_brake_rate)); // the 1.2 (12/10) factor has to be tuned in flight, here it means 120% of the "normal" time. poshold.braking_time_updated_roll = true; } } // if velocity is very low reduce braking time to 0.5seconds if ((fabsf(vel_right) <= POSHOLD_SPEED_0) && (poshold.brake_timeout_roll > 50*LOOP_RATE_FACTOR)) { poshold.brake_timeout_roll = 50*LOOP_RATE_FACTOR; } // reduce braking timer if (poshold.brake_timeout_roll > 0) { poshold.brake_timeout_roll--; } else { // indicate that we are ready to move to Loiter. // Loiter will only actually be engaged once both roll_mode and pitch_mode are changed to POSHOLD_BRAKE_READY_TO_LOITER // logic for engaging loiter is handled below the roll and pitch mode switch statements poshold.roll_mode = POSHOLD_BRAKE_READY_TO_LOITER; } // final lean angle is braking angle + wind compensation angle poshold.roll = poshold.brake_roll + poshold.wind_comp_roll; // check for pilot input if (!is_zero(target_roll)) { // init transition to pilot override poshold_roll_controller_to_pilot_override(); } break; case POSHOLD_BRAKE_TO_LOITER: case POSHOLD_LOITER: // these modes are combined roll-pitch modes and are handled below break; case POSHOLD_CONTROLLER_TO_PILOT_OVERRIDE: // update pilot desired roll angle using latest radio input // this filters the input so that it returns to zero no faster than the brake-rate poshold_update_pilot_lean_angle(poshold.pilot_roll, target_roll); // count-down loiter to pilot timer if (poshold.controller_to_pilot_timer_roll > 0) { poshold.controller_to_pilot_timer_roll--; } else { // when timer runs out switch to full pilot override for next iteration poshold.roll_mode = POSHOLD_PILOT_OVERRIDE; } // calculate controller_to_pilot mix ratio controller_to_pilot_roll_mix = (float)poshold.controller_to_pilot_timer_roll / (float)POSHOLD_CONTROLLER_TO_PILOT_MIX_TIMER; // mix final loiter lean angle and pilot desired lean angles poshold.roll = poshold_mix_controls(controller_to_pilot_roll_mix, poshold.controller_final_roll, poshold.pilot_roll + poshold.wind_comp_roll); break; } // Pitch state machine // Each state (aka mode) is responsible for: // 1. dealing with pilot input // 2. calculating the final pitch output to the attitude contpitcher // 3. checking if the state (aka mode) should be changed and if 'yes' perform any required initialisation for the new state switch (poshold.pitch_mode) { case POSHOLD_PILOT_OVERRIDE: // update pilot desired pitch angle using latest radio input // this filters the input so that it returns to zero no faster than the brake-rate poshold_update_pilot_lean_angle(poshold.pilot_pitch, target_pitch); // switch to BRAKE mode for next iteration if no pilot input if (is_zero(target_pitch) && (fabsf(poshold.pilot_pitch) < 2 * g.poshold_brake_rate)) { // initialise BRAKE mode poshold.pitch_mode = POSHOLD_BRAKE; // set brake pitch mode poshold.brake_pitch = 0; // initialise braking angle to zero poshold.brake_angle_max_pitch = 0; // reset brake_angle_max so we can detect when vehicle begins to flatten out during braking poshold.brake_timeout_pitch = POSHOLD_BRAKE_TIME_ESTIMATE_MAX; // number of cycles the brake will be applied, updated during braking mode. poshold.braking_time_updated_pitch = false; // flag the braking time can be re-estimated } // final lean angle should be pilot input plus wind compensation poshold.pitch = poshold.pilot_pitch + poshold.wind_comp_pitch; break; case POSHOLD_BRAKE: case POSHOLD_BRAKE_READY_TO_LOITER: // calculate brake_pitch angle to counter-act velocity poshold_update_brake_angle_from_velocity(poshold.brake_pitch, -vel_fw); // update braking time estimate if (!poshold.braking_time_updated_pitch) { // check if brake angle is increasing if (abs(poshold.brake_pitch) >= poshold.brake_angle_max_pitch) { poshold.brake_angle_max_pitch = abs(poshold.brake_pitch); } else { // braking angle has started decreasing so re-estimate braking time poshold.brake_timeout_pitch = 1+(uint16_t)(LOOP_RATE_FACTOR*15L*(int32_t)(abs(poshold.brake_pitch))/(10L*(int32_t)g.poshold_brake_rate)); // the 1.2 (12/10) factor has to be tuned in flight, here it means 120% of the "normal" time. poshold.braking_time_updated_pitch = true; } } // if velocity is very low reduce braking time to 0.5seconds if ((fabsf(vel_fw) <= POSHOLD_SPEED_0) && (poshold.brake_timeout_pitch > 50*LOOP_RATE_FACTOR)) { poshold.brake_timeout_pitch = 50*LOOP_RATE_FACTOR; } // reduce braking timer if (poshold.brake_timeout_pitch > 0) { poshold.brake_timeout_pitch--; } else { // indicate that we are ready to move to Loiter. // Loiter will only actually be engaged once both pitch_mode and pitch_mode are changed to POSHOLD_BRAKE_READY_TO_LOITER // logic for engaging loiter is handled below the pitch and pitch mode switch statements poshold.pitch_mode = POSHOLD_BRAKE_READY_TO_LOITER; } // final lean angle is braking angle + wind compensation angle poshold.pitch = poshold.brake_pitch + poshold.wind_comp_pitch; // check for pilot input if (!is_zero(target_pitch)) { // init transition to pilot override poshold_pitch_controller_to_pilot_override(); } break; case POSHOLD_BRAKE_TO_LOITER: case POSHOLD_LOITER: // these modes are combined pitch-pitch modes and are handled below break; case POSHOLD_CONTROLLER_TO_PILOT_OVERRIDE: // update pilot desired pitch angle using latest radio input // this filters the input so that it returns to zero no faster than the brake-rate poshold_update_pilot_lean_angle(poshold.pilot_pitch, target_pitch); // count-down loiter to pilot timer if (poshold.controller_to_pilot_timer_pitch > 0) { poshold.controller_to_pilot_timer_pitch--; } else { // when timer runs out switch to full pilot override for next iteration poshold.pitch_mode = POSHOLD_PILOT_OVERRIDE; } // calculate controller_to_pilot mix ratio controller_to_pilot_pitch_mix = (float)poshold.controller_to_pilot_timer_pitch / (float)POSHOLD_CONTROLLER_TO_PILOT_MIX_TIMER; // mix final loiter lean angle and pilot desired lean angles poshold.pitch = poshold_mix_controls(controller_to_pilot_pitch_mix, poshold.controller_final_pitch, poshold.pilot_pitch + poshold.wind_comp_pitch); break; } // set motors to full range motors.set_desired_spool_state(AP_Motors::DESIRED_THROTTLE_UNLIMITED); // // Shared roll & pitch states (POSHOLD_BRAKE_TO_LOITER and POSHOLD_LOITER) // // switch into LOITER mode when both roll and pitch are ready if (poshold.roll_mode == POSHOLD_BRAKE_READY_TO_LOITER && poshold.pitch_mode == POSHOLD_BRAKE_READY_TO_LOITER) { poshold.roll_mode = POSHOLD_BRAKE_TO_LOITER; poshold.pitch_mode = POSHOLD_BRAKE_TO_LOITER; poshold.brake_to_loiter_timer = POSHOLD_BRAKE_TO_LOITER_TIMER; // init loiter controller wp_nav.init_loiter_target(inertial_nav.get_position(), poshold.loiter_reset_I); // (false) to avoid I_term reset. In original code, velocity(0,0,0) was used instead of current velocity: wp_nav.init_loiter_target(inertial_nav.get_position(), Vector3f(0,0,0)); // at this stage, we are going to run update_loiter that will reset I_term once. From now, we ensure next time that we will enter loiter and update it, I_term won't be reset anymore poshold.loiter_reset_I = false; // set delay to start of wind compensation estimate updates poshold.wind_comp_start_timer = POSHOLD_WIND_COMP_START_TIMER; } // roll-mode is used as the combined roll+pitch mode when in BRAKE_TO_LOITER or LOITER modes if (poshold.roll_mode == POSHOLD_BRAKE_TO_LOITER || poshold.roll_mode == POSHOLD_LOITER) { // force pitch mode to be same as roll_mode just to keep it consistent (it's not actually used in these states) poshold.pitch_mode = poshold.roll_mode; // handle combined roll+pitch mode switch (poshold.roll_mode) { case POSHOLD_BRAKE_TO_LOITER: // reduce brake_to_loiter timer if (poshold.brake_to_loiter_timer > 0) { poshold.brake_to_loiter_timer--; } else { // progress to full loiter on next iteration poshold.roll_mode = POSHOLD_LOITER; poshold.pitch_mode = POSHOLD_LOITER; } // calculate percentage mix of loiter and brake control brake_to_loiter_mix = (float)poshold.brake_to_loiter_timer / (float)POSHOLD_BRAKE_TO_LOITER_TIMER; // calculate brake_roll and pitch angles to counter-act velocity poshold_update_brake_angle_from_velocity(poshold.brake_roll, vel_right); poshold_update_brake_angle_from_velocity(poshold.brake_pitch, -vel_fw); // run loiter controller wp_nav.update_loiter(ekfGndSpdLimit, ekfNavVelGainScaler); // calculate final roll and pitch output by mixing loiter and brake controls poshold.roll = poshold_mix_controls(brake_to_loiter_mix, poshold.brake_roll + poshold.wind_comp_roll, wp_nav.get_roll()); poshold.pitch = poshold_mix_controls(brake_to_loiter_mix, poshold.brake_pitch + poshold.wind_comp_pitch, wp_nav.get_pitch()); // check for pilot input if (!is_zero(target_roll) || !is_zero(target_pitch)) { // if roll input switch to pilot override for roll if (!is_zero(target_roll)) { // init transition to pilot override poshold_roll_controller_to_pilot_override(); // switch pitch-mode to brake (but ready to go back to loiter anytime) // no need to reset poshold.brake_pitch here as wind comp has not been updated since last brake_pitch computation poshold.pitch_mode = POSHOLD_BRAKE_READY_TO_LOITER; } // if pitch input switch to pilot override for pitch if (!is_zero(target_pitch)) { // init transition to pilot override poshold_pitch_controller_to_pilot_override(); if (is_zero(target_roll)) { // switch roll-mode to brake (but ready to go back to loiter anytime) // no need to reset poshold.brake_roll here as wind comp has not been updated since last brake_roll computation poshold.roll_mode = POSHOLD_BRAKE_READY_TO_LOITER; } } } break; case POSHOLD_LOITER: // run loiter controller wp_nav.update_loiter(ekfGndSpdLimit, ekfNavVelGainScaler); // set roll angle based on loiter controller outputs poshold.roll = wp_nav.get_roll(); poshold.pitch = wp_nav.get_pitch(); // update wind compensation estimate poshold_update_wind_comp_estimate(); // check for pilot input if (!is_zero(target_roll) || !is_zero(target_pitch)) { // if roll input switch to pilot override for roll if (!is_zero(target_roll)) { // init transition to pilot override poshold_roll_controller_to_pilot_override(); // switch pitch-mode to brake (but ready to go back to loiter anytime) poshold.pitch_mode = POSHOLD_BRAKE_READY_TO_LOITER; // reset brake_pitch because wind_comp is now different and should give the compensation of the whole previous loiter angle poshold.brake_pitch = 0; } // if pitch input switch to pilot override for pitch if (!is_zero(target_pitch)) { // init transition to pilot override poshold_pitch_controller_to_pilot_override(); // if roll not overriden switch roll-mode to brake (but be ready to go back to loiter any time) if (is_zero(target_roll)) { poshold.roll_mode = POSHOLD_BRAKE_READY_TO_LOITER; poshold.brake_roll = 0; } } } break; default: // do nothing for uncombined roll and pitch modes break; } } // constrain target pitch/roll angles poshold.roll = constrain_int16(poshold.roll, -aparm.angle_max, aparm.angle_max); poshold.pitch = constrain_int16(poshold.pitch, -aparm.angle_max, aparm.angle_max); // update attitude controller targets attitude_control.input_euler_angle_roll_pitch_euler_rate_yaw(poshold.roll, poshold.pitch, target_yaw_rate); // throttle control if (sonar_enabled && (sonar_alt_health >= SONAR_ALT_HEALTH_MAX)) { // if sonar is ok, use surface tracking target_climb_rate = get_surface_tracking_climb_rate(target_climb_rate, pos_control.get_alt_target(), G_Dt); } // update altitude target and call position controller pos_control.set_alt_target_from_climb_rate_ff(target_climb_rate, G_Dt, false); pos_control.add_takeoff_climb_rate(takeoff_climb_rate, G_Dt); pos_control.update_z_controller(); } } // poshold_update_pilot_lean_angle - update the pilot's filtered lean angle with the latest raw input received void Copter::poshold_update_pilot_lean_angle(float &lean_angle_filtered, float &lean_angle_raw) { // if raw input is large or reversing the vehicle's lean angle immediately set the fitlered angle to the new raw angle if ((lean_angle_filtered > 0 && lean_angle_raw < 0) || (lean_angle_filtered < 0 && lean_angle_raw > 0) || (fabsf(lean_angle_raw) > POSHOLD_STICK_RELEASE_SMOOTH_ANGLE)) { lean_angle_filtered = lean_angle_raw; } else { // lean_angle_raw must be pulling lean_angle_filtered towards zero, smooth the decrease if (lean_angle_filtered > 0) { // reduce the filtered lean angle at 5% or the brake rate (whichever is faster). lean_angle_filtered -= MAX((float)lean_angle_filtered * POSHOLD_SMOOTH_RATE_FACTOR, MAX(1, g.poshold_brake_rate/LOOP_RATE_FACTOR)); // do not let the filtered angle fall below the pilot's input lean angle. // the above line pulls the filtered angle down and the below line acts as a catch lean_angle_filtered = MAX(lean_angle_filtered, lean_angle_raw); }else{ lean_angle_filtered += MAX(-(float)lean_angle_filtered * POSHOLD_SMOOTH_RATE_FACTOR, MAX(1, g.poshold_brake_rate/LOOP_RATE_FACTOR)); lean_angle_filtered = MIN(lean_angle_filtered, lean_angle_raw); } } } // poshold_mix_controls - mixes two controls based on the mix_ratio // mix_ratio of 1 = use first_control completely, 0 = use second_control completely, 0.5 = mix evenly int16_t Copter::poshold_mix_controls(float mix_ratio, int16_t first_control, int16_t second_control) { mix_ratio = constrain_float(mix_ratio, 0.0f, 1.0f); return (int16_t)((mix_ratio * first_control) + ((1.0f-mix_ratio)*second_control)); } // poshold_update_brake_angle_from_velocity - updates the brake_angle based on the vehicle's velocity and brake_gain // brake_angle is slewed with the wpnav.poshold_brake_rate and constrained by the wpnav.poshold_braking_angle_max // velocity is assumed to be in the same direction as lean angle so for pitch you should provide the velocity backwards (i.e. -ve forward velocity) void Copter::poshold_update_brake_angle_from_velocity(int16_t &brake_angle, float velocity) { float lean_angle; int16_t brake_rate = g.poshold_brake_rate; brake_rate /= 4; if (brake_rate <= 0) { brake_rate = 1; } // calculate velocity-only based lean angle if (velocity >= 0) { lean_angle = -poshold.brake_gain * velocity * (1.0f+500.0f/(velocity+60.0f)); } else { lean_angle = -poshold.brake_gain * velocity * (1.0f+500.0f/(-velocity+60.0f)); } // do not let lean_angle be too far from brake_angle brake_angle = constrain_int16((int16_t)lean_angle, brake_angle - brake_rate, brake_angle + brake_rate); // constrain final brake_angle brake_angle = constrain_int16(brake_angle, -g.poshold_brake_angle_max, g.poshold_brake_angle_max); } // poshold_update_wind_comp_estimate - updates wind compensation estimate // should be called at the maximum loop rate when loiter is engaged void Copter::poshold_update_wind_comp_estimate() { // check wind estimate start has not been delayed if (poshold.wind_comp_start_timer > 0) { poshold.wind_comp_start_timer--; return; } // check horizontal velocity is low if (inertial_nav.get_velocity_xy() > POSHOLD_WIND_COMP_ESTIMATE_SPEED_MAX) { return; } // get position controller accel target // To-Do: clean this up by using accessor in loiter controller (or move entire PosHold controller to a library shared with loiter) const Vector3f& accel_target = pos_control.get_accel_target(); // update wind compensation in earth-frame lean angles if (is_zero(poshold.wind_comp_ef.x)) { // if wind compensation has not been initialised set it immediately to the pos controller's desired accel in north direction poshold.wind_comp_ef.x = accel_target.x; } else { // low pass filter the position controller's lean angle output poshold.wind_comp_ef.x = (1.0f-TC_WIND_COMP)*poshold.wind_comp_ef.x + TC_WIND_COMP*accel_target.x; } if (is_zero(poshold.wind_comp_ef.y)) { // if wind compensation has not been initialised set it immediately to the pos controller's desired accel in north direction poshold.wind_comp_ef.y = accel_target.y; } else { // low pass filter the position controller's lean angle output poshold.wind_comp_ef.y = (1.0f-TC_WIND_COMP)*poshold.wind_comp_ef.y + TC_WIND_COMP*accel_target.y; } } // poshold_get_wind_comp_lean_angles - retrieve wind compensation angles in body frame roll and pitch angles // should be called at the maximum loop rate void Copter::poshold_get_wind_comp_lean_angles(int16_t &roll_angle, int16_t &pitch_angle) { // reduce rate to 10hz poshold.wind_comp_timer++; if (poshold.wind_comp_timer < POSHOLD_WIND_COMP_TIMER_10HZ) { return; } poshold.wind_comp_timer = 0; // convert earth frame desired accelerations to body frame roll and pitch lean angles roll_angle = atanf((-poshold.wind_comp_ef.x*ahrs.sin_yaw() + poshold.wind_comp_ef.y*ahrs.cos_yaw())/981)*(18000/M_PI); pitch_angle = atanf(-(poshold.wind_comp_ef.x*ahrs.cos_yaw() + poshold.wind_comp_ef.y*ahrs.sin_yaw())/981)*(18000/M_PI); } // poshold_roll_controller_to_pilot_override - initialises transition from a controller submode (brake or loiter) to a pilot override on roll axis void Copter::poshold_roll_controller_to_pilot_override() { poshold.roll_mode = POSHOLD_CONTROLLER_TO_PILOT_OVERRIDE; poshold.controller_to_pilot_timer_roll = POSHOLD_CONTROLLER_TO_PILOT_MIX_TIMER; // initialise pilot_roll to 0, wind_comp will be updated to compensate and poshold_update_pilot_lean_angle function shall not smooth this transition at next iteration. so 0 is the right value poshold.pilot_roll = 0; // store final controller output for mixing with pilot input poshold.controller_final_roll = poshold.roll; } // poshold_pitch_controller_to_pilot_override - initialises transition from a controller submode (brake or loiter) to a pilot override on roll axis void Copter::poshold_pitch_controller_to_pilot_override() { poshold.pitch_mode = POSHOLD_CONTROLLER_TO_PILOT_OVERRIDE; poshold.controller_to_pilot_timer_pitch = POSHOLD_CONTROLLER_TO_PILOT_MIX_TIMER; // initialise pilot_pitch to 0, wind_comp will be updated to compensate and poshold_update_pilot_lean_angle function shall not smooth this transition at next iteration. so 0 is the right value poshold.pilot_pitch = 0; // store final loiter outputs for mixing with pilot input poshold.controller_final_pitch = poshold.pitch; } #endif // POSHOLD_ENABLED == ENABLED
koustubh-dwivedy/ardupilot
ArduCopter/control_poshold.cpp
C++
gpl-3.0
38,032
/* * Copyright 2010-2016 OpenXcom Developers. * * This file is part of OpenXcom. * * OpenXcom 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. * * OpenXcom 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 OpenXcom. If not, see <http://www.gnu.org/licenses/>. */ #include <assert.h> #include <climits> #include <set> #include "TileEngine.h" #include <SDL.h> #include "AIModule.h" #include "Map.h" #include "Camera.h" #include "Projectile.h" #include "../Savegame/SavedGame.h" #include "../Savegame/SavedBattleGame.h" #include "ExplosionBState.h" #include "../Savegame/Tile.h" #include "../Savegame/BattleItem.h" #include "../Savegame/BattleUnit.h" #include "../Engine/RNG.h" #include "BattlescapeState.h" #include "../Mod/MapDataSet.h" #include "../Mod/Unit.h" #include "../Mod/Mod.h" #include "../Mod/Armor.h" #include "Pathfinding.h" #include "../Engine/Options.h" #include "ProjectileFlyBState.h" #include "MeleeAttackBState.h" #include "../fmath.h" namespace OpenXcom { const int TileEngine::heightFromCenter[11] = {0,-2,+2,-4,+4,-6,+6,-8,+8,-12,+12}; /** * Sets up a TileEngine. * @param save Pointer to SavedBattleGame object. * @param voxelData List of voxel data. */ TileEngine::TileEngine(SavedBattleGame *save, std::vector<Uint16> *voxelData) : _save(save), _voxelData(voxelData), _personalLighting(true), _cacheTile(0), _cacheTileBelow(0) { _cacheTilePos = Position(-1,-1,-1); } /** * Deletes the TileEngine. */ TileEngine::~TileEngine() { } /** * Calculates sun shading for the whole terrain. */ void TileEngine::calculateSunShading() { const int layer = 0; // Ambient lighting layer. for (int i = 0; i < _save->getMapSizeXYZ(); ++i) { _save->getTiles()[i]->resetLight(layer); calculateSunShading(_save->getTiles()[i]); } } /** * Calculates sun shading for 1 tile. Sun comes from above and is blocked by floors or objects. * TODO: angle the shadow according to the time? - link to Options::globeSeasons (or whatever the realistic lighting one is) * @param tile The tile to calculate sun shading for. */ void TileEngine::calculateSunShading(Tile *tile) { const int layer = 0; // Ambient lighting layer. int power = 15 - _save->getGlobalShade(); // At night/dusk sun isn't dropping shades blocked by roofs if (_save->getGlobalShade() <= 4) { int block = 0; int x = tile->getPosition().x; int y = tile->getPosition().y; for (int z = _save->getMapSizeZ()-1; z > tile->getPosition().z ; z--) { block += blockage(_save->getTile(Position(x, y, z)), O_FLOOR, DT_NONE); block += blockage(_save->getTile(Position(x, y, z)), O_OBJECT, DT_NONE, Pathfinding::DIR_DOWN); } if (block>0) { power -= 2; } } tile->addLight(power, layer); } /** * Recalculates lighting for the terrain: objects,items,fire. */ void TileEngine::calculateTerrainLighting() { const int layer = 1; // Static lighting layer. const int fireLightPower = 15; // amount of light a fire generates // reset all light to 0 first for (int i = 0; i < _save->getMapSizeXYZ(); ++i) { _save->getTiles()[i]->resetLight(layer); } // add lighting of terrain for (int i = 0; i < _save->getMapSizeXYZ(); ++i) { // only floors and objects can light up if (_save->getTiles()[i]->getMapData(O_FLOOR) && _save->getTiles()[i]->getMapData(O_FLOOR)->getLightSource()) { addLight(_save->getTiles()[i]->getPosition(), _save->getTiles()[i]->getMapData(O_FLOOR)->getLightSource(), layer); } if (_save->getTiles()[i]->getMapData(O_OBJECT) && _save->getTiles()[i]->getMapData(O_OBJECT)->getLightSource()) { addLight(_save->getTiles()[i]->getPosition(), _save->getTiles()[i]->getMapData(O_OBJECT)->getLightSource(), layer); } // fires if (_save->getTiles()[i]->getFire()) { addLight(_save->getTiles()[i]->getPosition(), fireLightPower, layer); } for (std::vector<BattleItem*>::iterator it = _save->getTiles()[i]->getInventory()->begin(); it != _save->getTiles()[i]->getInventory()->end(); ++it) { if ((*it)->getRules()->getBattleType() == BT_FLARE) { addLight(_save->getTiles()[i]->getPosition(), (*it)->getRules()->getPower(), layer); } } } } /** * Recalculates lighting for the units. */ void TileEngine::calculateUnitLighting() { const int layer = 2; // Dynamic lighting layer. const int personalLightPower = 15; // amount of light a unit generates const int fireLightPower = 15; // amount of light a fire generates // reset all light to 0 first for (int i = 0; i < _save->getMapSizeXYZ(); ++i) { _save->getTiles()[i]->resetLight(layer); } for (std::vector<BattleUnit*>::iterator i = _save->getUnits()->begin(); i != _save->getUnits()->end(); ++i) { // add lighting of soldiers if (_personalLighting && (*i)->getFaction() == FACTION_PLAYER && !(*i)->isOut()) { addLight((*i)->getPosition(), personalLightPower, layer); } // add lighting of units on fire if ((*i)->getFire()) { addLight((*i)->getPosition(), fireLightPower, layer); } } } /** * Adds circular light pattern starting from center and losing power with distance travelled. * @param center Center. * @param power Power. * @param layer Light is separated in 3 layers: Ambient, Static and Dynamic. */ void TileEngine::addLight(Position center, int power, int layer) { // only loop through the positive quadrant. for (int x = 0; x <= power; ++x) { for (int y = 0; y <= power; ++y) { for (int z = 0; z < _save->getMapSizeZ(); z++) { int distance = (int)Round(sqrt(float(x*x + y*y))); if (_save->getTile(Position(center.x + x,center.y + y, z))) _save->getTile(Position(center.x + x,center.y + y, z))->addLight(power - distance, layer); if (_save->getTile(Position(center.x - x,center.y - y, z))) _save->getTile(Position(center.x - x,center.y - y, z))->addLight(power - distance, layer); if (_save->getTile(Position(center.x - x,center.y + y, z))) _save->getTile(Position(center.x - x,center.y + y, z))->addLight(power - distance, layer); if (_save->getTile(Position(center.x + x,center.y - y, z))) _save->getTile(Position(center.x + x,center.y - y, z))->addLight(power - distance, layer); } } } } /** * Calculates line of sight of a soldier. * @param unit Unit to check line of sight of. * @return True when new aliens are spotted. */ bool TileEngine::calculateFOV(BattleUnit *unit) { size_t oldNumVisibleUnits = unit->getUnitsSpottedThisTurn().size(); Position center = unit->getPosition(); Position test; int direction; bool swap; std::vector<Position> _trajectory; if (Options::strafe && (unit->getTurretType() > -1)) { direction = unit->getTurretDirection(); } else { direction = unit->getDirection(); } swap = (direction==0 || direction==4); int signX[8] = { +1, +1, +1, +1, -1, -1, -1, -1 }; int signY[8] = { -1, -1, -1, +1, +1, +1, -1, -1 }; int y1, y2; unit->clearVisibleUnits(); unit->clearVisibleTiles(); if (unit->isOut()) return false; Position pos = unit->getPosition(); if ((unit->getHeight() + unit->getFloatHeight() + -_save->getTile(unit->getPosition())->getTerrainLevel()) >= 24 + 4) { Tile *tileAbove = _save->getTile(pos + Position(0,0,1)); if (tileAbove && tileAbove->hasNoFloor(0)) { ++pos.z; } } for (int x = 0; x <= MAX_VIEW_DISTANCE; ++x) { if (direction%2) { y1 = 0; y2 = MAX_VIEW_DISTANCE; } else { y1 = -x; y2 = x; } for (int y = y1; y <= y2; ++y) { for (int z = 0; z < _save->getMapSizeZ(); z++) { const int distanceSqr = x*x + y*y; test.z = z; if (distanceSqr <= MAX_VIEW_DISTANCE_SQR) { test.x = center.x + signX[direction]*(swap?y:x); test.y = center.y + signY[direction]*(swap?x:y); if (_save->getTile(test)) { BattleUnit *visibleUnit = _save->getTile(test)->getUnit(); if (visibleUnit && !visibleUnit->isOut() && visible(unit, _save->getTile(test))) { if (unit->getFaction() == FACTION_PLAYER) { visibleUnit->getTile()->setVisible(+1); visibleUnit->setVisible(true); } if ((visibleUnit->getFaction() == FACTION_HOSTILE && unit->getFaction() == FACTION_PLAYER) || (visibleUnit->getFaction() != FACTION_HOSTILE && unit->getFaction() == FACTION_HOSTILE)) { unit->addToVisibleUnits(visibleUnit); unit->addToVisibleTiles(visibleUnit->getTile()); if (unit->getFaction() == FACTION_HOSTILE && visibleUnit->getFaction() != FACTION_HOSTILE) { visibleUnit->setTurnsSinceSpotted(0); } } } if (unit->getFaction() == FACTION_PLAYER) { // this sets tiles to discovered if they are in LOS - tile visibility is not calculated in voxelspace but in tilespace // large units have "4 pair of eyes" int size = unit->getArmor()->getSize(); for (int xo = 0; xo < size; xo++) { for (int yo = 0; yo < size; yo++) { Position poso = pos + Position(xo,yo,0); _trajectory.clear(); int tst = calculateLine(poso, test, true, &_trajectory, unit, false); size_t tsize = _trajectory.size(); if (tst>127) --tsize; //last tile is blocked thus must be cropped for (size_t i = 0; i < tsize; i++) { Position posi = _trajectory.at(i); //mark every tile of line as visible (as in original) //this is needed because of bresenham narrow stroke. _save->getTile(posi)->setVisible(+1); _save->getTile(posi)->setDiscovered(true, 2); // walls to the east or south of a visible tile, we see that too Tile* t = _save->getTile(Position(posi.x + 1, posi.y, posi.z)); if (t) t->setDiscovered(true, 0); t = _save->getTile(Position(posi.x, posi.y + 1, posi.z)); if (t) t->setDiscovered(true, 1); } } } } } } } } } // we only react when there are at least the same amount of visible units as before AND the checksum is different // this way we stop if there are the same amount of visible units, but a different unit is seen // or we stop if there are more visible units seen if (unit->getUnitsSpottedThisTurn().size() > oldNumVisibleUnits && !unit->getVisibleUnits()->empty()) { return true; } return false; } /** * Gets the origin voxel of a unit's eyesight (from just one eye or something? Why is it x+7?? * @param currentUnit The watcher. * @return Approximately an eyeball voxel. */ Position TileEngine::getSightOriginVoxel(BattleUnit *currentUnit) { // determine the origin and target voxels for the raytrace Position originVoxel; originVoxel = Position((currentUnit->getPosition().x * 16) + 7, (currentUnit->getPosition().y * 16) + 8, currentUnit->getPosition().z*24); originVoxel.z += -_save->getTile(currentUnit->getPosition())->getTerrainLevel(); originVoxel.z += currentUnit->getHeight() + currentUnit->getFloatHeight() - 1; //one voxel lower (eye level) Tile *tileAbove = _save->getTile(currentUnit->getPosition() + Position(0,0,1)); if (currentUnit->getArmor()->getSize() > 1) { originVoxel.x += 8; originVoxel.y += 8; originVoxel.z += 1; //topmost voxel } if (originVoxel.z >= (currentUnit->getPosition().z + 1)*24 && (!tileAbove || !tileAbove->hasNoFloor(0))) { while (originVoxel.z >= (currentUnit->getPosition().z + 1)*24) { originVoxel.z--; } } return originVoxel; } /** * Checks for an opposing unit on this tile. * @param currentUnit The watcher. * @param tile The tile to check for * @return True if visible. */ bool TileEngine::visible(BattleUnit *currentUnit, Tile *tile) { // if there is no tile or no unit, we can't see it if (!tile || !tile->getUnit()) { return false; } // aliens can see in the dark, xcom can see at a distance of 9 or less, further if there's enough light. if ((currentUnit->getFaction() == FACTION_PLAYER && distance(currentUnit->getPosition(), tile->getPosition()) > 9 && tile->getShade() > MAX_DARKNESS_TO_SEE_UNITS) || distance(currentUnit->getPosition(), tile->getPosition()) > MAX_VIEW_DISTANCE) { return false; } if (currentUnit->getFaction() == tile->getUnit()->getFaction()) return true; // friendlies are always seen Position originVoxel = getSightOriginVoxel(currentUnit); bool unitSeen = false; // for large units origin voxel is in the middle Position scanVoxel; std::vector<Position> _trajectory; unitSeen = canTargetUnit(&originVoxel, tile, &scanVoxel, currentUnit, false); if (unitSeen) { // now check if we really see it taking into account smoke tiles // initial smoke "density" of a smoke grenade is around 15 per tile // we do density/3 to get the decay of visibility // so in fresh smoke we should only have 4 tiles of visibility // this is traced in voxel space, with smoke affecting visibility every step of the way _trajectory.clear(); calculateLine(originVoxel, scanVoxel, true, &_trajectory, currentUnit); Tile *t = _save->getTile(currentUnit->getPosition()); size_t visibleDistance = _trajectory.size(); for (size_t i = 0; i < _trajectory.size(); i++) { if (t != _save->getTile(Position(_trajectory.at(i).x/16,_trajectory.at(i).y/16, _trajectory.at(i).z/24))) { t = _save->getTile(Position(_trajectory.at(i).x/16,_trajectory.at(i).y/16, _trajectory.at(i).z/24)); } if (t->getFire() == 0) { visibleDistance += t->getSmoke() / 3; } if (visibleDistance > (unsigned)MAX_VOXEL_VIEW_DISTANCE) { unitSeen = false; break; } } } return unitSeen; } /** * Checks for how exposed unit is for another unit. * @param originVoxel Voxel of trace origin (eye or gun's barrel). * @param tile The tile to check for. * @param excludeUnit Is self (not to hit self). * @param excludeAllBut [Optional] is unit which is the only one to be considered for ray hits. * @return Degree of exposure (as percent). */ int TileEngine::checkVoxelExposure(Position *originVoxel, Tile *tile, BattleUnit *excludeUnit, BattleUnit *excludeAllBut) { Position targetVoxel = Position((tile->getPosition().x * 16) + 7, (tile->getPosition().y * 16) + 8, tile->getPosition().z * 24); Position scanVoxel; std::vector<Position> _trajectory; BattleUnit *otherUnit = tile->getUnit(); if (otherUnit == 0) return 0; //no unit in this tile, even if it elevated and appearing in it. if (otherUnit == excludeUnit) return 0; //skip self int targetMinHeight = targetVoxel.z - tile->getTerrainLevel(); if (otherUnit) targetMinHeight += otherUnit->getFloatHeight(); // if there is an other unit on target tile, we assume we want to check against this unit's height int heightRange; int unitRadius = otherUnit->getLoftemps(); //width == loft in default loftemps set if (otherUnit->getArmor()->getSize() > 1) { unitRadius = 3; } // vector manipulation to make scan work in view-space Position relPos = targetVoxel - *originVoxel; float normal = unitRadius/sqrt((float)(relPos.x*relPos.x + relPos.y*relPos.y)); int relX = floor(((float)relPos.y)*normal+0.5); int relY = floor(((float)-relPos.x)*normal+0.5); int sliceTargets[] = {0,0, relX,relY, -relX,-relY}; if (!otherUnit->isOut()) { heightRange = otherUnit->getHeight(); } else { heightRange = 12; } int targetMaxHeight=targetMinHeight+heightRange; // scan ray from top to bottom plus different parts of target cylinder int total=0; int visible=0; for (int i = heightRange; i >=0; i-=2) { ++total; scanVoxel.z=targetMinHeight+i; for (int j = 0; j < 3; ++j) { scanVoxel.x=targetVoxel.x + sliceTargets[j*2]; scanVoxel.y=targetVoxel.y + sliceTargets[j*2+1]; _trajectory.clear(); int test = calculateLine(*originVoxel, scanVoxel, false, &_trajectory, excludeUnit, true, false, excludeAllBut); if (test == V_UNIT) { //voxel of hit must be inside of scanned box if (_trajectory.at(0).x/16 == scanVoxel.x/16 && _trajectory.at(0).y/16 == scanVoxel.y/16 && _trajectory.at(0).z >= targetMinHeight && _trajectory.at(0).z <= targetMaxHeight) { ++visible; } } } } return (visible*100)/total; } /** * Checks for another unit available for targeting and what particular voxel. * @param originVoxel Voxel of trace origin (eye or gun's barrel). * @param tile The tile to check for. * @param scanVoxel is returned coordinate of hit. * @param excludeUnit is self (not to hit self). * @param rememberObstacles Remember obstacles for no LOF indicator? * @param potentialUnit is a hypothetical unit to draw a virtual line of fire for AI. if left blank, this function behaves normally. * @return True if the unit can be targetted. */ bool TileEngine::canTargetUnit(Position *originVoxel, Tile *tile, Position *scanVoxel, BattleUnit *excludeUnit, bool rememberObstacles, BattleUnit *potentialUnit) { Position targetVoxel = Position((tile->getPosition().x * 16) + 7, (tile->getPosition().y * 16) + 8, tile->getPosition().z * 24); std::vector<Position> _trajectory; bool hypothetical = potentialUnit != 0; if (potentialUnit == 0) { potentialUnit = tile->getUnit(); if (potentialUnit == 0) return false; //no unit in this tile, even if it elevated and appearing in it. } if (potentialUnit == excludeUnit) return false; //skip self int targetMinHeight = targetVoxel.z - tile->getTerrainLevel(); targetMinHeight += potentialUnit->getFloatHeight(); int targetMaxHeight = targetMinHeight; int targetCenterHeight; // if there is an other unit on target tile, we assume we want to check against this unit's height int heightRange; int unitRadius = potentialUnit->getLoftemps(); //width == loft in default loftemps set int targetSize = potentialUnit->getArmor()->getSize() - 1; int xOffset = potentialUnit->getPosition().x - tile->getPosition().x; int yOffset = potentialUnit->getPosition().y - tile->getPosition().y; if (targetSize > 0) { unitRadius = 3; } // vector manipulation to make scan work in view-space Position relPos = targetVoxel - *originVoxel; float normal = unitRadius/sqrt((float)(relPos.x*relPos.x + relPos.y*relPos.y)); int relX = floor(((float)relPos.y)*normal+0.5); int relY = floor(((float)-relPos.x)*normal+0.5); int sliceTargets[] = {0,0, relX,relY, -relX,-relY, relY,-relX, -relY,relX}; if (!potentialUnit->isOut()) { heightRange = potentialUnit->getHeight(); } else { heightRange = 12; } targetMaxHeight += heightRange; targetCenterHeight=(targetMaxHeight+targetMinHeight)/2; heightRange/=2; if (heightRange>10) heightRange=10; if (heightRange<=0) heightRange=0; // scan ray from top to bottom plus different parts of target cylinder for (int i = 0; i <= heightRange; ++i) { scanVoxel->z=targetCenterHeight+heightFromCenter[i]; for (int j = 0; j < 5; ++j) { if (i < (heightRange-1) && j>2) break; //skip unnecessary checks scanVoxel->x=targetVoxel.x + sliceTargets[j*2]; scanVoxel->y=targetVoxel.y + sliceTargets[j*2+1]; _trajectory.clear(); int test = calculateLine(*originVoxel, *scanVoxel, false, &_trajectory, excludeUnit, true, false); if (test == V_UNIT) { for (int x = 0; x <= targetSize; ++x) { for (int y = 0; y <= targetSize; ++y) { //voxel of hit must be inside of scanned box if (_trajectory.at(0).x/16 == (scanVoxel->x/16) + x + xOffset && _trajectory.at(0).y/16 == (scanVoxel->y/16) + y + yOffset && _trajectory.at(0).z >= targetMinHeight && _trajectory.at(0).z <= targetMaxHeight) { return true; } } } } else if (test == V_EMPTY && hypothetical && !_trajectory.empty()) { return true; } if (rememberObstacles && _trajectory.size()>0) { Tile *tileObstacle = _save->getTile(Position(_trajectory.at(0).x / 16, _trajectory.at(0).y / 16, _trajectory.at(0).z / 24)); if (tileObstacle) tileObstacle->setObstacle(test); } } } return false; } /** * Checks for a tile part available for targeting and what particular voxel. * @param originVoxel Voxel of trace origin (gun's barrel). * @param tile The tile to check for. * @param part Tile part to check for. * @param scanVoxel Is returned coordinate of hit. * @param excludeUnit Is self (not to hit self). * @param rememberObstacles Remember obstacles for no LOF indicator? * @return True if the tile can be targetted. */ bool TileEngine::canTargetTile(Position *originVoxel, Tile *tile, int part, Position *scanVoxel, BattleUnit *excludeUnit, bool rememberObstacles) { static int sliceObjectSpiral[82] = {8,8, 8,6, 10,6, 10,8, 10,10, 8,10, 6,10, 6,8, 6,6, //first circle 8,4, 10,4, 12,4, 12,6, 12,8, 12,10, 12,12, 10,12, 8,12, 6,12, 4,12, 4,10, 4,8, 4,6, 4,4, 6,4, //second circle 8,1, 12,1, 15,1, 15,4, 15,8, 15,12, 15,15, 12,15, 8,15, 4,15, 1,15, 1,12, 1,8, 1,4, 1,1, 4,1}; //third circle static int westWallSpiral[14] = {0,7, 0,9, 0,6, 0,11, 0,4, 0,13, 0,2}; static int northWallSpiral[14] = {7,0, 9,0, 6,0, 11,0, 4,0, 13,0, 2,0}; Position targetVoxel = Position((tile->getPosition().x * 16), (tile->getPosition().y * 16), tile->getPosition().z * 24); std::vector<Position> _trajectory; int *spiralArray; int spiralCount; int minZ = 0, maxZ = 0; bool minZfound = false, maxZfound = false; bool dummy = false; if (part == O_OBJECT) { spiralArray = sliceObjectSpiral; spiralCount = 41; } else if (part == O_NORTHWALL) { spiralArray = northWallSpiral; spiralCount = 7; } else if (part == O_WESTWALL) { spiralArray = westWallSpiral; spiralCount = 7; } else if (part == O_FLOOR) { spiralArray = sliceObjectSpiral; spiralCount = 41; minZfound = true; minZ=0; maxZfound = true; maxZ=0; } else if (part == MapData::O_DUMMY) // used only for no line of fire indicator { spiralArray = sliceObjectSpiral; spiralCount = 41; minZfound = true; minZ = 12; maxZfound = true; maxZ = 12; } else { return false; } voxelCheckFlush(); // find out height range if (!minZfound) { for (int j = 1; j < 12; ++j) { if (minZfound) break; for (int i = 0; i < spiralCount; ++i) { int tX = spiralArray[i*2]; int tY = spiralArray[i*2+1]; if (voxelCheck(Position(targetVoxel.x + tX, targetVoxel.y + tY, targetVoxel.z + j*2),0,true) == part) //bingo { if (!minZfound) { minZ = j*2; minZfound = true; break; } } } } } if (!minZfound) { if (rememberObstacles) { // dummy attempt (only to highlight obstacles) minZfound = true; minZ = 10; dummy = true; } else { return false;//empty object!!! } } if (!maxZfound) { for (int j = 10; j >= 0; --j) { if (maxZfound) break; for (int i = 0; i < spiralCount; ++i) { int tX = spiralArray[i*2]; int tY = spiralArray[i*2+1]; if (voxelCheck(Position(targetVoxel.x + tX, targetVoxel.y + tY, targetVoxel.z + j*2),0,true) == part) //bingo { if (!maxZfound) { maxZ = j*2; maxZfound = true; break; } } } } } if (!maxZfound) { if (rememberObstacles) { // dummy attempt (only to highlight obstacles) maxZfound = true; maxZ = 10; dummy = true; } else { return false;//it's impossible to get there } } if (minZ > maxZ) minZ = maxZ; int rangeZ = maxZ - minZ; if (rangeZ>10) rangeZ = 10; //as above, clamping height range to prevent buffer overflow int centerZ = (maxZ + minZ)/2; for (int j = 0; j <= rangeZ; ++j) { scanVoxel->z = targetVoxel.z + centerZ + heightFromCenter[j]; for (int i = 0; i < spiralCount; ++i) { scanVoxel->x = targetVoxel.x + spiralArray[i*2]; scanVoxel->y = targetVoxel.y + spiralArray[i*2+1]; _trajectory.clear(); int test = calculateLine(*originVoxel, *scanVoxel, false, &_trajectory, excludeUnit, true); if (test == part && !dummy) //bingo { if (_trajectory.at(0).x/16 == scanVoxel->x/16 && _trajectory.at(0).y/16 == scanVoxel->y/16 && _trajectory.at(0).z/24 == scanVoxel->z/24) { return true; } } if (rememberObstacles && _trajectory.size()>0) { Tile *tileObstacle = _save->getTile(Position(_trajectory.at(0).x / 16, _trajectory.at(0).y / 16, _trajectory.at(0).z / 24)); if (tileObstacle) tileObstacle->setObstacle(test); } } } return false; } /** * Calculates line of sight of a soldiers within range of the Position * (used when terrain has changed, which can reveal new parts of terrain or units). * @param position Position of the changed terrain. */ void TileEngine::calculateFOV(Position position) { for (std::vector<BattleUnit*>::iterator i = _save->getUnits()->begin(); i != _save->getUnits()->end(); ++i) { if (distanceSq(position, (*i)->getPosition()) <= MAX_VIEW_DISTANCE_SQR) { calculateFOV(*i); } } } /** * Checks if a sniper from the opposing faction sees this unit. The unit with the highest reaction score will be compared with the current unit's reaction score. * If it's higher, a shot is fired when enough time units, a weapon and ammo are available. * @param unit The unit to check reaction fire upon. * @return True if reaction fire took place. */ bool TileEngine::checkReactionFire(BattleUnit *unit) { // reaction fire only triggered when the actioning unit is of the currently playing side, and is still on the map (alive) if (unit->getFaction() != _save->getSide() || unit->getTile() == 0) { return false; } std::vector<std::pair<BattleUnit *, int> > spotters = getSpottingUnits(unit); bool result = false; // not mind controlled, or controlled by the player if (unit->getFaction() == unit->getOriginalFaction() || unit->getFaction() != FACTION_HOSTILE) { // get the first man up to bat. int attackType; BattleUnit *reactor = getReactor(spotters, attackType, unit); // start iterating through the possible reactors until the current unit is the one with the highest score. while (reactor != unit) { if (!tryReaction(reactor, unit, attackType)) { // can't make a reaction snapshot for whatever reason, boot this guy from the vector. for (std::vector<std::pair<BattleUnit *, int> >::iterator i = spotters.begin(); i != spotters.end(); ++i) { if ((*i).first == reactor) { spotters.erase(i); break; } } // avoid setting result to true, but carry on, just cause one unit can't react doesn't mean the rest of the units in the vector (if any) can't reactor = getReactor(spotters, attackType, unit); continue; } // nice shot, kid. don't get cocky. reactor = getReactor(spotters, attackType, unit); result = true; } } return result; } /** * Creates a vector of units that can spot this unit. * @param unit The unit to check for spotters of. * @return A vector of units that can see this unit. */ std::vector<std::pair<BattleUnit *, int> > TileEngine::getSpottingUnits(BattleUnit* unit) { std::vector<std::pair<BattleUnit *, int> > spotters; Tile *tile = unit->getTile(); // no reaction on civilian turn. if (_save->getSide() != FACTION_NEUTRAL) { for (std::vector<BattleUnit*>::const_iterator i = _save->getUnits()->begin(); i != _save->getUnits()->end(); ++i) { // not dead/unconscious if (!(*i)->isOut() && // not dying (*i)->getHealth() != 0 && // not about to pass out (*i)->getStunlevel() < (*i)->getHealth() && // not a friend (*i)->getFaction() != _save->getSide() && // not a civilian (*i)->getFaction() != FACTION_NEUTRAL && // closer than 20 tiles distanceSq(unit->getPosition(), (*i)->getPosition()) <= MAX_VIEW_DISTANCE_SQR) { BattleAction falseAction; falseAction.type = BA_SNAPSHOT; falseAction.actor = *i; falseAction.target = unit->getPosition(); Position originVoxel = getOriginVoxel(falseAction, 0); Position targetVoxel; AIModule *ai = (*i)->getAIModule(); // Inquisitor's note regarding 'gotHit' variable // in vanilla, the 'hitState' flag is the only part of this equation that comes into play. // any time a unit takes damage, this flag is set, then it would be reset by a call to // a function analogous to SavedBattleGame::resetUnitHitStates(), any time: // 1: a unit was selected by being clicked on. // 2: either "next unit" button was pressed. // 3: the inventory screen was accessed. (i didn't look too far into this one, it's possible it's only called in the pre-mission equip screen) // 4: the same place where we call it, immediately before every move the AI makes. // this flag is responsible for units turning around to respond to hits, and is in keeping with the details listed on http://www.ufopaedia.org/index.php/Reaction_fire_triggers // we've gone for a slightly different implementation: AI units keep a list of which units have hit them and don't forget until the end of the player's turn. // this method is in keeping with the spirit of the original feature, but much less exploitable by players. // the hitState flag in our implementation allows player units to turn and react as they did in the original, (which is far less cumbersome than giving them all an AI module) // we don't extend the same "enhanced aggressor memory" courtesy to players, because in the original, they could only turn and react to damage immediately after it happened. // this is because as much as we want the player's soldiers dead, we don't want them to feel like we're being unfair about it. bool gotHit = (ai != 0 && ai->getWasHitBy(unit->getId())) || (ai == 0 && (*i)->getHitState()); // can actually see the target Tile, or we got hit if (((*i)->checkViewSector(unit->getPosition()) || gotHit) && // can actually target the unit canTargetUnit(&originVoxel, tile, &targetVoxel, *i, false) && // can actually see the unit visible(*i, tile)) { if ((*i)->getFaction() == FACTION_PLAYER) { unit->setVisible(true); } (*i)->addToVisibleUnits(unit); int attackType = determineReactionType(*i, unit); if (attackType != BA_NONE) { spotters.push_back(std::make_pair(*i, attackType)); } } } } } return spotters; } /** * Gets the unit with the highest reaction score from the spotter vector. * @param spotters The vector of spotting units. * @param unit The unit to check scores against. * @return The unit with the highest reactions. */ BattleUnit* TileEngine::getReactor(std::vector<std::pair<BattleUnit *, int> > spotters, int &attackType, BattleUnit *unit) { int bestScore = -1; BattleUnit *bu = 0; for (std::vector<std::pair<BattleUnit *, int> >::iterator i = spotters.begin(); i != spotters.end(); ++i) { if (!(*i).first->isOut() && !(*i).first->getRespawn() && determineReactionType((*i).first, unit) != BA_NONE && (*i).first->getReactionScore() > bestScore) { bestScore = (*i).first->getReactionScore(); bu = (*i).first; attackType = (*i).second; } } if (unit->getReactionScore() <= bestScore) { if (bu->getOriginalFaction() == FACTION_PLAYER) { bu->addReactionExp(); } } else { bu = unit; attackType = BA_NONE; } return bu; } /** * Checks the validity of a snap shot performed here. * @param unit The unit to check sight from. * @param target The unit to check sight TO. * @return True if the target is valid. */ int TileEngine::determineReactionType(BattleUnit *unit, BattleUnit *target) { // prioritize melee BattleItem *meleeWeapon = unit->getMeleeWeapon(); if (meleeWeapon && // has a melee weapon and is in melee range validMeleeRange(unit, target, unit->getDirection()) && unit->getActionTUs(BA_HIT, meleeWeapon) > 0 && unit->getTimeUnits() > unit->getActionTUs(BA_HIT, meleeWeapon) && (unit->getOriginalFaction() != FACTION_PLAYER || _save->getGeoscapeSave()->isResearched(meleeWeapon->getRules()->getRequirements())) && _save->isItemUsable(meleeWeapon)) { return BA_HIT; } BattleItem *weapon = unit->getMainHandWeapon(unit->getFaction() != FACTION_PLAYER); // has a weapon if (weapon && // has a gun capable of snap shot with ammo (weapon->getRules()->getBattleType() != BT_MELEE && weapon->getRules()->getTUSnap() && distance(unit->getPosition(), target->getPosition()) < weapon->getRules()->getMaxRange() && weapon->getAmmoItem() && unit->getActionTUs(BA_SNAPSHOT, weapon) > 0 && unit->getTimeUnits() > unit->getActionTUs(BA_SNAPSHOT, weapon)) && (unit->getOriginalFaction() != FACTION_PLAYER || _save->getGeoscapeSave()->isResearched(weapon->getRules()->getRequirements())) && _save->isItemUsable(weapon)) { return BA_SNAPSHOT; } return BA_NONE; } /** * Attempts to perform a reaction snap shot. * @param unit The unit to check sight from. * @param target The unit to check sight TO. * @return True if the action should (theoretically) succeed. */ bool TileEngine::tryReaction(BattleUnit *unit, BattleUnit *target, int attackType) { BattleAction action; action.cameraPosition = _save->getBattleState()->getMap()->getCamera()->getMapOffset(); action.actor = unit; if (attackType == BA_HIT) { action.weapon = unit->getMeleeWeapon(); } else { action.weapon = unit->getMainHandWeapon(unit->getFaction() != FACTION_PLAYER); } if (!action.weapon) { return false; } action.type = (BattleActionType)(attackType); action.target = target->getPosition(); action.TU = unit->getActionTUs(action.type, action.weapon); if (action.weapon->getAmmoItem() && action.weapon->getAmmoItem()->getAmmoQuantity() && unit->getTimeUnits() >= action.TU) { action.targeting = true; // hostile units will go into an "aggro" state when they react. if (unit->getFaction() == FACTION_HOSTILE) { AIModule *ai = unit->getAIModule(); if (ai == 0) { // should not happen, but just in case... ai = new AIModule(_save, unit, 0); unit->setAIModule(ai); } if (action.type != BA_HIT && action.weapon->getAmmoItem()->getRules()->getExplosionRadius() && ai->explosiveEfficacy(action.target, unit, action.weapon->getAmmoItem()->getRules()->getExplosionRadius(), -1) == false) { action.targeting = false; } } if (action.targeting && unit->spendTimeUnits(action.TU)) { action.TU = 0; if (action.type == BA_HIT) { _save->getBattleGame()->statePushBack(new MeleeAttackBState(_save->getBattleGame(), action)); } else { _save->getBattleGame()->statePushBack(new ProjectileFlyBState(_save->getBattleGame(), action)); } return true; } } return false; } /** * Handles bullet/weapon hits. * * A bullet/weapon hits a voxel. * @param center Center of the explosion in voxelspace. * @param power Power of the explosion. * @param type The damage type of the explosion. * @param unit The unit that caused the explosion. * @return The Unit that got hit. */ BattleUnit *TileEngine::hit(Position center, int power, ItemDamageType type, BattleUnit *unit) { Tile *tile = _save->getTile(Position(center.x/16, center.y/16, center.z/24)); if (!tile) { return 0; } BattleUnit *bu = tile->getUnit(); int adjustedDamage = 0; voxelCheckFlush(); const int part = voxelCheck(center, unit); if (part >= V_FLOOR && part <= V_OBJECT) { // power 25% to 75% const int rndPower = RNG::generate(power/4, (power*3)/4); if (part == V_OBJECT && rndPower >= tile->getMapData(O_OBJECT)->getArmor() && _save->getMissionType() == "STR_BASE_DEFENSE" && tile->getMapData(O_OBJECT)->isBaseModule()) { _save->getModuleMap()[(center.x/16)/10][(center.y/16)/10].second--; } if (tile->damage((TilePart)part, rndPower, _save->getObjectiveType())) { _save->addDestroyedObjective(); } } else if (part == V_UNIT) { int dmgRng = type == DT_HE ? Mod::EXPLOSIVE_DAMAGE_RANGE : Mod::DAMAGE_RANGE; int min = power * (100 - dmgRng) / 100; int max = power * (100 + dmgRng) / 100; const int rndPower = RNG::generate(min, max); int verticaloffset = 0; if (!bu) { // it's possible we have a unit below the actual tile, when he stands on a stairs and sticks his head out to the next tile Tile *below = _save->getTile(Position(center.x/16, center.y/16, (center.z/24)-1)); if (below) { BattleUnit *buBelow = below->getUnit(); if (buBelow) { bu = buBelow; verticaloffset = 24; } } } if (bu && bu->getHealth() != 0 && bu->getStunlevel() < bu->getHealth()) { const int sz = bu->getArmor()->getSize() * 8; const Position target = bu->getPosition() * Position(16,16,24) + Position(sz,sz, bu->getFloatHeight() - tile->getTerrainLevel()); const Position relative = (center - target) - Position(0,0,verticaloffset); const int wounds = bu->getFatalWounds(); adjustedDamage = bu->damage(relative, rndPower, type); // if it's going to bleed to death and it's not a player, give credit for the kill. if (unit && bu->getFaction() != FACTION_PLAYER && wounds < bu->getFatalWounds()) { bu->killedBy(unit->getFaction()); } const int bravery = (110 - bu->getBaseStats()->bravery) / 10; const int modifier = bu->getFaction() == FACTION_PLAYER ? _save->getMoraleModifier() : 100; const int morale_loss = 100 * (adjustedDamage * bravery / 10) / modifier; bu->moraleChange(-morale_loss); if ((bu->getSpecialAbility() == SPECAB_EXPLODEONDEATH || bu->getSpecialAbility() == SPECAB_BURN_AND_EXPLODE) && !bu->isOut() && (bu->getHealth() == 0 || bu->getStunlevel() >= bu->getHealth())) { if (type != DT_STUN && type != DT_HE && type != DT_IN && type != DT_MELEE) { Position p = Position(bu->getPosition().x * 16, bu->getPosition().y * 16, bu->getPosition().z * 24); _save->getBattleGame()->statePushNext(new ExplosionBState(_save->getBattleGame(), p, 0, bu, 0)); } } if (bu->getOriginalFaction() == FACTION_HOSTILE && unit && unit->getOriginalFaction() == FACTION_PLAYER && type != DT_NONE && _save->getBattleGame()->getCurrentAction()->type != BA_HIT) { unit->addFiringExp(); } } } applyGravity(tile); calculateSunShading(); // roofs could have been destroyed calculateTerrainLighting(); // fires could have been started calculateFOV(center / Position(16,16,24)); return bu; } /** * Handles explosions. * * HE, smoke and fire explodes in a circular pattern on 1 level only. HE however damages floor tiles of the above level. Not the units on it. * HE destroys an object if its armor is lower than the explosive power, then it's HE blockage is applied for further propagation. * See http://www.ufopaedia.org/index.php?title=Explosions for more info. * @param center Center of the explosion in voxelspace. * @param power Power of the explosion. * @param type The damage type of the explosion. * @param maxRadius The maximum radius of the explosion. * @param unit The unit that caused the explosion. */ void TileEngine::explode(Position center, int power, ItemDamageType type, int maxRadius, BattleUnit *unit) { double centerZ = center.z / 24 + 0.5; double centerX = center.x / 16 + 0.5; double centerY = center.y / 16 + 0.5; int hitSide = 0; int diagonalWall = 0; int power_; std::set<Tile*> tilesAffected; std::pair<std::set<Tile*>::iterator,bool> ret; if (type == DT_IN) { power /= 2; } int exHeight = Clamp(Options::battleExplosionHeight, 0, 3); int vertdec = 1000; //default flat explosion int dmgRng = type == DT_HE ? Mod::EXPLOSIVE_DAMAGE_RANGE : Mod::DAMAGE_RANGE; switch (exHeight) { case 1: vertdec = 30; break; case 2: vertdec = 10; break; case 3: vertdec = 5; } Tile *origin = _save->getTile(Position(centerX, centerY, centerZ)); Tile *dest; if (origin->isBigWall()) //precalculations for bigwall deflection { diagonalWall = origin->getMapData(O_OBJECT)->getBigWall(); if (diagonalWall == Pathfinding::BIGWALLNWSE) // 3 | hitSide = (center.x % 16 - center.y % 16) > 0 ? 1 : -1; if (diagonalWall == Pathfinding::BIGWALLNESW) // 2 -- hitSide = (center.x % 16 + center.y % 16 - 15) > 0 ? 1 : -1; } for (int fi = -90; fi <= 90; fi += 5) { // raytrace every 3 degrees makes sure we cover all tiles in a circle. for (int te = 0; te <= 360; te += 3) { double cos_te = cos(Deg2Rad(te)); double sin_te = sin(Deg2Rad(te)); double sin_fi = sin(Deg2Rad(fi)); double cos_fi = cos(Deg2Rad(fi)); origin = _save->getTile(Position(centerX, centerY, centerZ)); dest = origin; double l = 0; int tileX, tileY, tileZ; power_ = power; while (power_ > 0 && l <= maxRadius) { if (power_ > 0) { if (type == DT_HE) { // explosives do 1/2 damage to terrain and 1/2 up to 3/2 random damage to units (the halving is handled elsewhere) dest->setExplosive(power_, 0); } ret = tilesAffected.insert(dest); // check if we had this tile already if (ret.second) { int min = power_ * (100 - dmgRng) / 100; int max = power_ * (100 + dmgRng) / 100; BattleUnit *bu = dest->getUnit(); Tile *tileBelow = _save->getTile(dest->getPosition() - Position(0,0,1)); int wounds = 0; if (!bu && dest->getPosition().z > 0 && dest->hasNoFloor(tileBelow)) { bu = tileBelow->getUnit(); if (bu && bu->getHeight() + bu->getFloatHeight() - tileBelow->getTerrainLevel() <= 24) { bu = 0; // if the unit below has no voxels poking into the tile, don't damage it. } } if (bu && unit) { wounds = bu->getFatalWounds(); } switch (type) { case DT_STUN: // power 0 - 200% if (bu) { if (distance(dest->getPosition(), Position(centerX, centerY, centerZ)) < 2) { bu->damage(Position(0, 0, 0), RNG::generate(min, max), type); } else { bu->damage(Position(centerX, centerY, centerZ) - dest->getPosition(), RNG::generate(min, max), type); } } for (std::vector<BattleItem*>::iterator it = dest->getInventory()->begin(); it != dest->getInventory()->end(); ++it) { if ((*it)->getUnit()) { (*it)->getUnit()->damage(Position(0, 0, 0), RNG::generate(min, max), type); } } break; case DT_HE: { // power 50 - 150% if (bu) { if (distance(dest->getPosition(), Position(centerX, centerY, centerZ)) < 2) { // ground zero effect is in effect bu->damage(Position(0, 0, 0), (RNG::generate(min, max)), type); } else { // directional damage relative to explosion position. // units above the explosion will be hit in the legs, units lateral to or below will be hit in the torso bu->damage(Position(centerX, centerY, centerZ + 5) - dest->getPosition(), (RNG::generate(min, max)), type); } } std::vector<BattleItem*> temp = *dest->getInventory(); // copy this list since it might change for (std::vector<BattleItem*>::iterator it = temp.begin(); it != temp.end(); ++it) { if (power_ > (*it)->getRules()->getArmor()) { if ((*it)->getUnit() && (*it)->getUnit()->getStatus() == STATUS_UNCONSCIOUS) { (*it)->getUnit()->kill(); } _save->removeItem(*it); } } } break; case DT_SMOKE: // smoke from explosions always stay 6 to 14 turns - power of a smoke grenade is 60 if (dest->getSmoke() < 10 && dest->getTerrainLevel() > -24) { dest->setFire(0); dest->setSmoke(RNG::generate(7, 15)); } break; case DT_IN: if (!dest->isVoid()) { if (dest->getFire() == 0 && (dest->getMapData(O_FLOOR) || dest->getMapData(O_OBJECT))) { dest->setFire(dest->getFuel() + 1); dest->setSmoke(Clamp(15 - (dest->getFlammability() / 10), 1, 12)); } if (bu) { float resistance = bu->getArmor()->getDamageModifier(DT_IN); if (resistance > 0.0) { bu->damage(Position(0, 0, 12-dest->getTerrainLevel()), RNG::generate(Mod::FIRE_DAMAGE_RANGE[0], Mod::FIRE_DAMAGE_RANGE[1]), DT_IN, true); int burnTime = RNG::generate(0, int(5.0f * resistance)); if (bu->getFire() < burnTime) { bu->setFire(burnTime); // catch fire and burn } } } } break; default: break; } if (unit && bu && bu->getFaction() != unit->getFaction()) { unit->addFiringExp(); // if it's going to bleed to death and it's not a player, give credit for the kill. if (wounds < bu->getFatalWounds() && bu->getFaction() != FACTION_PLAYER) { bu->killedBy(unit->getFaction()); } } } } l += 1.0; tileX = int(floor(centerX + l * sin_te * cos_fi)); tileY = int(floor(centerY + l * cos_te * cos_fi)); tileZ = int(floor(centerZ + l * sin_fi)); origin = dest; dest = _save->getTile(Position(tileX, tileY, tileZ)); if (!dest) break; // out of map! // blockage by terrain is deducted from the explosion power power_ -= 10; // explosive damage decreases by 10 per tile if (origin->getPosition().z != tileZ) power_ -= vertdec; //3d explosion factor if (type == DT_IN) { int dir; Pathfinding::vectorToDirection(origin->getPosition() - dest->getPosition(), dir); if (dir != -1 && dir %2) power_ -= 5; // diagonal movement costs an extra 50% for fire. } if (l > 0.5) { if ( l > 1.5) { power_ -= verticalBlockage(origin, dest, type, false) * 2; power_ -= horizontalBlockage(origin, dest, type, false) * 2; } else //tricky bigwall deflection /Volutar { bool skipObject = diagonalWall == 0; if (diagonalWall == Pathfinding::BIGWALLNESW) // -- { if (hitSide<0 && te >= 135 && te < 315) skipObject = true; if (hitSide>0 && ( te < 135 || te > 315)) skipObject = true; } if (diagonalWall == Pathfinding::BIGWALLNWSE) // | { if (hitSide>0 && te >= 45 && te < 225) skipObject = true; if (hitSide<0 && ( te < 45 || te > 225)) skipObject = true; } power_ -= verticalBlockage(origin, dest, type, skipObject) * 2; power_ -= horizontalBlockage(origin, dest, type, skipObject) * 2; } } } } } // now detonate the tiles affected with HE if (type == DT_HE) { for (std::set<Tile*>::iterator i = tilesAffected.begin(); i != tilesAffected.end(); ++i) { if (detonate(*i)) { _save->addDestroyedObjective(); } applyGravity(*i); Tile *j = _save->getTile((*i)->getPosition() + Position(0,0,1)); if (j) applyGravity(j); } } calculateSunShading(); // roofs could have been destroyed calculateTerrainLighting(); // fires could have been started calculateFOV(center / Position(16,16,24)); } /** * Applies the explosive power to the tile parts. This is where the actual destruction takes place. * Must affect 9 objects (6 box sides and the object inside plus 2 outer walls). * @param tile Tile affected. * @return True if the objective was destroyed. */ bool TileEngine::detonate(Tile* tile) { int explosive = tile->getExplosive(); if (explosive == 0) return false; // no damage applied for this tile tile->setExplosive(0,0,true); bool objective = false; Tile* tiles[9]; static const TilePart parts[9]={O_FLOOR,O_WESTWALL,O_NORTHWALL,O_FLOOR,O_WESTWALL,O_NORTHWALL,O_OBJECT,O_OBJECT,O_OBJECT}; //6th is the object of current Position pos = tile->getPosition(); tiles[0] = _save->getTile(Position(pos.x, pos.y, pos.z+1)); //ceiling tiles[1] = _save->getTile(Position(pos.x+1, pos.y, pos.z)); //east wall tiles[2] = _save->getTile(Position(pos.x, pos.y+1, pos.z)); //south wall tiles[3] = tiles[4] = tiles[5] = tiles[6] = tile; tiles[7] = _save->getTile(Position(pos.x, pos.y-1, pos.z)); //north bigwall tiles[8] = _save->getTile(Position(pos.x-1, pos.y, pos.z)); //west bigwall int remainingPower, fireProof, fuel; bool destroyed, bigwalldestroyed = true, skipnorthwest = false; for (int i = 8; i >=0; --i) { if (!tiles[i] || !tiles[i]->getMapData(parts[i])) continue; //skip out of map and emptiness int bigwall = tiles[i]->getMapData(parts[i])->getBigWall(); if (i > 6 && !( (bigwall==1) || (bigwall==8) || (i==8 && bigwall==6) || (i==7 && bigwall==7))) continue; if ((bigwall!=0)) skipnorthwest = true; if (!bigwalldestroyed && i<6) //when ground shouldn't be destroyed continue; if (skipnorthwest && (i == 2 || i == 1)) continue; remainingPower = explosive; destroyed = false; int volume = 0; TilePart currentpart = parts[i], currentpart2; int diemcd; fireProof = tiles[i]->getFlammability(currentpart); fuel = tiles[i]->getFuel(currentpart) + 1; // get the volume of the object by checking it's loftemps objects. for (int j = 0; j < 12; j++) { if (tiles[i]->getMapData(currentpart)->getLoftID(j) != 0) ++volume; } if ( i == 6 && (bigwall == 2 || bigwall == 3) && //diagonals (2 * tiles[i]->getMapData(currentpart)->getArmor()) > remainingPower) //not enough to destroy { bigwalldestroyed = false; } // iterate through tile armor and destroy if can while ( tiles[i]->getMapData(currentpart) && (2 * tiles[i]->getMapData(currentpart)->getArmor()) <= remainingPower && tiles[i]->getMapData(currentpart)->getArmor() != 255) { if ( i == 6 && (bigwall == 2 || bigwall == 3)) //diagonals for the current tile { bigwalldestroyed = true; } if ( i == 6 && (bigwall == 6 || bigwall == 7 || bigwall == 8)) //n/w/nw { skipnorthwest = false; } remainingPower -= 2 * tiles[i]->getMapData(currentpart)->getArmor(); destroyed = true; if (_save->getMissionType() == "STR_BASE_DEFENSE" && tiles[i]->getMapData(currentpart)->isBaseModule()) { _save->getModuleMap()[tile->getPosition().x/10][tile->getPosition().y/10].second--; } //this trick is to follow transformed object parts (object can become a ground) diemcd = tiles[i]->getMapData(currentpart)->getDieMCD(); if (diemcd!=0) currentpart2 = tiles[i]->getMapData(currentpart)->getDataset()->getObject(diemcd)->getObjectType(); else currentpart2 = currentpart; if (tiles[i]->destroy(currentpart, _save->getObjectiveType())) objective = true; currentpart = currentpart2; if (tiles[i]->getMapData(currentpart)) // take new values { fireProof = tiles[i]->getFlammability(currentpart); fuel = tiles[i]->getFuel(currentpart) + 1; } } // set tile on fire if ((2 * fireProof) < remainingPower) { if (tiles[i]->getMapData(O_FLOOR) || tiles[i]->getMapData(O_OBJECT)) { tiles[i]->setFire(fuel); tiles[i]->setSmoke(Clamp(15 - (fireProof / 10), 1, 12)); } } // add some smoke if tile was destroyed and not set on fire if (destroyed) { if (tiles[i]->getFire() && !tiles[i]->getMapData(O_FLOOR) && !tiles[i]->getMapData(O_OBJECT)) { tiles[i]->setFire(0);// if the object set the floor on fire, and the floor was subsequently destroyed, the fire needs to go out } if (!tiles[i]->getFire()) { int smoke = RNG::generate(1, (volume / 2) + 3) + (volume / 2); if (smoke > tiles[i]->getSmoke()) { tiles[i]->setSmoke(Clamp(smoke, 0, 15)); } } } } return objective; } /** * Checks for chained explosions. * * Chained explosions are explosions which occur after an explosive map object is destroyed. * May be due a direct hit, other explosion or fire. * @return tile on which a explosion occurred */ Tile *TileEngine::checkForTerrainExplosions() { for (int i = 0; i < _save->getMapSizeXYZ(); ++i) { if (_save->getTiles()[i]->getExplosive()) { return _save->getTiles()[i]; } } return 0; } /** * Calculates the amount of power that is blocked going from one tile to another on a different level. * @param startTile The tile where the power starts. * @param endTile The adjacent tile where the power ends. * @param type The type of power/damage. * @return Amount of blockage of this power. */ int TileEngine::verticalBlockage(Tile *startTile, Tile *endTile, ItemDamageType type, bool skipObject) { int block = 0; // safety check if (startTile == 0 || endTile == 0) return 0; int direction = endTile->getPosition().z - startTile->getPosition().z; if (direction == 0 ) return 0; int x = startTile->getPosition().x; int y = startTile->getPosition().y; int z = startTile->getPosition().z; if (direction < 0) // down { block += blockage(startTile, O_FLOOR, type); if (!skipObject) block += blockage(startTile, O_OBJECT, type, Pathfinding::DIR_DOWN); if (x != endTile->getPosition().x || y != endTile->getPosition().y) { x = endTile->getPosition().x; y = endTile->getPosition().y; // z remains same as startTile Tile *currTile = _save->getTile(Position(x, y, z)); block += horizontalBlockage(startTile, currTile, type, skipObject); block += blockage(currTile, O_FLOOR, type); if (!skipObject) block += blockage(currTile, O_OBJECT, type, Pathfinding::DIR_DOWN); } } else if (direction > 0) // up { z += 1; Tile *currTile = _save->getTile(Position(x, y, z)); block += blockage(currTile, O_FLOOR, type); if (!skipObject) block += blockage(currTile, O_OBJECT, type, Pathfinding::DIR_UP); if (x != endTile->getPosition().x || y != endTile->getPosition().y) { x = endTile->getPosition().x; y = endTile->getPosition().y; currTile = _save->getTile(Position(x, y, z)); block += horizontalBlockage(startTile, currTile, type, skipObject); block += blockage(currTile, O_FLOOR, type); if (!skipObject) block += blockage(currTile, O_OBJECT, type, Pathfinding::DIR_UP); } } return block; } /** * Calculates the amount of power that is blocked going from one tile to another on the same level. * @param startTile The tile where the power starts. * @param endTile The adjacent tile where the power ends. * @param type The type of power/damage. * @return Amount of blockage. */ int TileEngine::horizontalBlockage(Tile *startTile, Tile *endTile, ItemDamageType type, bool skipObject) { static const Position oneTileNorth = Position(0, -1, 0); static const Position oneTileEast = Position(1, 0, 0); static const Position oneTileSouth = Position(0, 1, 0); static const Position oneTileWest = Position(-1, 0, 0); // safety check if (startTile == 0 || endTile == 0) return 0; if (startTile->getPosition().z != endTile->getPosition().z) return 0; Tile *tmpTile; int direction; Pathfinding::vectorToDirection(endTile->getPosition() - startTile->getPosition(), direction); if (direction == -1) return 0; int block = 0; switch(direction) { case 0: // north block = blockage(startTile, O_NORTHWALL, type); break; case 1: // north east if (type == DT_NONE) //this is two-way diagonal visibility check, used in original game { block = blockage(startTile, O_NORTHWALL, type) + blockage(endTile, O_WESTWALL, type); //up+right tmpTile = _save->getTile(startTile->getPosition() + oneTileNorth); if (tmpTile && tmpTile->getMapData(O_OBJECT) && tmpTile->getMapData(O_OBJECT)->getBigWall() != Pathfinding::BIGWALLNESW) block += blockage(tmpTile, O_OBJECT, type, 3); if (block == 0) break; //this way is opened block = blockage(_save->getTile(startTile->getPosition() + oneTileEast), O_NORTHWALL, type) + blockage(_save->getTile(startTile->getPosition() + oneTileEast), O_WESTWALL, type); //right+up tmpTile = _save->getTile(startTile->getPosition() + oneTileEast); if (tmpTile && tmpTile->getMapData(O_OBJECT) && tmpTile->getMapData(O_OBJECT)->getBigWall() != Pathfinding::BIGWALLNESW) block += blockage(tmpTile, O_OBJECT, type, 7); } else { block = (blockage(startTile,O_NORTHWALL, type) + blockage(endTile,O_WESTWALL, type))/2 + (blockage(_save->getTile(startTile->getPosition() + oneTileEast),O_WESTWALL, type) + blockage(_save->getTile(startTile->getPosition() + oneTileEast),O_NORTHWALL, type))/2; block += (blockage(_save->getTile(startTile->getPosition() + oneTileNorth),O_OBJECT, type, 4) + blockage(_save->getTile(startTile->getPosition() + oneTileEast),O_OBJECT, type, 6))/2; } break; case 2: // east block = blockage(endTile,O_WESTWALL, type); break; case 3: // south east if (type == DT_NONE) { block = blockage(_save->getTile(startTile->getPosition() + oneTileSouth), O_NORTHWALL, type) + blockage(endTile, O_WESTWALL, type); //down+right tmpTile = _save->getTile(startTile->getPosition() + oneTileSouth); if (tmpTile && tmpTile->getMapData(O_OBJECT) && tmpTile->getMapData(O_OBJECT)->getBigWall() != Pathfinding::BIGWALLNWSE) block += blockage(tmpTile, O_OBJECT, type, 1); if (block == 0) break; //this way is opened block = blockage(_save->getTile(startTile->getPosition() + oneTileEast), O_WESTWALL, type) + blockage(endTile, O_NORTHWALL, type); //right+down tmpTile = _save->getTile(startTile->getPosition() + oneTileEast); if (tmpTile && tmpTile->getMapData(O_OBJECT) && tmpTile->getMapData(O_OBJECT)->getBigWall() != Pathfinding::BIGWALLNWSE) block += blockage(tmpTile, O_OBJECT, type, 5); } else { block = (blockage(endTile,O_WESTWALL, type) + blockage(endTile,O_NORTHWALL, type))/2 + (blockage(_save->getTile(startTile->getPosition() + oneTileEast),O_WESTWALL, type) + blockage(_save->getTile(startTile->getPosition() + oneTileSouth),O_NORTHWALL, type))/2; block += (blockage(_save->getTile(startTile->getPosition() + oneTileSouth),O_OBJECT, type, 0) + blockage(_save->getTile(startTile->getPosition() + oneTileEast),O_OBJECT, type, 6))/2; } break; case 4: // south block = blockage(endTile,O_NORTHWALL, type); break; case 5: // south west if (type == DT_NONE) { block = blockage(_save->getTile(startTile->getPosition() + oneTileSouth), O_NORTHWALL, type) + blockage(_save->getTile(startTile->getPosition() + oneTileSouth), O_WESTWALL, type); //down+left tmpTile = _save->getTile(startTile->getPosition() + oneTileSouth); if (tmpTile && tmpTile->getMapData(O_OBJECT) && tmpTile->getMapData(O_OBJECT)->getBigWall() != Pathfinding::BIGWALLNESW) block += blockage(tmpTile, O_OBJECT, type, 7); if (block == 0) break; //this way is opened block = blockage(startTile, O_WESTWALL, type) + blockage(endTile, O_NORTHWALL, type); //left+down tmpTile = _save->getTile(startTile->getPosition() + oneTileWest); if (tmpTile && tmpTile->getMapData(O_OBJECT) && tmpTile->getMapData(O_OBJECT)->getBigWall() != Pathfinding::BIGWALLNESW) block += blockage(tmpTile, O_OBJECT, type, 3); } else { block = (blockage(endTile,O_NORTHWALL, type) + blockage(startTile,O_WESTWALL, type))/2 + (blockage(_save->getTile(startTile->getPosition() + oneTileSouth),O_WESTWALL, type) + blockage(_save->getTile(startTile->getPosition() + oneTileSouth),O_NORTHWALL, type))/2; block += (blockage(_save->getTile(startTile->getPosition() + oneTileSouth),O_OBJECT, type, 0) + blockage(_save->getTile(startTile->getPosition() + oneTileWest),O_OBJECT, type, 2))/2; } break; case 6: // west block = blockage(startTile,O_WESTWALL, type); break; case 7: // north west if (type == DT_NONE) { block = blockage(startTile, O_NORTHWALL, type) + blockage(_save->getTile(startTile->getPosition() + oneTileNorth), O_WESTWALL, type); //up+left tmpTile = _save->getTile(startTile->getPosition() + oneTileNorth); if (tmpTile && tmpTile->getMapData(O_OBJECT) && tmpTile->getMapData(O_OBJECT)->getBigWall() != Pathfinding::BIGWALLNWSE) block += blockage(tmpTile, O_OBJECT, type, 5); if (block == 0) break; //this way is opened block = blockage(startTile, O_WESTWALL, type) + blockage(_save->getTile(startTile->getPosition() + oneTileWest), O_NORTHWALL, type); //left+up tmpTile = _save->getTile(startTile->getPosition() + oneTileWest); if (tmpTile && tmpTile->getMapData(O_OBJECT) && tmpTile->getMapData(O_OBJECT)->getBigWall() != Pathfinding::BIGWALLNWSE) block += blockage(tmpTile, O_OBJECT, type, 1); } else { block = (blockage(startTile,O_WESTWALL, type) + blockage(startTile,O_NORTHWALL, type))/2 + (blockage(_save->getTile(startTile->getPosition() + oneTileNorth),O_WESTWALL, type) + blockage(_save->getTile(startTile->getPosition() + oneTileWest),O_NORTHWALL, type))/2; block += (blockage(_save->getTile(startTile->getPosition() + oneTileNorth),O_OBJECT, type, 4) + blockage(_save->getTile(startTile->getPosition() + oneTileWest),O_OBJECT, type, 2))/2; } break; } if (!skipObject || (type==DT_NONE && startTile->isBigWall()) ) block += blockage(startTile,O_OBJECT, type, direction); if (type != DT_NONE) { // not too sure about removing this line, // i have a sneaking suspicion we might end up blocking things that we shouldn't //if (skipObject) return block; direction += 4; if (direction > 7) direction -= 8; if (endTile->isBigWall()) block += blockage(endTile,O_OBJECT, type, direction, true); } else { if ( block <= 127 ) { direction += 4; if (direction > 7) direction -= 8; if (blockage(endTile,O_OBJECT, type, direction, true) > 127){ return -1; //hit bigwall, reveal bigwall tile } } } return block; } /** * Calculates the amount this certain wall or floor-part of the tile blocks. * @param startTile The tile where the power starts. * @param part The part of the tile the power needs to go through. * @param type The type of power/damage. * @param direction Direction the power travels. * @return Amount of blockage. */ int TileEngine::blockage(Tile *tile, const TilePart part, ItemDamageType type, int direction, bool checkingFromOrigin) { int blockage = 0; if (tile == 0) return 0; // probably outside the map here if (tile->getMapData(part)) { bool check = true; int wall = -1; if (direction != -1) { wall = tile->getMapData(O_OBJECT)->getBigWall(); if (type != DT_SMOKE && checkingFromOrigin && (wall == Pathfinding::BIGWALLNESW || wall == Pathfinding::BIGWALLNWSE)) { check = false; } switch (direction) { case 0: // north if (wall == Pathfinding::BIGWALLWEST || wall == Pathfinding::BIGWALLEAST || wall == Pathfinding::BIGWALLSOUTH || wall == Pathfinding::BIGWALLEASTANDSOUTH) { check = false; } break; case 1: // north east if (wall == Pathfinding::BIGWALLWEST || wall == Pathfinding::BIGWALLSOUTH) { check = false; } break; case 2: // east if (wall == Pathfinding::BIGWALLNORTH || wall == Pathfinding::BIGWALLSOUTH || wall == Pathfinding::BIGWALLWEST || wall == Pathfinding::BIGWALLWESTANDNORTH) { check = false; } break; case 3: // south east if (wall == Pathfinding::BIGWALLNORTH || wall == Pathfinding::BIGWALLWEST || wall == Pathfinding::BIGWALLWESTANDNORTH) { check = false; } break; case 4: // south if (wall == Pathfinding::BIGWALLWEST || wall == Pathfinding::BIGWALLEAST || wall == Pathfinding::BIGWALLNORTH || wall == Pathfinding::BIGWALLWESTANDNORTH) { check = false; } break; case 5: // south west if (wall == Pathfinding::BIGWALLNORTH || wall == Pathfinding::BIGWALLEAST) { check = false; } break; case 6: // west if (wall == Pathfinding::BIGWALLNORTH || wall == Pathfinding::BIGWALLSOUTH || wall == Pathfinding::BIGWALLEAST || wall == Pathfinding::BIGWALLEASTANDSOUTH) { check = false; } break; case 7: // north west if (wall == Pathfinding::BIGWALLSOUTH || wall == Pathfinding::BIGWALLEAST || wall == Pathfinding::BIGWALLEASTANDSOUTH) { check = false; } break; case 8: // up case 9: // down if (wall != 0 && wall != Pathfinding::BLOCK) { check = false; } break; default: break; } } else if (part == O_FLOOR && tile->getMapData(part)->getBlock(type) == 0) { if (type != DT_NONE) { blockage += tile->getMapData(part)->getArmor(); } else if (!tile->getMapData(part)->isNoFloor()) { return 256; } } if (check) { // -1 means we have a regular wall, and anything over 0 means we have a bigwall. if (type == DT_SMOKE && wall != 0 && !tile->isUfoDoorOpen(part)) { return 256; } blockage += tile->getMapData(part)->getBlock(type); } } // open ufo doors are actually still closed behind the scenes // so a special trick is needed to see if they are open, if they are, they obviously don't block anything if (tile->isUfoDoorOpen(part)) blockage = 0; return blockage; } /** * Opens a door (if any) by rightclick, or by walking through it. The unit has to face in the right direction. * @param unit Unit. * @param rClick Whether the player right clicked. * @param dir Direction. * @return -1 there is no door, you can walk through; * 0 normal door opened, make a squeaky sound and you can walk through; * 1 ufo door is starting to open, make a whoosh sound, don't walk through; * 3 ufo door is still opening, don't walk through it yet. (have patience, futuristic technology...) * 4 not enough TUs * 5 would contravene fire reserve */ int TileEngine::unitOpensDoor(BattleUnit *unit, bool rClick, int dir) { int door = -1; int TUCost = 0; int size = unit->getArmor()->getSize(); int z = unit->getTile()->getTerrainLevel() < -12 ? 1 : 0; // if we're standing on stairs, check the tile above instead. if (dir == -1) { dir = unit->getDirection(); } Tile *tile; for (int x = 0; x < size && door == -1; x++) { for (int y = 0; y < size && door == -1; y++) { std::vector<std::pair<Position, TilePart> > checkPositions; tile = _save->getTile(unit->getPosition() + Position(x,y,z)); if (!tile) continue; switch (dir) { case 0: // north checkPositions.push_back(std::make_pair(Position(0, 0, 0), O_NORTHWALL)); // origin if (x != 0) { checkPositions.push_back(std::make_pair(Position(0, -1, 0), O_WESTWALL)); // one tile north } break; case 1: // north east checkPositions.push_back(std::make_pair(Position(0, 0, 0), O_NORTHWALL)); // origin checkPositions.push_back(std::make_pair(Position(1, -1, 0), O_WESTWALL)); // one tile north-east if (rClick) { checkPositions.push_back(std::make_pair(Position(1, 0, 0), O_WESTWALL)); // one tile east checkPositions.push_back(std::make_pair(Position(1, 0, 0), O_NORTHWALL)); // one tile east } break; case 2: // east checkPositions.push_back(std::make_pair(Position(1, 0, 0), O_WESTWALL)); // one tile east break; case 3: // south-east if (!y) checkPositions.push_back(std::make_pair(Position(1, 1, 0), O_WESTWALL)); // one tile south-east if (!x) checkPositions.push_back(std::make_pair(Position(1, 1, 0), O_NORTHWALL)); // one tile south-east if (rClick) { checkPositions.push_back(std::make_pair(Position(1, 0, 0), O_WESTWALL)); // one tile east checkPositions.push_back(std::make_pair(Position(0, 1, 0), O_NORTHWALL)); // one tile south } break; case 4: // south checkPositions.push_back(std::make_pair(Position(0, 1, 0), O_NORTHWALL)); // one tile south break; case 5: // south-west checkPositions.push_back(std::make_pair(Position(0, 0, 0), O_WESTWALL)); // origin checkPositions.push_back(std::make_pair(Position(-1, 1, 0), O_NORTHWALL)); // one tile south-west if (rClick) { checkPositions.push_back(std::make_pair(Position(0, 1, 0), O_WESTWALL)); // one tile south checkPositions.push_back(std::make_pair(Position(0, 1, 0), O_NORTHWALL)); // one tile south } break; case 6: // west checkPositions.push_back(std::make_pair(Position(0, 0, 0), O_WESTWALL)); // origin if (y != 0) { checkPositions.push_back(std::make_pair(Position(-1, 0, 0), O_NORTHWALL)); // one tile west } break; case 7: // north-west checkPositions.push_back(std::make_pair(Position(0, 0, 0), O_WESTWALL)); // origin checkPositions.push_back(std::make_pair(Position(0, 0, 0), O_NORTHWALL)); // origin if (x) { checkPositions.push_back(std::make_pair(Position(-1, -1, 0), O_WESTWALL)); // one tile north } if (y) { checkPositions.push_back(std::make_pair(Position(-1, -1, 0), O_NORTHWALL)); // one tile north } if (rClick) { checkPositions.push_back(std::make_pair(Position(0, -1, 0), O_WESTWALL)); // one tile north checkPositions.push_back(std::make_pair(Position(-1, 0, 0), O_NORTHWALL)); // one tile west } break; default: break; } TilePart part = O_FLOOR; for (std::vector<std::pair<Position, TilePart> >::const_iterator i = checkPositions.begin(); i != checkPositions.end() && door == -1; ++i) { tile = _save->getTile(unit->getPosition() + Position(x,y,z) + i->first); if (tile) { door = tile->openDoor(i->second, unit, _save->getBattleGame()->getReservedAction()); if (door != -1) { part = i->second; if (door == 1) { checkAdjacentDoors(unit->getPosition() + Position(x,y,z) + i->first, i->second); } } } } if (door == 0 && rClick) { if (part == O_WESTWALL) { part = O_NORTHWALL; } else { part = O_WESTWALL; } TUCost = tile->getTUCost(part, unit->getMovementType()); } else if (door == 1 || door == 4) { TUCost = tile->getTUCost(part, unit->getMovementType()); } } } if (TUCost != 0) { if (_save->getBattleGame()->checkReservedTU(unit, TUCost)) { if (unit->spendTimeUnits(TUCost)) { calculateFOV(unit->getPosition()); // look from the other side (may be need check reaction fire?) std::vector<BattleUnit*> *vunits = unit->getVisibleUnits(); for (size_t i = 0; i < vunits->size(); ++i) { calculateFOV(vunits->at(i)); } } else return 4; } else return 5; } return door; } /** * Opens any doors connected to this part at this position, * Keeps processing til it hits a non-ufo-door. * @param pos The starting position * @param part The part to open, defines which direction to check. */ void TileEngine::checkAdjacentDoors(const Position& pos, TilePart part) { Position offset; bool westSide = (part == O_WESTWALL); for (int i = 1;; ++i) { offset = westSide ? Position(0,i,0):Position(i,0,0); Tile *tile = _save->getTile(pos + offset); if (tile && tile->getMapData(part) && tile->getMapData(part)->isUFODoor()) { tile->openDoor(part); } else break; } for (int i = -1;; --i) { offset = westSide ? Position(0,i,0):Position(i,0,0); Tile *tile = _save->getTile(pos + offset); if (tile && tile->getMapData(part) && tile->getMapData(part)->isUFODoor()) { tile->openDoor(part); } else break; } } /** * Closes ufo doors. * @return Whether doors are closed. */ int TileEngine::closeUfoDoors() { int doorsclosed = 0; // prepare a list of tiles on fire/smoke & close any ufo doors for (int i = 0; i < _save->getMapSizeXYZ(); ++i) { if (_save->getTiles()[i]->getUnit() && _save->getTiles()[i]->getUnit()->getArmor()->getSize() > 1) { BattleUnit *bu = _save->getTiles()[i]->getUnit(); Tile *tile = _save->getTiles()[i]; Tile *oneTileNorth = _save->getTile(tile->getPosition() + Position(0, -1, 0)); Tile *oneTileWest = _save->getTile(tile->getPosition() + Position(-1, 0, 0)); if ((tile->isUfoDoorOpen(O_NORTHWALL) && oneTileNorth && oneTileNorth->getUnit() && oneTileNorth->getUnit() == bu) || (tile->isUfoDoorOpen(O_WESTWALL) && oneTileWest && oneTileWest->getUnit() && oneTileWest->getUnit() == bu)) { continue; } } doorsclosed += _save->getTiles()[i]->closeUfoDoor(); } return doorsclosed; } /** * Calculates a line trajectory, using bresenham algorithm in 3D. * @param origin Origin (voxel??). * @param target Target (also voxel??). * @param storeTrajectory True will store the whole trajectory - otherwise it just stores the last position. * @param trajectory A vector of positions in which the trajectory is stored. * @param excludeUnit Excludes this unit in the collision detection. * @param doVoxelCheck Check against voxel or tile blocking? (first one for units visibility and line of fire, second one for terrain visibility). * @param onlyVisible Skip invisible units? used in FPS view. * @param excludeAllBut [Optional] The only unit to be considered for ray hits. * @return the objectnumber(0-3) or unit(4) or out of map (5) or -1(hit nothing). */ int TileEngine::calculateLine(Position origin, Position target, bool storeTrajectory, std::vector<Position> *trajectory, BattleUnit *excludeUnit, bool doVoxelCheck, bool onlyVisible, BattleUnit *excludeAllBut) { int x, x0, x1, delta_x, step_x; int y, y0, y1, delta_y, step_y; int z, z0, z1, delta_z, step_z; int swap_xy, swap_xz; int drift_xy, drift_xz; int cx, cy, cz; Position lastPoint(origin); int result; int steps = 0; bool excludeAllUnits = false; if (_save->isBeforeGame()) { excludeAllUnits = true; // don't start unit spotting before pre-game inventory stuff (large units on the craftInventory tile will cause a crash if they're "spotted") } //start and end points x0 = origin.x; x1 = target.x; y0 = origin.y; y1 = target.y; z0 = origin.z; z1 = target.z; //'steep' xy Line, make longest delta x plane swap_xy = abs(y1 - y0) > abs(x1 - x0); if (swap_xy) { std::swap(x0, y0); std::swap(x1, y1); } //do same for xz swap_xz = abs(z1 - z0) > abs(x1 - x0); if (swap_xz) { std::swap(x0, z0); std::swap(x1, z1); } //delta is Length in each plane delta_x = abs(x1 - x0); delta_y = abs(y1 - y0); delta_z = abs(z1 - z0); //drift controls when to step in 'shallow' planes //starting value keeps Line centred drift_xy = (delta_x / 2); drift_xz = (delta_x / 2); //direction of line step_x = 1; if (x0 > x1) { step_x = -1; } step_y = 1; if (y0 > y1) { step_y = -1; } step_z = 1; if (z0 > z1) { step_z = -1; } //starting point y = y0; z = z0; if (doVoxelCheck) voxelCheckFlush(); //step through longest delta (which we have swapped to x) for (x = x0;; x += step_x) { //copy position cx = x; cy = y; cz = z; //unswap (in reverse) if (swap_xz) std::swap(cx, cz); if (swap_xy) std::swap(cx, cy); if (storeTrajectory && trajectory) { trajectory->push_back(Position(cx, cy, cz)); } //passes through this point? if (doVoxelCheck) { result = voxelCheck(Position(cx, cy, cz), excludeUnit, false, onlyVisible, excludeAllBut); if (result != V_EMPTY) { if (trajectory) { // store the position of impact trajectory->push_back(Position(cx, cy, cz)); } return result; } } else { int temp_res = verticalBlockage(_save->getTile(lastPoint), _save->getTile(Position(cx, cy, cz)), DT_NONE); result = horizontalBlockage(_save->getTile(lastPoint), _save->getTile(Position(cx, cy, cz)), DT_NONE, steps<2); steps++; if (result == -1) { if (temp_res > 127) { result = 0; } else { return result; // We hit a big wall } } result += temp_res; if (result > 127) { return result; } lastPoint = Position(cx, cy, cz); } if (x == x1) break; //update progress in other planes drift_xy = drift_xy - delta_y; drift_xz = drift_xz - delta_z; //step in y plane if (drift_xy < 0) { y = y + step_y; drift_xy = drift_xy + delta_x; //check for xy diagonal intermediate voxel step if (doVoxelCheck) { cx = x; cz = z; cy = y; if (swap_xz) std::swap(cx, cz); if (swap_xy) std::swap(cx, cy); result = voxelCheck(Position(cx, cy, cz), excludeUnit, excludeAllUnits, onlyVisible, excludeAllBut); if (result != V_EMPTY) { if (trajectory != 0) { // store the position of impact trajectory->push_back(Position(cx, cy, cz)); } return result; } } } //same in z if (drift_xz < 0) { z = z + step_z; drift_xz = drift_xz + delta_x; //check for xz diagonal intermediate voxel step if (doVoxelCheck) { cx = x; cz = z; cy = y; if (swap_xz) std::swap(cx, cz); if (swap_xy) std::swap(cx, cy); result = voxelCheck(Position(cx, cy, cz), excludeUnit, excludeAllUnits, onlyVisible, excludeAllBut); if (result != V_EMPTY) { if (trajectory != 0) { // store the position of impact trajectory->push_back(Position(cx, cy, cz)); } return result; } } } } return V_EMPTY; } /** * Calculates a parabola trajectory, used for throwing items. * @param origin Origin in voxelspace. * @param target Target in voxelspace. * @param storeTrajectory True will store the whole trajectory - otherwise it just stores the last position. * @param trajectory A vector of positions in which the trajectory is stored. * @param excludeUnit Makes sure the trajectory does not hit the shooter itself. * @param curvature How high the parabola goes: 1.0 is almost straight throw, 3.0 is a very high throw, to throw over a fence for example. * @param delta Is the deviation of the angles it should take into account, 0,0,0 is perfection. * @return The objectnumber(0-3) or unit(4) or out of map (5) or -1(hit nothing). */ int TileEngine::calculateParabola(Position origin, Position target, bool storeTrajectory, std::vector<Position> *trajectory, BattleUnit *excludeUnit, double curvature, const Position delta) { double ro = sqrt((double)((target.x - origin.x) * (target.x - origin.x) + (target.y - origin.y) * (target.y - origin.y) + (target.z - origin.z) * (target.z - origin.z))); if (AreSame(ro, 0.0)) return V_EMPTY;//just in case double fi = acos((double)(target.z - origin.z) / ro); double te = atan2((double)(target.y - origin.y), (double)(target.x - origin.x)); te += (delta.x / ro) / 2 * M_PI; //horizontal magic value fi += ((delta.z + delta.y) / ro) / 14 * M_PI * curvature; //another magic value (vertical), to make it in line with fire spread double zA = sqrt(ro)*curvature; double zK = 4.0 * zA / ro / ro; int x = origin.x; int y = origin.y; int z = origin.z; int i = 8; int result = V_EMPTY; Position lastPosition = Position(x,y,z); Position nextPosition = lastPosition; if (storeTrajectory && trajectory) { //initla value for small hack to glue `calculateLine` into one continuous arc trajectory->push_back(lastPosition); } while (z > 0) { x = (int)((double)origin.x + (double)i * cos(te) * sin(fi)); y = (int)((double)origin.y + (double)i * sin(te) * sin(fi)); z = (int)((double)origin.z + (double)i * cos(fi) - zK * ((double)i - ro / 2.0) * ((double)i - ro / 2.0) + zA); //passes through this point? nextPosition = Position(x,y,z); if (storeTrajectory && trajectory) { //remove end point of previus trajectory part, becasue next one will add this point again trajectory->pop_back(); } result = calculateLine(lastPosition, nextPosition, storeTrajectory, storeTrajectory ? trajectory : 0, excludeUnit); if (result != V_EMPTY) { if (!storeTrajectory && trajectory) { result = calculateLine(lastPosition, nextPosition, false, trajectory, excludeUnit); //pick the INSIDE position of impact } break; } lastPosition = nextPosition; ++i; } return result; } /** * Calculates z "grounded" value for a particular voxel (used for projectile shadow). * @param voxel The voxel to trace down. * @return z coord of "ground". */ int TileEngine::castedShade(Position voxel) { int zstart = voxel.z; Position tmpCoord = voxel / Position(16,16,24); Tile *t = _save->getTile(tmpCoord); while (t && t->isVoid() && !t->getUnit()) { zstart = tmpCoord.z* 24; --tmpCoord.z; t = _save->getTile(tmpCoord); } Position tmpVoxel = voxel; int z; voxelCheckFlush(); for (z = zstart; z>0; z--) { tmpVoxel.z = z; if (voxelCheck(tmpVoxel, 0) != V_EMPTY) break; } return z; } /** * Traces voxel visibility. * @param voxel Voxel coordinates. * @return True if visible. */ bool TileEngine::isVoxelVisible(Position voxel) { int zstart = voxel.z+3; // slight Z adjust if ((zstart/24)!=(voxel.z/24)) return true; // visible! Position tmpVoxel = voxel; int zend = (zstart/24)*24 +24; voxelCheckFlush(); for (int z = zstart; z<zend; z++) { tmpVoxel.z=z; // only OBJECT can cause additional occlusion (because of any shape) if (voxelCheck(tmpVoxel, 0) == V_OBJECT) return false; ++tmpVoxel.x; if (voxelCheck(tmpVoxel, 0) == V_OBJECT) return false; ++tmpVoxel.y; if (voxelCheck(tmpVoxel, 0) == V_OBJECT) return false; } return true; } /** * Checks if we hit a voxel. * @param voxel The voxel to check. * @param excludeUnit Don't do checks on this unit. * @param excludeAllUnits Don't do checks on any unit. * @param onlyVisible Whether to consider only visible units. * @param excludeAllBut If set, the only unit to be considered for ray hits. * @return The objectnumber(0-3) or unit(4) or out of map (5) or -1 (hit nothing). */ VoxelType TileEngine::voxelCheck(Position voxel, BattleUnit *excludeUnit, bool excludeAllUnits, bool onlyVisible, BattleUnit *excludeAllBut) { if (voxel.x < 0 || voxel.y < 0 || voxel.z < 0) //preliminary out of map { return V_OUTOFBOUNDS; } Position pos = voxel / Position(16, 16, 24); Tile *tile, *tileBelow; if (_cacheTilePos == pos) { tile = _cacheTile; tileBelow = _cacheTileBelow; } else { tile = _save->getTile(pos); if (!tile) // check if we are not out of the map { return V_OUTOFBOUNDS; //not even cache } tileBelow = _save->getTile(pos + Position(0,0,-1)); _cacheTilePos = pos; _cacheTile = tile; _cacheTileBelow = tileBelow; } if (tile->isVoid() && tile->getUnit() == 0 && (!tileBelow || tileBelow->getUnit() == 0)) { return V_EMPTY; } if (tile->getMapData(O_FLOOR) && tile->getMapData(O_FLOOR)->isGravLift() && (voxel.z % 24 == 0 || voxel.z % 24 == 1)) { if ((tile->getPosition().z == 0) || (tileBelow && tileBelow->getMapData(O_FLOOR) && !tileBelow->getMapData(O_FLOOR)->isGravLift())) { return V_FLOOR; } } // first we check terrain voxel data, not to allow 2x2 units stick through walls for (int i = V_FLOOR; i <= V_OBJECT; ++i) { TilePart tp = (TilePart)i; MapData *mp = tile->getMapData(tp); if (((tp == O_WESTWALL) || (tp == O_NORTHWALL)) && tile->isUfoDoorOpen(tp)) continue; if (mp != 0) { int x = 15 - voxel.x%16; int y = voxel.y%16; int idx = (mp->getLoftID((voxel.z%24)/2)*16) + y; if (_voxelData->at(idx) & (1 << x)) { return (VoxelType)i; } } } if (!excludeAllUnits) { BattleUnit *unit = tile->getUnit(); // sometimes there is unit on the tile below, but sticks up to this tile with his head, // in this case we couldn't have unit standing at current tile. if (unit == 0 && tile->hasNoFloor(tileBelow)) { if (tileBelow) { tile = tileBelow; unit = tile->getUnit(); } } if (unit != 0 && unit != excludeUnit && (!excludeAllBut || unit == excludeAllBut) && (!onlyVisible || unit->getVisible() ) ) { Position tilepos; Position unitpos = unit->getPosition(); int terrainHeight = 0; for (int x = 0; x < unit->getArmor()->getSize(); ++x) { for (int y = 0; y < unit->getArmor()->getSize(); ++y) { Tile *tempTile = _save->getTile(unitpos + Position(x,y,0)); if (tempTile->getTerrainLevel() < terrainHeight) { terrainHeight = tempTile->getTerrainLevel(); } } } int tz = unitpos.z*24 + unit->getFloatHeight() - terrainHeight; //bottom most voxel, terrain heights are negative, so we subtract. if ((voxel.z > tz) && (voxel.z <= tz + unit->getHeight()) ) { int x = voxel.x%16; int y = voxel.y%16; int part = 0; if (unit->getArmor()->getSize() > 1) { tilepos = tile->getPosition(); part = tilepos.x - unitpos.x + (tilepos.y - unitpos.y)*2; } int idx = (unit->getLoftemps(part) * 16) + y; if (_voxelData->at(idx) & (1 << x)) { return V_UNIT; } } } } return V_EMPTY; } void TileEngine::voxelCheckFlush() { _cacheTilePos = Position(-1,-1,-1); _cacheTile = 0; _cacheTileBelow = 0; } /** * Toggles personal lighting on / off. */ void TileEngine::togglePersonalLighting() { _personalLighting = !_personalLighting; calculateUnitLighting(); } /** * Calculates the distance between 2 points. Rounded up to first INT. * @param pos1 Position of first square. * @param pos2 Position of second square. * @return Distance. */ int TileEngine::distance(Position pos1, Position pos2) const { int x = pos1.x - pos2.x; int y = pos1.y - pos2.y; return (int)std::ceil(sqrt(float(x*x + y*y))); } /** * Calculates the distance squared between 2 points. No sqrt(), not floating point math, and sometimes it's all you need. * @param pos1 Position of first square. * @param pos2 Position of second square. * @param considerZ Whether to consider the z coordinate. * @return Distance. */ int TileEngine::distanceSq(Position pos1, Position pos2, bool considerZ) const { int x = pos1.x - pos2.x; int y = pos1.y - pos2.y; int z = considerZ ? (pos1.z - pos2.z) : 0; return x*x + y*y + z*z; } /** * Applies gravity to a tile. Causes items and units to drop. * @param t Tile. * @return Tile where the items end up in eventually. */ Tile *TileEngine::applyGravity(Tile *t) { if (!t || (t->getInventory()->empty() && !t->getUnit())) return t; // skip this if there are no items Position p = t->getPosition(); Tile *rt = t; Tile *rtb; BattleUnit *occupant = t->getUnit(); if (occupant) { Position unitpos = occupant->getPosition(); while (unitpos.z >= 0) { bool canFall = true; for (int y = 0; y < occupant->getArmor()->getSize() && canFall; ++y) { for (int x = 0; x < occupant->getArmor()->getSize() && canFall; ++x) { rt = _save->getTile(Position(unitpos.x+x, unitpos.y+y, unitpos.z)); rtb = _save->getTile(Position(unitpos.x+x, unitpos.y+y, unitpos.z-1)); //below if (!rt->hasNoFloor(rtb)) { canFall = false; } } } if (!canFall) break; unitpos.z--; } if (unitpos != occupant->getPosition()) { if (occupant->getHealth() != 0 && occupant->getStunlevel() < occupant->getHealth()) { if (occupant->getMovementType() == MT_FLY) { // move to the position you're already in. this will unset the kneeling flag, set the floating flag, etc. occupant->startWalking(occupant->getDirection(), occupant->getPosition(), _save->getTile(occupant->getPosition() + Position(0,0,-1)), true); // and set our status to standing (rather than walking or flying) to avoid weirdness. occupant->abortTurn(); } else { occupant->setPosition(occupant->getPosition()); // this is necessary to set the unit up for falling correctly, updating their "lastPos" _save->addFallingUnit(occupant); } } else if (occupant->isOut()) { Position origin = occupant->getPosition(); for (int y = occupant->getArmor()->getSize()-1; y >= 0; --y) { for (int x = occupant->getArmor()->getSize()-1; x >= 0; --x) { _save->getTile(origin + Position(x, y, 0))->setUnit(0); } } occupant->setPosition(unitpos); } } } rt = t; bool canFall = true; while (p.z >= 0 && canFall) { rt = _save->getTile(p); rtb = _save->getTile(Position(p.x, p.y, p.z-1)); //below if (!rt->hasNoFloor(rtb)) canFall = false; p.z--; } for (std::vector<BattleItem*>::iterator it = t->getInventory()->begin(); it != t->getInventory()->end(); ++it) { if ((*it)->getUnit() && t->getPosition() == (*it)->getUnit()->getPosition()) { (*it)->getUnit()->setPosition(rt->getPosition()); } if (t != rt) { rt->addItem(*it, (*it)->getSlot()); } } if (t != rt) { // clear tile t->getInventory()->clear(); } return rt; } /** * Validates the melee range between two units. * @param attacker The attacking unit. * @param target The unit we want to attack. * @param dir Direction to check. * @return True when the range is valid. */ bool TileEngine::validMeleeRange(BattleUnit *attacker, BattleUnit *target, int dir) { return validMeleeRange(attacker->getPosition(), dir, attacker, target, 0); } /** * Validates the melee range between a tile and a unit. * @param pos Position to check from. * @param direction Direction to check. * @param attacker The attacking unit. * @param target The unit we want to attack, 0 for any unit. * @param dest Destination position. * @return True when the range is valid. */ bool TileEngine::validMeleeRange(const Position& pos, int direction, BattleUnit *attacker, BattleUnit *target, Position *dest, bool preferEnemy) { if (direction < 0 || direction > 7) { return false; } std::vector<BattleUnit*> potentialTargets; BattleUnit *chosenTarget = 0; Position p; int size = attacker->getArmor()->getSize() - 1; Pathfinding::directionToVector(direction, &p); for (int x = 0; x <= size; ++x) { for (int y = 0; y <= size; ++y) { Tile *origin (_save->getTile(Position(pos + Position(x, y, 0)))); Tile *targetTile (_save->getTile(Position(pos + Position(x, y, 0) + p))); Tile *aboveTargetTile (_save->getTile(Position(pos + Position(x, y, 1) + p))); Tile *belowTargetTile (_save->getTile(Position(pos + Position(x, y, -1) + p))); if (targetTile && origin) { if (origin->getTerrainLevel() <= -16 && aboveTargetTile && !aboveTargetTile->hasNoFloor(targetTile)) { targetTile = aboveTargetTile; } else if (belowTargetTile && targetTile->hasNoFloor(belowTargetTile) && !targetTile->getUnit() && belowTargetTile->getTerrainLevel() <= -16) { targetTile = belowTargetTile; } if (targetTile->getUnit()) { if (target == 0 || targetTile->getUnit() == target) { Position originVoxel = Position(origin->getPosition() * Position(16,16,24)) + Position(8,8,attacker->getHeight() + attacker->getFloatHeight() - 4 -origin->getTerrainLevel()); Position targetVoxel; if (canTargetUnit(&originVoxel, targetTile, &targetVoxel, attacker, false)) { if (dest) { *dest = targetTile->getPosition(); } if (target != 0) { return true; } else { potentialTargets.push_back(targetTile->getUnit()); } } } } } } } for (std::vector<BattleUnit*>::const_iterator i = potentialTargets.begin(); i != potentialTargets.end(); ++i) { // if there's actually something THERE, we'll chalk this up as a success. if (!chosenTarget) { chosenTarget = *i; } // but if there's a target of a different faction, we'll prioritize them. else if ((preferEnemy && (*i)->getFaction() != attacker->getFaction()) // or, if we're using a medikit, prioritize whichever friend is wounded the most. || (!preferEnemy && (*i)->getFaction() == attacker->getFaction() && (*i)->getFatalWounds() > chosenTarget->getFatalWounds())) { chosenTarget = *i; } } if (dest && chosenTarget) { *dest = chosenTarget->getPosition(); } return chosenTarget != 0; } /** * Gets the AI to look through a window. * @param position Current position. * @return Direction or -1 when no window found. */ int TileEngine::faceWindow(Position position) { static const Position oneTileEast = Position(1, 0, 0); static const Position oneTileSouth = Position(0, 1, 0); Tile *tile = _save->getTile(position); if (tile && tile->getMapData(O_NORTHWALL) && tile->getMapData(O_NORTHWALL)->getBlock(DT_NONE)==0) return 0; tile = _save->getTile(position + oneTileEast); if (tile && tile->getMapData(O_WESTWALL) && tile->getMapData(O_WESTWALL)->getBlock(DT_NONE)==0) return 2; tile = _save->getTile(position + oneTileSouth); if (tile && tile->getMapData(O_NORTHWALL) && tile->getMapData(O_NORTHWALL)->getBlock(DT_NONE)==0) return 4; tile = _save->getTile(position); if (tile && tile->getMapData(O_WESTWALL) && tile->getMapData(O_WESTWALL)->getBlock(DT_NONE)==0) return 6; return -1; } /** * Validates a throw action. * @param action The action to validate. * @param originVoxel The origin point of the action. * @param targetVoxel The target point of the action. * @param curve The curvature of the throw. * @param voxelType The type of voxel at which this parabola terminates. * @return Validity of action. */ bool TileEngine::validateThrow(BattleAction &action, Position originVoxel, Position targetVoxel, double *curve, int *voxelType, bool forced) { bool foundCurve = false; double curvature = 0.5; if (action.type == BA_THROW) { curvature = std::max(0.48, 1.73 / sqrt(sqrt((double)(action.actor->getBaseStats()->strength) / (double)(action.weapon->getRules()->getWeight()))) + (action.actor->isKneeled()? 0.1 : 0.0)); } else { // arcing projectile weapons assume a fixed strength and weight.(70 and 10 respectively) // curvature should be approximately 1.06358350461 at this point. curvature = 1.73 / sqrt(sqrt(70.0 / 10.0)) + (action.actor->isKneeled()? 0.1 : 0.0); } Tile *targetTile = _save->getTile(action.target); Position targetPos = (targetVoxel / Position(16, 16, 24)); // object blocking - can't throw here if (action.type == BA_THROW && targetTile && targetTile->getMapData(O_OBJECT) && targetTile->getMapData(O_OBJECT)->getTUCost(MT_WALK) == 255 && !(targetTile->isBigWall() && (targetTile->getMapData(O_OBJECT)->getBigWall()<1 || targetTile->getMapData(O_OBJECT)->getBigWall()>3))) { return false; } // out of range - can't throw here if (ProjectileFlyBState::validThrowRange(&action, originVoxel, targetTile) == false) { return false; } std::vector<Position> trajectory; // thows should be around 10 tiles far, make one allocation that fit 99% cases with some margin trajectory.resize(16*20); // we try 8 different curvatures to try and reach our goal. int test = V_OUTOFBOUNDS; while (!foundCurve && curvature < 5.0) { trajectory.clear(); test = calculateParabola(originVoxel, targetVoxel, true, &trajectory, action.actor, curvature, Position(0,0,0)); //position that item hit Position hitPos = (trajectory.back() + Position(0,0,1)) / Position(16, 16, 24); //position where item will land Position tilePos = Projectile::getPositionFromEnd(trajectory, Projectile::ItemDropVoxelOffset) / Position(16, 16, 24); if (forced || (test != V_OUTOFBOUNDS && tilePos == targetPos)) { if (voxelType) { *voxelType = test; } foundCurve = true; } else { curvature += 0.5; if (test != V_OUTOFBOUNDS && action.actor->getFaction() == FACTION_PLAYER) //obstacle indicator is only for player { Tile* hitTile = _save->getTile(hitPos); if (hitTile) { hitTile->setObstacle(test); } } } } if (curvature >= 5.0) { return false; } if (curve) { *curve = curvature; } return true; } /** * Recalculates FOV of all units in-game. */ void TileEngine::recalculateFOV() { for (std::vector<BattleUnit*>::iterator bu = _save->getUnits()->begin(); bu != _save->getUnits()->end(); ++bu) { if ((*bu)->getTile() != 0) { calculateFOV(*bu); } } } /** * Returns the direction from origin to target. * @param origin The origin point of the action. * @param target The target point of the action. * @return direction. */ int TileEngine::getDirectionTo(Position origin, Position target) const { double ox = target.x - origin.x; double oy = target.y - origin.y; double angle = atan2(ox, -oy); // divide the pie in 4 angles each at 1/8th before each quarter double pie[4] = {(M_PI_4 * 4.0) - M_PI_4 / 2.0, (M_PI_4 * 3.0) - M_PI_4 / 2.0, (M_PI_4 * 2.0) - M_PI_4 / 2.0, (M_PI_4 * 1.0) - M_PI_4 / 2.0}; int dir = 0; if (angle > pie[0] || angle < -pie[0]) { dir = 4; } else if (angle > pie[1]) { dir = 3; } else if (angle > pie[2]) { dir = 2; } else if (angle > pie[3]) { dir = 1; } else if (angle < -pie[1]) { dir = 5; } else if (angle < -pie[2]) { dir = 6; } else if (angle < -pie[3]) { dir = 7; } else if (angle < pie[0]) { dir = 0; } return dir; } /** * Gets the origin voxel of a certain action. * @param action Battle action. * @param tile Pointer to the action tile. * @return origin position. */ Position TileEngine::getOriginVoxel(BattleAction &action, Tile *tile) { const int dirYshift[8] = {1, 1, 8, 15,15,15,8, 1}; const int dirXshift[8] = {8, 14,15,15,8, 1, 1, 1}; if (!tile) { tile = action.actor->getTile(); } Position origin = tile->getPosition(); Tile *tileAbove = _save->getTile(origin + Position(0,0,1)); Position originVoxel = Position(origin.x*16, origin.y*16, origin.z*24); // take into account soldier height and terrain level if the projectile is launched from a soldier if (action.actor->getPosition() == origin || action.type != BA_LAUNCH) { // calculate offset of the starting point of the projectile originVoxel.z += -tile->getTerrainLevel(); originVoxel.z += action.actor->getHeight() + action.actor->getFloatHeight(); if (action.type == BA_THROW) { originVoxel.z -= 3; } else { originVoxel.z -= 4; } if (originVoxel.z >= (origin.z + 1)*24) { if (tileAbove && tileAbove->hasNoFloor(0)) { origin.z++; } else { while (originVoxel.z >= (origin.z + 1)*24) { originVoxel.z--; } originVoxel.z -= 4; } } int direction = getDirectionTo(origin, action.target); originVoxel.x += dirXshift[direction]*action.actor->getArmor()->getSize(); originVoxel.y += dirYshift[direction]*action.actor->getArmor()->getSize(); } else { // don't take into account soldier height and terrain level if the projectile is not launched from a soldier(from a waypoint) originVoxel.x += 8; originVoxel.y += 8; originVoxel.z += 16; } return originVoxel; } /** * mark a region of the map as "dangerous" for a turn. * @param pos is the epicenter of the explosion. * @param radius how far to spread out. * @param unit the unit that is triggering this action. */ void TileEngine::setDangerZone(const Position& pos, int radius, BattleUnit *unit) { Tile *tile = _save->getTile(pos); if (!tile) { return; } // set the epicenter as dangerous tile->setDangerous(true); Position originVoxel = (pos * Position(16,16,24)) + Position(8,8,12 + -tile->getTerrainLevel()); Position targetVoxel; for (int x = -radius; x != radius; ++x) { for (int y = -radius; y != radius; ++y) { // we can skip the epicenter if (x != 0 || y != 0) { // make sure we're within the radius if ((x*x)+(y*y) <= (radius*radius)) { tile = _save->getTile(pos + Position(x,y,0)); if (tile) { targetVoxel = ((pos + Position(x,y,0)) * Position(16,16,24)) + Position(8,8,12 + -tile->getTerrainLevel()); std::vector<Position> trajectory; // we'll trace a line here, ignoring all units, to check if the explosion will reach this point // granted this won't properly account for explosions tearing through walls, but then we can't really // know that kind of information before the fact, so let's have the AI assume that the wall (or tree) // is enough to protect them. if (calculateLine(originVoxel, targetVoxel, false, &trajectory, unit, true, false, unit) == V_EMPTY) { if (trajectory.size() && (trajectory.back() / Position(16,16,24)) == pos + Position(x,y,0)) { tile->setDangerous(true); } } } } } } } } }
R1dO/OpenXcom
src/Battlescape/TileEngine.cpp
C++
gpl-3.0
100,009
({ // local representation of all CSS3 named colors, companion to dojo.colors. To be used where descriptive information // is required for each color, such as a palette widget, and not for specifying color programatically. //Note: due to the SVG 1.0 spec additions, some of these are alternate spellings for the same color e.g. gray vs. gray. //TODO: should we be using unique rgb values as keys instead and avoid these duplicates, or rely on the caller to do the reverse mapping? aliceblue: "أزرق فاتح", antiquewhite: "أبيض عتيق", aqua: "أزرق مائي", aquamarine: "أزرق مائل للأخضر (زبرجد) ", azure: "أزرق سماوي ", beige: "بيج", bisque: "أصفر برتقالي الى رمادي مصفر", black: "أسود", blanchedalmond: "أخضر مائل للبياض", blue: "أزرق", blueviolet: "أزرق-بنفسجي", brown: "بني", burlywood: "خشبي", cadetblue: "أزرق ملون بالرمادي", chartreuse: "أخضر مائل للصفرة", chocolate: "بني غامق", coral: "مرجاني", cornflowerblue: "أزرق عنبري", cornsilk: "حريري", crimson: "قرمزي", cyan: "أزرق سماوي", darkblue: "أزرق داكن", darkcyan: "أزرق سماوي داكن", darkgoldenrod: "أصفر ذهبي داكن ", darkgray: "رمادي داكن", darkgreen: "أخضر داكن", darkgrey: "رمادي داكن", // same as darkgray darkkhaki: "كاكي داكن", darkmagenta: "قرمزي داكن", darkolivegreen: "أخضر زيتوني داكن", darkorange: "برتقالي داكن", darkorchid: "أرجواني داكن", darkred: "أحمر داكن", darksalmon: "فضي داكن", darkseagreen: "أخضر مائل للأزرق داكن", darkslateblue: "أزرق اردوازي داكن", darkslategray: "رمادي اردوازي داكن", darkslategrey: "رمادي اردوازي داكن", // same as darkslategray darkturquoise: "تركواز داكن", darkviolet: "بنفسجي داكن", deeppink: "أحمر وردي غامق", deepskyblue: "أزرق سماوي غامق", dimgray: "رمادي شاحب", dimgrey: "رمادي شاحب", // same as dimgray dodgerblue: "أزرق عنبري", firebrick: "أصفر زاهي", floralwhite: "أبيض زهري ", forestgreen: "أخضر بلون أشجار الغابات ", fuchsia: "فوشيا", gainsboro: "رمادي مائل للأزرق فاتح ", ghostwhite: "أبيض شفاف", gold: "ذهبي", goldenrod: "أصفر ذهبي ", gray: "رمادي", green: "أخضر", greenyellow: "أخضر مائل للأصفر", grey: "رمادي", // same as gray honeydew: "أبيض مائل للأخضر ", hotpink: "أحمر وردي زاهي", indianred: "أحمر هندي", indigo: "نيلي", ivory: "عاجي", khaki: "كاكي", lavender: "أرجواني شاحب", lavenderblush: "أحمر أرجواني", lawngreen: "أخضر بلون العشب ", lemonchiffon: "أصفر شفاف ", lightblue: "أزرق فاتح", lightcoral: "مرجاني فاتح", lightcyan: "سماوي فاتح", lightgoldenrodyellow: "أصفر ذهبي فاتح", lightgray: "رمادي فاتح", lightgreen: "أخضر فاتح", lightgrey: "رمادي فاتح", // same as lightgray lightpink: "وردي فاتح", lightsalmon: "فضي فاتح", lightseagreen: "أخضر مائل للأزرق فاتح", lightskyblue: "أزرق سماوي فاتح", lightslategray: "رمادي اردوازي فاتح", lightslategrey: "رمادي اردوازي فاتح", // same as lightslategray lightsteelblue: "أزرق معدني فاتح", lightyellow: "أصفر فاتح ", lime: "ليموني ", limegreen: "أخضر ليموني ", linen: "كتاني ", magenta: "أحمر قرمزي ", maroon: "أحمر داكن ", mediumaquamarine: "أزرق مائل للأخضر (زبرجد) متوسط ", mediumblue: "أزرق متوسط ", mediumorchid: "أرجواني متوسط ", mediumpurple: "قرمزي متوسط ", mediumseagreen: "أخضر مائل للأزرق متوسط ", mediumslateblue: "أزرق اردوازي متوسط ", mediumspringgreen: "أخضر ربيعي متوسط ", mediumturquoise: "تركواز متوسط ", mediumvioletred: "أحمر-بنفسجي متوسط ", midnightblue: "أزرق بحري ", mintcream: "أصفر شاحب مائل للأخضر الزرعي ", mistyrose: "وردي ", moccasin: "نحاسي أحمر ", navajowhite: "أبيض ملاحي ", navy: "أزرق داكن ", oldlace: "برتقالي مائل للأصفر شاحب ", olive: "أخضر زيتوني داكن ", olivedrab: "أسود فاتح ", orange: "برتقالي ", orangered: "أحمر مائل للبرتقالي ", orchid: "أرجواني فاتح ", palegoldenrod: "أصفر ذهبي شاحب ", palegreen: "أخضر شاحب ", paleturquoise: "تركواز شاحب ", palevioletred: "أحمر-بنفسجي شاحب ", papayawhip: "خوخي فاتح ", peachpuff: "خوخي مائل للأصفر ", peru: "بني جملي ", pink: "وردي ", plum: "أرجواني داكن ", powderblue: "أزرق مائل للأصفر ", purple: "ارجواني ", red: "أحمر ", rosybrown: "بني وردي ", royalblue: "أزرق ملكي ", saddlebrown: "بني فاتح ", salmon: "برتقالي وردي شاحب ", sandybrown: "بني مائل للصفرة ", seagreen: "أخضر مائل للأزرق ", seashell: "أبيض مائل للأصفر فاتح ", sienna: "بني محروق ", silver: "فضي ", skyblue: "أزرق سماوي ", slateblue: "أزرق اردوازي ", slategray: "رمادي اردوازي ", slategrey: "رمادي اردوازي ", // same as slategray snow: "أبيض ثلجي ", springgreen: "أخضر ربيعي ", steelblue: "أزرق معدني ", tan: "خمري ", teal: "بترولي ", thistle: "ارجواني شاحب ", tomato: "أحمر مائل للأصفر ", turquoise: "تركواز ", violet: "بنفسجي ", wheat: "أخضر قمحي ", white: "أبيض ", whitesmoke: "دخان أبيض ", yellow: "أصفر ", yellowgreen: "أخضر مائل للأصفر " })
Emergen/zivios-panel
web/public/scripts/devel/current/dojo/nls/ar/colors.js
JavaScript
gpl-3.0
6,045
/* * tracker/SamplePlayer.cpp * * Copyright 2009 Peter Barth * * This file is part of Milkytracker. * * Milkytracker 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. * * Milkytracker 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 Milkytracker. If not, see <http://www.gnu.org/licenses/>. * */ /* * SamplePlayer.cpp * MilkyTracker * * Created by Peter Barth on 13.12.07. * */ #include "SamplePlayer.h" #include "ModuleEditor.h" #include "SampleEditor.h" #include "PlayerController.h" void SamplePlayer::playSample(const TXMSample& smp, pp_uint32 note, pp_int32 rangeStart/* = -1*/, pp_int32 rangeEnd/* = -1*/) { playerController.playSample(smp, note, rangeStart, rangeEnd); } void SamplePlayer::playSample(pp_int32 insIndex, pp_int32 smpIndex, pp_uint32 note) { playSample(*moduleEditor.getSampleInfo(insIndex, smpIndex), note); } void SamplePlayer::playSample(pp_int32 insIndex, pp_uint32 note) { const mp_ubyte* nbu = moduleEditor.getSampleTable(insIndex); pp_int32 smpIndex = nbu[note]; playSample(insIndex, smpIndex, note); } void SamplePlayer::playCurrentSample(pp_uint32 note) { playSample(*moduleEditor.getSampleEditor()->getSample(), note); } void SamplePlayer::playCurrentSampleFromOffset(pp_uint32 offset, pp_uint32 note) { SampleEditor* sampleEditor = moduleEditor.getSampleEditor(); if (offset != -1) { playSample(*sampleEditor->getSample(), note, offset, sampleEditor->getSampleLen()); } } void SamplePlayer::playCurrentSampleSelectionRange(pp_uint32 note) { SampleEditor* sampleEditor = moduleEditor.getSampleEditor(); if (sampleEditor->getLogicalSelectionStart() != -1 && sampleEditor->getLogicalSelectionEnd() != -1) { playSample(*sampleEditor->getSample(), note, sampleEditor->getLogicalSelectionStart(), sampleEditor->getLogicalSelectionEnd()); } } void SamplePlayer::stopSamplePlayback() { playerController.stopSample(); }
dwhinham/MilkyTracker
src/tracker/SamplePlayer.cpp
C++
gpl-3.0
2,413
/***************************************************************************** * * PROJECT: Multi Theft Auto v1.0 * LICENSE: See LICENSE in the top level directory * FILE: game_sa/CWantedSA.cpp * PURPOSE: Wanted level management * DEVELOPERS: Ed Lyons <eai@opencoding.net> * Christian Myhre Lundheim <> * * Multi Theft Auto is available from http://www.multitheftauto.com/ * *****************************************************************************/ #include <main.h> CWantedSA::CWantedSA ( void ) { // TODO: Call GTA's new operator for CWanted. Lack of proper initialization might be causing crashes. internalInterface = new CWantedSAInterface; memset ( internalInterface, 0, sizeof ( CWantedSAInterface ) ); m_bDontDelete = false; } CWantedSA::CWantedSA ( CWantedSAInterface* wantedInterface ) { internalInterface = wantedInterface; m_bDontDelete = true; } CWantedSA::~CWantedSA ( void ) { if ( !m_bDontDelete ) { // TODO: Call GTA's delete operator for CWanted. Lack of proper destruction might be causing crashes. delete internalInterface; } } void CWantedSA::SetMaximumWantedLevel ( DWORD dwWantedLevel ) { DWORD dwFunc = FUNC_SetMaximumWantedLevel; _asm { push dwWantedLevel call dwFunc add esp, 4 } } void CWantedSA::SetWantedLevel ( DWORD dwWantedLevel ) { DWORD dwThis = (DWORD)this->GetInterface(); DWORD dwFunc = FUNC_SetWantedLevel; _asm { mov ecx, dwThis push dwWantedLevel call dwFunc } } void CWantedSA::SetWantedLevelNoDrop ( DWORD dwWantedLevel ) { DWORD dwThis = (DWORD)this->GetInterface(); DWORD dwFunc = FUNC_SetWantedLevelNoDrop; _asm { mov ecx, dwThis push dwWantedLevel call dwFunc } }
BlastHackNet/mod_s0beit_sa
src/game_sa/CWantedSA.cpp
C++
gpl-3.0
1,750
using System; using System.Collections.Generic; using DynamicData; using TailBlazer.Domain.Annotations; namespace TailBlazer.Domain.FileHandling.Search { public interface ISearchMetadataCollection : IDisposable { IObservableCache<SearchMetadata, string> Metadata { get; } void Add(IEnumerable<SearchMetadata> metadata); void AddorUpdate(SearchMetadata metadata); void Remove(string searchText); int NextIndex(); } }
mreichardt95/TailBlazer
Source/TailBlazer.Domain/FileHandling/Search/ISearchMetadataCollection.cs
C#
gpl-3.0
472
# Copyright: (c) 2012, Michael DeHaan <michael.dehaan@gmail.com> # Copyright: (c) 2018, Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible import constants as C from ansible import context from ansible.cli import CLI from ansible.cli.arguments import optparse_helpers as opt_help from ansible.errors import AnsibleError, AnsibleOptionsError from ansible.executor.task_queue_manager import TaskQueueManager from ansible.module_utils._text import to_text from ansible.parsing.splitter import parse_kv from ansible.playbook import Playbook from ansible.playbook.play import Play from ansible.plugins.loader import get_all_plugin_loaders from ansible.utils.display import Display display = Display() class AdHocCLI(CLI): ''' is an extra-simple tool/framework/API for doing 'remote things'. this command allows you to define and run a single task 'playbook' against a set of hosts ''' def init_parser(self): ''' create an options parser for bin/ansible ''' super(AdHocCLI, self).init_parser(usage='%prog <host-pattern> [options]', desc="Define and run a single task 'playbook' against" " a set of hosts", epilog="Some modules do not make sense in Ad-Hoc (include," " meta, etc)") opt_help.add_runas_options(self.parser) opt_help.add_inventory_options(self.parser) opt_help.add_async_options(self.parser) opt_help.add_output_options(self.parser) opt_help.add_connect_options(self.parser) opt_help.add_check_options(self.parser) opt_help.add_runtask_options(self.parser) opt_help.add_vault_options(self.parser) opt_help.add_fork_options(self.parser) opt_help.add_module_options(self.parser) opt_help.add_basedir_options(self.parser) # options unique to ansible ad-hoc self.parser.add_option('-a', '--args', dest='module_args', help="module arguments", default=C.DEFAULT_MODULE_ARGS) self.parser.add_option('-m', '--module-name', dest='module_name', help="module name to execute (default=%s)" % C.DEFAULT_MODULE_NAME, default=C.DEFAULT_MODULE_NAME) def post_process_args(self, options, args): '''Post process and validate options for bin/ansible ''' options, args = super(AdHocCLI, self).post_process_args(options, args) if len(args) < 1: raise AnsibleOptionsError("Missing target hosts") elif len(args) > 1: raise AnsibleOptionsError("Extraneous options or arguments") display.verbosity = options.verbosity self.validate_conflicts(options, runas_opts=True, vault_opts=True, fork_opts=True) options = self.normalize_become_options(options) return options, args def _play_ds(self, pattern, async_val, poll): check_raw = context.CLIARGS['module_name'] in ('command', 'win_command', 'shell', 'win_shell', 'script', 'raw') mytask = {'action': {'module': context.CLIARGS['module_name'], 'args': parse_kv(context.CLIARGS['module_args'], check_raw=check_raw)}} # avoid adding to tasks that don't support it, unless set, then give user an error if context.CLIARGS['module_name'] not in ('include_role', 'include_tasks') or any(frozenset((async_val, poll))): mytask['async_val'] = async_val mytask['poll'] = poll return dict( name="Ansible Ad-Hoc", hosts=pattern, gather_facts='no', tasks=[mytask]) def run(self): ''' create and execute the single task playbook ''' super(AdHocCLI, self).run() # only thing left should be host pattern pattern = to_text(context.CLIARGS['args'][0], errors='surrogate_or_strict') sshpass = None becomepass = None (sshpass, becomepass) = self.ask_passwords() passwords = {'conn_pass': sshpass, 'become_pass': becomepass} # dynamically load any plugins get_all_plugin_loaders() loader, inventory, variable_manager = self._play_prereqs() try: hosts = self.get_host_list(inventory, context.CLIARGS['subset'], pattern) except AnsibleError: if context.CLIARGS['subset']: raise else: hosts = [] display.warning("No hosts matched, nothing to do") if context.CLIARGS['listhosts']: display.display(' hosts (%d):' % len(hosts)) for host in hosts: display.display(' %s' % host) return 0 if context.CLIARGS['module_name'] in C.MODULE_REQUIRE_ARGS and not context.CLIARGS['module_args']: err = "No argument passed to %s module" % context.CLIARGS['module_name'] if pattern.endswith(".yml"): err = err + ' (did you mean to run ansible-playbook?)' raise AnsibleOptionsError(err) # Avoid modules that don't work with ad-hoc if context.CLIARGS['module_name'] in ('import_playbook',): raise AnsibleOptionsError("'%s' is not a valid action for ad-hoc commands" % context.CLIARGS['module_name']) play_ds = self._play_ds(pattern, context.CLIARGS['seconds'], context.CLIARGS['poll_interval']) play = Play().load(play_ds, variable_manager=variable_manager, loader=loader) # used in start callback playbook = Playbook(loader) playbook._entries.append(play) playbook._file_name = '__adhoc_playbook__' if self.callback: cb = self.callback elif context.CLIARGS['one_line']: cb = 'oneline' # Respect custom 'stdout_callback' only with enabled 'bin_ansible_callbacks' elif C.DEFAULT_LOAD_CALLBACK_PLUGINS and C.DEFAULT_STDOUT_CALLBACK != 'default': cb = C.DEFAULT_STDOUT_CALLBACK else: cb = 'minimal' run_tree = False if context.CLIARGS['tree']: C.DEFAULT_CALLBACK_WHITELIST.append('tree') C.TREE_DIR = context.CLIARGS['tree'] run_tree = True # now create a task queue manager to execute the play self._tqm = None try: self._tqm = TaskQueueManager( inventory=inventory, variable_manager=variable_manager, loader=loader, passwords=passwords, stdout_callback=cb, run_additional_callbacks=C.DEFAULT_LOAD_CALLBACK_PLUGINS, run_tree=run_tree, forks=context.CLIARGS['forks'], ) self._tqm.send_callback('v2_playbook_on_start', playbook) result = self._tqm.run(play) self._tqm.send_callback('v2_playbook_on_stats', self._tqm._stats) finally: if self._tqm: self._tqm.cleanup() if loader: loader.cleanup_all_tmp_files() return result
gregdek/ansible
lib/ansible/cli/adhoc.py
Python
gpl-3.0
7,375
using System; using System.ComponentModel; using System.Diagnostics; using ResourceManager.Xliff; namespace TranslationApp { [DebuggerDisplay("{" + nameof(DebuggerDisplay) + ",nq}")] public class TranslationItemWithCategory : INotifyPropertyChanged, ICloneable { public TranslationItemWithCategory() { _item = new TranslationItem(); } public TranslationItemWithCategory(string category, TranslationItem item) { Category = category; _item = item; } public string Category { get; set; } private readonly TranslationItem _item; public TranslationItem GetTranslationItem() { return _item; } public string Name { get => _item.Name; set => _item.Name = value; } public string Property { get => _item.Property; set => _item.Property = value; } public string NeutralValue { get => _item.Source; set => _item.Source = value; } public string TranslatedValue { get => _item.Value; set { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(TranslatedValue))); _item.Value = value; } } public event PropertyChangedEventHandler PropertyChanged; public bool IsSourceEqual(string value) { if (NeutralValue is null) { return true; } bool equal = value == NeutralValue; if (!equal && value.Contains("\n")) { return value.Replace(Environment.NewLine, "\n") == NeutralValue.Replace(Environment.NewLine, "\n"); } return equal; } private string DebuggerDisplay => string.Format("\"{0}\" - \"{1}\"", Category, NeutralValue); object ICloneable.Clone() { return Clone(); } public TranslationItemWithCategory Clone() { return new TranslationItemWithCategory(Category, _item.Clone()); } } }
PKRoma/gitextensions
TranslationApp/TranslationItemWithCategory.cs
C#
gpl-3.0
2,236
#region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. */ #endregion using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("OpenRA.Renderer.Cg")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("OpenRA.Renderer.Cg")] [assembly: AssemblyCopyright("Copyright © Microsoft 2010")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("5531344c-b25d-4641-bc3c-fe035cc777bd")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
Iran/ClassicRA
OpenRA.Renderer.Cg/Properties/AssemblyInfo.cs
C#
gpl-3.0
1,764
$(function() { var resultCache = []; var allItems = $(".index .item"); $("#filter_text").keyup(function(){ var searchString = $(this).val(); allItems.addClass('visibility_hidden'); var items; if (resultCache[searchString] === undefined) { items = $(".index .item .text").textContains(searchString).parent().parent(); resultCache[searchString] = items; } else { items = resultCache[searchString]; } items.removeClass('visibility_hidden'); $("#numberFiltered").text(items.length); $("#numberFilteredText").text(items.length == 1 ? $T("author") : $T("authors")); }); $(".material_icon").each(function() { $(this).qtip({ style: { classes: 'material_tip' }, content: { text: $(this).siblings('.material_list') }, show: { event: 'click' }, hide: { event: 'unfocus' }, position: { my: 'top right', at: 'bottom left' } }); }); });
Ictp/indico
indico/htdocs/js/indico/jquery/authors.js
JavaScript
gpl-3.0
1,191
#ifndef BOOST_MPL_COPY_IF_HPP_INCLUDED #define BOOST_MPL_COPY_IF_HPP_INCLUDED // Copyright Aleksey Gurtovoy 2000-2004 // Copyright David Abrahams 2003-2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/mpl for documentation. // $Source$ // $Date: 2004-09-02 11:41:37 -0400 (Thu, 02 Sep 2004) $ // $Revision: 24874 $ #include <boost/mpl/fold.hpp> #include <boost/mpl/reverse_fold.hpp> #include <boost/mpl/apply.hpp> #include <boost/mpl/eval_if.hpp> #include <boost/mpl/identity.hpp> #include <boost/mpl/protect.hpp> #include <boost/mpl/aux_/inserter_algorithm.hpp> #include <boost/mpl/aux_/config/forwarding.hpp> namespace boost { namespace mpl { namespace aux { template< typename Operation , typename Predicate > struct copy_if_op { template< typename Sequence, typename T > struct apply #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING) : eval_if< typename apply1<Predicate,T>::type , apply2<Operation,Sequence,T> , identity<Sequence> > { #else { typedef typename eval_if< typename apply1<Predicate,T>::type , apply2<Operation,Sequence,T> , identity<Sequence> >::type type; #endif }; }; template< typename Sequence , typename Predicate , typename Inserter > struct copy_if_impl : fold< Sequence , typename Inserter::state , protect< aux::copy_if_op< typename Inserter::operation , Predicate > > > { }; template< typename Sequence , typename Predicate , typename Inserter > struct reverse_copy_if_impl : reverse_fold< Sequence , typename Inserter::state , protect< aux::copy_if_op< typename Inserter::operation , Predicate > > > { }; } // namespace aux BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(3, copy_if) }} #endif // BOOST_MPL_COPY_IF_HPP_INCLUDED
TheSkorm/ISA100.11a-Gateway
cpplib/trunk/boost_1_36_0/boost/mpl/copy_if.hpp
C++
gpl-3.0
2,144
<?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Strings for component 'question', language 'en', branch 'MOODLE_20_STABLE' * * @package core_question * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ $string['addmorechoiceblanks'] = 'Blanks for {no} more choices'; $string['addcategory'] = 'Add category'; $string['adminreport'] = 'Report on possible problems in your question database.'; $string['advancedsearchoptions'] = 'Search options'; $string['alltries'] = 'All tries'; $string['answers'] = 'Answers'; $string['availableq'] = 'Available?'; $string['badbase'] = 'Bad base before **: {$a}**'; $string['behaviour'] = 'Behaviour'; $string['broken'] = 'This is a "broken link", it points to a nonexistent file.'; $string['byandon'] = 'by <em>{$a->user}</em> on <em>{$a->time}</em>'; $string['cannotcopybackup'] = 'Could not copy backup file'; $string['cannotcreate'] = 'Could not create new entry in question_attempts table'; $string['cannotcreatepath'] = 'Cannot create path: {$a}'; $string['cannotdeletebehaviourinuse'] = 'You cannot delete the behaviour \'{$a}\'. It is used by question attempts.'; $string['cannotdeletecate'] = 'You can\'t delete that category it is the default category for this context.'; $string['cannotdeleteneededbehaviour'] = 'Cannot delete the question behaviour \'{$a}\'. There are other behaviours installed that rely on it.'; $string['cannotdeleteqtypeinuse'] = 'You cannot delete the question type \'{$a}\'. There are questions of this type in the question bank.'; $string['cannotdeleteqtypeneeded'] = 'You cannot delete the question type \'{$a}\'. There are other question types installed that rely on it.'; $string['cannotdeletetopcat'] = 'Top categories can not be deleted.'; $string['cannotedittopcat'] = 'Top categories can not be edited.'; $string['cannotenable'] = 'Question type {$a} cannot be created directly.'; $string['cannotenablebehaviour'] = 'Question behaviour {$a} cannot be used directly. It is for internal use only.'; $string['cannotfindcate'] = 'Could not find category record'; $string['cannotfindquestionfile'] = 'Could not find question data file in zip'; $string['cannotgetdsfordependent'] = 'Cannot get the specified dataset for a dataset dependent question! (question: {$a->id}, datasetitem: {$a->item})'; $string['cannotgetdsforquestion'] = 'Cannot get the specified dataset for a calculated question! (question: {$a})'; $string['cannothidequestion'] = 'Was not able to hide question'; $string['cannotimportformat'] = 'Sorry, importing this format is not yet implemented!'; $string['cannotinsertquestion'] = 'Could not insert new question!'; $string['cannotinsertquestioncatecontext'] = 'Could not insert the new question category {$a->cat} illegal contextid {$a->ctx}'; $string['cannotloadquestion'] = 'Could not load question'; $string['cannotmovequestion'] = 'You can\'t use this script to move questions that have files associated with them from different areas.'; $string['cannotopenforwriting'] = 'Cannot open for writing: {$a}'; $string['cannotpreview'] = 'You can\'t preview these questions!'; $string['cannotread'] = 'Cannot read import file (or file is empty)'; $string['cannotretrieveqcat'] = 'Could not retrieve question category'; $string['cannotunhidequestion'] = 'Failed to unhide the question.'; $string['cannotunzip'] = 'Could not unzip file.'; $string['cannotwriteto'] = 'Cannot write exported questions to {$a}'; $string['categories'] = 'Categories'; $string['categorycurrent'] = 'Current category'; $string['categorycurrentuse'] = 'Use this category'; $string['categorydoesnotexist'] = 'This category does not exist'; $string['categoryinfo'] = 'Category info'; $string['categorymove'] = 'The category \'{$a->name}\' contains {$a->count} questions (some of which may be hidden questions or random questions that are still in use in a quiz). Please choose another category to move them to.'; $string['categorymoveto'] = 'Save in category'; $string['categorynamecantbeblank'] = 'The category name cannot be blank.'; $string['clickflag'] = 'Flag question'; $string['clicktoflag'] = 'Flag this question for future reference'; $string['clicktounflag'] = 'Remove flag'; $string['clickunflag'] = 'Remove flag'; $string['contexterror'] = 'You shouldn\'t have got here if you\'re not moving a category to another context.'; $string['copy'] = 'Copy from {$a} and change links.'; $string['created'] = 'Created'; $string['createdby'] = 'Created by'; $string['createdmodifiedheader'] = 'Created / last saved'; $string['createnewquestion'] = 'Create a new question ...'; $string['cwrqpfs'] = 'Random questions selecting questions from sub categories.'; $string['cwrqpfsinfo'] = '<p>During the upgrade to Moodle 1.9 we will separate question categories into different contexts. Some question categories and questions on your site will have to have their sharing status changed. This is necessary in the rare case that one or more \'random\' questions in a quiz are set up to select from a mixture of shared and unshared categories (as is the case on this site). This happens when a \'random\' question is set to select from subcategories and one or more subcategories have a different sharing status to the parent category in which the random question is created.</p> <p>The following question categories, from which \'random\' questions in parent categories select questions from, will have their sharing status changed to the same sharing status as the category with the \'random\' question in on upgrading to Moodle 1.9. The following categories will have their sharing status changed. Questions which are affected will continue to work in all existing quizzes until you remove them from these quizzes.</p>'; $string['cwrqpfsnoprob'] = 'No question categories in your site are affected by the \'Random questions selecting questions from sub categories\' issue.'; $string['defaultfor'] = 'Default for {$a}'; $string['defaultinfofor'] = 'The default category for questions shared in context \'{$a}\'.'; $string['defaultmarkmustbepositive'] = 'The default mark must be positive.'; $string['deletecoursecategorywithquestions'] = 'There are questions in the question bank associated with this course category. If you proceed, they will be deleted. You may wish to move them first, using the question bank interface.'; $string['deletequestioncheck'] = 'Are you absolutely sure you want to delete \'{$a}\'?'; $string['deletequestionscheck'] = 'Are you absolutely sure you want to delete the following questions?<br /><br />{$a}'; $string['deletingbehaviour'] = 'Deleting question behaviour \'{$a}\''; $string['deletingqtype'] = 'Deleting question type \'{$a}\''; $string['didnotmatchanyanswer'] = '[Did not match any answer]'; $string['disabled'] = 'Disabled'; $string['disterror'] = 'The distribution {$a} caused problems'; $string['donothing'] = 'Don\'t copy or move files or change links.'; $string['editcategories'] = 'Edit categories'; $string['editcategories_help'] = 'Rather than keeping everything in one big list, questions may be arranged into categories and subcategories. Each category has a context which determines where the questions in the category can be used: * Activity context - Questions only available in the activity module * Course context - Questions available in all activity modules in the course * Course category context - Questions available in all activity modules and courses in the course category * System context - Questions available in all courses and activities on the site Categories are also used for random questions, as questions are selected from a particular category.'; $string['editcategories_link'] = 'question/category'; $string['editcategory'] = 'Edit category'; $string['editingcategory'] = 'Editing a category'; $string['editingquestion'] = 'Editing a question'; $string['editquestion'] = 'Edit question'; $string['editthiscategory'] = 'Edit this category'; $string['emptyxml'] = 'Unkown error - empty imsmanifest.xml'; $string['enabled'] = 'Enabled'; $string['erroraccessingcontext'] = 'Cannot access context'; $string['errordeletingquestionsfromcategory'] = 'Error deleting questions from category {$a}.'; $string['errorduringpost'] = 'Error occurred during post-processing!'; $string['errorduringpre'] = 'Error occurred during pre-processing!'; $string['errorduringproc'] = 'Error occurred during processing!'; $string['errorduringregrade'] = 'Could not regrade question {$a->qid}, going to state {$a->stateid}.'; $string['errorfilecannotbecopied'] = 'Error: cannot copy file {$a}.'; $string['errorfilecannotbemoved'] = 'Error: cannot move file {$a}.'; $string['errorfileschanged'] = 'Error: files linked to from questions have changed since form was displayed.'; $string['erroritemappearsmorethanoncewithdifferentweight'] = 'The question ({$a}) appears more than once with different weights in different positions of the test. This is not currently supported by the statistics report and may make the statistics for this question unreliable.'; $string['errormanualgradeoutofrange'] = 'The grade {$a->grade} is not between 0 and {$a->maxgrade} for question {$a->name}. The score and comment have not been saved.'; $string['errormovingquestions'] = 'Error while moving questions with ids {$a}.'; $string['errorpostprocess'] = 'Error occurred during post-processing!'; $string['errorpreprocess'] = 'Error occurred during pre-processing!'; $string['errorprocess'] = 'Error occurred during processing!'; $string['errorprocessingresponses'] = 'An error occurred while processing your responses ({$a}). Click continue to return to the page you were on and try again.'; $string['errorsavingcomment'] = 'Error saving the comment for question {$a->name} in the database.'; $string['errorupdatingattempt'] = 'Error updating attempt {$a->id} in the database.'; $string['eventquestioncategorycreated'] = 'Question category created'; $string['eventquestioncategorydeleted'] = 'Question category deleted'; $string['eventquestioncategorymoved'] = 'Question category moved'; $string['eventquestioncategoryupdated'] = 'Question category updated'; $string['eventquestioncategoryviewed'] = 'Question category viewed'; $string['eventquestioncreated'] = 'Question created'; $string['eventquestiondeleted'] = 'Question deleted'; $string['eventquestionmoved'] = 'Question moved'; $string['eventquestionviewed'] = 'Question viewed'; $string['eventquestionsexported'] = 'Questions exported'; $string['eventquestionsimported'] = 'Questions imported'; $string['eventquestionupdated'] = 'Question updated'; $string['export'] = 'Export'; $string['exportcategory'] = 'Export category'; $string['exportcategory_help'] = 'This setting determines the category from which the exported questions will be taken. Certain import formats, such as GIFT and Moodle XML, permit category and context data to be included in the export file, enabling them to (optionally) be recreated on import. If required, the appropriate checkboxes should be ticked.'; $string['exporterror'] = 'Errors occur during exporting!'; $string['exportfilename'] = 'questions'; $string['exportnameformat'] = '%Y%m%d-%H%M'; $string['exportonequestion'] = 'Download this question in Moodle XML format'; $string['exportquestions'] = 'Export questions to file'; $string['exportquestions_help'] = 'This function enables the export of a complete category (and any subcategories) of questions to file. Please note that, depending on the file format selected, some question data and certain question types may not be exported.'; $string['exportquestions_link'] = 'question/export'; $string['filecantmovefrom'] = 'The questions files cannot be moved because you do not have permission to remove files from the place you are trying to move questions from.'; $string['filecantmoveto'] = 'The question files cannot be moved or copied becuase you do not have permission to add files to the place you are trying to move the questions to.'; $string['fileformat'] = 'File format'; $string['filesareacourse'] = 'the course files area'; $string['filesareasite'] = 'the site files area'; $string['filestomove'] = 'Move / copy files to {$a}?'; $string['filterbytags'] = 'Filter by tags...'; $string['firsttry'] = 'First try'; $string['flagged'] = 'Flagged'; $string['flagthisquestion'] = 'Flag this question'; $string['formquestionnotinids'] = 'Form contained question that is not in questionids'; $string['fractionsnomax'] = 'One of the answers should have a score of 100% so it is possible to get full marks for this question.'; $string['getcategoryfromfile'] = 'Get category from file'; $string['getcontextfromfile'] = 'Get context from file'; $string['changepublishstatuscat'] = '<a href="{$a->caturl}">Category "{$a->name}"</a> in course "{$a->coursename}" will have it\'s sharing status changed from <strong>{$a->changefrom} to {$a->changeto}</strong>.'; $string['chooseqtypetoadd'] = 'Choose a question type to add'; $string['editquestions'] = 'Edit questions'; $string['idnumber'] = 'ID number'; $string['idnumber_help'] = 'If used, the ID number must be unique within each question category. It provides another way of identifying a question which is sometimes useful, but can usually be left blank.'; $string['ignorebroken'] = 'Ignore broken links'; $string['impossiblechar'] = 'Impossible character {$a} detected as parenthesis character'; $string['import'] = 'Import'; $string['importcategory'] = 'Import category'; $string['importcategory_help'] = 'This setting determines the category into which the imported questions will go. Certain import formats, such as GIFT and Moodle XML, may include category and context data in the import file. To make use of this data, rather than the selected category, the appropriate checkboxes should be ticked. If categories specified in the import file do not exist, they will be created.'; $string['importerror'] = 'An error occurred during import processing'; $string['importerrorquestion'] = 'Error importing question'; $string['importingquestions'] = 'Importing {$a} questions from file'; $string['importparseerror'] = 'Error(s) found parsing the import file. No questions have been imported. To import any good questions try again setting \'Stop on error\' to \'No\''; $string['importquestions'] = 'Import questions from file'; $string['importquestions_help'] = 'This function enables questions in a variety of formats to be imported via text file. Note that the file must use UTF-8 encoding.'; $string['importquestions_link'] = 'question/import'; $string['importwrongfiletype'] = 'The type of the file you selected ({$a->actualtype}) does not match the type expected by this import format ({$a->expectedtype}).'; $string['invalidarg'] = 'No valid arguments supplied or incorrect server configuration'; $string['invalidcategoryidforparent'] = 'Invalid category id for parent!'; $string['invalidcategoryidtomove'] = 'Invalid category id to move!'; $string['invalidconfirm'] = 'Confirmation string was incorrect'; $string['invalidcontextinhasanyquestions'] = 'Invalid context passed to question_context_has_any_questions.'; $string['invalidgrade'] = 'Grades ({$a}) do not match grade options - question skipped.'; $string['invalidpenalty'] = 'Invalid penalty'; $string['invalidwizardpage'] = 'Incorrect or no wizard page specified!'; $string['lastmodifiedby'] = 'Last modified by'; $string['lasttry'] = 'Last try'; $string['linkedfiledoesntexist'] = 'Linked file {$a} doesn\'t exist'; $string['makechildof'] = 'Make child of \'{$a}\''; $string['maketoplevelitem'] = 'Move to top level'; $string['manualgradeinvalidformat'] = 'That is not a valid number.'; $string['matchgrades'] = 'Match grades'; $string['matchgradeserror'] = 'Error if grade not listed'; $string['matchgradesnearest'] = 'Nearest grade if not listed'; $string['matchgrades_help'] = 'Imported grades must match one of the fixed list of valid grades - 100, 90, 80, 75, 70, 66.666, 60, 50, 40, 33.333, 30, 25, 20, 16.666, 14.2857, 12.5, 11.111, 10, 5, 0 (also negative values). If not, there are two options: * Error if grade not listed - If a question contains any grades not found in the list an error is displayed and that question will not be imported * Nearest grade if not listed - If a grade is found that does not match a value in the list, the grade is changed to the closest matching value in the list '; $string['missingcourseorcmid'] = 'Need to provide courseid or cmid to print_question.'; $string['missingcourseorcmidtolink'] = 'Need to provide courseid or cmid to get_question_edit_link.'; $string['missingimportantcode'] = 'This question type is missing important code: {$a}.'; $string['missingoption'] = 'The cloze question {$a} is missing its options'; $string['modified'] = 'Last saved'; $string['move'] = 'Move from {$a} and change links.'; $string['movecategory'] = 'Move category'; $string['movedquestionsandcategories'] = 'Moved questions and question categories from {$a->oldplace} to {$a->newplace}.'; $string['movelinksonly'] = 'Just change where links point to, do not move or copy files.'; $string['moveq'] = 'Move question(s)'; $string['moveqtoanothercontext'] = 'Move question to another context.'; $string['moveto'] = 'Move to >>'; $string['movingcategory'] = 'Moving category'; $string['movingcategoryandfiles'] = 'Are you sure you want to move category {$a->name} and all child categories to context for "{$a->contextto}"?<br /> We have detected {$a->urlcount} files linked from questions in {$a->fromareaname}, would you like to copy or move these to {$a->toareaname}?'; $string['movingcategorynofiles'] = 'Are you sure you want to move category "{$a->name}" and all child categories to context for "{$a->contextto}"?'; $string['movingquestions'] = 'Moving questions and any files'; $string['movingquestionsandfiles'] = 'Are you sure you want to move question(s) {$a->questions} to context for <strong>"{$a->tocontext}"</strong>?<br /> We have detected <strong>{$a->urlcount} files</strong> linked from these question(s) in {$a->fromareaname}, would you like to copy or move these to {$a->toareaname}?'; $string['movingquestionsnofiles'] = 'Are you sure you want to move question(s) {$a->questions} to context for <strong>"{$a->tocontext}"</strong>?<br /> There are <strong>no files</strong> linked from these question(s) in {$a->fromareaname}.'; $string['needtochoosecat'] = 'You need to choose a category to move this question to or press \'cancel\'.'; $string['nocate'] = 'No such category {$a}!'; $string['nopermissionadd'] = 'You don\'t have permission to add questions here.'; $string['nopermissionmove'] = 'You don\'t have permission to move questions from here. You must save the question in this category or save it as a new question.'; $string['noprobs'] = 'No problems found in your question database.'; $string['noquestions'] = 'No questions were found that could be exported. Make sure that you have selected a category to export that contains questions.'; $string['noquestionsinfile'] = 'There are no questions in the import file'; $string['notagfiltersapplied'] = 'No tag filters applied'; $string['notenoughanswers'] = 'This type of question requires at least {$a} answers'; $string['notenoughdatatoeditaquestion'] = 'Neither a question id, nor a category id and question type, was specified.'; $string['notenoughdatatomovequestions'] = 'You need to provide the question ids of questions you want to move.'; $string['notflagged'] = 'Not flagged'; $string['novirtualquestiontype'] = 'No virtual question type for question type {$a}'; $string['numqas'] = 'No. question attempts'; $string['numquestions'] = 'No. questions'; $string['numquestionsandhidden'] = '{$a->numquestions} (+{$a->numhidden} hidden)'; $string['page-question-x'] = 'Any question page'; $string['page-question-edit'] = 'Question editing page'; $string['page-question-category'] = 'Question category page'; $string['page-question-import'] = 'Question import page'; $string['page-question-export'] = 'Question export page'; $string['parentcategory'] = 'Parent category'; $string['parentcategory_help'] = 'The parent category is the one in which the new category will be placed. "Top" means that this category is not contained in any other category. Category contexts are shown in bold type. There must be at least one category in each context.'; $string['parentcategory_link'] = 'question/category'; $string['parenthesisinproperclose'] = 'Parenthesis before ** is not properly closed in {$a}**'; $string['parenthesisinproperstart'] = 'Parenthesis before ** is not properly started in {$a}**'; $string['parsingquestions'] = 'Parsing questions from import file.'; $string['penaltyfactor'] = 'Penalty factor'; $string['penaltyfactor_help'] = 'This setting determines what fraction of the achieved score is subtracted for each wrong response. It is only applicable if the quiz is run in adaptive mode. The penalty factor should be a number between 0 and 1. A penalty factor of 1 means that the student has to get the answer right in his first response to get any credit for it at all. A penalty factor of 0 means the student can try as often as he likes and still get the full marks.'; $string['permissionedit'] = 'Edit this question'; $string['permissionmove'] = 'Move this question'; $string['permissionsaveasnew'] = 'Save this as a new question'; $string['permissionto'] = 'You have permission to :'; $string['published'] = 'shared'; $string['qtypeveryshort'] = 'T'; $string['questionaffected'] = '<a href="{$a->qurl}">Question "{$a->name}" ({$a->qtype})</a> is in this question category but is also being used in <a href="{$a->qurl}">quiz "{$a->quizname}"</a> in another course "{$a->coursename}".'; $string['questionbank'] = 'Question bank'; $string['questioncategory'] = 'Question category'; $string['questioncatsfor'] = 'Question categories for \'{$a}\''; $string['questiondoesnotexist'] = 'This question does not exist'; $string['questionname'] = 'Question name'; $string['questionno'] = 'Question {$a}'; $string['questionsaveerror'] = 'Errors occur during saving question - ({$a})'; $string['questionsinuse'] = '(* Questions marked by an asterisk are already in use in some quizzes. These questions will not be deleted from these quizzes but only from the category list.)'; $string['questionsmovedto'] = 'Questions still in use moved to "{$a}" in the parent course category.'; $string['questionsrescuedfrom'] = 'Questions saved from context {$a}.'; $string['questionsrescuedfrominfo'] = 'These questions (some of which may be hidden) were saved when context {$a} was deleted because they are still used by some quizzes or other activities.'; $string['questiontags'] = 'Question tags'; $string['questiontype'] = 'Question type'; $string['questionuse'] = 'Use question in this activity'; $string['questionvariant'] = 'Question variant'; $string['reviewresponse'] = 'Review response'; $string['save'] = 'Save'; $string['savechangesandcontinueediting'] = 'Save changes and continue editing'; $string['saveflags'] = 'Save the state of the flags'; $string['selectacategory'] = 'Select a category:'; $string['selectaqtypefordescription'] = 'Select a question type to see its description.'; $string['selectcategoryabove'] = 'Select a category above'; $string['selectquestionsforbulk'] = 'Select questions for bulk actions'; $string['shareincontext'] = 'Share in context for {$a}'; $string['stoponerror'] = 'Stop on error'; $string['stoponerror_help'] = 'This setting determines whether the import process stops when an error is detected, resulting in no questions being imported, or whether any questions containing errors are ignored and any valid questions are imported.'; $string['tofilecategory'] = 'Write category to file'; $string['tofilecontext'] = 'Write context to file'; $string['topfor'] = 'Top for {$a}'; $string['uninstallbehaviour'] = 'Uninstall this question behaviour.'; $string['uninstallqtype'] = 'Uninstall this question type.'; $string['unknown'] = 'Unknown'; $string['unknownquestiontype'] = 'Unknown question type: {$a}.'; $string['unknowntolerance'] = 'Unknown tolerance type {$a}'; $string['unpublished'] = 'unshared'; $string['upgradeproblemcategoryloop'] = 'Problem detected when upgrading question categories. There is a loop in the category tree. The affected category ids are {$a}.'; $string['upgradeproblemcouldnotupdatecategory'] = 'Could not update question category {$a->name} ({$a->id}).'; $string['upgradeproblemunknowncategory'] = 'Problem detected when upgrading question categories. Category {$a->id} refers to parent {$a->parent}, which does not exist. Parent changed to fix problem.'; $string['wrongprefix'] = 'Wrongly formatted nameprefix {$a}'; $string['youmustselectaqtype'] = 'You must select a question type.'; $string['yourfileshoulddownload'] = 'Your export file should start to download shortly. If not, please <a href="{$a}">click here</a>.'; $string['action'] = 'Action'; $string['addanotherhint'] = 'Add another hint'; $string['answer'] = 'Answer'; $string['answersaved'] = 'Answer saved'; $string['attemptfinished'] = 'Attempt finished'; $string['attemptfinishedsubmitting'] = 'Attempt finished submitting: '; $string['behaviourbeingused'] = 'Behaviour being used: {$a}'; $string['cannotloadquestion'] = 'Could not load question'; $string['cannotpreview'] = 'You can\'t preview these questions!'; $string['category'] = 'Category'; $string['changeoptions'] = 'Change options'; $string['attemptoptions'] = 'Attempt options'; $string['displayoptions'] = 'Display options'; $string['check'] = 'Check'; $string['clearwrongparts'] = 'Clear incorrect responses'; $string['closepreview'] = 'Close preview'; $string['combinedfeedback'] = 'Combined feedback'; $string['commented'] = 'Commented: {$a}'; $string['comment'] = 'Comment'; $string['commentormark'] = 'Make comment or override mark'; $string['comments'] = 'Comments'; $string['commentx'] = 'Comment: {$a}'; $string['complete'] = 'Complete'; $string['contexterror'] = 'You shouldn\'t have got here if you\'re not moving a category to another context.'; $string['correct'] = 'Correct'; $string['correctfeedback'] = 'For any correct response'; $string['correctfeedbackdefault'] = 'Your answer is correct.'; $string['decimalplacesingrades'] = 'Decimal places in grades'; $string['defaultmark'] = 'Default mark'; $string['errorsavingflags'] = 'Error saving the flag state.'; $string['feedback'] = 'Feedback'; $string['fillincorrect'] = 'Fill in correct responses'; $string['flagged'] = 'Flagged'; $string['flagthisquestion'] = 'Flag this question'; $string['generalfeedback'] = 'General feedback'; $string['generalfeedback_help'] = 'General feedback is shown to the student after they have completed the question. Unlike specific feedback, which depends on the question type and what response the student gave, the same general feedback text is shown to all students. You can use the general feedback to give students a fully worked answer and perhaps a link to more information they can use if they did not understand the questions.'; $string['hintn'] = 'Hint {no}'; $string['hintnoptions'] = 'Hint {no} options'; $string['hinttext'] = 'Hint text'; $string['howquestionsbehave'] = 'How questions behave'; $string['howquestionsbehave_help'] = 'Students can interact with the questions in the quiz in various different ways. For example, you may wish the students to enter an answer to each question and then submit the entire quiz, before anything is graded or they get any feedback. That would be \'Deferred feedback\' mode. Alternatively, you may wish for students to submit each question as they go along to get immediate feedback, and if they do not get it right immediately, have another try for fewer marks. That would be \'Interactive with multiple tries\' mode. Those are probably the two most commonly used modes of behaviour. '; $string['howquestionsbehave_link'] = 'question/behaviour'; $string['importfromcoursefiles'] = '... or choose a course file to import.'; $string['importfromupload'] = 'Select a file to upload ...'; $string['includesubcategories'] = 'Also show questions from subcategories'; $string['incorrect'] = 'Incorrect'; $string['incorrectfeedback'] = 'For any incorrect response'; $string['incorrectfeedbackdefault'] = 'Your answer is incorrect.'; $string['information'] = 'Information'; $string['invalidanswer'] = 'Incomplete answer'; $string['makecopy'] = 'Make copy'; $string['manualgradeoutofrange'] = 'This grade is outside the valid range.'; $string['manuallygraded'] = 'Manually graded {$a->mark} with comment: {$a->comment}'; $string['mark'] = 'Mark'; $string['markedoutof'] = 'Marked out of'; $string['markedoutofmax'] = 'Marked out of {$a}'; $string['markoutofmax'] = 'Mark {$a->mark} out of {$a->max}'; $string['marks'] = 'Marks'; $string['noresponse'] = '[No response]'; $string['notanswered'] = 'Not answered'; $string['notflagged'] = 'Not flagged'; $string['notgraded'] = 'Not graded'; $string['notshown'] = 'Not shown'; $string['notyetanswered'] = 'Not yet answered'; $string['notchanged'] = 'Not changed since last attempt'; $string['notyourpreview'] = 'This preview does not belong to you'; $string['options'] = 'Options'; $string['parent'] = 'Parent'; $string['partiallycorrect'] = 'Partially correct'; $string['partiallycorrectfeedback'] = 'For any partially correct response'; $string['partiallycorrectfeedbackdefault'] = 'Your answer is partially correct.'; $string['penaltyforeachincorrecttry'] = 'Penalty for each incorrect try'; $string['penaltyforeachincorrecttry_help'] = 'When questions are run using the \'Interactive with multiple tries\' or \'Adaptive mode\' behaviour, so that the student will have several tries to get the question right, then this option controls how much they are penalised for each incorrect try. The penalty is a proportion of the total question grade, so if the question is worth three marks, and the penalty is 0.3333333, then the student will score 3 if they get the question right first time, 2 if they get it right second try, and 1 of they get it right on the third try. For some multi-part questions this scoring logic is applied separately to each part of the question. The details depend on the question type and can be complicated, but the principle is to give students credit for the knowledge they have demonstrated as fairly as possible.'; $string['previewquestion'] = 'Preview question: {$a}'; $string['privacy:metadata:database:question'] = 'The details about a specific question.'; $string['privacy:metadata:database:question:createdby'] = 'The person who created the question.'; $string['privacy:metadata:database:question:generalfeedback'] = 'The general feedback for this question.'; $string['privacy:metadata:database:question:modifiedby'] = 'The person who last updated the question.'; $string['privacy:metadata:database:question:name'] = 'The name of the question.'; $string['privacy:metadata:database:question:questiontext'] = 'The question text.'; $string['privacy:metadata:database:question:timecreated'] = 'The date and time when this question was created.'; $string['privacy:metadata:database:question:timemodified'] = 'The date and time when this question was updated.'; $string['privacy:metadata:database:question_attempt_step_data'] = 'Question attempt steps may have additional data specific to that step. The data is stored in the step_data table.'; $string['privacy:metadata:database:question_attempt_step_data:name'] = 'The name of the data item.'; $string['privacy:metadata:database:question_attempt_step_data:value'] = 'The value of the data item.'; $string['privacy:metadata:database:question_attempt_steps'] = 'Each question attempt has a number of steps to indicate the different phases from beginning to completion to marking. This table stores the information for each of these steps.'; $string['privacy:metadata:database:question_attempt_steps:fraction'] = 'The grade that was awarded to this question attempt scaled to a value out of 1.'; $string['privacy:metadata:database:question_attempt_steps:state'] = 'The state of this question attempt step at the end of the step transition.'; $string['privacy:metadata:database:question_attempt_steps:timecreated'] = 'The date and time that this step transition begun.'; $string['privacy:metadata:database:question_attempt_steps:userid'] = 'The user who performed the step transition.'; $string['privacy:metadata:database:question_attempts'] = 'The information about an attempt at a specific question.'; $string['privacy:metadata:database:question_attempts:flagged'] = 'An indication that the user has flagged this question within the attempt.'; $string['privacy:metadata:database:question_attempts:responsesummary'] = 'A summary of the question response.'; $string['privacy:metadata:database:question_attempts:timemodified'] = 'The time that the question attempt was updated.'; $string['privacy:metadata:link:qbehaviour'] = 'The Question subsystem makes use of the Question Behaviour plugintype.'; $string['privacy:metadata:link:qformat'] = 'The Question subsystem makes use of the Question Format plugintype for the purpose of importing and exporting questions in different formats.'; $string['privacy:metadata:link:qtype'] = 'The Question subsystem interacts with the Question Type plugintype which contains the different types of questions.'; $string['questionbehaviouradminsetting'] = 'Question behaviour settings'; $string['questionbehavioursdisabled'] = 'Question behaviours to disable'; $string['questionbehavioursdisabledexplained'] = 'Enter a comma-separated list of behaviours you do not want to appear in the drop-down menu.'; $string['questionbehavioursorder'] = 'Question behaviours order'; $string['questionbehavioursorderexplained'] = 'Enter a comma-separated list of behaviours in the order you want them to appear in the drop-down menu.'; $string['questionidmismatch'] = 'Question ids mismatch'; $string['questionformtagheader'] = '{$a} tags'; $string['questionname'] = 'Question name'; $string['questionnamecopy'] = '{$a} (copy)'; $string['questionpreviewdefaults'] = 'Question preview defaults'; $string['questionpreviewdefaults_desc'] = 'These defaults are used when a user first previews a question in the question bank. Once a user has previewed a question, their personal preferences are stored as user preferences.'; $string['questions'] = 'Questions'; $string['questionx'] = 'Question {$a}'; $string['questiontext'] = 'Question text'; $string['requiresgrading'] = 'Requires grading'; $string['responsehistory'] = 'Response history'; $string['restart'] = 'Start again'; $string['restartwiththeseoptions'] = 'Start again with these options'; $string['restoremultipletopcats'] = 'The backup file contains more than one top-level question categories for context {$a}.'; $string['rightanswer'] = 'Right answer'; $string['rightanswer_help'] = 'An automatically generated summary of the correct response. This can be limited, so you may wish to consider explaining the correct solution in the general feedback for the question, and turning this option off.'; $string['saved'] = 'Saved: {$a}'; $string['saveflags'] = 'Save the state of the flags'; $string['settingsformultipletries'] = 'Multiple tries'; $string['showhidden'] = 'Also show old questions'; $string['showmarkandmax'] = 'Show mark and max'; $string['showmaxmarkonly'] = 'Show max mark only'; $string['showquestiontext'] = 'Show question text in the question list'; $string['shown'] = 'Shown'; $string['shownumpartscorrect'] = 'Show the number of correct responses'; $string['shownumpartscorrectwhenfinished'] = 'Show the number of correct responses once the question has finished'; $string['specificfeedback'] = 'Specific feedback'; $string['specificfeedback_help'] = 'Feedback that depends on what response the student gave.'; $string['started'] = 'Started'; $string['state'] = 'State'; $string['step'] = 'Step'; $string['steps'] = 'Steps'; $string['submissionoutofsequence'] = 'Access out of sequence. Please do not click the back button when working on quiz questions.'; $string['submissionoutofsequencefriendlymessage'] = "You have entered data outside the normal sequence. This can occur if you use your browser's Back or Forward buttons; please don't use these during the test. It can also happen if you click on something while a page is loading. Click <strong>Continue</strong> to resume."; $string['submit'] = 'Submit'; $string['submitandfinish'] = 'Submit and finish'; $string['submitted'] = 'Submit: {$a}'; $string['tagarea_question'] = 'Questions'; $string['technicalinfo'] = 'Technical information'; $string['technicalinfo_help'] = 'This technical information is probably only useful for developers working on new question types. It may also be helpful when trying to diagnose problems with questions.'; $string['technicalinfominfraction'] = 'Minimum fraction: {$a}'; $string['technicalinfomaxfraction'] = 'Maximum fraction: {$a}'; $string['technicalinfoquestionsummary'] = 'Question summary: {$a}'; $string['technicalinforesponsesummary'] = 'Response summary: {$a}'; $string['technicalinforightsummary'] = 'Right answer summary: {$a}'; $string['technicalinfostate'] = 'Question state: {$a}'; $string['technicalinfovariant'] = 'Question variant: {$a}'; $string['unknownbehaviour'] = 'Unknown behaviour: {$a}.'; $string['unknownorunhandledtype'] = 'Unknown or unhandled question type: {$a}'; $string['unknownquestion'] = 'Unknown question: {$a}.'; $string['unknownquestioncatregory'] = 'Unknown question category: {$a}.'; $string['unknownquestiontype'] = 'Unknown question type: {$a}.'; $string['unusedcategorydeleted'] = 'This category has been deleted because, after deleting the course, its questions weren\'t used any more.'; $string['updatedisplayoptions'] = 'Update display options'; $string['whethercorrect'] = 'Whether correct'; $string['whethercorrect_help'] = 'This covers both the textual description \'Correct\', \'Partially correct\' or \'Incorrect\', and any coloured highlighting that conveys the same information.'; $string['whichtries'] = 'Which tries'; $string['withselected'] = 'With selected'; $string['xoutofmax'] = '{$a->mark} out of {$a->max}'; $string['yougotnright'] = 'You have correctly selected {$a->num}.';
anieminen/moodle
lang/en/question.php
PHP
gpl-3.0
38,813
/** @odoo-module **/ export function isImg(node) { return (node && (node.nodeName === "IMG" || (node.className && node.className.match(/(^|\s)(media_iframe_video|o_image|fa)(\s|$)/i)))); } /** * Returns a list of all the ancestors nodes of the provided node. * * @param {Node} node * @param {Node} [stopElement] include to prevent bubbling up further than the stopElement. * @returns {HTMLElement[]} */ export function ancestors(node, stopElement) { if (!node || !node.parentElement || node === stopElement) return []; return [node.parentElement, ...ancestors(node.parentElement, stopElement)]; }
jeremiahyan/odoo
addons/web_editor/static/src/js/common/wysiwyg_utils.js
JavaScript
gpl-3.0
616
// Generated by CoffeeScript 1.11.1 var Fetcher, ware; ware = require('ware'); Fetcher = (function() { function Fetcher() { this.ware = ware(); } Fetcher.prototype.args = function() { this.args = arguments; return this; }; Fetcher.prototype.use = function(operation) { this.ware.use(operation); return this; }; Fetcher.prototype.fetch = function(callback) { var args; args = [].slice.call(this.args); args.push(callback); return this.ware.run.apply(this.ware, args); }; Fetcher.prototype.getLayers = function() { return this.ware.fns; }; return Fetcher; })(); module.exports = { "new": function() { return new Fetcher; } };
nono/konnectors
build/server/lib/fetcher.js
JavaScript
agpl-3.0
703
class OptimizeScribdRecyclableIndex < ActiveRecord::Migration tag :postdeploy self.transactional = false def self.up if connection.adapter_name == 'PostgreSQL' remove_index :attachments, name: 'scribd_attempts_smt_workflow_state' add_index :attachments, :scribd_attempts, concurrently: true, conditions: "workflow_state='errored' AND scribd_mime_type_id IS NOT NULL", name: 'scribd_attempts_smt_workflow_state' end end def self.down if connection.adapter_name == 'PostgreSQL' remove_index :attachments, name: 'scribd_attempts_smt_workflow_state' add_index :attachments, [:scribd_attempts, :scribd_mime_type_id, :workflow_state], concurrently: true, name: 'scribd_attempts_smt_workflow_state' end end end
owly/wok
db/migrate/20130708201319_optimize_scribd_recyclable_index.rb
Ruby
agpl-3.0
758
/* * Kuali Coeus, a comprehensive research administration system for higher education. * * Copyright 2005-2016 Kuali, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.kuali.kra.institutionalproposal.dao.ojb; import java.util.stream.Collectors; import java.util.stream.Stream; import org.apache.ojb.broker.PersistenceBroker; import org.apache.ojb.broker.accesslayer.QueryCustomizerDefaultImpl; import org.apache.ojb.broker.metadata.CollectionDescriptor; import org.apache.ojb.broker.query.Criteria; import org.apache.ojb.broker.query.Query; import org.apache.ojb.broker.query.QueryByCriteria; import org.kuali.coeus.common.framework.version.VersionStatus; import org.kuali.kra.institutionalproposal.home.InstitutionalProposal; public class AllFundingProposalQueryCustomizer extends QueryCustomizerDefaultImpl { private static final String ACTIVE = "active"; private static final String PROPOSAL_SEQUENCE_STATUS = "proposal.proposalSequenceStatus"; private static final String PROPOSAL_NUMBER = "proposal.proposalNumber"; @Override public Query customizeQuery(Object anObject, PersistenceBroker aBroker, CollectionDescriptor aCod, QueryByCriteria aQuery){ final Criteria crit = new Criteria(); crit.addEqualTo(PROPOSAL_NUMBER, ((InstitutionalProposal) anObject).getProposalNumber()); crit.addIn(PROPOSAL_SEQUENCE_STATUS, Stream.of(VersionStatus.ACTIVE.toString(), VersionStatus.PENDING.toString(), VersionStatus.ARCHIVED.toString()).collect(Collectors.toList())); crit.addEqualTo(ACTIVE, Boolean.TRUE); aQuery.setCriteria(crit); return aQuery; } }
mukadder/kc
coeus-impl/src/main/java/org/kuali/kra/institutionalproposal/dao/ojb/AllFundingProposalQueryCustomizer.java
Java
agpl-3.0
2,282
/* * Kuali Coeus, a comprehensive research administration system for higher education. * * Copyright 2005-2015 Kuali, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.kuali.coeus.common.framework.impl; import org.kuali.coeus.sys.api.model.ScaleTwoDecimal; import java.io.Serializable; /** * A line item object to be used by LineItemTable which represents an amount. The line item objects are matched * by the table for row by lineItemId, so the lineItemId MUST match across Periods to create a row. * * @author Kuali Coeus */ public class LineItemObject extends LineItem implements Serializable { private static final long serialVersionUID = 2763265895600649723L; private String lineItemId; private String name; private ScaleTwoDecimal amount; public LineItemObject(String lineItemId, String name, ScaleTwoDecimal amount) { this.lineItemId = lineItemId; this.name = name; this.amount = amount; } /** * The id of the lineItem, should be unique per a period but match for line items across multiple periods * * @return the line item id */ public String getLineItemId() { return lineItemId; } /** * @see #getLineItemId() */ public void setLineItemId(String lineItemId) { this.lineItemId = lineItemId; } /** * The name of the line item that will be displayed * * @return the name that will be displayed for this line item */ public String getName() { return name; } /** * @see #getName() */ public void setName(String name) { this.name = name; } /** * The amount in ScaleTwoDecimal format * * @return the amount */ public ScaleTwoDecimal getAmount() { return amount; } /** * @see #getAmount() */ public void setAmount(ScaleTwoDecimal amount) { this.amount = amount; } }
sanjupolus/KC6.oLatest
coeus-impl/src/main/java/org/kuali/coeus/common/framework/impl/LineItemObject.java
Java
agpl-3.0
2,593
<?php /** * Shopware 5 * Copyright (c) shopware AG * * According to our dual licensing model, this program can be used either * under the terms of the GNU Affero General Public License, version 3, * or under a proprietary license. * * The texts of the GNU Affero General Public License with an additional * permission and of our proprietary license can be found at and * in the LICENSE file you have received along with this program. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * "Shopware" is a registered trademark of shopware AG. * The licensing of the program under the AGPLv3 does not imply a * trademark license. Therefore any rights, title and interest in * our trademarks remain entirely with us. */ namespace Shopware\Models\Order; use Shopware\Components\Model\ModelEntity; use Doctrine\ORM\Mapping as ORM; /** * Shopware order status model represents the status of an order (payment or order state). * * The Shopware order status model represents a row of the s_core_states table. * The s_core_states table has the follows indices: * <code> * - PRIMARY KEY (`id`) * </code> * * @ORM\Entity * @ORM\Table(name="s_core_states") */ class Status extends ModelEntity { /** * Consts defining the group */ const GROUP_STATE = 'state'; const GROUP_PAYMENT = 'payment'; /** * @var integer $id * * @ORM\Column(name="id", type="integer", nullable=false) * @ORM\Id * @ORM\GeneratedValue(strategy="IDENTITY") */ private $id; /** * @var string $name * * @ORM\Column(name="name", type="string", length=50, nullable=false) */ private $name; /** * @var string $description * @deprecated Use 'name' in conjunction with the 'backend/static/*' snippet namespaces instead * * @ORM\Column(name="description", type="string", length=255, nullable=false) */ private $description; /** * @var integer $position * * @ORM\Column(name="position", type="integer", nullable=false) */ private $position; /** * @var string $group * * @ORM\Column(name="`group`", type="string", length=25, nullable=false) */ private $group; /** * @var integer $sendMail * * @ORM\Column(name="mail", type="integer", nullable=false) */ private $sendMail; /** * INVERSE SIDE * @ORM\OneToOne(targetEntity="Shopware\Models\Mail\Mail", mappedBy="status") * @var \Shopware\Models\Mail\Mail */ protected $mail; /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * @return string */ public function getName() { return $this->name; } /** * @param string $name */ public function setName($name) { $this->name = $name; } /** * Set description * @deprecated Use getName() + snippets instead * * @param string $description * @return Status */ public function setDescription($description) { $this->description = $description; return $this; } /** * Get description * @deprecated Use getName() + snippets instead * * @return string */ public function getDescription() { return $this->description; } /** * Set position * * @param integer $position * @return Status */ public function setPosition($position) { $this->position = $position; return $this; } /** * Get position * * @return integer */ public function getPosition() { return $this->position; } /** * Set group * * @param string $group * @return Status */ public function setGroup($group) { $this->group = $group; return $this; } /** * Get group * * @return string */ public function getGroup() { return $this->group; } /** * Set sendMail * * @param integer $sendMail * @return Status */ public function setSendMail($sendMail) { $this->sendMail = $sendMail; return $this; } /** * Get sendMail * * @return integer */ public function getSendMail() { return $this->sendMail; } /** * @return \Shopware\Models\Mail\Mail */ public function getMail() { return $this->mail; } /** * @param \Shopware\Models\Mail\Mail|array|null $mail * @return \Shopware\Models\Mail\Mail */ public function setMail($mail) { $this->mail = $mail; return $this; } }
Goucher/shopware
engine/Shopware/Models/Order/Status.php
PHP
agpl-3.0
4,977
/* * Copyright (C) 2012 The Guava Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google_voltpatches.common.collect; import com.google_voltpatches.common.annotations.GwtCompatible; import java.util.Collection; import java.util.SortedMap; import java.util.SortedSet; /** * Basic implementation of a {@link SortedSetMultimap} with a sorted key set. * * <p>This superclass allows {@code TreeMultimap} to override methods to return * navigable set and map types in non-GWT only, while GWT code will inherit the * SortedMap/SortedSet overrides. * * @author Louis Wasserman */ @GwtCompatible abstract class AbstractSortedKeySortedSetMultimap<K, V> extends AbstractSortedSetMultimap<K, V> { AbstractSortedKeySortedSetMultimap(SortedMap<K, Collection<V>> map) { super(map); } @Override public SortedMap<K, Collection<V>> asMap() { return (SortedMap<K, Collection<V>>) super.asMap(); } @Override SortedMap<K, Collection<V>> backingMap() { return (SortedMap<K, Collection<V>>) super.backingMap(); } @Override public SortedSet<K> keySet() { return (SortedSet<K>) super.keySet(); } }
deerwalk/voltdb
third_party/java/src/com/google_voltpatches/common/collect/AbstractSortedKeySortedSetMultimap.java
Java
agpl-3.0
1,658
var https = require( 'https' ), zlib = require( 'zlib' ), path = require( 'path' ), fs = require( 'fs' ); var count = 0; var resolved = 0; var outputs = []; var done; function check() { if (resolved === count) { normalize(); display(); } } function makeBar( length ) { var i = ''; while (i.length < length) { i += '='; } return i; } function normalize() { var i, max = 0, max2 = 0; for (i = 0; i < count; i++) { max = Math.max( max, outputs[i].gzip ); max2 = Math.max( max2, outputs[i].original ); } for (i = 0; i < count; i++) { outputs[i].bargraph = makeBar( (outputs[i].gzip / max) * 80 ); outputs[i].bargraph2 = makeBar( (outputs[i].original / max2) * 80 ); } } function display() { var i; for (i = 0; i < count; i++) { console.log( outputs[i].version + ' ' + outputs[i].gzip + ' ' + outputs[i].original ); console.log( 'gzip ' + outputs[i].bargraph ); console.log( 'orig ' + outputs[i].bargraph2 ); } done(); } function getSizeAtVersion( version, path ) { var data = '', op = {}, req = https.request( { host: 'raw.github.com', port: 443, path: '/timrwood/moment/' + version + path }, function( res ) { res.setEncoding( 'utf8' ); res.on( 'data', function( chunk ) { data += chunk; } ); res.on( 'end', function( e ) { zlib.gzip( data, function( error, result ) { op.version = version; op.gzip = result.length; op.original = data.length; resolved++; check(); } ); } ); } ); req.on( 'error', function( e ) { console.log( 'problem with request: ' + e.message ); } ); req.end(); count++; outputs.push( op ); } function getRemote() { var old_versions = '1.0.1 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.4.0'.split( ' ' ), new_versions = '1.5.0 1.5.1 1.6.0 1.6.1 1.7.0 1.7.1'.split( ' ' ), i; for (i = 0; i < old_versions.length; i++) { getSizeAtVersion( old_versions[i], '/moment.min.js' ); } for (i = 0; i < new_versions.length; i++) { getSizeAtVersion( new_versions[i], '/min/moment.min.js' ); } } function getLocal() { count++; var op = {}; outputs.push( op ); fs.readFile( path.normalize( __dirname + '/../min/moment.min.js' ), 'utf8', function( err, data ) { if (err) { throw err; } zlib.gzip( data, function( error, result ) { op.version = '.next'; op.gzip = result.length; op.original = data.length; resolved++; check(); } ); } ); } module.exports = function( grunt ) { grunt.registerTask( 'history', 'Check the codebase filesize over different releases.', function() { done = this.async(); getRemote(); getLocal(); } ); };
hannesk001/SPHERE-Framework
Library/Moment.Js/2.8.4/tasks/history.js
JavaScript
agpl-3.0
3,184
/* * Kuali Coeus, a comprehensive research administration system for higher education. * * Copyright 2005-2015 Kuali, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.kuali.coeus.common.budget.framework.personnel; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinColumns; import javax.persistence.ManyToOne; import javax.persistence.Table; import org.kuali.coeus.sys.framework.model.KcPersistableBusinessObjectBase; import org.kuali.coeus.sys.api.model.ScaleTwoDecimal; import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator; @Entity @Table(name = "BUDGET_PERSON_SALARY_DETAILS") public class BudgetPersonSalaryDetails extends KcPersistableBusinessObjectBase { @PortableSequenceGenerator(name = "SEQ_BUDGET_PER_SAL_DET_ID") @GeneratedValue(generator = "SEQ_BUDGET_PER_SAL_DET_ID") @Id @Column(name = "BUDGET_PERSON_SALARY_DETAIL_ID") private Long budgetPersonSalaryDetailId; @Column(name = "PERSON_SEQUENCE_NUMBER", insertable = false, updatable = false) private Integer personSequenceNumber; @Column(name = "BUDGET_ID", insertable = false, updatable = false) private Long budgetId; @Column(name = "BUDGET_PERIOD") private Integer budgetPeriod; @Column(name = "PERSON_ID") private String personId; @Column(name = "BASE_SALARY") private ScaleTwoDecimal baseSalary = ScaleTwoDecimal.ZERO; @ManyToOne(cascade = { CascadeType.REFRESH }) @JoinColumns({ @JoinColumn(name = "BUDGET_ID", referencedColumnName = "BUDGET_ID"), @JoinColumn(name = "PERSON_SEQUENCE_NUMBER", referencedColumnName = "PERSON_SEQUENCE_NUMBER") }) private BudgetPerson budgetPerson; public Long getBudgetPersonSalaryDetailId() { return budgetPersonSalaryDetailId; } public void setBudgetPersonSalaryDetailId(Long budgetPersonSalaryDetailId) { this.budgetPersonSalaryDetailId = budgetPersonSalaryDetailId; } public Integer getPersonSequenceNumber() { return personSequenceNumber; } public void setPersonSequenceNumber(Integer personSequenceNumber) { this.personSequenceNumber = personSequenceNumber; } public Long getBudgetId() { return budgetId; } public void setBudgetId(Long budgetId) { this.budgetId = budgetId; } public Integer getBudgetPeriod() { return budgetPeriod; } public void setBudgetPeriod(Integer budgetPeriod) { this.budgetPeriod = budgetPeriod; } public ScaleTwoDecimal getBaseSalary() { return baseSalary; } public void setBaseSalary(ScaleTwoDecimal baseSalary) { this.baseSalary = baseSalary; } public void setPersonId(String personId) { this.personId = personId; } public String getPersonId() { return personId; } public BudgetPerson getBudgetPerson() { return budgetPerson; } public void setBudgetPerson(BudgetPerson budgetPerson) { this.budgetPerson = budgetPerson; } }
sanjupolus/KC6.oLatest
coeus-impl/src/main/java/org/kuali/coeus/common/budget/framework/personnel/BudgetPersonSalaryDetails.java
Java
agpl-3.0
3,833
require 'spec_helper' require File.expand_path(File.dirname(__FILE__) + '/../../../lib/data_fixup/change_graded_survey_submissions_to_not_need_grading') describe DataFixup::ChangeGradedSurveySubmissionsToNotNeedGrading do subject do DataFixup::ChangeGradedSurveySubmissionsToNotNeedGrading end it "changes graded survey submissions to complete workflow_state" do course_with_student(active_all: true) course_quiz(course: @course) @quiz.quiz_type = 'graded_survey' @quiz.publish! submission = @quiz.generate_submission(@student) submission.submission = submission.assignment.find_or_create_submission(@student.id) Quizzes::SubmissionGrader.new(submission).grade_submission(grade: 15) submission.workflow_state = 'pending_review' submission.score = 10 submission.save! subject.run submission.reload.should be_completed submission.submission.should be_graded teacher_in_course(course: @course, active_all: true) @teacher.assignments_needing_grading.should_not include @quiz.assignment end end
usmschuck/canvas
spec/lib/data_fixup/change_graded_survey_submissions_to_not_need_grading_spec.rb
Ruby
agpl-3.0
1,073
/* This file is part of VoltDB. * Copyright (C) 2008-2015 VoltDB Inc. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, 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 BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ package org.voltdb_testprocs.regressionsuites.catchexceptions; import org.voltdb.ProcInfo; import org.voltdb.SQLStmt; import org.voltdb.VoltProcedure; @ProcInfo ( singlePartition = true, partitionInfo = "P1.NUM: 0" ) public class SPBigBatchOnPartitionTable extends VoltProcedure { public final SQLStmt insertP1 = new SQLStmt("insert into P1 (ID, ratio) values (?, ?)"); private boolean isTrue(int value) { return value == 0 ? false: true; } // use a partition key here to put all data insert into one partition public long run(int partitionKey, int hasPreviousBatch, int duplicatedID, int hasFollowingBatch, int followingBatchHasException) { int result = 0; if (isTrue(hasPreviousBatch)) { voltQueueSQL(insertP1, 0, 0.1); voltExecuteSQL(); } // VoltDB break large batch with 200 units // 300 here will be be broke into two batches at least try { for (int i = 1; i <= 300; i++) { voltQueueSQL(insertP1, i, 10.1); if (i == duplicatedID) { voltQueueSQL(insertP1, i, 10.2); } } voltExecuteSQL(); } catch (Exception e) { result = -1; } if (isTrue(hasFollowingBatch)) { voltQueueSQL(insertP1, 500, 500.1); if (isTrue(followingBatchHasException)) { voltQueueSQL(insertP1, 500, 500.2); } voltExecuteSQL(); } return result; } }
kumarrus/voltdb
tests/testprocs/org/voltdb_testprocs/regressionsuites/catchexceptions/SPBigBatchOnPartitionTable.java
Java
agpl-3.0
2,707
/* This file is part of the OdinMS Maple Story Server Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc> Matthias Butz <matze@odinms.de> Jan Christian Meyer <vimes@odinms.de> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation. You may not use, modify or distribute this program under any other version of the GNU Affero General Public License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Jiyur Little Kid */ function start() { cm.sendNext("I miss my sister... she's always working at the palace as their servant and I only get to see her on Sundays. The King and Queen are so selfish."); cm.dispose(); }
patLgNova/XMS-v62
scripts/npc/2101001.js
JavaScript
agpl-3.0
1,190
/** * Project Wonderland * * Copyright (c) 2004-2009, Sun Microsystems, Inc., All Rights Reserved * * Redistributions in source code form must reproduce the above * copyright and this condition. * * The contents of this file are subject to the GNU General Public * License, Version 2 (the "License"); you may not use this file * except in compliance with the License. A copy of the License is * available at http://www.opensource.org/licenses/gpl-license.php. * * Sun designates this particular file as subject to the "Classpath" * exception as provided by Sun in the License file that accompanied * this code. */ package org.jdesktop.wonderland.modules.phone.server.cell; import com.sun.sgs.app.ManagedReference; import org.jdesktop.wonderland.modules.phone.common.CallListing; import org.jdesktop.wonderland.modules.phone.common.messages.CallInvitedResponseMessage; import org.jdesktop.wonderland.modules.phone.common.messages.CallEndedResponseMessage; import org.jdesktop.wonderland.modules.phone.common.messages.CallEstablishedResponseMessage; import com.sun.mpk20.voicelib.app.AudioGroup; import com.sun.mpk20.voicelib.app.Call; import com.sun.mpk20.voicelib.app.ManagedCallStatusListener; import com.sun.mpk20.voicelib.app.Player; import com.sun.mpk20.voicelib.app.VoiceManager; import com.sun.sgs.app.AppContext; import com.sun.sgs.app.ManagedObject; import com.sun.voip.CallParticipant; import com.sun.voip.client.connector.CallStatus; import org.jdesktop.wonderland.common.cell.messages.CellMessage; import org.jdesktop.wonderland.server.WonderlandContext; import org.jdesktop.wonderland.server.comms.WonderlandClientID; import org.jdesktop.wonderland.server.comms.WonderlandClientSender; import org.jdesktop.wonderland.server.comms.CommsManager; import org.jdesktop.wonderland.common.cell.CellChannelConnectionType; import java.io.IOException; import java.io.Serializable; import java.util.logging.Logger; import org.jdesktop.wonderland.common.messages.Message; import org.jdesktop.wonderland.common.cell.CellID; import org.jdesktop.wonderland.server.cell.CellMO; import com.jme.math.Vector3f; /** * A server cell that provides conference phone functionality * @author jprovino */ public class PhoneStatusListener implements ManagedCallStatusListener, Serializable { private static final Logger logger = Logger.getLogger(PhoneStatusListener.class.getName()); private CellID cellID; private CallListing listing; private WonderlandClientID clientID; public PhoneStatusListener(PhoneCellMO phoneCellMO, CallListing listing, WonderlandClientID clientID) { cellID = phoneCellMO.getCellID(); this.listing = listing; this.clientID = clientID; AppContext.getManager(VoiceManager.class).addCallStatusListener(this, listing.getExternalCallID()); } private boolean ended; public void callStatusChanged(CallStatus status) { logger.finer("got status " + status); WonderlandClientSender sender = WonderlandContext.getCommsManager().getSender( CellChannelConnectionType.CLIENT_TYPE); VoiceManager vm = AppContext.getManager(VoiceManager.class); Call externalCall = null; if (listing.getExternalCallID() != null) { externalCall = vm.getCall(listing.getExternalCallID()); } Call softphoneCall = vm.getCall(listing.getSoftphoneCallID()); logger.fine("external call: " + externalCall); logger.fine("softphone call: " + softphoneCall); switch(status.getCode()) { case CallStatus.INVITED: //The call has been placed, the phone should be ringing /** HARRISDEBUG: It should be tested whether or not we'll catch * callStatus changes for calls which we've just set up. * If not, this code will have to be moved back to the * "messageReceived->PlaceCall" function. **/ if (listing.isPrivate()) { //Start playing the phone ringing sound try { softphoneCall.playTreatment("ring_tone.au"); } catch (IOException e) { logger.warning("Unable to play treatment " + softphoneCall + ": " + e.getMessage()); } } sender.send(clientID, new CallInvitedResponseMessage(cellID, listing, true)); break; //Something's picked up, the call has been connected case CallStatus.ESTABLISHED: if (listing.isPrivate()) { //Stop playing the phone ringing sound try { softphoneCall.stopTreatment("ring_tone.au"); } catch (IOException e) { logger.warning("Unable to stop treatment " + softphoneCall + ": " + e.getMessage()); } } sender.send(clientID, new CallEstablishedResponseMessage(cellID, listing, true)); break; case CallStatus.ENDED: if (ended) { return; } ended = true; vm.removeCallStatusListener(this); //Stop the ringing if (softphoneCall != null) { try { softphoneCall.stopTreatment("ring_tone.au"); } catch (IOException e) { logger.warning( "Unable to stop treatment " + softphoneCall + ": " + e.getMessage()); } } String softphoneCallID = listing.getSoftphoneCallID(); //This may appear redundant, but it's necessary for the VoiceManager // to remove its internal data structures. if (listing.simulateCalls() == false) { if (externalCall != null) { try { vm.endCall(externalCall, true); } catch (IOException e) { logger.warning( "Unable to end call " + externalCall + ": " + e.getMessage()); } } if (listing.isPrivate()) { String audioGroupId = softphoneCallID + "_" + listing.getPrivateClientName(); AudioGroup audioGroup = vm.getAudioGroup(audioGroupId); if (audioGroup != null) { if (softphoneCall.getPlayer() != null) { softphoneCall.getPlayer().attenuateOtherGroups(audioGroup, AudioGroup.DEFAULT_SPEAKING_ATTENUATION, AudioGroup.DEFAULT_LISTEN_ATTENUATION); } vm.removeAudioGroup(audioGroup); } } } sender.send(clientID, new CallEndedResponseMessage(cellID, listing, true, status.getOption("Reason"))); break; } } }
AsherBond/MondocosmOS
wonderland/modules/tools/phone/src/classes/org/jdesktop/wonderland/modules/phone/server/cell/PhoneStatusListener.java
Java
agpl-3.0
6,625
""" Common utility functions useful throughout the contentstore """ import logging from datetime import datetime from django.conf import settings from django.urls import reverse from django.utils.translation import ugettext as _ from opaque_keys.edx.keys import CourseKey, UsageKey from pytz import UTC from six import text_type from django_comment_common.models import assign_default_role from django_comment_common.utils import seed_permissions_roles from openedx.core.djangoapps.site_configuration.models import SiteConfiguration from student import auth from student.models import CourseEnrollment from student.roles import CourseInstructorRole, CourseStaffRole from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import modulestore from xmodule.modulestore.exceptions import ItemNotFoundError from xmodule.partitions.partitions_service import get_all_partitions_for_course log = logging.getLogger(__name__) def add_instructor(course_key, requesting_user, new_instructor): """ Adds given user as instructor and staff to the given course, after verifying that the requesting_user has permission to do so. """ # can't use auth.add_users here b/c it requires user to already have Instructor perms in this course CourseInstructorRole(course_key).add_users(new_instructor) auth.add_users(requesting_user, CourseStaffRole(course_key), new_instructor) def initialize_permissions(course_key, user_who_created_course): """ Initializes a new course by enrolling the course creator as a student, and initializing Forum by seeding its permissions and assigning default roles. """ # seed the forums seed_permissions_roles(course_key) # auto-enroll the course creator in the course so that "View Live" will work. CourseEnrollment.enroll(user_who_created_course, course_key) # set default forum roles (assign 'Student' role) assign_default_role(course_key, user_who_created_course) def remove_all_instructors(course_key): """ Removes all instructor and staff users from the given course. """ staff_role = CourseStaffRole(course_key) staff_role.remove_users(*staff_role.users_with_role()) instructor_role = CourseInstructorRole(course_key) instructor_role.remove_users(*instructor_role.users_with_role()) def delete_course(course_key, user_id, keep_instructors=False): """ Delete course from module store and if specified remove user and groups permissions from course. """ _delete_course_from_modulestore(course_key, user_id) if not keep_instructors: _remove_instructors(course_key) def _delete_course_from_modulestore(course_key, user_id): """ Delete course from MongoDB. Deleting course will fire a signal which will result into deletion of the courseware associated with a course_key. """ module_store = modulestore() with module_store.bulk_operations(course_key): module_store.delete_course(course_key, user_id) def _remove_instructors(course_key): """ In the django layer, remove all the user/groups permissions associated with this course """ print 'removing User permissions from course....' try: remove_all_instructors(course_key) except Exception as err: log.error("Error in deleting course groups for {0}: {1}".format(course_key, err)) def get_lms_link_for_item(location, preview=False): """ Returns an LMS link to the course with a jump_to to the provided location. :param location: the location to jump to :param preview: True if the preview version of LMS should be returned. Default value is false. """ assert isinstance(location, UsageKey) # checks LMS_BASE value in site configuration for the given course_org_filter(org) # if not found returns settings.LMS_BASE lms_base = SiteConfiguration.get_value_for_org( location.org, "LMS_BASE", settings.LMS_BASE ) if lms_base is None: return None if preview: # checks PREVIEW_LMS_BASE value in site configuration for the given course_org_filter(org) # if not found returns settings.FEATURES.get('PREVIEW_LMS_BASE') lms_base = SiteConfiguration.get_value_for_org( location.org, "PREVIEW_LMS_BASE", settings.FEATURES.get('PREVIEW_LMS_BASE') ) return u"//{lms_base}/courses/{course_key}/jump_to/{location}".format( lms_base=lms_base, course_key=text_type(location.course_key), location=text_type(location), ) # pylint: disable=invalid-name def get_lms_link_for_certificate_web_view(user_id, course_key, mode): """ Returns the url to the certificate web view. """ assert isinstance(course_key, CourseKey) # checks LMS_BASE value in SiteConfiguration against course_org_filter if not found returns settings.LMS_BASE lms_base = SiteConfiguration.get_value_for_org(course_key.org, "LMS_BASE", settings.LMS_BASE) if lms_base is None: return None return u"//{certificate_web_base}/certificates/user/{user_id}/course/{course_id}?preview={mode}".format( certificate_web_base=lms_base, user_id=user_id, course_id=unicode(course_key), mode=mode ) # pylint: disable=invalid-name def is_currently_visible_to_students(xblock): """ Returns true if there is a published version of the xblock that is currently visible to students. This means that it has a release date in the past, and the xblock has not been set to staff only. """ try: published = modulestore().get_item(xblock.location, revision=ModuleStoreEnum.RevisionOption.published_only) # If there's no published version then the xblock is clearly not visible except ItemNotFoundError: return False # If visible_to_staff_only is True, this xblock is not visible to students regardless of start date. if published.visible_to_staff_only: return False # Check start date if 'detached' not in published._class_tags and published.start is not None: return datetime.now(UTC) > published.start # No start date, so it's always visible return True def has_children_visible_to_specific_partition_groups(xblock): """ Returns True if this xblock has children that are limited to specific user partition groups. Note that this method is not recursive (it does not check grandchildren). """ if not xblock.has_children: return False for child in xblock.get_children(): if is_visible_to_specific_partition_groups(child): return True return False def is_visible_to_specific_partition_groups(xblock): """ Returns True if this xblock has visibility limited to specific user partition groups. """ if not xblock.group_access: return False for partition in get_user_partition_info(xblock): if any(g["selected"] for g in partition["groups"]): return True return False def find_release_date_source(xblock): """ Finds the ancestor of xblock that set its release date. """ # Stop searching at the section level if xblock.category == 'chapter': return xblock parent_location = modulestore().get_parent_location(xblock.location, revision=ModuleStoreEnum.RevisionOption.draft_preferred) # Orphaned xblocks set their own release date if not parent_location: return xblock parent = modulestore().get_item(parent_location) if parent.start != xblock.start: return xblock else: return find_release_date_source(parent) def find_staff_lock_source(xblock): """ Returns the xblock responsible for setting this xblock's staff lock, or None if the xblock is not staff locked. If this xblock is explicitly locked, return it, otherwise find the ancestor which sets this xblock's staff lock. """ # Stop searching if this xblock has explicitly set its own staff lock if xblock.fields['visible_to_staff_only'].is_set_on(xblock): return xblock # Stop searching at the section level if xblock.category == 'chapter': return None parent_location = modulestore().get_parent_location(xblock.location, revision=ModuleStoreEnum.RevisionOption.draft_preferred) # Orphaned xblocks set their own staff lock if not parent_location: return None parent = modulestore().get_item(parent_location) return find_staff_lock_source(parent) def ancestor_has_staff_lock(xblock, parent_xblock=None): """ Returns True iff one of xblock's ancestors has staff lock. Can avoid mongo query by passing in parent_xblock. """ if parent_xblock is None: parent_location = modulestore().get_parent_location(xblock.location, revision=ModuleStoreEnum.RevisionOption.draft_preferred) if not parent_location: return False parent_xblock = modulestore().get_item(parent_location) return parent_xblock.visible_to_staff_only def reverse_url(handler_name, key_name=None, key_value=None, kwargs=None): """ Creates the URL for the given handler. The optional key_name and key_value are passed in as kwargs to the handler. """ kwargs_for_reverse = {key_name: unicode(key_value)} if key_name else None if kwargs: kwargs_for_reverse.update(kwargs) return reverse(handler_name, kwargs=kwargs_for_reverse) def reverse_course_url(handler_name, course_key, kwargs=None): """ Creates the URL for handlers that use course_keys as URL parameters. """ return reverse_url(handler_name, 'course_key_string', course_key, kwargs) def reverse_library_url(handler_name, library_key, kwargs=None): """ Creates the URL for handlers that use library_keys as URL parameters. """ return reverse_url(handler_name, 'library_key_string', library_key, kwargs) def reverse_usage_url(handler_name, usage_key, kwargs=None): """ Creates the URL for handlers that use usage_keys as URL parameters. """ return reverse_url(handler_name, 'usage_key_string', usage_key, kwargs) def get_split_group_display_name(xblock, course): """ Returns group name if an xblock is found in user partition groups that are suitable for the split_test module. Arguments: xblock (XBlock): The courseware component. course (XBlock): The course descriptor. Returns: group name (String): Group name of the matching group xblock. """ for user_partition in get_user_partition_info(xblock, schemes=['random'], course=course): for group in user_partition['groups']: if 'Group ID {group_id}'.format(group_id=group['id']) == xblock.display_name_with_default: return group['name'] def get_user_partition_info(xblock, schemes=None, course=None): """ Retrieve user partition information for an XBlock for display in editors. * If a partition has been disabled, it will be excluded from the results. * If a group within a partition is referenced by the XBlock, but the group has been deleted, the group will be marked as deleted in the results. Arguments: xblock (XBlock): The courseware component being edited. Keyword Arguments: schemes (iterable of str): If provided, filter partitions to include only schemes with the provided names. course (XBlock): The course descriptor. If provided, uses this to look up the user partitions instead of loading the course. This is useful if we're calling this function multiple times for the same course want to minimize queries to the modulestore. Returns: list Example Usage: >>> get_user_partition_info(block, schemes=["cohort", "verification"]) [ { "id": 12345, "name": "Cohorts" "scheme": "cohort", "groups": [ { "id": 7890, "name": "Foo", "selected": True, "deleted": False, } ] }, { "id": 7292, "name": "Midterm A", "scheme": "verification", "groups": [ { "id": 1, "name": "Completed verification at Midterm A", "selected": False, "deleted": False }, { "id": 0, "name": "Did not complete verification at Midterm A", "selected": False, "deleted": False, } ] } ] """ course = course or modulestore().get_course(xblock.location.course_key) if course is None: log.warning( "Could not find course %s to retrieve user partition information", xblock.location.course_key ) return [] if schemes is not None: schemes = set(schemes) partitions = [] for p in sorted(get_all_partitions_for_course(course, active_only=True), key=lambda p: p.name): # Exclude disabled partitions, partitions with no groups defined # The exception to this case is when there is a selected group within that partition, which means there is # a deleted group # Also filter by scheme name if there's a filter defined. selected_groups = set(xblock.group_access.get(p.id, []) or []) if (p.groups or selected_groups) and (schemes is None or p.scheme.name in schemes): # First, add groups defined by the partition groups = [] for g in p.groups: # Falsey group access for a partition mean that all groups # are selected. In the UI, though, we don't show the particular # groups selected, since there's a separate option for "all users". groups.append({ "id": g.id, "name": g.name, "selected": g.id in selected_groups, "deleted": False, }) # Next, add any groups set on the XBlock that have been deleted all_groups = set(g.id for g in p.groups) missing_group_ids = selected_groups - all_groups for gid in missing_group_ids: groups.append({ "id": gid, "name": _("Deleted Group"), "selected": True, "deleted": True, }) # Put together the entire partition dictionary partitions.append({ "id": p.id, "name": unicode(p.name), # Convert into a string in case ugettext_lazy was used "scheme": p.scheme.name, "groups": groups, }) return partitions def get_visibility_partition_info(xblock, course=None): """ Retrieve user partition information for the component visibility editor. This pre-processes partition information to simplify the template. Arguments: xblock (XBlock): The component being edited. course (XBlock): The course descriptor. If provided, uses this to look up the user partitions instead of loading the course. This is useful if we're calling this function multiple times for the same course want to minimize queries to the modulestore. Returns: dict """ selectable_partitions = [] # We wish to display enrollment partitions before cohort partitions. enrollment_user_partitions = get_user_partition_info(xblock, schemes=["enrollment_track"], course=course) # For enrollment partitions, we only show them if there is a selected group or # or if the number of groups > 1. for partition in enrollment_user_partitions: if len(partition["groups"]) > 1 or any(group["selected"] for group in partition["groups"]): selectable_partitions.append(partition) # Now add the cohort user partitions. selectable_partitions = selectable_partitions + get_user_partition_info(xblock, schemes=["cohort"], course=course) # Find the first partition with a selected group. That will be the one initially enabled in the dialog # (if the course has only been added in Studio, only one partition should have a selected group). selected_partition_index = -1 # At the same time, build up all the selected groups as they are displayed in the dialog title. selected_groups_label = '' for index, partition in enumerate(selectable_partitions): for group in partition["groups"]: if group["selected"]: if len(selected_groups_label) == 0: selected_groups_label = group['name'] else: # Translators: This is building up a list of groups. It is marked for translation because of the # comma, which is used as a separator between each group. selected_groups_label = _('{previous_groups}, {current_group}').format( previous_groups=selected_groups_label, current_group=group['name'] ) if selected_partition_index == -1: selected_partition_index = index return { "selectable_partitions": selectable_partitions, "selected_partition_index": selected_partition_index, "selected_groups_label": selected_groups_label, } def get_xblock_aside_instance(usage_key): """ Returns: aside instance of a aside xblock :param usage_key: Usage key of aside xblock """ try: descriptor = modulestore().get_item(usage_key.usage_key) for aside in descriptor.runtime.get_asides(descriptor): if aside.scope_ids.block_type == usage_key.aside_type: return aside except ItemNotFoundError: log.warning(u'Unable to load item %s', usage_key.usage_key) def is_self_paced(course): """ Returns True if course is self-paced, False otherwise. """ return course and course.self_paced
Stanford-Online/edx-platform
cms/djangoapps/contentstore/utils.py
Python
agpl-3.0
18,481
############################################################################## # Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-647188 # # For details, see https://github.com/spack/spack # Please also see the NOTICE and LICENSE files for our notice and the LGPL. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License (as # published by the Free Software Foundation) version 2.1, February 1999. # # 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 terms and # conditions of the GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## from spack import * class PyAsn1crypto(PythonPackage): """Python ASN.1 library with a focus on performance and a pythonic API """ homepage = "https://github.com/wbond/asn1crypto" url = "https://pypi.io/packages/source/a/asn1crypto/asn1crypto-0.22.0.tar.gz" version('0.22.0', '74a8b9402625b38ef19cf3fa69ef8470') depends_on('py-setuptools', type='build')
EmreAtes/spack
var/spack/repos/builtin/packages/py-asn1crypto/package.py
Python
lgpl-2.1
1,619
/* ======================================================================== * JCommon : a free general purpose class library for the Java(tm) platform * ======================================================================== * * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jcommon/index.html * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * --------------------- * ReaderWriterLock.java * --------------------- * * $Id: ReaderWriterLock.java,v 1.3 2005/10/18 13:18:34 mungady Exp $ * * Changes * ------- * 29-Jan-2003 : Added standard header (DG); * */ package org.jfree.threads; import java.util.ArrayList; import java.util.Iterator; /** * A reader-writer lock from "Java Threads" by Scott Oak and Henry Wong. * * @author Scott Oak and Henry Wong */ public class ReaderWriterLock { /** * A node for the waiting list. * * @author Scott Oak and Henry Wong */ private static class ReaderWriterNode { /** A reader. */ protected static final int READER = 0; /** A writer. */ protected static final int WRITER = 1; /** The thread. */ protected Thread t; /** The state. */ protected int state; /** The number of acquires.*/ protected int nAcquires; /** * Creates a new node. * * @param t the thread. * @param state the state. */ private ReaderWriterNode(final Thread t, final int state) { this.t = t; this.state = state; this.nAcquires = 0; } } /** The waiting threads. */ private ArrayList waiters; /** * Default constructor. */ public ReaderWriterLock() { this.waiters = new ArrayList(); } /** * Grab the read lock. */ public synchronized void lockRead() { final ReaderWriterNode node; final Thread me = Thread.currentThread(); final int index = getIndex(me); if (index == -1) { node = new ReaderWriterNode(me, ReaderWriterNode.READER); this.waiters.add(node); } else { node = (ReaderWriterNode) this.waiters.get(index); } while (getIndex(me) > firstWriter()) { try { wait(); } catch (Exception e) { System.err.println("ReaderWriterLock.lockRead(): exception."); System.err.print(e.getMessage()); } } node.nAcquires++; } /** * Grab the write lock. */ public synchronized void lockWrite() { final ReaderWriterNode node; final Thread me = Thread.currentThread(); final int index = getIndex(me); if (index == -1) { node = new ReaderWriterNode(me, ReaderWriterNode.WRITER); this.waiters.add(node); } else { node = (ReaderWriterNode) this.waiters.get(index); if (node.state == ReaderWriterNode.READER) { throw new IllegalArgumentException("Upgrade lock"); } node.state = ReaderWriterNode.WRITER; } while (getIndex(me) != 0) { try { wait(); } catch (Exception e) { System.err.println("ReaderWriterLock.lockWrite(): exception."); System.err.print(e.getMessage()); } } node.nAcquires++; } /** * Unlock. */ public synchronized void unlock() { final ReaderWriterNode node; final Thread me = Thread.currentThread(); final int index = getIndex(me); if (index > firstWriter()) { throw new IllegalArgumentException("Lock not held"); } node = (ReaderWriterNode) this.waiters.get(index); node.nAcquires--; if (node.nAcquires == 0) { this.waiters.remove(index); } notifyAll(); } /** * Returns the index of the first waiting writer. * * @return The index. */ private int firstWriter() { final Iterator e = this.waiters.iterator(); int index = 0; while (e.hasNext()) { final ReaderWriterNode node = (ReaderWriterNode) e.next(); if (node.state == ReaderWriterNode.WRITER) { return index; } index += 1; } return Integer.MAX_VALUE; } /** * Returns the index of a thread. * * @param t the thread. * * @return The index. */ private int getIndex(final Thread t) { final Iterator e = this.waiters.iterator(); int index = 0; while (e.hasNext()) { final ReaderWriterNode node = (ReaderWriterNode) e.next(); if (node.t == t) { return index; } index += 1; } return -1; } }
apetresc/JCommon
src/main/java/org/jfree/threads/ReaderWriterLock.java
Java
lgpl-2.1
5,871
/* * eXist EXPath * Copyright (C) 2013 Adam Retter <adam@existsolutions.com> * www.existsolutions.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id$ */ package org.expath.httpclient.model.exist; import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardCopyOption; import javax.xml.transform.Source; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.exist.dom.memtree.DocumentImpl; import org.exist.util.io.TemporaryFileManager; import org.exist.xquery.NodeTest; import org.exist.xquery.TypeTest; import org.exist.xquery.XPathException; import org.exist.xquery.XQueryContext; import org.exist.xquery.modules.ModuleUtils; import org.exist.xquery.value.*; import org.expath.httpclient.HttpClientException; import org.expath.httpclient.HttpResponse; import org.expath.httpclient.model.Result; import org.xml.sax.SAXException; /** * @author Adam Retter <adam@existsolutions.com> */ public class EXistResult implements Result { private static final Logger logger = LogManager.getLogger(EXistResult.class); ValueSequence result = new ValueSequence(); private final XQueryContext context; public EXistResult(final XQueryContext context) { this.context = context; } @Override public Result makeNewResult() throws HttpClientException { return new EXistResult(context.copyContext()); } @Override public void add(final Reader reader, final Charset charset) throws HttpClientException { // START TEMP //TODO(AR) - replace with a deferred StringReader when eXist has this soon. final StringBuilder builder = new StringBuilder(); try { final char cbuf[] = new char[4096]; int read = -1; while((read = reader.read(cbuf)) > -1) { builder.append(cbuf, 0, read); } } catch(final IOException ioe) { throw new HttpClientException("Unable to add string value to result: " + ioe.getMessage(), ioe); } finally { try { reader.close(); } catch(final IOException ioe) { logger.warn(ioe.getMessage(), ioe); } } // END TEMP result.add(new StringValue(builder.toString())); } @Override public void add(final InputStream is) throws HttpClientException { try { // we have to make a temporary copy of the data stream, as the socket will be closed shortly final TemporaryFileManager temporaryFileManager = TemporaryFileManager.getInstance(); final Path tempFile = temporaryFileManager.getTemporaryFile(); Files.copy(is, tempFile, StandardCopyOption.REPLACE_EXISTING); result.add(BinaryValueFromFile.getInstance(context, new Base64BinaryValueType(), tempFile, (isClosed, file) -> temporaryFileManager.returnTemporaryFile(file))); } catch(final XPathException | IOException xpe) { throw new HttpClientException("Unable to add binary value to result:" + xpe.getMessage(), xpe); } finally { try { is.close(); } catch(final IOException ioe) { logger.warn(ioe.getMessage(), ioe); } } } @Override public void add(final Source src) throws HttpClientException { try { final NodeValue nodeValue = ModuleUtils.sourceToXML(context, src); result.add(nodeValue); } catch(final SAXException saxe) { throw new HttpClientException("Unable to add Source to result:" + saxe.getMessage(), saxe); } catch(final IOException ioe) { throw new HttpClientException("Unable to add Source to result:" + ioe.getMessage(), ioe); } } @Override public void add(final HttpResponse response) throws HttpClientException { final EXistTreeBuilder builder = new EXistTreeBuilder(context); response.outputResponseElement(builder); final DocumentImpl doc = builder.close(); try { // we add the root *element* to the result sequence final NodeTest kind = new TypeTest(Type.ELEMENT); // the elem must always be added at the front, so if there are // already other items, we create a new one, add the elem, then // add the original items after if(result.isEmpty()) { doc.selectChildren(kind, result); } else { final ValueSequence newResult = new ValueSequence(); doc.selectChildren(kind, newResult); newResult.addAll(result); result = newResult; } } catch (final XPathException xpe) { throw new HttpClientException("Unable to add HttpResponse to result:" + xpe.getMessage(), xpe); } } public Sequence getResult() { return result; } }
hungerburg/exist
extensions/expath/src/org/expath/httpclient/model/exist/EXistResult.java
Java
lgpl-2.1
5,815
/* * Entagged Audio Tag library * Copyright (c) 2003-2005 Raphaël Slinckx <raphael@slinckx.net> * Copyright (c) 2004-2005 Christian Laireiter <liree@web.de> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ package org.jaudiotagger.audio.ogg.util; import org.jaudiotagger.audio.exceptions.CannotReadException; import org.jaudiotagger.audio.generic.GenericAudioHeader; import org.jaudiotagger.logging.ErrorMessage; import org.jaudiotagger.tag.id3.AbstractID3v2Tag; import java.io.IOException; import java.io.RandomAccessFile; import java.util.logging.Logger; import java.util.Arrays; /** * Read encoding info, only implemented for vorbis streams */ public class OggInfoReader { // Logger Object public static Logger logger = Logger.getLogger("org.jaudiotagger.audio.ogg.atom"); public GenericAudioHeader read(RandomAccessFile raf) throws CannotReadException, IOException { long start = raf.getFilePointer(); GenericAudioHeader info = new GenericAudioHeader(); logger.fine("Started"); long oldPos; //Check start of file does it have Ogg pattern byte[] b = new byte[OggPageHeader.CAPTURE_PATTERN.length]; raf.read(b); if (!(Arrays.equals(b, OggPageHeader.CAPTURE_PATTERN))) { raf.seek(0); if(AbstractID3v2Tag.isId3Tag(raf)) { raf.read(b); if ((Arrays.equals(b, OggPageHeader.CAPTURE_PATTERN))) { start=raf.getFilePointer(); } } else { throw new CannotReadException(ErrorMessage.OGG_HEADER_CANNOT_BE_FOUND.getMsg(new String(b))); } } //Now work backwards from file looking for the last ogg page, it reads the granule position for this last page //which must be set. //TODO should do buffering to cut down the number of file reads raf.seek(start); double pcmSamplesNumber = -1; raf.seek(raf.length() - 2); while (raf.getFilePointer() >= 4) { if (raf.read() == OggPageHeader.CAPTURE_PATTERN[3]) { raf.seek(raf.getFilePointer() - OggPageHeader.FIELD_CAPTURE_PATTERN_LENGTH); byte[] ogg = new byte[3]; raf.readFully(ogg); if (ogg[0] == OggPageHeader.CAPTURE_PATTERN[0] && ogg[1] == OggPageHeader.CAPTURE_PATTERN[1] && ogg[2] == OggPageHeader.CAPTURE_PATTERN[2]) { raf.seek(raf.getFilePointer() - 3); oldPos = raf.getFilePointer(); raf.seek(raf.getFilePointer() + OggPageHeader.FIELD_PAGE_SEGMENTS_POS); int pageSegments = raf.readByte() & 0xFF; //Unsigned raf.seek(oldPos); b = new byte[OggPageHeader.OGG_PAGE_HEADER_FIXED_LENGTH + pageSegments]; raf.readFully(b); OggPageHeader pageHeader = new OggPageHeader(b); raf.seek(0); pcmSamplesNumber = pageHeader.getAbsoluteGranulePosition(); break; } } raf.seek(raf.getFilePointer() - 2); } if (pcmSamplesNumber == -1) { //According to spec a value of -1 indicates no packet finished on this page, this should not occur throw new CannotReadException(ErrorMessage.OGG_VORBIS_NO_SETUP_BLOCK.getMsg()); } //1st page = Identification Header OggPageHeader pageHeader = OggPageHeader.read(raf); byte[] vorbisData = new byte[pageHeader.getPageLength()]; raf.read(vorbisData); VorbisIdentificationHeader vorbisIdentificationHeader = new VorbisIdentificationHeader(vorbisData); //Map to generic encodingInfo info.setPreciseLength((float) (pcmSamplesNumber / vorbisIdentificationHeader.getSamplingRate())); info.setChannelNumber(vorbisIdentificationHeader.getChannelNumber()); info.setSamplingRate(vorbisIdentificationHeader.getSamplingRate()); info.setEncodingType(vorbisIdentificationHeader.getEncodingType()); info.setExtraEncodingInfos(""); //According to Wikipedia Vorbis Page, Vorbis only works on 16bits 44khz info.setBitsPerSample(16); //TODO this calculation should be done within identification header if (vorbisIdentificationHeader.getNominalBitrate() != 0 && vorbisIdentificationHeader.getMaxBitrate() == vorbisIdentificationHeader.getNominalBitrate() && vorbisIdentificationHeader.getMinBitrate() == vorbisIdentificationHeader.getNominalBitrate()) { //CBR (in kbps) info.setBitrate(vorbisIdentificationHeader.getNominalBitrate() / 1000); info.setVariableBitRate(false); } else if (vorbisIdentificationHeader.getNominalBitrate() != 0 && vorbisIdentificationHeader.getMaxBitrate() == 0 && vorbisIdentificationHeader.getMinBitrate() == 0) { //Average vbr (in kpbs) info.setBitrate(vorbisIdentificationHeader.getNominalBitrate() / 1000); info.setVariableBitRate(true); } else { //TODO need to remove comment from raf.getLength() info.setBitrate(computeBitrate(info.getTrackLength(), raf.length())); info.setVariableBitRate(true); } logger.fine("Finished"); return info; } private int computeBitrate(int length, long size) { //Protect against audio less than 0.5 seconds that can be rounded to zero causing Arithmetic Exception if(length==0) { length=1; } return (int) ((size / 1000) * 8 / length); } }
nhminus/jaudiotagger-androidpatch
src/org/jaudiotagger/audio/ogg/util/OggInfoReader.java
Java
lgpl-2.1
6,507
/** * Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com * * BuildCraft is distributed under the terms of the Minecraft Mod Public License * 1.0, or MMPL. Please check the contents of the license located in * http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.power; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.ForgeDirection; import buildcraft.api.core.SafeTimeTracker; public final class PowerHandler { public static enum Type { ENGINE, GATE, MACHINE, PIPE, STORAGE; public boolean canReceiveFromPipes() { switch (this) { case MACHINE: case STORAGE: return true; default: return false; } } public boolean eatsEngineExcess() { switch (this) { case MACHINE: case STORAGE: return true; default: return false; } } } public static class PerditionCalculator { public static final float DEFAULT_POWERLOSS = 1F; public static final float MIN_POWERLOSS = 0.01F; private final float powerLoss; public PerditionCalculator() { powerLoss = DEFAULT_POWERLOSS; } public PerditionCalculator(float powerLoss) { if (powerLoss < MIN_POWERLOSS) { powerLoss = MIN_POWERLOSS; } this.powerLoss = powerLoss; } /** * Apply the perdition algorithm to the current stored energy. This function can only be * called once per tick, but it might not be called every tick. It is triggered by any * manipulation of the stored energy. * * @param powerHandler the PowerHandler requesting the perdition update * @param current the current stored energy * @param ticksPassed ticks since the last time this function was called * @return */ public float applyPerdition(PowerHandler powerHandler, float current, long ticksPassed) { current -= powerLoss * ticksPassed; if (current < 0) { current = 0; } return current; } } public static final PerditionCalculator DEFAULT_PERDITION = new PerditionCalculator(); private float minEnergyReceived; private float maxEnergyReceived; private float maxEnergyStored; private float activationEnergy; private float energyStored = 0; private final SafeTimeTracker doWorkTracker = new SafeTimeTracker(); private final SafeTimeTracker sourcesTracker = new SafeTimeTracker(); private final SafeTimeTracker perditionTracker = new SafeTimeTracker(); public final int[] powerSources = new int[6]; public final IPowerReceptor receptor; private PerditionCalculator perdition; private final PowerReceiver receiver; private final Type type; public PowerHandler(IPowerReceptor receptor, Type type) { this.receptor = receptor; this.type = type; this.receiver = new PowerReceiver(); this.perdition = DEFAULT_PERDITION; } public PowerReceiver getPowerReceiver() { return receiver; } public float getMinEnergyReceived() { return minEnergyReceived; } public float getMaxEnergyReceived() { return maxEnergyReceived; } public float getMaxEnergyStored() { return maxEnergyStored; } public float getActivationEnergy() { return activationEnergy; } public float getEnergyStored() { return energyStored; } /** * Setup your PowerHandler's settings. * * @param minEnergyReceived This is the minimum about of power that will be accepted by the * PowerHandler. This should generally be greater than the activationEnergy if you plan to use * the doWork() callback. Anything greater than 1 will prevent Redstone Engines from powering * this Provider. * @param maxEnergyReceived The maximum amount of power accepted by the PowerHandler. This * should generally be less than 500. Too low and larger engines will overheat while trying to * power the machine. Too high, and the engines will never warm up. Greater values also place * greater strain on the power net. * @param activationEnergy If the stored energy is greater than this value, the doWork() * callback is called (once per tick). * @param maxStoredEnergy The maximum amount of power this PowerHandler can store. Values tend * to range between 100 and 5000. With 1000 and 1500 being common. */ public void configure(float minEnergyReceived, float maxEnergyReceived, float activationEnergy, float maxStoredEnergy) { if (minEnergyReceived > maxEnergyReceived) { maxEnergyReceived = minEnergyReceived; } this.minEnergyReceived = minEnergyReceived; this.maxEnergyReceived = maxEnergyReceived; this.maxEnergyStored = maxStoredEnergy; this.activationEnergy = activationEnergy; } public void configurePowerPerdition(int powerLoss, int powerLossRegularity) { if (powerLoss == 0 || powerLossRegularity == 0) { perdition = new PerditionCalculator(0); return; } perdition = new PerditionCalculator((float) powerLoss / (float) powerLossRegularity); } /** * Allows you to define a new PerditionCalculator class to handler perdition calculations. * * For example if you want exponentially increasing loss based on amount stored. * * @param perdition */ public void setPerdition(PerditionCalculator perdition) { if (perdition == null) perdition = DEFAULT_PERDITION; this.perdition = perdition; } public PerditionCalculator getPerdition() { if (perdition == null) return DEFAULT_PERDITION; return perdition; } /** * Ticks the power handler. You should call this if you can, but its not required. * * If you don't call it, the possibility exists for some weirdness with the perdition algorithm * and work callback as its possible they will not be called on every tick they otherwise would * be. You should be able to design around this though if you are aware of the limitations. */ public void update() { applyPerdition(); applyWork(); validateEnergy(); } private void applyPerdition() { if (perditionTracker.markTimeIfDelay(receptor.getWorld(), 1) && energyStored > 0) { float newEnergy = getPerdition().applyPerdition(this, energyStored, perditionTracker.durationOfLastDelay()); if (newEnergy == 0 || newEnergy < energyStored) energyStored = newEnergy; else energyStored = DEFAULT_PERDITION.applyPerdition(this, energyStored, perditionTracker.durationOfLastDelay()); validateEnergy(); } } private void applyWork() { if (energyStored >= activationEnergy) { if (doWorkTracker.markTimeIfDelay(receptor.getWorld(), 1)) { receptor.doWork(this); } } } private void updateSources(ForgeDirection source) { if (sourcesTracker.markTimeIfDelay(receptor.getWorld(), 1)) { for (int i = 0; i < 6; ++i) { powerSources[i] -= sourcesTracker.durationOfLastDelay(); if (powerSources[i] < 0) { powerSources[i] = 0; } } } if (source != null) powerSources[source.ordinal()] = 10; } /** * Extract energy from the PowerHandler. You must call this even if doWork() triggers. * * @param min * @param max * @param doUse * @return amount used */ public float useEnergy(float min, float max, boolean doUse) { applyPerdition(); float result = 0; if (energyStored >= min) { if (energyStored <= max) { result = energyStored; if (doUse) { energyStored = 0; } } else { result = max; if (doUse) { energyStored -= max; } } } validateEnergy(); return result; } public void readFromNBT(NBTTagCompound data) { readFromNBT(data, "powerProvider"); } public void readFromNBT(NBTTagCompound data, String tag) { NBTTagCompound nbt = data.getCompoundTag(tag); energyStored = nbt.getFloat("storedEnergy"); } public void writeToNBT(NBTTagCompound data) { writeToNBT(data, "powerProvider"); } public void writeToNBT(NBTTagCompound data, String tag) { NBTTagCompound nbt = new NBTTagCompound(); nbt.setFloat("storedEnergy", energyStored); data.setCompoundTag(tag, nbt); } public final class PowerReceiver { private PowerReceiver() { } public float getMinEnergyReceived() { return minEnergyReceived; } public float getMaxEnergyReceived() { return maxEnergyReceived; } public float getMaxEnergyStored() { return maxEnergyStored; } public float getActivationEnergy() { return activationEnergy; } public float getEnergyStored() { return energyStored; } public Type getType() { return type; } public void update() { PowerHandler.this.update(); } /** * The amount of power that this PowerHandler currently needs. * * @return */ public float powerRequest() { update(); return Math.min(maxEnergyReceived, maxEnergyStored - energyStored); } /** * Add power to the PowerReceiver from an external source. * * @param quantity * @param from * @return the amount of power used */ public float receiveEnergy(Type source, final float quantity, ForgeDirection from) { float used = quantity; if (source == Type.ENGINE) { if (used < minEnergyReceived) { return 0; } else if (used > maxEnergyReceived) { used = maxEnergyReceived; } } updateSources(from); used = addEnergy(used); applyWork(); if (source == Type.ENGINE && type.eatsEngineExcess()) { return Math.min(quantity, maxEnergyReceived); } return used; } } /** * * @return the amount the power changed by */ public float addEnergy(float quantity) { energyStored += quantity; if (energyStored > maxEnergyStored) { quantity -= energyStored - maxEnergyStored; energyStored = maxEnergyStored; } else if (energyStored < 0) { quantity -= energyStored; energyStored = 0; } applyPerdition(); return quantity; } public void setEnergy(float quantity) { this.energyStored = quantity; validateEnergy(); } public boolean isPowerSource(ForgeDirection from) { return powerSources[from.ordinal()] != 0; } private void validateEnergy() { if (energyStored < 0) { energyStored = 0; } if (energyStored > maxEnergyStored) { energyStored = maxEnergyStored; } } }
PandaTeam/HydroBlocks
src/buildcraft/api/power/PowerHandler.java
Java
lgpl-3.0
10,105
/* * #%L * Alfresco Repository * %% * Copyright (C) 2005 - 2016 Alfresco Software Limited * %% * This file is part of the Alfresco software. * If the software was purchased under a paid Alfresco license, the terms of * the paid license agreement will prevail. Otherwise, the software is * provided under the following open source license terms: * * Alfresco is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alfresco is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * #L% */ package org.alfresco.repo.domain.permissions.ibatis; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import org.alfresco.repo.domain.permissions.AbstractAclCrudDAOImpl; import org.alfresco.repo.domain.permissions.Ace; import org.alfresco.repo.domain.permissions.AceContextEntity; import org.alfresco.repo.domain.permissions.AceEntity; import org.alfresco.repo.domain.permissions.AclChangeSetEntity; import org.alfresco.repo.domain.permissions.AclEntity; import org.alfresco.repo.domain.permissions.AclMemberEntity; import org.alfresco.repo.domain.permissions.Authority; import org.alfresco.repo.domain.permissions.AuthorityAliasEntity; import org.alfresco.repo.domain.permissions.AuthorityEntity; import org.alfresco.repo.domain.permissions.PermissionEntity; import org.alfresco.repo.security.permissions.ACEType; import org.apache.ibatis.session.RowBounds; import org.mybatis.spring.SqlSessionTemplate; import org.springframework.util.Assert; /** * iBatis-specific implementation of the ACL Crud DAO. * * @author janv * @since 3.4 */ public class AclCrudDAOImpl extends AbstractAclCrudDAOImpl { private static final String INSERT_ACL = "alfresco.permissions.insert.insert_Acl"; private static final String SELECT_ACL_BY_ID = "alfresco.permissions.select_AclById"; private static final String SELECT_ACLS_THAT_INHERIT_FROM_ACL = "alfresco.permissions.select_AclsThatInheritFromAcl"; private static final String SELECT_LATEST_ACL_BY_GUID = "alfresco.permissions.select_LatestAclByGuid"; private static final String SELECT_ADM_NODES_BY_ACL = "alfresco.permissions.select_ADMNodesByAclId"; private static final String UPDATE_ACL = "alfresco.permissions.update_Acl"; private static final String DELETE_ACL = "alfresco.permissions.delete_Acl"; private static final String INSERT_ACL_MEMBER = "alfresco.permissions.insert.insert_AclMember"; private static final String SELECT_ACL_MEMBERS_BY_ACL = "alfresco.permissions.select_AclMembersByAclId"; private static final String SELECT_ACL_MEMBER = "alfresco.permissions.select_AclMember"; private static final String SELECT_ACL_MEMBERS_BY_AUTHORITY = "alfresco.permissions.select_AclMembersByAuthorityName"; private static final String UPDATE_ACL_MEMBER = "alfresco.permissions.update_AclMember"; private static final String DELETE_ACL_MEMBERS_LIST = "alfresco.permissions.delete_AclMembersList"; private static final String DELETE_ACL_MEMBERS_BY_ACL = "alfresco.permissions.delete_AclMembersByAclId"; private static final String INSERT_ACL_CHANGESET = "alfresco.permissions.insert.insert_AclChangeSet"; private static final String UPDATE_ACL_CHANGESET = "alfresco.permissions.update_AclChangeSet"; private static final String SELECT_ACL_CHANGESET_BY_ID = "alfresco.permissions.select_AclChangeSetById"; private static final String DELETE_ACL_CHANGESET = "alfresco.permissions.delete_AclChangeSet"; private static final String INSERT_ACE = "alfresco.permissions.insert.insert_Ace"; private static final String SELECT_ACE_BY_ID = "alfresco.permissions.select_AceById"; private static final String SELECT_ACES_BY_AUTHORITY = "alfresco.permissions.select_AcesByAuthorityId"; private static final String SELECT_ACES_AND_AUTHORIES_BY_ACL = "alfresco.permissions.select_AcesAndAuthoritiesByAclId"; private static final String SELECT_ACE_WITH_NO_CONTEXT = "alfresco.permissions.select_AceWithNoContext"; private static final String DELETE_ACES_LIST = "alfresco.permissions.delete_AcesList"; private static final String UPDATE_ACE = "alfresco.permissions.update_Ace"; private static final String INSERT_ACE_CONTEXT = "alfresco.permissions.insert.insert_AceContext"; private static final String SELECT_ACE_CONTEXT_BY_ID = "alfresco.permissions.select_AceContextById"; private static final String DELETE_ACE_CONTEXT = "alfresco.permissions.delete_AceContext"; private static final String INSERT_PERMISSION = "alfresco.permissions.insert.insert_Permission"; private static final String SELECT_PERMISSION_BY_ID = "alfresco.permissions.select_PermissionById"; private static final String SELECT_PERMISSION_BY_TYPE_AND_NAME = "alfresco.permissions.select_PermissionByTypeAndName"; private static final String UPDATE_PERMISSION = "alfresco.permissions.update_Permission"; private static final String DELETE_PERMISSION = "alfresco.permissions.delete_Permission"; private static final String INSERT_AUTHORITY = "alfresco.permissions.insert.insert_Authority"; private static final String SELECT_AUTHORITY_BY_ID = "alfresco.permissions.select_AuthorityById"; private static final String SELECT_AUTHORITY_BY_NAME = "alfresco.permissions.select_AuthorityByName"; private static final String UPDATE_AUTHORITY = "alfresco.permissions.update_Authority"; private static final String DELETE_AUTHORITY = "alfresco.permissions.delete_Authority"; private static final String INSERT_AUTHORITY_ALIAS = "alfresco.permissions.insert.insert_AuthorityAlias"; private static final String DELETE_AUTHORITY_ALIAS = "alfresco.permissions.delete_AuthorityAlias"; private static final String SELECT_CHANGE_SET_LAST = "alfresco.permissions.select_ChangeSetLast"; private static final String SELECT_CHANGE_SET_MAX_COMMIT_TIME = "alfresco.permissions.select_ChangeSetMaxCommitTime";; private SqlSessionTemplate template; public final void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) { this.template = sqlSessionTemplate; } @Override protected AclEntity createAclEntity(AclEntity entity) { entity.setVersion(0L); template.insert(INSERT_ACL, entity); return entity; } @Override protected AclEntity getAclEntity(long aclEntityId) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("id", aclEntityId); return template.selectOne(SELECT_ACL_BY_ID, params); } @SuppressWarnings("unchecked") @Override protected List<Long> getAclEntitiesThatInheritFromAcl(long aclEntityId) { Map<String, Object> params = new HashMap<String, Object>(2); params.put("id", aclEntityId); params.put("bool", true); return template.selectList(SELECT_ACLS_THAT_INHERIT_FROM_ACL, params); } @Override protected Long getLatestAclEntityByGuid(String aclGuid) { Map<String, Object> params = new HashMap<String, Object>(2); params.put("name", aclGuid); params.put("bool", true); return template.selectOne(SELECT_LATEST_ACL_BY_GUID, params); } @SuppressWarnings("unchecked") @Override protected List<Long> getADMNodeEntityIdsByAcl(long aclEntityId, int maxResults) { if (maxResults < 0) { maxResults = RowBounds.NO_ROW_LIMIT; } Map<String, Object> params = new HashMap<String, Object>(1); params.put("id", aclEntityId); return template.selectList(SELECT_ADM_NODES_BY_ACL, params, new RowBounds(0 , maxResults)); } @Override protected int updateAclEntity(AclEntity updatedAclEntity) { updatedAclEntity.incrementVersion(); return template.update(UPDATE_ACL, updatedAclEntity); } @Override protected int updateAceEntity(AceEntity updatedAceEntity) { AceEntity existingAceEntity = getAceEntity(updatedAceEntity.getPermissionId(), updatedAceEntity.getAuthorityId(), updatedAceEntity.isAllowed(), updatedAceEntity.getAceType()); if(existingAceEntity != null) { for(AclMemberEntity aclMemberEntity : getAclMemberEntitiesByAuthority(getAuthority(updatedAceEntity.getAuthorityId()).getAuthority())) { aclMemberEntity.setAceId(updatedAceEntity.getId()); updateAclMember(aclMemberEntity); } deleteAceEntities(Collections.singletonList(existingAceEntity.getId())); } updatedAceEntity.incrementVersion(); return template.update(UPDATE_ACE, updatedAceEntity); } @Override protected int deleteAclEntity(long aclEntityId) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("id", aclEntityId); return template.delete(DELETE_ACL, params); } @Override protected AclMemberEntity createAclMemberEntity(AclMemberEntity entity) { entity.setVersion(0L); template.insert(INSERT_ACL_MEMBER, entity); return entity; } @SuppressWarnings("unchecked") @Override protected List<AclMemberEntity> getAclMemberEntitiesByAcl(long aclEntityId) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("id", aclEntityId); return template.selectList(SELECT_ACL_MEMBERS_BY_ACL, params); } @SuppressWarnings("unchecked") @Override protected List<AclMemberEntity> getAclMemberEntitiesByAuthority(String authorityName) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("name", authorityName); return template.selectList(SELECT_ACL_MEMBERS_BY_AUTHORITY, params); } @Override protected int updateAclMemberEntity(AclMemberEntity updatedAclMemberEntity) { AclMemberEntity existingAclMemberEntity = getAclMemberEntity(updatedAclMemberEntity.getAclId(), updatedAclMemberEntity.getAceId(), updatedAclMemberEntity.getPos()); if(existingAclMemberEntity != null) { deleteAclMemberEntities(Collections.singletonList(existingAclMemberEntity.getId())); } updatedAclMemberEntity.incrementVersion(); return template.update(UPDATE_ACL_MEMBER, updatedAclMemberEntity); } @Override protected int deleteAclMemberEntities(List<Long> aclMemberEntityIds) { return template.delete(DELETE_ACL_MEMBERS_LIST, aclMemberEntityIds); } @Override protected int deleteAclMemberEntitiesByAcl(long aclEntityId) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("id", aclEntityId); return template.delete(DELETE_ACL_MEMBERS_BY_ACL, params); } @Override protected Long createAclChangeSetEntity() { AclChangeSetEntity entity = new AclChangeSetEntity(); template.insert(INSERT_ACL_CHANGESET, entity); return entity.getId(); } @Override protected AclChangeSetEntity getAclChangeSetEntity(Long aclChangeSetEntityId) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("id", aclChangeSetEntityId); return template.selectOne(SELECT_ACL_CHANGESET_BY_ID, params); } @Override protected int deleteAclChangeSetEntity(Long aclChangeSetEntityId) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("id", aclChangeSetEntityId); return template.delete(DELETE_ACL_CHANGESET, params); } @Override protected int updateChangeSetEntity(Long id, long commitTimeMs) { AclChangeSetEntity entity = new AclChangeSetEntity(); entity.setId(id); entity.setCommitTimeMs(commitTimeMs); return template.update(UPDATE_ACL_CHANGESET, entity); } @Override protected long createAceEntity(AceEntity entity) { entity.setVersion(0L); template.insert(INSERT_ACE, entity); Long id = entity.getId(); return (id != null ? id : -1); } @Override protected AceEntity getAceEntity(long aceEntityId) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("id", aceEntityId); return template.selectOne(SELECT_ACE_BY_ID, params); } @Override protected AceEntity getAceEntity(long permissionId, long authorityId, boolean allowed, ACEType type) { Map<String, Object> params = new HashMap<String, Object>(4); params.put("id1", permissionId); params.put("id2", authorityId); params.put("bool", allowed); params.put("int", type.getId()); return template.selectOne(SELECT_ACE_WITH_NO_CONTEXT, params); } @Override protected AclMemberEntity getAclMemberEntity(long aclId, long aceId, int pos) { Map<String, Object> params = new HashMap<String, Object>(4); params.put("id1", aclId); params.put("id2", aceId); params.put("int", pos); return (AclMemberEntity)template.selectOne(SELECT_ACL_MEMBER, params); } @SuppressWarnings("unchecked") @Override protected List<Ace> getAceEntitiesByAuthority(long authorityEntityId) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("id", authorityEntityId); return template.selectList(SELECT_ACES_BY_AUTHORITY, params); } @SuppressWarnings("unchecked") @Override protected List<Map<String, Object>> getAceAndAuthorityEntitiesByAcl(long aclEntityId) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("id", aclEntityId); return template.selectList(SELECT_ACES_AND_AUTHORIES_BY_ACL, params); } @Override protected int deleteAceEntities(List<Long> aceEntityIds) { return template.delete(DELETE_ACES_LIST, aceEntityIds); } @Override protected long createAceContextEntity(AceContextEntity entity) { entity.setVersion(0L); template.insert(INSERT_ACE_CONTEXT, entity); Long id = entity.getId(); return (id != null ? id : -1); } @Override protected AceContextEntity getAceContextEntity(long aceContextEntityId) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("id", aceContextEntityId); return template.selectOne(SELECT_ACE_CONTEXT_BY_ID, params); } @Override protected int deleteAceContextEntity(long aceContextEntityId) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("id", aceContextEntityId); return template.delete(DELETE_ACE_CONTEXT, params); } @Override protected PermissionEntity createPermissionEntity(PermissionEntity entity) { entity.setVersion(0L); template.insert(INSERT_PERMISSION, entity); return entity; } @Override protected PermissionEntity getPermissionEntity(long permissionEntityId) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("id", permissionEntityId); return template.selectOne(SELECT_PERMISSION_BY_ID, params); } @Override protected PermissionEntity getPermissionEntity(long qnameId, String name) { Map<String, Object> params = new HashMap<String, Object>(2); params.put("id", qnameId); params.put("name", name); return template.selectOne(SELECT_PERMISSION_BY_TYPE_AND_NAME, params); } @Override protected int updatePermissionEntity(PermissionEntity permissionEntity) { permissionEntity.incrementVersion(); return template.update(UPDATE_PERMISSION, permissionEntity); } @Override protected int deletePermissionEntity(long permissionEntityId) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("id", permissionEntityId); return template.delete(DELETE_PERMISSION, params); } @Override protected AuthorityEntity createAuthorityEntity(AuthorityEntity entity) { entity.setVersion(0L); template.insert(INSERT_AUTHORITY, entity); return entity; } @Override protected AuthorityEntity getAuthorityEntity(long authorityEntityId) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("id", authorityEntityId); return template.selectOne(SELECT_AUTHORITY_BY_ID, params); } @SuppressWarnings("unchecked") @Override protected AuthorityEntity getAuthorityEntity(String authorityName) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("name", authorityName); // note: allow for list (non-unique name) in case of upgrade of old schemas AuthorityEntity result = null; List<AuthorityEntity> authorities = template.selectList(SELECT_AUTHORITY_BY_NAME, params); for (AuthorityEntity found : authorities) { if (found.getAuthority().equals(authorityName)) { result = found; break; } } return result; } @Override protected int updateAuthorityEntity(AuthorityEntity authorityEntity) { Authority existingAuthorityEntity = getAuthority(authorityEntity.getAuthority()); if(existingAuthorityEntity != null) { for(Ace ace : getAceEntitiesByAuthority(existingAuthorityEntity.getId())) { AceEntity aceEntity = getAceEntity(ace.getId()); aceEntity.setAuthorityId(authorityEntity.getId()); updateAceEntity(aceEntity); } deleteAuthority(existingAuthorityEntity.getId()); } authorityEntity.incrementVersion(); return template.update(UPDATE_AUTHORITY, authorityEntity); } @Override protected int deleteAuthorityEntity(long authorityEntityId) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("id", authorityEntityId); return template.delete(DELETE_AUTHORITY, params); } @Override protected long createAuthorityAliasEntity(AuthorityAliasEntity entity) { entity.setVersion(0L); template.insert(INSERT_AUTHORITY_ALIAS, entity); Long id = entity.getId(); return (id != null ? id : -1); } @Override protected int deleteAuthorityAliasEntity(long authorityAliasEntityId) { Map<String, Object> params = new HashMap<String, Object>(1); params.put("id", authorityAliasEntityId); return template.delete(DELETE_AUTHORITY_ALIAS, params); } /* (non-Javadoc) * @see org.alfresco.repo.domain.permissions.AbstractAclCrudDAOImpl#selectMaxChangeSetCommitTime() */ @Override protected Long selectMaxChangeSetCommitTime() { return template.selectOne(SELECT_CHANGE_SET_MAX_COMMIT_TIME); } /* (non-Javadoc) * @see org.alfresco.repo.domain.permissions.AbstractAclCrudDAOImpl#selectMaxChangeSetIdBeforeCommitTime(long) */ @Override protected Long selectMaxChangeSetIdBeforeCommitTime(long maxCommitTime) { Assert.notNull(maxCommitTime, "maxCommitTime"); Map<String, Object> params = new HashMap<String, Object>(1); params.put("commit_time_ms", maxCommitTime); List<Long> sets = template.selectList(SELECT_CHANGE_SET_LAST, params, new RowBounds(0, 1)); if (sets.size() > 0) { return sets.get(0); } else { return null; } } }
Alfresco/alfresco-repository
src/main/java/org/alfresco/repo/domain/permissions/ibatis/AclCrudDAOImpl.java
Java
lgpl-3.0
21,316
/* * @BEGIN LICENSE * * Psi4: an open-source quantum chemistry software package * * Copyright (c) 2007-2021 The Psi4 Developers. * * The copyrights for code used from other parties are included in * the corresponding files. * * This file is part of Psi4. * * Psi4 is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, version 3. * * Psi4 is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along * with Psi4; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * @END LICENSE */ /*! \file \ingroup CCENERGY \brief Enter brief description of file here */ #include <cstdio> #include <cstdlib> #include "psi4/libdpd/dpd.h" #include "Params.h" #include "psi4/cc/ccwave.h" namespace psi { namespace ccenergy { void CCEnergyWavefunction::Fme_build() { dpdfile2 FME, Fme, fIA, fia, tIA, tia; dpdbuf4 D_anti, D; if (params_.ref == 0) { /** RHF **/ global_dpd_->file2_init(&fIA, PSIF_CC_OEI, 0, 0, 1, "fIA"); global_dpd_->file2_copy(&fIA, PSIF_CC_OEI, "FME"); global_dpd_->file2_close(&fIA); global_dpd_->file2_init(&FME, PSIF_CC_OEI, 0, 0, 1, "FME"); global_dpd_->buf4_init(&D_anti, PSIF_CC_DINTS, 0, 0, 5, 0, 5, 0, "D <ij||ab>"); global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 0, 5, 0, 5, 0, "D <ij|ab>"); global_dpd_->file2_init(&tIA, PSIF_CC_OEI, 0, 0, 1, "tIA"); global_dpd_->dot13(&tIA, &D_anti, &FME, 0, 0, 1.0, 1.0); global_dpd_->dot13(&tIA, &D, &FME, 0, 0, 1.0, 1.0); global_dpd_->file2_close(&tIA); global_dpd_->buf4_close(&D_anti); global_dpd_->buf4_close(&D); global_dpd_->file2_close(&FME); } else if (params_.ref == 1) { /** ROHF **/ global_dpd_->file2_init(&fIA, PSIF_CC_OEI, 0, 0, 1, "fIA"); global_dpd_->file2_copy(&fIA, PSIF_CC_OEI, "FME"); global_dpd_->file2_close(&fIA); global_dpd_->file2_init(&fia, PSIF_CC_OEI, 0, 0, 1, "fia"); global_dpd_->file2_copy(&fia, PSIF_CC_OEI, "Fme"); global_dpd_->file2_close(&fia); global_dpd_->file2_init(&FME, PSIF_CC_OEI, 0, 0, 1, "FME"); global_dpd_->file2_init(&Fme, PSIF_CC_OEI, 0, 0, 1, "Fme"); global_dpd_->buf4_init(&D_anti, PSIF_CC_DINTS, 0, 0, 5, 0, 5, 0, "D <ij||ab>"); global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 0, 5, 0, 5, 0, "D <ij|ab>"); global_dpd_->file2_init(&tIA, PSIF_CC_OEI, 0, 0, 1, "tIA"); global_dpd_->file2_init(&tia, PSIF_CC_OEI, 0, 0, 1, "tia"); global_dpd_->dot13(&tIA, &D_anti, &FME, 0, 0, 1.0, 1.0); global_dpd_->dot13(&tia, &D, &FME, 0, 0, 1.0, 1.0); global_dpd_->dot13(&tia, &D_anti, &Fme, 0, 0, 1.0, 1.0); global_dpd_->dot13(&tIA, &D, &Fme, 0, 0, 1.0, 1.0); global_dpd_->file2_close(&tIA); global_dpd_->file2_close(&tia); global_dpd_->buf4_close(&D_anti); global_dpd_->buf4_close(&D); global_dpd_->file2_close(&FME); global_dpd_->file2_close(&Fme); } else if (params_.ref == 2) { /** UHF **/ global_dpd_->file2_init(&fIA, PSIF_CC_OEI, 0, 0, 1, "fIA"); global_dpd_->file2_copy(&fIA, PSIF_CC_OEI, "FME"); global_dpd_->file2_close(&fIA); global_dpd_->file2_init(&fia, PSIF_CC_OEI, 0, 2, 3, "fia"); global_dpd_->file2_copy(&fia, PSIF_CC_OEI, "Fme"); global_dpd_->file2_close(&fia); global_dpd_->file2_init(&FME, PSIF_CC_OEI, 0, 0, 1, "FME"); global_dpd_->file2_init(&Fme, PSIF_CC_OEI, 0, 2, 3, "Fme"); global_dpd_->file2_init(&tIA, PSIF_CC_OEI, 0, 0, 1, "tIA"); global_dpd_->file2_init(&tia, PSIF_CC_OEI, 0, 2, 3, "tia"); global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 20, 20, 20, 20, 0, "D <IJ||AB> (IA,JB)"); global_dpd_->contract422(&D, &tIA, &FME, 0, 0, 1, 1); global_dpd_->buf4_close(&D); global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 20, 30, 20, 30, 0, "D <Ij|Ab> (IA,jb)"); global_dpd_->contract422(&D, &tia, &FME, 0, 0, 1, 1); global_dpd_->buf4_close(&D); global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 30, 30, 30, 30, 0, "D <ij||ab> (ia,jb)"); global_dpd_->contract422(&D, &tia, &Fme, 0, 0, 1, 1); global_dpd_->buf4_close(&D); global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 30, 20, 30, 20, 0, "D <Ij|Ab> (ia,JB)"); global_dpd_->contract422(&D, &tIA, &Fme, 0, 0, 1, 1); global_dpd_->buf4_close(&D); global_dpd_->file2_close(&tIA); global_dpd_->file2_close(&tia); global_dpd_->file2_close(&FME); global_dpd_->file2_close(&Fme); } } } // namespace ccenergy } // namespace psi
lothian/psi4
psi4/src/psi4/cc/ccenergy/Fme.cc
C++
lgpl-3.0
5,059
namespace StockSharp.Rss.Xaml { using System.Windows; using System.Windows.Controls; using System.Windows.Data; using Ecng.Xaml; using Xceed.Wpf.Toolkit.PropertyGrid; using Xceed.Wpf.Toolkit.PropertyGrid.Editors; /// <summary> /// The drop-down list to select the RSS feed address. /// </summary> public class RssAddressEditor : ITypeEditor { FrameworkElement ITypeEditor.ResolveEditor(PropertyItem propertyItem) { var comboBox = new RssAddressComboBox { IsEditable = true, Width = double.NaN }; var binding = new Binding("Value") { Source = propertyItem, Converter = new UriValueConverter(comboBox, comboBox.SelectedAddress), Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay }; BindingOperations.SetBinding(comboBox, ComboBox.TextProperty, binding); return comboBox; } } }
donaldlee2008/StockSharp
Connectors/Rss/Xaml/RssAddressEditor.cs
C#
lgpl-3.0
850
namespace StockSharp.Xaml { using System.Collections.Generic; using System.Linq; using System.Windows.Input; using Ecng.Collections; using Ecng.Common; using Ecng.Configuration; using Ecng.Interop; using Ecng.Xaml; using MoreLinq; using StockSharp.BusinessEntities; /// <summary> /// The table showing the news (<see cref="NewsGrid.News"/>). /// </summary> public partial class NewsGrid { /// <summary> /// The command for the news request. /// </summary> public static RoutedCommand RequestStoryCommand = new RoutedCommand(); /// <summary> /// The command for the news link opening. /// </summary> public static RoutedCommand OpenUrlCommand = new RoutedCommand(); private readonly ThreadSafeObservableCollection<News> _news; /// <summary> /// Initializes a new instance of the <see cref="NewsGrid"/>. /// </summary> public NewsGrid() { InitializeComponent(); var itemsSource = new ObservableCollectionEx<News>(); ItemsSource = itemsSource; _news = new ThreadSafeObservableCollection<News>(itemsSource) { MaxCount = 10000 }; } /// <summary> /// The maximum number of news to display. The -1 value means an unlimited amount. The default value is 10000. /// </summary> public int MaxCount { get { return _news.MaxCount; } set { _news.MaxCount = value; } } /// <summary> /// The list of news added to the table. /// </summary> public IListEx<News> News { get { return _news; } } /// <summary> /// Selected news item. /// </summary> public News FirstSelectedNews { get { return SelectedNews.FirstOrDefault(); } } /// <summary> /// Selected news items. /// </summary> public IEnumerable<News> SelectedNews { get { return SelectedItems.Cast<News>(); } } private void ExecutedRequestStoryCommand(object sender, ExecutedRoutedEventArgs e) { SelectedNews.Where(n => n.Story.IsEmpty()).ForEach(ConfigManager.GetService<IConnector>().RequestNewsStory); } private void CanExecuteRequestStoryCommand(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = ConfigManager.IsServiceRegistered<IConnector>() && SelectedNews.Any(n => n.Story.IsEmpty()); } private void CanExecuteOpenUrlCommand(object sender, CanExecuteRoutedEventArgs e) { var news = SelectedNews; e.CanExecute = news.Count() == 1 && FirstSelectedNews.Url != null; } private void ExecutedOpenUrlCommand(object sender, ExecutedRoutedEventArgs e) { FirstSelectedNews.Url.OpenLinkInBrowser(); } } }
donaldlee2008/StockSharp
Xaml/NewsGrid.xaml.cs
C#
lgpl-3.0
2,526
#include "client_manager.hh" #include "buffer_manager.hh" #include "command_manager.hh" #include "containers.hh" #include "event_manager.hh" #include "face_registry.hh" #include "file.hh" #include "user_interface.hh" #include "window.hh" namespace Kakoune { ClientManager::ClientManager() = default; ClientManager::~ClientManager() = default; String ClientManager::generate_name() const { for (int i = 0; true; ++i) { String name = format("unnamed{}", i); if (validate_client_name(name)) return name; } } Client* ClientManager::create_client(std::unique_ptr<UserInterface>&& ui, EnvVarMap env_vars, StringView init_commands) { Buffer& buffer = **BufferManager::instance().begin(); WindowAndSelections ws = get_free_window(buffer); Client* client = new Client{std::move(ui), std::move(ws.window), std::move(ws.selections), std::move(env_vars), generate_name()}; m_clients.emplace_back(client); try { CommandManager::instance().execute(init_commands, client->context()); } catch (Kakoune::runtime_error& error) { client->context().print_status({ error.what().str(), get_face("Error") }); client->context().hooks().run_hook("RuntimeError", error.what(), client->context()); } catch (Kakoune::client_removed&) { m_clients.pop_back(); return nullptr; } client->ui().set_input_callback([client](EventMode mode) { client->handle_available_input(mode); }); return client; } void ClientManager::handle_pending_inputs() const { for (auto& client : m_clients) client->handle_available_input(EventMode::Pending); } void ClientManager::remove_client(Client& client) { for (auto it = m_clients.begin(); it != m_clients.end(); ++it) { if (it->get() == &client) { m_clients.erase(it); return; } } kak_assert(false); } WindowAndSelections ClientManager::get_free_window(Buffer& buffer) { auto it = find_if(reversed(m_free_windows), [&](const WindowAndSelections& ws) { return &ws.window->buffer() == &buffer; }); if (it == m_free_windows.rend()) return { make_unique<Window>(buffer), { buffer, Selection{} } }; it->window->force_redraw(); WindowAndSelections res = std::move(*it); m_free_windows.erase(it.base()-1); res.selections.update(); return res; } void ClientManager::add_free_window(std::unique_ptr<Window>&& window, SelectionList selections) { window->clear_display_buffer(); Buffer& buffer = window->buffer(); m_free_windows.push_back({ std::move(window), SelectionList{ std::move(selections) }, buffer.timestamp() }); } void ClientManager::ensure_no_client_uses_buffer(Buffer& buffer) { for (auto& client : m_clients) { client->context().forget_jumps_to_buffer(buffer); if (&client->context().buffer() != &buffer) continue; if (client->context().is_editing()) throw runtime_error(format("client '{}' is inserting in buffer '{}'", client->context().name(), buffer.display_name())); // change client context to edit the first buffer which is not the // specified one. As BufferManager stores buffer according to last // access, this selects a sensible buffer to display. for (auto& buf : BufferManager::instance()) { if (buf.get() != &buffer) { client->context().change_buffer(*buf); break; } } } auto end = std::remove_if(m_free_windows.begin(), m_free_windows.end(), [&buffer](const WindowAndSelections& ws) { return &ws.window->buffer() == &buffer; }); m_free_windows.erase(end, m_free_windows.end()); } bool ClientManager::validate_client_name(StringView name) const { return const_cast<ClientManager*>(this)->get_client_ifp(name) == nullptr; } Client* ClientManager::get_client_ifp(StringView name) { for (auto& client : m_clients) { if (client->context().name() == name) return client.get(); } return nullptr; } Client& ClientManager::get_client(StringView name) { if (Client* client = get_client_ifp(name)) return *client; throw runtime_error(format("no client named '{}'", name)); } void ClientManager::redraw_clients() const { for (auto& client : m_clients) client->redraw_ifn(); } CandidateList ClientManager::complete_client_name(StringView prefix, ByteCount cursor_pos) const { auto c = transformed(m_clients, [](const std::unique_ptr<Client>& c){ return c->context().name(); }); return complete(prefix, cursor_pos, c, prefix_match, subsequence_match); } }
rstacruz/kakoune
src/client_manager.cc
C++
unlicense
5,133
/* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch licenses this file to you under * the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.elasticsearch.cluster.routing; import org.elasticsearch.Version; import org.elasticsearch.cluster.ClusterChangedEvent; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.allocation.AllocationService; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.test.ESAllocationTestCase; import org.elasticsearch.threadpool.ThreadPool; import org.junit.After; import org.junit.Before; import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicBoolean; import static java.util.Collections.singleton; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.service.ClusterServiceUtils.createClusterService; import static org.elasticsearch.cluster.service.ClusterServiceUtils.setState; import static org.hamcrest.Matchers.equalTo; /** */ public class RoutingServiceTests extends ESAllocationTestCase { private TestRoutingService routingService; @Before public void createRoutingService() { routingService = new TestRoutingService(); } @After public void shutdownRoutingService() throws Exception { routingService.shutdown(); } public void testReroute() { assertThat(routingService.hasReroutedAndClear(), equalTo(false)); routingService.reroute("test"); assertThat(routingService.hasReroutedAndClear(), equalTo(true)); } public void testNoDelayedUnassigned() throws Exception { AllocationService allocation = createAllocationService(Settings.EMPTY, new DelayedShardsMockGatewayAllocator()); MetaData metaData = MetaData.builder() .put(IndexMetaData.builder("test").settings(settings(Version.CURRENT).put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), "0")) .numberOfShards(1).numberOfReplicas(1)) .build(); ClusterState clusterState = ClusterState.builder(ClusterName.DEFAULT) .metaData(metaData) .routingTable(RoutingTable.builder().addAsNew(metaData.index("test")).build()).build(); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1")).put(newNode("node2")).localNodeId("node1").masterNodeId("node1")).build(); clusterState = ClusterState.builder(clusterState).routingResult(allocation.reroute(clusterState, "reroute")).build(); // starting primaries clusterState = ClusterState.builder(clusterState).routingResult(allocation.applyStartedShards(clusterState, clusterState.getRoutingNodes().shardsWithState(INITIALIZING))).build(); // starting replicas clusterState = ClusterState.builder(clusterState).routingResult(allocation.applyStartedShards(clusterState, clusterState.getRoutingNodes().shardsWithState(INITIALIZING))).build(); assertThat(clusterState.getRoutingNodes().unassigned().size() > 0, equalTo(false)); // remove node2 and reroute ClusterState prevState = clusterState; clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder(clusterState.nodes()).remove("node2")).build(); clusterState = ClusterState.builder(clusterState).routingResult(allocation.reroute(clusterState, "reroute")).build(); ClusterState newState = clusterState; assertThat(routingService.getMinDelaySettingAtLastSchedulingNanos(), equalTo(Long.MAX_VALUE)); routingService.clusterChanged(new ClusterChangedEvent("test", newState, prevState)); assertThat(routingService.getMinDelaySettingAtLastSchedulingNanos(), equalTo(Long.MAX_VALUE)); assertThat(routingService.hasReroutedAndClear(), equalTo(false)); } public void testDelayedUnassignedScheduleReroute() throws Exception { MockAllocationService allocation = createAllocationService(Settings.EMPTY, new DelayedShardsMockGatewayAllocator()); MetaData metaData = MetaData.builder() .put(IndexMetaData.builder("test").settings(settings(Version.CURRENT).put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), "100ms")) .numberOfShards(1).numberOfReplicas(1)) .build(); ClusterState clusterState = ClusterState.builder(ClusterName.DEFAULT) .metaData(metaData) .routingTable(RoutingTable.builder().addAsNew(metaData.index("test")).build()).build(); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1")).put(newNode("node2")).localNodeId("node1").masterNodeId("node1")).build(); clusterState = ClusterState.builder(clusterState).routingResult(allocation.reroute(clusterState, "reroute")).build(); // starting primaries clusterState = ClusterState.builder(clusterState).routingResult(allocation.applyStartedShards(clusterState, clusterState.getRoutingNodes().shardsWithState(INITIALIZING))).build(); // starting replicas clusterState = ClusterState.builder(clusterState).routingResult(allocation.applyStartedShards(clusterState, clusterState.getRoutingNodes().shardsWithState(INITIALIZING))).build(); assertFalse("no shards should be unassigned", clusterState.getRoutingNodes().unassigned().size() > 0); String nodeId = null; final List<ShardRouting> allShards = clusterState.getRoutingNodes().routingTable().allShards("test"); // we need to find the node with the replica otherwise we will not reroute for (ShardRouting shardRouting : allShards) { if (shardRouting.primary() == false) { nodeId = shardRouting.currentNodeId(); break; } } assertNotNull(nodeId); // remove nodeId and reroute ClusterState prevState = clusterState; clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder(clusterState.nodes()).remove(nodeId)).build(); // make sure the replica is marked as delayed (i.e. not reallocated) clusterState = ClusterState.builder(clusterState).routingResult(allocation.reroute(clusterState, "reroute")).build(); assertEquals(1, clusterState.getRoutingNodes().unassigned().size()); ClusterState newState = clusterState; routingService.clusterChanged(new ClusterChangedEvent("test", newState, prevState)); assertBusy(() -> assertTrue("routing service should have run a reroute", routingService.hasReroutedAndClear())); // verify the registration has been reset assertThat(routingService.getMinDelaySettingAtLastSchedulingNanos(), equalTo(Long.MAX_VALUE)); } /** * This tests that a new delayed reroute is scheduled right after a delayed reroute was run */ public void testDelayedUnassignedScheduleRerouteAfterDelayedReroute() throws Exception { final ThreadPool testThreadPool = new ThreadPool(getTestName()); ClusterService clusterService = createClusterService(testThreadPool); try { MockAllocationService allocation = createAllocationService(Settings.EMPTY, new DelayedShardsMockGatewayAllocator()); MetaData metaData = MetaData.builder() .put(IndexMetaData.builder("short_delay").settings(settings(Version.CURRENT).put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), "100ms")) .numberOfShards(1).numberOfReplicas(1)) .put(IndexMetaData.builder("long_delay").settings(settings(Version.CURRENT).put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), "10s")) .numberOfShards(1).numberOfReplicas(1)) .build(); ClusterState clusterState = ClusterState.builder(ClusterName.DEFAULT).metaData(metaData) .routingTable(RoutingTable.builder().addAsNew(metaData.index("short_delay")).addAsNew(metaData.index("long_delay")).build()) .nodes(DiscoveryNodes.builder() .put(newNode("node0", singleton(DiscoveryNode.Role.MASTER))).localNodeId("node0").masterNodeId("node0") .put(newNode("node1")).put(newNode("node2")).put(newNode("node3")).put(newNode("node4"))).build(); // allocate shards clusterState = ClusterState.builder(clusterState).routingResult(allocation.reroute(clusterState, "reroute")).build(); // start primaries clusterState = ClusterState.builder(clusterState).routingResult(allocation.applyStartedShards(clusterState, clusterState.getRoutingNodes().shardsWithState(INITIALIZING))).build(); // start replicas clusterState = ClusterState.builder(clusterState).routingResult(allocation.applyStartedShards(clusterState, clusterState.getRoutingNodes().shardsWithState(INITIALIZING))).build(); assertThat("all shards should be started", clusterState.getRoutingNodes().shardsWithState(STARTED).size(), equalTo(4)); // find replica of short_delay ShardRouting shortDelayReplica = null; for (ShardRouting shardRouting : clusterState.getRoutingNodes().routingTable().allShards("short_delay")) { if (shardRouting.primary() == false) { shortDelayReplica = shardRouting; break; } } assertNotNull(shortDelayReplica); // find replica of long_delay ShardRouting longDelayReplica = null; for (ShardRouting shardRouting : clusterState.getRoutingNodes().routingTable().allShards("long_delay")) { if (shardRouting.primary() == false) { longDelayReplica = shardRouting; break; } } assertNotNull(longDelayReplica); final long baseTime = System.nanoTime(); // remove node of shortDelayReplica and node of longDelayReplica and reroute ClusterState prevState = clusterState; clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder(clusterState.nodes()).remove(shortDelayReplica.currentNodeId()).remove(longDelayReplica.currentNodeId())).build(); // make sure both replicas are marked as delayed (i.e. not reallocated) allocation.setNanoTimeOverride(baseTime); clusterState = ClusterState.builder(clusterState).routingResult(allocation.reroute(clusterState, "reroute")).build(); // check that shortDelayReplica and longDelayReplica have been marked unassigned RoutingNodes.UnassignedShards unassigned = clusterState.getRoutingNodes().unassigned(); assertEquals(2, unassigned.size()); // update shortDelayReplica and longDelayReplica variables with new shard routing ShardRouting shortDelayUnassignedReplica = null; ShardRouting longDelayUnassignedReplica = null; for (ShardRouting shr : unassigned) { if (shr.getIndexName().equals("short_delay")) { shortDelayUnassignedReplica = shr; } else { longDelayUnassignedReplica = shr; } } assertTrue(shortDelayReplica.isSameShard(shortDelayUnassignedReplica)); assertTrue(longDelayReplica.isSameShard(longDelayUnassignedReplica)); // manually trigger a clusterChanged event on routingService ClusterState newState = clusterState; setState(clusterService, newState); // create routing service, also registers listener on cluster service RoutingService routingService = new RoutingService(Settings.EMPTY, testThreadPool, clusterService, allocation); routingService.start(); // just so performReroute does not prematurely return // next (delayed) reroute should only delay longDelayReplica/longDelayUnassignedReplica, simulate that we are now 1 second after shards became unassigned allocation.setNanoTimeOverride(baseTime + TimeValue.timeValueSeconds(1).nanos()); // register listener on cluster state so we know when cluster state has been changed CountDownLatch latch = new CountDownLatch(1); clusterService.addLast(event -> latch.countDown()); // instead of clusterService calling clusterChanged, we call it directly here routingService.clusterChanged(new ClusterChangedEvent("test", newState, prevState)); // cluster service should have updated state and called routingService with clusterChanged latch.await(); // verify the registration has been set to the delay of longDelayReplica/longDelayUnassignedReplica assertThat(routingService.getMinDelaySettingAtLastSchedulingNanos(), equalTo(TimeValue.timeValueSeconds(10).nanos())); } finally { clusterService.stop(); terminate(testThreadPool); } } private class TestRoutingService extends RoutingService { private AtomicBoolean rerouted = new AtomicBoolean(); public TestRoutingService() { super(Settings.EMPTY, new ThreadPool(getTestName()), null, null); } void shutdown() throws Exception { terminate(threadPool); } public boolean hasReroutedAndClear() { return rerouted.getAndSet(false); } @Override protected void performReroute(String reason) { logger.info("--> performing fake reroute [{}]", reason); rerouted.set(true); } } }
mmaracic/elasticsearch
core/src/test/java/org/elasticsearch/cluster/routing/RoutingServiceTests.java
Java
apache-2.0
15,018
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef __SLAVE_CSI_SERVER_HPP__ #define __SLAVE_CSI_SERVER_HPP__ #include <string> #include <mesos/mesos.hpp> #include <mesos/authentication/secret_generator.hpp> #include <mesos/secret/resolver.hpp> #include <process/future.hpp> #include <process/http.hpp> #include <process/owned.hpp> #include <stout/hashmap.hpp> #include <stout/try.hpp> #include "csi/service_manager.hpp" #include "csi/volume_manager.hpp" #include "slave/flags.hpp" namespace mesos { namespace internal { namespace slave { class CSIServerProcess; // A CSI server is a collection of volume managers and associated service // managers. This object can be instantiated and held by the Mesos agent to // manage a collection of CSI plugins and proxy calls to them. class CSIServer { public: ~CSIServer(); static Try<process::Owned<CSIServer>> create( const Flags& flags, const process::http::URL& agentUrl, SecretGenerator* secretGenerator, SecretResolver* secretResolver); // Starts the CSI server. Any `publishVolume()` or `unpublishVolume()` calls // which were made previously will be executed after this method is called. // Returns a future which is satisfied once initialization is complete. process::Future<Nothing> start(const SlaveID& agentId); // Publish a CSI volume to this agent. If the `start()` method has not yet // been called, then the publishing of this volume will not be completed until // the CSI server is started. // Returns the target path at which the volume has been published. process::Future<std::string> publishVolume(const Volume& volume); // Unpublishes a CSI volume from this agent. If the `start()` method has not // yet been called, then the unpublishing of this volume will not be completed // until the CSI server is started. process::Future<Nothing> unpublishVolume( const std::string& pluginName, const std::string& volumeId); private: CSIServer( const process::http::URL& agentUrl, const std::string& rootDir, const std::string& pluginConfigDir, SecretGenerator* secretGenerator, SecretResolver* secretResolver); process::Owned<CSIServerProcess> process; process::Promise<Nothing> started; }; } // namespace slave { } // namespace internal { } // namespace mesos { #endif // __SLAVE_CSI_SERVER_HPP__
dforsyth/mesos
src/slave/csi_server.hpp
C++
apache-2.0
3,130
$(document).ready(function() { //extract the data from the table var data = new Object(); $('tr').each(function(index, elem) { var sel = $(this).children(); data[sel.eq(0).text()] = sel.eq(1).text(); }) // remove the table $('#data').remove(); // });
longjl/JFinal_Authority
jfinal-authority/src/main/webapp/static/代码/Part VI/order.js
JavaScript
apache-2.0
302
/*Copyright 2015 Huawei Technologies Co., Ltd. All rights reserved. eSDK is 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.*/ #include "stdafx.h" #include <Shlwapi.h> #include <algorithm> #include "eLTE_Tool.h" #pragma comment(lib, "Shlwapi.lib") #define STR_LENGTH_SIZE 20 #define INT_FORMAT_D 10 #define DOUBLE_STR_SIZE 64 #define DOUBLE_FORMAT "%g" #define UINT_FORMAT "%u" eLTE_Tool::eLTE_Tool() { } eLTE_Tool::~eLTE_Tool() { } std::string eLTE_Tool::Int2String(int iVar) { char buf[STR_LENGTH_SIZE] = {0}; (void)_itoa_s(iVar, buf, INT_FORMAT_D); return std::string(buf); } std::string eLTE_Tool::UInt2String(unsigned int iVar) { char _Buf[STR_LENGTH_SIZE]; (void)sprintf_s(_Buf, sizeof(_Buf), UINT_FORMAT, iVar); return std::string(_Buf); } std::string eLTE_Tool::Double2String(double dVar) { char _Buf[DOUBLE_STR_SIZE]; (void)sprintf_s(_Buf, sizeof(_Buf), DOUBLE_FORMAT, dVar); return std::string(_Buf); } int eLTE_Tool::String2Int(const std::string& str) { int iRet = 0; try { iRet = std::stoi(str); } catch (...) { iRet = 0; } return iRet; } unsigned int eLTE_Tool::String2UInt(const std::string& str) { unsigned int uiRet = 0; try { uiRet = std::stoul(str); } catch (...) { uiRet = 0; } return uiRet; } int eLTE_Tool::WString2Int(const std::wstring& wstr) { int iRet = 0; try { iRet = std::stoi(wstr); } catch (...) { iRet = 0; } return iRet; } unsigned int eLTE_Tool::WString2UInt(const std::wstring& wstr) { unsigned int uiRet = 0; try { uiRet = std::stoul(wstr); } catch (...) { uiRet = 0; } return uiRet; } std::string eLTE_Tool::UnicodeToANSI(const CString& str) { std::string strResult(""); int textlen = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL); if (0 >= textlen) { // WideCharToMultiByte failed. return strResult; } size_t bufsize = (size_t)(textlen+1); char* pBuf = new char[bufsize]; memset(pBuf, 0, sizeof(char)*bufsize); WideCharToMultiByte(CP_ACP, 0, str, -1, pBuf, textlen, NULL, NULL);//lint !e713 strResult = pBuf; delete[] pBuf; return strResult; } std::string eLTE_Tool::UnicodeToUTF8(const std::wstring& str) { std::string strResult(""); int textlen = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), -1, NULL, 0, NULL, NULL); if (0 >= textlen) { // WideCharToMultiByte failed. return strResult; } size_t bufsize = (size_t)(textlen+1); char* pBuf = new char[bufsize]; memset(pBuf, 0, sizeof(char)*bufsize); WideCharToMultiByte(CP_UTF8, 0, str.c_str(), -1, pBuf, textlen, NULL, NULL);//lint !e713 strResult = pBuf; delete[] pBuf; return strResult; } CString eLTE_Tool::ANSIToUnicode(const std::string& str) { CString strResult(L""); int textlen = MultiByteToWideChar(CP_ACP, 0, str.c_str(), -1, NULL, 0); if (0 >= textlen) { // MultiByteToWideChar failed. return strResult; } size_t bufsize = (size_t)(textlen+1); wchar_t* pBuf = new wchar_t[bufsize]; memset(pBuf, 0, sizeof(wchar_t)*bufsize); MultiByteToWideChar(CP_ACP, 0, str.c_str(), -1, (LPWSTR)pBuf, textlen);//lint !e713 strResult = pBuf; delete[] pBuf; return strResult; } CString eLTE_Tool::UTF8ToUnicode(const std::string& str) { CString strResult(L""); int textlen = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), -1, NULL, 0); if (0 >= textlen) { // MultiByteToWideChar failed. return strResult; } size_t bufsize = (size_t)(textlen+1); wchar_t* pBuf = new wchar_t[bufsize]; memset(pBuf, 0, sizeof(wchar_t)*bufsize); MultiByteToWideChar(CP_UTF8, 0, str.c_str(), -1, (LPWSTR)pBuf, textlen);//lint !e713 strResult = pBuf; delete[] pBuf; return strResult; } //std::string eLTE_Tool::UTF8ToANSI(const std::string& str) //{ // std::wstring strUnicode = UTF8ToUnicode(str); // std::string strAnsi = UnicodeToANSI(strUnicode); // return strAnsi; //} //std::string eLTE_Tool::ANSIToUTF8(const std::string& str) //{ // std::wstring strUnicode = ANSIToUnicode(str); // std::string strUtf8 = UnicodeToUTF8(strUnicode); // return strUtf8; //} std::string eLTE_Tool::GetIPByUIntValue(unsigned long ulIP) { int val1 = (ulIP & 0xFF000000) >> 24; int val2 = (ulIP & 0x00FF0000) >> 16; int val3 = (ulIP & 0x0000FF00) >> 8; int val4 = (ulIP & 0x000000FF); std::string str = "."; std::string strIP = Int2String(val1) + str + Int2String(val2) + str + Int2String(val3) + str + Int2String(val4); return strIP; }
Huawei/eSDK_eLTE_SDK_Windows
sample/eLTE_characteristic/API/eLTE_SDS/eLTE_SDS/eLTE_Tool.cpp
C++
apache-2.0
4,879
/// Copyright (c) 2012 Ecma International. All rights reserved. /// Ecma International makes this code available under the terms and conditions set /// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the /// "Use Terms"). Any redistribution of this code must retain the above /// copyright and this notice and otherwise comply with the Use Terms. /** * @path ch15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-4.js * @description Function.prototype.bind, 'length' set to remaining number of expected args (target takes 0 args) */ function testcase() { function foo() { } var o = {}; var bf = foo.bind(o); if (bf.length === 0) { return true; } } runTestCase(testcase);
popravich/typescript
tests/Fidelity/test262/suite/ch15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-4.js
JavaScript
apache-2.0
729
/** * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.hbase; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.hbase.DoNotRetryIOException; /** * Thrown when an operation requires the root and all meta regions to be online */ @InterfaceAudience.Public @InterfaceStability.Stable public class NotAllMetaRegionsOnlineException extends DoNotRetryIOException { private static final long serialVersionUID = 6439786157874827523L; /** * default constructor */ public NotAllMetaRegionsOnlineException() { super(); } /** * @param message */ public NotAllMetaRegionsOnlineException(String message) { super(message); } }
ddraj/hbase-mttr
hbase-server/src/main/java/org/apache/hadoop/hbase/NotAllMetaRegionsOnlineException.java
Java
apache-2.0
1,526
/*! ****************************************************************************** * * Pentaho Data Integration * * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ******************************************************************************/ package org.pentaho.di.trans.steps.streamlookup; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotSame; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.plugins.PluginRegistry; import org.pentaho.di.trans.step.StepMeta; import org.pentaho.di.trans.step.StepMetaInterface; import org.pentaho.di.trans.steps.loadsave.LoadSaveTester; import org.pentaho.di.trans.steps.loadsave.initializer.InitializerInterface; import org.pentaho.di.trans.steps.loadsave.validator.ArrayLoadSaveValidator; import org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator; import org.pentaho.di.trans.steps.loadsave.validator.IntLoadSaveValidator; import org.pentaho.di.trans.steps.loadsave.validator.PrimitiveIntArrayLoadSaveValidator; import org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator; public class StreamLookupMetaTest implements InitializerInterface<StepMetaInterface> { LoadSaveTester loadSaveTester; Class<StreamLookupMeta> testMetaClass = StreamLookupMeta.class; @Before public void setUpLoadSave() throws Exception { KettleEnvironment.init(); PluginRegistry.init( true ); List<String> attributes = Arrays.asList( "inputSorted", "memoryPreservationActive", "usingSortedList", "usingIntegerPair", "keystream", "keylookup", "value", "valueName", "valueDefault", "valueDefaultType" ); FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>( new StringLoadSaveValidator(), 5 ); Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>(); attrValidatorMap.put( "keystream", stringArrayLoadSaveValidator ); attrValidatorMap.put( "keylookup", stringArrayLoadSaveValidator ); attrValidatorMap.put( "value", stringArrayLoadSaveValidator ); attrValidatorMap.put( "valueName", stringArrayLoadSaveValidator ); attrValidatorMap.put( "valueDefault", stringArrayLoadSaveValidator ); attrValidatorMap.put( "valueDefaultType", new PrimitiveIntArrayLoadSaveValidator( new IntLoadSaveValidator( 7 ), 5 ) ); Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>(); loadSaveTester = new LoadSaveTester( testMetaClass, attributes, new ArrayList<String>(), new ArrayList<String>(), new HashMap<String, String>(), new HashMap<String, String>(), attrValidatorMap, typeValidatorMap, this ); } // Call the allocate method on the LoadSaveTester meta class @Override public void modify( StepMetaInterface someMeta ) { if ( someMeta instanceof StreamLookupMeta ) { ( (StreamLookupMeta) someMeta ).allocate( 5, 5 ); } } @Test public void testSerialization() throws KettleException { loadSaveTester.testSerialization(); } @Test public void testCloneInfoSteps() { StreamLookupMeta meta = new StreamLookupMeta(); meta.setDefault(); final String stepName = UUID.randomUUID().toString(); StepMeta infoStep = mock( StepMeta.class ); when( infoStep.getName() ).thenReturn( stepName ); meta.getStepIOMeta().getInfoStreams().get( 0 ).setStepMeta( infoStep ); StreamLookupMeta cloned = (StreamLookupMeta) meta.clone(); assertEquals( stepName, cloned.getStepIOMeta().getInfoStreams().get( 0 ).getStepname() ); assertNotSame( meta.getStepIOMeta().getInfoStreams().get( 0 ), cloned.getStepIOMeta().getInfoStreams().get( 0 ) ); } //PDI-16110 @Test public void testGetXML() { StreamLookupMeta streamLookupMeta = new StreamLookupMeta(); streamLookupMeta.setKeystream( new String[] { "testKeyStreamValue" } ); streamLookupMeta.setKeylookup( new String[] { "testKeyLookupValue" } ); streamLookupMeta.setValue( new String[] { "testValue" } ); streamLookupMeta.setValueName( new String[] {} ); streamLookupMeta.setValueDefault( new String[] {} ); streamLookupMeta.setValueDefaultType( new int[] {} ); //run without exception streamLookupMeta.afterInjectionSynchronization(); streamLookupMeta.getXML(); Assert.assertEquals( streamLookupMeta.getKeystream().length, streamLookupMeta.getValueName().length ); Assert.assertEquals( streamLookupMeta.getKeystream().length, streamLookupMeta.getValueDefault().length ); Assert.assertEquals( streamLookupMeta.getKeystream().length, streamLookupMeta.getValueDefaultType().length ); } }
pavel-sakun/pentaho-kettle
engine/src/test/java/org/pentaho/di/trans/steps/streamlookup/StreamLookupMetaTest.java
Java
apache-2.0
5,864
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.trino.execution; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import io.airlift.units.DataSize; import io.airlift.units.Duration; import java.net.URI; import java.util.List; import java.util.Set; import static com.google.common.base.MoreObjects.toStringHelper; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; import static io.trino.execution.DynamicFiltersCollector.INITIAL_DYNAMIC_FILTERS_VERSION; import static io.trino.execution.TaskState.PLANNED; import static java.util.Objects.requireNonNull; import static java.util.concurrent.TimeUnit.MILLISECONDS; public class TaskStatus { /** * Version of task status that can be used to create an initial local task * that is always older or equal than any remote task. */ public static final long STARTING_VERSION = 0; /** * A value larger than any valid value. This value can be used to create * a final local task that is always newer than any remote task. */ private static final long MAX_VERSION = Long.MAX_VALUE; private final TaskId taskId; private final String taskInstanceId; private final long version; private final TaskState state; private final URI self; private final String nodeId; private final Set<Lifespan> completedDriverGroups; private final int queuedPartitionedDrivers; private final int runningPartitionedDrivers; private final boolean outputBufferOverutilized; private final DataSize physicalWrittenDataSize; private final DataSize memoryReservation; private final DataSize systemMemoryReservation; private final DataSize revocableMemoryReservation; private final long fullGcCount; private final Duration fullGcTime; private final List<ExecutionFailureInfo> failures; private final long dynamicFiltersVersion; @JsonCreator public TaskStatus( @JsonProperty("taskId") TaskId taskId, @JsonProperty("taskInstanceId") String taskInstanceId, @JsonProperty("version") long version, @JsonProperty("state") TaskState state, @JsonProperty("self") URI self, @JsonProperty("nodeId") String nodeId, @JsonProperty("completedDriverGroups") Set<Lifespan> completedDriverGroups, @JsonProperty("failures") List<ExecutionFailureInfo> failures, @JsonProperty("queuedPartitionedDrivers") int queuedPartitionedDrivers, @JsonProperty("runningPartitionedDrivers") int runningPartitionedDrivers, @JsonProperty("outputBufferOverutilized") boolean outputBufferOverutilized, @JsonProperty("physicalWrittenDataSize") DataSize physicalWrittenDataSize, @JsonProperty("memoryReservation") DataSize memoryReservation, @JsonProperty("systemMemoryReservation") DataSize systemMemoryReservation, @JsonProperty("revocableMemoryReservation") DataSize revocableMemoryReservation, @JsonProperty("fullGcCount") long fullGcCount, @JsonProperty("fullGcTime") Duration fullGcTime, @JsonProperty("dynamicFiltersVersion") long dynamicFiltersVersion) { this.taskId = requireNonNull(taskId, "taskId is null"); this.taskInstanceId = requireNonNull(taskInstanceId, "taskInstanceId is null"); checkState(version >= STARTING_VERSION, "version must be >= STARTING_VERSION"); this.version = version; this.state = requireNonNull(state, "state is null"); this.self = requireNonNull(self, "self is null"); this.nodeId = requireNonNull(nodeId, "nodeId is null"); this.completedDriverGroups = requireNonNull(completedDriverGroups, "completedDriverGroups is null"); checkArgument(queuedPartitionedDrivers >= 0, "queuedPartitionedDrivers must be positive"); this.queuedPartitionedDrivers = queuedPartitionedDrivers; checkArgument(runningPartitionedDrivers >= 0, "runningPartitionedDrivers must be positive"); this.runningPartitionedDrivers = runningPartitionedDrivers; this.outputBufferOverutilized = outputBufferOverutilized; this.physicalWrittenDataSize = requireNonNull(physicalWrittenDataSize, "physicalWrittenDataSize is null"); this.memoryReservation = requireNonNull(memoryReservation, "memoryReservation is null"); this.systemMemoryReservation = requireNonNull(systemMemoryReservation, "systemMemoryReservation is null"); this.revocableMemoryReservation = requireNonNull(revocableMemoryReservation, "revocableMemoryReservation is null"); this.failures = ImmutableList.copyOf(requireNonNull(failures, "failures is null")); checkArgument(fullGcCount >= 0, "fullGcCount is negative"); this.fullGcCount = fullGcCount; this.fullGcTime = requireNonNull(fullGcTime, "fullGcTime is null"); checkArgument(dynamicFiltersVersion >= INITIAL_DYNAMIC_FILTERS_VERSION, "dynamicFiltersVersion must be >= INITIAL_DYNAMIC_FILTERS_VERSION"); this.dynamicFiltersVersion = dynamicFiltersVersion; } @JsonProperty public TaskId getTaskId() { return taskId; } @JsonProperty public String getTaskInstanceId() { return taskInstanceId; } @JsonProperty public long getVersion() { return version; } @JsonProperty public TaskState getState() { return state; } @JsonProperty public URI getSelf() { return self; } @JsonProperty public String getNodeId() { return nodeId; } @JsonProperty public Set<Lifespan> getCompletedDriverGroups() { return completedDriverGroups; } @JsonProperty public List<ExecutionFailureInfo> getFailures() { return failures; } @JsonProperty public int getQueuedPartitionedDrivers() { return queuedPartitionedDrivers; } @JsonProperty public int getRunningPartitionedDrivers() { return runningPartitionedDrivers; } @JsonProperty public DataSize getPhysicalWrittenDataSize() { return physicalWrittenDataSize; } @JsonProperty public boolean isOutputBufferOverutilized() { return outputBufferOverutilized; } @JsonProperty public DataSize getMemoryReservation() { return memoryReservation; } @JsonProperty public DataSize getSystemMemoryReservation() { return systemMemoryReservation; } @JsonProperty public DataSize getRevocableMemoryReservation() { return revocableMemoryReservation; } @JsonProperty public long getFullGcCount() { return fullGcCount; } @JsonProperty public Duration getFullGcTime() { return fullGcTime; } @JsonProperty public long getDynamicFiltersVersion() { return dynamicFiltersVersion; } @Override public String toString() { return toStringHelper(this) .add("taskId", taskId) .add("state", state) .toString(); } public static TaskStatus initialTaskStatus(TaskId taskId, URI location, String nodeId) { return new TaskStatus( taskId, "", STARTING_VERSION, PLANNED, location, nodeId, ImmutableSet.of(), ImmutableList.of(), 0, 0, false, DataSize.ofBytes(0), DataSize.ofBytes(0), DataSize.ofBytes(0), DataSize.ofBytes(0), 0, new Duration(0, MILLISECONDS), INITIAL_DYNAMIC_FILTERS_VERSION); } public static TaskStatus failWith(TaskStatus taskStatus, TaskState state, List<ExecutionFailureInfo> exceptions) { return new TaskStatus( taskStatus.getTaskId(), taskStatus.getTaskInstanceId(), MAX_VERSION, state, taskStatus.getSelf(), taskStatus.getNodeId(), taskStatus.getCompletedDriverGroups(), exceptions, taskStatus.getQueuedPartitionedDrivers(), taskStatus.getRunningPartitionedDrivers(), taskStatus.isOutputBufferOverutilized(), taskStatus.getPhysicalWrittenDataSize(), taskStatus.getMemoryReservation(), taskStatus.getSystemMemoryReservation(), taskStatus.getRevocableMemoryReservation(), taskStatus.getFullGcCount(), taskStatus.getFullGcTime(), taskStatus.getDynamicFiltersVersion()); } }
dain/presto
core/trino-main/src/main/java/io/trino/execution/TaskStatus.java
Java
apache-2.0
9,616
package org.apereo.cas.configuration.model.core.sso; /** * Configuration properties class for {@code create.sso}. * * @author Dmitriy Kopylenko * @since 5.0.0 */ public class SsoProperties { private boolean renewedAuthn = true; private boolean missingService = true; public boolean isRenewedAuthn() { return renewedAuthn; } public void setRenewedAuthn(final boolean renewedAuthn) { this.renewedAuthn = renewedAuthn; } public boolean isMissingService() { return missingService; } public void setMissingService(final boolean missingService) { this.missingService = missingService; } }
creamer/cas
core/cas-server-core-configuration/src/main/java/org/apereo/cas/configuration/model/core/sso/SsoProperties.java
Java
apache-2.0
668
/* * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.xdebugger.impl.breakpoints; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.markup.GutterIconRenderer; import com.intellij.openapi.editor.markup.RangeHighlighter; import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.containers.ContainerUtil; import com.intellij.xdebugger.XDebuggerManager; import com.intellij.xdebugger.XDebuggerUtil; import com.intellij.xdebugger.breakpoints.*; import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroupingRule; import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointItem; import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointPanelProvider; import com.intellij.xdebugger.impl.breakpoints.ui.grouping.XBreakpointCustomGroupingRule; import com.intellij.xdebugger.impl.breakpoints.ui.grouping.XBreakpointFileGroupingRule; import com.intellij.xdebugger.impl.breakpoints.ui.grouping.XBreakpointGroupingByTypeRule; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Collection; import java.util.List; /** * @author nik */ public class XBreakpointPanelProvider extends BreakpointPanelProvider<XBreakpoint> { private final List<MyXBreakpointListener> myListeners = ContainerUtil.createLockFreeCopyOnWriteList(); @Override public void createBreakpointsGroupingRules(Collection<XBreakpointGroupingRule> rules) { rules.add(new XBreakpointGroupingByTypeRule()); rules.add(new XBreakpointFileGroupingRule()); rules.add(new XBreakpointCustomGroupingRule()); } @Override public void addListener(final BreakpointsListener listener, Project project, Disposable disposable) { XBreakpointManager breakpointManager = XDebuggerManager.getInstance(project).getBreakpointManager(); final MyXBreakpointListener listener1 = new MyXBreakpointListener(listener, breakpointManager); breakpointManager.addBreakpointListener(listener1); myListeners.add(listener1); Disposer.register(disposable, new Disposable() { @Override public void dispose() { removeListener(listener); } }); } @Override protected void removeListener(BreakpointsListener listener) { for (MyXBreakpointListener breakpointListener : myListeners) { if (breakpointListener.myListener == listener) { XBreakpointManager manager = breakpointListener.myBreakpointManager; manager.removeBreakpointListener(breakpointListener); myListeners.remove(breakpointListener); break; } } } public int getPriority() { return 0; } @Nullable public XBreakpoint<?> findBreakpoint(@NotNull final Project project, @NotNull final Document document, final int offset) { XBreakpointManager breakpointManager = XDebuggerManager.getInstance(project).getBreakpointManager(); int line = document.getLineNumber(offset); VirtualFile file = FileDocumentManager.getInstance().getFile(document); if (file == null) { return null; } for (XLineBreakpointType<?> type : XDebuggerUtil.getInstance().getLineBreakpointTypes()) { XLineBreakpoint<? extends XBreakpointProperties> breakpoint = breakpointManager.findBreakpointAtLine(type, file, line); if (breakpoint != null) { return breakpoint; } } return null; } @Override public GutterIconRenderer getBreakpointGutterIconRenderer(Object breakpoint) { if (breakpoint instanceof XLineBreakpointImpl) { RangeHighlighter highlighter = ((XLineBreakpointImpl)breakpoint).getHighlighter(); if (highlighter != null) { return highlighter.getGutterIconRenderer(); } } return null; } public void onDialogClosed(final Project project) { } @Override public void provideBreakpointItems(Project project, Collection<BreakpointItem> items) { final XBreakpointType<?, ?>[] types = XBreakpointUtil.getBreakpointTypes(); final XBreakpointManager manager = XDebuggerManager.getInstance(project).getBreakpointManager(); for (XBreakpointType<?, ?> type : types) { final Collection<? extends XBreakpoint<?>> breakpoints = manager.getBreakpoints(type); if (breakpoints.isEmpty()) continue; for (XBreakpoint<?> breakpoint : breakpoints) { items.add(new XBreakpointItem(breakpoint)); } } } private static class MyXBreakpointListener implements XBreakpointListener<XBreakpoint<?>> { public final BreakpointsListener myListener; public final XBreakpointManager myBreakpointManager; public MyXBreakpointListener(BreakpointsListener listener, XBreakpointManager breakpointManager) { myListener = listener; myBreakpointManager = breakpointManager; } @Override public void breakpointAdded(@NotNull XBreakpoint<?> breakpoint) { myListener.breakpointsChanged(); } @Override public void breakpointRemoved(@NotNull XBreakpoint<?> breakpoint) { myListener.breakpointsChanged(); } @Override public void breakpointChanged(@NotNull XBreakpoint<?> breakpoint) { myListener.breakpointsChanged(); } } private static class AddXBreakpointAction extends AnAction { private final XBreakpointType<?, ?> myType; public AddXBreakpointAction(XBreakpointType<?, ?> type) { myType = type; getTemplatePresentation().setIcon(type.getEnabledIcon()); getTemplatePresentation().setText(type.getTitle()); } @Override public void actionPerformed(AnActionEvent e) { myType.addBreakpoint(getEventProject(e), null); } } }
MichaelNedzelsky/intellij-community
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointPanelProvider.java
Java
apache-2.0
6,449
/* * Copyright 2015 Red Hat, Inc. and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.uberfire.client.workbench.panels.impl; /** * Minor behavioural alterations to */ public class SimpleWorkbenchPanelViewUnitTestWrapper extends SimpleWorkbenchPanelView { private boolean forcedAttachState; @Override public boolean isAttached() { return forcedAttachState; } public void forceAttachedState( boolean attached ) { forcedAttachState = attached; } }
psiroky/uberfire
uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/impl/SimpleWorkbenchPanelViewUnitTestWrapper.java
Java
apache-2.0
1,045
/* ***************************************************************************** Copyright (c) Microsoft Corporation. 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 THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ /// <reference no-default-lib="true"/> //////////////// /// ECMAScript APIs //////////////// declare var NaN: number; declare var Infinity: number; /** * Evaluates JavaScript code and executes it. * @param x A String value that contains valid JavaScript code. */ declare function eval(x: string): any; /** * Converts A string to an integer. * @param s A string to convert into a number. * @param radix A value between 2 and 36 that specifies the base of the number in numString. * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. * All other strings are considered decimal. */ declare function parseInt(s: string, radix?: number): number; /** * Converts a string to a floating-point number. * @param string A string that contains a floating-point number. */ declare function parseFloat(string: string): number; /** * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). * @param number A numeric value. */ declare function isNaN(number: number): bool; /** * Determines whether a supplied number is finite. * @param number Any numeric value. */ declare function isFinite(number: number): bool; /** * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). * @param encodedURI A value representing an encoded URI. */ declare function decodeURI(encodedURI: string): string; /** * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). * @param encodedURIComponent A value representing an encoded URI component. */ declare function decodeURIComponent(encodedURIComponent: string): string; /** * Encodes a text string as a valid Uniform Resource Identifier (URI) * @param uri A value representing an encoded URI. */ declare function encodeURI(uri: string): string; /** * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). * @param uriComponent A value representing an encoded URI component. */ declare function encodeURIComponent(uriComponent: string): string; interface PropertyDescriptor { configurable?: bool; enumerable?: bool; value?: any; writable?: bool; get?(): any; set?(v: any): void; } interface PropertyDescriptorMap { [s: string]: PropertyDescriptor; } interface Object { /** Returns a string representation of an object. */ toString(): string; /** Returns a date converted to a string using the current locale. */ toLocaleString(): string; /** Returns the primitive value of the specified object. */ valueOf(): Object; /** * Determines whether an object has a property with the specified name. * @param v A property name. */ hasOwnProperty(v: string): bool; /** * Determines whether an object exists in another object's prototype chain. * @param v Another object whose prototype chain is to be checked. */ isPrototypeOf(v: Object): bool; /** * Determines whether a specified property is enumerable. * @param v A property name. */ propertyIsEnumerable(v: string): bool; [s: string]: any; } /** * Provides functionality common to all JavaScript objects. */ declare var Object: { new (value?: any): Object; (): any; (value: any): any; /** A reference to the prototype for a class of objects. */ prototype: Object; /** * Returns the prototype of an object. * @param o The object that references the prototype. */ getPrototypeOf(o: any): any; /** * Gets the own property descriptor of the specified object. * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. * @param o Object that contains the property. * @param p Name of the property. */ getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; /** * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. * @param o Object that contains the own properties. */ getOwnPropertyNames(o: any): string[]; /** * Creates an object that has the specified prototype, and that optionally contains specified properties. * @param o Object to use as a prototype. May be null * @param properties JavaScript object that contains one or more property descriptors. */ create(o: any, properties?: PropertyDescriptorMap): any; /** * Adds a property to an object, or modifies attributes of an existing property. * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. * @param p The property name. * @param attributes Descriptor for the property. It can be for a data property or an accessor property. */ defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; /** * Adds one or more properties to an object, and/or modifies attributes of existing properties. * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. */ defineProperties(o: any, properties: PropertyDescriptorMap): any; /** * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. * @param o Object on which to lock the attributes. */ seal(o: any): any; /** * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. * @param o Object on which to lock the attributes. */ freeze(o: any): any; /** * Prevents the addition of new properties to an object. * @param o Object to make non-extensible. */ preventExtensions(o: any): any; /** * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. * @param o Object to test. */ isSealed(o: any): bool; /** * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. * @param o Object to test. */ isFrozen(o: any): bool; /** * Returns a value that indicates whether new properties can be added to an object. * @param o Object to test. */ isExtensible(o: any): bool; /** * Returns the names of the enumerable properties and methods of an object. * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. */ keys(o: any): string[]; } /** * Creates a new function. */ interface Function { /** * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. * @param thisArg The object to be used as the this object. * @param argArray A set of arguments to be passed to the function. */ apply(thisArg: any, ...argArray: any[]): any; /** * Calls a method of an object, substituting another object for the current object. * @param thisArg The object to be used as the current object. * @param argArray A list of arguments to be passed to the method. */ call(thisArg: any, ...argArray: any[]): any; /** * For a given function, creates a bound function that has the same body as the original function. * The this object of the bound function is associated with the specified object, and has the specified initial parameters. * @param thisArg An object to which the this keyword can refer inside the new function. * @param argArray A list of arguments to be passed to the new function. */ bind(thisArg: any, ...argArray: any[]): any; prototype: any; length: number; } declare var Function: { /** * Creates a new function. * @param args A list of arguments the function accepts. */ new (...args: string[]): Function; (...args: string[]): Function; prototype: Function; } interface IArguments { [index: number]: any; length: number; callee: Function; } interface String { /** Returns a string representation of a string. */ toString(): string; /** * Returns the character at the specified index. * @param pos The zero-based index of the desired character. */ charAt(pos: number): string; /** * Returns the Unicode value of the character at the specified location. * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. */ charCodeAt(index: number): number; /** * Returns a string that contains the concatenation of two or more strings. * @param strings The strings to append to the end of the string. */ concat(...strings: string[]): string; /** * Returns the position of the first occurrence of a substring. * @param searchString The substring to search for in the string * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. */ indexOf(searchString: string, position?: number): number; /** * Returns the last occurrence of a substring in the string. * @param searchString The substring to search for. * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. */ lastIndexOf(searchString: string, position?: number): number; /** * Determines whether two strings are equivalent in the current locale. * @param that String to compare to target string */ localeCompare(that: string): number; /** * Matches a string with a regular expression, and returns an array containing the results of that search. * @param regexp A variable name or string literal containing the regular expression pattern and flags. */ match(regexp: string): string[]; /** * Matches a string with a regular expression, and returns an array containing the results of that search. * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. */ match(regexp: RegExp): string[]; /** * Replaces text in a string, using a regular expression or search string. * @param searchValue A String object or string literal that represents the regular expression * @param replaceValue A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. */ replace(searchValue: string, replaceValue: string): string; /** * Replaces text in a string, using a regular expression or search string. * @param searchValue A String object or string literal that represents the regular expression * @param replaceValue A function that returns the replacement text. */ replace(searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; /** * Replaces text in a string, using a regular expression or search string. * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags * @param replaceValue A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. */ replace(searchValue: RegExp, replaceValue: string): string; /** * Replaces text in a string, using a regular expression or search string. * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags * @param replaceValue A function that returns the replacement text. */ replace(searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; /** * Finds the first substring match in a regular expression search. * @param regexp The regular expression pattern and applicable flags. */ search(regexp: string): number; /** * Finds the first substring match in a regular expression search. * @param regexp The regular expression pattern and applicable flags. */ search(regexp: RegExp): number; /** * Returns a section of a string. * @param start The index to the beginning of the specified portion of stringObj. * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. * If this value is not specified, the substring continues to the end of stringObj. */ slice(start: number, end?: number): string; /** * Split a string into substrings using the specified separator and return them as an array. * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. * @param limit A value used to limit the number of elements returned in the array. */ split(separator: string, limit?: number): string[]; /** * Split a string into substrings using the specified separator and return them as an array. * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. * @param limit A value used to limit the number of elements returned in the array. */ split(separator: RegExp, limit?: number): string[]; /** * Returns the substring at the specified location within a String object. * @param start The zero-based index integer indicating the beginning of the substring. * @param end Zero-based index integer indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. * If end is omitted, the characters from start through the end of the original string are returned. */ substring(start: number, end?: number): string; /** Converts all the alphabetic characters in a string to lowercase. */ toLowerCase(): string; /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ toLocaleLowerCase(): string; /** Converts all the alphabetic characters in a string to uppercase. */ toUpperCase(): string; /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ toLocaleUpperCase(): string; /** Removes the leading and trailing white space and line terminator characters from a string. */ trim(): string; /** Returns the length of a String object. */ length: number; // IE extensions /** * Gets a substring beginning at the specified location and having the specified length. * @param from The starting position of the desired substring. The index of the first character in the string is zero. * @param length The number of characters to include in the returned substring. */ substr(from: number, length?: number): string; } /** * Allows manipulation and formatting of text strings and determination and location of substrings within strings. */ declare var String: { new (value?: any): String; (value?: any): string; prototype: String; fromCharCode(...codes: number[]): string; } interface Boolean { } declare var Boolean: { new (value?: any): Boolean; (value?: any): bool; prototype: Boolean; } interface Number { toString(radix?: number): string; toFixed(fractionDigits?: number): string; toExponential(fractionDigits?: number): string; toPrecision(precision: number): string; } /** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ declare var Number: { new (value?: any): Number; (value?: any): number; prototype: Number; /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ MAX_VALUE: number; /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ MIN_VALUE: number; /** * A value that is not a number. * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. */ NaN: number; /** * A value that is less than the largest negative number that can be represented in JavaScript. * JavaScript displays NEGATIVE_INFINITY values as -infinity. */ NEGATIVE_INFINITY: number; /** * A value greater than the largest number that can be represented in JavaScript. * JavaScript displays POSITIVE_INFINITY values as infinity. */ POSITIVE_INFINITY: number; } interface Math { /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ E: number; /** The natural logarithm of 10. */ LN10: number; /** The natural logarithm of 2. */ LN2: number; /** The base-2 logarithm of e. */ LOG2E: number; /** The base-10 logarithm of e. */ LOG10E: number; /** Pi. This is the ratio of the circumference of a circle to its diameter. */ PI: number; /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ SQRT1_2: number; /** The square root of 2. */ SQRT2: number; /** * Returns the absolute value of a number (the value without regard to whether it is positive or negative). * For example, the absolute value of -5 is the same as the absolute value of 5. * @param x A numeric expression for which the absolute value is needed. */ abs(x: number): number; /** * Returns the arc cosine (or inverse cosine) of a number. * @param x A numeric expression. */ acos(x: number): number; /** * Returns the arcsine of a number. * @param x A numeric expression. */ asin(x: number): number; /** * Returns the arctangent of a number. * @param x A numeric expression for which the arctangent is needed. */ atan(x: number): number; /** * Returns the angle (in radians) from the X axis to a point (y,x). * @param y A numeric expression representing the cartesian y-coordinate. * @param x A numeric expression representing the cartesian x-coordinate. */ atan2(y: number, x: number): number; /** * Returns the smallest integer greater than or equal to its numeric argument. * @param x A numeric expression. */ ceil(x: number): number; /** * Returns the cosine of a number. * @param x A numeric expression that contains an angle measured in radians. */ cos(x: number): number; /** * Returns e (the base of natural logarithms) raised to a power. * @param x A numeric expression representing the power of e. */ exp(x: number): number; /** * Returns the greatest integer less than or equal to its numeric argument. * @param x A numeric expression. */ floor(x: number): number; /** * Returns the natural logarithm (base e) of a number. * @param x A numeric expression. */ log(x: number): number; /** * Returns the larger of a set of supplied numeric expressions. * @param values Numeric expressions to be evaluated. */ max(...values: number[]): number; /** * Returns the smaller of a set of supplied numeric expressions. * @param values Numeric expressions to be evaluated. */ min(...values: number[]): number; /** * Returns the value of a base expression taken to a specified power. * @param x The base value of the expression. * @param y The exponent value of the expression. */ pow(x: number, y: number): number; /** Returns a pseudorandom number between 0 and 1. */ random(): number; /** * Returns a supplied numeric expression rounded to the nearest integer. * @param x The value to be rounded to the nearest integer. */ round(x: number): number; /** * Returns the sine of a number. * @param x A numeric expression that contains an angle measured in radians. */ sin(x: number): number; /** * Returns the square root of a number. * @param x A numeric expression. */ sqrt(x: number): number; /** * Returns the tangent of a number. * @param x A numeric expression that contains an angle measured in radians. */ tan(x: number): number; } /** An intrinsic object that provides basic mathematics functionality and constants. */ declare var Math: Math; /** Enables basic storage and retrieval of dates and times. */ interface Date { /** Returns a string representation of a date. The format of the string depends on the locale. */ toString(): string; /** Returns a date as a string value. */ toDateString(): string; /** Returns a time as a string value. */ toTimeString(): string; toLocaleString(): string; /** Returns a date as a string value appropriate to the host environment's current locale. */ toLocaleDateString(): string; /** Returns a time as a string value appropriate to the host environment's current locale. */ toLocaleTimeString(): string; /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ valueOf(): number; /** Gets the time value in milliseconds. */ getTime(): number; /** Gets the year, using local time. */ getFullYear(): number; /** Gets the year using Universal Coordinated Time (UTC). */ getUTCFullYear(): number; /** Gets the month, using local time. */ getMonth(): number; /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ getUTCMonth(): number; /** Gets the day-of-the-month, using local time. */ getDate(): number; /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ getUTCDate(): number; /** Gets the day of the week, using local time. */ getDay(): number; /** Gets the day of the week using Universal Coordinated Time (UTC). */ getUTCDay(): number; /** Gets the hours in a date, using local time. */ getHours(): number; /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ getUTCHours(): number; /** Gets the minutes of a Date object, using local time. */ getMinutes(): number; /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ getUTCMinutes(): number; /** Gets the seconds of a Date object, using local time. */ getSeconds(): number; /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ getUTCSeconds(): number; /** Gets the milliseconds of a Date, using local time. */ getMilliseconds(): number; /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ getUTCMilliseconds(): number; /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ getTimezoneOffset(): number; /** * Sets the date and time value in the Date object. * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. */ setTime(time: number): void; /** * Sets the milliseconds value in the Date object using local time. * @param ms A numeric value equal to the millisecond value. */ setMilliseconds(ms: number): void; /** * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). * @param ms A numeric value equal to the millisecond value. */ setUTCMilliseconds(ms: number): void; /** * Sets the seconds value in the Date object using local time. * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setSeconds(sec: number, ms?: number): void; /** * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setUTCSeconds(sec: number, ms?: number): void; /** * Sets the minutes value in the Date object using local time. * @param min A numeric value equal to the minutes value. * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setMinutes(min: number, sec?: number, ms?: number): void; /** * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). * @param min A numeric value equal to the minutes value. * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setUTCMinutes(min: number, sec?: number, ms?: number): void; /** * Sets the hour value in the Date object using local time. * @param hours A numeric value equal to the hours value. * @param min A numeric value equal to the minutes value. * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setHours(hours: number, min?: number, sec?: number, ms?: number): void; /** * Sets the hours value in the Date object using Universal Coordinated Time (UTC). * @param hours A numeric value equal to the hours value. * @param min A numeric value equal to the minutes value. * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setUTCHours(hours: number, min?: number, sec?: number, ms?: number): void; /** * Sets the numeric day-of-the-month value of the Date object using local time. * @param date A numeric value equal to the day of the month. */ setDate(date: number): void; /** * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). * @param date A numeric value equal to the day of the month. */ setUTCDate(date: number): void; /** * Sets the month value in the Date object using local time. * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. */ setMonth(month: number, date?: number): void; /** * Sets the month value in the Date object using Universal Coordinated Time (UTC). * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. */ setUTCMonth(month: number, date?: number): void; /** * Sets the year of the Date object using local time. * @param year A numeric value for the year. * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. * @param date A numeric value equal for the day of the month. */ setFullYear(year: number, month?: number, date?: number): void; /** * Sets the year value in the Date object using Universal Coordinated Time (UTC). * @param year A numeric value equal to the year. * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. * @param date A numeric value equal to the day of the month. */ setUTCFullYear(year: number, month?: number, date?: number): void; /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ toUTCString(): string; /** Returns a date as a string value in ISO format. */ toISOString(): string; /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ toJSON(key?: any): string; } /** * Enables basic storage and retrieval of dates and times. */ declare var Date: { new (): Date; new (value: number): Date; new (value: string): Date; new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; (): string; prototype: Date; /** * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. * @param s A date string */ parse(s: string): number; /** * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. * @param month The month as an integer between 0 and 11 (January to December). * @param date The date as an integer between 1 and 31. * @param hours Must be supplied if minutes is supplied. An integer from 0 to 23 (midnight to 11pm) that specifies the hour. * @param minutes Must be supplied if seconds is supplied. An integer from 0 to 59 that specifies the minutes. * @param seconds Must be supplied if milliseconds is supplied. An integer from 0 to 59 that specifies the seconds. * @param ms An integer from 0 to 999 that specifies the milliseconds. */ UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } interface RegExpExecArray { [index: number]: string; length: number; index: number; input: string; toString(): string; toLocaleString(): string; concat(...items: string[][]): string[]; join(seperator?: string): string; pop(): string; push(...items: string[]): number; reverse(): string[]; shift(): string; slice(start: number, end?: number): string[]; sort(compareFn?: (a: string, b: string) => number): string[]; splice(start: number): string[]; splice(start: number, deleteCount: number, ...items: string[]): string[]; unshift(...items: string[]): number; indexOf(searchElement: string, fromIndex?: number): number; lastIndexOf(searchElement: string, fromIndex?: number): number; every(callbackfn: (value: string, index: number, array: string[]) => bool, thisArg?: any): bool; some(callbackfn: (value: string, index: number, array: string[]) => bool, thisArg?: any): bool; forEach(callbackfn: (value: string, index: number, array: string[]) => void , thisArg?: any): void; map(callbackfn: (value: string, index: number, array: string[]) => any, thisArg?: any): any[]; filter(callbackfn: (value: string, index: number, array: string[]) => bool, thisArg?: any): string[]; reduce(callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: string[]) => any, initialValue?: any): any; reduceRight(callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: string[]) => any, initialValue?: any): any; } interface RegExp { /** * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. * @param string The String object or string literal on which to perform the search. */ exec(string: string): RegExpExecArray; /** * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. * @param string String on which to perform the search. */ test(string: string): bool; /** Returns a copy of the text of the regular expression pattern. Read-only. The rgExp argument is a Regular expression object. It can be a variable name or a literal. */ source: string; /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ global: bool; /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ ignoreCase: bool; /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ multiline: bool; lastIndex: number; } declare var RegExp: { new (pattern: string, flags?: string): RegExp; (pattern: string, flags?: string): RegExp; } interface Error { name: string; message: string; } declare var Error: { new (message?: string): Error; (message?: string): Error; prototype: Error; } interface EvalError extends Error { } declare var EvalError: { new (message?: string): EvalError; (message?: string): EvalError; prototype: EvalError; } interface RangeError extends Error { } declare var RangeError: { new (message?: string): RangeError; (message?: string): RangeError; prototype: RangeError; } interface ReferenceError extends Error { } declare var ReferenceError: { new (message?: string): ReferenceError; (message?: string): ReferenceError; prototype: ReferenceError; } interface SyntaxError extends Error { } declare var SyntaxError: { new (message?: string): SyntaxError; (message?: string): SyntaxError; prototype: SyntaxError; } interface TypeError extends Error { } declare var TypeError: { new (message?: string): TypeError; (message?: string): TypeError; prototype: TypeError; } interface URIError extends Error { } declare var URIError: { new (message?: string): URIError; (message?: string): URIError; prototype: URIError; } interface JSON { /** * Converts a JavaScript Object Notation (JSON) string into an object. * @param text A valid JSON string. * @param reviver A function that transforms the results. This function is called for each member of the object. * If a member contains nested objects, the nested objects are transformed before the parent object is. */ parse(text: string, reviver?: (key: any, value: any) => any): any; /** * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. * @param value A JavaScript value, usually an object or array, to be converted. */ stringify(value: any): string; /** * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. * @param value A JavaScript value, usually an object or array, to be converted. * @param replacer A function that transforms the results. */ stringify(value: any, replacer: (key: string, value: any) => any): string; /** * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. * @param value A JavaScript value, usually an object or array, to be converted. * @param replacer Array that transforms the results. */ stringify(value: any, replacer: any[]): string; /** * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. * @param value A JavaScript value, usually an object or array, to be converted. * @param replacer A function that transforms the results. * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. */ stringify(value: any, replacer: (key: string, value: any) => any, space: any): string; /** * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. * @param value A JavaScript value, usually an object or array, to be converted. * @param replacer Array that transforms the results. * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. */ stringify(value: any, replacer: any[], space: any): string; } /** * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. */ declare var JSON: JSON; //////////////// /// ECMAScript Array API (specially handled by compiler) //////////////// interface Array { toString(): string; toLocaleString(): string; concat(...items: _element[][]): _element[]; join(seperator?: string): string; pop(): _element; push(...items: _element[]): number; reverse(): _element[]; shift(): _element; slice(start: number, end?: number): _element[]; sort(compareFn?: (a: _element, b: _element) => number): _element[]; splice(start: number): _element[]; splice(start: number, deleteCount: number, ...items: _element[]): _element[]; unshift(...items: _element[]): number; indexOf(searchElement: _element, fromIndex?: number): number; lastIndexOf(searchElement: _element, fromIndex?: number): number; every(callbackfn: (value: _element, index: number, array: _element[]) => bool, thisArg?: any): bool; some(callbackfn: (value: _element, index: number, array: _element[]) => bool, thisArg?: any): bool; forEach(callbackfn: (value: _element, index: number, array: _element[]) => void , thisArg?: any): void; map(callbackfn: (value: _element, index: number, array: _element[]) => any, thisArg?: any): any[]; filter(callbackfn: (value: _element, index: number, array: _element[]) => bool, thisArg?: any): _element[]; reduce(callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: _element[]) => any, initialValue?: any): any; reduceRight(callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: _element[]) => any, initialValue?: any): any; length: number; } declare var Array: { new (...items: any[]): any[]; (...items: any[]): any[]; isArray(arg: any): bool; prototype: Array; } //////////////// /// IE10 ECMAScript Extensions //////////////// interface ArrayBuffer { byteLength: number; } declare var ArrayBuffer: { prototype: ArrayBuffer; new (byteLength: number); } interface ArrayBufferView { buffer: ArrayBuffer; byteOffset: number; byteLength: number; } interface Int8Array extends ArrayBufferView { BYTES_PER_ELEMENT: number; length: number; [index: number]: number; get(index: number): number; set(index: number, value: number): void; set(array: Int8Array, offset?: number): void; set(array: number[], offset?: number): void; subarray(begin: number, end?: number): Int8Array; } declare var Int8Array: { prototype: Int8Array; new (length: number): Int8Array; new (array: Int8Array): Int8Array; new (array: number[]): Int8Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; BYTES_PER_ELEMENT: number; } interface Uint8Array extends ArrayBufferView { BYTES_PER_ELEMENT: number; length: number; [index: number]: number; get(index: number): number; set(index: number, value: number): void; set(array: Uint8Array, offset?: number): void; set(array: number[], offset?: number): void; subarray(begin: number, end?: number): Uint8Array; } declare var Uint8Array: { prototype: Uint8Array; new (length: number): Uint8Array; new (array: Uint8Array): Uint8Array; new (array: number[]): Uint8Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; BYTES_PER_ELEMENT: number; } interface Int16Array extends ArrayBufferView { BYTES_PER_ELEMENT: number; length: number; [index: number]: number; get(index: number): number; set(index: number, value: number): void; set(array: Int16Array, offset?: number): void; set(array: number[], offset?: number): void; subarray(begin: number, end?: number): Int16Array; } declare var Int16Array: { prototype: Int16Array; new (length: number): Int16Array; new (array: Int16Array): Int16Array; new (array: number[]): Int16Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; BYTES_PER_ELEMENT: number; } interface Uint16Array extends ArrayBufferView { BYTES_PER_ELEMENT: number; length: number; [index: number]: number; get(index: number): number; set(index: number, value: number): void; set(array: Uint16Array, offset?: number): void; set(array: number[], offset?: number): void; subarray(begin: number, end?: number): Uint16Array; } declare var Uint16Array: { prototype: Uint16Array; new (length: number): Uint16Array; new (array: Uint16Array): Uint16Array; new (array: number[]): Uint16Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; BYTES_PER_ELEMENT: number; } interface Int32Array extends ArrayBufferView { BYTES_PER_ELEMENT: number; length: number; [index: number]: number; get(index: number): number; set(index: number, value: number): void; set(array: Int32Array, offset?: number): void; set(array: number[], offset?: number): void; subarray(begin: number, end?: number): Int32Array; } declare var Int32Array: { prototype: Int32Array; new (length: number): Int32Array; new (array: Int32Array): Int32Array; new (array: number[]): Int32Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; BYTES_PER_ELEMENT: number; } interface Uint32Array extends ArrayBufferView { BYTES_PER_ELEMENT: number; length: number; [index: number]: number; get(index: number): number; set(index: number, value: number): void; set(array: Uint32Array, offset?: number): void; set(array: number[], offset?: number): void; subarray(begin: number, end?: number): Uint32Array; } declare var Uint32Array: { prototype: Uint32Array; new (length: number): Uint32Array; new (array: Uint32Array): Uint32Array; new (array: number[]): Uint32Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; BYTES_PER_ELEMENT: number; } interface Float32Array extends ArrayBufferView { BYTES_PER_ELEMENT: number; length: number; [index: number]: number; get(index: number): number; set(index: number, value: number): void; set(array: Float32Array, offset?: number): void; set(array: number[], offset?: number): void; subarray(begin: number, end?: number): Float32Array; } declare var Float32Array: { prototype: Float32Array; new (length: number): Float32Array; new (array: Float32Array): Float32Array; new (array: number[]): Float32Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; BYTES_PER_ELEMENT: number; } interface Float64Array extends ArrayBufferView { BYTES_PER_ELEMENT: number; length: number; [index: number]: number; get(index: number): number; set(index: number, value: number): void; set(array: Float64Array, offset?: number): void; set(array: number[], offset?: number): void; subarray(begin: number, end?: number): Float64Array; } declare var Float64Array: { prototype: Float64Array; new (length: number): Float64Array; new (array: Float64Array): Float64Array; new (array: number[]): Float64Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; BYTES_PER_ELEMENT: number; } interface DataView extends ArrayBufferView { getInt8(byteOffset: number): number; getUint8(byteOffset: number): number; getInt16(byteOffset: number, littleEndian?: bool): number; getUint16(byteOffset: number, littleEndian?: bool): number; getInt32(byteOffset: number, littleEndian?: bool): number; getUint32(byteOffset: number, littleEndian?: bool): number; getFloat32(byteOffset: number, littleEndian?: bool): number; getFloat64(byteOffset: number, littleEndian?: bool): number; setInt8(byteOffset: number, value: number): void; setUint8(byteOffset: number, value: number): void; setInt16(byteOffset: number, value: number, littleEndian?: bool): void; setUint16(byteOffset: number, value: number, littleEndian?: bool): void; setInt32(byteOffset: number, value: number, littleEndian?: bool): void; setUint32(byteOffset: number, value: number, littleEndian?: bool): void; setFloat32(byteOffset: number, value: number, littleEndian?: bool): void; setFloat64(byteOffset: number, value: number, littleEndian?: bool): void; } declare var DataView: { prototype: DataView; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): DataView; } //////////////// /// IE9 DOM APIs (note that //////////////// interface NavigatorID { appVersion: string; appName: string; userAgent: string; platform: string; } interface HTMLTableElement extends HTMLElement, DOML2DeprecatedBorderStyle_HTMLTableElement, DOML2DeprecatedAlignmentStyle_HTMLTableElement, MSBorderColorStyle, MSDataBindingExtensions, MSHTMLTableElementExtensions, DOML2DeprecatedBackgroundStyle, MSBorderColorHighlightStyle, MSDataBindingTableExtensions, DOML2DeprecatedBackgroundColorStyle { tBodies: HTMLCollection; width: string; tHead: HTMLTableSectionElement; cellSpacing: string; tFoot: HTMLTableSectionElement; frame: string; rows: HTMLCollection; rules: string; cellPadding: string; summary: string; caption: HTMLTableCaptionElement; deleteRow(index?: number): void; createTBody(): HTMLElement; deleteCaption(): void; insertRow(index?: number): HTMLElement; deleteTFoot(): void; createTHead(): HTMLElement; deleteTHead(): void; createCaption(): HTMLElement; createTFoot(): HTMLElement; } declare var HTMLTableElement: { prototype: HTMLTableElement; new(): HTMLTableElement; } interface TreeWalker { whatToShow: number; filter: NodeFilterCallback; root: Node; currentNode: Node; expandEntityReferences: bool; previousSibling(): Node; lastChild(): Node; nextSibling(): Node; nextNode(): Node; parentNode(): Node; firstChild(): Node; previousNode(): Node; } declare var TreeWalker: { prototype: TreeWalker; new(): TreeWalker; } interface GetSVGDocument { getSVGDocument(): SVGDocument; } interface HTMLHtmlElementDOML2Deprecated { version: string; } interface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg { y: number; y1: number; x: number; x1: number; } declare var SVGPathSegCurvetoQuadraticRel: { prototype: SVGPathSegCurvetoQuadraticRel; new(): SVGPathSegCurvetoQuadraticRel; } interface Performance { navigation: PerformanceNavigation; timing: PerformanceTiming; toJSON(): any; } declare var Performance: { prototype: Performance; new(): Performance; } interface SVGSVGElementEventHandlers { onresize: (ev: UIEvent) => any; onunload: (ev: Event) => any; onscroll: (ev: UIEvent) => any; onerror: (ev: Event) => any; onzoom: (ev: any) => any; onabort: (ev: UIEvent) => any; } interface MSDataBindingTableExtensions { dataPageSize: number; nextPage(): void; firstPage(): void; refresh(): void; previousPage(): void; lastPage(): void; } interface DOML2DeprecatedAlignmentStyle_HTMLParagraphElement { align: string; } interface CompositionEvent extends UIEvent { data: string; locale: string; initCompositionEvent(typeArg: string, canBubbleArg: bool, cancelableArg: bool, viewArg: AbstractView, dataArg: string, locale: string): void; } declare var CompositionEvent: { prototype: CompositionEvent; new(): CompositionEvent; } interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGFitToViewBox { orientType: SVGAnimatedEnumeration; markerUnits: SVGAnimatedEnumeration; markerWidth: SVGAnimatedLength; markerHeight: SVGAnimatedLength; orientAngle: SVGAnimatedAngle; refY: SVGAnimatedLength; refX: SVGAnimatedLength; setOrientToAngle(angle: SVGAngle): void; setOrientToAuto(): void; SVG_MARKER_ORIENT_UNKNOWN: number; SVG_MARKER_ORIENT_ANGLE: number; SVG_MARKERUNITS_UNKNOWN: number; SVG_MARKERUNITS_STROKEWIDTH: number; SVG_MARKER_ORIENT_AUTO: number; SVG_MARKERUNITS_USERSPACEONUSE: number; } declare var SVGMarkerElement: { prototype: SVGMarkerElement; new(): SVGMarkerElement; SVG_MARKER_ORIENT_UNKNOWN: number; SVG_MARKER_ORIENT_ANGLE: number; SVG_MARKERUNITS_UNKNOWN: number; SVG_MARKERUNITS_STROKEWIDTH: number; SVG_MARKER_ORIENT_AUTO: number; SVG_MARKERUNITS_USERSPACEONUSE: number; } interface WindowTimers { clearTimeout(handle: number): void; setTimeout(expression: any, msec?: number, language?: any): number; clearInterval(handle: number): void; setInterval(expression: any, msec?: number, language?: any): number; } interface CSSStyleDeclaration extends CSS3Properties, SVG1_1Properties, CSS2Properties { cssText: string; length: number; parentRule: CSSRule; getPropertyPriority(propertyName: string): string; getPropertyValue(propertyName: string): string; removeProperty(propertyName: string): string; item(index: number): string; [index: number]: string; setProperty(propertyName: string, value: string, priority?: string): void; } declare var CSSStyleDeclaration: { prototype: CSSStyleDeclaration; new(): CSSStyleDeclaration; } interface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests { } declare var SVGGElement: { prototype: SVGGElement; new(): SVGGElement; } interface MSStyleCSSProperties extends MSCSSProperties { pixelWidth: number; posHeight: number; posLeft: number; pixelTop: number; pixelBottom: number; textDecorationNone: bool; pixelLeft: number; posTop: number; posBottom: number; textDecorationOverline: bool; posWidth: number; textDecorationLineThrough: bool; pixelHeight: number; textDecorationBlink: bool; posRight: number; pixelRight: number; textDecorationUnderline: bool; } declare var MSStyleCSSProperties: { prototype: MSStyleCSSProperties; new(): MSStyleCSSProperties; } interface MSCSSStyleSheetExtensions { owningElement: Element; imports: StyleSheetList; isAlternate: bool; rules: MSCSSRuleList; isPrefAlternate: bool; readOnly: bool; cssText: string; href: string; id: string; pages: StyleSheetPageList; addImport(bstrURL: string, lIndex?: number): number; addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; removeRule(lIndex: number): void; addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; removeImport(lIndex: number): void; } interface Navigator extends NavigatorID, NavigatorOnLine, NavigatorDoNotTrack, NavigatorAbilities, NavigatorGeolocation, MSNavigatorAbilities { } declare var Navigator: { prototype: Navigator; new(): Navigator; } interface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg { y: number; x2: number; x: number; y2: number; } declare var SVGPathSegCurvetoCubicSmoothAbs: { prototype: SVGPathSegCurvetoCubicSmoothAbs; new(): SVGPathSegCurvetoCubicSmoothAbs; } interface MSBorderColorStyle_HTMLFrameSetElement { borderColor: any; } interface SVGZoomEvent extends UIEvent { zoomRectScreen: SVGRect; previousScale: number; newScale: number; previousTranslate: SVGPoint; newTranslate: SVGPoint; } declare var SVGZoomEvent: { prototype: SVGZoomEvent; new(): SVGZoomEvent; } interface NodeSelector { querySelectorAll(selectors: string): NodeList; querySelector(selectors: string): Element; } interface HTMLTableDataCellElement extends HTMLTableCellElement, MSHTMLTableDataCellElementExtensions { } declare var HTMLTableDataCellElement: { prototype: HTMLTableDataCellElement; new(): HTMLTableDataCellElement; } interface MSHTMLDirectoryElementExtensions extends DOML2DeprecatedListNumberingAndBulletStyle { } interface HTMLBaseElement extends HTMLElement { target: string; href: string; } declare var HTMLBaseElement: { prototype: HTMLBaseElement; new(): HTMLBaseElement; } interface ClientRect { left: number; width: number; right: number; top: number; bottom: number; height: number; } declare var ClientRect: { prototype: ClientRect; new(): ClientRect; } interface PositionErrorCallback { (error: PositionError): void; } interface DOMImplementation extends DOMHTMLImplementation { createDocumentType(qualifiedName: string, publicId: string, systemId: string): DocumentType; createDocument(namespaceURI: string, qualifiedName: string, doctype: DocumentType): Document; hasFeature(feature: string, version?: string): bool; } declare var DOMImplementation: { prototype: DOMImplementation; new(): DOMImplementation; } interface DOML2DeprecatedWidthStyle_HTMLBlockElement { width: number; } interface SVGUnitTypes { SVG_UNIT_TYPE_UNKNOWN: number; SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; SVG_UNIT_TYPE_USERSPACEONUSE: number; } declare var SVGUnitTypes: { prototype: SVGUnitTypes; new(): SVGUnitTypes; SVG_UNIT_TYPE_UNKNOWN: number; SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; SVG_UNIT_TYPE_USERSPACEONUSE: number; } interface DocumentRange { createRange(): Range; } interface MSHTMLDocumentExtensions { onrowexit: (ev: MSEventObj) => any; compatible: MSCompatibleInfoCollection; oncontrolselect: (ev: MSEventObj) => any; onrowsinserted: (ev: MSEventObj) => any; onpropertychange: (ev: MSEventObj) => any; media: string; onafterupdate: (ev: MSEventObj) => any; onhelp: (ev: Event) => any; uniqueID: string; onbeforeactivate: (ev: UIEvent) => any; onstoragecommit: (ev: StorageEvent) => any; onselectionchange: (ev: Event) => any; documentMode: number; onfocusout: (ev: FocusEvent) => any; ondataavailable: (ev: MSEventObj) => any; onbeforeupdate: (ev: MSEventObj) => any; onfocusin: (ev: FocusEvent) => any; security: string; namespaces: MSNamespaceInfoCollection; ondatasetcomplete: (ev: MSEventObj) => any; onbeforedeactivate: (ev: UIEvent) => any; onstop: (ev: Event) => any; onactivate: (ev: UIEvent) => any; onmssitemodejumplistitemremoved: (ev: MSSiteModeEvent) => any; frames: Window; onselectstart: (ev: Event) => any; onerrorupdate: (ev: MSEventObj) => any; parentWindow: Window; ondeactivate: (ev: UIEvent) => any; ondatasetchanged: (ev: MSEventObj) => any; onrowsdelete: (ev: MSEventObj) => any; onmsthumbnailclick: (ev: MSSiteModeEvent) => any; onrowenter: (ev: MSEventObj) => any; onbeforeeditfocus: (ev: MSEventObj) => any; Script: MSScriptHost; oncellchange: (ev: MSEventObj) => any; URLUnencoded: string; updateSettings(): void; execCommandShowHelp(commandId: string): bool; releaseCapture(): void; focus(): void; } interface CSS2Properties { backgroundAttachment: string; visibility: string; fontFamily: string; borderRightStyle: string; clear: string; content: string; counterIncrement: string; orphans: string; marginBottom: string; borderStyle: string; counterReset: string; outlineWidth: string; marginRight: string; paddingLeft: string; borderBottom: string; marginTop: string; borderTopColor: string; top: string; fontWeight: string; textIndent: string; borderRight: string; width: string; listStyleImage: string; cursor: string; listStylePosition: string; borderTopStyle: string; direction: string; maxWidth: string; color: string; clip: string; borderRightWidth: string; verticalAlign: string; pageBreakAfter: string; overflow: string; borderBottomStyle: string; borderLeftStyle: string; fontStretch: string; emptyCells: string; padding: string; paddingRight: string; background: string; bottom: string; height: string; paddingTop: string; right: string; borderLeftWidth: string; borderLeft: string; backgroundPosition: string; backgroundColor: string; widows: string; lineHeight: string; pageBreakInside: string; borderTopWidth: string; left: string; outlineStyle: string; borderTop: string; paddingBottom: string; outlineColor: string; wordSpacing: string; outline: string; font: string; marginLeft: string; display: string; maxHeight: string; cssFloat: string; letterSpacing: string; borderSpacing: string; backgroundRepeat: string; fontSizeAdjust: string; borderLeftColor: string; borderWidth: string; backgroundImage: string; listStyleType: string; whiteSpace: string; fontStyle: string; borderBottomColor: string; minWidth: string; position: string; zIndex: string; borderColor: string; listStyle: string; captionSide: string; borderCollapse: string; fontVariant: string; quotes: string; tableLayout: string; unicodeBidi: string; borderBottomWidth: string; minHeight: string; textDecoration: string; fontSize: string; border: string; pageBreakBefore: string; textAlign: string; textTransform: string; margin: string; borderRightColor: string; } interface MSImageResourceExtensions_HTMLInputElement { dynsrc: string; vrml: string; lowsrc: string; start: string; loop: number; } interface MSHTMLEmbedElementExtensions { palette: string; hidden: string; pluginspage: string; units: string; } interface MSHTMLModElementExtensions { } interface Element extends Node, NodeSelector, ElementTraversal, MSElementExtensions { scrollTop: number; clientLeft: number; scrollLeft: number; tagName: string; clientWidth: number; scrollWidth: number; clientHeight: number; clientTop: number; scrollHeight: number; getAttribute(name?: string): string; getElementsByTagNameNS(namespaceURI: string, localName: string): NodeList; hasAttributeNS(namespaceURI: string, localName: string): bool; getBoundingClientRect(): ClientRect; getAttributeNS(namespaceURI: string, localName: string): string; getAttributeNodeNS(namespaceURI: string, localName: string): Attr; setAttributeNodeNS(newAttr: Attr): Attr; hasAttribute(name: string): bool; removeAttribute(name?: string): void; setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void; getAttributeNode(name: string): Attr; getElementsByTagName(name: string): NodeList; setAttributeNode(newAttr: Attr): Attr; getClientRects(): ClientRectList; removeAttributeNode(oldAttr: Attr): Attr; setAttribute(name?: string, value?: string): void; removeAttributeNS(namespaceURI: string, localName: string): void; } declare var Element: { prototype: Element; new(): Element; } interface SVGDocument { rootElement: SVGSVGElement; } interface HTMLNextIdElement extends HTMLElement { n: string; } declare var HTMLNextIdElement: { prototype: HTMLNextIdElement; new(): HTMLNextIdElement; } interface SVGPathSegMovetoRel extends SVGPathSeg { y: number; x: number; } declare var SVGPathSegMovetoRel: { prototype: SVGPathSegMovetoRel; new(): SVGPathSegMovetoRel; } interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests { y1: SVGAnimatedLength; x2: SVGAnimatedLength; x1: SVGAnimatedLength; y2: SVGAnimatedLength; } declare var SVGLineElement: { prototype: SVGLineElement; new(): SVGLineElement; } interface HTMLParagraphElement extends HTMLElement, DOML2DeprecatedAlignmentStyle_HTMLParagraphElement, MSHTMLParagraphElementExtensions { } declare var HTMLParagraphElement: { prototype: HTMLParagraphElement; new(): HTMLParagraphElement; } interface MSHTMLTextAreaElementExtensions { status: any; createTextRange(): TextRange; } interface ErrorFunction { (eventOrMessage: any, source: string, fileno: number): any; } interface HTMLAreasCollection extends HTMLCollection { remove(index?: number): void; add(element: HTMLElement, before?: any): void; } declare var HTMLAreasCollection: { prototype: HTMLAreasCollection; new(): HTMLAreasCollection; } interface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace { } declare var SVGDescElement: { prototype: SVGDescElement; new(): SVGDescElement; } interface Node extends EventTarget { nodeType: number; previousSibling: Node; localName: string; namespaceURI: string; textContent: string; parentNode: Node; nextSibling: Node; nodeValue: string; lastChild: Node; childNodes: NodeList; nodeName: string; ownerDocument: Document; attributes: Attr[]; firstChild: Node; prefix: string; removeChild(oldChild: Node): Node; appendChild(newChild: Node): Node; isSupported(feature: string, version: string): bool; isEqualNode(arg: Node): bool; lookupPrefix(namespaceURI: string): string; isDefaultNamespace(namespaceURI: string): bool; compareDocumentPosition(other: Node): number; normalize(): void; isSameNode(other: Node): bool; hasAttributes(): bool; lookupNamespaceURI(prefix: string): string; cloneNode(deep?: bool): Node; hasChildNodes(): bool; replaceChild(newChild: Node, oldChild: Node): Node; insertBefore(newChild: Node, refChild?: Node): Node; ENTITY_REFERENCE_NODE: number; ATTRIBUTE_NODE: number; DOCUMENT_FRAGMENT_NODE: number; TEXT_NODE: number; ELEMENT_NODE: number; COMMENT_NODE: number; DOCUMENT_POSITION_DISCONNECTED: number; DOCUMENT_POSITION_CONTAINED_BY: number; DOCUMENT_POSITION_CONTAINS: number; DOCUMENT_TYPE_NODE: number; DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; DOCUMENT_NODE: number; ENTITY_NODE: number; PROCESSING_INSTRUCTION_NODE: number; CDATA_SECTION_NODE: number; NOTATION_NODE: number; DOCUMENT_POSITION_FOLLOWING: number; DOCUMENT_POSITION_PRECEDING: number; } declare var Node: { prototype: Node; new(): Node; ENTITY_REFERENCE_NODE: number; ATTRIBUTE_NODE: number; DOCUMENT_FRAGMENT_NODE: number; TEXT_NODE: number; ELEMENT_NODE: number; COMMENT_NODE: number; DOCUMENT_POSITION_DISCONNECTED: number; DOCUMENT_POSITION_CONTAINED_BY: number; DOCUMENT_POSITION_CONTAINS: number; DOCUMENT_TYPE_NODE: number; DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; DOCUMENT_NODE: number; ENTITY_NODE: number; PROCESSING_INSTRUCTION_NODE: number; CDATA_SECTION_NODE: number; NOTATION_NODE: number; DOCUMENT_POSITION_FOLLOWING: number; DOCUMENT_POSITION_PRECEDING: number; } interface MSHTMLLegendElementExtensions { } interface MSCSSStyleDeclarationExtensions { getAttribute(attributeName: string, flags?: number): any; setAttribute(attributeName: string, AttributeValue: any, flags?: number): void; removeAttribute(attributeName: string, flags?: number): bool; } interface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg { y: number; x: number; } declare var SVGPathSegCurvetoQuadraticSmoothRel: { prototype: SVGPathSegCurvetoQuadraticSmoothRel; new(): SVGPathSegCurvetoQuadraticSmoothRel; } interface DOML2DeprecatedAlignmentStyle_HTMLTableRowElement { align: string; } interface DOML2DeprecatedBorderStyle_HTMLObjectElement { border: string; } interface MSHTMLSpanElementExtensions { } interface MSHTMLObjectElementExtensions { object: Object; alt: string; classid: string; altHtml: string; BaseHref: string; } interface DOML2DeprecatedListSpaceReduction { compact: bool; } interface CSS3Properties { textAlignLast: string; textUnderlinePosition: string; wordWrap: string; borderTopLeftRadius: string; backgroundClip: string; msTransformOrigin: string; opacity: string; overflowY: string; boxShadow: string; backgroundSize: string; wordBreak: string; boxSizing: string; rubyOverhang: string; rubyAlign: string; textJustify: string; borderRadius: string; overflowX: string; borderTopRightRadius: string; msTransform: string; borderBottomLeftRadius: string; rubyPosition: string; borderBottomRightRadius: string; backgroundOrigin: string; textOverflow: string; } interface MSScriptHost { } declare var MSScriptHost: { prototype: MSScriptHost; new(): MSScriptHost; } interface SVGClipPathElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests { clipPathUnits: SVGAnimatedEnumeration; } declare var SVGClipPathElement: { prototype: SVGClipPathElement; new(): SVGClipPathElement; } interface MouseEvent extends UIEvent, MSMouseEventExtensions { pageX: number; offsetY: number; x: number; y: number; altKey: bool; metaKey: bool; ctrlKey: bool; offsetX: number; screenX: number; clientY: number; shiftKey: bool; screenY: number; relatedTarget: EventTarget; button: number; pageY: number; buttons: number; clientX: number; initMouseEvent(typeArg: string, canBubbleArg: bool, cancelableArg: bool, viewArg: AbstractView, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: bool, altKeyArg: bool, shiftKeyArg: bool, metaKeyArg: bool, buttonArg: number, relatedTargetArg: EventTarget): void; getModifierState(keyArg: string): bool; } declare var MouseEvent: { prototype: MouseEvent; new(): MouseEvent; } interface DOML2DeprecatedAlignmentStyle_HTMLTableElement { align: string; } interface RangeException { code: number; message: string; toString(): string; INVALID_NODE_TYPE_ERR: number; BAD_BOUNDARYPOINTS_ERR: number; } declare var RangeException: { prototype: RangeException; new(): RangeException; INVALID_NODE_TYPE_ERR: number; BAD_BOUNDARYPOINTS_ERR: number; } interface DOML2DeprecatedAlignmentStyle_HTMLHRElement { align: string; } interface SVGTextPositioningElement extends SVGTextContentElement { y: SVGAnimatedLengthList; rotate: SVGAnimatedNumberList; dy: SVGAnimatedLengthList; x: SVGAnimatedLengthList; dx: SVGAnimatedLengthList; } declare var SVGTextPositioningElement: { prototype: SVGTextPositioningElement; new(): SVGTextPositioningElement; } interface HTMLAppletElement extends HTMLElement, DOML2DeprecatedWidthStyle_HTMLAppletElement, DOML2DeprecatedMarginStyle_HTMLObjectElement, MSHTMLAppletElementExtensions, MSDataBindingExtensions, MSDataBindingRecordSetExtensions, DOML2DeprecatedAlignmentStyle_HTMLObjectElement { object: string; archive: string; codeBase: string; alt: string; name: string; height: string; code: string; } declare var HTMLAppletElement: { prototype: HTMLAppletElement; new(): HTMLAppletElement; } interface MSHTMLFieldSetElementExtensions extends DOML2DeprecatedAlignmentStyle_HTMLFieldSetElement { } interface DocumentEvent { createEvent(eventInterface: string): Event; } interface MSHTMLUnknownElementExtensions { } interface TextMetrics { width: number; } declare var TextMetrics: { prototype: TextMetrics; new(): TextMetrics; } interface DOML2DeprecatedWordWrapSuppression_HTMLBodyElement { noWrap: bool; } interface HTMLOListElement extends HTMLElement, DOML2DeprecatedListNumberingAndBulletStyle, DOML2DeprecatedListSpaceReduction, MSHTMLOListElementExtensions { start: number; } declare var HTMLOListElement: { prototype: HTMLOListElement; new(): HTMLOListElement; } interface MSHTMLTableCaptionElementExtensions { vAlign: string; } interface SVGAnimatedString { animVal: string; baseVal: string; } declare var SVGAnimatedString: { prototype: SVGAnimatedString; new(): SVGAnimatedString; } interface SVGPathSegLinetoVerticalRel extends SVGPathSeg { y: number; } declare var SVGPathSegLinetoVerticalRel: { prototype: SVGPathSegLinetoVerticalRel; new(): SVGPathSegLinetoVerticalRel; } interface CDATASection extends Text { } declare var CDATASection: { prototype: CDATASection; new(): CDATASection; } interface StyleMedia { type: string; matchMedium(mediaquery: string): bool; } declare var StyleMedia: { prototype: StyleMedia; new(): StyleMedia; } interface TextRange { boundingLeft: number; htmlText: string; offsetLeft: number; boundingWidth: number; boundingHeight: number; boundingTop: number; text: string; offsetTop: number; moveToPoint(x: number, y: number): void; queryCommandValue(cmdID: string): any; getBookmark(): string; move(Unit: string, Count?: number): number; queryCommandIndeterm(cmdID: string): bool; scrollIntoView(fStart?: bool): void; findText(string: string, count?: number, flags?: number): bool; execCommand(cmdID: string, showUI?: bool, value?: any): bool; getBoundingClientRect(): ClientRect; moveToBookmark(Bookmark: string): bool; isEqual(range: TextRange): bool; duplicate(): TextRange; collapse(Start?: bool): void; queryCommandText(cmdID: string): string; select(): void; pasteHTML(html: string): void; inRange(range: TextRange): bool; moveEnd(Unit: string, Count?: number): number; getClientRects(): ClientRectList; moveStart(Unit: string, Count?: number): number; parentElement(): Element; queryCommandState(cmdID: string): bool; compareEndPoints(how: string, sourceRange: TextRange): number; execCommandShowHelp(cmdID: string): bool; moveToElementText(element: Element): void; expand(Unit: string): bool; queryCommandSupported(cmdID: string): bool; setEndPoint(how: string, SourceRange: TextRange): void; queryCommandEnabled(cmdID: string): bool; } declare var TextRange: { prototype: TextRange; new(): TextRange; } interface HTMLSelectElement extends HTMLElement, MSHTMLCollectionExtensions, MSDataBindingExtensions, MSHTMLSelectElementExtensions { options: HTMLSelectElement; value: string; form: HTMLFormElement; name: string; size: number; length: number; selectedIndex: number; multiple: bool; type: string; remove(index?: number): void; add(element: HTMLElement, before?: any): void; item(name?: any, index?: any): any; (name: any, index: any): any; namedItem(name: string): any; [name: string]: any; (name: string): any; } declare var HTMLSelectElement: { prototype: HTMLSelectElement; new(): HTMLSelectElement; } interface CSSStyleSheet extends StyleSheet, MSCSSStyleSheetExtensions { ownerRule: CSSRule; cssRules: CSSRuleList; insertRule(rule: string, index?: number): number; deleteRule(index?: number): void; } declare var CSSStyleSheet: { prototype: CSSStyleSheet; new(): CSSStyleSheet; } interface HTMLBlockElement extends HTMLElement, DOML2DeprecatedTextFlowControl_HTMLBlockElement, DOML2DeprecatedWidthStyle_HTMLBlockElement { cite: string; } declare var HTMLBlockElement: { prototype: HTMLBlockElement; new(): HTMLBlockElement; } interface SVGTests { requiredFeatures: SVGStringList; requiredExtensions: SVGStringList; systemLanguage: SVGStringList; hasExtension(extension: string): bool; } interface MSSelection { type: string; typeDetail: string; createRange(): TextRange; clear(): void; createRangeCollection(): TextRangeCollection; empty(): void; } declare var MSSelection: { prototype: MSSelection; new(): MSSelection; } interface MSHTMLDListElementExtensions { } interface HTMLMetaElement extends HTMLElement, MSHTMLMetaElementExtensions { httpEquiv: string; name: string; content: string; scheme: string; } declare var HTMLMetaElement: { prototype: HTMLMetaElement; new(): HTMLMetaElement; } interface Selection { isCollapsed: bool; anchorNode: Node; focusNode: Node; anchorOffset: number; focusOffset: number; rangeCount: number; addRange(range: Range): void; collapseToEnd(): void; toString(): string; selectAllChildren(parentNode: Node): void; getRangeAt(index: number): Range; collapse(parentNode: Node, offset: number): void; removeAllRanges(): void; collapseToStart(): void; deleteFromDocument(): void; removeRange(range: Range): void; } declare var Selection: { prototype: Selection; new(): Selection; } interface SVGAnimatedAngle { animVal: SVGAngle; baseVal: SVGAngle; } declare var SVGAnimatedAngle: { prototype: SVGAnimatedAngle; new(): SVGAnimatedAngle; } interface SVGPatternElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGTests, SVGFitToViewBox, SVGURIReference { patternUnits: SVGAnimatedEnumeration; y: SVGAnimatedLength; width: SVGAnimatedLength; x: SVGAnimatedLength; patternContentUnits: SVGAnimatedEnumeration; patternTransform: SVGAnimatedTransformList; height: SVGAnimatedLength; } declare var SVGPatternElement: { prototype: SVGPatternElement; new(): SVGPatternElement; } interface SVGScriptElement extends SVGElement, SVGURIReference { type: string; } declare var SVGScriptElement: { prototype: SVGScriptElement; new(): SVGScriptElement; } interface HTMLDDElement extends HTMLElement, DOML2DeprecatedWordWrapSuppression_HTMLDDElement { } declare var HTMLDDElement: { prototype: HTMLDDElement; new(): HTMLDDElement; } interface NodeIterator { whatToShow: number; filter: NodeFilterCallback; root: Node; expandEntityReferences: bool; nextNode(): Node; detach(): void; previousNode(): Node; } declare var NodeIterator: { prototype: NodeIterator; new(): NodeIterator; } interface CSSStyleRule extends CSSRule, MSCSSStyleRuleExtensions { selectorText: string; style: MSStyleCSSProperties; } declare var CSSStyleRule: { prototype: CSSStyleRule; new(): CSSStyleRule; } interface MSDataBindingRecordSetReadonlyExtensions { recordset: Object; namedRecordset(dataMember: string, hierarchy?: any): Object; } interface HTMLLinkElement extends HTMLElement, MSLinkStyleExtensions, LinkStyle { rel: string; target: string; href: string; media: string; rev: string; type: string; charset: string; hreflang: string; } declare var HTMLLinkElement: { prototype: HTMLLinkElement; new(): HTMLLinkElement; } interface SVGViewElement extends SVGElement, SVGZoomAndPan, SVGFitToViewBox { viewTarget: SVGStringList; } declare var SVGViewElement: { prototype: SVGViewElement; new(): SVGViewElement; } interface MSHTMLAppletElementExtensions extends DOML2DeprecatedBorderStyle_HTMLObjectElement { codeType: string; standby: string; classid: string; useMap: string; form: HTMLFormElement; data: string; contentDocument: Document; altHtml: string; declare: bool; type: string; BaseHref: string; } interface SVGLocatable { farthestViewportElement: SVGElement; nearestViewportElement: SVGElement; getBBox(): SVGRect; getTransformToElement(element: SVGElement): SVGMatrix; getCTM(): SVGMatrix; getScreenCTM(): SVGMatrix; } interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, MSHTMLFontElementExtensions, DOML2DeprecatedSizeProperty { face: string; } declare var HTMLFontElement: { prototype: HTMLFontElement; new(): HTMLFontElement; } interface MSHTMLTableElementExtensions { cells: HTMLCollection; height: any; cols: number; moveRow(indexFrom?: number, indexTo?: number): Object; } interface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace { } declare var SVGTitleElement: { prototype: SVGTitleElement; new(): SVGTitleElement; } interface ControlRangeCollection { length: number; queryCommandValue(cmdID: string): any; remove(index: number): void; add(item: Element): void; queryCommandIndeterm(cmdID: string): bool; scrollIntoView(varargStart?: any): void; item(index: number): Element; [index: number]: Element; execCommand(cmdID: string, showUI?: bool, value?: any): bool; addElement(item: Element): void; queryCommandState(cmdID: string): bool; queryCommandSupported(cmdID: string): bool; queryCommandEnabled(cmdID: string): bool; queryCommandText(cmdID: string): string; select(): void; } declare var ControlRangeCollection: { prototype: ControlRangeCollection; new(): ControlRangeCollection; } interface DOML2DeprecatedAlignmentStyle_HTMLImageElement { align: string; } interface MSHTMLFrameElementExtensions { width: any; contentWindow: Window; onload: (ev: Event) => any; frameBorder: string; height: any; border: string; frameSpacing: any; } interface MSNamespaceInfo extends MSEventAttachmentTarget { urn: string; onreadystatechange: (ev: Event) => any; name: string; readyState: string; doImport(implementationUrl: string): void; } declare var MSNamespaceInfo: { prototype: MSNamespaceInfo; new(): MSNamespaceInfo; } interface WindowSessionStorage { sessionStorage: Storage; } interface SVGAnimatedTransformList { animVal: SVGTransformList; baseVal: SVGTransformList; } declare var SVGAnimatedTransformList: { prototype: SVGAnimatedTransformList; new(): SVGAnimatedTransformList; } interface HTMLTableCaptionElement extends HTMLElement, MSHTMLTableCaptionElementExtensions, DOML2DeprecatedAlignmentStyle_HTMLTableCaptionElement { } declare var HTMLTableCaptionElement: { prototype: HTMLTableCaptionElement; new(): HTMLTableCaptionElement; } interface HTMLOptionElement extends HTMLElement, MSDataBindingExtensions { index: number; defaultSelected: bool; value: string; text: string; form: HTMLFormElement; label: string; selected: bool; } declare var HTMLOptionElement: { prototype: HTMLOptionElement; new(): HTMLOptionElement; } interface HTMLMapElement extends HTMLElement { name: string; areas: HTMLAreasCollection; } declare var HTMLMapElement: { prototype: HTMLMapElement; new(): HTMLMapElement; } interface HTMLMenuElement extends HTMLElement, DOML2DeprecatedListSpaceReduction, MSHTMLMenuElementExtensions { type: string; } declare var HTMLMenuElement: { prototype: HTMLMenuElement; new(): HTMLMenuElement; } interface MouseWheelEvent extends MouseEvent { wheelDelta: number; initMouseWheelEvent(typeArg: string, canBubbleArg: bool, cancelableArg: bool, viewArg: AbstractView, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, wheelDeltaArg: number): void; } declare var MouseWheelEvent: { prototype: MouseWheelEvent; new(): MouseWheelEvent; } interface SVGFitToViewBox { viewBox: SVGAnimatedRect; preserveAspectRatio: SVGAnimatedPreserveAspectRatio; } interface MSHTMLAnchorElementExtensions { nameProp: string; protocolLong: string; urn: string; mimeType: string; Methods: string; } interface SVGPointList { numberOfItems: number; replaceItem(newItem: SVGPoint, index: number): SVGPoint; getItem(index: number): SVGPoint; clear(): void; appendItem(newItem: SVGPoint): SVGPoint; initialize(newItem: SVGPoint): SVGPoint; removeItem(index: number): SVGPoint; insertItemBefore(newItem: SVGPoint, index: number): SVGPoint; } declare var SVGPointList: { prototype: SVGPointList; new(): SVGPointList; } interface MSElementCSSInlineStyleExtensions { doScroll(component?: any): void; componentFromPoint(x: number, y: number): string; } interface SVGAnimatedLengthList { animVal: SVGLengthList; baseVal: SVGLengthList; } declare var SVGAnimatedLengthList: { prototype: SVGAnimatedLengthList; new(): SVGAnimatedLengthList; } interface MSHTMLTableDataCellElementExtensions { } interface Window extends ViewCSS, MSEventAttachmentTarget, MSWindowExtensions, WindowPerformance, ScreenView, EventTarget, WindowLocalStorage, WindowSessionStorage, WindowTimers { ondragend: (ev: DragEvent) => any; onkeydown: (ev: KeyboardEvent) => any; ondragover: (ev: DragEvent) => any; onkeyup: (ev: KeyboardEvent) => any; onreset: (ev: Event) => any; onmouseup: (ev: MouseEvent) => any; ondragstart: (ev: DragEvent) => any; ondrag: (ev: DragEvent) => any; onmouseover: (ev: MouseEvent) => any; ondragleave: (ev: DragEvent) => any; history: History; name: string; onafterprint: (ev: Event) => any; onpause: (ev: Event) => any; onbeforeprint: (ev: Event) => any; top: Window; onmousedown: (ev: MouseEvent) => any; onseeked: (ev: Event) => any; opener: Window; onclick: (ev: MouseEvent) => any; onwaiting: (ev: Event) => any; ononline: (ev: Event) => any; ondurationchange: (ev: Event) => any; frames: Window; onblur: (ev: FocusEvent) => any; onemptied: (ev: Event) => any; onseeking: (ev: Event) => any; oncanplay: (ev: Event) => any; onstalled: (ev: Event) => any; onmousemove: (ev: MouseEvent) => any; onoffline: (ev: Event) => any; length: number; onbeforeunload: (ev: BeforeUnloadEvent) => any; onratechange: (ev: Event) => any; onstorage: (ev: StorageEvent) => any; onloadstart: (ev: Event) => any; ondragenter: (ev: DragEvent) => any; onsubmit: (ev: Event) => any; self: Window; onprogress: (ev: any) => any; ondblclick: (ev: MouseEvent) => any; oncontextmenu: (ev: MouseEvent) => any; onchange: (ev: Event) => any; onloadedmetadata: (ev: Event) => any; onplay: (ev: Event) => any; onerror: ErrorFunction; onplaying: (ev: Event) => any; parent: Window; location: Location; oncanplaythrough: (ev: Event) => any; onabort: (ev: UIEvent) => any; onreadystatechange: (ev: Event) => any; onkeypress: (ev: KeyboardEvent) => any; frameElement: Element; onloadeddata: (ev: Event) => any; onsuspend: (ev: Event) => any; window: Window; onfocus: (ev: FocusEvent) => any; onmessage: (ev: MessageEvent) => any; ontimeupdate: (ev: Event) => any; onresize: (ev: UIEvent) => any; navigator: Navigator; onselect: (ev: UIEvent) => any; ondrop: (ev: DragEvent) => any; onmouseout: (ev: MouseEvent) => any; onended: (ev: Event) => any; onhashchange: (ev: Event) => any; onunload: (ev: Event) => any; onscroll: (ev: UIEvent) => any; onmousewheel: (ev: MouseWheelEvent) => any; onload: (ev: Event) => any; onvolumechange: (ev: Event) => any; oninput: (ev: Event) => any; alert(message?: string): void; focus(): void; print(): void; prompt(message?: string, defaul?: string): string; toString(): string; open(url?: string, target?: string, features?: string, replace?: bool): Window; close(): void; confirm(message?: string): bool; postMessage(message: any, targetOrigin: string, ports?: any): void; showModalDialog(url?: string, argument?: any, options?: any): any; blur(): void; getSelection(): Selection; } declare var Window: { prototype: Window; new(): Window; } interface SVGAnimatedPreserveAspectRatio { animVal: SVGPreserveAspectRatio; baseVal: SVGPreserveAspectRatio; } declare var SVGAnimatedPreserveAspectRatio: { prototype: SVGAnimatedPreserveAspectRatio; new(): SVGAnimatedPreserveAspectRatio; } interface MSSiteModeEvent extends Event { buttonID: number; actionURL: string; } declare var MSSiteModeEvent: { prototype: MSSiteModeEvent; new(): MSSiteModeEvent; } interface MSCSSStyleRuleExtensions { readOnly: bool; } interface StyleSheetPageList { length: number; item(index: number): StyleSheetPage; [index: number]: StyleSheetPage; } declare var StyleSheetPageList: { prototype: StyleSheetPageList; new(): StyleSheetPageList; } interface HTMLCollection extends MSHTMLCollectionExtensions { length: number; item(nameOrIndex?: any, optionalIndex?: any): Element; (nameOrIndex: any, optionalIndex: any): Element; namedItem(name: string): Element; [index: number]: Element; [name: string]: Element; (name: string): Element; } declare var HTMLCollection: { prototype: HTMLCollection; new(): HTMLCollection; } interface MSCSSProperties extends CSSStyleDeclaration, MSCSSStyleDeclarationExtensions { scrollbarShadowColor: string; scrollbarHighlightColor: string; layoutGridChar: string; layoutGridType: string; textAutospace: string; textKashidaSpace: string; writingMode: string; scrollbarFaceColor: string; backgroundPositionY: string; lineBreak: string; imeMode: string; msBlockProgression: string; layoutGridLine: string; scrollbarBaseColor: string; layoutGrid: string; layoutFlow: string; textKashida: string; filter: string; zoom: string; scrollbarArrowColor: string; behavior: string; backgroundPositionX: string; accelerator: string; layoutGridMode: string; textJustifyTrim: string; scrollbar3dLightColor: string; msInterpolationMode: string; scrollbarTrackColor: string; scrollbarDarkShadowColor: string; styleFloat: string; } declare var MSCSSProperties: { prototype: MSCSSProperties; new(): MSCSSProperties; } interface HTMLImageElement extends HTMLElement, DOML2DeprecatedMarginStyle, DOML2DeprecatedBorderStyle, DOML2DeprecatedAlignmentStyle_HTMLImageElement, MSImageResourceExtensions, MSHTMLImageElementExtensions, MSDataBindingExtensions, MSResourceMetadata { width: number; naturalHeight: number; alt: string; src: string; useMap: string; naturalWidth: number; name: string; height: number; longDesc: string; isMap: bool; complete: bool; } declare var HTMLImageElement: { prototype: HTMLImageElement; new(): HTMLImageElement; } interface HTMLAreaElement extends HTMLElement, MSHTMLAreaElementExtensions { protocol: string; search: string; alt: string; coords: string; hostname: string; port: string; pathname: string; host: string; hash: string; target: string; href: string; noHref: bool; shape: string; toString(): string; } declare var HTMLAreaElement: { prototype: HTMLAreaElement; new(): HTMLAreaElement; } interface EventTarget { removeEventListener(type: string, listener: EventListener, useCapture?: bool): void; addEventListener(type: string, listener: EventListener, useCapture?: bool): void; dispatchEvent(evt: Event): bool; } interface SVGAngle { valueAsString: string; valueInSpecifiedUnits: number; value: number; unitType: number; newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; convertToSpecifiedUnits(unitType: number): void; SVG_ANGLETYPE_RAD: number; SVG_ANGLETYPE_UNKNOWN: number; SVG_ANGLETYPE_UNSPECIFIED: number; SVG_ANGLETYPE_DEG: number; SVG_ANGLETYPE_GRAD: number; } declare var SVGAngle: { prototype: SVGAngle; new(): SVGAngle; SVG_ANGLETYPE_RAD: number; SVG_ANGLETYPE_UNKNOWN: number; SVG_ANGLETYPE_UNSPECIFIED: number; SVG_ANGLETYPE_DEG: number; SVG_ANGLETYPE_GRAD: number; } interface HTMLButtonElement extends HTMLElement, MSHTMLButtonElementExtensions, MSDataBindingExtensions { value: string; form: HTMLFormElement; name: string; type: string; } declare var HTMLButtonElement: { prototype: HTMLButtonElement; new(): HTMLButtonElement; } interface MSHTMLLabelElementExtensions { } interface HTMLSourceElement extends HTMLElement { src: string; media: string; type: string; } declare var HTMLSourceElement: { prototype: HTMLSourceElement; new(): HTMLSourceElement; } interface CanvasGradient { addColorStop(offset: number, color: string): void; } declare var CanvasGradient: { prototype: CanvasGradient; new(): CanvasGradient; } interface KeyboardEvent extends UIEvent, KeyboardEventExtensions { location: number; shiftKey: bool; locale: string; key: string; altKey: bool; metaKey: bool; char: string; ctrlKey: bool; repeat: bool; getModifierState(keyArg: string): bool; initKeyboardEvent(typeArg: string, canBubbleArg: bool, cancelableArg: bool, viewArg: AbstractView, keyArg: string, locationArg: number, modifiersListArg: string, repeat: bool, locale: string): void; DOM_KEY_LOCATION_RIGHT: number; DOM_KEY_LOCATION_STANDARD: number; DOM_KEY_LOCATION_LEFT: number; DOM_KEY_LOCATION_NUMPAD: number; DOM_KEY_LOCATION_JOYSTICK: number; DOM_KEY_LOCATION_MOBILE: number; } declare var KeyboardEvent: { prototype: KeyboardEvent; new(): KeyboardEvent; DOM_KEY_LOCATION_RIGHT: number; DOM_KEY_LOCATION_STANDARD: number; DOM_KEY_LOCATION_LEFT: number; DOM_KEY_LOCATION_NUMPAD: number; DOM_KEY_LOCATION_JOYSTICK: number; DOM_KEY_LOCATION_MOBILE: number; } interface Document extends Node, DocumentStyle, DocumentRange, HTMLDocument, NodeSelector, DocumentEvent, DocumentTraversal, DocumentView, SVGDocument { doctype: DocumentType; xmlVersion: string; implementation: DOMImplementation; xmlEncoding: string; xmlStandalone: bool; documentElement: HTMLElement; inputEncoding: string; createElement(tagName: string): HTMLElement; adoptNode(source: Node): Node; createComment(data: string): Comment; createDocumentFragment(): DocumentFragment; getElementsByTagName(tagname: string): NodeList; getElementsByTagNameNS(namespaceURI: string, localName: string): NodeList; createProcessingInstruction(target: string, data: string): ProcessingInstruction; createElementNS(namespaceURI: string, qualifiedName: string): Element; createAttribute(name: string): Attr; createTextNode(data: string): Text; importNode(importedNode: Node, deep: bool): Node; createCDATASection(data: string): CDATASection; createAttributeNS(namespaceURI: string, qualifiedName: string): Attr; getElementById(elementId: string): HTMLElement; } declare var Document: { prototype: Document; new(): Document; } interface MessageEvent extends Event { source: Window; origin: string; data: any; initMessageEvent(typeArg: string, canBubbleArg: bool, cancelableArg: bool, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; } declare var MessageEvent: { prototype: MessageEvent; new(): MessageEvent; } interface SVGElement extends Element, SVGElementEventHandlers { xmlbase: string; viewportElement: SVGElement; id: string; ownerSVGElement: SVGSVGElement; } declare var SVGElement: { prototype: SVGElement; new(): SVGElement; } interface HTMLScriptElement extends HTMLElement { defer: bool; text: string; src: string; htmlFor: string; charset: string; type: string; event: string; } declare var HTMLScriptElement: { prototype: HTMLScriptElement; new(): HTMLScriptElement; } interface MSHTMLBodyElementExtensions extends DOML2DeprecatedWordWrapSuppression_HTMLBodyElement { scroll: string; bottomMargin: any; topMargin: any; rightMargin: any; bgProperties: string; leftMargin: any; createTextRange(): TextRange; } interface HTMLTableRowElement extends HTMLElement, MSBorderColorHighlightStyle_HTMLTableRowElement, HTMLTableAlignment, MSBorderColorStyle_HTMLTableRowElement, DOML2DeprecatedAlignmentStyle_HTMLTableRowElement, DOML2DeprecatedBackgroundColorStyle, MSHTMLTableRowElementExtensions { rowIndex: number; cells: HTMLCollection; sectionRowIndex: number; deleteCell(index?: number): void; insertCell(index?: number): HTMLElement; } declare var HTMLTableRowElement: { prototype: HTMLTableRowElement; new(): HTMLTableRowElement; } interface MSCommentExtensions { text: string; } interface DOML2DeprecatedMarginStyle_HTMLMarqueeElement { vspace: number; hspace: number; } interface MSCSSRuleList { length: number; item(index?: number): CSSStyleRule; [index: number]: CSSStyleRule; } declare var MSCSSRuleList: { prototype: MSCSSRuleList; new(): MSCSSRuleList; } interface CanvasRenderingContext2D { shadowOffsetX: number; lineWidth: number; miterLimit: number; canvas: HTMLCanvasElement; strokeStyle: any; font: string; globalAlpha: number; globalCompositeOperation: string; shadowOffsetY: number; fillStyle: any; lineCap: string; shadowBlur: number; textAlign: string; textBaseline: string; shadowColor: string; lineJoin: string; restore(): void; setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; save(): void; arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: bool): void; measureText(text: string): TextMetrics; isPointInPath(x: number, y: number): bool; quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; rotate(angle: number): void; fillText(text: string, x: number, y: number, maxWidth?: number): void; translate(x: number, y: number): void; scale(x: number, y: number): void; createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; lineTo(x: number, y: number): void; fill(): void; createPattern(image: HTMLElement, repetition: string): CanvasPattern; closePath(): void; rect(x: number, y: number, w: number, h: number): void; clip(): void; createImageData(imageDataOrSw: any, sh?: number): ImageData; clearRect(x: number, y: number, w: number, h: number): void; moveTo(x: number, y: number): void; getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; fillRect(x: number, y: number, w: number, h: number): void; bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; drawImage(image: HTMLElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void; transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; stroke(): void; strokeRect(x: number, y: number, w: number, h: number): void; strokeText(text: string, x: number, y: number, maxWidth?: number): void; beginPath(): void; arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; } declare var CanvasRenderingContext2D: { prototype: CanvasRenderingContext2D; new(): CanvasRenderingContext2D; } interface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg { x: number; } declare var SVGPathSegLinetoHorizontalAbs: { prototype: SVGPathSegLinetoHorizontalAbs; new(): SVGPathSegLinetoHorizontalAbs; } interface DOML2DeprecatedAlignmentStyle_HTMLObjectElement { align: string; } interface DOML2DeprecatedBorderStyle_MSHTMLIFrameElementExtensions { border: string; } interface MSHTMLElementRangeExtensions { createControlRange(): ControlRangeCollection; } interface SVGPathSegArcAbs extends SVGPathSeg { y: number; sweepFlag: bool; r2: number; x: number; angle: number; r1: number; largeArcFlag: bool; } declare var SVGPathSegArcAbs: { prototype: SVGPathSegArcAbs; new(): SVGPathSegArcAbs; } interface MSScreenExtensions { deviceXDPI: number; fontSmoothingEnabled: bool; bufferDepth: number; logicalXDPI: number; systemXDPI: number; logicalYDPI: number; systemYDPI: number; updateInterval: number; deviceYDPI: number; } interface HTMLHtmlElement extends HTMLElement, HTMLHtmlElementDOML2Deprecated { } declare var HTMLHtmlElement: { prototype: HTMLHtmlElement; new(): HTMLHtmlElement; } interface MSBorderColorStyle { borderColor: any; } interface SVGTransformList { numberOfItems: number; getItem(index: number): SVGTransform; consolidate(): SVGTransform; clear(): void; appendItem(newItem: SVGTransform): SVGTransform; initialize(newItem: SVGTransform): SVGTransform; removeItem(index: number): SVGTransform; insertItemBefore(newItem: SVGTransform, index: number): SVGTransform; replaceItem(newItem: SVGTransform, index: number): SVGTransform; createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; } declare var SVGTransformList: { prototype: SVGTransformList; new(): SVGTransformList; } interface SVGPathSegClosePath extends SVGPathSeg { } declare var SVGPathSegClosePath: { prototype: SVGPathSegClosePath; new(): SVGPathSegClosePath; } interface DOML2DeprecatedMarginStyle_MSHTMLIFrameElementExtensions { vspace: number; hspace: number; } interface HTMLFrameElement extends HTMLElement, GetSVGDocument, MSHTMLFrameElementExtensions, MSDataBindingExtensions, MSBorderColorStyle_HTMLFrameElement { scrolling: string; marginHeight: string; src: string; name: string; marginWidth: string; contentDocument: Document; longDesc: string; noResize: bool; } declare var HTMLFrameElement: { prototype: HTMLFrameElement; new(): HTMLFrameElement; } interface SVGAnimatedLength { animVal: SVGLength; baseVal: SVGLength; } declare var SVGAnimatedLength: { prototype: SVGAnimatedLength; new(): SVGAnimatedLength; } interface CSSMediaRule extends CSSRule { media: MediaList; cssRules: CSSRuleList; insertRule(rule: string, index?: number): number; deleteRule(index?: number): void; } declare var CSSMediaRule: { prototype: CSSMediaRule; new(): CSSMediaRule; } interface HTMLQuoteElement extends HTMLElement, MSHTMLQuoteElementExtensions { cite: string; } declare var HTMLQuoteElement: { prototype: HTMLQuoteElement; new(): HTMLQuoteElement; } interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests { } declare var SVGDefsElement: { prototype: SVGDefsElement; new(): SVGDefsElement; } interface SVGAnimatedPoints { points: SVGPointList; animatedPoints: SVGPointList; } interface WindowModal { dialogArguments: any; returnValue: any; } interface MSHTMLButtonElementExtensions { status: any; createTextRange(): TextRange; } interface XMLHttpRequest extends EventTarget, MSXMLHttpRequestExtensions { onreadystatechange: (ev: Event) => any; status: number; onload: (ev: Event) => any; readyState: number; responseText: string; responseXML: Document; statusText: string; open(method: string, url: string, async?: bool, user?: string, password?: string): void; send(data?: any): void; abort(): void; getAllResponseHeaders(): string; setRequestHeader(header: string, value: string): void; getResponseHeader(header: string): string; LOADING: number; DONE: number; UNSENT: number; OPENED: number; HEADERS_RECEIVED: number; } declare var XMLHttpRequest: { prototype: XMLHttpRequest; new (): XMLHttpRequest; LOADING: number; DONE: number; UNSENT: number; OPENED: number; HEADERS_RECEIVED: number; } interface HTMLTableHeaderCellElement extends HTMLTableCellElement, HTMLTableHeaderCellScope { } declare var HTMLTableHeaderCellElement: { prototype: HTMLTableHeaderCellElement; new(): HTMLTableHeaderCellElement; } interface HTMLDListElement extends HTMLElement, DOML2DeprecatedListSpaceReduction, MSHTMLDListElementExtensions { } declare var HTMLDListElement: { prototype: HTMLDListElement; new(): HTMLDListElement; } interface MSDataBindingExtensions { dataSrc: string; dataFormatAs: string; dataFld: string; } interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests { ry: SVGAnimatedLength; cx: SVGAnimatedLength; rx: SVGAnimatedLength; cy: SVGAnimatedLength; } declare var SVGEllipseElement: { prototype: SVGEllipseElement; new(): SVGEllipseElement; } interface SVGPathSegLinetoHorizontalRel extends SVGPathSeg { x: number; } declare var SVGPathSegLinetoHorizontalRel: { prototype: SVGPathSegLinetoHorizontalRel; new(): SVGPathSegLinetoHorizontalRel; } interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGURIReference { target: SVGAnimatedString; } declare var SVGAElement: { prototype: SVGAElement; new(): SVGAElement; } interface MSHTMLMetaElementExtensions { url: string; charset: string; } interface SVGStylable { className: SVGAnimatedString; style: CSSStyleDeclaration; } interface MSHTMLTableCellElementExtensions { } interface HTMLFrameSetElement extends HTMLElement, MSHTMLFrameSetElementExtensions, MSBorderColorStyle_HTMLFrameSetElement { onresize: (ev: UIEvent) => any; ononline: (ev: Event) => any; onafterprint: (ev: Event) => any; onbeforeprint: (ev: Event) => any; onoffline: (ev: Event) => any; rows: string; cols: string; onblur: (ev: FocusEvent) => any; onunload: (ev: Event) => any; onhashchange: (ev: Event) => any; onfocus: (ev: FocusEvent) => any; onmessage: (ev: MessageEvent) => any; onload: (ev: Event) => any; onerror: (ev: Event) => any; onbeforeunload: (ev: BeforeUnloadEvent) => any; onstorage: (ev: StorageEvent) => any; } declare var HTMLFrameSetElement: { prototype: HTMLFrameSetElement; new(): HTMLFrameSetElement; } interface SVGTransformable extends SVGLocatable { transform: SVGAnimatedTransformList; } interface Screen extends MSScreenExtensions { width: number; colorDepth: number; availWidth: number; pixelDepth: number; availHeight: number; height: number; } declare var Screen: { prototype: Screen; new(): Screen; } interface NavigatorGeolocation { geolocation: Geolocation; } interface Coordinates { altitudeAccuracy: number; longitude: number; latitude: number; speed: number; heading: number; altitude: number; accuracy: number; } declare var Coordinates: { prototype: Coordinates; new(): Coordinates; } interface DOML2DeprecatedAlignmentStyle_HTMLTableColElement { align: string; } interface EventListener { (evt: Event): void; } interface SVGLangSpace { xmllang: string; xmlspace: string; } interface DataTransfer { effectAllowed: string; dropEffect: string; clearData(format?: string): bool; setData(format: string, data: string): bool; getData(format: string): string; } declare var DataTransfer: { prototype: DataTransfer; new(): DataTransfer; } interface FocusEvent extends UIEvent { relatedTarget: EventTarget; initFocusEvent(typeArg: string, canBubbleArg: bool, cancelableArg: bool, viewArg: AbstractView, detailArg: number, relatedTargetArg: EventTarget): void; } declare var FocusEvent: { prototype: FocusEvent; new(): FocusEvent; } interface Range { startOffset: number; collapsed: bool; endOffset: number; startContainer: Node; endContainer: Node; commonAncestorContainer: Node; setStart(refNode: Node, offset: number): void; setEndBefore(refNode: Node): void; setStartBefore(refNode: Node): void; selectNode(refNode: Node): void; detach(): void; getBoundingClientRect(): ClientRect; toString(): string; compareBoundaryPoints(how: number, sourceRange: Range): number; insertNode(newNode: Node): void; collapse(toStart: bool): void; selectNodeContents(refNode: Node): void; cloneContents(): DocumentFragment; setEnd(refNode: Node, offset: number): void; cloneRange(): Range; getClientRects(): ClientRectList; surroundContents(newParent: Node): void; deleteContents(): void; setStartAfter(refNode: Node): void; extractContents(): DocumentFragment; setEndAfter(refNode: Node): void; END_TO_END: number; START_TO_START: number; START_TO_END: number; END_TO_START: number; } declare var Range: { prototype: Range; new(): Range; END_TO_END: number; START_TO_START: number; START_TO_END: number; END_TO_START: number; } interface MSHTMLPreElementExtensions extends DOML2DeprecatedTextFlowControl_HTMLBlockElement { cite: string; } interface SVGPoint { y: number; x: number; matrixTransform(matrix: SVGMatrix): SVGPoint; } declare var SVGPoint: { prototype: SVGPoint; new(): SVGPoint; } interface MSPluginsCollection { length: number; refresh(reload?: bool): void; } declare var MSPluginsCollection: { prototype: MSPluginsCollection; new(): MSPluginsCollection; } interface MSHTMLFontElementExtensions { } interface SVGAnimatedNumberList { animVal: SVGNumberList; baseVal: SVGNumberList; } declare var SVGAnimatedNumberList: { prototype: SVGAnimatedNumberList; new(): SVGAnimatedNumberList; } interface SVGSVGElement extends SVGElement, SVGZoomAndPan, SVGLangSpace, SVGLocatable, SVGTests, SVGFitToViewBox, SVGSVGElementEventHandlers, SVGStylable, DocumentEvent, ViewCSS_SVGSVGElement { width: SVGAnimatedLength; x: SVGAnimatedLength; contentStyleType: string; screenPixelToMillimeterY: number; height: SVGAnimatedLength; contentScriptType: string; pixelUnitToMillimeterX: number; currentTranslate: SVGPoint; y: SVGAnimatedLength; viewport: SVGRect; currentScale: number; screenPixelToMillimeterX: number; pixelUnitToMillimeterY: number; setCurrentTime(seconds: number): void; createSVGLength(): SVGLength; getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeList; unpauseAnimations(): void; createSVGRect(): SVGRect; checkIntersection(element: SVGElement, rect: SVGRect): bool; unsuspendRedrawAll(): void; pauseAnimations(): void; suspendRedraw(maxWaitMilliseconds: number): number; deselectAll(): void; createSVGAngle(): SVGAngle; getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeList; createSVGTransform(): SVGTransform; unsuspendRedraw(suspendHandleID: number): void; forceRedraw(): void; getCurrentTime(): number; checkEnclosure(element: SVGElement, rect: SVGRect): bool; createSVGMatrix(): SVGMatrix; createSVGPoint(): SVGPoint; createSVGNumber(): SVGNumber; createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; getElementById(elementId: string): Element; } declare var SVGSVGElement: { prototype: SVGSVGElement; new(): SVGSVGElement; } interface HTMLLabelElement extends HTMLElement, MSDataBindingExtensions, MSHTMLLabelElementExtensions { htmlFor: string; form: HTMLFormElement; } declare var HTMLLabelElement: { prototype: HTMLLabelElement; new(): HTMLLabelElement; } interface MSResourceMetadata { protocol: string; fileSize: string; fileUpdatedDate: string; nameProp: string; fileCreatedDate: string; fileModifiedDate: string; mimeType: string; } interface MSHTMLQuoteElementExtensions { dateTime: string; } interface DOML2DeprecatedAlignmentStyle_HTMLIFrameElement { align: string; } interface HTMLLegendElement extends HTMLElement, DOML2DeprecatedAlignmentStyle_HTMLLegendElement, MSDataBindingExtensions, MSHTMLLegendElementExtensions { form: HTMLFormElement; } declare var HTMLLegendElement: { prototype: HTMLLegendElement; new(): HTMLLegendElement; } interface HTMLDirectoryElement extends HTMLElement, DOML2DeprecatedListSpaceReduction, MSHTMLDirectoryElementExtensions { } declare var HTMLDirectoryElement: { prototype: HTMLDirectoryElement; new(): HTMLDirectoryElement; } interface NavigatorAbilities { } interface MSHTMLImageElementExtensions { href: string; } interface SVGAnimatedInteger { animVal: number; baseVal: number; } declare var SVGAnimatedInteger: { prototype: SVGAnimatedInteger; new(): SVGAnimatedInteger; } interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { } declare var SVGTextElement: { prototype: SVGTextElement; new(): SVGTextElement; } interface SVGTSpanElement extends SVGTextPositioningElement { } declare var SVGTSpanElement: { prototype: SVGTSpanElement; new(): SVGTSpanElement; } interface HTMLLIElement extends HTMLElement, DOML2DeprecatedListNumberingAndBulletStyle, MSHTMLLIElementExtensions { value: number; } declare var HTMLLIElement: { prototype: HTMLLIElement; new(): HTMLLIElement; } interface SVGPathSegLinetoVerticalAbs extends SVGPathSeg { y: number; } declare var SVGPathSegLinetoVerticalAbs: { prototype: SVGPathSegLinetoVerticalAbs; new(): SVGPathSegLinetoVerticalAbs; } interface ViewCSS { getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; } interface MSAttrExtensions { expando: bool; } interface MSStorageExtensions { remainingSpace: number; } interface SVGStyleElement extends SVGElement, SVGLangSpace { media: string; type: string; title: string; } declare var SVGStyleElement: { prototype: SVGStyleElement; new(): SVGStyleElement; } interface MSCurrentStyleCSSProperties extends MSCSSProperties { blockDirection: string; clipBottom: string; clipLeft: string; clipRight: string; clipTop: string; hasLayout: string; } declare var MSCurrentStyleCSSProperties: { prototype: MSCurrentStyleCSSProperties; new(): MSCurrentStyleCSSProperties; } interface MSLinkStyleExtensions { styleSheet: StyleSheet; } interface MSHTMLCollectionExtensions { urns(urn: any): Object; tags(tagName: any): Object; } interface DOML2DeprecatedWordWrapSuppression_HTMLDivElement { noWrap: bool; } interface DocumentTraversal { createNodeIterator(root: Node, whatToShow: number, filter: NodeFilterCallback, entityReferenceExpansion: bool): NodeIterator; createTreeWalker(root: Node, whatToShow: number, filter: NodeFilterCallback, entityReferenceExpansion: bool): TreeWalker; } interface Storage extends MSStorageExtensions { length: number; getItem(key: string): any; [key: string]: any; setItem(key: string, data: string): void; clear(): void; removeItem(key: string): void; key(index: number): string; [index: number]: any; } declare var Storage: { prototype: Storage; new(): Storage; } interface HTMLTableHeaderCellScope { scope: string; } interface HTMLIFrameElement extends HTMLElement, GetSVGDocument, MSHTMLIFrameElementExtensions, MSDataBindingExtensions, DOML2DeprecatedAlignmentStyle_HTMLIFrameElement { width: string; contentWindow: Window; scrolling: string; src: string; marginHeight: string; name: string; marginWidth: string; height: string; contentDocument: Document; longDesc: string; frameBorder: string; } declare var HTMLIFrameElement: { prototype: HTMLIFrameElement; new(): HTMLIFrameElement; } interface MSNavigatorAbilities { userLanguage: string; plugins: MSPluginsCollection; cookieEnabled: bool; appCodeName: string; cpuClass: string; appMinorVersion: string; connectionSpeed: number; browserLanguage: string; mimeTypes: MSMimeTypesCollection; product: string; systemLanguage: string; javaEnabled(): bool; taintEnabled(): bool; } interface TextRangeCollection { length: number; item(index: number): TextRange; [index: number]: TextRange; } declare var TextRangeCollection: { prototype: TextRangeCollection; new(): TextRangeCollection; } interface HTMLBodyElement extends HTMLElement, HTMLBodyElementDOML2Deprecated, MSHTMLBodyElementExtensions, DOML2DeprecatedBackgroundStyle, DOML2DeprecatedBackgroundColorStyle { onresize: (ev: UIEvent) => any; ononline: (ev: Event) => any; onafterprint: (ev: Event) => any; onbeforeprint: (ev: Event) => any; onoffline: (ev: Event) => any; onblur: (ev: FocusEvent) => any; onhashchange: (ev: Event) => any; onunload: (ev: Event) => any; onfocus: (ev: FocusEvent) => any; onmessage: (ev: MessageEvent) => any; onload: (ev: Event) => any; onerror: (ev: Event) => any; onbeforeunload: (ev: BeforeUnloadEvent) => any; onstorage: (ev: StorageEvent) => any; } declare var HTMLBodyElement: { prototype: HTMLBodyElement; new(): HTMLBodyElement; } interface DocumentType extends Node { name: string; notations: NamedNodeMap; systemId: string; internalSubset: string; entities: NamedNodeMap; publicId: string; } declare var DocumentType: { prototype: DocumentType; new(): DocumentType; } interface MSHTMLInputElementExtensions extends DOML2DeprecatedMarginStyle_HTMLInputElement, DOML2DeprecatedBorderStyle_HTMLInputElement { status: bool; complete: bool; createTextRange(): TextRange; } interface DOML2DeprecatedAlignmentStyle_HTMLLegendElement { align: string; } interface SVGRadialGradientElement extends SVGGradientElement { cx: SVGAnimatedLength; r: SVGAnimatedLength; cy: SVGAnimatedLength; fx: SVGAnimatedLength; fy: SVGAnimatedLength; } declare var SVGRadialGradientElement: { prototype: SVGRadialGradientElement; new(): SVGRadialGradientElement; } interface MutationEvent extends Event { newValue: string; attrChange: number; attrName: string; prevValue: string; relatedNode: Node; initMutationEvent(typeArg: string, canBubbleArg: bool, cancelableArg: bool, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; MODIFICATION: number; REMOVAL: number; ADDITION: number; } declare var MutationEvent: { prototype: MutationEvent; new(): MutationEvent; MODIFICATION: number; REMOVAL: number; ADDITION: number; } interface DragEvent extends MouseEvent { dataTransfer: DataTransfer; initDragEvent(typeArg: string, canBubbleArg: bool, cancelableArg: bool, viewArg: AbstractView, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: bool, altKeyArg: bool, shiftKeyArg: bool, metaKeyArg: bool, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void; } declare var DragEvent: { prototype: DragEvent; new(): DragEvent; } interface DOML2DeprecatedWidthStyle_HTMLTableCellElement { width: number; } interface HTMLTableSectionElement extends HTMLElement, MSHTMLTableSectionElementExtensions, DOML2DeprecatedAlignmentStyle_HTMLTableSectionElement, HTMLTableAlignment { rows: HTMLCollection; deleteRow(index?: number): void; insertRow(index?: number): HTMLElement; } declare var HTMLTableSectionElement: { prototype: HTMLTableSectionElement; new(): HTMLTableSectionElement; } interface DOML2DeprecatedListNumberingAndBulletStyle { type: string; } interface HTMLInputElement extends HTMLElement, DOML2DeprecatedAlignmentStyle_HTMLInputElement, MSImageResourceExtensions_HTMLInputElement, MSHTMLInputElementExtensions, MSDataBindingExtensions { width: string; defaultChecked: bool; alt: string; accept: string; value: string; src: string; useMap: string; name: string; form: HTMLFormElement; selectionStart: number; height: string; indeterminate: bool; readOnly: bool; size: number; checked: bool; maxLength: number; selectionEnd: number; type: string; defaultValue: string; setSelectionRange(start: number, end: number): void; select(): void; } declare var HTMLInputElement: { prototype: HTMLInputElement; new(): HTMLInputElement; } interface HTMLAnchorElement extends HTMLElement, MSHTMLAnchorElementExtensions, MSDataBindingExtensions { rel: string; protocol: string; search: string; coords: string; hostname: string; pathname: string; target: string; href: string; name: string; charset: string; hreflang: string; port: string; host: string; hash: string; rev: string; type: string; shape: string; toString(): string; } declare var HTMLAnchorElement: { prototype: HTMLAnchorElement; new(): HTMLAnchorElement; } interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGURIReference { y: SVGAnimatedLength; width: SVGAnimatedLength; preserveAspectRatio: SVGAnimatedPreserveAspectRatio; x: SVGAnimatedLength; height: SVGAnimatedLength; } declare var SVGImageElement: { prototype: SVGImageElement; new(): SVGImageElement; } interface MSElementExtensions { msMatchesSelector(selectors: string): bool; fireEvent(eventName: string, eventObj?: any): bool; } interface HTMLParamElement extends HTMLElement { value: string; name: string; type: string; valueType: string; } declare var HTMLParamElement: { prototype: HTMLParamElement; new(): HTMLParamElement; } interface MSHTMLDocumentViewExtensions { createStyleSheet(href?: string, index?: number): CSSStyleSheet; } interface SVGAnimatedNumber { animVal: number; baseVal: number; } declare var SVGAnimatedNumber: { prototype: SVGAnimatedNumber; new(): SVGAnimatedNumber; } interface PerformanceTiming { redirectStart: number; domainLookupEnd: number; responseStart: number; domComplete: number; domainLookupStart: number; loadEventStart: number; msFirstPaint: number; unloadEventEnd: number; fetchStart: number; requestStart: number; domInteractive: number; navigationStart: number; connectEnd: number; loadEventEnd: number; connectStart: number; responseEnd: number; domLoading: number; redirectEnd: number; unloadEventStart: number; domContentLoadedEventStart: number; domContentLoadedEventEnd: number; toJSON(): any; } declare var PerformanceTiming: { prototype: PerformanceTiming; new(): PerformanceTiming; } interface DOML2DeprecatedAlignmentStyle_HTMLInputElement { align: string; } interface HTMLPreElement extends HTMLElement, DOML2DeprecatedWidthStyle, MSHTMLPreElementExtensions { } declare var HTMLPreElement: { prototype: HTMLPreElement; new(): HTMLPreElement; } interface EventException { code: number; message: string; toString(): string; DISPATCH_REQUEST_ERR: number; UNSPECIFIED_EVENT_TYPE_ERR: number; } declare var EventException: { prototype: EventException; new(): EventException; DISPATCH_REQUEST_ERR: number; UNSPECIFIED_EVENT_TYPE_ERR: number; } interface MSBorderColorHighlightStyle_HTMLTableCellElement { borderColorLight: any; borderColorDark: any; } interface DOMHTMLImplementation { createHTMLDocument(title: string): Document; } interface NavigatorOnLine { onLine: bool; } interface SVGElementEventHandlers { onmouseover: (ev: MouseEvent) => any; onmousemove: (ev: MouseEvent) => any; onmouseout: (ev: MouseEvent) => any; ondblclick: (ev: MouseEvent) => any; onfocusout: (ev: FocusEvent) => any; onfocusin: (ev: FocusEvent) => any; onmousedown: (ev: MouseEvent) => any; onmouseup: (ev: MouseEvent) => any; onload: (ev: Event) => any; onclick: (ev: MouseEvent) => any; } interface WindowLocalStorage { localStorage: Storage; } interface SVGMetadataElement extends SVGElement { } declare var SVGMetadataElement: { prototype: SVGMetadataElement; new(): SVGMetadataElement; } interface SVGPathSegArcRel extends SVGPathSeg { y: number; sweepFlag: bool; r2: number; x: number; angle: number; r1: number; largeArcFlag: bool; } declare var SVGPathSegArcRel: { prototype: SVGPathSegArcRel; new(): SVGPathSegArcRel; } interface SVGPathSegMovetoAbs extends SVGPathSeg { y: number; x: number; } declare var SVGPathSegMovetoAbs: { prototype: SVGPathSegMovetoAbs; new(): SVGPathSegMovetoAbs; } interface SVGStringList { numberOfItems: number; replaceItem(newItem: string, index: number): string; getItem(index: number): string; clear(): void; appendItem(newItem: string): string; initialize(newItem: string): string; removeItem(index: number): string; insertItemBefore(newItem: string, index: number): string; } declare var SVGStringList: { prototype: SVGStringList; new(): SVGStringList; } interface XDomainRequest { timeout: number; onerror: (ev: Event) => any; onload: (ev: Event) => any; onprogress: (ev: any) => any; ontimeout: (ev: Event) => any; responseText: string; contentType: string; open(method: string, url: string): void; abort(): void; send(data?: any): void; } declare var XDomainRequest: { prototype: XDomainRequest; new (): XDomainRequest; } interface DOML2DeprecatedBackgroundColorStyle { bgColor: any; } interface ElementTraversal { childElementCount: number; previousElementSibling: Element; lastElementChild: Element; nextElementSibling: Element; firstElementChild: Element; } interface SVGLength { valueAsString: string; valueInSpecifiedUnits: number; value: number; unitType: number; newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; convertToSpecifiedUnits(unitType: number): void; SVG_LENGTHTYPE_NUMBER: number; SVG_LENGTHTYPE_CM: number; SVG_LENGTHTYPE_PC: number; SVG_LENGTHTYPE_PERCENTAGE: number; SVG_LENGTHTYPE_MM: number; SVG_LENGTHTYPE_PT: number; SVG_LENGTHTYPE_IN: number; SVG_LENGTHTYPE_EMS: number; SVG_LENGTHTYPE_PX: number; SVG_LENGTHTYPE_UNKNOWN: number; SVG_LENGTHTYPE_EXS: number; } declare var SVGLength: { prototype: SVGLength; new(): SVGLength; SVG_LENGTHTYPE_NUMBER: number; SVG_LENGTHTYPE_CM: number; SVG_LENGTHTYPE_PC: number; SVG_LENGTHTYPE_PERCENTAGE: number; SVG_LENGTHTYPE_MM: number; SVG_LENGTHTYPE_PT: number; SVG_LENGTHTYPE_IN: number; SVG_LENGTHTYPE_EMS: number; SVG_LENGTHTYPE_PX: number; SVG_LENGTHTYPE_UNKNOWN: number; SVG_LENGTHTYPE_EXS: number; } interface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGAnimatedPoints, SVGTests { } declare var SVGPolygonElement: { prototype: SVGPolygonElement; new(): SVGPolygonElement; } interface HTMLPhraseElement extends HTMLElement { dateTime: string; cite: string; } declare var HTMLPhraseElement: { prototype: HTMLPhraseElement; new(): HTMLPhraseElement; } interface MSHTMLAreaElementExtensions { } interface SVGPathSegCurvetoCubicRel extends SVGPathSeg { y: number; y1: number; x2: number; x: number; x1: number; y2: number; } declare var SVGPathSegCurvetoCubicRel: { prototype: SVGPathSegCurvetoCubicRel; new(): SVGPathSegCurvetoCubicRel; } interface MSEventObj { nextPage: string; keyCode: number; toElement: Element; returnValue: any; dataFld: string; y: number; dataTransfer: DataTransfer; propertyName: string; url: string; offsetX: number; recordset: Object; screenX: number; buttonID: number; wheelDelta: number; reason: number; origin: string; data: string; srcFilter: Object; boundElements: HTMLCollection; cancelBubble: bool; altLeft: bool; behaviorCookie: number; bookmarks: BookmarkCollection; type: string; repeat: bool; srcElement: Element; source: Window; fromElement: Element; offsetY: number; x: number; behaviorPart: number; qualifier: string; altKey: bool; ctrlKey: bool; clientY: number; shiftKey: bool; shiftLeft: bool; contentOverflow: bool; screenY: number; ctrlLeft: bool; button: number; srcUrn: string; clientX: number; actionURL: string; getAttribute(strAttributeName: string, lFlags?: number): any; setAttribute(strAttributeName: string, AttributeValue: any, lFlags?: number): void; removeAttribute(strAttributeName: string, lFlags?: number): bool; } declare var MSEventObj: { prototype: MSEventObj; new(): MSEventObj; } interface SVGTextContentElement extends SVGElement, SVGStylable, SVGLangSpace, SVGTests { textLength: SVGAnimatedLength; lengthAdjust: SVGAnimatedEnumeration; getCharNumAtPosition(point: SVGPoint): number; getStartPositionOfChar(charnum: number): SVGPoint; getExtentOfChar(charnum: number): SVGRect; getComputedTextLength(): number; getSubStringLength(charnum: number, nchars: number): number; selectSubString(charnum: number, nchars: number): void; getNumberOfChars(): number; getRotationOfChar(charnum: number): number; getEndPositionOfChar(charnum: number): SVGPoint; LENGTHADJUST_SPACING: number; LENGTHADJUST_SPACINGANDGLYPHS: number; LENGTHADJUST_UNKNOWN: number; } declare var SVGTextContentElement: { prototype: SVGTextContentElement; new(): SVGTextContentElement; LENGTHADJUST_SPACING: number; LENGTHADJUST_SPACINGANDGLYPHS: number; LENGTHADJUST_UNKNOWN: number; } interface DOML2DeprecatedColorProperty { color: string; } interface MSHTMLLIElementExtensions { } interface HTMLCanvasElement extends HTMLElement { width: number; height: number; toDataURL(): string; toDataURL(type: string, ...args: any[]): string; getContext(contextId: string): CanvasRenderingContext2D; } declare var HTMLCanvasElement: { prototype: HTMLCanvasElement; new(): HTMLCanvasElement; } interface HTMLTitleElement extends HTMLElement { text: string; } declare var HTMLTitleElement: { prototype: HTMLTitleElement; new(): HTMLTitleElement; } interface Location { hash: string; protocol: string; search: string; href: string; hostname: string; port: string; pathname: string; host: string; reload(flag?: bool): void; replace(url: string): void; assign(url: string): void; toString(): string; } declare var Location: { prototype: Location; new(): Location; } interface HTMLStyleElement extends HTMLElement, MSLinkStyleExtensions, LinkStyle { media: string; type: string; } declare var HTMLStyleElement: { prototype: HTMLStyleElement; new(): HTMLStyleElement; } interface MSHTMLOptGroupElementExtensions { index: number; defaultSelected: bool; text: string; value: string; form: HTMLFormElement; selected: bool; } interface MSBorderColorHighlightStyle { borderColorLight: any; borderColorDark: any; } interface DOML2DeprecatedSizeProperty_HTMLBaseFontElement { size: number; } interface SVGTransform { type: number; angle: number; matrix: SVGMatrix; setTranslate(tx: number, ty: number): void; setScale(sx: number, sy: number): void; setMatrix(matrix: SVGMatrix): void; setSkewY(angle: number): void; setRotate(angle: number, cx: number, cy: number): void; setSkewX(angle: number): void; SVG_TRANSFORM_SKEWX: number; SVG_TRANSFORM_UNKNOWN: number; SVG_TRANSFORM_SCALE: number; SVG_TRANSFORM_TRANSLATE: number; SVG_TRANSFORM_MATRIX: number; SVG_TRANSFORM_ROTATE: number; SVG_TRANSFORM_SKEWY: number; } declare var SVGTransform: { prototype: SVGTransform; new(): SVGTransform; SVG_TRANSFORM_SKEWX: number; SVG_TRANSFORM_UNKNOWN: number; SVG_TRANSFORM_SCALE: number; SVG_TRANSFORM_TRANSLATE: number; SVG_TRANSFORM_MATRIX: number; SVG_TRANSFORM_ROTATE: number; SVG_TRANSFORM_SKEWY: number; } interface MSCSSFilter { Percent: number; Enabled: bool; Duration: number; Play(Duration: number): void; Apply(): void; Stop(): void; } declare var MSCSSFilter: { prototype: MSCSSFilter; new(): MSCSSFilter; } interface UIEvent extends Event { detail: number; view: AbstractView; initUIEvent(typeArg: string, canBubbleArg: bool, cancelableArg: bool, viewArg: AbstractView, detailArg: number): void; } declare var UIEvent: { prototype: UIEvent; new(): UIEvent; } interface ViewCSS_SVGSVGElement { getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; } interface SVGURIReference { href: SVGAnimatedString; } interface SVGPathSeg { pathSegType: number; pathSegTypeAsLetter: string; PATHSEG_MOVETO_REL: number; PATHSEG_LINETO_VERTICAL_REL: number; PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; PATHSEG_CURVETO_QUADRATIC_REL: number; PATHSEG_CURVETO_CUBIC_ABS: number; PATHSEG_LINETO_HORIZONTAL_ABS: number; PATHSEG_CURVETO_QUADRATIC_ABS: number; PATHSEG_LINETO_ABS: number; PATHSEG_CLOSEPATH: number; PATHSEG_LINETO_HORIZONTAL_REL: number; PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; PATHSEG_LINETO_REL: number; PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; PATHSEG_ARC_REL: number; PATHSEG_CURVETO_CUBIC_REL: number; PATHSEG_UNKNOWN: number; PATHSEG_LINETO_VERTICAL_ABS: number; PATHSEG_ARC_ABS: number; PATHSEG_MOVETO_ABS: number; PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; } declare var SVGPathSeg: { PATHSEG_MOVETO_REL: number; PATHSEG_LINETO_VERTICAL_REL: number; PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; PATHSEG_CURVETO_QUADRATIC_REL: number; PATHSEG_CURVETO_CUBIC_ABS: number; PATHSEG_LINETO_HORIZONTAL_ABS: number; PATHSEG_CURVETO_QUADRATIC_ABS: number; PATHSEG_LINETO_ABS: number; PATHSEG_CLOSEPATH: number; PATHSEG_LINETO_HORIZONTAL_REL: number; PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; PATHSEG_LINETO_REL: number; PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; PATHSEG_ARC_REL: number; PATHSEG_CURVETO_CUBIC_REL: number; PATHSEG_UNKNOWN: number; PATHSEG_LINETO_VERTICAL_ABS: number; PATHSEG_ARC_ABS: number; PATHSEG_MOVETO_ABS: number; PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; } interface WheelEvent extends MouseEvent { deltaZ: number; deltaX: number; deltaMode: number; deltaY: number; initWheelEvent(typeArg: string, canBubbleArg: bool, cancelableArg: bool, viewArg: AbstractView, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void; DOM_DELTA_PIXEL: number; DOM_DELTA_LINE: number; DOM_DELTA_PAGE: number; } declare var WheelEvent: { prototype: WheelEvent; new(): WheelEvent; DOM_DELTA_PIXEL: number; DOM_DELTA_LINE: number; DOM_DELTA_PAGE: number; } interface DOML2DeprecatedAlignmentStyle_HTMLDivElement { align: string; } interface MSEventAttachmentTarget { attachEvent(event: string, listener: EventListener): bool; detachEvent(event: string, listener: EventListener): void; } interface SVGNumber { value: number; } declare var SVGNumber: { prototype: SVGNumber; new(): SVGNumber; } interface SVGPathElement extends SVGElement, SVGStylable, SVGAnimatedPathData, SVGTransformable, SVGLangSpace, SVGTests { getPathSegAtLength(distance: number): number; getPointAtLength(distance: number): SVGPoint; createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs; createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel; createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel; createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs; createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs; createSVGPathSegClosePath(): SVGPathSegClosePath; createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel; createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel; createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel; createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs; createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs; createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel; createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: bool, sweepFlag: bool): SVGPathSegArcRel; createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs; createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel; getTotalLength(): number; createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel; createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs; createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs; createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: bool, sweepFlag: bool): SVGPathSegArcAbs; } declare var SVGPathElement: { prototype: SVGPathElement; new(): SVGPathElement; } interface MSCompatibleInfo { version: string; userAgent: string; } declare var MSCompatibleInfo: { prototype: MSCompatibleInfo; new(): MSCompatibleInfo; } interface MSHTMLDocumentEventExtensions { createEventObject(eventObj?: any): MSEventObj; fireEvent(eventName: string, eventObj?: any): bool; } interface Text extends CharacterData, MSNodeExtensions { wholeText: string; splitText(offset: number): Text; replaceWholeText(content: string): Text; } declare var Text: { prototype: Text; new(): Text; } interface SVGAnimatedRect { animVal: SVGRect; baseVal: SVGRect; } declare var SVGAnimatedRect: { prototype: SVGAnimatedRect; new(): SVGAnimatedRect; } interface CSSNamespaceRule extends CSSRule { namespaceURI: string; prefix: string; } declare var CSSNamespaceRule: { prototype: CSSNamespaceRule; new(): CSSNamespaceRule; } interface HTMLUnknownElement extends HTMLElement, MSDataBindingRecordSetReadonlyExtensions, MSHTMLUnknownElementExtensions { } declare var HTMLUnknownElement: { prototype: HTMLUnknownElement; new(): HTMLUnknownElement; } interface SVGPathSegList { numberOfItems: number; replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg; getItem(index: number): SVGPathSeg; clear(): void; appendItem(newItem: SVGPathSeg): SVGPathSeg; initialize(newItem: SVGPathSeg): SVGPathSeg; removeItem(index: number): SVGPathSeg; insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg; } declare var SVGPathSegList: { prototype: SVGPathSegList; new(): SVGPathSegList; } interface HTMLAudioElement extends HTMLMediaElement { } declare var HTMLAudioElement: { prototype: HTMLAudioElement; new(): HTMLAudioElement; } interface MSImageResourceExtensions { dynsrc: string; vrml: string; lowsrc: string; start: string; loop: number; } interface MSBorderColorHighlightStyle_HTMLTableRowElement { borderColorLight: any; borderColorDark: any; } interface PositionError { code: number; message: string; toString(): string; POSITION_UNAVAILABLE: number; PERMISSION_DENIED: number; TIMEOUT: number; } declare var PositionError: { POSITION_UNAVAILABLE: number; PERMISSION_DENIED: number; TIMEOUT: number; } interface BrowserPublic { } declare var BrowserPublic: { prototype: BrowserPublic; new(): BrowserPublic; } interface HTMLTableCellElement extends HTMLElement, DOML2DeprecatedTableCellHeight, HTMLTableAlignment, MSBorderColorHighlightStyle_HTMLTableCellElement, DOML2DeprecatedWidthStyle_HTMLTableCellElement, DOML2DeprecatedBackgroundStyle, MSBorderColorStyle_HTMLTableCellElement, MSHTMLTableCellElementExtensions, DOML2DeprecatedAlignmentStyle_HTMLTableCellElement, HTMLTableHeaderCellScope, DOML2DeprecatedWordWrapSuppression, DOML2DeprecatedBackgroundColorStyle { headers: string; abbr: string; rowSpan: number; cellIndex: number; colSpan: number; axis: string; } declare var HTMLTableCellElement: { prototype: HTMLTableCellElement; new(): HTMLTableCellElement; } interface MSNamespaceInfoCollection { length: number; add(namespace?: string, urn?: string, implementationUrl?: any): Object; item(index: any): Object; [index: string]: Object; (index: any): Object; } declare var MSNamespaceInfoCollection: { prototype: MSNamespaceInfoCollection; new(): MSNamespaceInfoCollection; } interface SVGElementInstance extends EventTarget { previousSibling: SVGElementInstance; parentNode: SVGElementInstance; lastChild: SVGElementInstance; nextSibling: SVGElementInstance; childNodes: SVGElementInstanceList; correspondingUseElement: SVGUseElement; correspondingElement: SVGElement; firstChild: SVGElementInstance; } declare var SVGElementInstance: { prototype: SVGElementInstance; new(): SVGElementInstance; } interface MSHTMLUListElementExtensions { } interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests { cx: SVGAnimatedLength; r: SVGAnimatedLength; cy: SVGAnimatedLength; } declare var SVGCircleElement: { prototype: SVGCircleElement; new(): SVGCircleElement; } interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedSizeProperty_HTMLBaseFontElement, DOML2DeprecatedColorProperty { face: string; } declare var HTMLBaseFontElement: { prototype: HTMLBaseFontElement; new(): HTMLBaseFontElement; } interface CustomEvent extends Event { detail: Object; initCustomEvent(typeArg: string, canBubbleArg: bool, cancelableArg: bool, detailArg: Object): void; } declare var CustomEvent: { prototype: CustomEvent; new(): CustomEvent; } interface CSSImportRule extends CSSRule { styleSheet: CSSStyleSheet; href: string; media: MediaList; } declare var CSSImportRule: { prototype: CSSImportRule; new(): CSSImportRule; } interface StyleSheetList { length: number; item(index?: number): StyleSheet; [index: number]: StyleSheet; } declare var StyleSheetList: { prototype: StyleSheetList; new(): StyleSheetList; } interface HTMLTextAreaElement extends HTMLElement, MSDataBindingExtensions, MSHTMLTextAreaElementExtensions { value: string; form: HTMLFormElement; name: string; selectionStart: number; rows: number; cols: number; readOnly: bool; wrap: string; selectionEnd: number; type: string; defaultValue: string; setSelectionRange(start: number, end: number): void; select(): void; } declare var HTMLTextAreaElement: { prototype: HTMLTextAreaElement; new(): HTMLTextAreaElement; } interface MSHTMLFormElementExtensions { encoding: string; } interface DOML2DeprecatedMarginStyle { vspace: number; hspace: number; } interface Geolocation { clearWatch(watchId: number): void; getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void; watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number; } declare var Geolocation: { prototype: Geolocation; new(): Geolocation; } interface MSWindowModeless { dialogTop: any; dialogLeft: any; dialogWidth: any; dialogHeight: any; menuArguments: any; } interface HTMLMarqueeElement extends HTMLElement, DOML2DeprecatedMarginStyle_HTMLMarqueeElement, MSDataBindingExtensions, MSHTMLMarqueeElementExtensions, DOML2DeprecatedBackgroundColorStyle { width: string; onbounce: (ev: Event) => any; trueSpeed: bool; scrollAmount: number; scrollDelay: number; behavior: string; height: string; loop: number; direction: string; onstart: (ev: Event) => any; onfinish: (ev: Event) => any; stop(): void; start(): void; } declare var HTMLMarqueeElement: { prototype: HTMLMarqueeElement; new(): HTMLMarqueeElement; } interface SVGRect { y: number; width: number; x: number; height: number; } declare var SVGRect: { prototype: SVGRect; new(): SVGRect; } interface MSNodeExtensions { swapNode(otherNode: Node): Node; removeNode(deep?: bool): Node; replaceNode(replacement: Node): Node; } interface KeyboardEventExtensions { keyCode: number; which: number; charCode: number; } interface History { length: number; back(distance?: any): void; forward(distance?: any): void; go(delta?: any): void; } declare var History: { prototype: History; new(): History; } interface DocumentStyle { styleSheets: StyleSheetList; } interface SVGPathSegCurvetoCubicAbs extends SVGPathSeg { y: number; y1: number; x2: number; x: number; x1: number; y2: number; } declare var SVGPathSegCurvetoCubicAbs: { prototype: SVGPathSegCurvetoCubicAbs; new(): SVGPathSegCurvetoCubicAbs; } interface TimeRanges { length: number; start(index: number): number; end(index: number): number; } declare var TimeRanges: { prototype: TimeRanges; new(): TimeRanges; } interface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg { y: number; y1: number; x: number; x1: number; } declare var SVGPathSegCurvetoQuadraticAbs: { prototype: SVGPathSegCurvetoQuadraticAbs; new(): SVGPathSegCurvetoQuadraticAbs; } interface MSHTMLSelectElementExtensions { } interface CSSRule { cssText: string; parentStyleSheet: CSSStyleSheet; parentRule: CSSRule; type: number; IMPORT_RULE: number; MEDIA_RULE: number; STYLE_RULE: number; NAMESPACE_RULE: number; PAGE_RULE: number; UNKNOWN_RULE: number; FONT_FACE_RULE: number; CHARSET_RULE: number; } declare var CSSRule: { prototype: CSSRule; new(): CSSRule; IMPORT_RULE: number; MEDIA_RULE: number; STYLE_RULE: number; NAMESPACE_RULE: number; PAGE_RULE: number; UNKNOWN_RULE: number; FONT_FACE_RULE: number; CHARSET_RULE: number; } interface SVGPathSegLinetoAbs extends SVGPathSeg { y: number; x: number; } declare var SVGPathSegLinetoAbs: { prototype: SVGPathSegLinetoAbs; new(): SVGPathSegLinetoAbs; } interface MSMouseEventExtensions { toElement: Element; layerY: number; fromElement: Element; which: number; layerX: number; } interface HTMLModElement extends HTMLElement, MSHTMLModElementExtensions { dateTime: string; cite: string; } declare var HTMLModElement: { prototype: HTMLModElement; new(): HTMLModElement; } interface DOML2DeprecatedWordWrapSuppression { noWrap: bool; } interface BeforeUnloadEvent extends Event { returnValue: string; } declare var BeforeUnloadEvent: { prototype: BeforeUnloadEvent; new(): BeforeUnloadEvent; } interface MSPopupWindow { document: HTMLDocument; isOpen: bool; show(x: number, y: number, w: number, h: number, element?: any): void; hide(): void; } declare var MSPopupWindow: { prototype: MSPopupWindow; new(): MSPopupWindow; } interface SVGMatrix { e: number; c: number; a: number; b: number; d: number; f: number; multiply(secondMatrix: SVGMatrix): SVGMatrix; flipY(): SVGMatrix; skewY(angle: number): SVGMatrix; inverse(): SVGMatrix; scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix; rotate(angle: number): SVGMatrix; flipX(): SVGMatrix; translate(x: number, y: number): SVGMatrix; scale(scaleFactor: number): SVGMatrix; rotateFromVector(x: number, y: number): SVGMatrix; skewX(angle: number): SVGMatrix; } declare var SVGMatrix: { prototype: SVGMatrix; new(): SVGMatrix; } interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests, SVGURIReference { y: SVGAnimatedLength; width: SVGAnimatedLength; animatedInstanceRoot: SVGElementInstance; instanceRoot: SVGElementInstance; x: SVGAnimatedLength; height: SVGAnimatedLength; } declare var SVGUseElement: { prototype: SVGUseElement; new(): SVGUseElement; } interface Event extends MSEventExtensions { timeStamp: number; defaultPrevented: bool; isTrusted: bool; currentTarget: EventTarget; target: EventTarget; eventPhase: number; type: string; cancelable: bool; bubbles: bool; initEvent(eventTypeArg: string, canBubbleArg: bool, cancelableArg: bool): void; stopPropagation(): void; stopImmediatePropagation(): void; preventDefault(): void; CAPTURING_PHASE: number; AT_TARGET: number; BUBBLING_PHASE: number; } declare var Event: { prototype: Event; new(): Event; CAPTURING_PHASE: number; AT_TARGET: number; BUBBLING_PHASE: number; } interface ImageData { width: number; data: number[]; height: number; } declare var ImageData: { prototype: ImageData; new(): ImageData; } interface MSHTMLElementExtensions { onlosecapture: (ev: MSEventObj) => any; onrowexit: (ev: MSEventObj) => any; oncontrolselect: (ev: MSEventObj) => any; onrowsinserted: (ev: MSEventObj) => any; onmouseleave: (ev: MouseEvent) => any; document: HTMLDocument; behaviorUrns: MSBehaviorUrnsCollection; onpropertychange: (ev: MSEventObj) => any; children: HTMLCollection; filters: Object; onbeforecut: (ev: DragEvent) => any; scopeName: string; onbeforepaste: (ev: DragEvent) => any; onmove: (ev: MSEventObj) => any; onafterupdate: (ev: MSEventObj) => any; onbeforecopy: (ev: DragEvent) => any; onlayoutcomplete: (ev: MSEventObj) => any; onresizeend: (ev: MSEventObj) => any; uniqueID: string; onhelp: (ev: Event) => any; onbeforeactivate: (ev: UIEvent) => any; isMultiLine: bool; uniqueNumber: number; tagUrn: string; onfocusout: (ev: FocusEvent) => any; ondataavailable: (ev: MSEventObj) => any; hideFocus: bool; onbeforeupdate: (ev: MSEventObj) => any; onfilterchange: (ev: MSEventObj) => any; onfocusin: (ev: FocusEvent) => any; recordNumber: any; parentTextEdit: Element; ondatasetcomplete: (ev: MSEventObj) => any; onbeforedeactivate: (ev: UIEvent) => any; outerText: string; onresizestart: (ev: MSEventObj) => any; onactivate: (ev: UIEvent) => any; isTextEdit: bool; isDisabled: bool; readyState: string; all: HTMLCollection; onmouseenter: (ev: MouseEvent) => any; onmovestart: (ev: MSEventObj) => any; onselectstart: (ev: Event) => any; onpaste: (ev: DragEvent) => any; canHaveHTML: bool; innerText: string; onerrorupdate: (ev: MSEventObj) => any; ondeactivate: (ev: UIEvent) => any; oncut: (ev: DragEvent) => any; onmoveend: (ev: MSEventObj) => any; onresize: (ev: UIEvent) => any; language: string; ondatasetchanged: (ev: MSEventObj) => any; oncopy: (ev: DragEvent) => any; onrowsdelete: (ev: MSEventObj) => any; parentElement: HTMLElement; onrowenter: (ev: MSEventObj) => any; onbeforeeditfocus: (ev: MSEventObj) => any; canHaveChildren: bool; sourceIndex: number; oncellchange: (ev: MSEventObj) => any; dragDrop(): bool; releaseCapture(): void; addFilter(filter: Object): void; setCapture(containerCapture?: bool): void; removeBehavior(cookie: number): bool; contains(child: HTMLElement): bool; applyElement(apply: Element, where?: string): Element; replaceAdjacentText(where: string, newText: string): string; mergeAttributes(source: HTMLElement, preserveIdentity?: bool): void; insertAdjacentElement(position: string, insertedElement: Element): Element; insertAdjacentText(where: string, text: string): void; getAdjacentText(where: string): string; removeFilter(filter: Object): void; setActive(): void; addBehavior(bstrUrl: string, factory?: any): number; clearAttributes(): void; } interface HTMLTableColElement extends HTMLElement, MSHTMLTableColElementExtensions, HTMLTableAlignment, DOML2DeprecatedAlignmentStyle_HTMLTableColElement { width: any; span: number; } declare var HTMLTableColElement: { prototype: HTMLTableColElement; new(): HTMLTableColElement; } interface HTMLDocument extends MSEventAttachmentTarget, MSHTMLDocumentSelection, MSHTMLDocumentExtensions, MSNodeExtensions, MSResourceMetadata, MSHTMLDocumentEventExtensions, MSHTMLDocumentViewExtensions { ondragend: (ev: DragEvent) => any; ondragover: (ev: DragEvent) => any; onkeydown: (ev: KeyboardEvent) => any; bgColor: string; onkeyup: (ev: KeyboardEvent) => any; onreset: (ev: Event) => any; onmouseup: (ev: MouseEvent) => any; ondragstart: (ev: DragEvent) => any; scripts: HTMLCollection; ondrag: (ev: DragEvent) => any; linkColor: string; ondragleave: (ev: DragEvent) => any; onmouseover: (ev: MouseEvent) => any; onpause: (ev: Event) => any; charset: string; vlinkColor: string; onmousedown: (ev: MouseEvent) => any; onseeked: (ev: Event) => any; title: string; onclick: (ev: MouseEvent) => any; onwaiting: (ev: Event) => any; defaultCharset: string; embeds: HTMLCollection; ondurationchange: (ev: Event) => any; all: HTMLCollection; applets: HTMLCollection; forms: HTMLCollection; onblur: (ev: FocusEvent) => any; dir: string; body: HTMLElement; designMode: string; onemptied: (ev: Event) => any; domain: string; onseeking: (ev: Event) => any; oncanplay: (ev: Event) => any; onstalled: (ev: Event) => any; onmousemove: (ev: MouseEvent) => any; onratechange: (ev: Event) => any; onloadstart: (ev: Event) => any; ondragenter: (ev: DragEvent) => any; onsubmit: (ev: Event) => any; onprogress: (ev: any) => any; ondblclick: (ev: MouseEvent) => any; oncontextmenu: (ev: MouseEvent) => any; activeElement: Element; onchange: (ev: Event) => any; onloadedmetadata: (ev: Event) => any; onerror: (ev: Event) => any; onplay: (ev: Event) => any; links: HTMLCollection; onplaying: (ev: Event) => any; URL: string; images: HTMLCollection; head: HTMLHeadElement; location: Location; cookie: string; oncanplaythrough: (ev: Event) => any; onabort: (ev: UIEvent) => any; characterSet: string; anchors: HTMLCollection; lastModified: string; onreadystatechange: (ev: Event) => any; onkeypress: (ev: KeyboardEvent) => any; onloadeddata: (ev: Event) => any; plugins: HTMLCollection; onsuspend: (ev: Event) => any; referrer: string; readyState: string; alinkColor: string; onfocus: (ev: FocusEvent) => any; fgColor: string; ontimeupdate: (ev: Event) => any; onselect: (ev: UIEvent) => any; ondrop: (ev: DragEvent) => any; onmouseout: (ev: MouseEvent) => any; onended: (ev: Event) => any; compatMode: string; onscroll: (ev: UIEvent) => any; onmousewheel: (ev: MouseWheelEvent) => any; onload: (ev: Event) => any; onvolumechange: (ev: Event) => any; oninput: (ev: Event) => any; queryCommandValue(commandId: string): string; queryCommandIndeterm(commandId: string): bool; execCommand(commandId: string, showUI?: bool, value?: any): bool; getElementsByName(elementName: string): NodeList; writeln(...content: string[]): void; open(url?: string, name?: string, features?: string, replace?: bool): any; queryCommandState(commandId: string): bool; close(): void; hasFocus(): bool; getElementsByClassName(classNames: string): NodeList; queryCommandSupported(commandId: string): bool; getSelection(): Selection; queryCommandEnabled(commandId: string): bool; write(...content: string[]): void; queryCommandText(commandId: string): string; } interface SVGException { code: number; message: string; toString(): string; SVG_MATRIX_NOT_INVERTABLE: number; SVG_WRONG_TYPE_ERR: number; SVG_INVALID_VALUE_ERR: number; } declare var SVGException: { prototype: SVGException; new(): SVGException; SVG_MATRIX_NOT_INVERTABLE: number; SVG_WRONG_TYPE_ERR: number; SVG_INVALID_VALUE_ERR: number; } interface DOML2DeprecatedTableCellHeight { height: any; } interface HTMLTableAlignment { ch: string; vAlign: string; chOff: string; } interface SVGAnimatedEnumeration { animVal: number; baseVal: number; } declare var SVGAnimatedEnumeration: { prototype: SVGAnimatedEnumeration; new(): SVGAnimatedEnumeration; } interface SVGLinearGradientElement extends SVGGradientElement { y1: SVGAnimatedLength; x2: SVGAnimatedLength; x1: SVGAnimatedLength; y2: SVGAnimatedLength; } declare var SVGLinearGradientElement: { prototype: SVGLinearGradientElement; new(): SVGLinearGradientElement; } interface DOML2DeprecatedSizeProperty { size: number; } interface MSHTMLHeadingElementExtensions extends DOML2DeprecatedTextFlowControl_HTMLBlockElement { } interface MSBorderColorStyle_HTMLTableCellElement { borderColor: any; } interface DOML2DeprecatedWidthStyle_HTMLHRElement { width: number; } interface HTMLUListElement extends HTMLElement, DOML2DeprecatedListSpaceReduction, DOML2DeprecatedListNumberingAndBulletStyle, MSHTMLUListElementExtensions { } declare var HTMLUListElement: { prototype: HTMLUListElement; new(): HTMLUListElement; } interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests { y: SVGAnimatedLength; width: SVGAnimatedLength; ry: SVGAnimatedLength; rx: SVGAnimatedLength; x: SVGAnimatedLength; height: SVGAnimatedLength; } declare var SVGRectElement: { prototype: SVGRectElement; new(): SVGRectElement; } interface DOML2DeprecatedBorderStyle { border: string; } interface HTMLDivElement extends HTMLElement, DOML2DeprecatedAlignmentStyle_HTMLDivElement, MSHTMLDivElementExtensions, MSDataBindingExtensions { } declare var HTMLDivElement: { prototype: HTMLDivElement; new(): HTMLDivElement; } interface NavigatorDoNotTrack { msDoNotTrack: string; } interface SVG1_1Properties { fillRule: string; strokeLinecap: string; stopColor: string; glyphOrientationHorizontal: string; kerning: string; alignmentBaseline: string; dominantBaseline: string; fill: string; strokeMiterlimit: string; marker: string; glyphOrientationVertical: string; markerMid: string; textAnchor: string; fillOpacity: string; strokeDasharray: string; mask: string; stopOpacity: string; stroke: string; strokeDashoffset: string; strokeOpacity: string; markerStart: string; pointerEvents: string; baselineShift: string; markerEnd: string; clipRule: string; strokeLinejoin: string; clipPath: string; strokeWidth: string; } interface NamedNodeMap { length: number; removeNamedItemNS(namespaceURI: string, localName: string): Node; item(index: number): Node; [index: number]: Node; removeNamedItem(name: string): Node; getNamedItem(name: string): Node; [name: string]: Node; setNamedItem(arg: Node): Node; getNamedItemNS(namespaceURI: string, localName: string): Node; setNamedItemNS(arg: Node): Node; } declare var NamedNodeMap: { prototype: NamedNodeMap; new(): NamedNodeMap; } interface MediaList { length: number; mediaText: string; deleteMedium(oldMedium: string): void; appendMedium(newMedium: string): void; item(index: number): string; [index: number]: string; toString(): string; } declare var MediaList: { prototype: MediaList; new(): MediaList; } interface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg { y: number; x: number; } declare var SVGPathSegCurvetoQuadraticSmoothAbs: { prototype: SVGPathSegCurvetoQuadraticSmoothAbs; new(): SVGPathSegCurvetoQuadraticSmoothAbs; } interface SVGLengthList { numberOfItems: number; replaceItem(newItem: SVGLength, index: number): SVGLength; getItem(index: number): SVGLength; clear(): void; appendItem(newItem: SVGLength): SVGLength; initialize(newItem: SVGLength): SVGLength; removeItem(index: number): SVGLength; insertItemBefore(newItem: SVGLength, index: number): SVGLength; } declare var SVGLengthList: { prototype: SVGLengthList; new(): SVGLengthList; } interface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg { y: number; x2: number; x: number; y2: number; } declare var SVGPathSegCurvetoCubicSmoothRel: { prototype: SVGPathSegCurvetoCubicSmoothRel; new(): SVGPathSegCurvetoCubicSmoothRel; } interface MSWindowExtensions { status: string; onmouseleave: (ev: MouseEvent) => any; screenLeft: number; offscreenBuffering: any; maxConnectionsPerServer: number; onmouseenter: (ev: MouseEvent) => any; clipboardData: DataTransfer; defaultStatus: string; clientInformation: Navigator; closed: bool; onhelp: (ev: Event) => any; external: BrowserPublic; event: MSEventObj; onfocusout: (ev: FocusEvent) => any; screenTop: number; onfocusin: (ev: FocusEvent) => any; showModelessDialog(url?: string, argument?: any, options?: any): Window; navigate(url: string): void; resizeBy(x?: number, y?: number): void; item(index: any): any; resizeTo(x?: number, y?: number): void; createPopup(arguments?: any): MSPopupWindow; toStaticHTML(html: string): string; execScript(code: string, language?: string): any; msWriteProfilerMark(profilerMarkName: string): void; moveTo(x?: number, y?: number): void; moveBy(x?: number, y?: number): void; showHelp(url: string, helpArg?: any, features?: string): void; } interface ProcessingInstruction extends Node { target: string; data: string; } declare var ProcessingInstruction: { prototype: ProcessingInstruction; new(): ProcessingInstruction; } interface MSBehaviorUrnsCollection { length: number; item(index: number): string; } declare var MSBehaviorUrnsCollection: { prototype: MSBehaviorUrnsCollection; new(): MSBehaviorUrnsCollection; } interface CSSFontFaceRule extends CSSRule { style: CSSStyleDeclaration; } declare var CSSFontFaceRule: { prototype: CSSFontFaceRule; new(): CSSFontFaceRule; } interface DOML2DeprecatedBackgroundStyle { background: string; } interface TextEvent extends UIEvent { inputMethod: number; data: string; locale: string; initTextEvent(typeArg: string, canBubbleArg: bool, cancelableArg: bool, viewArg: AbstractView, dataArg: string, inputMethod: number, locale: string): void; DOM_INPUT_METHOD_KEYBOARD: number; DOM_INPUT_METHOD_DROP: number; DOM_INPUT_METHOD_IME: number; DOM_INPUT_METHOD_SCRIPT: number; DOM_INPUT_METHOD_VOICE: number; DOM_INPUT_METHOD_UNKNOWN: number; DOM_INPUT_METHOD_PASTE: number; DOM_INPUT_METHOD_HANDWRITING: number; DOM_INPUT_METHOD_OPTION: number; DOM_INPUT_METHOD_MULTIMODAL: number; } declare var TextEvent: { prototype: TextEvent; new(): TextEvent; DOM_INPUT_METHOD_KEYBOARD: number; DOM_INPUT_METHOD_DROP: number; DOM_INPUT_METHOD_IME: number; DOM_INPUT_METHOD_SCRIPT: number; DOM_INPUT_METHOD_VOICE: number; DOM_INPUT_METHOD_UNKNOWN: number; DOM_INPUT_METHOD_PASTE: number; DOM_INPUT_METHOD_HANDWRITING: number; DOM_INPUT_METHOD_OPTION: number; DOM_INPUT_METHOD_MULTIMODAL: number; } interface MSHTMLHRElementExtensions extends DOML2DeprecatedColorProperty { } interface AbstractView { styleMedia: StyleMedia; document: Document; } interface DocumentFragment extends Node, NodeSelector, MSEventAttachmentTarget, MSNodeExtensions { } declare var DocumentFragment: { prototype: DocumentFragment; new(): DocumentFragment; } interface DOML2DeprecatedAlignmentStyle_HTMLFieldSetElement { align: string; } interface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGAnimatedPoints, SVGTests { } declare var SVGPolylineElement: { prototype: SVGPolylineElement; new(): SVGPolylineElement; } interface DOML2DeprecatedWidthStyle { width: number; } interface DOML2DeprecatedAlignmentStyle_HTMLHeadingElement { align: string; } interface SVGAnimatedPathData { pathSegList: SVGPathSegList; } interface Position { timestamp: Date; coords: Coordinates; } declare var Position: { prototype: Position; new(): Position; } interface BookmarkCollection { length: number; item(index: number): any; [index: number]: any; } declare var BookmarkCollection: { prototype: BookmarkCollection; new(): BookmarkCollection; } interface CSSPageRule extends CSSRule, StyleSheetPage { selectorText: string; style: CSSStyleDeclaration; } declare var CSSPageRule: { prototype: CSSPageRule; new(): CSSPageRule; } interface WindowPerformance { performance: any; } interface HTMLBRElement extends HTMLElement, DOML2DeprecatedTextFlowControl_HTMLBRElement { } declare var HTMLBRElement: { prototype: HTMLBRElement; new(): HTMLBRElement; } interface MSHTMLDivElementExtensions extends DOML2DeprecatedWordWrapSuppression_HTMLDivElement { } interface DOML2DeprecatedBorderStyle_HTMLInputElement { border: string; } interface HTMLSpanElement extends HTMLElement, MSHTMLSpanElementExtensions, MSDataBindingExtensions { } declare var HTMLSpanElement: { prototype: HTMLSpanElement; new(): HTMLSpanElement; } interface HTMLHRElementDOML2Deprecated { noShade: bool; } interface HTMLHeadElement extends HTMLElement { profile: string; } declare var HTMLHeadElement: { prototype: HTMLHeadElement; new(): HTMLHeadElement; } interface NodeFilterCallback { (...args: any[]): any; } interface HTMLHeadingElement extends HTMLElement, DOML2DeprecatedAlignmentStyle_HTMLHeadingElement, MSHTMLHeadingElementExtensions { } declare var HTMLHeadingElement: { prototype: HTMLHeadingElement; new(): HTMLHeadingElement; } interface HTMLFormElement extends HTMLElement, MSHTMLFormElementExtensions, MSHTMLCollectionExtensions { length: number; target: string; acceptCharset: string; enctype: string; elements: HTMLCollection; action: string; name: string; method: string; reset(): void; item(name?: any, index?: any): any; (name: any, index: any): any; submit(): void; namedItem(name: string): any; [name: string]: any; (name: string): any; } declare var HTMLFormElement: { prototype: HTMLFormElement; new(): HTMLFormElement; } interface SVGZoomAndPan { zoomAndPan: number; SVG_ZOOMANDPAN_MAGNIFY: number; SVG_ZOOMANDPAN_UNKNOWN: number; SVG_ZOOMANDPAN_DISABLE: number; } declare var SVGZoomAndPan: { prototype: SVGZoomAndPan; new(): SVGZoomAndPan; SVG_ZOOMANDPAN_MAGNIFY: number; SVG_ZOOMANDPAN_UNKNOWN: number; SVG_ZOOMANDPAN_DISABLE: number; } interface MSEventExtensions { cancelBubble: bool; srcElement: Element; } interface HTMLMediaElement extends HTMLElement { initialTime: number; played: TimeRanges; currentSrc: string; readyState: string; autobuffer: bool; loop: bool; ended: bool; buffered: TimeRanges; error: MediaError; seekable: TimeRanges; autoplay: bool; controls: bool; volume: number; src: string; playbackRate: number; duration: number; muted: bool; defaultPlaybackRate: number; paused: bool; seeking: bool; currentTime: number; preload: string; networkState: number; pause(): void; play(): void; load(): void; canPlayType(type: string): string; HAVE_METADATA: number; HAVE_CURRENT_DATA: number; HAVE_NOTHING: number; NETWORK_NO_SOURCE: number; HAVE_ENOUGH_DATA: number; NETWORK_EMPTY: number; NETWORK_LOADING: number; NETWORK_IDLE: number; HAVE_FUTURE_DATA: number; } declare var HTMLMediaElement: { prototype: HTMLMediaElement; new(): HTMLMediaElement; HAVE_METADATA: number; HAVE_CURRENT_DATA: number; HAVE_NOTHING: number; NETWORK_NO_SOURCE: number; HAVE_ENOUGH_DATA: number; NETWORK_EMPTY: number; NETWORK_LOADING: number; NETWORK_IDLE: number; HAVE_FUTURE_DATA: number; } interface ElementCSSInlineStyle extends MSElementCSSInlineStyleExtensions { runtimeStyle: MSStyleCSSProperties; currentStyle: MSCurrentStyleCSSProperties; } interface DOMParser { parseFromString(source: string, mimeType: string): Document; } declare var DOMParser: { prototype: DOMParser; new (): DOMParser; } interface MSMimeTypesCollection { length: number; } declare var MSMimeTypesCollection: { prototype: MSMimeTypesCollection; new(): MSMimeTypesCollection; } interface StyleSheet { disabled: bool; ownerNode: Node; parentStyleSheet: StyleSheet; href: string; media: MediaList; type: string; title: string; } declare var StyleSheet: { prototype: StyleSheet; new(): StyleSheet; } interface DOML2DeprecatedBorderStyle_HTMLTableElement { border: string; } interface DOML2DeprecatedWidthStyle_HTMLAppletElement { width: number; } interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { startOffset: SVGAnimatedLength; method: SVGAnimatedEnumeration; spacing: SVGAnimatedEnumeration; TEXTPATH_SPACINGTYPE_EXACT: number; TEXTPATH_METHODTYPE_STRETCH: number; TEXTPATH_SPACINGTYPE_AUTO: number; TEXTPATH_SPACINGTYPE_UNKNOWN: number; TEXTPATH_METHODTYPE_UNKNOWN: number; TEXTPATH_METHODTYPE_ALIGN: number; } declare var SVGTextPathElement: { prototype: SVGTextPathElement; new(): SVGTextPathElement; TEXTPATH_SPACINGTYPE_EXACT: number; TEXTPATH_METHODTYPE_STRETCH: number; TEXTPATH_SPACINGTYPE_AUTO: number; TEXTPATH_SPACINGTYPE_UNKNOWN: number; TEXTPATH_METHODTYPE_UNKNOWN: number; TEXTPATH_METHODTYPE_ALIGN: number; } interface NodeList { length: number; item(index: number): Node; [index: number]: Node; } declare var NodeList: { prototype: NodeList; new(): NodeList; } interface HTMLDTElement extends HTMLElement, DOML2DeprecatedWordWrapSuppression_HTMLDTElement { } declare var HTMLDTElement: { prototype: HTMLDTElement; new(): HTMLDTElement; } interface XMLSerializer { serializeToString(target: Node): string; } declare var XMLSerializer: { prototype: XMLSerializer; new (): XMLSerializer; } interface StyleSheetPage { pseudoClass: string; selector: string; } interface DOML2DeprecatedWordWrapSuppression_HTMLDDElement { noWrap: bool; } interface MSHTMLTableRowElementExtensions { height: any; } interface SVGGradientElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGURIReference { spreadMethod: SVGAnimatedEnumeration; gradientTransform: SVGAnimatedTransformList; gradientUnits: SVGAnimatedEnumeration; SVG_SPREADMETHOD_REFLECT: number; SVG_SPREADMETHOD_PAD: number; SVG_SPREADMETHOD_UNKNOWN: number; SVG_SPREADMETHOD_REPEAT: number; } declare var SVGGradientElement: { prototype: SVGGradientElement; new(): SVGGradientElement; SVG_SPREADMETHOD_REFLECT: number; SVG_SPREADMETHOD_PAD: number; SVG_SPREADMETHOD_UNKNOWN: number; SVG_SPREADMETHOD_REPEAT: number; } interface DOML2DeprecatedTextFlowControl_HTMLBRElement { clear: string; } interface MSHTMLParagraphElementExtensions extends DOML2DeprecatedTextFlowControl_HTMLBlockElement { } interface NodeFilter { acceptNode(n: Node): number; SHOW_ENTITY_REFERENCE: number; SHOW_NOTATION: number; SHOW_ENTITY: number; SHOW_DOCUMENT: number; SHOW_PROCESSING_INSTRUCTION: number; FILTER_REJECT: number; SHOW_CDATA_SECTION: number; FILTER_ACCEPT: number; SHOW_ALL: number; SHOW_DOCUMENT_TYPE: number; SHOW_TEXT: number; SHOW_ELEMENT: number; SHOW_COMMENT: number; FILTER_SKIP: number; SHOW_ATTRIBUTE: number; SHOW_DOCUMENT_FRAGMENT: number; } declare var NodeFilter: { prototype: NodeFilter; new(): NodeFilter; SHOW_ENTITY_REFERENCE: number; SHOW_NOTATION: number; SHOW_ENTITY: number; SHOW_DOCUMENT: number; SHOW_PROCESSING_INSTRUCTION: number; FILTER_REJECT: number; SHOW_CDATA_SECTION: number; FILTER_ACCEPT: number; SHOW_ALL: number; SHOW_DOCUMENT_TYPE: number; SHOW_TEXT: number; SHOW_ELEMENT: number; SHOW_COMMENT: number; FILTER_SKIP: number; SHOW_ATTRIBUTE: number; SHOW_DOCUMENT_FRAGMENT: number; } interface MSBorderColorStyle_HTMLFrameElement { borderColor: any; } interface MSHTMLOListElementExtensions { } interface DOML2DeprecatedWordWrapSuppression_HTMLDTElement { noWrap: bool; } interface ScreenView extends AbstractView { outerWidth: number; pageXOffset: number; innerWidth: number; pageYOffset: number; screenY: number; outerHeight: number; screen: Screen; innerHeight: number; screenX: number; scroll(x?: number, y?: number): void; scrollBy(x?: number, y?: number): void; scrollTo(x?: number, y?: number): void; } interface DOML2DeprecatedMarginStyle_HTMLObjectElement { vspace: number; hspace: number; } interface DOML2DeprecatedMarginStyle_HTMLInputElement { vspace: number; hspace: number; } interface MSHTMLTableSectionElementExtensions extends DOML2DeprecatedBackgroundColorStyle { moveRow(indexFrom?: number, indexTo?: number): Object; } interface HTMLFieldSetElement extends HTMLElement, MSHTMLFieldSetElementExtensions { form: HTMLFormElement; } declare var HTMLFieldSetElement: { prototype: HTMLFieldSetElement; new(): HTMLFieldSetElement; } interface MediaError { code: number; MEDIA_ERR_ABORTED: number; MEDIA_ERR_NETWORK: number; MEDIA_ERR_SRC_NOT_SUPPORTED: number; MEDIA_ERR_DECODE: number; } declare var MediaError: { prototype: MediaError; new(): MediaError; MEDIA_ERR_ABORTED: number; MEDIA_ERR_NETWORK: number; MEDIA_ERR_SRC_NOT_SUPPORTED: number; MEDIA_ERR_DECODE: number; } interface SVGNumberList { numberOfItems: number; replaceItem(newItem: SVGNumber, index: number): SVGNumber; getItem(index: number): SVGNumber; clear(): void; appendItem(newItem: SVGNumber): SVGNumber; initialize(newItem: SVGNumber): SVGNumber; removeItem(index: number): SVGNumber; insertItemBefore(newItem: SVGNumber, index: number): SVGNumber; } declare var SVGNumberList: { prototype: SVGNumberList; new(): SVGNumberList; } interface HTMLBGSoundElement extends HTMLElement { balance: any; volume: any; src: string; loop: number; } declare var HTMLBGSoundElement: { prototype: HTMLBGSoundElement; new(): HTMLBGSoundElement; } interface HTMLElement extends Element, MSHTMLElementRangeExtensions, ElementCSSInlineStyle, MSEventAttachmentTarget, MSHTMLElementExtensions, MSNodeExtensions { ondragend: (ev: DragEvent) => any; onkeydown: (ev: KeyboardEvent) => any; ondragover: (ev: DragEvent) => any; onkeyup: (ev: KeyboardEvent) => any; offsetTop: number; onreset: (ev: Event) => any; onmouseup: (ev: MouseEvent) => any; ondragstart: (ev: DragEvent) => any; ondrag: (ev: DragEvent) => any; innerHTML: string; onmouseover: (ev: MouseEvent) => any; ondragleave: (ev: DragEvent) => any; lang: string; onpause: (ev: Event) => any; className: string; onseeked: (ev: Event) => any; onmousedown: (ev: MouseEvent) => any; title: string; onclick: (ev: MouseEvent) => any; onwaiting: (ev: Event) => any; outerHTML: string; offsetLeft: number; ondurationchange: (ev: Event) => any; offsetHeight: number; dir: string; onblur: (ev: FocusEvent) => any; onemptied: (ev: Event) => any; onseeking: (ev: Event) => any; oncanplay: (ev: Event) => any; onstalled: (ev: Event) => any; onmousemove: (ev: MouseEvent) => any; style: MSStyleCSSProperties; isContentEditable: bool; onratechange: (ev: Event) => any; onloadstart: (ev: Event) => any; ondragenter: (ev: DragEvent) => any; contentEditable: string; onsubmit: (ev: Event) => any; tabIndex: number; onprogress: (ev: any) => any; ondblclick: (ev: MouseEvent) => any; oncontextmenu: (ev: MouseEvent) => any; onchange: (ev: Event) => any; onloadedmetadata: (ev: Event) => any; onerror: (ev: Event) => any; onplay: (ev: Event) => any; id: string; onplaying: (ev: Event) => any; oncanplaythrough: (ev: Event) => any; onabort: (ev: UIEvent) => any; onreadystatechange: (ev: Event) => any; onkeypress: (ev: KeyboardEvent) => any; offsetParent: Element; onloadeddata: (ev: Event) => any; disabled: bool; onsuspend: (ev: Event) => any; accessKey: string; onfocus: (ev: FocusEvent) => any; ontimeupdate: (ev: Event) => any; onselect: (ev: UIEvent) => any; ondrop: (ev: DragEvent) => any; offsetWidth: number; onmouseout: (ev: MouseEvent) => any; onended: (ev: Event) => any; onscroll: (ev: UIEvent) => any; onmousewheel: (ev: MouseWheelEvent) => any; onvolumechange: (ev: Event) => any; onload: (ev: Event) => any; oninput: (ev: Event) => any; click(): void; getElementsByClassName(classNames: string): NodeList; scrollIntoView(top?: bool): void; focus(): void; blur(): void; insertAdjacentHTML(where: string, html: string): void; } declare var HTMLElement: { prototype: HTMLElement; new(): HTMLElement; } interface Comment extends CharacterData, MSCommentExtensions { } declare var Comment: { prototype: Comment; new(): Comment; } interface CanvasPattern { } declare var CanvasPattern: { prototype: CanvasPattern; new(): CanvasPattern; } interface HTMLHRElement extends HTMLElement, DOML2DeprecatedWidthStyle_HTMLHRElement, MSHTMLHRElementExtensions, HTMLHRElementDOML2Deprecated, DOML2DeprecatedAlignmentStyle_HTMLHRElement, DOML2DeprecatedSizeProperty { } declare var HTMLHRElement: { prototype: HTMLHRElement; new(): HTMLHRElement; } interface MSHTMLFrameSetElementExtensions { name: string; frameBorder: string; border: string; frameSpacing: any; } interface DOML2DeprecatedTextFlowControl_HTMLBlockElement { clear: string; } interface PositionOptions { enableHighAccuracy?: bool; timeout?: number; maximumAge?: number; } interface HTMLObjectElement extends HTMLElement, MSHTMLObjectElementExtensions, GetSVGDocument, DOML2DeprecatedMarginStyle_HTMLObjectElement, MSDataBindingExtensions, MSDataBindingRecordSetExtensions, DOML2DeprecatedAlignmentStyle_HTMLObjectElement, DOML2DeprecatedBorderStyle_HTMLObjectElement { width: string; codeType: string; archive: string; standby: string; name: string; useMap: string; form: HTMLFormElement; data: string; height: string; contentDocument: Document; codeBase: string; declare: bool; type: string; code: string; } declare var HTMLObjectElement: { prototype: HTMLObjectElement; new(): HTMLObjectElement; } interface MSHTMLMenuElementExtensions { } interface DocumentView { defaultView: AbstractView; elementFromPoint(x: number, y: number): Element; } interface StorageEvent extends Event { oldValue: any; newValue: any; url: string; storageArea: Storage; key: string; initStorageEvent(typeArg: string, canBubbleArg: bool, cancelableArg: bool, keyArg: string, oldValueArg: any, newValueArg: any, urlArg: string, storageAreaArg: Storage): void; } declare var StorageEvent: { prototype: StorageEvent; new(): StorageEvent; } interface HTMLEmbedElement extends HTMLElement, GetSVGDocument, MSHTMLEmbedElementExtensions { width: string; src: string; name: string; height: string; } declare var HTMLEmbedElement: { prototype: HTMLEmbedElement; new(): HTMLEmbedElement; } interface CharacterData extends Node { length: number; data: string; deleteData(offset: number, count: number): void; replaceData(offset: number, count: number, arg: string): void; appendData(arg: string): void; insertData(offset: number, arg: string): void; substringData(offset: number, count: number): string; } declare var CharacterData: { prototype: CharacterData; new(): CharacterData; } interface DOML2DeprecatedAlignmentStyle_HTMLTableSectionElement { align: string; } interface HTMLOptGroupElement extends HTMLElement, MSDataBindingExtensions, MSHTMLOptGroupElementExtensions { label: string; } declare var HTMLOptGroupElement: { prototype: HTMLOptGroupElement; new(): HTMLOptGroupElement; } interface HTMLIsIndexElement extends HTMLElement, MSHTMLIsIndexElementExtensions { form: HTMLFormElement; prompt: string; } declare var HTMLIsIndexElement: { prototype: HTMLIsIndexElement; new(): HTMLIsIndexElement; } interface SVGPathSegLinetoRel extends SVGPathSeg { y: number; x: number; } declare var SVGPathSegLinetoRel: { prototype: SVGPathSegLinetoRel; new(): SVGPathSegLinetoRel; } interface MSHTMLDocumentSelection { selection: MSSelection; } interface DOMException { code: number; message: string; toString(): string; HIERARCHY_REQUEST_ERR: number; NO_MODIFICATION_ALLOWED_ERR: number; INVALID_MODIFICATION_ERR: number; NAMESPACE_ERR: number; INVALID_CHARACTER_ERR: number; TYPE_MISMATCH_ERR: number; ABORT_ERR: number; INVALID_STATE_ERR: number; SECURITY_ERR: number; NETWORK_ERR: number; WRONG_DOCUMENT_ERR: number; QUOTA_EXCEEDED_ERR: number; INDEX_SIZE_ERR: number; DOMSTRING_SIZE_ERR: number; SYNTAX_ERR: number; SERIALIZE_ERR: number; VALIDATION_ERR: number; NOT_FOUND_ERR: number; URL_MISMATCH_ERR: number; PARSE_ERR: number; NO_DATA_ALLOWED_ERR: number; NOT_SUPPORTED_ERR: number; INVALID_ACCESS_ERR: number; INUSE_ATTRIBUTE_ERR: number; } declare var DOMException: { prototype: DOMException; new(): DOMException; HIERARCHY_REQUEST_ERR: number; NO_MODIFICATION_ALLOWED_ERR: number; INVALID_MODIFICATION_ERR: number; NAMESPACE_ERR: number; INVALID_CHARACTER_ERR: number; TYPE_MISMATCH_ERR: number; ABORT_ERR: number; INVALID_STATE_ERR: number; SECURITY_ERR: number; NETWORK_ERR: number; WRONG_DOCUMENT_ERR: number; QUOTA_EXCEEDED_ERR: number; INDEX_SIZE_ERR: number; DOMSTRING_SIZE_ERR: number; SYNTAX_ERR: number; SERIALIZE_ERR: number; VALIDATION_ERR: number; NOT_FOUND_ERR: number; URL_MISMATCH_ERR: number; PARSE_ERR: number; NO_DATA_ALLOWED_ERR: number; NOT_SUPPORTED_ERR: number; INVALID_ACCESS_ERR: number; INUSE_ATTRIBUTE_ERR: number; } interface MSCompatibleInfoCollection { length: number; item(index: number): MSCompatibleInfo; } declare var MSCompatibleInfoCollection: { prototype: MSCompatibleInfoCollection; new(): MSCompatibleInfoCollection; } interface MSHTMLIsIndexElementExtensions { action: string; } interface SVGAnimatedBoolean { animVal: bool; baseVal: bool; } declare var SVGAnimatedBoolean: { prototype: SVGAnimatedBoolean; new(): SVGAnimatedBoolean; } interface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGLangSpace, SVGTests { } declare var SVGSwitchElement: { prototype: SVGSwitchElement; new(): SVGSwitchElement; } interface MSHTMLIFrameElementExtensions extends DOML2DeprecatedMarginStyle_MSHTMLIFrameElementExtensions, DOML2DeprecatedBorderStyle_MSHTMLIFrameElementExtensions { onload: (ev: Event) => any; frameSpacing: any; noResize: bool; } interface SVGPreserveAspectRatio { align: number; meetOrSlice: number; SVG_PRESERVEASPECTRATIO_NONE: number; SVG_PRESERVEASPECTRATIO_XMINYMID: number; SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; SVG_PRESERVEASPECTRATIO_XMINYMAX: number; SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; SVG_MEETORSLICE_UNKNOWN: number; SVG_PRESERVEASPECTRATIO_XMAXYMID: number; SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; SVG_PRESERVEASPECTRATIO_XMINYMIN: number; SVG_MEETORSLICE_MEET: number; SVG_PRESERVEASPECTRATIO_XMIDYMID: number; SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; SVG_MEETORSLICE_SLICE: number; SVG_PRESERVEASPECTRATIO_UNKNOWN: number; } declare var SVGPreserveAspectRatio: { prototype: SVGPreserveAspectRatio; new(): SVGPreserveAspectRatio; SVG_PRESERVEASPECTRATIO_NONE: number; SVG_PRESERVEASPECTRATIO_XMINYMID: number; SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; SVG_PRESERVEASPECTRATIO_XMINYMAX: number; SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; SVG_MEETORSLICE_UNKNOWN: number; SVG_PRESERVEASPECTRATIO_XMAXYMID: number; SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; SVG_PRESERVEASPECTRATIO_XMINYMIN: number; SVG_MEETORSLICE_MEET: number; SVG_PRESERVEASPECTRATIO_XMIDYMID: number; SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; SVG_MEETORSLICE_SLICE: number; SVG_PRESERVEASPECTRATIO_UNKNOWN: number; } interface Attr extends Node, MSAttrExtensions { specified: bool; ownerElement: Element; value: string; name: string; } declare var Attr: { prototype: Attr; new(): Attr; } interface MSBorderColorStyle_HTMLTableRowElement { borderColor: any; } interface DOML2DeprecatedAlignmentStyle_HTMLTableCaptionElement { align: string; } interface PerformanceNavigation { redirectCount: number; type: number; toJSON(): any; TYPE_RELOAD: number; TYPE_RESERVED: number; TYPE_BACK_FORWARD: number; TYPE_NAVIGATE: number; } declare var PerformanceNavigation: { prototype: PerformanceNavigation; new(): PerformanceNavigation; TYPE_RELOAD: number; TYPE_RESERVED: number; TYPE_BACK_FORWARD: number; TYPE_NAVIGATE: number; } interface HTMLBodyElementDOML2Deprecated { link: any; aLink: any; text: any; vLink: any; } interface SVGStopElement extends SVGElement, SVGStylable { offset: SVGAnimatedNumber; } declare var SVGStopElement: { prototype: SVGStopElement; new(): SVGStopElement; } interface PositionCallback { (position: Position): void; } interface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGFitToViewBox { } declare var SVGSymbolElement: { prototype: SVGSymbolElement; new(): SVGSymbolElement; } interface SVGElementInstanceList { length: number; item(index: number): SVGElementInstance; } declare var SVGElementInstanceList: { prototype: SVGElementInstanceList; new(): SVGElementInstanceList; } interface MSDataBindingRecordSetExtensions { recordset: Object; namedRecordset(dataMember: string, hierarchy?: any): Object; } interface CSSRuleList { length: number; item(index: number): CSSRule; [index: number]: CSSRule; } declare var CSSRuleList: { prototype: CSSRuleList; new(): CSSRuleList; } interface MSHTMLTableColElementExtensions { } interface LinkStyle { sheet: StyleSheet; } interface MSHTMLMarqueeElementExtensions { } interface HTMLVideoElement extends HTMLMediaElement { width: number; videoWidth: number; videoHeight: number; height: number; poster: string; } declare var HTMLVideoElement: { prototype: HTMLVideoElement; new(): HTMLVideoElement; } interface MSXMLHttpRequestExtensions { responseBody: any; timeout: number; ontimeout: (ev: Event) => any; } interface ClientRectList { length: number; item(index: number): ClientRect; [index: number]: ClientRect; } declare var ClientRectList: { prototype: ClientRectList; new(): ClientRectList; } interface DOML2DeprecatedAlignmentStyle_HTMLTableCellElement { align: string; } interface SVGMaskElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGTests { y: SVGAnimatedLength; width: SVGAnimatedLength; maskUnits: SVGAnimatedEnumeration; maskContentUnits: SVGAnimatedEnumeration; x: SVGAnimatedLength; height: SVGAnimatedLength; } declare var SVGMaskElement: { prototype: SVGMaskElement; new(): SVGMaskElement; } declare var Audio: { new (src?: string): HTMLAudioElement; }; declare var Option: { new (text?: string, value?: string, defaultSelected?: bool, selected?: bool): HTMLOptionElement; }; declare var Image: { new (width?: number, height?: number): HTMLImageElement; }; declare var ondragend: (ev: DragEvent) => any; declare var onkeydown: (ev: KeyboardEvent) => any; declare var ondragover: (ev: DragEvent) => any; declare var onkeyup: (ev: KeyboardEvent) => any; declare var onreset: (ev: Event) => any; declare var onmouseup: (ev: MouseEvent) => any; declare var ondragstart: (ev: DragEvent) => any; declare var ondrag: (ev: DragEvent) => any; declare var onmouseover: (ev: MouseEvent) => any; declare var ondragleave: (ev: DragEvent) => any; declare var history: History; declare var name: string; declare var onafterprint: (ev: Event) => any; declare var onpause: (ev: Event) => any; declare var onbeforeprint: (ev: Event) => any; declare var top: Window; declare var onmousedown: (ev: MouseEvent) => any; declare var onseeked: (ev: Event) => any; declare var opener: Window; declare var onclick: (ev: MouseEvent) => any; declare var onwaiting: (ev: Event) => any; declare var ononline: (ev: Event) => any; declare var ondurationchange: (ev: Event) => any; declare var frames: Window; declare var onblur: (ev: FocusEvent) => any; declare var onemptied: (ev: Event) => any; declare var onseeking: (ev: Event) => any; declare var oncanplay: (ev: Event) => any; declare var onstalled: (ev: Event) => any; declare var onmousemove: (ev: MouseEvent) => any; declare var onoffline: (ev: Event) => any; declare var length: number; declare var onbeforeunload: (ev: BeforeUnloadEvent) => any; declare var onratechange: (ev: Event) => any; declare var onstorage: (ev: StorageEvent) => any; declare var onloadstart: (ev: Event) => any; declare var ondragenter: (ev: DragEvent) => any; declare var onsubmit: (ev: Event) => any; declare var self: Window; declare var onprogress: (ev: any) => any; declare var ondblclick: (ev: MouseEvent) => any; declare var oncontextmenu: (ev: MouseEvent) => any; declare var onchange: (ev: Event) => any; declare var onloadedmetadata: (ev: Event) => any; declare var onplay: (ev: Event) => any; declare var onerror: ErrorFunction; declare var onplaying: (ev: Event) => any; declare var parent: Window; declare var location: Location; declare var oncanplaythrough: (ev: Event) => any; declare var onabort: (ev: UIEvent) => any; declare var onreadystatechange: (ev: Event) => any; declare var onkeypress: (ev: KeyboardEvent) => any; declare var frameElement: Element; declare var onloadeddata: (ev: Event) => any; declare var onsuspend: (ev: Event) => any; declare var window: Window; declare var onfocus: (ev: FocusEvent) => any; declare var onmessage: (ev: MessageEvent) => any; declare var ontimeupdate: (ev: Event) => any; declare var onresize: (ev: UIEvent) => any; declare var navigator: Navigator; declare var onselect: (ev: UIEvent) => any; declare var ondrop: (ev: DragEvent) => any; declare var onmouseout: (ev: MouseEvent) => any; declare var onended: (ev: Event) => any; declare var onhashchange: (ev: Event) => any; declare var onunload: (ev: Event) => any; declare var onscroll: (ev: UIEvent) => any; declare var onmousewheel: (ev: MouseWheelEvent) => any; declare var onload: (ev: Event) => any; declare var onvolumechange: (ev: Event) => any; declare var oninput: (ev: Event) => any; declare function alert(message?: string): void; declare function focus(): void; declare function print(): void; declare function prompt(message?: string, defaul?: string): string; declare function toString(): string; declare function open(url?: string, target?: string, features?: string, replace?: bool): Window; declare function close(): void; declare function confirm(message?: string): bool; declare function postMessage(message: any, targetOrigin: string, ports?: any): void; declare function showModalDialog(url?: string, argument?: any, options?: any): any; declare function blur(): void; declare function getSelection(): Selection; declare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; declare function attachEvent(event: string, listener: EventListener): bool; declare function detachEvent(event: string, listener: EventListener): void; declare var status: string; declare var onmouseleave: (ev: MouseEvent) => any; declare var screenLeft: number; declare var offscreenBuffering: any; declare var maxConnectionsPerServer: number; declare var onmouseenter: (ev: MouseEvent) => any; declare var clipboardData: DataTransfer; declare var defaultStatus: string; declare var clientInformation: Navigator; declare var closed: bool; declare var onhelp: (ev: Event) => any; declare var external: BrowserPublic; declare var event: MSEventObj; declare var onfocusout: (ev: FocusEvent) => any; declare var screenTop: number; declare var onfocusin: (ev: FocusEvent) => any; declare function showModelessDialog(url?: string, argument?: any, options?: any): Window; declare function navigate(url: string): void; declare function resizeBy(x?: number, y?: number): void; declare function item(index: any): any; declare function resizeTo(x?: number, y?: number): void; declare function createPopup(arguments?: any): MSPopupWindow; declare function toStaticHTML(html: string): string; declare function execScript(code: string, language?: string): any; declare function msWriteProfilerMark(profilerMarkName: string): void; declare function moveTo(x?: number, y?: number): void; declare function moveBy(x?: number, y?: number): void; declare function showHelp(url: string, helpArg?: any, features?: string): void; declare var performance: any; declare var outerWidth: number; declare var pageXOffset: number; declare var innerWidth: number; declare var pageYOffset: number; declare var screenY: number; declare var outerHeight: number; declare var screen: Screen; declare var innerHeight: number; declare var screenX: number; declare function scroll(x?: number, y?: number): void; declare function scrollBy(x?: number, y?: number): void; declare function scrollTo(x?: number, y?: number): void; declare var styleMedia: StyleMedia; declare var document: Document; declare function removeEventListener(type: string, listener: EventListener, useCapture?: bool): void; declare function addEventListener(type: string, listener: EventListener, useCapture?: bool): void; declare function dispatchEvent(evt: Event): bool; declare var localStorage: Storage; declare var sessionStorage: Storage; declare function clearTimeout(handle: number): void; declare function setTimeout(expression: any, msec?: number, language?: any): number; declare function clearInterval(handle: number): void; declare function setInterval(expression: any, msec?: number, language?: any): number; ///////////////////////////// /// IE10 DOM APIs ///////////////////////////// interface HTMLBodyElement { onpopstate: (ev: PopStateEvent) => any; } interface MSGestureEvent extends UIEvent { offsetY: number; translationY: number; velocityExpansion: number; velocityY: number; velocityAngular: number; translationX: number; velocityX: number; hwTimestamp: number; offsetX: number; screenX: number; rotation: number; expansion: number; clientY: number; screenY: number; scale: number; gestureObject: any; clientX: number; initGestureEvent(typeArg: string, canBubbleArg: bool, cancelableArg: bool, viewArg: AbstractView, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void; MSGESTURE_FLAG_BEGIN: number; MSGESTURE_FLAG_END: number; MSGESTURE_FLAG_CANCEL: number; MSGESTURE_FLAG_INERTIA: number; MSGESTURE_FLAG_NONE: number; } declare var MSGestureEvent: { prototype: MSGestureEvent; new(): MSGestureEvent; MSGESTURE_FLAG_BEGIN: number; MSGESTURE_FLAG_END: number; MSGESTURE_FLAG_CANCEL: number; MSGESTURE_FLAG_INERTIA: number; MSGESTURE_FLAG_NONE: number; } interface HTMLAnchorElement { text: string; } interface HTMLInputElement { validationMessage: string; files: FileList; max: string; formTarget: string; willValidate: bool; step: string; autofocus: bool; required: bool; formEnctype: string; valueAsNumber: number; placeholder: string; formMethod: string; list: HTMLElement; autocomplete: string; min: string; formAction: string; pattern: string; validity: ValidityState; formNoValidate: string; multiple: bool; checkValidity(): bool; stepDown(n?: number): void; stepUp(n?: number): void; setCustomValidity(error: string): void; } interface ErrorEvent extends Event { colno: number; filename: string; lineno: number; message: string; initErrorEvent(typeArg: string, canBubbleArg: bool, cancelableArg: bool, messageArg: string, filenameArg: string, linenoArg: number): void; } declare var ErrorEvent: { prototype: ErrorEvent; new(): ErrorEvent; } interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference { y: SVGAnimatedLength; width: SVGAnimatedLength; filterResX: SVGAnimatedInteger; filterUnits: SVGAnimatedEnumeration; primitiveUnits: SVGAnimatedEnumeration; x: SVGAnimatedLength; height: SVGAnimatedLength; filterResY: SVGAnimatedInteger; setFilterRes(filterResX: number, filterResY: number): void; } declare var SVGFilterElement: { prototype: SVGFilterElement; new(): SVGFilterElement; } interface TrackEvent extends Event { track: any; } declare var TrackEvent: { prototype: TrackEvent; new(): TrackEvent; } interface SVGFEMergeNodeElement extends SVGElement { in1: SVGAnimatedString; } declare var SVGFEMergeNodeElement: { prototype: SVGFEMergeNodeElement; new(): SVGFEMergeNodeElement; } interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { } declare var SVGFEFloodElement: { prototype: SVGFEFloodElement; new(): SVGFEFloodElement; } interface MSElementExtensions { msRegionOverflow: string; onmspointerdown: (ev: any) => any; onmsgotpointercapture: (ev: any) => any; onmsgesturedoubletap: (ev: any) => any; onmspointerhover: (ev: any) => any; onmsgesturehold: (ev: any) => any; onmspointermove: (ev: any) => any; onmsgesturechange: (ev: any) => any; onmsgesturestart: (ev: any) => any; onmspointercancel: (ev: any) => any; onmsgestureend: (ev: any) => any; onmsgesturetap: (ev: any) => any; onmspointerout: (ev: any) => any; onmsinertiastart: (ev: any) => any; onmslostpointercapture: (ev: any) => any; onmspointerover: (ev: any) => any; msContentZoomFactor: number; onmspointerup: (ev: any) => any; msGetRegionContent(): MSRangeCollection; msReleasePointerCapture(pointerId: number): void; msSetPointerCapture(pointerId: number): void; } declare var MSElementExtensions: { prototype: MSElementExtensions; new(): MSElementExtensions; } interface MSCSSScrollTranslationProperties { msScrollTranslation: string; } interface MSGesture { target: Element; addPointer(pointerId: number): void; stop(): void; } declare var MSGesture: { prototype: MSGesture; new (): MSGesture; } interface TextTrackCue extends EventTarget { onenter: (ev: Event) => any; track: TextTrack; endTime: number; text: string; pauseOnExit: bool; id: string; startTime: number; onexit: (ev: Event) => any; getCueAsHTML(): DocumentFragment; } declare var TextTrackCue: { prototype: TextTrackCue; new(): TextTrackCue; } interface MSHTMLDocumentViewExtensions { msCSSOMElementFloatMetrics: bool; msElementsFromPoint(x: number, y: number): NodeList; msElementsFromRect(left: number, top: number, width: number, height: number): NodeList; } declare var MSHTMLDocumentViewExtensions: { prototype: MSHTMLDocumentViewExtensions; new(): MSHTMLDocumentViewExtensions; } interface MSStreamReader extends MSBaseReader { error: DOMError; readAsArrayBuffer(stream: MSStream, size?: number): void; readAsBlob(stream: MSStream, size?: number): void; readAsDataURL(stream: MSStream, size?: number): void; readAsText(stream: MSStream, encoding?: string, size?: number): void; } declare var MSStreamReader: { prototype: MSStreamReader; new (): MSStreamReader; } interface CSSFlexibleBoxProperties { msFlex: string; msFlexDirection: string; msFlexNegative: string; msFlexPack: string; msFlexWrap: string; msFlexItemAlign: string; msFlexOrder: string; msFlexPositive: string; msFlexAlign: string; msFlexFlow: string; msFlexPreferredSize: string; msFlexLinePack: string; } interface DOMTokenList { length: number; contains(token: string): bool; remove(token: string): void; toggle(token: string): bool; add(token: string): void; item(index: number): string; [index: number]: string; toString(): string; } declare var DOMTokenList: { prototype: DOMTokenList; new(): DOMTokenList; } interface EventException { name: string; } interface SVGFEFuncAElement extends SVGComponentTransferFunctionElement { } declare var SVGFEFuncAElement: { prototype: SVGFEFuncAElement; new(): SVGFEFuncAElement; } interface Performance { now(): number; } interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { in1: SVGAnimatedString; } declare var SVGFETileElement: { prototype: SVGFETileElement; new(): SVGFETileElement; } interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { in2: SVGAnimatedString; mode: SVGAnimatedEnumeration; in1: SVGAnimatedString; SVG_FEBLEND_MODE_DARKEN: number; SVG_FEBLEND_MODE_UNKNOWN: number; SVG_FEBLEND_MODE_MULTIPLY: number; SVG_FEBLEND_MODE_NORMAL: number; SVG_FEBLEND_MODE_SCREEN: number; SVG_FEBLEND_MODE_LIGHTEN: number; } declare var SVGFEBlendElement: { prototype: SVGFEBlendElement; new(): SVGFEBlendElement; SVG_FEBLEND_MODE_DARKEN: number; SVG_FEBLEND_MODE_UNKNOWN: number; SVG_FEBLEND_MODE_MULTIPLY: number; SVG_FEBLEND_MODE_NORMAL: number; SVG_FEBLEND_MODE_SCREEN: number; SVG_FEBLEND_MODE_LIGHTEN: number; } interface WindowTimers extends WindowTimersExtension { } declare var WindowTimers: { prototype: WindowTimers; new(): WindowTimers; } interface CSSStyleDeclaration extends CSS2DTransformsProperties, CSSTransitionsProperties, CSSFontsProperties, MSCSSHighContrastProperties, CSSGridProperties, CSSAnimationsProperties, MSCSSContentZoomProperties, MSCSSScrollTranslationProperties, MSCSSTouchManipulationProperties, CSSFlexibleBoxProperties, MSCSSPositionedFloatsProperties, MSCSSRegionProperties, MSCSSSelectionBoundaryProperties, CSSMultiColumnProperties, CSSTextProperties, CSS3DTransformsProperties { } interface MessageChannel { port2: MessagePort; port1: MessagePort; } declare var MessageChannel: { prototype: MessageChannel; new (): MessageChannel; } interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { } declare var SVGFEMergeElement: { prototype: SVGFEMergeElement; new(): SVGFEMergeElement; } interface Navigator extends MSFileSaver { } interface TransitionEvent extends Event { propertyName: string; elapsedTime: number; initTransitionEvent(typeArg: string, canBubbleArg: bool, cancelableArg: bool, propertyNameArg: string, elapsedTimeArg: number): void; } declare var TransitionEvent: { prototype: TransitionEvent; new(): TransitionEvent; } interface MediaQueryList { matches: bool; media: string; addListener(listener: MediaQueryListListener): void; removeListener(listener: MediaQueryListListener): void; } declare var MediaQueryList: { prototype: MediaQueryList; new(): MediaQueryList; } interface DOMError { name: string; toString(): string; } declare var DOMError: { prototype: DOMError; new(): DOMError; } interface SVGFEPointLightElement extends SVGElement { y: SVGAnimatedNumber; x: SVGAnimatedNumber; z: SVGAnimatedNumber; } declare var SVGFEPointLightElement: { prototype: SVGFEPointLightElement; new(): SVGFEPointLightElement; } interface CSSFontsProperties { msFontFeatureSettings: string; fontFeatureSettings: string; } interface CloseEvent extends Event { wasClean: bool; reason: string; code: number; initCloseEvent(typeArg: string, canBubbleArg: bool, cancelableArg: bool, wasCleanArg: bool, codeArg: number, reasonArg: string): void; } declare var CloseEvent: { prototype: CloseEvent; new(): CloseEvent; } interface WebSocket extends EventTarget { protocol: string; readyState: number; bufferedAmount: number; onopen: (ev: Event) => any; extensions: string; onmessage: (ev: any) => any; onclose: (ev: CloseEvent) => any; onerror: (ev: ErrorEvent) => any; binaryType: string; url: string; close(code?: number, reason?: string): void; send(data: any): void; OPEN: number; CLOSING: number; CONNECTING: number; CLOSED: number; } declare var WebSocket: { prototype: WebSocket; new (url: string): WebSocket; new (url: string, prototcol: string): WebSocket; new (url: string, prototcol: string[]): WebSocket; OPEN: number; CLOSING: number; CONNECTING: number; CLOSED: number; } interface ProgressEvent extends Event { loaded: number; lengthComputable: bool; total: number; initProgressEvent(typeArg: string, canBubbleArg: bool, cancelableArg: bool, lengthComputableArg: bool, loadedArg: number, totalArg: number): void; } declare var ProgressEvent: { prototype: ProgressEvent; new(): ProgressEvent; } interface HTMLCanvasElement { msToBlob(): Blob; } interface IDBObjectStore { indexNames: DOMStringList; name: string; transaction: IDBTransaction; keyPath: string; count(key?: any): IDBRequest; add(value: any, key?: any): IDBRequest; clear(): IDBRequest; createIndex(name: string, keyPath: string, optionalParameters?: any): IDBIndex; put(value: any, key?: any): IDBRequest; openCursor(range?: any, direction?: string): IDBRequest; deleteIndex(indexName: string): void; index(name: string): IDBIndex; get(key: any): IDBRequest; delet(key: any): IDBRequest; } declare var IDBObjectStore: { prototype: IDBObjectStore; new(): IDBObjectStore; } interface ObjectURLOptions { oneTimeOnly?: bool; } interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { stdDeviationX: SVGAnimatedNumber; in1: SVGAnimatedString; stdDeviationY: SVGAnimatedNumber; setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; } declare var SVGFEGaussianBlurElement: { prototype: SVGFEGaussianBlurElement; new(): SVGFEGaussianBlurElement; } interface MSHTMLDocumentExtensions { onmspointerdown: (ev: any) => any; onmspointercancel: (ev: any) => any; onmsgesturedoubletap: (ev: any) => any; onmsgesturetap: (ev: any) => any; onmsgestureend: (ev: any) => any; onmspointerout: (ev: any) => any; onmsmanipulationstatechanged: (ev: any) => any; onmsinertiastart: (ev: any) => any; onmspointerhover: (ev: any) => any; onmscontentzoom: (ev: any) => any; onmsgesturehold: (ev: any) => any; onmspointermove: (ev: any) => any; onmspointerover: (ev: any) => any; onmsgesturechange: (ev: any) => any; onmsgesturestart: (ev: any) => any; onmspointerup: (ev: any) => any; } declare var MSHTMLDocumentExtensions: { prototype: MSHTMLDocumentExtensions; new(): MSHTMLDocumentExtensions; } interface MSCSSSelectionBoundaryProperties { msUserSelect: string; } interface SVGFilterPrimitiveStandardAttributes extends SVGStylable { y: SVGAnimatedLength; width: SVGAnimatedLength; x: SVGAnimatedLength; height: SVGAnimatedLength; result: SVGAnimatedString; } interface IDBVersionChangeEvent extends Event { newVersion: number; oldVersion: number; } declare var IDBVersionChangeEvent: { prototype: IDBVersionChangeEvent; new(): IDBVersionChangeEvent; } interface IDBIndex { unique: bool; name: string; keyPath: string; objectStore: IDBObjectStore; count(key?: any): IDBRequest; getKey(key: any): IDBRequest; openKeyCursor(range?: IDBKeyRange, direction?: string): IDBRequest; get(key: any): IDBRequest; openCursor(range?: IDBKeyRange, direction?: string): IDBRequest; } declare var IDBIndex: { prototype: IDBIndex; new(): IDBIndex; } interface FileList { length: number; item(index: number): File; [index: number]: File; } declare var FileList: { prototype: FileList; new(): FileList; } interface IDBCursor { source: any; direction: string; key: any; primaryKey: any; advance(count: number): void; delet(): IDBRequest; continu(key?: any): void; update(value: any): IDBRequest; } declare var IDBCursor: { prototype: IDBCursor; new(): IDBCursor; } interface CSSAnimationsProperties { animationFillMode: string; msAnimationDirection: string; msAnimationDelay: string; msAnimationFillMode: string; animationIterationCount: string; msAnimationPlayState: string; msAnimationIterationCount: string; animationDelay: string; animationTimingFunction: string; msAnimation: string; animation: string; animationDirection: string; animationDuration: string; animationName: string; animationPlayState: string; msAnimationTimingFunction: string; msAnimationName: string; msAnimationDuration: string; } interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { kernelUnitLengthY: SVGAnimatedNumber; surfaceScale: SVGAnimatedNumber; specularExponent: SVGAnimatedNumber; in1: SVGAnimatedString; kernelUnitLengthX: SVGAnimatedNumber; specularConstant: SVGAnimatedNumber; } declare var SVGFESpecularLightingElement: { prototype: SVGFESpecularLightingElement; new(): SVGFESpecularLightingElement; } interface File extends Blob { lastModifiedDate: any; name: string; } declare var File: { prototype: File; new(): File; } interface URL { revokeObjectURL(url: string): void; createObjectURL(object: any, options?: ObjectURLOptions): string; } declare var URL: URL; interface RangeException { name: string; } interface IDBCursorWithValue extends IDBCursor { value: any; } declare var IDBCursorWithValue: { prototype: IDBCursorWithValue; new(): IDBCursorWithValue; } interface HTMLTextAreaElement { validationMessage: string; autofocus: bool; validity: ValidityState; required: bool; maxLength: number; willValidate: bool; placeholder: string; checkValidity(): bool; setCustomValidity(error: string): void; } interface XMLHttpRequestEventTarget extends EventTarget { onprogress: (ev: ProgressEvent) => any; onerror: (ev: ErrorEvent) => any; onload: (ev: any) => any; ontimeout: (ev: any) => any; onabort: (ev: any) => any; onloadstart: (ev: any) => any; onloadend: (ev: ProgressEvent) => any; } declare var XMLHttpRequestEventTarget: { prototype: XMLHttpRequestEventTarget; new(): XMLHttpRequestEventTarget; } interface IDBEnvironment { msIndexedDB: IDBFactory; indexedDB: IDBFactory; } interface AudioTrackList extends EventTarget { length: number; onchange: (ev: any) => any; onaddtrack: (ev: TrackEvent) => any; getTrackById(id: string): AudioTrack; item(index: number): AudioTrack; [index: number]: AudioTrack; } declare var AudioTrackList: { prototype: AudioTrackList; new(): AudioTrackList; } interface MSBaseReader extends EventTarget { onprogress: (ev: ProgressEvent) => any; readyState: number; onabort: (ev: any) => any; onloadend: (ev: ProgressEvent) => any; onerror: (ev: ErrorEvent) => any; onload: (ev: any) => any; onloadstart: (ev: any) => any; result: any; abort(): void; LOADING: number; EMPTY: number; DONE: number; } interface History { state: any; replaceState(statedata: any, title: string, url?: string): void; pushState(statedata: any, title: string, url?: string): void; } interface MSProtocol { protocol: string; } declare var MSProtocol: { prototype: MSProtocol; new(): MSProtocol; } interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { operator: SVGAnimatedEnumeration; radiusX: SVGAnimatedNumber; radiusY: SVGAnimatedNumber; in1: SVGAnimatedString; SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; SVG_MORPHOLOGY_OPERATOR_ERODE: number; SVG_MORPHOLOGY_OPERATOR_DILATE: number; } declare var SVGFEMorphologyElement: { prototype: SVGFEMorphologyElement; new(): SVGFEMorphologyElement; SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; SVG_MORPHOLOGY_OPERATOR_ERODE: number; SVG_MORPHOLOGY_OPERATOR_DILATE: number; } interface HTMLSelectElement { validationMessage: string; autofocus: bool; validity: ValidityState; required: bool; willValidate: bool; checkValidity(): bool; setCustomValidity(error: string): void; } interface CSSTransitionsProperties { transition: string; transitionDelay: string; transitionDuration: string; msTransitionTimingFunction: string; msTransition: string; msTransitionDuration: string; transitionTimingFunction: string; msTransitionDelay: string; transitionProperty: string; msTransitionProperty: string; } interface SVGFEFuncRElement extends SVGComponentTransferFunctionElement { } declare var SVGFEFuncRElement: { prototype: SVGFEFuncRElement; new(): SVGFEFuncRElement; } interface CSSRule { KEYFRAMES_RULE: number; KEYFRAME_RULE: number; VIEWPORT_RULE: number; } //declare var CSSRule: { // KEYFRAMES_RULE: number; // KEYFRAME_RULE: number; // VIEWPORT_RULE: number; //} interface WindowTimersExtension { msSetImmediate(expression: any, ...args: any[]): number; clearImmediate(handle: number): void; msClearImmediate(handle: number): void; setImmediate(expression: any, ...args: any[]): number; } interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { in2: SVGAnimatedString; xChannelSelector: SVGAnimatedEnumeration; yChannelSelector: SVGAnimatedEnumeration; scale: SVGAnimatedNumber; in1: SVGAnimatedString; SVG_CHANNEL_B: number; SVG_CHANNEL_R: number; SVG_CHANNEL_G: number; SVG_CHANNEL_UNKNOWN: number; SVG_CHANNEL_A: number; } declare var SVGFEDisplacementMapElement: { prototype: SVGFEDisplacementMapElement; new(): SVGFEDisplacementMapElement; SVG_CHANNEL_B: number; SVG_CHANNEL_R: number; SVG_CHANNEL_G: number; SVG_CHANNEL_UNKNOWN: number; SVG_CHANNEL_A: number; } interface MSCSSContentZoomProperties { msContentZoomLimit: string; msContentZooming: string; msContentZoomSnapType: string; msContentZoomLimitMax: any; msContentZoomSnapPoints: string; msContentZoomSnap: string; msContentZoomLimitMin: any; msContentZoomChaining: string; } interface AnimationEvent extends Event { animationName: string; elapsedTime: number; initAnimationEvent(typeArg: string, canBubbleArg: bool, cancelableArg: bool, animationNameArg: string, elapsedTimeArg: number): void; } declare var AnimationEvent: { prototype: AnimationEvent; new(): AnimationEvent; } interface SVGComponentTransferFunctionElement extends SVGElement { tableValues: SVGAnimatedNumberList; slope: SVGAnimatedNumber; type: SVGAnimatedEnumeration; exponent: SVGAnimatedNumber; amplitude: SVGAnimatedNumber; intercept: SVGAnimatedNumber; offset: SVGAnimatedNumber; SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; } declare var SVGComponentTransferFunctionElement: { prototype: SVGComponentTransferFunctionElement; new(): SVGComponentTransferFunctionElement; SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; } interface MSRangeCollection { length: number; item(index: number): Range; [index: number]: Range; } declare var MSRangeCollection: { prototype: MSRangeCollection; new(): MSRangeCollection; } interface MSHTMLElementExtensions { onmscontentzoom: (ev: any) => any; onmsmanipulationstatechanged: (ev: any) => any; } declare var MSHTMLElementExtensions: { prototype: MSHTMLElementExtensions; new(): MSHTMLElementExtensions; } interface MSCSSPositionedFloatsProperties { msWrapMargin: any; msWrapFlow: string; } interface SVGException { name: string; } interface SVGFEDistantLightElement extends SVGElement { azimuth: SVGAnimatedNumber; elevation: SVGAnimatedNumber; } declare var SVGFEDistantLightElement: { prototype: SVGFEDistantLightElement; new(): SVGFEDistantLightElement; } interface MSCSSRegionProperties { msFlowFrom: string; msFlowInto: string; msWrapThrough: string; } interface SVGFEFuncBElement extends SVGComponentTransferFunctionElement { } declare var SVGFEFuncBElement: { prototype: SVGFEFuncBElement; new(): SVGFEFuncBElement; } interface IDBKeyRange { upper: any; upperOpen: bool; lower: any; lowerOpen: bool; bound(lower: any, upper: any, lowerOpen?: bool, upperOpen?: bool): IDBKeyRange; only(value: any): IDBKeyRange; lowerBound(bound: any, open?: bool): IDBKeyRange; upperBound(bound: any, open?: bool): IDBKeyRange; } declare var IDBKeyRange: { prototype: IDBKeyRange; new(): IDBKeyRange; } interface WindowConsole { console: Console; } interface SVG1_1Properties { floodOpacity: string; floodColor: string; filter: string; lightingColor: string; enableBackground: string; colorInterpolationFilters: string; } declare var SVG1_1Properties: { prototype: SVG1_1Properties; new(): SVG1_1Properties; } interface IDBTransaction extends EventTarget { oncomplete: (ev: Event) => any; db: IDBDatabase; mode: string; error: DOMError; onerror: (ev: ErrorEvent) => any; onabort: (ev: any) => any; abort(): void; objectStore(name: string): IDBObjectStore; } declare var IDBTransaction: { prototype: IDBTransaction; new(): IDBTransaction; } interface MSWindowExtensions { onmspointerdown: (ev: any) => any; onmspointercancel: (ev: any) => any; onmsgesturedoubletap: (ev: any) => any; onmsgestureend: (ev: any) => any; onmsgesturetap: (ev: any) => any; onmspointerout: (ev: any) => any; onmspointerhover: (ev: any) => any; onmsinertiastart: (ev: any) => any; onmspointermove: (ev: any) => any; onmsgesturehold: (ev: any) => any; onmspointerover: (ev: any) => any; onmsgesturechange: (ev: any) => any; onmsgesturestart: (ev: any) => any; onmspointerup: (ev: any) => any; msIsStaticHTML(html: string): bool; } declare var MSWindowExtensions: { prototype: MSWindowExtensions; new(): MSWindowExtensions; } interface AudioTrack { kind: string; language: string; id: string; label: string; enabled: bool; } declare var AudioTrack: { prototype: AudioTrack; new(): AudioTrack; } interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { orderY: SVGAnimatedInteger; kernelUnitLengthY: SVGAnimatedNumber; orderX: SVGAnimatedInteger; preserveAlpha: SVGAnimatedBoolean; kernelMatrix: SVGAnimatedNumberList; edgeMode: SVGAnimatedEnumeration; kernelUnitLengthX: SVGAnimatedNumber; bias: SVGAnimatedNumber; targetX: SVGAnimatedInteger; targetY: SVGAnimatedInteger; divisor: SVGAnimatedNumber; in1: SVGAnimatedString; SVG_EDGEMODE_WRAP: number; SVG_EDGEMODE_DUPLICATE: number; SVG_EDGEMODE_UNKNOWN: number; SVG_EDGEMODE_NONE: number; } declare var SVGFEConvolveMatrixElement: { prototype: SVGFEConvolveMatrixElement; new(): SVGFEConvolveMatrixElement; SVG_EDGEMODE_WRAP: number; SVG_EDGEMODE_DUPLICATE: number; SVG_EDGEMODE_UNKNOWN: number; SVG_EDGEMODE_NONE: number; } interface TextTrackCueList { length: number; item(index: number): TextTrackCue; [index: number]: TextTrackCue; getCueById(id: string): TextTrackCue; } declare var TextTrackCueList: { prototype: TextTrackCueList; new(): TextTrackCueList; } interface CSSKeyframesRule extends CSSRule { name: string; cssRules: CSSRuleList; findRule(rule: string): CSSKeyframeRule; deleteRule(rule: string): void; appendRule(rule: string): void; } declare var CSSKeyframesRule: { prototype: CSSKeyframesRule; new(): CSSKeyframesRule; } interface MSCSSTouchManipulationProperties { msScrollSnapPointsY: string; msOverflowStyle: string; msScrollLimitXMax: any; msScrollSnapType: string; msScrollSnapPointsX: string; msScrollLimitYMax: any; msScrollSnapY: string; msScrollLimitXMin: any; msScrollLimitYMin: any; msScrollChaining: string; msTouchAction: string; msScrollSnapX: string; msScrollLimit: string; msScrollRails: string; msTouchSelect: string; } interface Window extends WindowAnimationTiming, WindowBase64, IDBEnvironment, WindowConsole { onpopstate: (ev: PopStateEvent) => any; applicationCache: ApplicationCache; matchMedia(mediaQuery: string): MediaQueryList; msMatchMedia(mediaQuery: string): MediaQueryList; } interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { baseFrequencyX: SVGAnimatedNumber; numOctaves: SVGAnimatedInteger; type: SVGAnimatedEnumeration; baseFrequencyY: SVGAnimatedNumber; stitchTiles: SVGAnimatedEnumeration; seed: SVGAnimatedNumber; SVG_STITCHTYPE_UNKNOWN: number; SVG_STITCHTYPE_NOSTITCH: number; SVG_TURBULENCE_TYPE_UNKNOWN: number; SVG_TURBULENCE_TYPE_TURBULENCE: number; SVG_TURBULENCE_TYPE_FRACTALNOISE: number; SVG_STITCHTYPE_STITCH: number; } declare var SVGFETurbulenceElement: { prototype: SVGFETurbulenceElement; new(): SVGFETurbulenceElement; SVG_STITCHTYPE_UNKNOWN: number; SVG_STITCHTYPE_NOSTITCH: number; SVG_TURBULENCE_TYPE_UNKNOWN: number; SVG_TURBULENCE_TYPE_TURBULENCE: number; SVG_TURBULENCE_TYPE_FRACTALNOISE: number; SVG_STITCHTYPE_STITCH: number; } interface TextTrackList { length: number; item(index: number): TextTrack; [index: number]: TextTrack; } declare var TextTrackList: { prototype: TextTrackList; new(): TextTrackList; } interface WindowAnimationTiming { animationStartTime: number; msAnimationStartTime: number; msCancelRequestAnimationFrame(handle: number): void; cancelAnimationFrame(handle: number): void; requestAnimationFrame(callback: FrameRequestCallback): number; msRequestAnimationFrame(callback: FrameRequestCallback): number; } interface SVGFEFuncGElement extends SVGComponentTransferFunctionElement { } declare var SVGFEFuncGElement: { prototype: SVGFEFuncGElement; new(): SVGFEFuncGElement; } interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { in1: SVGAnimatedString; type: SVGAnimatedEnumeration; values: SVGAnimatedNumberList; SVG_FECOLORMATRIX_TYPE_SATURATE: number; SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; SVG_FECOLORMATRIX_TYPE_MATRIX: number; SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; } declare var SVGFEColorMatrixElement: { prototype: SVGFEColorMatrixElement; new(): SVGFEColorMatrixElement; SVG_FECOLORMATRIX_TYPE_SATURATE: number; SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; SVG_FECOLORMATRIX_TYPE_MATRIX: number; SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; } interface Console { info(): void; info(message: any, ...optionalParams: any[]): void; profile(reportName?: string): bool; assert(): void; assert(test: bool): void; assert(test: bool, message: any, ...optionalParams: any[]): void; msIsIndependentlyComposed(element: Element): bool; clear(): bool; dir(): bool; dir(value: any, ...optionalParams: any[]): bool; warn(): void; warn(message: any, ...optionalParams: any[]): void; error(): void; error(message: any, ...optionalParams: any[]): void; log(): void; log(message: any, ...optionalParams: any[]): void; profileEnd(): bool; } declare var Console: { prototype: Console; new(): Console; } interface SVGFESpotLightElement extends SVGElement { pointsAtY: SVGAnimatedNumber; y: SVGAnimatedNumber; limitingConeAngle: SVGAnimatedNumber; specularExponent: SVGAnimatedNumber; x: SVGAnimatedNumber; pointsAtZ: SVGAnimatedNumber; z: SVGAnimatedNumber; pointsAtX: SVGAnimatedNumber; } declare var SVGFESpotLightElement: { prototype: SVGFESpotLightElement; new(): SVGFESpotLightElement; } interface DocumentVisibility { msHidden: bool; msVisibilityState: string; visibilityState: string; hidden: bool; } interface WindowBase64 { btoa(rawString: string): string; atob(encodedString: string): string; } interface IDBDatabase extends EventTarget { version: string; name: string; objectStoreNames: DOMStringList; onerror: (ev: ErrorEvent) => any; onabort: (ev: any) => any; createObjectStore(name: string, optionalParameters?: any): IDBObjectStore; close(): void; transaction(storeNames: any, mode?: string): IDBTransaction; deleteObjectStore(name: string): void; } declare var IDBDatabase: { prototype: IDBDatabase; new(): IDBDatabase; } interface MSProtocolsCollection { } declare var MSProtocolsCollection: { prototype: MSProtocolsCollection; new(): MSProtocolsCollection; } interface DOMStringList { length: number; contains(str: string): bool; item(index: number): string; [index: number]: string; } declare var DOMStringList: { prototype: DOMStringList; new(): DOMStringList; } interface CSSMultiColumnProperties { breakAfter: string; columnSpan: string; columnRule: string; columnFill: string; columnRuleStyle: string; breakBefore: string; columnCount: any; breakInside: string; columnWidth: any; columns: string; columnRuleColor: any; columnGap: any; columnRuleWidth: any; } interface IDBOpenDBRequest extends IDBRequest { onupgradeneeded: (ev: IDBVersionChangeEvent) => any; onblocked: (ev: Event) => any; } declare var IDBOpenDBRequest: { prototype: IDBOpenDBRequest; new(): IDBOpenDBRequest; } interface HTMLButtonElement { validationMessage: string; formTarget: string; willValidate: bool; formAction: string; autofocus: bool; validity: ValidityState; formNoValidate: string; formEnctype: string; formMethod: string; checkValidity(): bool; setCustomValidity(error: string): void; } interface HTMLProgressElement extends HTMLElement { value: number; max: number; position: number; form: HTMLFormElement; } declare var HTMLProgressElement: { prototype: HTMLProgressElement; new(): HTMLProgressElement; } interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { dy: SVGAnimatedNumber; in1: SVGAnimatedString; dx: SVGAnimatedNumber; } declare var SVGFEOffsetElement: { prototype: SVGFEOffsetElement; new(): SVGFEOffsetElement; } interface HTMLFormElement { autocomplete: string; noValidate: bool; checkValidity(): bool; } interface MSUnsafeFunctionCallback { (): any; } interface Document extends DocumentVisibility { } interface MessageEvent extends Event { ports: any; } interface HTMLScriptElement { async: bool; } interface HTMLMediaElement extends MSHTMLMediaElementExtensions { textTracks: TextTrackList; audioTracks: AudioTrackList; } interface TextTrack extends EventTarget { language: string; mode: number; readyState: string; activeCues: TextTrackCueList; cues: TextTrackCueList; oncuechange: (ev: Event) => any; kind: string; onload: (ev: any) => any; onerror: (ev: ErrorEvent) => any; label: string; ERROR: number; SHOWING: number; LOADING: number; LOADED: number; NONE: number; HIDDEN: number; DISABLED: number; } declare var TextTrack: { prototype: TextTrack; new(): TextTrack; ERROR: number; SHOWING: number; LOADING: number; LOADED: number; NONE: number; HIDDEN: number; DISABLED: number; } interface MediaQueryListListener { (mql: MediaQueryList): void; } interface IDBRequest extends EventTarget { source: any; onsuccess: (ev: Event) => any; error: DOMError; transaction: IDBTransaction; onerror: (ev: ErrorEvent) => any; readyState: string; result: any; } declare var IDBRequest: { prototype: IDBRequest; new(): IDBRequest; } interface MessagePort extends EventTarget { onmessage: (ev: any) => any; close(): void; postMessage(message: any, ports?: any): void; start(): void; } declare var MessagePort: { prototype: MessagePort; new(): MessagePort; } interface FileReader extends MSBaseReader { error: DOMError; readAsArrayBuffer(blob: Blob): void; readAsDataURL(blob: Blob): void; readAsText(blob: Blob, encoding?: string): void; } declare var FileReader: { prototype: FileReader; new (): FileReader; } interface Blob { type: string; size: number; msDetachStream(): any; slice(start?: number, end?: number, contentType?: string): Blob; msClose(): void; } declare var Blob: { prototype: Blob; new (): Blob; } interface ApplicationCache extends EventTarget { status: number; ondownloading: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; onupdateready: (ev: Event) => any; oncached: (ev: Event) => any; onobsolete: (ev: Event) => any; onerror: (ev: ErrorEvent) => any; onchecking: (ev: Event) => any; onnoupdate: (ev: Event) => any; swapCache(): void; abort(): void; update(): void; CHECKING: number; UNCACHED: number; UPDATEREADY: number; DOWNLOADING: number; IDLE: number; OBSOLETE: number; } declare var ApplicationCache: { prototype: ApplicationCache; new(): ApplicationCache; CHECKING: number; UNCACHED: number; UPDATEREADY: number; DOWNLOADING: number; IDLE: number; OBSOLETE: number; } interface MSHTMLVideoElementExtensions { msIsStereo3D: bool; msStereo3DPackingMode: string; onMSVideoOptimalLayoutChanged: (ev: any) => any; onMSVideoFrameStepCompleted: (ev: any) => any; msStereo3DRenderMode: string; msIsLayoutOptimalForPlayback: bool; msHorizontalMirror: bool; onMSVideoFormatChanged: (ev: any) => any; msZoom: bool; msInsertVideoEffect(activatableClassId: string, effectRequired: bool, config?: any): void; msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void; msFrameStep(forward: bool): void; } interface FrameRequestCallback { (time: number): void; } interface CSS3DTransformsProperties { perspective: string; msBackfaceVisibility: string; perspectiveOrigin: string; transformStyle: string; backfaceVisibility: string; msPerspectiveOrigin: string; msTransformStyle: string; msPerspective: string; } interface XMLHttpRequest { withCredentials: bool; } interface PopStateEvent extends Event { state: any; initPopStateEvent(typeArg: string, canBubbleArg: bool, cancelableArg: bool, stateArg: any): void; } declare var PopStateEvent: { prototype: PopStateEvent; new(): PopStateEvent; } interface CSSKeyframeRule extends CSSRule { keyText: string; style: CSSStyleDeclaration; } declare var CSSKeyframeRule: { prototype: CSSKeyframeRule; new(): CSSKeyframeRule; } interface CSSGridProperties { msGridRows: string; msGridColumnSpan: any; msGridRow: any; msGridRowSpan: any; msGridColumns: string; msGridColumnAlign: string; msGridRowAlign: string; msGridColumn: any; } interface MSFileSaver { msSaveBlob(blob: any, defaultName?: string): bool; msSaveOrOpenBlob(blob: any, defaultName?: string): bool; } interface MSStream { type: string; msDetachStream(): any; msClose(): void; } declare var MSStream: { prototype: MSStream; new(): MSStream; } interface MediaError extends MSMediaErrorExtensions { } interface HTMLFieldSetElement { validationMessage: string; validity: ValidityState; willValidate: bool; checkValidity(): bool; setCustomValidity(error: string): void; } interface MSBlobBuilder { append(data: any, endings?: string): void; getBlob(contentType?: string): Blob; } declare var MSBlobBuilder: { prototype: MSBlobBuilder; new (): MSBlobBuilder; } interface MSRangeExtensions { createContextualFragment(fragment: string): DocumentFragment; } interface HTMLElement { oncuechange: (ev: Event) => any; spellcheck: bool; classList: DOMTokenList; draggable: bool; } interface DataTransfer { types: DOMStringList; files: FileList; } interface DOMSettableTokenList extends DOMTokenList { value: string; } declare var DOMSettableTokenList: { prototype: DOMSettableTokenList; new(): DOMSettableTokenList; } interface IDBFactory { open(name: string, version?: number): IDBOpenDBRequest; cmp(first: any, second: any): number; deleteDatabase(name: string): IDBOpenDBRequest; } declare var IDBFactory: { prototype: IDBFactory; new(): IDBFactory; } interface Range extends MSRangeExtensions { } interface HTMLObjectElement { validationMessage: string; validity: ValidityState; willValidate: bool; checkValidity(): bool; setCustomValidity(error: string): void; } interface MSPointerEvent extends MouseEvent { width: number; rotation: number; pressure: number; pointerType: number; isPrimary: bool; tiltY: number; height: number; intermediatePoints: any; currentPoint: any; tiltX: number; hwTimestamp: number; pointerId: number; initPointerEvent(typeArg: string, canBubbleArg: bool, cancelableArg: bool, viewArg: AbstractView, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: bool, altKeyArg: bool, shiftKeyArg: bool, metaKeyArg: bool, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: number, hwTimestampArg: number, isPrimary: bool): void; getCurrentPoint(element: Element): void; getIntermediatePoints(element: Element): void; MSPOINTER_TYPE_PEN: number; MSPOINTER_TYPE_MOUSE: number; MSPOINTER_TYPE_TOUCH: number; } declare var MSPointerEvent: { prototype: MSPointerEvent; new(): MSPointerEvent; MSPOINTER_TYPE_PEN: number; MSPOINTER_TYPE_MOUSE: number; MSPOINTER_TYPE_TOUCH: number; } interface CSSTextProperties { textShadow: string; msHyphenateLimitLines: any; msHyphens: string; msHyphenateLimitChars: string; msHyphenateLimitZone: any; } interface CSS2DTransformsProperties { transform: string; transformOrigin: string; } interface DOMException { name: string; INVALID_NODE_TYPE_ERR: number; DATA_CLONE_ERR: number; TIMEOUT_ERR: number; } //declare var DOMException: { // INVALID_NODE_TYPE_ERR: number; // DATA_CLONE_ERR: number; // TIMEOUT_ERR: number; //} interface MSCSSHighContrastProperties { msHighContrastAdjust: string; } interface MSManipulationEvent extends UIEvent { lastState: number; currentState: number; initMSManipulationEvent(typeArg: string, canBubbleArg: bool, cancelableArg: bool, viewArg: AbstractView, detailArg: number, lastState: number, currentState: number): void; MS_MANIPULATION_STATE_STOPPED: number; MS_MANIPULATION_STATE_ACTIVE: number; MS_MANIPULATION_STATE_INERTIA: number; } declare var MSManipulationEvent: { prototype: MSManipulationEvent; new(): MSManipulationEvent; MS_MANIPULATION_STATE_STOPPED: number; MS_MANIPULATION_STATE_ACTIVE: number; MS_MANIPULATION_STATE_INERTIA: number; } interface FormData { append(name: any, value: any, blobName?: string): void; } declare var FormData: { prototype: FormData; new (): FormData; } interface MSHTMLImageElementExtensions { msPlayToPrimary: bool; msPlayToDisabled: bool; msPlayToSource: any; } declare var MSHTMLImageElementExtensions: { prototype: MSHTMLImageElementExtensions; new(): MSHTMLImageElementExtensions; } interface MSHTMLMediaElementExtensions { msAudioCategory: string; msRealTime: bool; msPlayToPrimary: bool; msPlayToDisabled: bool; msPlayToSource: any; msAudioDeviceType: string; msClearEffects(): void; msSetMediaProtectionManager(mediaProtectionManager?: any): void; msInsertAudioEffect(activatableClassId: string, effectRequired: bool, config?: any): void; } interface SVGFEImageElement extends SVGElement, SVGLangSpace, SVGFilterPrimitiveStandardAttributes, SVGURIReference { preserveAspectRatio: SVGAnimatedPreserveAspectRatio; } declare var SVGFEImageElement: { prototype: SVGFEImageElement; new(): SVGFEImageElement; } interface HTMLDataListElement extends HTMLElement { options: HTMLCollection; } declare var HTMLDataListElement: { prototype: HTMLDataListElement; new(): HTMLDataListElement; } interface AbstractWorker extends EventTarget { onerror: (ev: ErrorEvent) => any; } interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { operator: SVGAnimatedEnumeration; in2: SVGAnimatedString; k2: SVGAnimatedNumber; k1: SVGAnimatedNumber; k3: SVGAnimatedNumber; in1: SVGAnimatedString; k4: SVGAnimatedNumber; SVG_FECOMPOSITE_OPERATOR_OUT: number; SVG_FECOMPOSITE_OPERATOR_OVER: number; SVG_FECOMPOSITE_OPERATOR_XOR: number; SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; SVG_FECOMPOSITE_OPERATOR_IN: number; SVG_FECOMPOSITE_OPERATOR_ATOP: number; } declare var SVGFECompositeElement: { prototype: SVGFECompositeElement; new(): SVGFECompositeElement; SVG_FECOMPOSITE_OPERATOR_OUT: number; SVG_FECOMPOSITE_OPERATOR_OVER: number; SVG_FECOMPOSITE_OPERATOR_XOR: number; SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; SVG_FECOMPOSITE_OPERATOR_IN: number; SVG_FECOMPOSITE_OPERATOR_ATOP: number; } interface ValidityState { customError: bool; valueMissing: bool; stepMismatch: bool; rangeUnderflow: bool; rangeOverflow: bool; typeMismatch: bool; patternMismatch: bool; tooLong: bool; valid: bool; } declare var ValidityState: { prototype: ValidityState; new(): ValidityState; } interface HTMLVideoElement extends MSHTMLVideoElementExtensions { } interface HTMLTrackElement extends HTMLElement { kind: string; src: string; srclang: string; track: TextTrack; label: string; defaul: bool; } declare var HTMLTrackElement: { prototype: HTMLTrackElement; new(): HTMLTrackElement; } interface MSApp { createFileFromStorageFile(storageFile: any): File; createBlobFromRandomAccessStream(type: string, seeker: any): Blob; createStreamFromInputStream(type: string, inputStream: any): MSStream; terminateApp(exceptionObject: any): void; createDataPackage(object: any): any; execUnsafeLocalFunction(unsafeFunction: MSUnsafeFunctionCallback): any; getHtmlPrintDocumentSource(htmlDoc: any, printTemplate?: string): any; addPublicLocalApplicationUri(uri: string): void; createDataPackageFromSelection(): any; } declare var MSApp: MSApp; interface MSXMLHttpRequestExtensions { response: any; onprogress: (ev: ProgressEvent) => any; onabort: (ev: any) => any; responseType: string; onloadend: (ev: ProgressEvent) => any; upload: XMLHttpRequestEventTarget; onerror: (ev: ErrorEvent) => any; onloadstart: (ev: any) => any; } declare var MSXMLHttpRequestExtensions: { prototype: MSXMLHttpRequestExtensions; new(): MSXMLHttpRequestExtensions; } interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { kernelUnitLengthY: SVGAnimatedNumber; surfaceScale: SVGAnimatedNumber; in1: SVGAnimatedString; kernelUnitLengthX: SVGAnimatedNumber; diffuseConstant: SVGAnimatedNumber; } declare var SVGFEDiffuseLightingElement: { prototype: SVGFEDiffuseLightingElement; new(): SVGFEDiffuseLightingElement; } interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { in1: SVGAnimatedString; } declare var SVGFEComponentTransferElement: { prototype: SVGFEComponentTransferElement; new(): SVGFEComponentTransferElement; } interface MSCSSMatrix { m24: number; m34: number; a: number; d: number; m32: number; m41: number; m11: number; f: number; e: number; m23: number; m14: number; m33: number; m22: number; m21: number; c: number; m12: number; b: number; m42: number; m31: number; m43: number; m13: number; m44: number; multiply(secondMatrix: MSCSSMatrix): MSCSSMatrix; skewY(angle: number): MSCSSMatrix; setMatrixValue(value: string): void; inverse(): MSCSSMatrix; rotateAxisAngle(x: number, y: number, z: number, angle: number): MSCSSMatrix; toString(): string; rotate(angleX: number, angleY?: number, angleZ?: number): MSCSSMatrix; translate(x: number, y: number, z?: number): MSCSSMatrix; scale(scaleX: number, scaleY?: number, scaleZ?: number): MSCSSMatrix; skewX(angle: number): MSCSSMatrix; } declare var MSCSSMatrix: { prototype: MSCSSMatrix; new (text?: string): MSCSSMatrix; } interface Worker extends AbstractWorker { onmessage: (ev: any) => any; postMessage(message: any, ports?: any): void; terminate(): void; } declare var Worker: { prototype: Worker; new (stringUrl: string): Worker; } interface HTMLIFrameElement { sandbox: DOMSettableTokenList; } interface MSMediaErrorExtensions { msExtendedCode: number; } interface MSNavigatorAbilities { msProtocols: MSProtocolsCollection; msMaxTouchPoints: number; msPointerEnabled: bool; msManipulationViewsEnabled: bool; } declare var MSNavigatorAbilities: { prototype: MSNavigatorAbilities; new(): MSNavigatorAbilities; } declare var onpopstate: (ev: PopStateEvent) => any; declare var applicationCache: ApplicationCache; declare function matchMedia(mediaQuery: string): MediaQueryList; declare function msMatchMedia(mediaQuery: string): MediaQueryList; declare var animationStartTime: number; declare var msAnimationStartTime: number; declare function msCancelRequestAnimationFrame(handle: number): void; declare function cancelAnimationFrame(handle: number): void; declare function requestAnimationFrame(callback: FrameRequestCallback): number; declare function msRequestAnimationFrame(callback: FrameRequestCallback): number; declare function btoa(rawString: string): string; declare function atob(encodedString: string): string; declare var msIndexedDB: IDBFactory; declare var indexedDB: IDBFactory; declare var console: Console; ///////////////////////////// /// WorkerGlobalScope APIs ///////////////////////////// // TODO: These are only available in a Web Worker - should be in a seperate lib file declare function importScripts(...urls: string[]): void; ///////////////////////////// /// Windows Script Host APIS ///////////////////////////// declare var ActiveXObject: { new (s: string): any; }; interface ITextWriter { Write(s: string): void; WriteLine(s: string): void; Close(): void; } declare var WScript : { Echo(s); StdErr: ITextWriter; StdOut: ITextWriter; Arguments: { length: number; Item(n: number): string; }; ScriptFullName: string; Quit(exitCode?: number); }
jonathanmarvens/typescript
typings/lib.d.ts
TypeScript
apache-2.0
254,107
/* * Copyright 2017 StreamSets Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.streamsets.pipeline.stage.destination.kudu; import org.junit.Test; import org.junit.Assert; public class TestKuduOperationType { @Test public void TestconvertToIntCode() throws Exception { int insert = KuduOperationType.convertToIntCode("1"); Assert.assertEquals(1, insert); int delete = KuduOperationType.convertToIntCode("2"); Assert.assertEquals(2, delete); int unsupported1 = KuduOperationType.convertToIntCode("10"); Assert.assertEquals(-1, unsupported1); int unsupported2 = KuduOperationType.convertToIntCode("-10"); Assert.assertEquals(-1, unsupported2); try { KuduOperationType.convertToIntCode("insert"); Assert.fail(); } catch (NumberFormatException ex) { // pass } try { KuduOperationType.convertToIntCode("0.5"); Assert.fail(); } catch (NumberFormatException ex) { // pass } } }
kunickiaj/datacollector
kudu-protolib/src/test/java/com/streamsets/pipeline/stage/destination/kudu/TestKuduOperationType.java
Java
apache-2.0
1,508
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.syncope.common.lib.to; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.apache.syncope.common.lib.AbstractBaseBean; @XmlRootElement(name = "provision") @XmlType public class ProvisionTO extends AbstractBaseBean implements EntityTO { private static final long serialVersionUID = 8298910216218007927L; private String key; private String anyType; private String objectClass; private final List<String> auxClasses = new ArrayList<>(); private String syncToken; private MappingTO mapping; private final List<String> virSchemas = new ArrayList<>(); @Override public String getKey() { return key; } @Override public void setKey(final String key) { this.key = key; } public String getAnyType() { return anyType; } public void setAnyType(final String anyType) { this.anyType = anyType; } public String getObjectClass() { return objectClass; } public void setObjectClass(final String objectClass) { this.objectClass = objectClass; } @XmlElementWrapper(name = "auxClasses") @XmlElement(name = "class") @JsonProperty("auxClasses") public List<String> getAuxClasses() { return auxClasses; } public String getSyncToken() { return syncToken; } public void setSyncToken(final String syncToken) { this.syncToken = syncToken; } public MappingTO getMapping() { return mapping; } public void setMapping(final MappingTO mapping) { this.mapping = mapping; } @XmlElementWrapper(name = "virSchemas") @XmlElement(name = "virSchema") @JsonProperty("virSchemas") public List<String> getVirSchemas() { return virSchemas; } }
tmess567/syncope
common/lib/src/main/java/org/apache/syncope/common/lib/to/ProvisionTO.java
Java
apache-2.0
2,858
// Copyright 2007-2015 Chris Patterson, Dru Sellers, Travis Smith, et. al. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software distributed // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR // CONDITIONS OF ANY KIND, either express or implied. See the License for the // specific language governing permissions and limitations under the License. namespace MassTransit { using System; using System.Runtime.Serialization; [Serializable] public class CommandException : MassTransitException { public CommandException() { } public CommandException(string message) : base(message) { } public CommandException(string message, Exception innerException) : base(message, innerException) { } protected CommandException(SerializationInfo info, StreamingContext context) : base(info, context) { } } }
jacobpovar/MassTransit
src/MassTransit/Exceptions/CommandException.cs
C#
apache-2.0
1,294
"""Debounce helper.""" from __future__ import annotations import asyncio from collections.abc import Awaitable, Callable from logging import Logger from typing import Any from homeassistant.core import HassJob, HomeAssistant, callback class Debouncer: """Class to rate limit calls to a specific command.""" def __init__( self, hass: HomeAssistant, logger: Logger, *, cooldown: float, immediate: bool, function: Callable[..., Awaitable[Any]] | None = None, ) -> None: """Initialize debounce. immediate: indicate if the function needs to be called right away and wait <cooldown> until executing next invocation. function: optional and can be instantiated later. """ self.hass = hass self.logger = logger self._function = function self.cooldown = cooldown self.immediate = immediate self._timer_task: asyncio.TimerHandle | None = None self._execute_at_end_of_timer: bool = False self._execute_lock = asyncio.Lock() self._job: HassJob | None = None if function is None else HassJob(function) @property def function(self) -> Callable[..., Awaitable[Any]] | None: """Return the function being wrapped by the Debouncer.""" return self._function @function.setter def function(self, function: Callable[..., Awaitable[Any]]) -> None: """Update the function being wrapped by the Debouncer.""" self._function = function if self._job is None or function != self._job.target: self._job = HassJob(function) async def async_call(self) -> None: """Call the function.""" assert self._job is not None if self._timer_task: if not self._execute_at_end_of_timer: self._execute_at_end_of_timer = True return # Locked means a call is in progress. Any call is good, so abort. if self._execute_lock.locked(): return if not self.immediate: self._execute_at_end_of_timer = True self._schedule_timer() return async with self._execute_lock: # Abort if timer got set while we're waiting for the lock. if self._timer_task: return task = self.hass.async_run_hass_job(self._job) if task: await task self._schedule_timer() async def _handle_timer_finish(self) -> None: """Handle a finished timer.""" assert self._job is not None self._timer_task = None if not self._execute_at_end_of_timer: return self._execute_at_end_of_timer = False # Locked means a call is in progress. Any call is good, so abort. if self._execute_lock.locked(): return async with self._execute_lock: # Abort if timer got set while we're waiting for the lock. if self._timer_task: return # type: ignore try: task = self.hass.async_run_hass_job(self._job) if task: await task except Exception: # pylint: disable=broad-except self.logger.exception("Unexpected exception from %s", self.function) self._schedule_timer() @callback def async_cancel(self) -> None: """Cancel any scheduled call.""" if self._timer_task: self._timer_task.cancel() self._timer_task = None self._execute_at_end_of_timer = False @callback def _schedule_timer(self) -> None: """Schedule a timer.""" self._timer_task = self.hass.loop.call_later( self.cooldown, lambda: self.hass.async_create_task(self._handle_timer_finish()), )
jawilson/home-assistant
homeassistant/helpers/debounce.py
Python
apache-2.0
3,910