code
stringlengths
3
1.05M
repo_name
stringlengths
4
116
path
stringlengths
3
942
language
stringclasses
30 values
license
stringclasses
15 values
size
int32
3
1.05M
/* * This file is part of the MIAMI framework. For copyright information, see * the LICENSE file in the MIAMI root folder. */ /* * File: TemplateExecutionUnit.h * Author: Gabriel Marin, [email protected] * * Defines data structure to hold information about the use pattern of an * execution unit type as part of an instruction execution template. */ #ifndef _TEMPLATE_EXECUTION_UNIT_H_ #define _TEMPLATE_EXECUTION_UNIT_H_ #include <stdio.h> #include <stdlib.h> #include "BitSet.h" #include <list> namespace MIAMI { #define EXACT_MATCH_ALLOCATE 0 class TemplateExecutionUnit { public: TemplateExecutionUnit (int _unit, BitSet* _umask, int _count); ~TemplateExecutionUnit () { if (unit_mask) delete unit_mask; } inline BitSet* UnitsMask () const { return (unit_mask); } inline int Count () const { return (count); } int index; int count; BitSet *unit_mask; }; typedef std::list<TemplateExecutionUnit*> TEUList; } /* namespace MIAMI */ #endif
gmarin13/MIAMI
src/Scheduler/TemplateExecutionUnit.h
C
bsd-3-clause
1,012
# # product import logging from django.contrib import messages from django.contrib.auth.decorators import user_passes_test from django.urls import reverse from django.http import HttpResponseRedirect from django.shortcuts import render from dojo.utils import add_breadcrumb from dojo.forms import ToolTypeForm from dojo.models import Tool_Type logger = logging.getLogger(__name__) @user_passes_test(lambda u: u.is_staff) def new_tool_type(request): if request.method == 'POST': tform = ToolTypeForm(request.POST, instance=Tool_Type()) if tform.is_valid(): tform.save() messages.add_message(request, messages.SUCCESS, 'Tool Type Configuration Successfully Created.', extra_tags='alert-success') return HttpResponseRedirect(reverse('tool_type', )) else: tform = ToolTypeForm() add_breadcrumb(title="New Tool Type Configuration", top_level=False, request=request) return render(request, 'dojo/new_tool_type.html', {'tform': tform}) @user_passes_test(lambda u: u.is_staff) def edit_tool_type(request, ttid): tool_type = Tool_Type.objects.get(pk=ttid) if request.method == 'POST': tform = ToolTypeForm(request.POST, instance=tool_type) if tform.is_valid(): tform.save() messages.add_message(request, messages.SUCCESS, 'Tool Type Configuration Successfully Updated.', extra_tags='alert-success') return HttpResponseRedirect(reverse('tool_type', )) else: tform = ToolTypeForm(instance=tool_type) add_breadcrumb(title="Edit Tool Type Configuration", top_level=False, request=request) return render(request, 'dojo/edit_tool_type.html', { 'tform': tform, }) @user_passes_test(lambda u: u.is_staff) def tool_type(request): confs = Tool_Type.objects.all().order_by('name') add_breadcrumb(title="Tool Type List", top_level=not len(request.GET), request=request) return render(request, 'dojo/tool_type.html', {'confs': confs, })
rackerlabs/django-DefectDojo
dojo/tool_type/views.py
Python
bsd-3-clause
2,344
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <stddef.h> #include <stdint.h> #include "base/bind.h" #include "base/macros.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/strings/string_number_conversions.h" #include "media/base/media_log.h" #include "media/base/mock_filters.h" #include "media/base/test_helpers.h" #include "media/blink/buffered_data_source.h" #include "media/blink/mock_webframeclient.h" #include "media/blink/mock_weburlloader.h" #include "media/blink/multibuffer_data_source.h" #include "media/blink/multibuffer_reader.h" #include "media/blink/resource_multibuffer_data_provider.h" #include "media/blink/test_response_generator.h" #include "third_party/WebKit/public/platform/WebURLResponse.h" #include "third_party/WebKit/public/web/WebLocalFrame.h" #include "third_party/WebKit/public/web/WebView.h" using ::testing::_; using ::testing::Assign; using ::testing::DoAll; using ::testing::Invoke; using ::testing::InvokeWithoutArgs; using ::testing::InSequence; using ::testing::NiceMock; using ::testing::StrictMock; using blink::WebLocalFrame; using blink::WebString; using blink::WebURLLoader; using blink::WebURLResponse; using blink::WebView; namespace media { class TestResourceMultiBuffer; class TestMultiBufferDataProvider; std::set<TestMultiBufferDataProvider*> test_data_providers; class TestMultiBufferDataProvider : public ResourceMultiBufferDataProvider { public: TestMultiBufferDataProvider(UrlData* url_data, MultiBuffer::BlockId pos) : ResourceMultiBufferDataProvider(url_data, pos), loading_(false) { CHECK(test_data_providers.insert(this).second); } ~TestMultiBufferDataProvider() override { CHECK_EQ(static_cast<size_t>(1), test_data_providers.erase(this)); } void Start() override { // Create a mock active loader. // Keep track of active loading state via loadAsynchronously() and cancel(). NiceMock<MockWebURLLoader>* url_loader = new NiceMock<MockWebURLLoader>(); ON_CALL(*url_loader, cancel()) .WillByDefault(Invoke([this]() { // Check that we have not been destroyed first. if (test_data_providers.find(this) != test_data_providers.end()) { this->loading_ = false; } })); loading_ = true; active_loader_.reset( new ActiveLoader(std::unique_ptr<WebURLLoader>(url_loader))); if (!on_start_.is_null()) { on_start_.Run(); } } bool loading() const { return loading_; } void RunOnStart(base::Closure cb) { on_start_ = cb; } private: bool loading_; base::Closure on_start_; }; class TestUrlData; class TestResourceMultiBuffer : public ResourceMultiBuffer { public: explicit TestResourceMultiBuffer(UrlData* url_data, int shift) : ResourceMultiBuffer(url_data, shift) {} std::unique_ptr<MultiBuffer::DataProvider> CreateWriter( const BlockId& pos) override { TestMultiBufferDataProvider* ret = new TestMultiBufferDataProvider(url_data_, pos); ret->Start(); return std::unique_ptr<MultiBuffer::DataProvider>(ret); } // TODO: Make these global TestMultiBufferDataProvider* GetProvider() { EXPECT_EQ(test_data_providers.size(), 1U); if (test_data_providers.size() != 1) return nullptr; return *test_data_providers.begin(); } TestMultiBufferDataProvider* GetProvider_allownull() { EXPECT_LE(test_data_providers.size(), 1U); if (test_data_providers.size() != 1U) return nullptr; return *test_data_providers.begin(); } bool HasProvider() const { return test_data_providers.size() == 1U; } bool loading() { if (test_data_providers.empty()) return false; return GetProvider()->loading(); } }; class TestUrlData : public UrlData { public: TestUrlData(const GURL& url, CORSMode cors_mode, const base::WeakPtr<UrlIndex>& url_index) : UrlData(url, cors_mode, url_index), block_shift_(url_index->block_shift()) {} ResourceMultiBuffer* multibuffer() override { if (!test_multibuffer_.get()) { test_multibuffer_.reset(new TestResourceMultiBuffer(this, block_shift_)); } return test_multibuffer_.get(); } TestResourceMultiBuffer* test_multibuffer() { if (!test_multibuffer_.get()) { test_multibuffer_.reset(new TestResourceMultiBuffer(this, block_shift_)); } return test_multibuffer_.get(); } protected: ~TestUrlData() override {} const int block_shift_; std::unique_ptr<TestResourceMultiBuffer> test_multibuffer_; }; class TestUrlIndex : public UrlIndex { public: explicit TestUrlIndex(blink::WebFrame* frame) : UrlIndex(frame) {} scoped_refptr<UrlData> NewUrlData(const GURL& url, UrlData::CORSMode cors_mode) override { last_url_data_ = new TestUrlData(url, cors_mode, weak_factory_.GetWeakPtr()); return last_url_data_; } scoped_refptr<TestUrlData> last_url_data() { EXPECT_TRUE(last_url_data_); return last_url_data_; } private: scoped_refptr<TestUrlData> last_url_data_; }; class MockBufferedDataSourceHost : public BufferedDataSourceHost { public: MockBufferedDataSourceHost() {} virtual ~MockBufferedDataSourceHost() {} MOCK_METHOD1(SetTotalBytes, void(int64_t total_bytes)); MOCK_METHOD2(AddBufferedByteRange, void(int64_t start, int64_t end)); private: DISALLOW_COPY_AND_ASSIGN(MockBufferedDataSourceHost); }; class MockMultibufferDataSource : public MultibufferDataSource { public: MockMultibufferDataSource( const GURL& url, UrlData::CORSMode cors_mode, const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, linked_ptr<UrlIndex> url_index, WebLocalFrame* frame, BufferedDataSourceHost* host) : MultibufferDataSource( url, cors_mode, task_runner, url_index, frame, new media::MediaLog(), host, base::Bind(&MockMultibufferDataSource::set_downloading, base::Unretained(this))), downloading_(false) {} bool downloading() { return downloading_; } void set_downloading(bool downloading) { downloading_ = downloading; } bool range_supported() { return url_data_->range_supported(); } private: // Whether the resource is downloading or deferred. bool downloading_; DISALLOW_COPY_AND_ASSIGN(MockMultibufferDataSource); }; static const int64_t kFileSize = 5000000; static const int64_t kFarReadPosition = 3997696; static const int kDataSize = 32 << 10; static const char kHttpUrl[] = "http://localhost/foo.webm"; static const char kFileUrl[] = "file:///tmp/bar.webm"; static const char kHttpDifferentPathUrl[] = "http://localhost/bar.webm"; static const char kHttpDifferentOriginUrl[] = "http://127.0.0.1/foo.webm"; class MultibufferDataSourceTest : public testing::Test { public: MultibufferDataSourceTest() : view_(WebView::create(nullptr, blink::WebPageVisibilityStateVisible)), frame_( WebLocalFrame::create(blink::WebTreeScopeType::Document, &client_)), preload_(MultibufferDataSource::AUTO), url_index_(make_linked_ptr(new TestUrlIndex(frame_))) { view_->setMainFrame(frame_); } virtual ~MultibufferDataSourceTest() { view_->close(); frame_->close(); } MOCK_METHOD1(OnInitialize, void(bool)); void InitializeWithCORS(const char* url, bool expected, UrlData::CORSMode cors_mode) { GURL gurl(url); data_source_.reset(new MockMultibufferDataSource( gurl, cors_mode, message_loop_.task_runner(), url_index_, view_->mainFrame()->toWebLocalFrame(), &host_)); data_source_->SetPreload(preload_); response_generator_.reset(new TestResponseGenerator(gurl, kFileSize)); EXPECT_CALL(*this, OnInitialize(expected)); data_source_->Initialize(base::Bind( &MultibufferDataSourceTest::OnInitialize, base::Unretained(this))); base::RunLoop().RunUntilIdle(); // Not really loading until after OnInitialize is called. EXPECT_EQ(data_source_->downloading(), false); } void Initialize(const char* url, bool expected) { InitializeWithCORS(url, expected, UrlData::CORS_UNSPECIFIED); } // Helper to initialize tests with a valid 200 response. void InitializeWith200Response() { Initialize(kHttpUrl, true); EXPECT_CALL(host_, SetTotalBytes(response_generator_->content_length())); Respond(response_generator_->Generate200()); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); ReceiveData(kDataSize); } // Helper to initialize tests with a valid 206 response. void InitializeWith206Response() { Initialize(kHttpUrl, true); EXPECT_CALL(host_, SetTotalBytes(response_generator_->content_length())); Respond(response_generator_->Generate206(0)); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); ReceiveData(kDataSize); } // Helper to initialize tests with a valid file:// response. void InitializeWithFileResponse() { Initialize(kFileUrl, true); EXPECT_CALL(host_, SetTotalBytes(kFileSize)); EXPECT_CALL(host_, AddBufferedByteRange(0, kFileSize)); Respond(response_generator_->GenerateFileResponse(0)); ReceiveData(kDataSize); } // Stops any active loaders and shuts down the data source. // // This typically happens when the page is closed and for our purposes is // appropriate to do when tearing down a test. void Stop() { if (loading()) { data_provider()->didFail(url_loader(), response_generator_->GenerateError()); base::RunLoop().RunUntilIdle(); } data_source_->Stop(); base::RunLoop().RunUntilIdle(); } void Respond(const WebURLResponse& response) { EXPECT_TRUE(url_loader()); if (!active_loader()) return; data_provider()->didReceiveResponse(url_loader(), response); base::RunLoop().RunUntilIdle(); } void ReceiveData(int size) { EXPECT_TRUE(url_loader()); if (!url_loader()) return; std::unique_ptr<char[]> data(new char[size]); memset(data.get(), 0xA5, size); // Arbitrary non-zero value. data_provider()->didReceiveData(url_loader(), data.get(), size, size, size); base::RunLoop().RunUntilIdle(); } void FinishLoading() { EXPECT_TRUE(url_loader()); if (!url_loader()) return; data_provider()->didFinishLoading(url_loader(), 0, -1); base::RunLoop().RunUntilIdle(); } void FailLoading() { data_provider()->didFail(url_loader(), response_generator_->GenerateError()); base::RunLoop().RunUntilIdle(); } void Restart() { EXPECT_TRUE(data_provider()); EXPECT_FALSE(active_loader_allownull()); if (!data_provider()) return; data_provider()->Start(); } MOCK_METHOD1(ReadCallback, void(int size)); void ReadAt(int64_t position, int64_t howmuch = kDataSize) { data_source_->Read(position, howmuch, buffer_, base::Bind(&MultibufferDataSourceTest::ReadCallback, base::Unretained(this))); base::RunLoop().RunUntilIdle(); } void ExecuteMixedResponseSuccessTest(const WebURLResponse& response1, const WebURLResponse& response2) { EXPECT_CALL(host_, SetTotalBytes(kFileSize)); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2)); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); EXPECT_CALL(*this, ReadCallback(kDataSize)).Times(2); Respond(response1); ReceiveData(kDataSize); ReadAt(0); EXPECT_TRUE(loading()); FinishLoading(); Restart(); ReadAt(kDataSize); Respond(response2); ReceiveData(kDataSize); FinishLoading(); Stop(); } void ExecuteMixedResponseFailureTest(const WebURLResponse& response1, const WebURLResponse& response2) { EXPECT_CALL(host_, SetTotalBytes(kFileSize)); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); EXPECT_CALL(*this, ReadCallback(kDataSize)); // Stop() will also cause the readback to be called with kReadError, but // we want to make sure it was called before Stop(). bool failed_ = false; EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError)) .WillOnce(Assign(&failed_, true)); Respond(response1); ReceiveData(kDataSize); ReadAt(0); EXPECT_TRUE(loading()); FinishLoading(); Restart(); ReadAt(kDataSize); Respond(response2); EXPECT_TRUE(failed_); Stop(); } void CheckCapacityDefer() { EXPECT_EQ(2 << 20, preload_low()); EXPECT_EQ(3 << 20, preload_high()); } void CheckReadThenDefer() { EXPECT_EQ(0, preload_low()); EXPECT_EQ(0, preload_high()); } void CheckNeverDefer() { EXPECT_EQ(1LL << 40, preload_low()); EXPECT_EQ(1LL << 40, preload_high()); } // Accessors for private variables on |data_source_|. MultiBufferReader* loader() { return data_source_->reader_.get(); } TestResourceMultiBuffer* multibuffer() { return url_index_->last_url_data()->test_multibuffer(); } TestMultiBufferDataProvider* data_provider() { return multibuffer()->GetProvider(); } ActiveLoader* active_loader() { EXPECT_TRUE(data_provider()); if (!data_provider()) return nullptr; return data_provider()->active_loader_.get(); } ActiveLoader* active_loader_allownull() { TestMultiBufferDataProvider* data_provider = multibuffer()->GetProvider_allownull(); if (!data_provider) return nullptr; return data_provider->active_loader_.get(); } WebURLLoader* url_loader() { EXPECT_TRUE(active_loader()); if (!active_loader()) return nullptr; return active_loader()->loader_.get(); } bool loading() { return multibuffer()->loading(); } MultibufferDataSource::Preload preload() { return data_source_->preload_; } void set_preload(MultibufferDataSource::Preload preload) { preload_ = preload; } int64_t preload_high() { CHECK(loader()); return loader()->preload_high(); } int64_t preload_low() { CHECK(loader()); return loader()->preload_low(); } int data_source_bitrate() { return data_source_->bitrate_; } double data_source_playback_rate() { return data_source_->playback_rate_; } bool is_local_source() { return data_source_->assume_fully_buffered(); } void set_might_be_reused_from_cache_in_future(bool value) { data_source_->url_data_->set_cacheable(value); } protected: MockWebFrameClient client_; WebView* view_; WebLocalFrame* frame_; MultibufferDataSource::Preload preload_; base::MessageLoop message_loop_; linked_ptr<TestUrlIndex> url_index_; std::unique_ptr<MockMultibufferDataSource> data_source_; std::unique_ptr<TestResponseGenerator> response_generator_; StrictMock<MockBufferedDataSourceHost> host_; // Used for calling MultibufferDataSource::Read(). uint8_t buffer_[kDataSize * 2]; DISALLOW_COPY_AND_ASSIGN(MultibufferDataSourceTest); }; TEST_F(MultibufferDataSourceTest, Range_Supported) { InitializeWith206Response(); EXPECT_TRUE(loading()); EXPECT_FALSE(data_source_->IsStreaming()); Stop(); } TEST_F(MultibufferDataSourceTest, Range_InstanceSizeUnknown) { Initialize(kHttpUrl, true); Respond(response_generator_->Generate206( 0, TestResponseGenerator::kNoContentRangeInstanceSize)); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); ReceiveData(kDataSize); EXPECT_TRUE(loading()); EXPECT_TRUE(data_source_->IsStreaming()); Stop(); } TEST_F(MultibufferDataSourceTest, Range_NotFound) { Initialize(kHttpUrl, false); Respond(response_generator_->Generate404()); EXPECT_FALSE(loading()); Stop(); } TEST_F(MultibufferDataSourceTest, Range_NotSupported) { InitializeWith200Response(); EXPECT_TRUE(loading()); EXPECT_TRUE(data_source_->IsStreaming()); Stop(); } TEST_F(MultibufferDataSourceTest, Range_NotSatisfiable) { Initialize(kHttpUrl, true); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); Respond(response_generator_->GenerateResponse(416)); EXPECT_FALSE(loading()); Stop(); } // Special carve-out for Apache versions that choose to return a 200 for // Range:0- ("because it's more efficient" than a 206) TEST_F(MultibufferDataSourceTest, Range_SupportedButReturned200) { Initialize(kHttpUrl, true); EXPECT_CALL(host_, SetTotalBytes(response_generator_->content_length())); WebURLResponse response = response_generator_->Generate200(); response.setHTTPHeaderField(WebString::fromUTF8("Accept-Ranges"), WebString::fromUTF8("bytes")); Respond(response); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); ReceiveData(kDataSize); EXPECT_TRUE(loading()); EXPECT_FALSE(data_source_->IsStreaming()); Stop(); } TEST_F(MultibufferDataSourceTest, Range_MissingContentRange) { Initialize(kHttpUrl, false); Respond(response_generator_->Generate206( 0, TestResponseGenerator::kNoContentRange)); EXPECT_FALSE(loading()); Stop(); } TEST_F(MultibufferDataSourceTest, Range_MissingContentLength) { Initialize(kHttpUrl, true); // It'll manage without a Content-Length response. EXPECT_CALL(host_, SetTotalBytes(response_generator_->content_length())); Respond(response_generator_->Generate206( 0, TestResponseGenerator::kNoContentLength)); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); ReceiveData(kDataSize); EXPECT_TRUE(loading()); EXPECT_FALSE(data_source_->IsStreaming()); Stop(); } TEST_F(MultibufferDataSourceTest, Range_WrongContentRange) { Initialize(kHttpUrl, false); // Now it's done and will fail. Respond(response_generator_->Generate206(1337)); EXPECT_FALSE(loading()); Stop(); } // Test the case where the initial response from the server indicates that // Range requests are supported, but a later request prove otherwise. TEST_F(MultibufferDataSourceTest, Range_ServerLied) { InitializeWith206Response(); // Read causing a new request to be made -- we'll expect it to error. ReadAt(kFarReadPosition); // Return a 200 in response to a range request. EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError)); Respond(response_generator_->Generate200()); EXPECT_FALSE(loading()); Stop(); } TEST_F(MultibufferDataSourceTest, Http_AbortWhileReading) { InitializeWith206Response(); // Make sure there's a pending read -- we'll expect it to error. ReadAt(kFileSize); // Abort!!! EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError)); data_source_->Abort(); base::RunLoop().RunUntilIdle(); EXPECT_FALSE(loading()); Stop(); } TEST_F(MultibufferDataSourceTest, File_AbortWhileReading) { InitializeWithFileResponse(); // Make sure there's a pending read -- we'll expect it to error. ReadAt(kFileSize); // Abort!!! EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError)); data_source_->Abort(); base::RunLoop().RunUntilIdle(); EXPECT_FALSE(loading()); Stop(); } TEST_F(MultibufferDataSourceTest, Http_Retry) { InitializeWith206Response(); // Read to advance our position. EXPECT_CALL(*this, ReadCallback(kDataSize)); ReadAt(0); // Issue a pending read but terminate the connection to force a retry. ReadAt(kDataSize); FinishLoading(); Restart(); Respond(response_generator_->Generate206(kDataSize)); // Complete the read. EXPECT_CALL(*this, ReadCallback(kDataSize)); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2)); ReceiveData(kDataSize); EXPECT_TRUE(loading()); Stop(); } TEST_F(MultibufferDataSourceTest, Http_RetryOnError) { InitializeWith206Response(); // Read to advance our position. EXPECT_CALL(*this, ReadCallback(kDataSize)); ReadAt(0); // Issue a pending read but trigger an error to force a retry. EXPECT_CALL(*this, ReadCallback(kDataSize)); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2)); ReadAt(kDataSize); base::RunLoop run_loop; data_provider()->didFail(url_loader(), response_generator_->GenerateError()); data_provider()->RunOnStart(run_loop.QuitClosure()); run_loop.Run(); Respond(response_generator_->Generate206(kDataSize)); ReceiveData(kDataSize); FinishLoading(); EXPECT_FALSE(loading()); Stop(); } // Make sure that we prefetch across partial responses. (crbug.com/516589) TEST_F(MultibufferDataSourceTest, Http_PartialResponsePrefetch) { Initialize(kHttpUrl, true); WebURLResponse response1 = response_generator_->GeneratePartial206(0, kDataSize - 1); WebURLResponse response2 = response_generator_->GeneratePartial206(kDataSize, kDataSize * 3 - 1); EXPECT_CALL(host_, SetTotalBytes(kFileSize)); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 3)); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2)); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); EXPECT_CALL(*this, ReadCallback(kDataSize)); Respond(response1); ReceiveData(kDataSize); ReadAt(0); EXPECT_TRUE(loading()); FinishLoading(); Restart(); Respond(response2); ReceiveData(kDataSize); ReceiveData(kDataSize); FinishLoading(); Stop(); } TEST_F(MultibufferDataSourceTest, Http_PartialResponse) { Initialize(kHttpUrl, true); WebURLResponse response1 = response_generator_->GeneratePartial206(0, kDataSize - 1); WebURLResponse response2 = response_generator_->GeneratePartial206(kDataSize, kDataSize * 2 - 1); // The origin URL of response1 and response2 are same. So no error should // occur. ExecuteMixedResponseSuccessTest(response1, response2); } TEST_F(MultibufferDataSourceTest, Http_MixedResponse_RedirectedToDifferentPathResponse) { Initialize(kHttpUrl, true); WebURLResponse response1 = response_generator_->GeneratePartial206(0, kDataSize - 1); WebURLResponse response2 = response_generator_->GeneratePartial206(kDataSize, kDataSize * 2 - 1); response2.setURL(GURL(kHttpDifferentPathUrl)); // The origin URL of response1 and response2 are same. So no error should // occur. ExecuteMixedResponseSuccessTest(response1, response2); } TEST_F(MultibufferDataSourceTest, Http_MixedResponse_RedirectedToDifferentOriginResponse) { Initialize(kHttpUrl, true); WebURLResponse response1 = response_generator_->GeneratePartial206(0, kDataSize - 1); WebURLResponse response2 = response_generator_->GeneratePartial206(kDataSize, kDataSize * 2 - 1); response2.setURL(GURL(kHttpDifferentOriginUrl)); // The origin URL of response1 and response2 are different. So an error should // occur. ExecuteMixedResponseFailureTest(response1, response2); } TEST_F(MultibufferDataSourceTest, Http_MixedResponse_ServiceWorkerGeneratedResponseAndNormalResponse) { Initialize(kHttpUrl, true); WebURLResponse response1 = response_generator_->GeneratePartial206(0, kDataSize - 1); response1.setWasFetchedViaServiceWorker(true); WebURLResponse response2 = response_generator_->GeneratePartial206(kDataSize, kDataSize * 2 - 1); // response1 is generated in a Service Worker but response2 is from a native // server. So an error should occur. ExecuteMixedResponseFailureTest(response1, response2); } TEST_F(MultibufferDataSourceTest, Http_MixedResponse_ServiceWorkerProxiedAndSameURLResponse) { Initialize(kHttpUrl, true); WebURLResponse response1 = response_generator_->GeneratePartial206(0, kDataSize - 1); response1.setWasFetchedViaServiceWorker(true); response1.setOriginalURLViaServiceWorker(GURL(kHttpUrl)); WebURLResponse response2 = response_generator_->GeneratePartial206(kDataSize, kDataSize * 2 - 1); // The origin URL of response1 and response2 are same. So no error should // occur. ExecuteMixedResponseSuccessTest(response1, response2); } TEST_F(MultibufferDataSourceTest, Http_MixedResponse_ServiceWorkerProxiedAndDifferentPathResponse) { Initialize(kHttpUrl, true); WebURLResponse response1 = response_generator_->GeneratePartial206(0, kDataSize - 1); response1.setWasFetchedViaServiceWorker(true); response1.setOriginalURLViaServiceWorker(GURL(kHttpDifferentPathUrl)); WebURLResponse response2 = response_generator_->GeneratePartial206(kDataSize, kDataSize * 2 - 1); // The origin URL of response1 and response2 are same. So no error should // occur. ExecuteMixedResponseSuccessTest(response1, response2); } TEST_F(MultibufferDataSourceTest, Http_MixedResponse_ServiceWorkerProxiedAndDifferentOriginResponse) { Initialize(kHttpUrl, true); WebURLResponse response1 = response_generator_->GeneratePartial206(0, kDataSize - 1); response1.setWasFetchedViaServiceWorker(true); response1.setOriginalURLViaServiceWorker(GURL(kHttpDifferentOriginUrl)); WebURLResponse response2 = response_generator_->GeneratePartial206(kDataSize, kDataSize * 2 - 1); // The origin URL of response1 and response2 are different. So an error should // occur. ExecuteMixedResponseFailureTest(response1, response2); } TEST_F(MultibufferDataSourceTest, Http_MixedResponse_ServiceWorkerProxiedAndDifferentOriginResponseCORS) { InitializeWithCORS(kHttpUrl, true, UrlData::CORS_ANONYMOUS); WebURLResponse response1 = response_generator_->GeneratePartial206(0, kDataSize - 1); response1.setWasFetchedViaServiceWorker(true); response1.setOriginalURLViaServiceWorker(GURL(kHttpDifferentOriginUrl)); WebURLResponse response2 = response_generator_->GeneratePartial206(kDataSize, kDataSize * 2 - 1); // The origin URL of response1 and response2 are different, but a CORS check // has been passed for each request, so expect success. ExecuteMixedResponseSuccessTest(response1, response2); } TEST_F(MultibufferDataSourceTest, File_Retry) { InitializeWithFileResponse(); // Read to advance our position. EXPECT_CALL(*this, ReadCallback(kDataSize)); ReadAt(0); // Issue a pending read but terminate the connection to force a retry. ReadAt(kDataSize); FinishLoading(); Restart(); Respond(response_generator_->GenerateFileResponse(kDataSize)); // Complete the read. EXPECT_CALL(*this, ReadCallback(kDataSize)); ReceiveData(kDataSize); EXPECT_TRUE(loading()); Stop(); } TEST_F(MultibufferDataSourceTest, Http_TooManyRetries) { InitializeWith206Response(); // Make sure there's a pending read -- we'll expect it to error. ReadAt(kDataSize); for (int i = 0; i < ResourceMultiBufferDataProvider::kMaxRetries; i++) { FailLoading(); data_provider()->Start(); Respond(response_generator_->Generate206(kDataSize)); } // Stop() will also cause the readback to be called with kReadError, but // we want to make sure it was called during FailLoading(). bool failed_ = false; EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError)) .WillOnce(Assign(&failed_, true)); FailLoading(); EXPECT_TRUE(failed_); EXPECT_FALSE(loading()); Stop(); } TEST_F(MultibufferDataSourceTest, File_TooManyRetries) { InitializeWithFileResponse(); // Make sure there's a pending read -- we'll expect it to error. ReadAt(kDataSize); for (int i = 0; i < ResourceMultiBufferDataProvider::kMaxRetries; i++) { FailLoading(); data_provider()->Start(); Respond(response_generator_->Generate206(kDataSize)); } // Stop() will also cause the readback to be called with kReadError, but // we want to make sure it was called during FailLoading(). bool failed_ = false; EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError)) .WillOnce(Assign(&failed_, true)); FailLoading(); EXPECT_TRUE(failed_); EXPECT_FALSE(loading()); Stop(); } TEST_F(MultibufferDataSourceTest, File_InstanceSizeUnknown) { Initialize(kFileUrl, false); Respond( response_generator_->GenerateFileResponse(media::DataSource::kReadError)); ReceiveData(kDataSize); EXPECT_FALSE(data_source_->downloading()); EXPECT_FALSE(loading()); Stop(); } TEST_F(MultibufferDataSourceTest, File_Successful) { InitializeWithFileResponse(); EXPECT_TRUE(loading()); EXPECT_FALSE(data_source_->IsStreaming()); Stop(); } TEST_F(MultibufferDataSourceTest, StopDuringRead) { InitializeWith206Response(); uint8_t buffer[256]; data_source_->Read(0, arraysize(buffer), buffer, base::Bind(&MultibufferDataSourceTest::ReadCallback, base::Unretained(this))); // The outstanding read should fail before the stop callback runs. { InSequence s; EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError)); data_source_->Stop(); } base::RunLoop().RunUntilIdle(); } TEST_F(MultibufferDataSourceTest, DefaultValues) { InitializeWith206Response(); // Ensure we have sane values for default loading scenario. EXPECT_EQ(MultibufferDataSource::AUTO, preload()); EXPECT_EQ(2 << 20, preload_low()); EXPECT_EQ(3 << 20, preload_high()); EXPECT_EQ(0, data_source_bitrate()); EXPECT_EQ(0.0, data_source_playback_rate()); EXPECT_TRUE(loading()); Stop(); } TEST_F(MultibufferDataSourceTest, SetBitrate) { InitializeWith206Response(); data_source_->SetBitrate(1234); base::RunLoop().RunUntilIdle(); EXPECT_EQ(1234, data_source_bitrate()); // Read so far ahead to cause the loader to get recreated. TestMultiBufferDataProvider* old_loader = data_provider(); ReadAt(kFarReadPosition); Respond(response_generator_->Generate206(kFarReadPosition)); // Verify loader changed but still has same bitrate. EXPECT_NE(old_loader, data_provider()); EXPECT_TRUE(loading()); EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError)); Stop(); } TEST_F(MultibufferDataSourceTest, MediaPlaybackRateChanged) { InitializeWith206Response(); data_source_->MediaPlaybackRateChanged(2.0); base::RunLoop().RunUntilIdle(); EXPECT_EQ(2.0, data_source_playback_rate()); // Read so far ahead to cause the loader to get recreated. TestMultiBufferDataProvider* old_loader = data_provider(); ReadAt(kFarReadPosition); Respond(response_generator_->Generate206(kFarReadPosition)); // Verify loader changed but still has same playback rate. EXPECT_NE(old_loader, data_provider()); EXPECT_TRUE(loading()); EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError)); Stop(); } TEST_F(MultibufferDataSourceTest, Http_Read) { InitializeWith206Response(); EXPECT_CALL(*this, ReadCallback(kDataSize)); ReadAt(0, kDataSize * 2); ReadAt(kDataSize, kDataSize); EXPECT_CALL(*this, ReadCallback(kDataSize)); EXPECT_CALL(host_, AddBufferedByteRange(kDataSize, kDataSize + kDataSize / 2)); ReceiveData(kDataSize / 2); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2)); ReceiveData(kDataSize / 2); EXPECT_TRUE(data_source_->downloading()); Stop(); } TEST_F(MultibufferDataSourceTest, Http_ShareData) { InitializeWith206Response(); EXPECT_CALL(*this, ReadCallback(kDataSize)); ReadAt(0, kDataSize * 2); ReadAt(kDataSize, kDataSize); EXPECT_CALL(*this, ReadCallback(kDataSize)); EXPECT_CALL(host_, AddBufferedByteRange(kDataSize, kDataSize + kDataSize / 2)); ReceiveData(kDataSize / 2); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2)); ReceiveData(kDataSize / 2); EXPECT_TRUE(data_source_->downloading()); StrictMock<MockBufferedDataSourceHost> host2; MockMultibufferDataSource source2( GURL(kHttpUrl), UrlData::CORS_UNSPECIFIED, message_loop_.task_runner(), url_index_, view_->mainFrame()->toWebLocalFrame(), &host2); source2.SetPreload(preload_); EXPECT_CALL(*this, OnInitialize(true)); // This call would not be expected if we were not sharing data. EXPECT_CALL(host2, SetTotalBytes(response_generator_->content_length())); source2.Initialize(base::Bind(&MultibufferDataSourceTest::OnInitialize, base::Unretained(this))); base::RunLoop().RunUntilIdle(); // Always loading after initialize. EXPECT_EQ(source2.downloading(), true); Stop(); } TEST_F(MultibufferDataSourceTest, Http_Read_Seek) { InitializeWith206Response(); // Read a bit from the beginning. EXPECT_CALL(*this, ReadCallback(kDataSize)); ReadAt(0); // Simulate a seek by reading a bit beyond kDataSize. ReadAt(kDataSize * 2); // We receive data leading up to but not including our read. // No notification will happen, since it's progress outside // of our current range. ReceiveData(kDataSize); // We now receive the rest of the data for our read. EXPECT_CALL(*this, ReadCallback(kDataSize)); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 3)); ReceiveData(kDataSize); EXPECT_TRUE(data_source_->downloading()); Stop(); } TEST_F(MultibufferDataSourceTest, File_Read) { InitializeWithFileResponse(); EXPECT_CALL(*this, ReadCallback(kDataSize)); ReadAt(0, kDataSize * 2); ReadAt(kDataSize, kDataSize); EXPECT_CALL(*this, ReadCallback(kDataSize)); ReceiveData(kDataSize); Stop(); } TEST_F(MultibufferDataSourceTest, Http_FinishLoading) { InitializeWith206Response(); EXPECT_TRUE(data_source_->downloading()); // premature didFinishLoading() will cause a retry. FinishLoading(); EXPECT_TRUE(data_source_->downloading()); Stop(); } TEST_F(MultibufferDataSourceTest, File_FinishLoading) { InitializeWithFileResponse(); ReceiveData(kDataSize); EXPECT_FALSE(data_source_->downloading()); // premature didFinishLoading() will cause a retry. FinishLoading(); EXPECT_FALSE(data_source_->downloading()); Stop(); } TEST_F(MultibufferDataSourceTest, LocalResource_DeferStrategy) { InitializeWithFileResponse(); EXPECT_EQ(MultibufferDataSource::AUTO, preload()); EXPECT_TRUE(is_local_source()); CheckCapacityDefer(); data_source_->MediaIsPlaying(); CheckCapacityDefer(); data_source_->SetBufferingStrategy( BufferedDataSourceInterface::BUFFERING_STRATEGY_AGGRESSIVE); CheckCapacityDefer(); Stop(); } TEST_F(MultibufferDataSourceTest, LocalResource_PreloadMetadata_DeferStrategy) { set_preload(MultibufferDataSource::METADATA); InitializeWithFileResponse(); EXPECT_EQ(MultibufferDataSource::METADATA, preload()); EXPECT_TRUE(is_local_source()); CheckReadThenDefer(); data_source_->MediaIsPlaying(); CheckCapacityDefer(); data_source_->SetBufferingStrategy( BufferedDataSourceInterface::BUFFERING_STRATEGY_AGGRESSIVE); CheckCapacityDefer(); Stop(); } TEST_F(MultibufferDataSourceTest, ExternalResource_Reponse200_DeferStrategy) { InitializeWith200Response(); EXPECT_EQ(MultibufferDataSource::AUTO, preload()); EXPECT_FALSE(is_local_source()); EXPECT_FALSE(data_source_->range_supported()); CheckCapacityDefer(); data_source_->MediaIsPlaying(); CheckCapacityDefer(); data_source_->SetBufferingStrategy( BufferedDataSourceInterface::BUFFERING_STRATEGY_AGGRESSIVE); CheckCapacityDefer(); Stop(); } TEST_F(MultibufferDataSourceTest, ExternalResource_Response200_PreloadMetadata_DeferStrategy) { set_preload(MultibufferDataSource::METADATA); InitializeWith200Response(); EXPECT_EQ(MultibufferDataSource::METADATA, preload()); EXPECT_FALSE(is_local_source()); EXPECT_FALSE(data_source_->range_supported()); CheckReadThenDefer(); data_source_->MediaIsPlaying(); CheckCapacityDefer(); data_source_->SetBufferingStrategy( BufferedDataSourceInterface::BUFFERING_STRATEGY_AGGRESSIVE); CheckCapacityDefer(); Stop(); } TEST_F(MultibufferDataSourceTest, ExternalResource_Reponse206_DeferStrategy) { InitializeWith206Response(); EXPECT_EQ(MultibufferDataSource::AUTO, preload()); EXPECT_FALSE(is_local_source()); EXPECT_TRUE(data_source_->range_supported()); CheckCapacityDefer(); data_source_->MediaIsPlaying(); CheckCapacityDefer(); set_might_be_reused_from_cache_in_future(true); data_source_->SetBufferingStrategy( BufferedDataSourceInterface::BUFFERING_STRATEGY_AGGRESSIVE); CheckNeverDefer(); data_source_->SetBufferingStrategy( BufferedDataSourceInterface::BUFFERING_STRATEGY_NORMAL); data_source_->MediaIsPlaying(); CheckCapacityDefer(); set_might_be_reused_from_cache_in_future(false); data_source_->SetBufferingStrategy( BufferedDataSourceInterface::BUFFERING_STRATEGY_AGGRESSIVE); CheckCapacityDefer(); Stop(); } TEST_F(MultibufferDataSourceTest, ExternalResource_Response206_PreloadMetadata_DeferStrategy) { set_preload(MultibufferDataSource::METADATA); InitializeWith206Response(); EXPECT_EQ(MultibufferDataSource::METADATA, preload()); EXPECT_FALSE(is_local_source()); EXPECT_TRUE(data_source_->range_supported()); CheckReadThenDefer(); data_source_->MediaIsPlaying(); CheckCapacityDefer(); set_might_be_reused_from_cache_in_future(true); data_source_->SetBufferingStrategy( BufferedDataSourceInterface::BUFFERING_STRATEGY_AGGRESSIVE); CheckNeverDefer(); data_source_->SetBufferingStrategy( BufferedDataSourceInterface::BUFFERING_STRATEGY_NORMAL); data_source_->MediaIsPlaying(); CheckCapacityDefer(); set_might_be_reused_from_cache_in_future(false); data_source_->SetBufferingStrategy( BufferedDataSourceInterface::BUFFERING_STRATEGY_AGGRESSIVE); CheckCapacityDefer(); Stop(); } TEST_F(MultibufferDataSourceTest, ExternalResource_Response206_VerifyDefer) { set_preload(MultibufferDataSource::METADATA); InitializeWith206Response(); EXPECT_EQ(MultibufferDataSource::METADATA, preload()); EXPECT_FALSE(is_local_source()); EXPECT_TRUE(data_source_->range_supported()); CheckReadThenDefer(); // Read a bit from the beginning. EXPECT_CALL(*this, ReadCallback(kDataSize)); ReadAt(0); ASSERT_TRUE(active_loader()); EXPECT_TRUE(active_loader()->deferred()); } TEST_F(MultibufferDataSourceTest, ExternalResource_Response206_CancelAfterDefer) { set_preload(MultibufferDataSource::METADATA); InitializeWith206Response(); EXPECT_EQ(MultibufferDataSource::METADATA, preload()); EXPECT_FALSE(is_local_source()); EXPECT_TRUE(data_source_->range_supported()); CheckReadThenDefer(); ReadAt(kDataSize); data_source_->OnBufferingHaveEnough(false); ASSERT_TRUE(active_loader()); EXPECT_CALL(*this, ReadCallback(kDataSize)); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2)); ReceiveData(kDataSize); EXPECT_FALSE(active_loader_allownull()); } TEST_F(MultibufferDataSourceTest, ExternalResource_Response206_CancelAfterPlay) { set_preload(BufferedDataSource::METADATA); InitializeWith206Response(); EXPECT_EQ(MultibufferDataSource::METADATA, preload()); EXPECT_FALSE(is_local_source()); EXPECT_TRUE(data_source_->range_supported()); CheckReadThenDefer(); ReadAt(kDataSize); // Marking the media as playing should prevent deferral. It also tells the // data source to start buffering beyond the initial load. data_source_->MediaIsPlaying(); data_source_->OnBufferingHaveEnough(false); CheckCapacityDefer(); ASSERT_TRUE(active_loader()); // Read a bit from the beginning and ensure deferral hasn't happened yet. EXPECT_CALL(*this, ReadCallback(kDataSize)); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2)); ReceiveData(kDataSize); ASSERT_TRUE(active_loader()); data_source_->OnBufferingHaveEnough(true); ASSERT_TRUE(active_loader()); ASSERT_FALSE(active_loader()->deferred()); // Deliver data until capacity is reached and verify deferral. int bytes_received = 0; EXPECT_CALL(host_, AddBufferedByteRange(_, _)).Times(testing::AtLeast(1)); while (active_loader_allownull() && !active_loader()->deferred()) { ReceiveData(kDataSize); bytes_received += kDataSize; } EXPECT_GT(bytes_received, 0); EXPECT_LT(bytes_received + kDataSize, kFileSize); EXPECT_FALSE(active_loader_allownull()); } TEST_F(MultibufferDataSourceTest, SeekPastEOF) { GURL gurl(kHttpUrl); data_source_.reset(new MockMultibufferDataSource( gurl, UrlData::CORS_UNSPECIFIED, message_loop_.task_runner(), url_index_, view_->mainFrame()->toWebLocalFrame(), &host_)); data_source_->SetPreload(preload_); response_generator_.reset(new TestResponseGenerator(gurl, kDataSize + 1)); EXPECT_CALL(*this, OnInitialize(true)); data_source_->Initialize(base::Bind(&MultibufferDataSourceTest::OnInitialize, base::Unretained(this))); base::RunLoop().RunUntilIdle(); // Not really loading until after OnInitialize is called. EXPECT_EQ(data_source_->downloading(), false); EXPECT_CALL(host_, SetTotalBytes(response_generator_->content_length())); Respond(response_generator_->Generate206(0)); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); ReceiveData(kDataSize); // Read a bit from the beginning. EXPECT_CALL(*this, ReadCallback(kDataSize)); ReadAt(0); EXPECT_CALL(host_, AddBufferedByteRange(kDataSize, kDataSize + 1)); ReceiveData(1); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 3)); FinishLoading(); EXPECT_CALL(*this, ReadCallback(0)); ReadAt(kDataSize + 5, kDataSize * 2); Stop(); } TEST_F(MultibufferDataSourceTest, Http_RetryThenRedirect) { InitializeWith206Response(); // Read to advance our position. EXPECT_CALL(*this, ReadCallback(kDataSize)); ReadAt(0); // Issue a pending read but trigger an error to force a retry. EXPECT_CALL(*this, ReadCallback(kDataSize - 10)); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2)); ReadAt(kDataSize + 10, kDataSize - 10); base::RunLoop run_loop; data_provider()->didFail(url_loader(), response_generator_->GenerateError()); data_provider()->RunOnStart(run_loop.QuitClosure()); run_loop.Run(); // Server responds with a redirect. blink::WebURLRequest request((GURL(kHttpDifferentPathUrl))); blink::WebURLResponse response((GURL(kHttpUrl))); response.setHTTPStatusCode(307); data_provider()->willFollowRedirect(url_loader(), request, response, 0); Respond(response_generator_->Generate206(kDataSize)); ReceiveData(kDataSize); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 3)); FinishLoading(); EXPECT_FALSE(loading()); Stop(); } TEST_F(MultibufferDataSourceTest, Http_NotStreamingAfterRedirect) { Initialize(kHttpUrl, true); // Server responds with a redirect. blink::WebURLRequest request((GURL(kHttpDifferentPathUrl))); blink::WebURLResponse response((GURL(kHttpUrl))); response.setHTTPStatusCode(307); data_provider()->willFollowRedirect(url_loader(), request, response, 0); EXPECT_CALL(host_, SetTotalBytes(response_generator_->content_length())); Respond(response_generator_->Generate206(0)); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); ReceiveData(kDataSize); EXPECT_FALSE(data_source_->IsStreaming()); FinishLoading(); EXPECT_FALSE(loading()); Stop(); } TEST_F(MultibufferDataSourceTest, Http_RangeNotSatisfiableAfterRedirect) { Initialize(kHttpUrl, true); // Server responds with a redirect. blink::WebURLRequest request((GURL(kHttpDifferentPathUrl))); blink::WebURLResponse response((GURL(kHttpUrl))); response.setHTTPStatusCode(307); data_provider()->willFollowRedirect(url_loader(), request, response, 0); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); Respond(response_generator_->GenerateResponse(416)); Stop(); } TEST_F(MultibufferDataSourceTest, LengthKnownAtEOF) { Initialize(kHttpUrl, true); // Server responds without content-length. WebURLResponse response = response_generator_->Generate200(); response.clearHTTPHeaderField(WebString::fromUTF8("Content-Length")); response.setExpectedContentLength(kPositionNotSpecified); Respond(response); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); ReceiveData(kDataSize); int64_t len; EXPECT_FALSE(data_source_->GetSize(&len)); EXPECT_TRUE(data_source_->IsStreaming()); EXPECT_CALL(*this, ReadCallback(kDataSize)); ReadAt(0); ReadAt(kDataSize); EXPECT_CALL(host_, SetTotalBytes(kDataSize)); EXPECT_CALL(*this, ReadCallback(0)); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2)); FinishLoading(); // Done loading, now we should know the length. EXPECT_TRUE(data_source_->GetSize(&len)); EXPECT_EQ(kDataSize, len); Stop(); } TEST_F(MultibufferDataSourceTest, FileSizeLessThanBlockSize) { Initialize(kHttpUrl, true); GURL gurl(kHttpUrl); blink::WebURLResponse response(gurl); response.setHTTPStatusCode(200); response.setHTTPHeaderField( WebString::fromUTF8("Content-Length"), WebString::fromUTF8(base::Int64ToString(kDataSize / 2))); response.setExpectedContentLength(kDataSize / 2); Respond(response); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize / 2)); EXPECT_CALL(host_, SetTotalBytes(kDataSize / 2)); EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2)); ReceiveData(kDataSize / 2); FinishLoading(); int64_t len = 0; EXPECT_TRUE(data_source_->GetSize(&len)); EXPECT_EQ(kDataSize / 2, len); Stop(); } } // namespace media
danakj/chromium
media/blink/multibuffer_data_source_unittest.cc
C++
bsd-3-clause
45,234
<?php namespace BackEnd\Form; use Zend\Form\Form; use Zend\InputFilter\Factory as InputFactory; use Zend\InputFilter\InputFilter; class LoginForm extends Form { protected $inputFilter; public function __construct(){ parent::__construct('login-form'); $this->setAttribute('method', 'post'); $this->add(array( 'name' => 'username', 'options' => array( 'label' => '用户名' ), )); $this->add(array( 'name' => 'password', 'options' => array( 'label' => '密码' ), )); $this->add(array( 'name' => 'submit', 'attributes' => array( 'value' => 'Login', 'type' => 'submit', ), )); $this->setInputFilter($this->getInputFilter()); } public function getInputFilter(){ if(!$this->inputFilter){ $inputFilter = new InputFilter(); $factory = new InputFactory(); $inputFilter->add($factory->createInput(array( 'name' => 'username', 'required' => true, 'validators' => array( array('name' => 'StringLength' , 'options' => array('min' => 3 , 'max' => 20)), ), ))); $inputFilter->add($factory->createInput(array( 'name' => 'password', 'required' => true, 'validators' => array( array('name' => 'Alnum'), ), ))); $this->inputFilter = $inputFilter; } return $this->inputFilter; } }
aidear/jiaju
module/BackEnd/Form/LoginForm.php
PHP
bsd-3-clause
1,856
module UI.Widget.List ( listWidget ) where import Reactive.Banana import Reactive.Banana.Extra import Reactive.Banana.Frameworks import UI.TclTk import UI.TclTk.AST import UI.TclTk.Builder import UI.Widget -- | List widget listWidget :: Frameworks t => Event t [a] -> GUI t p (TkName, Event t (Int,a)) listWidget eList = do frame [Fill FillX] $ withPack PackLeft $ do let toEvt x (_,e) = x <$ e -- Buttons spacer e1 <- toEvt ToBegin <$> button [Text "<|" ] [] e2 <- toEvt (MoveBack 10) <$> button [Text "<<<"] [] e3 <- toEvt (MoveBack 1 ) <$> button [Text "<" ] [] -- Central area spacer Widget _ eN finiN <- entryInt [] [] _ <- label [ Text " / " ] [] labN <- label [] [] actimateTcl (length <$> eList) $ do configure labN $ LamOpt $ Text . show spacer -- More buttons e4 <- toEvt (MoveFwd 1 ) <$> button [Text ">" ] [] e5 <- toEvt (MoveFwd 10) <$> button [Text ">>>"] [] e6 <- toEvt ToEnd <$> button [Text "|>" ] [] spacer -- OOPS let events = listEvents eList (unions [JumpTo <$> eN, e1, e2, e3, e4, e5, e6]) finiN $ Bhv 0 $ fst <$> events return events -- Commands for a list data ListCmd = MoveFwd Int | MoveBack Int | JumpTo Int | ToBegin | ToEnd deriving (Show) -- Cursor for list of values data Cursor a = Cursor Int [a] Int -- Length × list × position | Invalid listEvents :: Event t [a] -> Event t ListCmd -> Event t (Int,a) listEvents listEvt command = filterJust $ fmap fini $ scanE acc Invalid $ listEvt `joinE` command where -- fini (Cursor _ xs i) = Just (i, xs !! i) fini Invalid = Nothing -- Accumulate data acc Invalid (Left []) = Invalid acc Invalid (Left xs) = Cursor (length xs) xs 0 acc Invalid _ = Invalid acc (Cursor _ _ n) (Left xs) = Cursor len xs $ clip len n where len = length xs acc (Cursor len xs n) (Right c) = case c of MoveFwd d -> go $ n + d MoveBack d -> go $ n - d JumpTo d -> go d ToBegin -> go 0 ToEnd -> go $ len - 1 where go = Cursor len xs . clip len -- Clip out of range indices clip len i | i < 0 = 0 | i >= len = len -1 | otherwise = i
Shimuuar/banana-tcltk
UI/Widget/List.hs
Haskell
bsd-3-clause
2,401
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef MEDIA_VIDEO_SUPPORTED_VIDEO_DECODER_CONFIG_H_ #define MEDIA_VIDEO_SUPPORTED_VIDEO_DECODER_CONFIG_H_ #include <vector> #include "base/containers/flat_map.h" #include "base/macros.h" #include "media/base/media_export.h" #include "media/base/video_codecs.h" #include "media/base/video_decoder_config.h" #include "ui/gfx/geometry/size.h" namespace media { // Specification of a range of configurations that are supported by a video // decoder. Also provides the ability to check if a VideoDecoderConfig matches // the supported range. struct MEDIA_EXPORT SupportedVideoDecoderConfig { SupportedVideoDecoderConfig(); SupportedVideoDecoderConfig(VideoCodecProfile profile_min, VideoCodecProfile profile_max, const gfx::Size& coded_size_min, const gfx::Size& coded_size_max, bool allow_encrypted, bool require_encrypted); ~SupportedVideoDecoderConfig(); // Returns true if and only if |config| is a supported config. bool Matches(const VideoDecoderConfig& config) const; // Range of VideoCodecProfiles to match, inclusive. VideoCodecProfile profile_min = VIDEO_CODEC_PROFILE_UNKNOWN; VideoCodecProfile profile_max = VIDEO_CODEC_PROFILE_UNKNOWN; // Coded size range, inclusive. gfx::Size coded_size_min; gfx::Size coded_size_max; // TODO(liberato): consider switching these to "allow_clear" and // "allow_encrypted", so that they're orthogonal. // If true, then this will match encrypted configs. bool allow_encrypted = true; // If true, then unencrypted configs will not match. bool require_encrypted = false; // Allow copy and assignment. }; // Enumeration of possible implementations for (Mojo)VideoDecoders. enum class VideoDecoderImplementation { kDefault = 0, kAlternate = 1, kMaxValue = kAlternate }; using SupportedVideoDecoderConfigs = std::vector<SupportedVideoDecoderConfig>; // Map of mojo VideoDecoder implementations to the vector of configs that they // (probably) support. using SupportedVideoDecoderConfigMap = base::flat_map<VideoDecoderImplementation, SupportedVideoDecoderConfigs>; // Helper method to determine if |config| is supported by |supported_configs|. MEDIA_EXPORT bool IsVideoDecoderConfigSupported( const SupportedVideoDecoderConfigs& supported_configs, const VideoDecoderConfig& config); } // namespace media #endif // MEDIA_VIDEO_SUPPORTED_VIDEO_DECODER_CONFIG_H_
endlessm/chromium-browser
media/video/supported_video_decoder_config.h
C
bsd-3-clause
2,687
/* * Copyright (c) 2016, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ #include <proxygen/lib/http/codec/experimental/HTTP2Framer.h> #include <cstdint> using namespace folly::io; using namespace folly; namespace proxygen { namespace http2 { const uint8_t kMaxFrameType = static_cast<uint8_t>(FrameType::ALTSVC); const boost::optional<uint8_t> kNoPadding; const PriorityUpdate DefaultPriority{0, false, 15}; namespace { const uint32_t kLengthMask = 0x00ffffff; const uint32_t kUint31Mask = 0x7fffffff; static const uint64_t kZeroPad[32] = {0}; static const bool kStrictPadding = true; static_assert(sizeof(kZeroPad) == 256, "bad zero padding"); void writePriorityBody(IOBufQueue& queue, uint32_t streamDependency, bool exclusive, uint8_t weight) { DCHECK_EQ(0, ~kUint31Mask & streamDependency); if (exclusive) { streamDependency |= ~kUint31Mask; } QueueAppender appender(&queue, 8); appender.writeBE<uint32_t>(streamDependency); appender.writeBE<uint8_t>(weight); } void writePadding(IOBufQueue& queue, boost::optional<uint8_t> size) { if (size && size.get() > 0) { auto out = queue.preallocate(size.get(), size.get()); memset(out.first, 0, size.get()); queue.postallocate(size.get()); } } /** * Generate just the common frame header. This includes the padding length * bits that sometimes come right after the frame header. Returns the * length field written to the common frame header. */ size_t writeFrameHeader(IOBufQueue& queue, uint32_t length, FrameType type, uint8_t flags, uint32_t stream, boost::optional<uint8_t> padding, boost::optional<PriorityUpdate> priority, std::unique_ptr<IOBuf> payload) noexcept { size_t headerSize = kFrameHeaderSize; // the acceptable length is now conditional based on state :( DCHECK_EQ(0, ~kLengthMask & length); DCHECK_EQ(0, ~kUint31Mask & stream); // Adjust length if we will emit a priority section if (flags & PRIORITY) { DCHECK(FrameType::HEADERS == type); length += kFramePrioritySize; headerSize += kFramePrioritySize; DCHECK_EQ(0, ~kLengthMask & length); } // Add or remove padding flags if (padding) { flags |= PADDED; length += padding.get() + 1; headerSize += 1; } else { flags &= ~PADDED; } if (priority) { headerSize += kFramePrioritySize; } DCHECK_EQ(0, ~kLengthMask & length); DCHECK_GE(kMaxFrameType, static_cast<uint8_t>(type)); uint32_t lengthAndType = ((kLengthMask & length) << 8) | static_cast<uint8_t>(type); uint64_t payloadLength = 0; if (payload && !payload->isSharedOne() && payload->headroom() >= headerSize && queue.tailroom() < headerSize) { // Use the headroom in payload for the frame header. // Make it appear that the payload IOBuf is empty and retreat so // appender can access the headroom payloadLength = payload->length(); payload->trimEnd(payloadLength); payload->retreat(headerSize); auto tail = payload->pop(); queue.append(std::move(payload)); payload = std::move(tail); } QueueAppender appender(&queue, kFrameHeaderSize); appender.writeBE<uint32_t>(lengthAndType); appender.writeBE<uint8_t>(flags); appender.writeBE<uint32_t>(kUint31Mask & stream); if (padding) { appender.writeBE<uint8_t>(padding.get()); } if (priority) { DCHECK_NE(priority->streamDependency, stream) << "Circular dependecy"; writePriorityBody(queue, priority->streamDependency, priority->exclusive, priority->weight); } if (payloadLength) { queue.postallocate(payloadLength); } queue.append(std::move(payload)); return length; } uint32_t parseUint31(Cursor& cursor) { // MUST ignore the 1 bit before the stream-id return kUint31Mask & cursor.readBE<uint32_t>(); } ErrorCode parseErrorCode(Cursor& cursor, ErrorCode& outCode) { auto code = cursor.readBE<uint32_t>(); if (code > kMaxErrorCode) { return ErrorCode::PROTOCOL_ERROR; } outCode = ErrorCode(code); return ErrorCode::NO_ERROR; } PriorityUpdate parsePriorityCommon(Cursor& cursor) { PriorityUpdate priority; uint32_t streamAndExclusive = cursor.readBE<uint32_t>(); priority.weight = cursor.readBE<uint8_t>(); priority.exclusive = ~kUint31Mask & streamAndExclusive; priority.streamDependency = kUint31Mask & streamAndExclusive; return priority; } /** * Given the flags for a frame and the cursor pointing at the top of the * frame-specific section (after the common header), return the number of * bytes to skip at the end of the frame. Caller must ensure there is at * least 1 bytes in the cursor. * * @param cursor The cursor to pull data from * @param header The frame header for the frame being parsed. The length * field may be modified based on the number of optional * padding length fields were read. * @param padding The out parameter that will return the number of padding * bytes at the end of the frame. * @return Nothing if success. The connection error code if failure. */ ErrorCode parsePadding(Cursor& cursor, FrameHeader& header, uint8_t& padding) noexcept { if (frameHasPadding(header)) { if (header.length < 1) { return ErrorCode::FRAME_SIZE_ERROR; } header.length -= 1; padding = cursor.readBE<uint8_t>(); } else { padding = 0; } return ErrorCode::NO_ERROR; } ErrorCode skipPadding(Cursor& cursor, uint8_t length, bool verify) { if (verify) { while (length > 0) { auto cur = cursor.peek(); uint8_t toCmp = std::min<size_t>(cur.second, length); if (memcmp(cur.first, kZeroPad, toCmp)) { return ErrorCode::PROTOCOL_ERROR; } cursor.skip(toCmp); length -= toCmp; } } else { cursor.skip(length); } return ErrorCode::NO_ERROR; } } // anonymous namespace bool frameAffectsCompression(FrameType t) { return t == FrameType::HEADERS || t == FrameType::PUSH_PROMISE || t == FrameType::CONTINUATION; } bool frameHasPadding(const FrameHeader& header) { return header.flags & PADDED; } //// Parsing //// ErrorCode parseFrameHeader(Cursor& cursor, FrameHeader& header) noexcept { DCHECK_LE(kFrameHeaderSize, cursor.totalLength()); // MUST ignore the 2 bits before the length uint32_t lengthAndType = cursor.readBE<uint32_t>(); header.length = kLengthMask & (lengthAndType >> 8); uint8_t type = lengthAndType & 0xff; header.type = FrameType(type); header.flags = cursor.readBE<uint8_t>(); header.stream = parseUint31(cursor); return ErrorCode::NO_ERROR; } ErrorCode parseData(Cursor& cursor, FrameHeader header, std::unique_ptr<IOBuf>& outBuf, uint16_t& outPadding) noexcept { DCHECK_LE(header.length, cursor.totalLength()); if (header.stream == 0) { return ErrorCode::PROTOCOL_ERROR; } uint8_t padding; const auto err = parsePadding(cursor, header, padding); RETURN_IF_ERROR(err); if (header.length < padding) { return ErrorCode::PROTOCOL_ERROR; } // outPadding is the total number of flow-controlled pad bytes, which // includes the length byte, if present. outPadding = padding + ((frameHasPadding(header)) ? 1 : 0); cursor.clone(outBuf, header.length - padding); return skipPadding(cursor, padding, kStrictPadding); } ErrorCode parseDataBegin(Cursor& cursor, FrameHeader header, size_t& parsed, uint16_t& outPadding) noexcept { uint8_t padding = 0; const auto err = http2::parsePadding(cursor, header, padding); RETURN_IF_ERROR(err); if (header.length < padding) { return ErrorCode::PROTOCOL_ERROR; } // outPadding is the total number of flow-controlled pad bytes, which // includes the length byte, if present. outPadding = padding + ((frameHasPadding(header)) ? 1 : 0); return ErrorCode::NO_ERROR; } ErrorCode parseDataEnd(Cursor& cursor, const size_t bufLen, const size_t pendingDataFramePaddingBytes, size_t& toSkip) noexcept { toSkip = std::min(pendingDataFramePaddingBytes, bufLen); return skipPadding(cursor, toSkip, kStrictPadding); } ErrorCode parseHeaders(Cursor& cursor, FrameHeader header, boost::optional<PriorityUpdate>& outPriority, std::unique_ptr<IOBuf>& outBuf) noexcept { DCHECK_LE(header.length, cursor.totalLength()); if (header.stream == 0) { return ErrorCode::PROTOCOL_ERROR; } uint8_t padding; auto err = parsePadding(cursor, header, padding); RETURN_IF_ERROR(err); if (header.flags & PRIORITY) { if (header.length < kFramePrioritySize) { return ErrorCode::FRAME_SIZE_ERROR; } outPriority = parsePriorityCommon(cursor); header.length -= kFramePrioritySize; } else { outPriority = boost::none; } if (header.length < padding) { return ErrorCode::PROTOCOL_ERROR; } cursor.clone(outBuf, header.length - padding); return skipPadding(cursor, padding, kStrictPadding); } ErrorCode parsePriority(Cursor& cursor, FrameHeader header, PriorityUpdate& outPriority) noexcept { DCHECK_LE(header.length, cursor.totalLength()); if (header.length != kFramePrioritySize) { return ErrorCode::FRAME_SIZE_ERROR; } if (header.stream == 0) { return ErrorCode::PROTOCOL_ERROR; } outPriority = parsePriorityCommon(cursor); return ErrorCode::NO_ERROR; } ErrorCode parseRstStream(Cursor& cursor, FrameHeader header, ErrorCode& outCode) noexcept { DCHECK_LE(header.length, cursor.totalLength()); if (header.length != kFrameRstStreamSize) { return ErrorCode::FRAME_SIZE_ERROR; } if (header.stream == 0) { return ErrorCode::PROTOCOL_ERROR; } return parseErrorCode(cursor, outCode); } ErrorCode parseSettings(Cursor& cursor, FrameHeader header, std::deque<SettingPair>& settings) noexcept { DCHECK_LE(header.length, cursor.totalLength()); if (header.stream != 0) { return ErrorCode::PROTOCOL_ERROR; } if (header.flags & ACK) { if (header.length != 0) { return ErrorCode::FRAME_SIZE_ERROR; } return ErrorCode::NO_ERROR; } if (header.length % 6 != 0) { return ErrorCode::FRAME_SIZE_ERROR; } for (; header.length > 0; header.length -= 6) { uint16_t id = cursor.readBE<uint16_t>(); uint32_t val = cursor.readBE<uint32_t>(); settings.push_back(std::make_pair(SettingsId(id), val)); } return ErrorCode::NO_ERROR; } ErrorCode parsePushPromise(Cursor& cursor, FrameHeader header, uint32_t& outPromisedStream, std::unique_ptr<IOBuf>& outBuf) noexcept { DCHECK_LE(header.length, cursor.totalLength()); if (header.stream == 0) { return ErrorCode::PROTOCOL_ERROR; } uint8_t padding; auto err = parsePadding(cursor, header, padding); RETURN_IF_ERROR(err); if (header.length < kFramePushPromiseSize) { return ErrorCode::FRAME_SIZE_ERROR; } header.length -= kFramePushPromiseSize; outPromisedStream = parseUint31(cursor); if (outPromisedStream == 0 || outPromisedStream & 0x1) { // client MUST reserve an even stream id greater than 0 return ErrorCode::PROTOCOL_ERROR; } if (header.length < padding) { return ErrorCode::PROTOCOL_ERROR; } cursor.clone(outBuf, header.length - padding); return skipPadding(cursor, padding, kStrictPadding); } ErrorCode parsePing(Cursor& cursor, FrameHeader header, uint64_t& outOpaqueData) noexcept { DCHECK_LE(header.length, cursor.totalLength()); if (header.length != kFramePingSize) { return ErrorCode::FRAME_SIZE_ERROR; } if (header.stream != 0) { return ErrorCode::PROTOCOL_ERROR; } cursor.pull(&outOpaqueData, sizeof(outOpaqueData)); return ErrorCode::NO_ERROR; } ErrorCode parseGoaway(Cursor& cursor, FrameHeader header, uint32_t& outLastStreamID, ErrorCode& outCode, std::unique_ptr<IOBuf>& outDebugData) noexcept { DCHECK_LE(header.length, cursor.totalLength()); if (header.length < kFrameGoawaySize) { return ErrorCode::FRAME_SIZE_ERROR; } if (header.stream != 0) { return ErrorCode::PROTOCOL_ERROR; } outLastStreamID = parseUint31(cursor); auto err = parseErrorCode(cursor, outCode); RETURN_IF_ERROR(err); header.length -= kFrameGoawaySize; if (header.length > 0) { cursor.clone(outDebugData, header.length); } return ErrorCode::NO_ERROR; } ErrorCode parseWindowUpdate(Cursor& cursor, FrameHeader header, uint32_t& outAmount) noexcept { DCHECK_LE(header.length, cursor.totalLength()); if (header.length != kFrameWindowUpdateSize) { return ErrorCode::FRAME_SIZE_ERROR; } outAmount = parseUint31(cursor); return ErrorCode::NO_ERROR; } ErrorCode parseContinuation(Cursor& cursor, FrameHeader header, std::unique_ptr<IOBuf>& outBuf) noexcept { DCHECK(header.type == FrameType::CONTINUATION); DCHECK_LE(header.length, cursor.totalLength()); if (header.stream == 0) { return ErrorCode::PROTOCOL_ERROR; } uint8_t padding; auto err = parsePadding(cursor, header, padding); RETURN_IF_ERROR(err); if (header.length < padding) { return ErrorCode::PROTOCOL_ERROR; } cursor.clone(outBuf, header.length - padding); return skipPadding(cursor, padding, kStrictPadding); } ErrorCode parseAltSvc(Cursor& cursor, FrameHeader header, uint32_t& outMaxAge, uint32_t& outPort, std::string& outProtocol, std::string& outHost, std::string& outOrigin) noexcept { DCHECK_LE(header.length, cursor.totalLength()); if (header.length < kFrameAltSvcSizeBase) { return ErrorCode::FRAME_SIZE_ERROR; } std::unique_ptr<IOBuf> tmpBuf; outMaxAge = cursor.readBE<uint32_t>(); outPort = cursor.readBE<uint16_t>(); const auto protoLen = cursor.readBE<uint8_t>(); if (header.length < kFrameAltSvcSizeBase + protoLen) { return ErrorCode::FRAME_SIZE_ERROR; } outProtocol = cursor.readFixedString(protoLen); const auto hostLen = cursor.readBE<uint8_t>(); if (header.length < kFrameAltSvcSizeBase + protoLen + hostLen) { return ErrorCode::FRAME_SIZE_ERROR; } outHost = cursor.readFixedString(hostLen); const auto originLen = (header.length - kFrameAltSvcSizeBase - protoLen - hostLen); outOrigin = cursor.readFixedString(originLen); return ErrorCode::NO_ERROR; } //// Egress //// size_t writeData(IOBufQueue& queue, std::unique_ptr<IOBuf> data, uint32_t stream, boost::optional<uint8_t> padding, bool endStream) noexcept { DCHECK_NE(0, stream); uint8_t flags = 0; if (endStream) { flags |= END_STREAM; } const uint64_t dataLen = data ? data->computeChainDataLength() : 0; // Caller must not exceed peer setting for MAX_FRAME_SIZE // TODO: look into using headroom from data to hold the frame header const auto frameLen = writeFrameHeader(queue, dataLen, FrameType::DATA, flags, stream, padding, boost::none, std::move(data)); writePadding(queue, padding); return kFrameHeaderSize + frameLen; } size_t writeHeaders(IOBufQueue& queue, std::unique_ptr<IOBuf> headers, uint32_t stream, boost::optional<PriorityUpdate> priority, boost::optional<uint8_t> padding, bool endStream, bool endHeaders) noexcept { DCHECK_NE(0, stream); const auto dataLen = (headers) ? headers->computeChainDataLength() : 0; uint32_t flags = 0; if (priority) { flags |= PRIORITY; } if (endStream) { flags |= END_STREAM; } if (endHeaders) { flags |= END_HEADERS; } // padding flags handled directly inside writeFrameHeader() const auto frameLen = writeFrameHeader(queue, dataLen, FrameType::HEADERS, flags, stream, padding, priority, std::move(headers)); writePadding(queue, padding); return kFrameHeaderSize + frameLen; } size_t writePriority(IOBufQueue& queue, uint32_t stream, PriorityUpdate priority) noexcept { DCHECK_NE(0, stream); const auto frameLen = writeFrameHeader(queue, kFramePrioritySize, FrameType::PRIORITY, 0, stream, kNoPadding, priority, nullptr); return kFrameHeaderSize + frameLen; } size_t writeRstStream(IOBufQueue& queue, uint32_t stream, ErrorCode errorCode) noexcept { DCHECK_NE(0, stream); const auto frameLen = writeFrameHeader(queue, kFrameRstStreamSize, FrameType::RST_STREAM, 0, stream, kNoPadding, boost::none, nullptr); QueueAppender appender(&queue, frameLen); appender.writeBE<uint32_t>(static_cast<uint32_t>(errorCode)); return kFrameHeaderSize + frameLen; } size_t writeSettings(IOBufQueue& queue, const std::deque<SettingPair>& settings) { const auto settingsSize = settings.size() * 6; const auto frameLen = writeFrameHeader(queue, settingsSize, FrameType::SETTINGS, 0, 0, kNoPadding, boost::none, nullptr); QueueAppender appender(&queue, settingsSize); for (const auto& setting: settings) { DCHECK_LE(static_cast<uint32_t>(setting.first), std::numeric_limits<uint16_t>::max()); appender.writeBE<uint16_t>(static_cast<uint16_t>(setting.first)); appender.writeBE<uint32_t>(setting.second); } return kFrameHeaderSize + frameLen; } size_t writeSettingsAck(IOBufQueue& queue) { writeFrameHeader(queue, 0, FrameType::SETTINGS, ACK, 0, kNoPadding, boost::none, nullptr); return kFrameHeaderSize; } size_t writePushPromise(IOBufQueue& queue, uint32_t associatedStream, uint32_t promisedStream, std::unique_ptr<IOBuf> headers, boost::optional<uint8_t> padding, bool endHeaders) noexcept { DCHECK_NE(0, promisedStream); DCHECK_NE(0, associatedStream); DCHECK_EQ(0, 0x1 & promisedStream); DCHECK_EQ(1, 0x1 & associatedStream); DCHECK_EQ(0, ~kUint31Mask & promisedStream); const auto dataLen = headers->computeChainDataLength(); const auto frameLen = writeFrameHeader(queue, dataLen + kFramePushPromiseSize, FrameType::PUSH_PROMISE, endHeaders ? END_HEADERS : 0, associatedStream, padding, boost::none, nullptr); QueueAppender appender(&queue, frameLen); appender.writeBE<uint32_t>(promisedStream); queue.append(std::move(headers)); writePadding(queue, padding); return kFrameHeaderSize + frameLen; } size_t writePing(IOBufQueue& queue, uint64_t opaqueData, bool ack) noexcept { const auto frameLen = writeFrameHeader(queue, kFramePingSize, FrameType::PING, ack ? ACK : 0, 0, kNoPadding, boost::none, nullptr); queue.append(&opaqueData, sizeof(opaqueData)); return kFrameHeaderSize + frameLen; } size_t writeGoaway(IOBufQueue& queue, uint32_t lastStreamID, ErrorCode errorCode, std::unique_ptr<IOBuf> debugData) noexcept { uint32_t debugLen = debugData ? debugData->computeChainDataLength() : 0; DCHECK_EQ(0, ~kLengthMask & debugLen); const auto frameLen = writeFrameHeader(queue, kFrameGoawaySize + debugLen, FrameType::GOAWAY, 0, 0, kNoPadding, boost::none, nullptr); QueueAppender appender(&queue, frameLen); appender.writeBE<uint32_t>(lastStreamID); appender.writeBE<uint32_t>(static_cast<uint32_t>(errorCode)); queue.append(std::move(debugData)); return kFrameHeaderSize + frameLen; } size_t writeWindowUpdate(IOBufQueue& queue, uint32_t stream, uint32_t amount) noexcept { const auto frameLen = writeFrameHeader(queue, kFrameWindowUpdateSize, FrameType::WINDOW_UPDATE, 0, stream, kNoPadding, boost::none, nullptr); DCHECK_EQ(0, ~kUint31Mask & amount); DCHECK_LT(0, amount); QueueAppender appender(&queue, kFrameWindowUpdateSize); appender.writeBE<uint32_t>(amount); return kFrameHeaderSize + frameLen; } size_t writeContinuation(IOBufQueue& queue, uint32_t stream, bool endHeaders, std::unique_ptr<IOBuf> headers, boost::optional<uint8_t> padding) noexcept { DCHECK_NE(0, stream); const auto dataLen = headers->computeChainDataLength(); const auto frameLen = writeFrameHeader(queue, dataLen, FrameType::CONTINUATION, endHeaders ? END_HEADERS : 0, stream, padding, boost::none, std::move(headers)); writePadding(queue, padding); return kFrameHeaderSize + frameLen; } size_t writeAltSvc(IOBufQueue& queue, uint32_t stream, uint32_t maxAge, uint16_t port, StringPiece protocol, StringPiece host, StringPiece origin) noexcept { const auto protoLen = protocol.size(); const auto hostLen = host.size(); const auto originLen = origin.size(); const auto frameLen = protoLen + hostLen + originLen + kFrameAltSvcSizeBase; writeFrameHeader(queue, frameLen, FrameType::ALTSVC, 0, stream, kNoPadding, boost::none, nullptr); QueueAppender appender(&queue, frameLen); appender.writeBE<uint32_t>(maxAge); appender.writeBE<uint16_t>(port); appender.writeBE<uint8_t>(protoLen); appender.push(reinterpret_cast<const uint8_t*>(protocol.data()), protoLen); appender.writeBE<uint8_t>(hostLen); appender.push(reinterpret_cast<const uint8_t*>(host.data()), hostLen); appender.push(reinterpret_cast<const uint8_t*>(origin.data()), originLen); return kFrameHeaderSize + frameLen; } const char* getFrameTypeString(FrameType type) { switch (type) { case FrameType::DATA: return "DATA"; case FrameType::HEADERS: return "HEADERS"; case FrameType::PRIORITY: return "PRIORITY"; case FrameType::RST_STREAM: return "RST_STREAM"; case FrameType::SETTINGS: return "SETTINGS"; case FrameType::PUSH_PROMISE: return "PUSH_PROMISE"; case FrameType::PING: return "PING"; case FrameType::GOAWAY: return "GOAWAY"; case FrameType::WINDOW_UPDATE: return "WINDOW_UPDATE"; case FrameType::CONTINUATION: return "CONTINUATION"; case FrameType::ALTSVC: return "ALTSVC"; default: // can happen when type was cast from uint8_t return "Unknown"; } LOG(FATAL) << "Unreachable"; return ""; } }}
Orvid/proxygen
proxygen/lib/http/codec/experimental/HTTP2Framer.cpp
C++
bsd-3-clause
25,806
# -*-coding:Utf-8 -* # Copyright (c) 2010-2017 LE GOFF Vincent # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # * Neither the name of the copyright holder nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. """Fichier contenant le paramètre 'voir' de la commande 'chemin'.""" from primaires.format.fonctions import oui_ou_non from primaires.interpreteur.masque.parametre import Parametre from primaires.pnj.chemin import FLAGS class PrmVoir(Parametre): """Commande 'chemin voir'. """ def __init__(self): """Constructeur du paramètre""" Parametre.__init__(self, "voir", "view") self.schema = "<cle>" self.aide_courte = "affiche le détail d'un chemin" self.aide_longue = \ "Cette commande permet d'obtenir plus d'informations sur " \ "un chemin (ses flags actifs, ses salles et sorties...)." def ajouter(self): """Méthode appelée lors de l'ajout de la commande à l'interpréteur""" cle = self.noeud.get_masque("cle") cle.proprietes["regex"] = r"'[a-z0-9_:]{3,}'" def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" cle = dic_masques["cle"].cle if cle not in importeur.pnj.chemins: personnage << "|err|Ce chemin n'existe pas.|ff|" return chemin = importeur.pnj.chemins[cle] msg = "Détail sur le chemin {} :".format(chemin.cle) msg += "\n Flags :" for nom_flag in FLAGS.keys(): msg += "\n {}".format(nom_flag.capitalize()) msg += " : " + oui_ou_non(chemin.a_flag(nom_flag)) msg += "\n Salles du chemin :" if len(chemin.salles) == 0: msg += "\n Aucune" else: for salle, direction in chemin.salles.items(): msg += "\n " + salle.ident.ljust(20) + " " msg += direction.ljust(10) if salle in chemin.salles_retour and \ chemin.salles_retour[salle]: msg += " (retour " + chemin.salles_retour[salle] + ")" personnage << msg
vlegoff/tsunami
src/primaires/pnj/commandes/chemin/voir.py
Python
bsd-3-clause
3,490
#This is where the tests go.
praekelt/ummeli
ummeli/providers/tests.py
Python
bsd-3-clause
29
import FontAwesome from '@expo/vector-icons/build/FontAwesome'; import MaterialIcons from '@expo/vector-icons/build/MaterialIcons'; import AsyncStorage from '@react-native-async-storage/async-storage'; import { useFocusEffect } from '@react-navigation/native'; import { StackNavigationProp } from '@react-navigation/stack'; import * as Location from 'expo-location'; import * as TaskManager from 'expo-task-manager'; import { EventEmitter, EventSubscription } from 'fbemitter'; import * as React from 'react'; import { Modal, Platform, StyleSheet, Text, View } from 'react-native'; import MapView from 'react-native-maps'; import Button from '../../components/Button'; import Colors from '../../constants/Colors'; import usePermissions from '../../utilities/usePermissions'; const STORAGE_KEY = 'expo-home-locations'; const LOCATION_UPDATES_TASK = 'location-updates'; const locationEventsEmitter = new EventEmitter(); const locationAccuracyStates: { [key in Location.Accuracy]: Location.Accuracy } = { [Location.Accuracy.Lowest]: Location.Accuracy.Low, [Location.Accuracy.Low]: Location.Accuracy.Balanced, [Location.Accuracy.Balanced]: Location.Accuracy.High, [Location.Accuracy.High]: Location.Accuracy.Highest, [Location.Accuracy.Highest]: Location.Accuracy.BestForNavigation, [Location.Accuracy.BestForNavigation]: Location.Accuracy.Lowest, }; const locationActivityTypes: { [key in Location.ActivityType]: Location.ActivityType | undefined; } = { [Location.ActivityType.Other]: Location.ActivityType.AutomotiveNavigation, [Location.ActivityType.AutomotiveNavigation]: Location.ActivityType.Fitness, [Location.ActivityType.Fitness]: Location.ActivityType.OtherNavigation, [Location.ActivityType.OtherNavigation]: Location.ActivityType.Airborne, [Location.ActivityType.Airborne]: undefined, }; interface Props { navigation: StackNavigationProp<any>; } type Region = { latitude: number; longitude: number; latitudeDelta: number; longitudeDelta: number; }; type State = Pick<Location.LocationTaskOptions, 'showsBackgroundLocationIndicator'> & { activityType: Location.ActivityType | null; accuracy: Location.Accuracy; isTracking: boolean; savedLocations: any[]; initialRegion: Region | null; }; const initialState: State = { isTracking: false, savedLocations: [], activityType: null, accuracy: Location.Accuracy.High, initialRegion: null, showsBackgroundLocationIndicator: false, }; function reducer(state: State, action: Partial<State>): State { return { ...state, ...action, }; } export default function BackgroundLocationMapScreen(props: Props) { const [permission] = usePermissions(Location.requestForegroundPermissionsAsync); React.useEffect(() => { (async () => { if (!(await Location.isBackgroundLocationAvailableAsync())) { alert('Background location is not available in this application.'); props.navigation.goBack(); } })(); }, [props.navigation]); if (!permission) { return ( <Text style={styles.errorText}> Location permissions are required in order to use this feature. You can manually enable them at any time in the "Location Services" section of the Settings app. </Text> ); } return <BackgroundLocationMapView />; } function BackgroundLocationMapView() { const mapViewRef = React.useRef<MapView>(null); const [state, dispatch] = React.useReducer(reducer, initialState); const onFocus = React.useCallback(() => { let subscription: EventSubscription | null = null; let isMounted = true; (async () => { if ((await Location.getBackgroundPermissionsAsync()).status !== 'granted') { console.log( 'Missing background location permissions. Make sure it is granted in the OS Settings.' ); return; } const { coords } = await Location.getCurrentPositionAsync(); const isTracking = await Location.hasStartedLocationUpdatesAsync(LOCATION_UPDATES_TASK); const task = (await TaskManager.getRegisteredTasksAsync()).find( ({ taskName }) => taskName === LOCATION_UPDATES_TASK ); const savedLocations = await getSavedLocations(); subscription = locationEventsEmitter.addListener('update', (savedLocations: any) => { if (isMounted) dispatch({ savedLocations }); }); if (!isTracking) { alert('Click `Start tracking` to start getting location updates.'); } if (!isMounted) return; dispatch({ isTracking, accuracy: task?.options.accuracy ?? state.accuracy, showsBackgroundLocationIndicator: task?.options.showsBackgroundLocationIndicator, activityType: task?.options.activityType ?? null, savedLocations, initialRegion: { latitude: coords.latitude, longitude: coords.longitude, latitudeDelta: 0.004, longitudeDelta: 0.002, }, }); })(); return () => { isMounted = false; if (subscription) { subscription.remove(); } }; }, [state.accuracy, state.isTracking]); useFocusEffect(onFocus); const startLocationUpdates = React.useCallback( async (acc = state.accuracy) => { if ((await Location.getBackgroundPermissionsAsync()).status !== 'granted') { console.log( 'Missing background location permissions. Make sure it is granted in the OS Settings.' ); return; } await Location.startLocationUpdatesAsync(LOCATION_UPDATES_TASK, { accuracy: acc, activityType: state.activityType ?? undefined, pausesUpdatesAutomatically: state.activityType != null, showsBackgroundLocationIndicator: state.showsBackgroundLocationIndicator, deferredUpdatesInterval: 60 * 1000, // 1 minute deferredUpdatesDistance: 100, // 100 meters foregroundService: { notificationTitle: 'expo-location-demo', notificationBody: 'Background location is running...', notificationColor: Colors.tintColor, }, }); if (!state.isTracking) { alert( // tslint:disable-next-line max-line-length 'Now you can send app to the background, go somewhere and come back here! You can even terminate the app and it will be woken up when the new significant location change comes out.' ); } dispatch({ isTracking: true, }); }, [state.isTracking, state.accuracy, state.activityType, state.showsBackgroundLocationIndicator] ); const stopLocationUpdates = React.useCallback(async () => { await Location.stopLocationUpdatesAsync(LOCATION_UPDATES_TASK); dispatch({ isTracking: false, }); }, []); const clearLocations = React.useCallback(async () => { await AsyncStorage.setItem(STORAGE_KEY, JSON.stringify([])); dispatch({ savedLocations: [], }); }, []); const toggleTracking = React.useCallback(async () => { await AsyncStorage.removeItem(STORAGE_KEY); if (state.isTracking) { await stopLocationUpdates(); } else { await startLocationUpdates(); } dispatch({ savedLocations: [], }); }, [state.isTracking, startLocationUpdates, stopLocationUpdates]); const onAccuracyChange = React.useCallback(() => { const currentAccuracy = locationAccuracyStates[state.accuracy]; dispatch({ accuracy: currentAccuracy, }); if (state.isTracking) { // Restart background task with the new accuracy. startLocationUpdates(currentAccuracy); } }, [state.accuracy, state.isTracking, startLocationUpdates]); const toggleLocationIndicator = React.useCallback(() => { dispatch({ showsBackgroundLocationIndicator: !state.showsBackgroundLocationIndicator, }); if (state.isTracking) { startLocationUpdates(); } }, [state.showsBackgroundLocationIndicator, state.isTracking, startLocationUpdates]); const toggleActivityType = React.useCallback(() => { let nextActivityType: Location.ActivityType | null; if (state.activityType) { nextActivityType = locationActivityTypes[state.activityType] ?? null; } else { nextActivityType = Location.ActivityType.Other; } dispatch({ activityType: nextActivityType, }); if (state.isTracking) { // Restart background task with the new activity type startLocationUpdates(); } }, [state.activityType, state.isTracking, startLocationUpdates]); const onCenterMap = React.useCallback(async () => { const { coords } = await Location.getCurrentPositionAsync(); const mapView = mapViewRef.current; if (mapView) { mapView.animateToRegion({ latitude: coords.latitude, longitude: coords.longitude, latitudeDelta: 0.004, longitudeDelta: 0.002, }); } }, []); const renderPolyline = React.useCallback(() => { if (state.savedLocations.length === 0) { return null; } return ( // @ts-ignore <MapView.Polyline coordinates={state.savedLocations} strokeWidth={3} strokeColor={Colors.tintColor} /> ); }, [state.savedLocations]); return ( <View style={styles.screen}> <PermissionsModal /> <MapView ref={mapViewRef} style={styles.mapView} initialRegion={state.initialRegion ?? undefined} showsUserLocation> {renderPolyline()} </MapView> <View style={styles.buttons} pointerEvents="box-none"> <View style={styles.topButtons}> <View style={styles.buttonsColumn}> {Platform.OS === 'android' ? null : ( <Button style={styles.button} onPress={toggleLocationIndicator}> <View style={styles.buttonContentWrapper}> <Text style={styles.text}> {state.showsBackgroundLocationIndicator ? 'Hide' : 'Show'} </Text> <Text style={styles.text}> background </Text> <FontAwesome name="location-arrow" size={20} color="white" /> <Text style={styles.text}> indicator</Text> </View> </Button> )} {Platform.OS === 'android' ? null : ( <Button style={styles.button} onPress={toggleActivityType} title={ state.activityType ? `Activity type: ${Location.ActivityType[state.activityType]}` : 'No activity type' } /> )} <Button title={`Accuracy: ${Location.Accuracy[state.accuracy]}`} style={styles.button} onPress={onAccuracyChange} /> </View> <View style={styles.buttonsColumn}> <Button style={styles.button} onPress={onCenterMap}> <MaterialIcons name="my-location" size={20} color="white" /> </Button> </View> </View> <View style={styles.bottomButtons}> <Button title="Clear locations" style={styles.button} onPress={clearLocations} /> <Button title={state.isTracking ? 'Stop tracking' : 'Start tracking'} style={styles.button} onPress={toggleTracking} /> </View> </View> </View> ); } const PermissionsModal = () => { const [showPermissionsModal, setShowPermissionsModal] = React.useState(true); const [permission] = usePermissions(Location.getBackgroundPermissionsAsync); return ( <Modal animationType="slide" transparent={false} visible={!permission && showPermissionsModal} onRequestClose={() => { setShowPermissionsModal(!showPermissionsModal); }}> <View style={{ flex: 1, justifyContent: 'space-around', alignItems: 'center' }}> <View style={{ flex: 2, justifyContent: 'center', alignItems: 'center' }}> <Text style={styles.modalHeader}>Background location access</Text> <Text style={styles.modalText}> This app collects location data to enable updating the MapView in the background even when the app is closed or not in use. Otherwise, your location on the map will only be updated while the app is foregrounded. </Text> <Text style={styles.modalText}> This data is not used for anything other than updating the position on the map, and this data is never shared with anyone. </Text> </View> <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}> <Button title="Request background location permission" style={styles.button} onPress={async () => { // Need both background and foreground permissions await Location.requestForegroundPermissionsAsync(); await Location.requestBackgroundPermissionsAsync(); setShowPermissionsModal(!showPermissionsModal); }} /> <Button title="Continue without background location permission" style={styles.button} onPress={() => setShowPermissionsModal(!showPermissionsModal)} /> </View> </View> </Modal> ); }; BackgroundLocationMapScreen.navigationOptions = { title: 'Background location', }; async function getSavedLocations() { try { const item = await AsyncStorage.getItem(STORAGE_KEY); return item ? JSON.parse(item) : []; } catch (e) { return []; } } TaskManager.defineTask(LOCATION_UPDATES_TASK, async ({ data: { locations } }: any) => { if (locations && locations.length > 0) { const savedLocations = await getSavedLocations(); const newLocations = locations.map(({ coords }: any) => ({ latitude: coords.latitude, longitude: coords.longitude, })); // tslint:disable-next-line no-console console.log(`Received new locations at ${new Date()}:`, locations); savedLocations.push(...newLocations); await AsyncStorage.setItem(STORAGE_KEY, JSON.stringify(savedLocations)); locationEventsEmitter.emit('update', savedLocations); } }); const styles = StyleSheet.create({ screen: { flex: 1, }, mapView: { flex: 1, }, buttons: { flex: 1, flexDirection: 'column', justifyContent: 'space-between', padding: 10, position: 'absolute', top: 0, right: 0, bottom: 0, left: 0, }, topButtons: { flexDirection: 'row', justifyContent: 'space-between', }, bottomButtons: { flexDirection: 'column', alignItems: 'flex-end', }, buttonsColumn: { flexDirection: 'column', alignItems: 'flex-start', }, button: { paddingVertical: 5, paddingHorizontal: 10, marginVertical: 5, }, buttonContentWrapper: { flexDirection: 'row', }, text: { color: 'white', fontWeight: '700', }, errorText: { fontSize: 15, color: 'rgba(0,0,0,0.7)', margin: 20, }, modalHeader: { padding: 12, fontSize: 20, fontWeight: '800' }, modalText: { padding: 8, fontWeight: '600' }, });
exponentjs/exponent
apps/native-component-list/src/screens/Location/BackgroundLocationMapScreen.tsx
TypeScript
bsd-3-clause
15,261
using System; namespace DistributedPrimeCalculatorApp { public class MessageTypes { public const int Terminate = 0; //tells the prime worker to stop public const int Start = 1; //initialize the prime workers public const int ReplyBatch = 2; //the main worker sends a batch of numbers public const int RequestBatch = 3; //the prime worker requests a new batch public const int Result = 4; //the prime worker sends the count back } }
parallax68/MPAPI
DistributedPrimeCalculatorApp/MessageTypes.cs
C#
bsd-3-clause
450
// // Use this file to import your target's public headers that you would like to expose to Swift. // #import "MockORKTask.h" #import "MockTrackedDataStore.h" #import "MockAppInfoDelegate.h" #import "MockKeychainWrapper.h" #import "BridgeSDKTestable.h"
Sage-Bionetworks/BridgeAppSDK
BridgeAppSDKTests/BridgeAppSDKTests-Bridging-Header.h
C
bsd-3-clause
255
/*! * Bootstrap v2.3.2 * * Copyright 2012 Twitter, Inc * Licensed under the Apache License v2.0 * http://www.apache.org/licenses/LICENSE-2.0 * * Designed and built with all the love in the world @twitter by @mdo and @fat. */ .clearfix { *zoom: 1; } .clearfix:before, .clearfix:after { display: table; content: ""; line-height: 0; } .clearfix:after { clear: both; } .hide-text { font: 0/0 a; color: transparent; text-shadow: none; background-color: transparent; border: 0; } .input-block-level { display: block; width: 100%; min-height: 30px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; } audio, canvas, video { display: inline-block; *display: inline; *zoom: 1; } audio:not([controls]) { display: none; } html { font-size: 100%; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; } a:focus { outline: thin dotted #333; outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; } a:hover, a:active { outline: 0; } sub, sup { position: relative; font-size: 75%; line-height: 0; vertical-align: baseline; } sup { top: -0.5em; } sub { bottom: -0.25em; } img { /* Responsive images (ensure images don't scale beyond their parents) */ max-width: 100%; /* Part 1: Set a maxium relative to the parent */ width: auto\9; /* IE7-8 need help adjusting responsive images */ height: auto; /* Part 2: Scale the height according to the width, otherwise you get stretching */ vertical-align: middle; border: 0; -ms-interpolation-mode: bicubic; } #map_canvas img, .google-maps img { max-width: none; } button, input, select, textarea { margin: 0; font-size: 100%; vertical-align: middle; } button, input { *overflow: visible; line-height: normal; } button::-moz-focus-inner, input::-moz-focus-inner { padding: 0; border: 0; } button, html input[type="button"], input[type="reset"], input[type="submit"] { -webkit-appearance: button; cursor: pointer; } label, select, button, input[type="button"], input[type="reset"], input[type="submit"], input[type="radio"], input[type="checkbox"] { cursor: pointer; } input[type="search"] { -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; -webkit-appearance: textfield; } input[type="search"]::-webkit-search-decoration, input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; } textarea { overflow: auto; vertical-align: top; } @media print { * { text-shadow: none !important; color: #000 !important; background: transparent !important; box-shadow: none !important; } a, a:visited { text-decoration: underline; } a[href]:after { content: " (" attr(href) ")"; } abbr[title]:after { content: " (" attr(title) ")"; } .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; } pre, blockquote { border: 1px solid #999; page-break-inside: avoid; } thead { display: table-header-group; } tr, img { page-break-inside: avoid; } img { max-width: 100% !important; } @page { margin: 0.5cm; } p, h2, h3 { orphans: 3; widows: 3; } h2, h3 { page-break-after: avoid; } } body { margin: 0; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; color: #2a2a2a; background-color: #c5ad91; } a { color: #715458; text-decoration: none; } a:hover, a:focus { color: #ca3308; text-decoration: underline; } .img-rounded { -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; } .img-polaroid { padding: 4px; background-color: #fff; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, 0.2); -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); } .img-circle { -webkit-border-radius: 500px; -moz-border-radius: 500px; border-radius: 500px; } .row { margin-left: -20px; *zoom: 1; } .row:before, .row:after { display: table; content: ""; line-height: 0; } .row:after { clear: both; } [class*="span"] { float: left; min-height: 1px; margin-left: 20px; } .container, .navbar-static-top .container, .navbar-fixed-top .container, .navbar-fixed-bottom .container { width: 940px; } .span12 { width: 940px; } .span11 { width: 860px; } .span10 { width: 780px; } .span9 { width: 700px; } .span8 { width: 620px; } .span7 { width: 540px; } .span6 { width: 460px; } .span5 { width: 380px; } .span4 { width: 300px; } .span3 { width: 220px; } .span2 { width: 140px; } .span1 { width: 60px; } .offset12 { margin-left: 980px; } .offset11 { margin-left: 900px; } .offset10 { margin-left: 820px; } .offset9 { margin-left: 740px; } .offset8 { margin-left: 660px; } .offset7 { margin-left: 580px; } .offset6 { margin-left: 500px; } .offset5 { margin-left: 420px; } .offset4 { margin-left: 340px; } .offset3 { margin-left: 260px; } .offset2 { margin-left: 180px; } .offset1 { margin-left: 100px; } .row-fluid { width: 100%; *zoom: 1; } .row-fluid:before, .row-fluid:after { display: table; content: ""; line-height: 0; } .row-fluid:after { clear: both; } .row-fluid [class*="span"] { display: block; width: 100%; min-height: 30px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; float: left; margin-left: 2.127659574468085%; *margin-left: 2.074468085106383%; } .row-fluid [class*="span"]:first-child { margin-left: 0; } .row-fluid .controls-row [class*="span"] + [class*="span"] { margin-left: 2.127659574468085%; } .row-fluid .span12 { width: 100%; *width: 99.94680851063829%; } .row-fluid .span11 { width: 91.48936170212765%; *width: 91.43617021276594%; } .row-fluid .span10 { width: 82.97872340425532%; *width: 82.92553191489361%; } .row-fluid .span9 { width: 74.46808510638297%; *width: 74.41489361702126%; } .row-fluid .span8 { width: 65.95744680851064%; *width: 65.90425531914893%; } .row-fluid .span7 { width: 57.44680851063829%; *width: 57.39361702127659%; } .row-fluid .span6 { width: 48.93617021276595%; *width: 48.88297872340425%; } .row-fluid .span5 { width: 40.42553191489362%; *width: 40.37234042553192%; } .row-fluid .span4 { width: 31.914893617021278%; *width: 31.861702127659576%; } .row-fluid .span3 { width: 23.404255319148934%; *width: 23.351063829787233%; } .row-fluid .span2 { width: 14.893617021276595%; *width: 14.840425531914894%; } .row-fluid .span1 { width: 6.382978723404255%; *width: 6.329787234042553%; } .row-fluid .offset12 { margin-left: 104.25531914893617%; *margin-left: 104.14893617021275%; } .row-fluid .offset12:first-child { margin-left: 102.12765957446808%; *margin-left: 102.02127659574467%; } .row-fluid .offset11 { margin-left: 95.74468085106382%; *margin-left: 95.6382978723404%; } .row-fluid .offset11:first-child { margin-left: 93.61702127659574%; *margin-left: 93.51063829787232%; } .row-fluid .offset10 { margin-left: 87.23404255319149%; *margin-left: 87.12765957446807%; } .row-fluid .offset10:first-child { margin-left: 85.1063829787234%; *margin-left: 84.99999999999999%; } .row-fluid .offset9 { margin-left: 78.72340425531914%; *margin-left: 78.61702127659572%; } .row-fluid .offset9:first-child { margin-left: 76.59574468085106%; *margin-left: 76.48936170212764%; } .row-fluid .offset8 { margin-left: 70.2127659574468%; *margin-left: 70.10638297872339%; } .row-fluid .offset8:first-child { margin-left: 68.08510638297872%; *margin-left: 67.9787234042553%; } .row-fluid .offset7 { margin-left: 61.70212765957446%; *margin-left: 61.59574468085106%; } .row-fluid .offset7:first-child { margin-left: 59.574468085106375%; *margin-left: 59.46808510638297%; } .row-fluid .offset6 { margin-left: 53.191489361702125%; *margin-left: 53.085106382978715%; } .row-fluid .offset6:first-child { margin-left: 51.063829787234035%; *margin-left: 50.95744680851063%; } .row-fluid .offset5 { margin-left: 44.68085106382979%; *margin-left: 44.57446808510638%; } .row-fluid .offset5:first-child { margin-left: 42.5531914893617%; *margin-left: 42.4468085106383%; } .row-fluid .offset4 { margin-left: 36.170212765957444%; *margin-left: 36.06382978723405%; } .row-fluid .offset4:first-child { margin-left: 34.04255319148936%; *margin-left: 33.93617021276596%; } .row-fluid .offset3 { margin-left: 27.659574468085104%; *margin-left: 27.5531914893617%; } .row-fluid .offset3:first-child { margin-left: 25.53191489361702%; *margin-left: 25.425531914893618%; } .row-fluid .offset2 { margin-left: 19.148936170212764%; *margin-left: 19.04255319148936%; } .row-fluid .offset2:first-child { margin-left: 17.02127659574468%; *margin-left: 16.914893617021278%; } .row-fluid .offset1 { margin-left: 10.638297872340425%; *margin-left: 10.53191489361702%; } .row-fluid .offset1:first-child { margin-left: 8.51063829787234%; *margin-left: 8.404255319148938%; } [class*="span"].hide, .row-fluid [class*="span"].hide { display: none; } [class*="span"].pull-right, .row-fluid [class*="span"].pull-right { float: right; } .container { margin-right: auto; margin-left: auto; *zoom: 1; } .container:before, .container:after { display: table; content: ""; line-height: 0; } .container:after { clear: both; } .container-fluid { padding-right: 20px; padding-left: 20px; *zoom: 1; } .container-fluid:before, .container-fluid:after { display: table; content: ""; line-height: 0; } .container-fluid:after { clear: both; } p { margin: 0 0 10px; } .lead { margin-bottom: 20px; font-size: 21px; font-weight: 200; line-height: 30px; } small { font-size: 85%; } strong { font-weight: bold; } em { font-style: italic; } cite { font-style: normal; } .muted { color: #999999; } a.muted:hover, a.muted:focus { color: #808080; } .text-warning { color: #c09853; } a.text-warning:hover, a.text-warning:focus { color: #a47e3c; } .text-error { color: #b94a48; } a.text-error:hover, a.text-error:focus { color: #953b39; } .text-info { color: #3a87ad; } a.text-info:hover, a.text-info:focus { color: #2d6987; } .text-success { color: #468847; } a.text-success:hover, a.text-success:focus { color: #356635; } .text-left { text-align: left; } .text-right { text-align: right; } .text-center { text-align: center; } h1, h2, h3, h4, h5, h6 { margin: 10px 0; font-family: inherit; font-weight: bold; line-height: 20px; color: inherit; text-rendering: optimizelegibility; } h1 small, h2 small, h3 small, h4 small, h5 small, h6 small { font-weight: normal; line-height: 1; color: #999999; } h1, h2, h3 { line-height: 40px; } h1 { font-size: 38.5px; } h2 { font-size: 31.5px; } h3 { font-size: 24.5px; } h4 { font-size: 17.5px; } h5 { font-size: 14px; } h6 { font-size: 11.9px; } h1 small { font-size: 24.5px; } h2 small { font-size: 17.5px; } h3 small { font-size: 14px; } h4 small { font-size: 14px; } .page-header { padding-bottom: 9px; margin: 20px 0 30px; border-bottom: 1px solid #eeeeee; } ul, ol { padding: 0; margin: 0 0 10px 25px; } ul ul, ul ol, ol ol, ol ul { margin-bottom: 0; } li { line-height: 20px; } ul.unstyled, ol.unstyled { margin-left: 0; list-style: none; } ul.inline, ol.inline { margin-left: 0; list-style: none; } ul.inline > li, ol.inline > li { display: inline-block; *display: inline; /* IE7 inline-block hack */ *zoom: 1; padding-left: 5px; padding-right: 5px; } dl { margin-bottom: 20px; } dt, dd { line-height: 20px; } dt { font-weight: bold; } dd { margin-left: 10px; } .dl-horizontal { *zoom: 1; } .dl-horizontal:before, .dl-horizontal:after { display: table; content: ""; line-height: 0; } .dl-horizontal:after { clear: both; } .dl-horizontal dt { float: left; width: 160px; clear: left; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .dl-horizontal dd { margin-left: 180px; } hr { margin: 20px 0; border: 0; border-top: 1px solid #eeeeee; border-bottom: 1px solid #ffffff; } abbr[title], abbr[data-original-title] { cursor: help; border-bottom: 1px dotted #999999; } abbr.initialism { font-size: 90%; text-transform: uppercase; } blockquote { padding: 0 0 0 15px; margin: 0 0 20px; border-left: 5px solid #eeeeee; } blockquote p { margin-bottom: 0; font-size: 17.5px; font-weight: 300; line-height: 1.25; } blockquote small { display: block; line-height: 20px; color: #999999; } blockquote small:before { content: '\2014 \00A0'; } blockquote.pull-right { float: right; padding-right: 15px; padding-left: 0; border-right: 5px solid #eeeeee; border-left: 0; } blockquote.pull-right p, blockquote.pull-right small { text-align: right; } blockquote.pull-right small:before { content: ''; } blockquote.pull-right small:after { content: '\00A0 \2014'; } q:before, q:after, blockquote:before, blockquote:after { content: ""; } address { display: block; margin-bottom: 20px; font-style: normal; line-height: 20px; } code, pre { padding: 0 3px 2px; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; color: #333333; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } code { padding: 2px 4px; color: #d14; background-color: #f7f7f9; border: 1px solid #e1e1e8; white-space: nowrap; } pre { display: block; padding: 9.5px; margin: 0 0 10px; font-size: 13px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, 0.15); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } pre.prettyprint { margin-bottom: 20px; } pre code { padding: 0; color: inherit; white-space: pre; white-space: pre-wrap; background-color: transparent; border: 0; } .pre-scrollable { max-height: 340px; overflow-y: scroll; } .label, .badge { display: inline-block; padding: 2px 4px; font-size: 11.844px; font-weight: bold; line-height: 14px; color: #ffffff; vertical-align: baseline; white-space: nowrap; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #999999; } .label { -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } .badge { padding-left: 9px; padding-right: 9px; -webkit-border-radius: 9px; -moz-border-radius: 9px; border-radius: 9px; } .label:empty, .badge:empty { display: none; } a.label:hover, a.label:focus, a.badge:hover, a.badge:focus { color: #ffffff; text-decoration: none; cursor: pointer; } .label-important, .badge-important { background-color: #b94a48; } .label-important[href], .badge-important[href] { background-color: #953b39; } .label-warning, .badge-warning { background-color: #fc9f06; } .label-warning[href], .badge-warning[href] { background-color: #cd8002; } .label-success, .badge-success { background-color: #468847; } .label-success[href], .badge-success[href] { background-color: #356635; } .label-info, .badge-info { background-color: #3a87ad; } .label-info[href], .badge-info[href] { background-color: #2d6987; } .label-inverse, .badge-inverse { background-color: #333333; } .label-inverse[href], .badge-inverse[href] { background-color: #1a1a1a; } .btn .label, .btn .badge { position: relative; top: -1px; } .btn-mini .label, .btn-mini .badge { top: 0; } table { max-width: 100%; background-color: transparent; border-collapse: collapse; border-spacing: 0; } .table { width: 100%; margin-bottom: 20px; } .table th, .table td { padding: 8px; line-height: 20px; text-align: left; vertical-align: top; border-top: 1px solid #dddddd; } .table th { font-weight: bold; } .table thead th { vertical-align: bottom; } .table caption + thead tr:first-child th, .table caption + thead tr:first-child td, .table colgroup + thead tr:first-child th, .table colgroup + thead tr:first-child td, .table thead:first-child tr:first-child th, .table thead:first-child tr:first-child td { border-top: 0; } .table tbody + tbody { border-top: 2px solid #dddddd; } .table .table { background-color: #c5ad91; } .table-condensed th, .table-condensed td { padding: 4px 5px; } .table-bordered { border: 1px solid #dddddd; border-collapse: separate; *border-collapse: collapse; border-left: 0; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .table-bordered th, .table-bordered td { border-left: 1px solid #dddddd; } .table-bordered caption + thead tr:first-child th, .table-bordered caption + tbody tr:first-child th, .table-bordered caption + tbody tr:first-child td, .table-bordered colgroup + thead tr:first-child th, .table-bordered colgroup + tbody tr:first-child th, .table-bordered colgroup + tbody tr:first-child td, .table-bordered thead:first-child tr:first-child th, .table-bordered tbody:first-child tr:first-child th, .table-bordered tbody:first-child tr:first-child td { border-top: 0; } .table-bordered thead:first-child tr:first-child > th:first-child, .table-bordered tbody:first-child tr:first-child > td:first-child, .table-bordered tbody:first-child tr:first-child > th:first-child { -webkit-border-top-left-radius: 4px; -moz-border-radius-topleft: 4px; border-top-left-radius: 4px; } .table-bordered thead:first-child tr:first-child > th:last-child, .table-bordered tbody:first-child tr:first-child > td:last-child, .table-bordered tbody:first-child tr:first-child > th:last-child { -webkit-border-top-right-radius: 4px; -moz-border-radius-topright: 4px; border-top-right-radius: 4px; } .table-bordered thead:last-child tr:last-child > th:first-child, .table-bordered tbody:last-child tr:last-child > td:first-child, .table-bordered tbody:last-child tr:last-child > th:first-child, .table-bordered tfoot:last-child tr:last-child > td:first-child, .table-bordered tfoot:last-child tr:last-child > th:first-child { -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomleft: 4px; border-bottom-left-radius: 4px; } .table-bordered thead:last-child tr:last-child > th:last-child, .table-bordered tbody:last-child tr:last-child > td:last-child, .table-bordered tbody:last-child tr:last-child > th:last-child, .table-bordered tfoot:last-child tr:last-child > td:last-child, .table-bordered tfoot:last-child tr:last-child > th:last-child { -webkit-border-bottom-right-radius: 4px; -moz-border-radius-bottomright: 4px; border-bottom-right-radius: 4px; } .table-bordered tfoot + tbody:last-child tr:last-child td:first-child { -webkit-border-bottom-left-radius: 0; -moz-border-radius-bottomleft: 0; border-bottom-left-radius: 0; } .table-bordered tfoot + tbody:last-child tr:last-child td:last-child { -webkit-border-bottom-right-radius: 0; -moz-border-radius-bottomright: 0; border-bottom-right-radius: 0; } .table-bordered caption + thead tr:first-child th:first-child, .table-bordered caption + tbody tr:first-child td:first-child, .table-bordered colgroup + thead tr:first-child th:first-child, .table-bordered colgroup + tbody tr:first-child td:first-child { -webkit-border-top-left-radius: 4px; -moz-border-radius-topleft: 4px; border-top-left-radius: 4px; } .table-bordered caption + thead tr:first-child th:last-child, .table-bordered caption + tbody tr:first-child td:last-child, .table-bordered colgroup + thead tr:first-child th:last-child, .table-bordered colgroup + tbody tr:first-child td:last-child { -webkit-border-top-right-radius: 4px; -moz-border-radius-topright: 4px; border-top-right-radius: 4px; } .table-striped tbody > tr:nth-child(odd) > td, .table-striped tbody > tr:nth-child(odd) > th { background-color: #f9f9f9; } .table-hover tbody tr:hover > td, .table-hover tbody tr:hover > th { background-color: #f5f5f5; } table td[class*="span"], table th[class*="span"], .row-fluid table td[class*="span"], .row-fluid table th[class*="span"] { display: table-cell; float: none; margin-left: 0; } .table td.span1, .table th.span1 { float: none; width: 44px; margin-left: 0; } .table td.span2, .table th.span2 { float: none; width: 124px; margin-left: 0; } .table td.span3, .table th.span3 { float: none; width: 204px; margin-left: 0; } .table td.span4, .table th.span4 { float: none; width: 284px; margin-left: 0; } .table td.span5, .table th.span5 { float: none; width: 364px; margin-left: 0; } .table td.span6, .table th.span6 { float: none; width: 444px; margin-left: 0; } .table td.span7, .table th.span7 { float: none; width: 524px; margin-left: 0; } .table td.span8, .table th.span8 { float: none; width: 604px; margin-left: 0; } .table td.span9, .table th.span9 { float: none; width: 684px; margin-left: 0; } .table td.span10, .table th.span10 { float: none; width: 764px; margin-left: 0; } .table td.span11, .table th.span11 { float: none; width: 844px; margin-left: 0; } .table td.span12, .table th.span12 { float: none; width: 924px; margin-left: 0; } .table tbody tr.success > td { background-color: #dff0d8; } .table tbody tr.error > td { background-color: #f2dede; } .table tbody tr.warning > td { background-color: #fcf8e3; } .table tbody tr.info > td { background-color: #d9edf7; } .table-hover tbody tr.success:hover > td { background-color: #d0e9c6; } .table-hover tbody tr.error:hover > td { background-color: #ebcccc; } .table-hover tbody tr.warning:hover > td { background-color: #faf2cc; } .table-hover tbody tr.info:hover > td { background-color: #c4e3f3; } form { margin: 0 0 20px; } fieldset { padding: 0; margin: 0; border: 0; } legend { display: block; width: 100%; padding: 0; margin-bottom: 20px; font-size: 21px; line-height: 40px; color: #333333; border: 0; border-bottom: 1px solid #e5e5e5; } legend small { font-size: 15px; color: #999999; } label, input, button, select, textarea { font-size: 14px; font-weight: normal; line-height: 20px; } input, button, select, textarea { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; } label { display: block; margin-bottom: 5px; } select, textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input { display: inline-block; height: 20px; padding: 4px 6px; margin-bottom: 10px; font-size: 14px; line-height: 20px; color: #555555; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; vertical-align: middle; } input, textarea, .uneditable-input { width: 206px; } textarea { height: auto; } textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input { background-color: #ffffff; border: 1px solid #cccccc; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -webkit-transition: border linear .2s, box-shadow linear .2s; -moz-transition: border linear .2s, box-shadow linear .2s; -o-transition: border linear .2s, box-shadow linear .2s; transition: border linear .2s, box-shadow linear .2s; } textarea:focus, input[type="text"]:focus, input[type="password"]:focus, input[type="datetime"]:focus, input[type="datetime-local"]:focus, input[type="date"]:focus, input[type="month"]:focus, input[type="time"]:focus, input[type="week"]:focus, input[type="number"]:focus, input[type="email"]:focus, input[type="url"]:focus, input[type="search"]:focus, input[type="tel"]:focus, input[type="color"]:focus, .uneditable-input:focus { border-color: rgba(82, 168, 236, 0.8); outline: 0; outline: thin dotted \9; /* IE6-9 */ -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6); -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6); box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6); } input[type="radio"], input[type="checkbox"] { margin: 4px 0 0; *margin-top: 0; /* IE7 */ margin-top: 1px \9; /* IE8-9 */ line-height: normal; } input[type="file"], input[type="image"], input[type="submit"], input[type="reset"], input[type="button"], input[type="radio"], input[type="checkbox"] { width: auto; } select, input[type="file"] { height: 30px; /* In IE7, the height of the select element cannot be changed by height, only font-size */ *margin-top: 4px; /* For IE7, add top margin to align select with labels */ line-height: 30px; } select { width: 220px; border: 1px solid #cccccc; background-color: #ffffff; } select[multiple], select[size] { height: auto; } select:focus, input[type="file"]:focus, input[type="radio"]:focus, input[type="checkbox"]:focus { outline: thin dotted #333; outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; } .uneditable-input, .uneditable-textarea { color: #999999; background-color: #fcfcfc; border-color: #cccccc; -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); cursor: not-allowed; } .uneditable-input { overflow: hidden; white-space: nowrap; } .uneditable-textarea { width: auto; height: auto; } input:-moz-placeholder, textarea:-moz-placeholder { color: #999999; } input:-ms-input-placeholder, textarea:-ms-input-placeholder { color: #999999; } input::-webkit-input-placeholder, textarea::-webkit-input-placeholder { color: #999999; } .radio, .checkbox { min-height: 20px; padding-left: 20px; } .radio input[type="radio"], .checkbox input[type="checkbox"] { float: left; margin-left: -20px; } .controls > .radio:first-child, .controls > .checkbox:first-child { padding-top: 5px; } .radio.inline, .checkbox.inline { display: inline-block; padding-top: 5px; margin-bottom: 0; vertical-align: middle; } .radio.inline + .radio.inline, .checkbox.inline + .checkbox.inline { margin-left: 10px; } .input-mini { width: 60px; } .input-small { width: 90px; } .input-medium { width: 150px; } .input-large { width: 210px; } .input-xlarge { width: 270px; } .input-xxlarge { width: 530px; } input[class*="span"], select[class*="span"], textarea[class*="span"], .uneditable-input[class*="span"], .row-fluid input[class*="span"], .row-fluid select[class*="span"], .row-fluid textarea[class*="span"], .row-fluid .uneditable-input[class*="span"] { float: none; margin-left: 0; } .input-append input[class*="span"], .input-append .uneditable-input[class*="span"], .input-prepend input[class*="span"], .input-prepend .uneditable-input[class*="span"], .row-fluid input[class*="span"], .row-fluid select[class*="span"], .row-fluid textarea[class*="span"], .row-fluid .uneditable-input[class*="span"], .row-fluid .input-prepend [class*="span"], .row-fluid .input-append [class*="span"] { display: inline-block; } input, textarea, .uneditable-input { margin-left: 0; } .controls-row [class*="span"] + [class*="span"] { margin-left: 20px; } input.span12, textarea.span12, .uneditable-input.span12 { width: 926px; } input.span11, textarea.span11, .uneditable-input.span11 { width: 846px; } input.span10, textarea.span10, .uneditable-input.span10 { width: 766px; } input.span9, textarea.span9, .uneditable-input.span9 { width: 686px; } input.span8, textarea.span8, .uneditable-input.span8 { width: 606px; } input.span7, textarea.span7, .uneditable-input.span7 { width: 526px; } input.span6, textarea.span6, .uneditable-input.span6 { width: 446px; } input.span5, textarea.span5, .uneditable-input.span5 { width: 366px; } input.span4, textarea.span4, .uneditable-input.span4 { width: 286px; } input.span3, textarea.span3, .uneditable-input.span3 { width: 206px; } input.span2, textarea.span2, .uneditable-input.span2 { width: 126px; } input.span1, textarea.span1, .uneditable-input.span1 { width: 46px; } .controls-row { *zoom: 1; } .controls-row:before, .controls-row:after { display: table; content: ""; line-height: 0; } .controls-row:after { clear: both; } .controls-row [class*="span"], .row-fluid .controls-row [class*="span"] { float: left; } .controls-row .checkbox[class*="span"], .controls-row .radio[class*="span"] { padding-top: 5px; } input[disabled], select[disabled], textarea[disabled], input[readonly], select[readonly], textarea[readonly] { cursor: not-allowed; background-color: #eeeeee; } input[type="radio"][disabled], input[type="checkbox"][disabled], input[type="radio"][readonly], input[type="checkbox"][readonly] { background-color: transparent; } .control-group.warning .control-label, .control-group.warning .help-block, .control-group.warning .help-inline { color: #c09853; } .control-group.warning .checkbox, .control-group.warning .radio, .control-group.warning input, .control-group.warning select, .control-group.warning textarea { color: #c09853; } .control-group.warning input, .control-group.warning select, .control-group.warning textarea { border-color: #c09853; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); } .control-group.warning input:focus, .control-group.warning select:focus, .control-group.warning textarea:focus { border-color: #a47e3c; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e; -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e; } .control-group.warning .input-prepend .add-on, .control-group.warning .input-append .add-on { color: #c09853; background-color: #fcf8e3; border-color: #c09853; } .control-group.error .control-label, .control-group.error .help-block, .control-group.error .help-inline { color: #b94a48; } .control-group.error .checkbox, .control-group.error .radio, .control-group.error input, .control-group.error select, .control-group.error textarea { color: #b94a48; } .control-group.error input, .control-group.error select, .control-group.error textarea { border-color: #b94a48; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); } .control-group.error input:focus, .control-group.error select:focus, .control-group.error textarea:focus { border-color: #953b39; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392; -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392; } .control-group.error .input-prepend .add-on, .control-group.error .input-append .add-on { color: #b94a48; background-color: #f2dede; border-color: #b94a48; } .control-group.success .control-label, .control-group.success .help-block, .control-group.success .help-inline { color: #468847; } .control-group.success .checkbox, .control-group.success .radio, .control-group.success input, .control-group.success select, .control-group.success textarea { color: #468847; } .control-group.success input, .control-group.success select, .control-group.success textarea { border-color: #468847; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); } .control-group.success input:focus, .control-group.success select:focus, .control-group.success textarea:focus { border-color: #356635; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b; -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b; } .control-group.success .input-prepend .add-on, .control-group.success .input-append .add-on { color: #468847; background-color: #dff0d8; border-color: #468847; } .control-group.info .control-label, .control-group.info .help-block, .control-group.info .help-inline { color: #3a87ad; } .control-group.info .checkbox, .control-group.info .radio, .control-group.info input, .control-group.info select, .control-group.info textarea { color: #3a87ad; } .control-group.info input, .control-group.info select, .control-group.info textarea { border-color: #3a87ad; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); } .control-group.info input:focus, .control-group.info select:focus, .control-group.info textarea:focus { border-color: #2d6987; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7ab5d3; -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7ab5d3; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7ab5d3; } .control-group.info .input-prepend .add-on, .control-group.info .input-append .add-on { color: #3a87ad; background-color: #d9edf7; border-color: #3a87ad; } input:focus:invalid, textarea:focus:invalid, select:focus:invalid { color: #b94a48; border-color: #ee5f5b; } input:focus:invalid:focus, textarea:focus:invalid:focus, select:focus:invalid:focus { border-color: #e9322d; -webkit-box-shadow: 0 0 6px #f8b9b7; -moz-box-shadow: 0 0 6px #f8b9b7; box-shadow: 0 0 6px #f8b9b7; } .form-actions { padding: 19px 20px 20px; margin-top: 20px; margin-bottom: 20px; background-color: #f5f5f5; border-top: 1px solid #e5e5e5; *zoom: 1; } .form-actions:before, .form-actions:after { display: table; content: ""; line-height: 0; } .form-actions:after { clear: both; } .help-block, .help-inline { color: #505050; } .help-block { display: block; margin-bottom: 10px; } .help-inline { display: inline-block; *display: inline; /* IE7 inline-block hack */ *zoom: 1; vertical-align: middle; padding-left: 5px; } .input-append, .input-prepend { display: inline-block; margin-bottom: 10px; vertical-align: middle; font-size: 0; white-space: nowrap; } .input-append input, .input-prepend input, .input-append select, .input-prepend select, .input-append .uneditable-input, .input-prepend .uneditable-input, .input-append .dropdown-menu, .input-prepend .dropdown-menu, .input-append .popover, .input-prepend .popover { font-size: 14px; } .input-append input, .input-prepend input, .input-append select, .input-prepend select, .input-append .uneditable-input, .input-prepend .uneditable-input { position: relative; margin-bottom: 0; *margin-left: 0; vertical-align: top; -webkit-border-radius: 0 4px 4px 0; -moz-border-radius: 0 4px 4px 0; border-radius: 0 4px 4px 0; } .input-append input:focus, .input-prepend input:focus, .input-append select:focus, .input-prepend select:focus, .input-append .uneditable-input:focus, .input-prepend .uneditable-input:focus { z-index: 2; } .input-append .add-on, .input-prepend .add-on { display: inline-block; width: auto; height: 20px; min-width: 16px; padding: 4px 5px; font-size: 14px; font-weight: normal; line-height: 20px; text-align: center; text-shadow: 0 1px 0 #ffffff; background-color: #eeeeee; border: 1px solid #ccc; } .input-append .add-on, .input-prepend .add-on, .input-append .btn, .input-prepend .btn, .input-append .btn-group > .dropdown-toggle, .input-prepend .btn-group > .dropdown-toggle { vertical-align: top; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; } .input-append .active, .input-prepend .active { background-color: #a9dba9; border-color: #46a546; } .input-prepend .add-on, .input-prepend .btn { margin-right: -1px; } .input-prepend .add-on:first-child, .input-prepend .btn:first-child { -webkit-border-radius: 4px 0 0 4px; -moz-border-radius: 4px 0 0 4px; border-radius: 4px 0 0 4px; } .input-append input, .input-append select, .input-append .uneditable-input { -webkit-border-radius: 4px 0 0 4px; -moz-border-radius: 4px 0 0 4px; border-radius: 4px 0 0 4px; } .input-append input + .btn-group .btn:last-child, .input-append select + .btn-group .btn:last-child, .input-append .uneditable-input + .btn-group .btn:last-child { -webkit-border-radius: 0 4px 4px 0; -moz-border-radius: 0 4px 4px 0; border-radius: 0 4px 4px 0; } .input-append .add-on, .input-append .btn, .input-append .btn-group { margin-left: -1px; } .input-append .add-on:last-child, .input-append .btn:last-child, .input-append .btn-group:last-child > .dropdown-toggle { -webkit-border-radius: 0 4px 4px 0; -moz-border-radius: 0 4px 4px 0; border-radius: 0 4px 4px 0; } .input-prepend.input-append input, .input-prepend.input-append select, .input-prepend.input-append .uneditable-input { -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; } .input-prepend.input-append input + .btn-group .btn, .input-prepend.input-append select + .btn-group .btn, .input-prepend.input-append .uneditable-input + .btn-group .btn { -webkit-border-radius: 0 4px 4px 0; -moz-border-radius: 0 4px 4px 0; border-radius: 0 4px 4px 0; } .input-prepend.input-append .add-on:first-child, .input-prepend.input-append .btn:first-child { margin-right: -1px; -webkit-border-radius: 4px 0 0 4px; -moz-border-radius: 4px 0 0 4px; border-radius: 4px 0 0 4px; } .input-prepend.input-append .add-on:last-child, .input-prepend.input-append .btn:last-child { margin-left: -1px; -webkit-border-radius: 0 4px 4px 0; -moz-border-radius: 0 4px 4px 0; border-radius: 0 4px 4px 0; } .input-prepend.input-append .btn-group:first-child { margin-left: 0; } input.search-query { padding-right: 14px; padding-right: 4px \9; padding-left: 14px; padding-left: 4px \9; /* IE7-8 doesn't have border-radius, so don't indent the padding */ margin-bottom: 0; -webkit-border-radius: 15px; -moz-border-radius: 15px; border-radius: 15px; } /* Allow for input prepend/append in search forms */ .form-search .input-append .search-query, .form-search .input-prepend .search-query { -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; } .form-search .input-append .search-query { -webkit-border-radius: 14px 0 0 14px; -moz-border-radius: 14px 0 0 14px; border-radius: 14px 0 0 14px; } .form-search .input-append .btn { -webkit-border-radius: 0 14px 14px 0; -moz-border-radius: 0 14px 14px 0; border-radius: 0 14px 14px 0; } .form-search .input-prepend .search-query { -webkit-border-radius: 0 14px 14px 0; -moz-border-radius: 0 14px 14px 0; border-radius: 0 14px 14px 0; } .form-search .input-prepend .btn { -webkit-border-radius: 14px 0 0 14px; -moz-border-radius: 14px 0 0 14px; border-radius: 14px 0 0 14px; } .form-search input, .form-inline input, .form-horizontal input, .form-search textarea, .form-inline textarea, .form-horizontal textarea, .form-search select, .form-inline select, .form-horizontal select, .form-search .help-inline, .form-inline .help-inline, .form-horizontal .help-inline, .form-search .uneditable-input, .form-inline .uneditable-input, .form-horizontal .uneditable-input, .form-search .input-prepend, .form-inline .input-prepend, .form-horizontal .input-prepend, .form-search .input-append, .form-inline .input-append, .form-horizontal .input-append { display: inline-block; *display: inline; /* IE7 inline-block hack */ *zoom: 1; margin-bottom: 0; vertical-align: middle; } .form-search .hide, .form-inline .hide, .form-horizontal .hide { display: none; } .form-search label, .form-inline label, .form-search .btn-group, .form-inline .btn-group { display: inline-block; } .form-search .input-append, .form-inline .input-append, .form-search .input-prepend, .form-inline .input-prepend { margin-bottom: 0; } .form-search .radio, .form-search .checkbox, .form-inline .radio, .form-inline .checkbox { padding-left: 0; margin-bottom: 0; vertical-align: middle; } .form-search .radio input[type="radio"], .form-search .checkbox input[type="checkbox"], .form-inline .radio input[type="radio"], .form-inline .checkbox input[type="checkbox"] { float: left; margin-right: 3px; margin-left: 0; } .control-group { margin-bottom: 10px; } legend + .control-group { margin-top: 20px; -webkit-margin-top-collapse: separate; } .form-horizontal .control-group { margin-bottom: 20px; *zoom: 1; } .form-horizontal .control-group:before, .form-horizontal .control-group:after { display: table; content: ""; line-height: 0; } .form-horizontal .control-group:after { clear: both; } .form-horizontal .control-label { float: left; width: 160px; padding-top: 5px; text-align: right; } .form-horizontal .controls { *display: inline-block; *padding-left: 20px; margin-left: 180px; *margin-left: 0; } .form-horizontal .controls:first-child { *padding-left: 180px; } .form-horizontal .help-block { margin-bottom: 0; } .form-horizontal input + .help-block, .form-horizontal select + .help-block, .form-horizontal textarea + .help-block, .form-horizontal .uneditable-input + .help-block, .form-horizontal .input-prepend + .help-block, .form-horizontal .input-append + .help-block { margin-top: 10px; } .form-horizontal .form-actions { padding-left: 180px; } .btn { display: inline-block; *display: inline; /* IE7 inline-block hack */ *zoom: 1; padding: 4px 12px; margin-bottom: 0; font-size: 14px; line-height: 20px; text-align: center; vertical-align: middle; cursor: pointer; color: #333333; text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); background-color: #f5f5f5; background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); background-image: linear-gradient(to bottom, #ffffff, #e6e6e6); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0); border-color: #e6e6e6 #e6e6e6 #bfbfbf; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #e6e6e6; /* Darken IE7 buttons by default so they stand out more given they won't have borders */ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); border: 1px solid #cccccc; *border: 0; border-bottom-color: #b3b3b3; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; *margin-left: .3em; -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); } .btn:hover, .btn:focus, .btn:active, .btn.active, .btn.disabled, .btn[disabled] { color: #333333; background-color: #e6e6e6; *background-color: #d9d9d9; } .btn:active, .btn.active { background-color: #cccccc \9; } .btn:first-child { *margin-left: 0; } .btn:hover, .btn:focus { color: #333333; text-decoration: none; background-position: 0 -15px; -webkit-transition: background-position 0.1s linear; -moz-transition: background-position 0.1s linear; -o-transition: background-position 0.1s linear; transition: background-position 0.1s linear; } .btn:focus { outline: thin dotted #333; outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; } .btn.active, .btn:active { background-image: none; outline: 0; -webkit-box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05); -moz-box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05); box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05); } .btn.disabled, .btn[disabled] { cursor: default; background-image: none; opacity: 0.65; filter: alpha(opacity=65); -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; } .btn-large { padding: 11px 19px; font-size: 17.5px; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; } .btn-large [class^="icon-"], .btn-large [class*=" icon-"] { margin-top: 4px; } .btn-small { padding: 2px 10px; font-size: 11.9px; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } .btn-small [class^="icon-"], .btn-small [class*=" icon-"] { margin-top: 0; } .btn-mini [class^="icon-"], .btn-mini [class*=" icon-"] { margin-top: -1px; } .btn-mini { padding: 0 6px; font-size: 10.5px; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } .btn-block { display: block; width: 100%; padding-left: 0; padding-right: 0; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .btn-block + .btn-block { margin-top: 5px; } input[type="submit"].btn-block, input[type="reset"].btn-block, input[type="button"].btn-block { width: 100%; } .btn-primary.active, .btn-warning.active, .btn-danger.active, .btn-success.active, .btn-info.active, .btn-inverse.active { color: rgba(255, 255, 255, 0.75); } .btn-primary { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #816266; background-image: -moz-linear-gradient(top, #715458, #9a777c); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#715458), to(#9a777c)); background-image: -webkit-linear-gradient(top, #715458, #9a777c); background-image: -o-linear-gradient(top, #715458, #9a777c); background-image: linear-gradient(to bottom, #715458, #9a777c); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff715458', endColorstr='#ff9a777c', GradientType=0); border-color: #9a777c #9a777c #715458; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #9a777c; /* Darken IE7 buttons by default so they stand out more given they won't have borders */ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); } .btn-primary:hover, .btn-primary:focus, .btn-primary:active, .btn-primary.active, .btn-primary.disabled, .btn-primary[disabled] { color: #ffffff; background-color: #9a777c; *background-color: #8e6a6f; } .btn-primary:active, .btn-primary.active { background-color: #805f63 \9; } .btn-warning { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #fdb033; background-image: -moz-linear-gradient(top, #fdbc52, #fc9f06); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdbc52), to(#fc9f06)); background-image: -webkit-linear-gradient(top, #fdbc52, #fc9f06); background-image: -o-linear-gradient(top, #fdbc52, #fc9f06); background-image: linear-gradient(to bottom, #fdbc52, #fc9f06); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffdbc52', endColorstr='#fffc9f06', GradientType=0); border-color: #fc9f06 #fc9f06 #b37002; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #fc9f06; /* Darken IE7 buttons by default so they stand out more given they won't have borders */ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); } .btn-warning:hover, .btn-warning:focus, .btn-warning:active, .btn-warning.active, .btn-warning.disabled, .btn-warning[disabled] { color: #ffffff; background-color: #fc9f06; *background-color: #e69003; } .btn-warning:active, .btn-warning.active { background-color: #cd8002 \9; } .btn-danger { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #da4f49; background-image: -moz-linear-gradient(top, #ee5f5b, #bd362f); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#bd362f)); background-image: -webkit-linear-gradient(top, #ee5f5b, #bd362f); background-image: -o-linear-gradient(top, #ee5f5b, #bd362f); background-image: linear-gradient(to bottom, #ee5f5b, #bd362f); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffbd362f', GradientType=0); border-color: #bd362f #bd362f #802420; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #bd362f; /* Darken IE7 buttons by default so they stand out more given they won't have borders */ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); } .btn-danger:hover, .btn-danger:focus, .btn-danger:active, .btn-danger.active, .btn-danger.disabled, .btn-danger[disabled] { color: #ffffff; background-color: #bd362f; *background-color: #a9302a; } .btn-danger:active, .btn-danger.active { background-color: #942a25 \9; } .btn-success { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #5bb75b; background-image: -moz-linear-gradient(top, #62c462, #51a351); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#51a351)); background-image: -webkit-linear-gradient(top, #62c462, #51a351); background-image: -o-linear-gradient(top, #62c462, #51a351); background-image: linear-gradient(to bottom, #62c462, #51a351); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff62c462', endColorstr='#ff51a351', GradientType=0); border-color: #51a351 #51a351 #387038; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #51a351; /* Darken IE7 buttons by default so they stand out more given they won't have borders */ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); } .btn-success:hover, .btn-success:focus, .btn-success:active, .btn-success.active, .btn-success.disabled, .btn-success[disabled] { color: #ffffff; background-color: #51a351; *background-color: #499249; } .btn-success:active, .btn-success.active { background-color: #408140 \9; } .btn-info { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #49afcd; background-image: -moz-linear-gradient(top, #5bc0de, #2f96b4); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#2f96b4)); background-image: -webkit-linear-gradient(top, #5bc0de, #2f96b4); background-image: -o-linear-gradient(top, #5bc0de, #2f96b4); background-image: linear-gradient(to bottom, #5bc0de, #2f96b4); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2f96b4', GradientType=0); border-color: #2f96b4 #2f96b4 #1f6377; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #2f96b4; /* Darken IE7 buttons by default so they stand out more given they won't have borders */ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); } .btn-info:hover, .btn-info:focus, .btn-info:active, .btn-info.active, .btn-info.disabled, .btn-info[disabled] { color: #ffffff; background-color: #2f96b4; *background-color: #2a85a0; } .btn-info:active, .btn-info.active { background-color: #24748c \9; } .btn-inverse { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #363636; background-image: -moz-linear-gradient(top, #444444, #222222); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#444444), to(#222222)); background-image: -webkit-linear-gradient(top, #444444, #222222); background-image: -o-linear-gradient(top, #444444, #222222); background-image: linear-gradient(to bottom, #444444, #222222); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff444444', endColorstr='#ff222222', GradientType=0); border-color: #222222 #222222 #000000; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #222222; /* Darken IE7 buttons by default so they stand out more given they won't have borders */ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); } .btn-inverse:hover, .btn-inverse:focus, .btn-inverse:active, .btn-inverse.active, .btn-inverse.disabled, .btn-inverse[disabled] { color: #ffffff; background-color: #222222; *background-color: #151515; } .btn-inverse:active, .btn-inverse.active { background-color: #080808 \9; } button.btn, input[type="submit"].btn { *padding-top: 3px; *padding-bottom: 3px; } button.btn::-moz-focus-inner, input[type="submit"].btn::-moz-focus-inner { padding: 0; border: 0; } button.btn.btn-large, input[type="submit"].btn.btn-large { *padding-top: 7px; *padding-bottom: 7px; } button.btn.btn-small, input[type="submit"].btn.btn-small { *padding-top: 3px; *padding-bottom: 3px; } button.btn.btn-mini, input[type="submit"].btn.btn-mini { *padding-top: 1px; *padding-bottom: 1px; } .btn-link, .btn-link:active, .btn-link[disabled] { background-color: transparent; background-image: none; -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; } .btn-link { border-color: transparent; cursor: pointer; color: #715458; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; } .btn-link:hover, .btn-link:focus { color: #ca3308; text-decoration: underline; background-color: transparent; } .btn-link[disabled]:hover, .btn-link[disabled]:focus { color: #333333; text-decoration: none; } [class^="icon-"], [class*=" icon-"] { display: inline-block; width: 14px; height: 14px; *margin-right: .3em; line-height: 14px; vertical-align: text-top; background-image: url("../img/glyphicons-halflings.png"); background-position: 14px 14px; background-repeat: no-repeat; margin-top: 1px; } /* White icons with optional class, or on hover/focus/active states of certain elements */ .icon-white, .nav-pills > .active > a > [class^="icon-"], .nav-pills > .active > a > [class*=" icon-"], .nav-list > .active > a > [class^="icon-"], .nav-list > .active > a > [class*=" icon-"], .navbar-inverse .nav > .active > a > [class^="icon-"], .navbar-inverse .nav > .active > a > [class*=" icon-"], .dropdown-menu > li > a:hover > [class^="icon-"], .dropdown-menu > li > a:focus > [class^="icon-"], .dropdown-menu > li > a:hover > [class*=" icon-"], .dropdown-menu > li > a:focus > [class*=" icon-"], .dropdown-menu > .active > a > [class^="icon-"], .dropdown-menu > .active > a > [class*=" icon-"], .dropdown-submenu:hover > a > [class^="icon-"], .dropdown-submenu:focus > a > [class^="icon-"], .dropdown-submenu:hover > a > [class*=" icon-"], .dropdown-submenu:focus > a > [class*=" icon-"] { background-image: url("../img/glyphicons-halflings-white.png"); } .icon-glass { background-position: 0 0; } .icon-music { background-position: -24px 0; } .icon-search { background-position: -48px 0; } .icon-envelope { background-position: -72px 0; } .icon-heart { background-position: -96px 0; } .icon-star { background-position: -120px 0; } .icon-star-empty { background-position: -144px 0; } .icon-user { background-position: -168px 0; } .icon-film { background-position: -192px 0; } .icon-th-large { background-position: -216px 0; } .icon-th { background-position: -240px 0; } .icon-th-list { background-position: -264px 0; } .icon-ok { background-position: -288px 0; } .icon-remove { background-position: -312px 0; } .icon-zoom-in { background-position: -336px 0; } .icon-zoom-out { background-position: -360px 0; } .icon-off { background-position: -384px 0; } .icon-signal { background-position: -408px 0; } .icon-cog { background-position: -432px 0; } .icon-trash { background-position: -456px 0; } .icon-home { background-position: 0 -24px; } .icon-file { background-position: -24px -24px; } .icon-time { background-position: -48px -24px; } .icon-road { background-position: -72px -24px; } .icon-download-alt { background-position: -96px -24px; } .icon-download { background-position: -120px -24px; } .icon-upload { background-position: -144px -24px; } .icon-inbox { background-position: -168px -24px; } .icon-play-circle { background-position: -192px -24px; } .icon-repeat { background-position: -216px -24px; } .icon-refresh { background-position: -240px -24px; } .icon-list-alt { background-position: -264px -24px; } .icon-lock { background-position: -287px -24px; } .icon-flag { background-position: -312px -24px; } .icon-headphones { background-position: -336px -24px; } .icon-volume-off { background-position: -360px -24px; } .icon-volume-down { background-position: -384px -24px; } .icon-volume-up { background-position: -408px -24px; } .icon-qrcode { background-position: -432px -24px; } .icon-barcode { background-position: -456px -24px; } .icon-tag { background-position: 0 -48px; } .icon-tags { background-position: -25px -48px; } .icon-book { background-position: -48px -48px; } .icon-bookmark { background-position: -72px -48px; } .icon-print { background-position: -96px -48px; } .icon-camera { background-position: -120px -48px; } .icon-font { background-position: -144px -48px; } .icon-bold { background-position: -167px -48px; } .icon-italic { background-position: -192px -48px; } .icon-text-height { background-position: -216px -48px; } .icon-text-width { background-position: -240px -48px; } .icon-align-left { background-position: -264px -48px; } .icon-align-center { background-position: -288px -48px; } .icon-align-right { background-position: -312px -48px; } .icon-align-justify { background-position: -336px -48px; } .icon-list { background-position: -360px -48px; } .icon-indent-left { background-position: -384px -48px; } .icon-indent-right { background-position: -408px -48px; } .icon-facetime-video { background-position: -432px -48px; } .icon-picture { background-position: -456px -48px; } .icon-pencil { background-position: 0 -72px; } .icon-map-marker { background-position: -24px -72px; } .icon-adjust { background-position: -48px -72px; } .icon-tint { background-position: -72px -72px; } .icon-edit { background-position: -96px -72px; } .icon-share { background-position: -120px -72px; } .icon-check { background-position: -144px -72px; } .icon-move { background-position: -168px -72px; } .icon-step-backward { background-position: -192px -72px; } .icon-fast-backward { background-position: -216px -72px; } .icon-backward { background-position: -240px -72px; } .icon-play { background-position: -264px -72px; } .icon-pause { background-position: -288px -72px; } .icon-stop { background-position: -312px -72px; } .icon-forward { background-position: -336px -72px; } .icon-fast-forward { background-position: -360px -72px; } .icon-step-forward { background-position: -384px -72px; } .icon-eject { background-position: -408px -72px; } .icon-chevron-left { background-position: -432px -72px; } .icon-chevron-right { background-position: -456px -72px; } .icon-plus-sign { background-position: 0 -96px; } .icon-minus-sign { background-position: -24px -96px; } .icon-remove-sign { background-position: -48px -96px; } .icon-ok-sign { background-position: -72px -96px; } .icon-question-sign { background-position: -96px -96px; } .icon-info-sign { background-position: -120px -96px; } .icon-screenshot { background-position: -144px -96px; } .icon-remove-circle { background-position: -168px -96px; } .icon-ok-circle { background-position: -192px -96px; } .icon-ban-circle { background-position: -216px -96px; } .icon-arrow-left { background-position: -240px -96px; } .icon-arrow-right { background-position: -264px -96px; } .icon-arrow-up { background-position: -289px -96px; } .icon-arrow-down { background-position: -312px -96px; } .icon-share-alt { background-position: -336px -96px; } .icon-resize-full { background-position: -360px -96px; } .icon-resize-small { background-position: -384px -96px; } .icon-plus { background-position: -408px -96px; } .icon-minus { background-position: -433px -96px; } .icon-asterisk { background-position: -456px -96px; } .icon-exclamation-sign { background-position: 0 -120px; } .icon-gift { background-position: -24px -120px; } .icon-leaf { background-position: -48px -120px; } .icon-fire { background-position: -72px -120px; } .icon-eye-open { background-position: -96px -120px; } .icon-eye-close { background-position: -120px -120px; } .icon-warning-sign { background-position: -144px -120px; } .icon-plane { background-position: -168px -120px; } .icon-calendar { background-position: -192px -120px; } .icon-random { background-position: -216px -120px; width: 16px; } .icon-comment { background-position: -240px -120px; } .icon-magnet { background-position: -264px -120px; } .icon-chevron-up { background-position: -288px -120px; } .icon-chevron-down { background-position: -313px -119px; } .icon-retweet { background-position: -336px -120px; } .icon-shopping-cart { background-position: -360px -120px; } .icon-folder-close { background-position: -384px -120px; width: 16px; } .icon-folder-open { background-position: -408px -120px; width: 16px; } .icon-resize-vertical { background-position: -432px -119px; } .icon-resize-horizontal { background-position: -456px -118px; } .icon-hdd { background-position: 0 -144px; } .icon-bullhorn { background-position: -24px -144px; } .icon-bell { background-position: -48px -144px; } .icon-certificate { background-position: -72px -144px; } .icon-thumbs-up { background-position: -96px -144px; } .icon-thumbs-down { background-position: -120px -144px; } .icon-hand-right { background-position: -144px -144px; } .icon-hand-left { background-position: -168px -144px; } .icon-hand-up { background-position: -192px -144px; } .icon-hand-down { background-position: -216px -144px; } .icon-circle-arrow-right { background-position: -240px -144px; } .icon-circle-arrow-left { background-position: -264px -144px; } .icon-circle-arrow-up { background-position: -288px -144px; } .icon-circle-arrow-down { background-position: -312px -144px; } .icon-globe { background-position: -336px -144px; } .icon-wrench { background-position: -360px -144px; } .icon-tasks { background-position: -384px -144px; } .icon-filter { background-position: -408px -144px; } .icon-briefcase { background-position: -432px -144px; } .icon-fullscreen { background-position: -456px -144px; } .btn-group { position: relative; display: inline-block; *display: inline; /* IE7 inline-block hack */ *zoom: 1; font-size: 0; vertical-align: middle; white-space: nowrap; *margin-left: .3em; } .btn-group:first-child { *margin-left: 0; } .btn-group + .btn-group { margin-left: 5px; } .btn-toolbar { font-size: 0; margin-top: 10px; margin-bottom: 10px; } .btn-toolbar > .btn + .btn, .btn-toolbar > .btn-group + .btn, .btn-toolbar > .btn + .btn-group { margin-left: 5px; } .btn-group > .btn { position: relative; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; } .btn-group > .btn + .btn { margin-left: -1px; } .btn-group > .btn, .btn-group > .dropdown-menu, .btn-group > .popover { font-size: 14px; } .btn-group > .btn-mini { font-size: 10.5px; } .btn-group > .btn-small { font-size: 11.9px; } .btn-group > .btn-large { font-size: 17.5px; } .btn-group > .btn:first-child { margin-left: 0; -webkit-border-top-left-radius: 4px; -moz-border-radius-topleft: 4px; border-top-left-radius: 4px; -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomleft: 4px; border-bottom-left-radius: 4px; } .btn-group > .btn:last-child, .btn-group > .dropdown-toggle { -webkit-border-top-right-radius: 4px; -moz-border-radius-topright: 4px; border-top-right-radius: 4px; -webkit-border-bottom-right-radius: 4px; -moz-border-radius-bottomright: 4px; border-bottom-right-radius: 4px; } .btn-group > .btn.large:first-child { margin-left: 0; -webkit-border-top-left-radius: 6px; -moz-border-radius-topleft: 6px; border-top-left-radius: 6px; -webkit-border-bottom-left-radius: 6px; -moz-border-radius-bottomleft: 6px; border-bottom-left-radius: 6px; } .btn-group > .btn.large:last-child, .btn-group > .large.dropdown-toggle { -webkit-border-top-right-radius: 6px; -moz-border-radius-topright: 6px; border-top-right-radius: 6px; -webkit-border-bottom-right-radius: 6px; -moz-border-radius-bottomright: 6px; border-bottom-right-radius: 6px; } .btn-group > .btn:hover, .btn-group > .btn:focus, .btn-group > .btn:active, .btn-group > .btn.active { z-index: 2; } .btn-group .dropdown-toggle:active, .btn-group.open .dropdown-toggle { outline: 0; } .btn-group > .btn + .dropdown-toggle { padding-left: 8px; padding-right: 8px; -webkit-box-shadow: inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); -moz-box-shadow: inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); box-shadow: inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); *padding-top: 5px; *padding-bottom: 5px; } .btn-group > .btn-mini + .dropdown-toggle { padding-left: 5px; padding-right: 5px; *padding-top: 2px; *padding-bottom: 2px; } .btn-group > .btn-small + .dropdown-toggle { *padding-top: 5px; *padding-bottom: 4px; } .btn-group > .btn-large + .dropdown-toggle { padding-left: 12px; padding-right: 12px; *padding-top: 7px; *padding-bottom: 7px; } .btn-group.open .dropdown-toggle { background-image: none; -webkit-box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05); -moz-box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05); box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05); } .btn-group.open .btn.dropdown-toggle { background-color: #e6e6e6; } .btn-group.open .btn-primary.dropdown-toggle { background-color: #9a777c; } .btn-group.open .btn-warning.dropdown-toggle { background-color: #fc9f06; } .btn-group.open .btn-danger.dropdown-toggle { background-color: #bd362f; } .btn-group.open .btn-success.dropdown-toggle { background-color: #51a351; } .btn-group.open .btn-info.dropdown-toggle { background-color: #2f96b4; } .btn-group.open .btn-inverse.dropdown-toggle { background-color: #222222; } .btn .caret { margin-top: 8px; margin-left: 0; } .btn-large .caret { margin-top: 6px; } .btn-large .caret { border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; } .btn-mini .caret, .btn-small .caret { margin-top: 8px; } .dropup .btn-large .caret { border-bottom-width: 5px; } .btn-primary .caret, .btn-warning .caret, .btn-danger .caret, .btn-info .caret, .btn-success .caret, .btn-inverse .caret { border-top-color: #ffffff; border-bottom-color: #ffffff; } .btn-group-vertical { display: inline-block; *display: inline; /* IE7 inline-block hack */ *zoom: 1; } .btn-group-vertical > .btn { display: block; float: none; max-width: 100%; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; } .btn-group-vertical > .btn + .btn { margin-left: 0; margin-top: -1px; } .btn-group-vertical > .btn:first-child { -webkit-border-radius: 4px 4px 0 0; -moz-border-radius: 4px 4px 0 0; border-radius: 4px 4px 0 0; } .btn-group-vertical > .btn:last-child { -webkit-border-radius: 0 0 4px 4px; -moz-border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px; } .btn-group-vertical > .btn-large:first-child { -webkit-border-radius: 6px 6px 0 0; -moz-border-radius: 6px 6px 0 0; border-radius: 6px 6px 0 0; } .btn-group-vertical > .btn-large:last-child { -webkit-border-radius: 0 0 6px 6px; -moz-border-radius: 0 0 6px 6px; border-radius: 0 0 6px 6px; } .nav { margin-left: 0; margin-bottom: 20px; list-style: none; } .nav > li > a { display: block; } .nav > li > a:hover, .nav > li > a:focus { text-decoration: none; background-color: #eeeeee; } .nav > li > a > img { max-width: none; } .nav > .pull-right { float: right; } .nav-header { display: block; padding: 3px 15px; font-size: 11px; font-weight: bold; line-height: 20px; color: #999999; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); text-transform: uppercase; } .nav li + .nav-header { margin-top: 9px; } .nav-list { padding-left: 15px; padding-right: 15px; margin-bottom: 0; } .nav-list > li > a, .nav-list .nav-header { margin-left: -15px; margin-right: -15px; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); } .nav-list > li > a { padding: 3px 15px; } .nav-list > .active > a, .nav-list > .active > a:hover, .nav-list > .active > a:focus { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); background-color: #715458; } .nav-list [class^="icon-"], .nav-list [class*=" icon-"] { margin-right: 2px; } .nav-list .divider { *width: 100%; height: 1px; margin: 9px 1px; *margin: -5px 0 5px; overflow: hidden; background-color: #e5e5e5; border-bottom: 1px solid #ffffff; } .nav-tabs, .nav-pills { *zoom: 1; } .nav-tabs:before, .nav-pills:before, .nav-tabs:after, .nav-pills:after { display: table; content: ""; line-height: 0; } .nav-tabs:after, .nav-pills:after { clear: both; } .nav-tabs > li, .nav-pills > li { float: left; } .nav-tabs > li > a, .nav-pills > li > a { padding-right: 12px; padding-left: 12px; margin-right: 2px; line-height: 14px; } .nav-tabs { border-bottom: 1px solid #ddd; } .nav-tabs > li { margin-bottom: -1px; } .nav-tabs > li > a { padding-top: 8px; padding-bottom: 8px; line-height: 20px; border: 1px solid transparent; -webkit-border-radius: 4px 4px 0 0; -moz-border-radius: 4px 4px 0 0; border-radius: 4px 4px 0 0; } .nav-tabs > li > a:hover, .nav-tabs > li > a:focus { border-color: #eeeeee #eeeeee #dddddd; } .nav-tabs > .active > a, .nav-tabs > .active > a:hover, .nav-tabs > .active > a:focus { color: #555555; background-color: #c5ad91; border: 1px solid #ddd; border-bottom-color: transparent; cursor: default; } .nav-pills > li > a { padding-top: 8px; padding-bottom: 8px; margin-top: 2px; margin-bottom: 2px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; } .nav-pills > .active > a, .nav-pills > .active > a:hover, .nav-pills > .active > a:focus { color: #ffffff; background-color: #715458; } .nav-stacked > li { float: none; } .nav-stacked > li > a { margin-right: 0; } .nav-tabs.nav-stacked { border-bottom: 0; } .nav-tabs.nav-stacked > li > a { border: 1px solid #ddd; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; } .nav-tabs.nav-stacked > li:first-child > a { -webkit-border-top-right-radius: 4px; -moz-border-radius-topright: 4px; border-top-right-radius: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-topleft: 4px; border-top-left-radius: 4px; } .nav-tabs.nav-stacked > li:last-child > a { -webkit-border-bottom-right-radius: 4px; -moz-border-radius-bottomright: 4px; border-bottom-right-radius: 4px; -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomleft: 4px; border-bottom-left-radius: 4px; } .nav-tabs.nav-stacked > li > a:hover, .nav-tabs.nav-stacked > li > a:focus { border-color: #ddd; z-index: 2; } .nav-pills.nav-stacked > li > a { margin-bottom: 3px; } .nav-pills.nav-stacked > li:last-child > a { margin-bottom: 1px; } .nav-tabs .dropdown-menu { -webkit-border-radius: 0 0 6px 6px; -moz-border-radius: 0 0 6px 6px; border-radius: 0 0 6px 6px; } .nav-pills .dropdown-menu { -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; } .nav .dropdown-toggle .caret { border-top-color: #715458; border-bottom-color: #715458; margin-top: 6px; } .nav .dropdown-toggle:hover .caret, .nav .dropdown-toggle:focus .caret { border-top-color: #ca3308; border-bottom-color: #ca3308; } /* move down carets for tabs */ .nav-tabs .dropdown-toggle .caret { margin-top: 8px; } .nav .active .dropdown-toggle .caret { border-top-color: #fff; border-bottom-color: #fff; } .nav-tabs .active .dropdown-toggle .caret { border-top-color: #555555; border-bottom-color: #555555; } .nav > .dropdown.active > a:hover, .nav > .dropdown.active > a:focus { cursor: pointer; } .nav-tabs .open .dropdown-toggle, .nav-pills .open .dropdown-toggle, .nav > li.dropdown.open.active > a:hover, .nav > li.dropdown.open.active > a:focus { color: #ffffff; background-color: #999999; border-color: #999999; } .nav li.dropdown.open .caret, .nav li.dropdown.open.active .caret, .nav li.dropdown.open a:hover .caret, .nav li.dropdown.open a:focus .caret { border-top-color: #ffffff; border-bottom-color: #ffffff; opacity: 1; filter: alpha(opacity=100); } .tabs-stacked .open > a:hover, .tabs-stacked .open > a:focus { border-color: #999999; } .tabbable { *zoom: 1; } .tabbable:before, .tabbable:after { display: table; content: ""; line-height: 0; } .tabbable:after { clear: both; } .tab-content { overflow: auto; } .tabs-below > .nav-tabs, .tabs-right > .nav-tabs, .tabs-left > .nav-tabs { border-bottom: 0; } .tab-content > .tab-pane, .pill-content > .pill-pane { display: none; } .tab-content > .active, .pill-content > .active { display: block; } .tabs-below > .nav-tabs { border-top: 1px solid #ddd; } .tabs-below > .nav-tabs > li { margin-top: -1px; margin-bottom: 0; } .tabs-below > .nav-tabs > li > a { -webkit-border-radius: 0 0 4px 4px; -moz-border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px; } .tabs-below > .nav-tabs > li > a:hover, .tabs-below > .nav-tabs > li > a:focus { border-bottom-color: transparent; border-top-color: #ddd; } .tabs-below > .nav-tabs > .active > a, .tabs-below > .nav-tabs > .active > a:hover, .tabs-below > .nav-tabs > .active > a:focus { border-color: transparent #ddd #ddd #ddd; } .tabs-left > .nav-tabs > li, .tabs-right > .nav-tabs > li { float: none; } .tabs-left > .nav-tabs > li > a, .tabs-right > .nav-tabs > li > a { min-width: 74px; margin-right: 0; margin-bottom: 3px; } .tabs-left > .nav-tabs { float: left; margin-right: 19px; border-right: 1px solid #ddd; } .tabs-left > .nav-tabs > li > a { margin-right: -1px; -webkit-border-radius: 4px 0 0 4px; -moz-border-radius: 4px 0 0 4px; border-radius: 4px 0 0 4px; } .tabs-left > .nav-tabs > li > a:hover, .tabs-left > .nav-tabs > li > a:focus { border-color: #eeeeee #dddddd #eeeeee #eeeeee; } .tabs-left > .nav-tabs .active > a, .tabs-left > .nav-tabs .active > a:hover, .tabs-left > .nav-tabs .active > a:focus { border-color: #ddd transparent #ddd #ddd; *border-right-color: #ffffff; } .tabs-right > .nav-tabs { float: right; margin-left: 19px; border-left: 1px solid #ddd; } .tabs-right > .nav-tabs > li > a { margin-left: -1px; -webkit-border-radius: 0 4px 4px 0; -moz-border-radius: 0 4px 4px 0; border-radius: 0 4px 4px 0; } .tabs-right > .nav-tabs > li > a:hover, .tabs-right > .nav-tabs > li > a:focus { border-color: #eeeeee #eeeeee #eeeeee #dddddd; } .tabs-right > .nav-tabs .active > a, .tabs-right > .nav-tabs .active > a:hover, .tabs-right > .nav-tabs .active > a:focus { border-color: #ddd #ddd #ddd transparent; *border-left-color: #ffffff; } .nav > .disabled > a { color: #999999; } .nav > .disabled > a:hover, .nav > .disabled > a:focus { text-decoration: none; background-color: transparent; cursor: default; } .navbar { overflow: visible; margin-bottom: 20px; *position: relative; *z-index: 2; } .navbar-inner { min-height: 40px; padding-left: 20px; padding-right: 20px; background-color: #160902; background-image: -moz-linear-gradient(top, #000000, #371605); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#000000), to(#371605)); background-image: -webkit-linear-gradient(top, #000000, #371605); background-image: -o-linear-gradient(top, #000000, #371605); background-image: linear-gradient(to bottom, #000000, #371605); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff000000', endColorstr='#ff371605', GradientType=0); border: 1px solid #000000; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065); -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065); *zoom: 1; } .navbar-inner:before, .navbar-inner:after { display: table; content: ""; line-height: 0; } .navbar-inner:after { clear: both; } .navbar .container { width: auto; } .nav-collapse.collapse { height: auto; overflow: visible; } .navbar .brand { float: left; display: block; padding: 10px 20px 10px; margin-left: -20px; font-size: 20px; font-weight: 200; color: #bb844e; text-shadow: 0 1px 0 #000000; } .navbar .brand:hover, .navbar .brand:focus { text-decoration: none; } .navbar-text { margin-bottom: 0; line-height: 40px; color: #bb844e; } .navbar-link { color: #bb844e; } .navbar-link:hover, .navbar-link:focus { color: #c5ad91; } .navbar .divider-vertical { height: 40px; margin: 0 9px; border-left: 1px solid #371605; border-right: 1px solid #000000; } .navbar .btn, .navbar .btn-group { margin-top: 5px; } .navbar .btn-group .btn, .navbar .input-prepend .btn, .navbar .input-append .btn, .navbar .input-prepend .btn-group, .navbar .input-append .btn-group { margin-top: 0; } .navbar-form { margin-bottom: 0; *zoom: 1; } .navbar-form:before, .navbar-form:after { display: table; content: ""; line-height: 0; } .navbar-form:after { clear: both; } .navbar-form input, .navbar-form select, .navbar-form .radio, .navbar-form .checkbox { margin-top: 5px; } .navbar-form input, .navbar-form select, .navbar-form .btn { display: inline-block; margin-bottom: 0; } .navbar-form input[type="image"], .navbar-form input[type="checkbox"], .navbar-form input[type="radio"] { margin-top: 3px; } .navbar-form .input-append, .navbar-form .input-prepend { margin-top: 5px; white-space: nowrap; } .navbar-form .input-append input, .navbar-form .input-prepend input { margin-top: 0; } .navbar-search { position: relative; float: left; margin-top: 5px; margin-bottom: 0; } .navbar-search .search-query { margin-bottom: 0; padding: 4px 14px; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 1; -webkit-border-radius: 15px; -moz-border-radius: 15px; border-radius: 15px; } .navbar-static-top { position: static; margin-bottom: 0; } .navbar-static-top .navbar-inner { -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; } .navbar-fixed-top, .navbar-fixed-bottom { position: fixed; right: 0; left: 0; z-index: 1030; margin-bottom: 0; } .navbar-fixed-top .navbar-inner, .navbar-static-top .navbar-inner { border-width: 0 0 1px; } .navbar-fixed-bottom .navbar-inner { border-width: 1px 0 0; } .navbar-fixed-top .navbar-inner, .navbar-fixed-bottom .navbar-inner { padding-left: 0; padding-right: 0; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; } .navbar-static-top .container, .navbar-fixed-top .container, .navbar-fixed-bottom .container { width: 940px; } .navbar-fixed-top { top: 0; } .navbar-fixed-top .navbar-inner, .navbar-static-top .navbar-inner { -webkit-box-shadow: 0 1px 10px rgba(0,0,0,.1); -moz-box-shadow: 0 1px 10px rgba(0,0,0,.1); box-shadow: 0 1px 10px rgba(0,0,0,.1); } .navbar-fixed-bottom { bottom: 0; } .navbar-fixed-bottom .navbar-inner { -webkit-box-shadow: 0 -1px 10px rgba(0,0,0,.1); -moz-box-shadow: 0 -1px 10px rgba(0,0,0,.1); box-shadow: 0 -1px 10px rgba(0,0,0,.1); } .navbar .nav { position: relative; left: 0; display: block; float: left; margin: 0 10px 0 0; } .navbar .nav.pull-right { float: right; margin-right: 0; } .navbar .nav > li { float: left; } .navbar .nav > li > a { float: none; padding: 10px 15px 10px; color: #bb844e; text-decoration: none; text-shadow: 0 1px 0 #000000; } .navbar .nav .dropdown-toggle .caret { margin-top: 8px; } .navbar .nav > li > a:focus, .navbar .nav > li > a:hover { background-color: transparent; color: #c5ad91; text-decoration: none; } .navbar .nav > .active > a, .navbar .nav > .active > a:hover, .navbar .nav > .active > a:focus { color: #371605; text-decoration: none; background-color: #bb844e; -webkit-box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125); -moz-box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125); box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125); } .navbar .btn-navbar { display: none; float: right; padding: 7px 10px; margin-left: 5px; margin-right: 5px; color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #0d0501; background-image: -moz-linear-gradient(top, #000000, #200d03); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#000000), to(#200d03)); background-image: -webkit-linear-gradient(top, #000000, #200d03); background-image: -o-linear-gradient(top, #000000, #200d03); background-image: linear-gradient(to bottom, #000000, #200d03); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff000000', endColorstr='#ff200d03', GradientType=0); border-color: #200d03 #200d03 #000000; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #200d03; /* Darken IE7 buttons by default so they stand out more given they won't have borders */ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075); -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075); box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075); } .navbar .btn-navbar:hover, .navbar .btn-navbar:focus, .navbar .btn-navbar:active, .navbar .btn-navbar.active, .navbar .btn-navbar.disabled, .navbar .btn-navbar[disabled] { color: #ffffff; background-color: #200d03; *background-color: #080301; } .navbar .btn-navbar:active, .navbar .btn-navbar.active { background-color: #000000 \9; } .navbar .btn-navbar .icon-bar { display: block; width: 18px; height: 2px; background-color: #f5f5f5; -webkit-border-radius: 1px; -moz-border-radius: 1px; border-radius: 1px; -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); -moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); } .btn-navbar .icon-bar + .icon-bar { margin-top: 3px; } .navbar .nav > li > .dropdown-menu:before { content: ''; display: inline-block; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 7px solid #ccc; border-bottom-color: rgba(0, 0, 0, 0.2); position: absolute; top: -7px; left: 9px; } .navbar .nav > li > .dropdown-menu:after { content: ''; display: inline-block; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 6px solid #c5ad91; position: absolute; top: -6px; left: 10px; } .navbar-fixed-bottom .nav > li > .dropdown-menu:before { border-top: 7px solid #ccc; border-top-color: rgba(0, 0, 0, 0.2); border-bottom: 0; bottom: -7px; top: auto; } .navbar-fixed-bottom .nav > li > .dropdown-menu:after { border-top: 6px solid #c5ad91; border-bottom: 0; bottom: -6px; top: auto; } .navbar .nav li.dropdown > a:hover .caret, .navbar .nav li.dropdown > a:focus .caret { border-top-color: #c5ad91; border-bottom-color: #c5ad91; } .navbar .nav li.dropdown.open > .dropdown-toggle, .navbar .nav li.dropdown.active > .dropdown-toggle, .navbar .nav li.dropdown.open.active > .dropdown-toggle { background-color: #bb844e; color: #371605; } .navbar .nav li.dropdown > .dropdown-toggle .caret { border-top-color: #bb844e; border-bottom-color: #bb844e; } .navbar .nav li.dropdown.open > .dropdown-toggle .caret, .navbar .nav li.dropdown.active > .dropdown-toggle .caret, .navbar .nav li.dropdown.open.active > .dropdown-toggle .caret { border-top-color: #371605; border-bottom-color: #371605; } .navbar .pull-right > li > .dropdown-menu, .navbar .nav > li > .dropdown-menu.pull-right { left: auto; right: 0; } .navbar .pull-right > li > .dropdown-menu:before, .navbar .nav > li > .dropdown-menu.pull-right:before { left: auto; right: 12px; } .navbar .pull-right > li > .dropdown-menu:after, .navbar .nav > li > .dropdown-menu.pull-right:after { left: auto; right: 13px; } .navbar .pull-right > li > .dropdown-menu .dropdown-menu, .navbar .nav > li > .dropdown-menu.pull-right .dropdown-menu { left: auto; right: 100%; margin-left: 0; margin-right: -1px; -webkit-border-radius: 6px 0 6px 6px; -moz-border-radius: 6px 0 6px 6px; border-radius: 6px 0 6px 6px; } .navbar-inverse .navbar-inner { background-color: #1b1b1b; background-image: -moz-linear-gradient(top, #222222, #111111); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#222222), to(#111111)); background-image: -webkit-linear-gradient(top, #222222, #111111); background-image: -o-linear-gradient(top, #222222, #111111); background-image: linear-gradient(to bottom, #222222, #111111); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff111111', GradientType=0); border-color: #252525; } .navbar-inverse .brand, .navbar-inverse .nav > li > a { color: #999999; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); } .navbar-inverse .brand:hover, .navbar-inverse .nav > li > a:hover, .navbar-inverse .brand:focus, .navbar-inverse .nav > li > a:focus { color: #ffffff; } .navbar-inverse .brand { color: #999999; } .navbar-inverse .navbar-text { color: #999999; } .navbar-inverse .nav > li > a:focus, .navbar-inverse .nav > li > a:hover { background-color: transparent; color: #ffffff; } .navbar-inverse .nav .active > a, .navbar-inverse .nav .active > a:hover, .navbar-inverse .nav .active > a:focus { color: #ffffff; background-color: #111111; } .navbar-inverse .navbar-link { color: #999999; } .navbar-inverse .navbar-link:hover, .navbar-inverse .navbar-link:focus { color: #ffffff; } .navbar-inverse .divider-vertical { border-left-color: #111111; border-right-color: #222222; } .navbar-inverse .nav li.dropdown.open > .dropdown-toggle, .navbar-inverse .nav li.dropdown.active > .dropdown-toggle, .navbar-inverse .nav li.dropdown.open.active > .dropdown-toggle { background-color: #111111; color: #ffffff; } .navbar-inverse .nav li.dropdown > a:hover .caret, .navbar-inverse .nav li.dropdown > a:focus .caret { border-top-color: #ffffff; border-bottom-color: #ffffff; } .navbar-inverse .nav li.dropdown > .dropdown-toggle .caret { border-top-color: #999999; border-bottom-color: #999999; } .navbar-inverse .nav li.dropdown.open > .dropdown-toggle .caret, .navbar-inverse .nav li.dropdown.active > .dropdown-toggle .caret, .navbar-inverse .nav li.dropdown.open.active > .dropdown-toggle .caret { border-top-color: #ffffff; border-bottom-color: #ffffff; } .navbar-inverse .navbar-search .search-query { color: #ffffff; background-color: #515151; border-color: #111111; -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15); -moz-box-shadow: inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15); box-shadow: inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15); -webkit-transition: none; -moz-transition: none; -o-transition: none; transition: none; } .navbar-inverse .navbar-search .search-query:-moz-placeholder { color: #cccccc; } .navbar-inverse .navbar-search .search-query:-ms-input-placeholder { color: #cccccc; } .navbar-inverse .navbar-search .search-query::-webkit-input-placeholder { color: #cccccc; } .navbar-inverse .navbar-search .search-query:focus, .navbar-inverse .navbar-search .search-query.focused { padding: 5px 15px; color: #333333; text-shadow: 0 1px 0 #ffffff; background-color: #ffffff; border: 0; -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); -moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); outline: 0; } .navbar-inverse .btn-navbar { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #0e0e0e; background-image: -moz-linear-gradient(top, #151515, #040404); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#151515), to(#040404)); background-image: -webkit-linear-gradient(top, #151515, #040404); background-image: -o-linear-gradient(top, #151515, #040404); background-image: linear-gradient(to bottom, #151515, #040404); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff151515', endColorstr='#ff040404', GradientType=0); border-color: #040404 #040404 #000000; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #040404; /* Darken IE7 buttons by default so they stand out more given they won't have borders */ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); } .navbar-inverse .btn-navbar:hover, .navbar-inverse .btn-navbar:focus, .navbar-inverse .btn-navbar:active, .navbar-inverse .btn-navbar.active, .navbar-inverse .btn-navbar.disabled, .navbar-inverse .btn-navbar[disabled] { color: #ffffff; background-color: #040404; *background-color: #000000; } .navbar-inverse .btn-navbar:active, .navbar-inverse .btn-navbar.active { background-color: #000000 \9; } .breadcrumb { padding: 8px 15px; margin: 0 0 20px; list-style: none; background-color: #f5f5f5; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .breadcrumb > li { display: inline-block; *display: inline; /* IE7 inline-block hack */ *zoom: 1; text-shadow: 0 1px 0 #ffffff; } .breadcrumb > li > .divider { padding: 0 5px; color: #ccc; } .breadcrumb > .active { color: #999999; } .pagination { margin: 20px 0; } .pagination ul { display: inline-block; *display: inline; /* IE7 inline-block hack */ *zoom: 1; margin-left: 0; margin-bottom: 0; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); } .pagination ul > li { display: inline; } .pagination ul > li > a, .pagination ul > li > span { float: left; padding: 4px 12px; line-height: 20px; text-decoration: none; background-color: #ffffff; border: 1px solid #dddddd; border-left-width: 0; } .pagination ul > li > a:hover, .pagination ul > li > a:focus, .pagination ul > .active > a, .pagination ul > .active > span { background-color: #f5f5f5; } .pagination ul > .active > a, .pagination ul > .active > span { color: #999999; cursor: default; } .pagination ul > .disabled > span, .pagination ul > .disabled > a, .pagination ul > .disabled > a:hover, .pagination ul > .disabled > a:focus { color: #999999; background-color: transparent; cursor: default; } .pagination ul > li:first-child > a, .pagination ul > li:first-child > span { border-left-width: 1px; -webkit-border-top-left-radius: 4px; -moz-border-radius-topleft: 4px; border-top-left-radius: 4px; -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomleft: 4px; border-bottom-left-radius: 4px; } .pagination ul > li:last-child > a, .pagination ul > li:last-child > span { -webkit-border-top-right-radius: 4px; -moz-border-radius-topright: 4px; border-top-right-radius: 4px; -webkit-border-bottom-right-radius: 4px; -moz-border-radius-bottomright: 4px; border-bottom-right-radius: 4px; } .pagination-centered { text-align: center; } .pagination-right { text-align: right; } .pagination-large ul > li > a, .pagination-large ul > li > span { padding: 11px 19px; font-size: 17.5px; } .pagination-large ul > li:first-child > a, .pagination-large ul > li:first-child > span { -webkit-border-top-left-radius: 6px; -moz-border-radius-topleft: 6px; border-top-left-radius: 6px; -webkit-border-bottom-left-radius: 6px; -moz-border-radius-bottomleft: 6px; border-bottom-left-radius: 6px; } .pagination-large ul > li:last-child > a, .pagination-large ul > li:last-child > span { -webkit-border-top-right-radius: 6px; -moz-border-radius-topright: 6px; border-top-right-radius: 6px; -webkit-border-bottom-right-radius: 6px; -moz-border-radius-bottomright: 6px; border-bottom-right-radius: 6px; } .pagination-mini ul > li:first-child > a, .pagination-small ul > li:first-child > a, .pagination-mini ul > li:first-child > span, .pagination-small ul > li:first-child > span { -webkit-border-top-left-radius: 3px; -moz-border-radius-topleft: 3px; border-top-left-radius: 3px; -webkit-border-bottom-left-radius: 3px; -moz-border-radius-bottomleft: 3px; border-bottom-left-radius: 3px; } .pagination-mini ul > li:last-child > a, .pagination-small ul > li:last-child > a, .pagination-mini ul > li:last-child > span, .pagination-small ul > li:last-child > span { -webkit-border-top-right-radius: 3px; -moz-border-radius-topright: 3px; border-top-right-radius: 3px; -webkit-border-bottom-right-radius: 3px; -moz-border-radius-bottomright: 3px; border-bottom-right-radius: 3px; } .pagination-small ul > li > a, .pagination-small ul > li > span { padding: 2px 10px; font-size: 11.9px; } .pagination-mini ul > li > a, .pagination-mini ul > li > span { padding: 0 6px; font-size: 10.5px; } .pager { margin: 20px 0; list-style: none; text-align: center; *zoom: 1; } .pager:before, .pager:after { display: table; content: ""; line-height: 0; } .pager:after { clear: both; } .pager li { display: inline; } .pager li > a, .pager li > span { display: inline-block; padding: 5px 14px; background-color: #fff; border: 1px solid #ddd; -webkit-border-radius: 15px; -moz-border-radius: 15px; border-radius: 15px; } .pager li > a:hover, .pager li > a:focus { text-decoration: none; background-color: #f5f5f5; } .pager .next > a, .pager .next > span { float: right; } .pager .previous > a, .pager .previous > span { float: left; } .pager .disabled > a, .pager .disabled > a:hover, .pager .disabled > a:focus, .pager .disabled > span { color: #999999; background-color: #fff; cursor: default; } .thumbnails { margin-left: -20px; list-style: none; *zoom: 1; } .thumbnails:before, .thumbnails:after { display: table; content: ""; line-height: 0; } .thumbnails:after { clear: both; } .row-fluid .thumbnails { margin-left: 0; } .thumbnails > li { float: left; margin-bottom: 20px; margin-left: 20px; } .thumbnail { display: block; padding: 4px; line-height: 20px; border: 1px solid #ddd; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055); -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055); -webkit-transition: all 0.2s ease-in-out; -moz-transition: all 0.2s ease-in-out; -o-transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out; } a.thumbnail:hover, a.thumbnail:focus { border-color: #715458; -webkit-box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25); -moz-box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25); box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25); } .thumbnail > img { display: block; max-width: 100%; margin-left: auto; margin-right: auto; } .thumbnail .caption { padding: 9px; color: #555555; } .alert { padding: 8px 35px 8px 14px; margin-bottom: 20px; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); background-color: #fcf8e3; border: 1px solid #fbeed5; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .alert, .alert h4 { color: #c09853; } .alert h4 { margin: 0; } .alert .close { position: relative; top: -2px; right: -21px; line-height: 20px; } .alert-success { background-color: #dff0d8; border-color: #d6e9c6; color: #468847; } .alert-success h4 { color: #468847; } .alert-danger, .alert-error { background-color: #f2dede; border-color: #eed3d7; color: #b94a48; } .alert-danger h4, .alert-error h4 { color: #b94a48; } .alert-info { background-color: #d9edf7; border-color: #bce8f1; color: #3a87ad; } .alert-info h4 { color: #3a87ad; } .alert-block { padding-top: 14px; padding-bottom: 14px; } .alert-block > p, .alert-block > ul { margin-bottom: 0; } .alert-block p + p { margin-top: 5px; } @-webkit-keyframes progress-bar-stripes { from { background-position: 40px 0; } to { background-position: 0 0; } } @-moz-keyframes progress-bar-stripes { from { background-position: 40px 0; } to { background-position: 0 0; } } @-ms-keyframes progress-bar-stripes { from { background-position: 40px 0; } to { background-position: 0 0; } } @-o-keyframes progress-bar-stripes { from { background-position: 0 0; } to { background-position: 40px 0; } } @keyframes progress-bar-stripes { from { background-position: 40px 0; } to { background-position: 0 0; } } .progress { overflow: hidden; height: 20px; margin-bottom: 20px; background-color: #f7f7f7; background-image: -moz-linear-gradient(top, #f5f5f5, #f9f9f9); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f5f5f5), to(#f9f9f9)); background-image: -webkit-linear-gradient(top, #f5f5f5, #f9f9f9); background-image: -o-linear-gradient(top, #f5f5f5, #f9f9f9); background-image: linear-gradient(to bottom, #f5f5f5, #f9f9f9); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#fff9f9f9', GradientType=0); -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .progress .bar { width: 0%; height: 100%; color: #ffffff; float: left; font-size: 12px; text-align: center; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #0e90d2; background-image: -moz-linear-gradient(top, #149bdf, #0480be); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#149bdf), to(#0480be)); background-image: -webkit-linear-gradient(top, #149bdf, #0480be); background-image: -o-linear-gradient(top, #149bdf, #0480be); background-image: linear-gradient(to bottom, #149bdf, #0480be); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff149bdf', endColorstr='#ff0480be', GradientType=0); -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); -moz-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; -webkit-transition: width 0.6s ease; -moz-transition: width 0.6s ease; -o-transition: width 0.6s ease; transition: width 0.6s ease; } .progress .bar + .bar { -webkit-box-shadow: inset 1px 0 0 rgba(0,0,0,.15), inset 0 -1px 0 rgba(0,0,0,.15); -moz-box-shadow: inset 1px 0 0 rgba(0,0,0,.15), inset 0 -1px 0 rgba(0,0,0,.15); box-shadow: inset 1px 0 0 rgba(0,0,0,.15), inset 0 -1px 0 rgba(0,0,0,.15); } .progress-striped .bar { background-color: #149bdf; background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); -webkit-background-size: 40px 40px; -moz-background-size: 40px 40px; -o-background-size: 40px 40px; background-size: 40px 40px; } .progress.active .bar { -webkit-animation: progress-bar-stripes 2s linear infinite; -moz-animation: progress-bar-stripes 2s linear infinite; -ms-animation: progress-bar-stripes 2s linear infinite; -o-animation: progress-bar-stripes 2s linear infinite; animation: progress-bar-stripes 2s linear infinite; } .progress-danger .bar, .progress .bar-danger { background-color: #dd514c; background-image: -moz-linear-gradient(top, #ee5f5b, #c43c35); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#c43c35)); background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35); background-image: -o-linear-gradient(top, #ee5f5b, #c43c35); background-image: linear-gradient(to bottom, #ee5f5b, #c43c35); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffc43c35', GradientType=0); } .progress-danger.progress-striped .bar, .progress-striped .bar-danger { background-color: #ee5f5b; background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); } .progress-success .bar, .progress .bar-success { background-color: #5eb95e; background-image: -moz-linear-gradient(top, #62c462, #57a957); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#57a957)); background-image: -webkit-linear-gradient(top, #62c462, #57a957); background-image: -o-linear-gradient(top, #62c462, #57a957); background-image: linear-gradient(to bottom, #62c462, #57a957); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff62c462', endColorstr='#ff57a957', GradientType=0); } .progress-success.progress-striped .bar, .progress-striped .bar-success { background-color: #62c462; background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); } .progress-info .bar, .progress .bar-info { background-color: #4bb1cf; background-image: -moz-linear-gradient(top, #5bc0de, #339bb9); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#339bb9)); background-image: -webkit-linear-gradient(top, #5bc0de, #339bb9); background-image: -o-linear-gradient(top, #5bc0de, #339bb9); background-image: linear-gradient(to bottom, #5bc0de, #339bb9); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff339bb9', GradientType=0); } .progress-info.progress-striped .bar, .progress-striped .bar-info { background-color: #5bc0de; background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); } .progress-warning .bar, .progress .bar-warning { background-color: #fdb033; background-image: -moz-linear-gradient(top, #fdbc52, #fc9f06); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdbc52), to(#fc9f06)); background-image: -webkit-linear-gradient(top, #fdbc52, #fc9f06); background-image: -o-linear-gradient(top, #fdbc52, #fc9f06); background-image: linear-gradient(to bottom, #fdbc52, #fc9f06); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffdbc52', endColorstr='#fffc9f06', GradientType=0); } .progress-warning.progress-striped .bar, .progress-striped .bar-warning { background-color: #fdbc52; background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); } .hero-unit { padding: 60px; margin-bottom: 30px; font-size: 18px; font-weight: 200; line-height: 30px; color: inherit; background-color: #bb844e; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; } .hero-unit h1 { margin-bottom: 0; font-size: 60px; line-height: 1; color: inherit; letter-spacing: -1px; } .hero-unit li { line-height: 30px; } .media, .media-body { overflow: hidden; *overflow: visible; zoom: 1; } .media, .media .media { margin-top: 15px; } .media:first-child { margin-top: 0; } .media-object { display: block; } .media-heading { margin: 0 0 5px; } .media > .pull-left { margin-right: 10px; } .media > .pull-right { margin-left: 10px; } .media-list { margin-left: 0; list-style: none; } .tooltip { position: absolute; z-index: 1030; display: block; visibility: visible; font-size: 11px; line-height: 1.4; opacity: 0; filter: alpha(opacity=0); } .tooltip.in { opacity: 0.8; filter: alpha(opacity=80); } .tooltip.top { margin-top: -3px; padding: 5px 0; } .tooltip.right { margin-left: 3px; padding: 0 5px; } .tooltip.bottom { margin-top: 3px; padding: 5px 0; } .tooltip.left { margin-left: -3px; padding: 0 5px; } .tooltip-inner { max-width: 200px; padding: 8px; color: #ffffff; text-align: center; text-decoration: none; background-color: #000000; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .tooltip-arrow { position: absolute; width: 0; height: 0; border-color: transparent; border-style: solid; } .tooltip.top .tooltip-arrow { bottom: 0; left: 50%; margin-left: -5px; border-width: 5px 5px 0; border-top-color: #000000; } .tooltip.right .tooltip-arrow { top: 50%; left: 0; margin-top: -5px; border-width: 5px 5px 5px 0; border-right-color: #000000; } .tooltip.left .tooltip-arrow { top: 50%; right: 0; margin-top: -5px; border-width: 5px 0 5px 5px; border-left-color: #000000; } .tooltip.bottom .tooltip-arrow { top: 0; left: 50%; margin-left: -5px; border-width: 0 5px 5px; border-bottom-color: #000000; } .popover { position: absolute; top: 0; left: 0; z-index: 1010; display: none; max-width: 276px; padding: 1px; text-align: left; background-color: #ffffff; -webkit-background-clip: padding-box; -moz-background-clip: padding; background-clip: padding-box; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, 0.2); -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); white-space: normal; } .popover.top { margin-top: -10px; } .popover.right { margin-left: 10px; } .popover.bottom { margin-top: 10px; } .popover.left { margin-left: -10px; } .popover-title { margin: 0; padding: 8px 14px; font-size: 14px; font-weight: normal; line-height: 18px; background-color: #f7f7f7; border-bottom: 1px solid #ebebeb; -webkit-border-radius: 5px 5px 0 0; -moz-border-radius: 5px 5px 0 0; border-radius: 5px 5px 0 0; } .popover-title:empty { display: none; } .popover-content { padding: 9px 14px; } .popover .arrow, .popover .arrow:after { position: absolute; display: block; width: 0; height: 0; border-color: transparent; border-style: solid; } .popover .arrow { border-width: 11px; } .popover .arrow:after { border-width: 10px; content: ""; } .popover.top .arrow { left: 50%; margin-left: -11px; border-bottom-width: 0; border-top-color: #999; border-top-color: rgba(0, 0, 0, 0.25); bottom: -11px; } .popover.top .arrow:after { bottom: 1px; margin-left: -10px; border-bottom-width: 0; border-top-color: #ffffff; } .popover.right .arrow { top: 50%; left: -11px; margin-top: -11px; border-left-width: 0; border-right-color: #999; border-right-color: rgba(0, 0, 0, 0.25); } .popover.right .arrow:after { left: 1px; bottom: -10px; border-left-width: 0; border-right-color: #ffffff; } .popover.bottom .arrow { left: 50%; margin-left: -11px; border-top-width: 0; border-bottom-color: #999; border-bottom-color: rgba(0, 0, 0, 0.25); top: -11px; } .popover.bottom .arrow:after { top: 1px; margin-left: -10px; border-top-width: 0; border-bottom-color: #ffffff; } .popover.left .arrow { top: 50%; right: -11px; margin-top: -11px; border-right-width: 0; border-left-color: #999; border-left-color: rgba(0, 0, 0, 0.25); } .popover.left .arrow:after { right: 1px; border-right-width: 0; border-left-color: #ffffff; bottom: -10px; } .modal-backdrop { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1040; background-color: #000000; } .modal-backdrop.fade { opacity: 0; } .modal-backdrop, .modal-backdrop.fade.in { opacity: 0.8; filter: alpha(opacity=80); } .modal { position: fixed; top: 10%; left: 50%; z-index: 1050; width: 560px; margin-left: -280px; background-color: #ffffff; border: 1px solid #999; border: 1px solid rgba(0, 0, 0, 0.3); *border: 1px solid #999; /* IE6-7 */ -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); -webkit-background-clip: padding-box; -moz-background-clip: padding-box; background-clip: padding-box; outline: none; } .modal.fade { -webkit-transition: opacity .3s linear, top .3s ease-out; -moz-transition: opacity .3s linear, top .3s ease-out; -o-transition: opacity .3s linear, top .3s ease-out; transition: opacity .3s linear, top .3s ease-out; top: -25%; } .modal.fade.in { top: 10%; } .modal-header { padding: 9px 15px; border-bottom: 1px solid #eee; } .modal-header .close { margin-top: 2px; } .modal-header h3 { margin: 0; line-height: 30px; } .modal-body { position: relative; overflow-y: auto; max-height: 400px; padding: 15px; } .modal-form { margin-bottom: 0; } .modal-footer { padding: 14px 15px 15px; margin-bottom: 0; text-align: right; background-color: #f5f5f5; border-top: 1px solid #ddd; -webkit-border-radius: 0 0 6px 6px; -moz-border-radius: 0 0 6px 6px; border-radius: 0 0 6px 6px; -webkit-box-shadow: inset 0 1px 0 #ffffff; -moz-box-shadow: inset 0 1px 0 #ffffff; box-shadow: inset 0 1px 0 #ffffff; *zoom: 1; } .modal-footer:before, .modal-footer:after { display: table; content: ""; line-height: 0; } .modal-footer:after { clear: both; } .modal-footer .btn + .btn { margin-left: 5px; margin-bottom: 0; } .modal-footer .btn-group .btn + .btn { margin-left: -1px; } .modal-footer .btn-block + .btn-block { margin-left: 0; } .dropup, .dropdown { position: relative; } .dropdown-toggle { *margin-bottom: -3px; } .dropdown-toggle:active, .open .dropdown-toggle { outline: 0; } .caret { display: inline-block; width: 0; height: 0; vertical-align: top; border-top: 4px solid #000000; border-right: 4px solid transparent; border-left: 4px solid transparent; content: ""; } .dropdown .caret { margin-top: 8px; margin-left: 2px; } .dropdown-menu { position: absolute; top: 100%; left: 0; z-index: 1000; display: none; float: left; min-width: 160px; padding: 5px 0; margin: 2px 0 0; list-style: none; background-color: #c5ad91; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, 0.2); *border-right-width: 2px; *border-bottom-width: 2px; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); -webkit-background-clip: padding-box; -moz-background-clip: padding; background-clip: padding-box; } .dropdown-menu.pull-right { right: 0; left: auto; } .dropdown-menu .divider { *width: 100%; height: 1px; margin: 9px 1px; *margin: -5px 0 5px; overflow: hidden; background-color: #e5e5e5; border-bottom: 1px solid #ffffff; } .dropdown-menu > li > a { display: block; padding: 3px 20px; clear: both; font-weight: normal; line-height: 20px; color: #715458; white-space: nowrap; } .dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus, .dropdown-submenu:hover > a, .dropdown-submenu:focus > a { text-decoration: none; color: #c5ad91; background-color: #6b5053; background-image: -moz-linear-gradient(top, #715458, #62494d); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#715458), to(#62494d)); background-image: -webkit-linear-gradient(top, #715458, #62494d); background-image: -o-linear-gradient(top, #715458, #62494d); background-image: linear-gradient(to bottom, #715458, #62494d); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff715458', endColorstr='#ff62494d', GradientType=0); } .dropdown-menu > .active > a, .dropdown-menu > .active > a:hover, .dropdown-menu > .active > a:focus { color: #ffffff; text-decoration: none; outline: 0; background-color: #6b5053; background-image: -moz-linear-gradient(top, #715458, #62494d); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#715458), to(#62494d)); background-image: -webkit-linear-gradient(top, #715458, #62494d); background-image: -o-linear-gradient(top, #715458, #62494d); background-image: linear-gradient(to bottom, #715458, #62494d); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff715458', endColorstr='#ff62494d', GradientType=0); } .dropdown-menu > .disabled > a, .dropdown-menu > .disabled > a:hover, .dropdown-menu > .disabled > a:focus { color: #999999; } .dropdown-menu > .disabled > a:hover, .dropdown-menu > .disabled > a:focus { text-decoration: none; background-color: transparent; background-image: none; filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); cursor: default; } .open { *z-index: 1000; } .open > .dropdown-menu { display: block; } .dropdown-backdrop { position: fixed; left: 0; right: 0; bottom: 0; top: 0; z-index: 990; } .pull-right > .dropdown-menu { right: 0; left: auto; } .dropup .caret, .navbar-fixed-bottom .dropdown .caret { border-top: 0; border-bottom: 4px solid #000000; content: ""; } .dropup .dropdown-menu, .navbar-fixed-bottom .dropdown .dropdown-menu { top: auto; bottom: 100%; margin-bottom: 1px; } .dropdown-submenu { position: relative; } .dropdown-submenu > .dropdown-menu { top: 0; left: 100%; margin-top: -6px; margin-left: -1px; -webkit-border-radius: 0 6px 6px 6px; -moz-border-radius: 0 6px 6px 6px; border-radius: 0 6px 6px 6px; } .dropdown-submenu:hover > .dropdown-menu { display: block; } .dropup .dropdown-submenu > .dropdown-menu { top: auto; bottom: 0; margin-top: 0; margin-bottom: -2px; -webkit-border-radius: 5px 5px 5px 0; -moz-border-radius: 5px 5px 5px 0; border-radius: 5px 5px 5px 0; } .dropdown-submenu > a:after { display: block; content: " "; float: right; width: 0; height: 0; border-color: transparent; border-style: solid; border-width: 5px 0 5px 5px; border-left-color: #9d7b53; margin-top: 5px; margin-right: -10px; } .dropdown-submenu:hover > a:after { border-left-color: #c5ad91; } .dropdown-submenu.pull-left { float: none; } .dropdown-submenu.pull-left > .dropdown-menu { left: -100%; margin-left: 10px; -webkit-border-radius: 6px 0 6px 6px; -moz-border-radius: 6px 0 6px 6px; border-radius: 6px 0 6px 6px; } .dropdown .dropdown-menu .nav-header { padding-left: 20px; padding-right: 20px; } .typeahead { z-index: 1051; margin-top: 2px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .accordion { margin-bottom: 20px; } .accordion-group { margin-bottom: 2px; border: 1px solid #e5e5e5; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .accordion-heading { border-bottom: 0; } .accordion-heading .accordion-toggle { display: block; padding: 8px 15px; } .accordion-toggle { cursor: pointer; } .accordion-inner { padding: 9px 15px; border-top: 1px solid #e5e5e5; } .carousel { position: relative; margin-bottom: 20px; line-height: 1; } .carousel-inner { overflow: hidden; width: 100%; position: relative; } .carousel-inner > .item { display: none; position: relative; -webkit-transition: 0.6s ease-in-out left; -moz-transition: 0.6s ease-in-out left; -o-transition: 0.6s ease-in-out left; transition: 0.6s ease-in-out left; } .carousel-inner > .item > img, .carousel-inner > .item > a > img { display: block; line-height: 1; } .carousel-inner > .active, .carousel-inner > .next, .carousel-inner > .prev { display: block; } .carousel-inner > .active { left: 0; } .carousel-inner > .next, .carousel-inner > .prev { position: absolute; top: 0; width: 100%; } .carousel-inner > .next { left: 100%; } .carousel-inner > .prev { left: -100%; } .carousel-inner > .next.left, .carousel-inner > .prev.right { left: 0; } .carousel-inner > .active.left { left: -100%; } .carousel-inner > .active.right { left: 100%; } .carousel-control { position: absolute; top: 40%; left: 15px; width: 40px; height: 40px; margin-top: -20px; font-size: 60px; font-weight: 100; line-height: 30px; color: #ffffff; text-align: center; background: #222222; border: 3px solid #ffffff; -webkit-border-radius: 23px; -moz-border-radius: 23px; border-radius: 23px; opacity: 0.5; filter: alpha(opacity=50); } .carousel-control.right { left: auto; right: 15px; } .carousel-control:hover, .carousel-control:focus { color: #ffffff; text-decoration: none; opacity: 0.9; filter: alpha(opacity=90); } .carousel-indicators { position: absolute; top: 15px; right: 15px; z-index: 5; margin: 0; list-style: none; } .carousel-indicators li { display: block; float: left; width: 10px; height: 10px; margin-left: 5px; text-indent: -999px; background-color: #ccc; background-color: rgba(255, 255, 255, 0.25); border-radius: 5px; } .carousel-indicators .active { background-color: #fff; } .carousel-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 15px; background: #333333; background: rgba(0, 0, 0, 0.75); } .carousel-caption h4, .carousel-caption p { color: #ffffff; line-height: 20px; } .carousel-caption h4 { margin: 0 0 5px; } .carousel-caption p { margin-bottom: 0; } .well { min-height: 20px; padding: 19px; margin-bottom: 20px; background-color: #f5f5f5; border: 1px solid #e3e3e3; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); } .well blockquote { border-color: #ddd; border-color: rgba(0, 0, 0, 0.15); } .well-large { padding: 24px; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; } .well-small { padding: 9px; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } .close { float: right; font-size: 20px; font-weight: bold; line-height: 20px; color: #000000; text-shadow: 0 1px 0 #ffffff; opacity: 0.2; filter: alpha(opacity=20); } .close:hover, .close:focus { color: #000000; text-decoration: none; cursor: pointer; opacity: 0.4; filter: alpha(opacity=40); } button.close { padding: 0; cursor: pointer; background: transparent; border: 0; -webkit-appearance: none; } .pull-right { float: right; } .pull-left { float: left; } .hide { display: none; } .show { display: block; } .invisible { visibility: hidden; } .affix { position: fixed; } .fade { opacity: 0; -webkit-transition: opacity 0.15s linear; -moz-transition: opacity 0.15s linear; -o-transition: opacity 0.15s linear; transition: opacity 0.15s linear; } .fade.in { opacity: 1; } .collapse { position: relative; height: 0; overflow: hidden; -webkit-transition: height 0.35s ease; -moz-transition: height 0.35s ease; -o-transition: height 0.35s ease; transition: height 0.35s ease; } .collapse.in { height: auto; } @-ms-viewport { width: device-width; } .hidden { display: none; visibility: hidden; } .visible-phone { display: none !important; } .visible-tablet { display: none !important; } .hidden-desktop { display: none !important; } .visible-desktop { display: inherit !important; } @media (min-width: 768px) and (max-width: 979px) { .hidden-desktop { display: inherit !important; } .visible-desktop { display: none !important ; } .visible-tablet { display: inherit !important; } .hidden-tablet { display: none !important; } } @media (max-width: 767px) { .hidden-desktop { display: inherit !important; } .visible-desktop { display: none !important; } .visible-phone { display: inherit !important; } .hidden-phone { display: none !important; } } .visible-print { display: none !important; } @media print { .visible-print { display: inherit !important; } .hidden-print { display: none !important; } } @media (max-width: 767px) { body { padding-left: 20px; padding-right: 20px; } .navbar-fixed-top, .navbar-fixed-bottom, .navbar-static-top { margin-left: -20px; margin-right: -20px; } .container-fluid { padding: 0; } .dl-horizontal dt { float: none; clear: none; width: auto; text-align: left; } .dl-horizontal dd { margin-left: 0; } .container { width: auto; } .row-fluid { width: 100%; } .row, .thumbnails { margin-left: 0; } .thumbnails > li { float: none; margin-left: 0; } [class*="span"], .uneditable-input[class*="span"], .row-fluid [class*="span"] { float: none; display: block; width: 100%; margin-left: 0; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .span12, .row-fluid .span12 { width: 100%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .row-fluid [class*="offset"]:first-child { margin-left: 0; } .input-large, .input-xlarge, .input-xxlarge, input[class*="span"], select[class*="span"], textarea[class*="span"], .uneditable-input { display: block; width: 100%; min-height: 30px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .input-prepend input, .input-append input, .input-prepend input[class*="span"], .input-append input[class*="span"] { display: inline-block; width: auto; } .controls-row [class*="span"] + [class*="span"] { margin-left: 0; } .modal { position: fixed; top: 20px; left: 20px; right: 20px; width: auto; margin: 0; } .modal.fade { top: -100px; } .modal.fade.in { top: 20px; } } @media (max-width: 480px) { .nav-collapse { -webkit-transform: translate3d(0, 0, 0); } .page-header h1 small { display: block; line-height: 20px; } input[type="checkbox"], input[type="radio"] { border: 1px solid #ccc; } .form-horizontal .control-label { float: none; width: auto; padding-top: 0; text-align: left; } .form-horizontal .controls { margin-left: 0; } .form-horizontal .control-list { padding-top: 0; } .form-horizontal .form-actions { padding-left: 10px; padding-right: 10px; } .media .pull-left, .media .pull-right { float: none; display: block; margin-bottom: 10px; } .media-object { margin-right: 0; margin-left: 0; } .modal { top: 10px; left: 10px; right: 10px; } .modal-header .close { padding: 10px; margin: -10px; } .carousel-caption { position: static; } } @media (min-width: 768px) and (max-width: 979px) { .row { margin-left: -20px; *zoom: 1; } .row:before, .row:after { display: table; content: ""; line-height: 0; } .row:after { clear: both; } [class*="span"] { float: left; min-height: 1px; margin-left: 20px; } .container, .navbar-static-top .container, .navbar-fixed-top .container, .navbar-fixed-bottom .container { width: 724px; } .span12 { width: 724px; } .span11 { width: 662px; } .span10 { width: 600px; } .span9 { width: 538px; } .span8 { width: 476px; } .span7 { width: 414px; } .span6 { width: 352px; } .span5 { width: 290px; } .span4 { width: 228px; } .span3 { width: 166px; } .span2 { width: 104px; } .span1 { width: 42px; } .offset12 { margin-left: 764px; } .offset11 { margin-left: 702px; } .offset10 { margin-left: 640px; } .offset9 { margin-left: 578px; } .offset8 { margin-left: 516px; } .offset7 { margin-left: 454px; } .offset6 { margin-left: 392px; } .offset5 { margin-left: 330px; } .offset4 { margin-left: 268px; } .offset3 { margin-left: 206px; } .offset2 { margin-left: 144px; } .offset1 { margin-left: 82px; } .row-fluid { width: 100%; *zoom: 1; } .row-fluid:before, .row-fluid:after { display: table; content: ""; line-height: 0; } .row-fluid:after { clear: both; } .row-fluid [class*="span"] { display: block; width: 100%; min-height: 30px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; float: left; margin-left: 2.7624309392265194%; *margin-left: 2.709239449864817%; } .row-fluid [class*="span"]:first-child { margin-left: 0; } .row-fluid .controls-row [class*="span"] + [class*="span"] { margin-left: 2.7624309392265194%; } .row-fluid .span12 { width: 100%; *width: 99.94680851063829%; } .row-fluid .span11 { width: 91.43646408839778%; *width: 91.38327259903608%; } .row-fluid .span10 { width: 82.87292817679558%; *width: 82.81973668743387%; } .row-fluid .span9 { width: 74.30939226519337%; *width: 74.25620077583166%; } .row-fluid .span8 { width: 65.74585635359117%; *width: 65.69266486422946%; } .row-fluid .span7 { width: 57.18232044198895%; *width: 57.12912895262725%; } .row-fluid .span6 { width: 48.61878453038674%; *width: 48.56559304102504%; } .row-fluid .span5 { width: 40.05524861878453%; *width: 40.00205712942283%; } .row-fluid .span4 { width: 31.491712707182323%; *width: 31.43852121782062%; } .row-fluid .span3 { width: 22.92817679558011%; *width: 22.87498530621841%; } .row-fluid .span2 { width: 14.3646408839779%; *width: 14.311449394616199%; } .row-fluid .span1 { width: 5.801104972375691%; *width: 5.747913483013988%; } .row-fluid .offset12 { margin-left: 105.52486187845304%; *margin-left: 105.41847889972962%; } .row-fluid .offset12:first-child { margin-left: 102.76243093922652%; *margin-left: 102.6560479605031%; } .row-fluid .offset11 { margin-left: 96.96132596685082%; *margin-left: 96.8549429881274%; } .row-fluid .offset11:first-child { margin-left: 94.1988950276243%; *margin-left: 94.09251204890089%; } .row-fluid .offset10 { margin-left: 88.39779005524862%; *margin-left: 88.2914070765252%; } .row-fluid .offset10:first-child { margin-left: 85.6353591160221%; *margin-left: 85.52897613729868%; } .row-fluid .offset9 { margin-left: 79.8342541436464%; *margin-left: 79.72787116492299%; } .row-fluid .offset9:first-child { margin-left: 77.07182320441989%; *margin-left: 76.96544022569647%; } .row-fluid .offset8 { margin-left: 71.2707182320442%; *margin-left: 71.16433525332079%; } .row-fluid .offset8:first-child { margin-left: 68.50828729281768%; *margin-left: 68.40190431409427%; } .row-fluid .offset7 { margin-left: 62.70718232044199%; *margin-left: 62.600799341718584%; } .row-fluid .offset7:first-child { margin-left: 59.94475138121547%; *margin-left: 59.838368402492065%; } .row-fluid .offset6 { margin-left: 54.14364640883978%; *margin-left: 54.037263430116376%; } .row-fluid .offset6:first-child { margin-left: 51.38121546961326%; *margin-left: 51.27483249088986%; } .row-fluid .offset5 { margin-left: 45.58011049723757%; *margin-left: 45.47372751851417%; } .row-fluid .offset5:first-child { margin-left: 42.81767955801105%; *margin-left: 42.71129657928765%; } .row-fluid .offset4 { margin-left: 37.01657458563536%; *margin-left: 36.91019160691196%; } .row-fluid .offset4:first-child { margin-left: 34.25414364640884%; *margin-left: 34.14776066768544%; } .row-fluid .offset3 { margin-left: 28.45303867403315%; *margin-left: 28.346655695309746%; } .row-fluid .offset3:first-child { margin-left: 25.69060773480663%; *margin-left: 25.584224756083227%; } .row-fluid .offset2 { margin-left: 19.88950276243094%; *margin-left: 19.783119783707537%; } .row-fluid .offset2:first-child { margin-left: 17.12707182320442%; *margin-left: 17.02068884448102%; } .row-fluid .offset1 { margin-left: 11.32596685082873%; *margin-left: 11.219583872105325%; } .row-fluid .offset1:first-child { margin-left: 8.56353591160221%; *margin-left: 8.457152932878806%; } input, textarea, .uneditable-input { margin-left: 0; } .controls-row [class*="span"] + [class*="span"] { margin-left: 20px; } input.span12, textarea.span12, .uneditable-input.span12 { width: 710px; } input.span11, textarea.span11, .uneditable-input.span11 { width: 648px; } input.span10, textarea.span10, .uneditable-input.span10 { width: 586px; } input.span9, textarea.span9, .uneditable-input.span9 { width: 524px; } input.span8, textarea.span8, .uneditable-input.span8 { width: 462px; } input.span7, textarea.span7, .uneditable-input.span7 { width: 400px; } input.span6, textarea.span6, .uneditable-input.span6 { width: 338px; } input.span5, textarea.span5, .uneditable-input.span5 { width: 276px; } input.span4, textarea.span4, .uneditable-input.span4 { width: 214px; } input.span3, textarea.span3, .uneditable-input.span3 { width: 152px; } input.span2, textarea.span2, .uneditable-input.span2 { width: 90px; } input.span1, textarea.span1, .uneditable-input.span1 { width: 28px; } } @media (min-width: 1200px) { .row { margin-left: -30px; *zoom: 1; } .row:before, .row:after { display: table; content: ""; line-height: 0; } .row:after { clear: both; } [class*="span"] { float: left; min-height: 1px; margin-left: 30px; } .container, .navbar-static-top .container, .navbar-fixed-top .container, .navbar-fixed-bottom .container { width: 1170px; } .span12 { width: 1170px; } .span11 { width: 1070px; } .span10 { width: 970px; } .span9 { width: 870px; } .span8 { width: 770px; } .span7 { width: 670px; } .span6 { width: 570px; } .span5 { width: 470px; } .span4 { width: 370px; } .span3 { width: 270px; } .span2 { width: 170px; } .span1 { width: 70px; } .offset12 { margin-left: 1230px; } .offset11 { margin-left: 1130px; } .offset10 { margin-left: 1030px; } .offset9 { margin-left: 930px; } .offset8 { margin-left: 830px; } .offset7 { margin-left: 730px; } .offset6 { margin-left: 630px; } .offset5 { margin-left: 530px; } .offset4 { margin-left: 430px; } .offset3 { margin-left: 330px; } .offset2 { margin-left: 230px; } .offset1 { margin-left: 130px; } .row-fluid { width: 100%; *zoom: 1; } .row-fluid:before, .row-fluid:after { display: table; content: ""; line-height: 0; } .row-fluid:after { clear: both; } .row-fluid [class*="span"] { display: block; width: 100%; min-height: 30px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; float: left; margin-left: 2.564102564102564%; *margin-left: 2.5109110747408616%; } .row-fluid [class*="span"]:first-child { margin-left: 0; } .row-fluid .controls-row [class*="span"] + [class*="span"] { margin-left: 2.564102564102564%; } .row-fluid .span12 { width: 100%; *width: 99.94680851063829%; } .row-fluid .span11 { width: 91.45299145299145%; *width: 91.39979996362975%; } .row-fluid .span10 { width: 82.90598290598291%; *width: 82.8527914166212%; } .row-fluid .span9 { width: 74.35897435897436%; *width: 74.30578286961266%; } .row-fluid .span8 { width: 65.81196581196582%; *width: 65.75877432260411%; } .row-fluid .span7 { width: 57.26495726495726%; *width: 57.21176577559556%; } .row-fluid .span6 { width: 48.717948717948715%; *width: 48.664757228587014%; } .row-fluid .span5 { width: 40.17094017094017%; *width: 40.11774868157847%; } .row-fluid .span4 { width: 31.623931623931625%; *width: 31.570740134569924%; } .row-fluid .span3 { width: 23.076923076923077%; *width: 23.023731587561375%; } .row-fluid .span2 { width: 14.52991452991453%; *width: 14.476723040552828%; } .row-fluid .span1 { width: 5.982905982905983%; *width: 5.929714493544281%; } .row-fluid .offset12 { margin-left: 105.12820512820512%; *margin-left: 105.02182214948171%; } .row-fluid .offset12:first-child { margin-left: 102.56410256410257%; *margin-left: 102.45771958537915%; } .row-fluid .offset11 { margin-left: 96.58119658119658%; *margin-left: 96.47481360247316%; } .row-fluid .offset11:first-child { margin-left: 94.01709401709402%; *margin-left: 93.91071103837061%; } .row-fluid .offset10 { margin-left: 88.03418803418803%; *margin-left: 87.92780505546462%; } .row-fluid .offset10:first-child { margin-left: 85.47008547008548%; *margin-left: 85.36370249136206%; } .row-fluid .offset9 { margin-left: 79.48717948717949%; *margin-left: 79.38079650845607%; } .row-fluid .offset9:first-child { margin-left: 76.92307692307693%; *margin-left: 76.81669394435352%; } .row-fluid .offset8 { margin-left: 70.94017094017094%; *margin-left: 70.83378796144753%; } .row-fluid .offset8:first-child { margin-left: 68.37606837606839%; *margin-left: 68.26968539734497%; } .row-fluid .offset7 { margin-left: 62.393162393162385%; *margin-left: 62.28677941443899%; } .row-fluid .offset7:first-child { margin-left: 59.82905982905982%; *margin-left: 59.72267685033642%; } .row-fluid .offset6 { margin-left: 53.84615384615384%; *margin-left: 53.739770867430444%; } .row-fluid .offset6:first-child { margin-left: 51.28205128205128%; *margin-left: 51.175668303327875%; } .row-fluid .offset5 { margin-left: 45.299145299145295%; *margin-left: 45.1927623204219%; } .row-fluid .offset5:first-child { margin-left: 42.73504273504273%; *margin-left: 42.62865975631933%; } .row-fluid .offset4 { margin-left: 36.75213675213675%; *margin-left: 36.645753773413354%; } .row-fluid .offset4:first-child { margin-left: 34.18803418803419%; *margin-left: 34.081651209310785%; } .row-fluid .offset3 { margin-left: 28.205128205128204%; *margin-left: 28.0987452264048%; } .row-fluid .offset3:first-child { margin-left: 25.641025641025642%; *margin-left: 25.53464266230224%; } .row-fluid .offset2 { margin-left: 19.65811965811966%; *margin-left: 19.551736679396257%; } .row-fluid .offset2:first-child { margin-left: 17.094017094017094%; *margin-left: 16.98763411529369%; } .row-fluid .offset1 { margin-left: 11.11111111111111%; *margin-left: 11.004728132387708%; } .row-fluid .offset1:first-child { margin-left: 8.547008547008547%; *margin-left: 8.440625568285142%; } input, textarea, .uneditable-input { margin-left: 0; } .controls-row [class*="span"] + [class*="span"] { margin-left: 30px; } input.span12, textarea.span12, .uneditable-input.span12 { width: 1156px; } input.span11, textarea.span11, .uneditable-input.span11 { width: 1056px; } input.span10, textarea.span10, .uneditable-input.span10 { width: 956px; } input.span9, textarea.span9, .uneditable-input.span9 { width: 856px; } input.span8, textarea.span8, .uneditable-input.span8 { width: 756px; } input.span7, textarea.span7, .uneditable-input.span7 { width: 656px; } input.span6, textarea.span6, .uneditable-input.span6 { width: 556px; } input.span5, textarea.span5, .uneditable-input.span5 { width: 456px; } input.span4, textarea.span4, .uneditable-input.span4 { width: 356px; } input.span3, textarea.span3, .uneditable-input.span3 { width: 256px; } input.span2, textarea.span2, .uneditable-input.span2 { width: 156px; } input.span1, textarea.span1, .uneditable-input.span1 { width: 56px; } .thumbnails { margin-left: -30px; } .thumbnails > li { margin-left: 30px; } .row-fluid .thumbnails { margin-left: 0; } } @media (max-width: 979px) { body { padding-top: 0; } .navbar-fixed-top, .navbar-fixed-bottom { position: static; } .navbar-fixed-top { margin-bottom: 20px; } .navbar-fixed-bottom { margin-top: 20px; } .navbar-fixed-top .navbar-inner, .navbar-fixed-bottom .navbar-inner { padding: 5px; } .navbar .container { width: auto; padding: 0; } .navbar .brand { padding-left: 10px; padding-right: 10px; margin: 0 0 0 -5px; } .nav-collapse { clear: both; } .nav-collapse .nav { float: none; margin: 0 0 10px; } .nav-collapse .nav > li { float: none; } .nav-collapse .nav > li > a { margin-bottom: 2px; } .nav-collapse .nav > .divider-vertical { display: none; } .nav-collapse .nav .nav-header { color: #bb844e; text-shadow: none; } .nav-collapse .nav > li > a, .nav-collapse .dropdown-menu a { padding: 9px 15px; font-weight: bold; color: #bb844e; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } .nav-collapse .btn { padding: 4px 10px 4px; font-weight: normal; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .nav-collapse .dropdown-menu li + li a { margin-bottom: 2px; } .nav-collapse .nav > li > a:hover, .nav-collapse .nav > li > a:focus, .nav-collapse .dropdown-menu a:hover, .nav-collapse .dropdown-menu a:focus { background-color: #371605; } .navbar-inverse .nav-collapse .nav > li > a, .navbar-inverse .nav-collapse .dropdown-menu a { color: #999999; } .navbar-inverse .nav-collapse .nav > li > a:hover, .navbar-inverse .nav-collapse .nav > li > a:focus, .navbar-inverse .nav-collapse .dropdown-menu a:hover, .navbar-inverse .nav-collapse .dropdown-menu a:focus { background-color: #111111; } .nav-collapse.in .btn-group { margin-top: 5px; padding: 0; } .nav-collapse .dropdown-menu { position: static; top: auto; left: auto; float: none; display: none; max-width: none; margin: 0 15px; padding: 0; background-color: transparent; border: none; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; } .nav-collapse .open > .dropdown-menu { display: block; } .nav-collapse .dropdown-menu:before, .nav-collapse .dropdown-menu:after { display: none; } .nav-collapse .dropdown-menu .divider { display: none; } .nav-collapse .nav > li > .dropdown-menu:before, .nav-collapse .nav > li > .dropdown-menu:after { display: none; } .nav-collapse .navbar-form, .nav-collapse .navbar-search { float: none; padding: 10px 15px; margin: 10px 0; border-top: 1px solid #371605; border-bottom: 1px solid #371605; -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1); -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1); box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1); } .navbar-inverse .nav-collapse .navbar-form, .navbar-inverse .nav-collapse .navbar-search { border-top-color: #111111; border-bottom-color: #111111; } .navbar .nav-collapse .nav.pull-right { float: none; margin-left: 0; } .nav-collapse, .nav-collapse.collapse { overflow: hidden; height: 0; } .navbar .btn-navbar { display: block; } .navbar-static .navbar-inner { padding-left: 10px; padding-right: 10px; } } @media (min-width: 980px) { .nav-collapse.collapse { height: auto !important; overflow: visible !important; } }
bokac1984/sandbook
sandbook/app/bootstrap/css/bootstrap.css
CSS
bsd-3-clause
147,074
#ifndef ENTRY_H #define ENTRY_H #include "Object.h" #include "CompiledCode.h" #include "String.h" #define ENTRY_MAX_ARGS_SIZE 16 typedef struct { _Bool isHandle; union { Value value; Object *handle; }; } EntryArg; typedef struct { size_t size; EntryArg values[ENTRY_MAX_ARGS_SIZE]; } EntryArgs; Value invokeMethod(CompiledMethod *method, EntryArgs *args); Value invokeInititalize(Object *object); Value sendMessage(String *selector, EntryArgs *args); Value evalCode(char *source); _Bool parseFileAndInitialize(char *filename, Value *lastBlockResult); _Bool parseFile(char *filename, OrderedCollection *classes, OrderedCollection *blocks); static void entryArgsAddObject(EntryArgs *args, Object *object) { intptr_t index = args->size++; ASSERT(index <= ENTRY_MAX_ARGS_SIZE); args->values[index].isHandle = 1; args->values[index].handle = object; } static void entryArgsAdd(EntryArgs *args, Value value) { intptr_t index = args->size++; ASSERT(index <= ENTRY_MAX_ARGS_SIZE); args->values[index].isHandle = 0; args->values[index].value = value; } #endif
lm/yet-another-smalltalk-vm
vm/Entry.h
C
bsd-3-clause
1,073
// Copyright (c) 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef QUICHE_QUIC_QBONE_QBONE_CLIENT_INTERFACE_H_ #define QUICHE_QUIC_QBONE_QBONE_CLIENT_INTERFACE_H_ #include <cstdint> #include "absl/strings/string_view.h" namespace quic { // An interface that includes methods to interact with a QBONE client. class QboneClientInterface { public: virtual ~QboneClientInterface() {} // Accepts a given packet from the network and sends the packet down to the // QBONE connection. virtual void ProcessPacketFromNetwork(absl::string_view packet) = 0; }; } // namespace quic #endif // QUICHE_QUIC_QBONE_QBONE_CLIENT_INTERFACE_H_
google/quiche
quic/qbone/qbone_client_interface.h
C
bsd-3-clause
751
#ifndef SEQUENCE_INDEX_DATABASE_H_ #define SEQUENCE_INDEX_DATABASE_H_ #include <fstream> #include <iostream> #include <vector> #include <assert.h> #include <stdlib.h> #include <sstream> #include <algorithm> #include "Types.h" #include "DNASequence.h" #include "utils/StringUtils.h" using namespace std; #define SEQUENCE_INDEX_DATABASE_MAGIC 1233211233 template<typename TSeq> class SequenceIndexDatabase { public: vector<DNALength> growableSeqStartPos; vector<string> growableName; DNALength *seqStartPos; bool deleteSeqStartPos; char **names; bool deleteNames; int *nameLengths; bool deleteNameLengths; int nSeqPos; bool deleteStructures; // // This is stored after reading in the sequence. // vector<string> md5; SequenceIndexDatabase(int final=0) { nSeqPos = 0; if (!final) { growableSeqStartPos.push_back(0); } names = NULL; deleteNames = false; nameLengths = NULL; deleteNameLengths = false; seqStartPos = NULL; deleteSeqStartPos = false; deleteStructures = false; } DNALength GetLengthOfSeq(int seqIndex) { assert(seqIndex < nSeqPos-1); return seqStartPos[seqIndex+1] - seqStartPos[seqIndex] - 1; } void GetName(int seqIndex, string &name) { assert(seqIndex < nSeqPos-1); name = names[seqIndex]; } void MakeSAMSQString(string &sqString) { stringstream st; int i; for (i = 0; i < nSeqPos-1; i++) { st << "@SQ\tSN:" << names[i] << "\tLN:" << GetLengthOfSeq(i); if (md5.size() == nSeqPos-1) { st << "\tM5:" << md5[i]; } st << endl; } sqString = st.str(); } DNALength ChromosomePositionToGenome(int chrom, DNALength chromPos) { assert(chrom < nSeqPos); return seqStartPos[chrom] + chromPos; } int SearchForIndex(DNALength pos) { // The default behavior for the case // that there is just one genome. if (nSeqPos == 1) { return 0; } DNALength* seqPosIt = upper_bound(seqStartPos+1, seqStartPos + nSeqPos, pos); return seqPosIt - seqStartPos - 1; } string GetSpaceDelimitedName(unsigned int index) { int pos; assert(index < nSeqPos); string name; for (pos = 0; pos < nameLengths[index]; pos++) { if (names[index][pos] == ' ' or names[index][pos] == '\t' or names[index][pos] == '\0') { break; } } name.assign(names[index], pos); return name; } int SearchForStartBoundary(DNALength pos) { int index = SearchForIndex(pos); if (index != -1) { return seqStartPos[index]; } else { return -1; } } int SearchForEndBoundary(DNALength pos) { int index = SearchForIndex(pos); if (index != -1) { return seqStartPos[index + 1]; } else { return -1; } } DNALength SearchForStartAndEnd(DNALength pos, DNALength &start, DNALength &end) { int index = SearchForIndex(pos); if (index != -1) { start = seqStartPos[index]; end = seqStartPos[index+1]; return 1; } else { start = end = -1; return 0; } } void WriteDatabase(ofstream &out) { int mn = SEQUENCE_INDEX_DATABASE_MAGIC; out.write((char*) &mn, sizeof(int)); out.write((char*) &nSeqPos, sizeof(int)); out.write((char*) seqStartPos, sizeof(DNALength) * nSeqPos); int nSeq = nSeqPos - 1; out.write((char*) nameLengths, sizeof(int) * nSeq); int i; // // The number of sequences is 1 less than the number of positions // since the positions include 0 as a boundary. // char nullchar = '\0'; for (i = 0; i < nSeq; i++) { // // nameLengths has space for the null char, so the length of the // name = nameLengths[i]-1. Write a nullchar to disk so that it // may be read in later with no work. // out.write((char*) names[i], sizeof(char) * (nameLengths[i]-1)); out.write((char*) &nullchar, sizeof(char)); } } void ReadDatabase(ifstream &in) { int mn; // Make sure this is a read database, since the binary input // is not syntax checked. in.read((char*) &mn, sizeof(int)); if (mn != SEQUENCE_INDEX_DATABASE_MAGIC) { cout << "ERROR: Sequence index database is corrupt!" << endl; exit(0); } // // Read in the boundaries of each sequence. // deleteStructures = true; in.read((char*) &nSeqPos, sizeof(int)); seqStartPos = new DNALength[nSeqPos]; deleteSeqStartPos = true; in.read((char*) seqStartPos, sizeof(DNALength) * nSeqPos); int nSeq = nSeqPos - 1; // Get the lengths of the strings to read. nameLengths = new int[nSeq]; deleteNameLengths = true; in.read((char*)nameLengths, sizeof(int) * nSeq); // Get the titles of the sequences. names = new char*[nSeq]; deleteNames = true; char *namePtr; int i; for (i = 0; i < nSeq; i++) { namePtr = new char[nameLengths[i]]; if (nameLengths[i] > 0) { in.read(namePtr, nameLengths[i]); } namePtr[nameLengths[i]-1] = '\0'; names[i] = namePtr; } } void SequenceTitleLinesToNames() { int seqIndex; for (seqIndex = 0; seqIndex < nSeqPos-1; seqIndex++) { string tmpName; AssignUntilFirstSpace(names[seqIndex], nameLengths[seqIndex], tmpName); delete[] names[seqIndex]; names[seqIndex] = new char[tmpName.size()+1]; strcpy(names[seqIndex], tmpName.c_str()); names[seqIndex][tmpName.size()] = '\0'; nameLengths[seqIndex] = tmpName.size(); } } VectorIndex AddSequence(TSeq &sequence) { int endPos = growableSeqStartPos[growableSeqStartPos.size() - 1]; int growableSize = growableSeqStartPos.size(); growableSeqStartPos.push_back(endPos + sequence.length + 1); string fastaTitle; sequence.GetFASTATitle(fastaTitle); growableName.push_back(fastaTitle); return growableName.size(); } void Finalize() { deleteStructures = true; seqStartPos = &growableSeqStartPos[0]; nSeqPos = growableSeqStartPos.size(); int nSeq = nSeqPos - 1; names = new char*[nSeq]; deleteNames = true; unsigned int i; nameLengths = new int[nSeq]; deleteNameLengths = true; for (i = 0; i < nSeq; i++) { names[i] = new char[growableName[i].size() + 1]; memcpy((char*) names[i], (char*) growableName[i].c_str(), growableName[i].size()); names[i][growableName[i].size()] = '\0'; nameLengths[i] = growableName[i].size() + 1; } } void FreeDatabase() { int i; if (deleteStructures == false) { return; } if (names != NULL and deleteNames) { int nSeq = nSeqPos - 1; for (i = 0; i < nSeq; i++ ){ delete[] names[i]; } delete[] names; } if (nameLengths != NULL) { delete[] nameLengths; } if (seqStartPos != NULL and deleteSeqStartPos) { delete[] seqStartPos; } } }; template< typename TSeq > class SeqBoundaryFtr { public: SequenceIndexDatabase<TSeq> *seqDB; SeqBoundaryFtr(SequenceIndexDatabase<TSeq> *_seqDB) { seqDB = _seqDB; } int GetIndex(DNALength pos) { return seqDB->SearchForIndex(pos); } int GetStartPos(int index) { assert(index < seqDB->nSeqPos); return seqDB->seqStartPos[index]; } DNALength operator()(DNALength pos) { return seqDB->SearchForStartBoundary(pos); } // // This is misuse of a functor, but easier interface coding for now. DNALength Length(DNALength pos) { DNALength start, end; seqDB->SearchForStartAndEnd(pos, start, end); return end - start; } }; #endif
ylipacbio/ForReferenceOnly
common/datastructures/metagenome/SequenceIndexDatabase.h
C
bsd-3-clause
7,231
/* Copyright (C) 2013-2014 by Kristina Simpson <[email protected]> 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. */ #pragma once #include "ParticleSystemFwd.hpp" namespace KRE { namespace Particles { enum class EmitsType { VISUAL, EMITTER, AFFECTOR, TECHNIQUE, SYSTEM, }; class Emitter : public EmitObject { public: explicit Emitter(ParticleSystemContainer* parent, const variant& node); virtual ~Emitter(); Emitter(const Emitter&); int getEmittedParticleCountPerCycle(float t); color_vector getColor() const; Technique* getTechnique() { return technique_; } void setParentTechnique(Technique* tq) { technique_ = tq; } virtual Emitter* clone() = 0; static Emitter* factory(ParticleSystemContainer* parent, const variant& node); protected: virtual void internalCreate(Particle& p, float t) = 0; virtual bool durationExpired() { return can_be_deleted_; } private: virtual void handleEmitProcess(float t) override; virtual void handleDraw() const override; Technique* technique_; // These are generation parameters. ParameterPtr emission_rate_; ParameterPtr time_to_live_; ParameterPtr velocity_; ParameterPtr angle_; ParameterPtr mass_; // This is the duration that the emitter lives for ParameterPtr duration_; // this is the delay till the emitter repeats. ParameterPtr repeat_delay_; std::unique_ptr<std::pair<glm::quat, glm::quat>> orientation_range_; typedef std::pair<color_vector,color_vector> color_range; std::shared_ptr<color_range> color_range_; glm::vec4 color_; ParameterPtr particle_width_; ParameterPtr particle_height_; ParameterPtr particle_depth_; bool force_emission_; bool force_emission_processed_; bool can_be_deleted_; EmitsType emits_type_; std::string emits_name_; void initParticle(Particle& p, float t); void setParticleStartingValues(const std::vector<Particle>::iterator& start, const std::vector<Particle>::iterator& end); void createParticles(std::vector<Particle>& particles, std::vector<Particle>::iterator& start, std::vector<Particle>::iterator& end, float t); size_t calculateParticlesToEmit(float t, size_t quota, size_t current_size); float generateAngle() const; glm::vec3 getInitialDirection() const; //BoxOutlinePtr debug_draw_outline_; // working items // Any "left over" fractional count of emitted particles float emission_fraction_; // time till the emitter stops emitting. float duration_remaining_; // time remaining till a stopped emitter restarts. float repeat_delay_remaining_; Emitter(); }; } }
sweetkristas/swiftly
src/kre/ParticleSystemEmitters.hpp
C++
bsd-3-clause
3,459
{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE DataKinds #-} module React.Flux.Mui.RadioButton.RadioButtonGroup where import Protolude import Data.Aeson import Data.Aeson.Casing import Data.String (String) import React.Flux import React.Flux.Mui.Types import React.Flux.Mui.Util data RadioButtonGroup = RadioButtonGroup { radioButtonGroupClassName :: !(Maybe Text) , radioButtonGroupLabelPosition :: !(Maybe (MuiSymbolEnum '[ "left", "right"])) , radioButtonGroupName :: !Text } deriving (Generic, Show) instance ToJSON RadioButtonGroup where toJSON = genericToJSON $ aesonDrop (length ("RadioButtonGroup" :: String)) camelCase defRadioButtonGroup :: Text -> RadioButtonGroup defRadioButtonGroup radioButtonGroupName_ = RadioButtonGroup { radioButtonGroupClassName = Nothing , radioButtonGroupLabelPosition = Nothing , radioButtonGroupName = radioButtonGroupName_ } radioButtonGroup_ :: RadioButtonGroup -> [PropertyOrHandler handler] -> ReactElementM handler () -> ReactElementM handler () radioButtonGroup_ args props = foreign_ "RadioButtonGroup" (fromMaybe [] (toProps args) ++ props)
pbogdan/react-flux-mui
react-flux-mui/src/React/Flux/Mui/RadioButton/RadioButtonGroup.hs
Haskell
bsd-3-clause
1,165
YUI.add('enc-utf16-test', function (Y) { var C = CryptoJS; Y.CryptoJSTestSuite.add(new Y.Test.Case({ name: 'Utf16', testStringify1: function () { Y.Assert.areEqual('z', C.enc.Utf16.stringify(C.lib.WordArray.create([0x007a0000], 2))); }, testStringify2: function () { Y.Assert.areEqual('水', C.enc.Utf16.stringify(C.lib.WordArray.create([0x6c340000], 2))); }, testStringify3: function () { Y.Assert.areEqual('𐀀', C.enc.Utf16.stringify(C.lib.WordArray.create([0xd800dc00], 4))); }, testStringify4: function () { Y.Assert.areEqual('𝄞', C.enc.Utf16.stringify(C.lib.WordArray.create([0xd834dd1e], 4))); }, testStringify5: function () { Y.Assert.areEqual('􏿽', C.enc.Utf16.stringify(C.lib.WordArray.create([0xdbffdffd], 4))); }, testStringifyLE: function () { Y.Assert.areEqual('􏿽', C.enc.Utf16LE.stringify(C.lib.WordArray.create([0xffdbfddf], 4))); }, testStringifyLEInputIntegrity: function () { var wordArray = C.lib.WordArray.create([0xffdbfddf], 4); Y.Assert.areEqual('􏿽', C.enc.Utf16LE.stringify(wordArray)); Y.Assert.areEqual('􏿽', C.enc.Utf16LE.stringify(wordArray)); }, testParse1: function () { Y.Assert.areEqual(C.lib.WordArray.create([0x007a0000], 2).toString(), C.enc.Utf16.parse('z').toString()); }, testParse2: function () { Y.Assert.areEqual(C.lib.WordArray.create([0x6c340000], 2).toString(), C.enc.Utf16.parse('水').toString()); }, testParse3: function () { Y.Assert.areEqual(C.lib.WordArray.create([0xd800dc00], 4).toString(), C.enc.Utf16.parse('𐀀').toString()); }, testParse4: function () { Y.Assert.areEqual(C.lib.WordArray.create([0xd834dd1e], 4).toString(), C.enc.Utf16.parse('𝄞').toString()); }, testParse5: function () { Y.Assert.areEqual(C.lib.WordArray.create([0xdbffdffd], 4).toString(), C.enc.Utf16.parse('􏿽').toString()); }, testParseLE: function () { Y.Assert.areEqual(C.lib.WordArray.create([0xffdbfddf], 4).toString(), C.enc.Utf16LE.parse('􏿽').toString()); } })); }, '$Rev$');
pirafrank/crypto-js
branches/4.x/test/tests/enc-utf16-test.js
JavaScript
bsd-3-clause
2,419
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved. # Use of this source code is governed by a BSD-style license (see the COPYING file). """ This package contains the qibuild actions. """ from __future__ import absolute_import from __future__ import unicode_literals from __future__ import print_function
aldebaran/qibuild
python/qibuild/actions/__init__.py
Python
bsd-3-clause
365
package com.navisens.pojostick.navishare; import com.navisens.motiondnaapi.MotionDna; import com.navisens.pojostick.navisenscore.*; import java.util.HashSet; import java.util.Map; import java.util.Set; /** * Created by Joseph on 11/30/17. * <p> * NaviShare provides functionality for communicating with other devices * </p> */ @SuppressWarnings("unused") public class NaviShare implements NavisensPlugin { private static final long QUERY_INTERVAL = 500000000; private String host, port, room; private boolean changed; private boolean configured; private boolean connected; private NavisensCore core; private final Set<String> rooms; private final Set<NaviShareListener> listeners; private long roomsQueriedAt; @SuppressWarnings("unused") public NaviShare() { this.rooms = new HashSet<>(); this.listeners = new HashSet<>(); this.roomsQueriedAt = System.nanoTime(); } /** * Configure a server. This does not connect to it yet, but is required before calling connect. * * @param host server ip * @param port server port * @return a reference to this NaviShare */ @SuppressWarnings("unused") public NaviShare configure(String host, String port) { core.getSettings().overrideHost(null, null); this.host = host; this.port = port; this.changed = true; this.configured = true; return this; } /** * Connect to a room in the server. * * @param room The room to connect to * @return Whether this device connected to a server */ @SuppressWarnings("unused") public boolean connect(String room) { core.getSettings().overrideRoom(null); if (configured) { if (connected && !changed) { core.getMotionDna().setUDPRoom(room); } else { this.disconnect(); core.getMotionDna().startUDP(room, host, port); this.connected = true; } this.changed = false; return true; } return false; } /** * Disconnect from the server. */ @SuppressWarnings("unused") public void disconnect() { core.getMotionDna().stopUDP(); this.connected = false; } /** * Connect to a public test server. Don't use this for official release, as it is public * and can get filled up quickly. Each organization can claim one room, so if you need * multiple independent servers within your organization, you should test on a private * server instead, and use configure(host, port) to target that server instead. */ @SuppressWarnings("unused") public boolean testConnect() { if (!connected) { this.disconnect(); core.getMotionDna().startUDP(); return this.connected = true; } return false; } /** * Send a message to all other devices on the network * * @param msg A string to send, recommended web safe */ @SuppressWarnings("unused") public void sendMessage(String msg) { if (connected) { core.getMotionDna().sendUDPPacket(msg); } } /** * Add a listener to receive network events * * @param listener The listener to receive events * @return Whether the listener was added successfully */ @SuppressWarnings("unused") public boolean addListener(NaviShareListener listener) { return this.listeners.add(listener); } /** * Remove a listener to stop receiving events * * @param listener Ths listener to remove * @return Whether the listener was removed successfully */ @SuppressWarnings("unused") public boolean removeListener(NaviShareListener listener) { return this.listeners.remove(listener); } /** * Track a room so you can query its status. Call refreshRoomStatus to * receive a new roomStatus event * * @param room A room to track * @return Whether the room was added to be tracked or not */ @SuppressWarnings("unused") public boolean trackRoom(String room) { return this.rooms.add(room); } /** * Stop tracking a room. Call refreshRoomStatus to receive a new roomStatusEvent * * @param room A room to stop tracking * @return Whether the room was removed from tracking or not */ @SuppressWarnings("unused") public boolean untrackRoom(String room) { return this.rooms.remove(room); } /** * Refresh the status of any tracked rooms. Updates will be received from the * roomOccupancyChanged event * @return Whether a refresh request was sent or not */ @SuppressWarnings("unused") public boolean refreshRoomStatus() { final long now = System.nanoTime(); if (connected && now - roomsQueriedAt > QUERY_INTERVAL) { roomsQueriedAt = now; core.getMotionDna().sendUDPQueryRooms(rooms.toArray(new String[0])); return true; } return false; } @Override public boolean init(NavisensCore navisensCore, Object[] objects) { this.core = navisensCore; core.subscribe(this, NavisensCore.NETWORK_DATA); core.getSettings().requestNetworkRate(100); core.applySettings(); return true; } @Override public boolean stop() { this.disconnect(); core.remove(this); return true; } @Override public void receiveMotionDna(MotionDna motionDna) { } @Override public void receiveNetworkData(MotionDna motionDna) { } @Override public void receiveNetworkData(MotionDna.NetworkCode networkCode, Map<String, ?> map) { switch (networkCode) { case RAW_NETWORK_DATA: for (NaviShareListener listener : listeners) listener.messageReceived((String) map.get("ID"), (String) map.get("payload")); break; case ROOM_CAPACITY_STATUS: for (NaviShareListener listener : listeners) listener.roomOccupancyChanged((Map<String, Integer>) map.get("payload")); break; case EXCEEDED_SERVER_ROOM_CAPACITY: for (NaviShareListener listener : listeners) listener.serverCapacityExceeded(); this.disconnect(); break; case EXCEEDED_ROOM_CONNECTION_CAPACITY: for (NaviShareListener listener : listeners) listener.roomCapacityExceeded(); this.disconnect(); break; } } @Override public void receivePluginData(String id, int operator, Object... payload) { } @Override public void reportError(MotionDna.ErrorCode errorCode, String s) { } }
navisens/Android-Plugin
navishare/src/main/java/com/navisens/pojostick/navishare/NaviShare.java
Java
bsd-3-clause
6,973
# @desc makefile for Login # @author viticm<[email protected]> # @date 2013-06-25 20:00:13 include ../../premake.mk CFLAGS = -I$(BASEDIR)/Login/Main -I$(BASEDIR)/Login/DB -I$(BASEDIR)/Login/Packets -I$(BASEDIR)/Login/Process -I$(BASEDIR)/Login/Player -I$(BASEDIR)/Login $(SERVER_BASE_INCLUDES) LDFLAGS = DIRS = OBJS = DBThread.o \ LoginDBManager.o \ DBThreadManager.o \ CharConfig.o \ DBLogicManager.o debug:$(OBJS) for dir in $(DIRS); do \ $(MAKE) debug -C $$dir; \ done release:$(OBJS) for dir in $(DIRS); do \ $(MAKE) release -C $$dir; \ done all:debug clean: $(RM) -f *.o
viticm/web-pap
server/Login/DB/Makefile
Makefile
bsd-3-clause
604
# $FreeBSD$ PROG= juggle NO_MAN= WARNS?= 3 DPADD= ${LIBPTHREAD} LDADD= -lpthread .include <bsd.prog.mk>
jhbsz/OSI-OS
tools/tools/netrate/juggle/Makefile
Makefile
bsd-3-clause
106
<?php // WARNING, this is a read only file created by import scripts // WARNING // WARNING, Changes made to this file will be clobbered // WARNING // WARNING, Please make changes on poeditor instead of here // // ?> subject: (opomnik) {if:transfer.files>1}Datoteke, pripravljene{else}Datoteka, pripravljena{endif} za prenos subject: (opomnik) {transfer.subject} {alternative:plain} Spoštovani, prejeli ste opomnik, da {if:transfer.files>1}so bile naložene datoteke{else}je bila naložena datoteka{endif} na {cfg:site_name} s strani {transfer.user_email}, Vam pa so bile dodeljene pravice za prenos {if:transfer.files>1}njihovih vsebin{else}njene vsebine{endif} : {if:transfer.files>1}{each:transfer.files as file} - {file.path} ({size:file.size}) {endeach}{else} {transfer.files.first().path} ({size:transfer.files.first().size}) {endif} Povezava za prenos: {recipient.download_link} Prenos je na voljo do {date:transfer.expires}. Po tem datumu bo avtomatsko izbrisan. {if:transfer.message || transfer.subject} Osebno sporočilo od {transfer.user_email}: {transfer.subject} {transfer.message} {endif} Lep pozdrav, {cfg:site_name} {alternative:html} <p> Spoštovani, </p> <p> prejeli ste opomnik, da {if:transfer.files>1}so bile naložene datoteke{else}je bila naložena datoteka{endif} na {cfg:site_name} s strani {transfer.user_email}, Vam pa so bile dodeljene pravice za prenos {if:transfer.files>1}njihovih vsebin{else}njene vsebine{endif}. </p> <table rules="rows"> <thead> <tr> <th colspan="2">Podrobnosti prenosa</th> </tr> </thead> <tbody> <tr> <td>{if:transfer.files>1}Datoteke{else}Datoteka{endif}</td> <td> {if:transfer.files>1} <ul> {each:transfer.files as file} <li>{file.path} ({size:file.size})</li> {endeach} </ul> {else} {transfer.files.first().path} ({size:transfer.files.first().size}) {endif} </td> </tr> {if:transfer.files>1} <tr> <td>Velikost prenosa</td> <td>{size:transfer.size}</td> </tr> {endif} <tr> <td>Rok veljavnosti</td> <td>{date:transfer.expires}</td> </tr> <tr> <td>Povezava do prenosa</td> <td><a href="{recipient.download_link}">{recipient.download_link}</a></td> </tr> </tbody> </table> {if:transfer.message} <p> Osebno sporočilo od {transfer.user_email}: </p> <p class="message"> <span class="subject">{transfer.subject}</span> {transfer.message} </p> {endif} <p> Lep pozdrav,<br /> {cfg:site_name} </p>
filesender/filesender
language/sl_SI/transfer_reminder.mail.php
PHP
bsd-3-clause
2,784
-- | -- Module: Threshold -- Description: Time integrated threshold functions -- Copyright: (c) 2013 Tom Hawkins & Lee Pike -- -- Time integrated threshold functions typically used in condition monitoring. module Language.Atom.Common.Threshold ( boolThreshold , doubleThreshold ) where import Language.Atom.Expressions import Language.Atom.Language import Data.Int (Int32) -- | Boolean thresholding over time. Output is set when internal counter hits -- limit, and cleared when counter is 0. boolThreshold :: Name -> Int32 -> Bool -> E Bool -> Atom (E Bool) boolThreshold name_ num init_ input = atom name_ "" $ do --assert "positiveNumber" $ num >= 0 state <- bool "state" init_ count <- int32 "count" (if init_ then num else 0) atom "update" "" $ do cond $ value count >. Const 0 &&. value count <. Const num count <== value count + mux input (Const 1) (Const (-1)) atom "low" "" $ do cond $ value count ==. Const 0 state <== false atom "high" "" $ do cond $ value count ==. Const num state <== true return $ value state -- | Integrating threshold. Output is set with integral reaches limit, and -- cleared when integral reaches 0. doubleThreshold :: Name -> Double -> E Double -> Atom (E Bool) doubleThreshold name_ lim input = atom name_ "" $ do --assert "positiveLimit" $ lim >= 0 state <- bool "state" False sum_ <- double "sum" 0 -- TODO: Figure out what the below translates to in the newer library -- (high,low) <- priority atom "update" "" $ do sum_ <== value sum_ + input -- low atom "clear" "" $ do cond $ value sum_ <=. 0 state <== false sum_ <== 0 -- high atom "set" "" $ do cond $ value sum_ >=. Const lim state <== true sum_ <== Const lim -- high return $ value state
Copilot-Language/atom_for_copilot
Language/Atom/Common/Threshold.hs
Haskell
bsd-3-clause
1,806
// // Copyright (c) 2004-2021 Jaroslaw Kowalski <[email protected]>, Kim Christensen, Julian Verdurmen // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // * Neither the name of Jaroslaw Kowalski nor the names of its // contributors may be used to endorse or promote products derived from this // software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF // THE POSSIBILITY OF SUCH DAMAGE. // namespace NLog.Layouts { using NLog.Config; /// <summary> /// A XML Element /// </summary> [NLogConfigurationItem] public class XmlElement : XmlElementBase { private const string DefaultElementName = "item"; /// <inheritdoc/> public XmlElement() : this(DefaultElementName, null) { } /// <inheritdoc/> public XmlElement(string elementName, Layout elementValue) : base(elementName, elementValue) { } /// <summary> /// Name of the element /// </summary> /// <docgen category='Element Options' order='10' /> public string Name { get => base.ElementNameInternal; set => base.ElementNameInternal = value; } /// <summary> /// Value inside the element /// </summary> /// <docgen category='Element Options' order='10' /> public Layout Value { get => base.LayoutWrapper.Inner; set => base.LayoutWrapper.Inner = value; } /// <summary> /// Determines whether or not this attribute will be Xml encoded. /// </summary> /// <docgen category='Element Options' order='10' /> public bool Encode { get => base.LayoutWrapper.XmlEncode; set => base.LayoutWrapper.XmlEncode = value; } } }
304NotModified/NLog
src/NLog/Layouts/XML/XmlElement.cs
C#
bsd-3-clause
3,082
require "lita" Lita.load_locales Dir[File.expand_path( File.join("..", "..", "locales", "*.yml"), __FILE__ )] require 'lita/handlers/markov' # Lita::Handlers::Markov.template_root File.expand_path( # File.join("..", "..", "templates"), # __FILE__ # )
dirk/lita-markov
lib/lita-markov.rb
Ruby
bsd-3-clause
259
# ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (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.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is configman # # The Initial Developer of the Original Code is # Mozilla Foundation # Portions created by the Initial Developer are Copyright (C) 2011 # the Initial Developer. All Rights Reserved. # # Contributor(s): # K Lars Lohn, [email protected] # Peter Bengtsson, [email protected] # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ***** END LICENSE BLOCK ***** import sys import re import datetime import types import inspect import collections import json from required_config import RequiredConfig from namespace import Namespace from .datetime_util import datetime_from_ISO_string as datetime_converter from .datetime_util import date_from_ISO_string as date_converter import datetime_util #------------------------------------------------------------------------------ def option_value_str(an_option): """return an instance of Option's value as a string. The option instance doesn't actually have to be from the Option class. All it requires is that the passed option instance has a ``value`` attribute. """ if an_option.value is None: return '' try: converter = to_string_converters[type(an_option.value)] s = converter(an_option.value) except KeyError: if not isinstance(an_option.value, basestring): s = unicode(an_option.value) else: s = an_option.value if an_option.from_string_converter in converters_requiring_quotes: s = "'''%s'''" % s return s #------------------------------------------------------------------------------ def str_dict_keys(a_dict): """return a modified dict where all the keys that are anything but str get converted to str. E.g. >>> result = str_dict_keys({u'name': u'Peter', u'age': 99, 1: 2}) >>> # can't compare whole dicts in doctests >>> result['name'] u'Peter' >>> result['age'] 99 >>> result[1] 2 The reason for this is that in Python <= 2.6.4 doing ``MyClass(**{u'name': u'Peter'})`` would raise a TypeError Note that only unicode types are converted to str types. The reason for that is you might have a class that looks like this:: class Option(object): def __init__(self, foo=None, bar=None, **kwargs): ... And it's being used like this:: Option(**{u'foo':1, u'bar':2, 3:4}) Then you don't want to change that {3:4} part which becomes part of `**kwargs` inside the __init__ method. Using integers as parameter keys is a silly example but the point is that due to the python 2.6.4 bug only unicode keys are converted to str. """ new_dict = {} for key in a_dict: if isinstance(key, unicode): new_dict[str(key)] = a_dict[key] else: new_dict[key] = a_dict[key] return new_dict #------------------------------------------------------------------------------ def io_converter(input_str): """ a conversion function for to select stdout, stderr or open a file for writing""" if type(input_str) is str: input_str_lower = input_str.lower() if input_str_lower == 'stdout': return sys.stdout if input_str_lower == 'stderr': return sys.stderr return open(input_str, "w") return input_str #------------------------------------------------------------------------------ def timedelta_converter(input_str): """a conversion function for time deltas""" if isinstance(input_str, basestring): days, hours, minutes, seconds = 0, 0, 0, 0 details = input_str.split(':') if len(details) >= 4: days = int(details[-4]) if len(details) >= 3: hours = int(details[-3]) if len(details) >= 2: minutes = int(details[-2]) if len(details) >= 1: seconds = int(details[-1]) return datetime.timedelta(days=days, hours=hours, minutes=minutes, seconds=seconds) raise ValueError(input_str) #------------------------------------------------------------------------------ def boolean_converter(input_str): """ a conversion function for boolean """ return input_str.lower() in ("true", "t", "1", "y", "yes") #------------------------------------------------------------------------------ import __builtin__ _all_named_builtins = dir(__builtin__) def class_converter(input_str): """ a conversion that will import a module and class name """ if not input_str: return None if '.' not in input_str and input_str in _all_named_builtins: return eval(input_str) parts = [x.strip() for x in input_str.split('.') if x.strip()] try: # first try as a complete module package = __import__(input_str) except ImportError: # it must be a class from a module if len(parts) == 1: # since it has only one part, it must be a class from __main__ parts = ('__main__', input_str) package = __import__('.'.join(parts[:-1]), globals(), locals(), []) obj = package for name in parts[1:]: obj = getattr(obj, name) return obj #------------------------------------------------------------------------------ def classes_in_namespaces_converter(template_for_namespace="cls%d", name_of_class_option='cls', instantiate_classes=False): """take a comma delimited list of class names, convert each class name into an actual class as an option within a numbered namespace. This function creates a closure over a new function. That new function, in turn creates a class derived from RequiredConfig. The inner function, 'class_list_converter', populates the InnerClassList with a Namespace for each of the classes in the class list. In addition, it puts the each class itself into the subordinate Namespace. The requirement discovery mechanism of configman then reads the InnerClassList's requried config, pulling in the namespaces and associated classes within. For example, if we have a class list like this: "Alpha, Beta", then this converter will add the following Namespaces and options to the configuration: "cls0" - the subordinate Namespace for Alpha "cls0.cls" - the option containing the class Alpha itself "cls1" - the subordinate Namespace for Beta "cls1.cls" - the option containing the class Beta itself Optionally, the 'class_list_converter' inner function can embue the InnerClassList's subordinate namespaces with aggregates that will instantiate classes from the class list. This is a convenience to the programmer who would otherwise have to know ahead of time what the namespace names were so that the classes could be instantiated within the context of the correct namespace. Remember the user could completely change the list of classes at run time, so prediction could be difficult. "cls0" - the subordinate Namespace for Alpha "cls0.cls" - the option containing the class Alpha itself "cls0.cls_instance" - an instance of the class Alpha "cls1" - the subordinate Namespace for Beta "cls1.cls" - the option containing the class Beta itself "cls1.cls_instance" - an instance of the class Beta parameters: template_for_namespace - a template for the names of the namespaces that will contain the classes and their associated required config options. The namespaces will be numbered sequentially. By default, they will be "cls1", "cls2", etc. class_option_name - the name to be used for the class option within the nested namespace. By default, it will choose: "cls1.cls", "cls2.cls", etc. instantiate_classes - a boolean to determine if there should be an aggregator added to each namespace that instantiates each class. If True, then each Namespace will contain elements for the class, as well as an aggregator that will instantiate the class. """ #-------------------------------------------------------------------------- def class_list_converter(class_list_str): """This function becomes the actual converter used by configman to take a string and convert it into the nested sequence of Namespaces, one for each class in the list. It does this by creating a proxy class stuffed with its own 'required_config' that's dynamically generated.""" if isinstance(class_list_str, basestring): class_list = [x.strip() for x in class_list_str.split(',')] else: raise TypeError('must be derivative of a basestring') #====================================================================== class InnerClassList(RequiredConfig): """This nested class is a proxy list for the classes. It collects all the config requirements for the listed classes and places them each into their own Namespace. """ # we're dynamically creating a class here. The following block of # code is actually adding class level attributes to this new class required_config = Namespace() # 1st requirement for configman subordinate_namespace_names = [] # to help the programmer know # what Namespaces we added namespace_template = template_for_namespace # save the template # for future reference class_option_name = name_of_class_option # save the class's option # name for the future # for each class in the class list for namespace_index, a_class in enumerate(class_list): # figure out the Namespace name namespace_name = template_for_namespace % namespace_index subordinate_namespace_names.append(namespace_name) # create the new Namespace required_config[namespace_name] = Namespace() # add the option for the class itself required_config[namespace_name].add_option( name_of_class_option, #doc=a_class.__doc__ # not helpful if too verbose default=a_class, from_string_converter=class_converter ) if instantiate_classes: # add an aggregator to instantiate the class required_config[namespace_name].add_aggregation( "%s_instance" % name_of_class_option, lambda c, lc, a: lc[name_of_class_option](lc)) @classmethod def to_str(cls): """this method takes this inner class object and turns it back into the original string of classnames. This is used primarily as for the output of the 'help' option""" return ', '.join( py_obj_to_str(v[name_of_class_option].value) for v in cls.get_required_config().values() if isinstance(v, Namespace)) return InnerClassList # result of class_list_converter return class_list_converter # result of classes_in_namespaces_converter #------------------------------------------------------------------------------ def regex_converter(input_str): return re.compile(input_str) compiled_regexp_type = type(re.compile(r'x')) #------------------------------------------------------------------------------ from_string_converters = { int: int, float: float, str: str, unicode: unicode, bool: boolean_converter, dict: json.loads, datetime.datetime: datetime_converter, datetime.date: date_converter, datetime.timedelta: timedelta_converter, type: class_converter, types.FunctionType: class_converter, compiled_regexp_type: regex_converter, } #------------------------------------------------------------------------------ def py_obj_to_str(a_thing): if a_thing is None: return '' if inspect.ismodule(a_thing): return a_thing.__name__ if a_thing.__module__ == '__builtin__': return a_thing.__name__ if a_thing.__module__ == "__main__": return a_thing.__name__ if hasattr(a_thing, 'to_str'): return a_thing.to_str() return "%s.%s" % (a_thing.__module__, a_thing.__name__) #------------------------------------------------------------------------------ def list_to_str(a_list): return ', '.join(to_string_converters[type(x)](x) for x in a_list) #------------------------------------------------------------------------------ to_string_converters = { int: str, float: str, str: str, unicode: unicode, list: list_to_str, tuple: list_to_str, bool: lambda x: 'True' if x else 'False', dict: json.dumps, datetime.datetime: datetime_util.datetime_to_ISO_string, datetime.date: datetime_util.date_to_ISO_string, datetime.timedelta: datetime_util.timedelta_to_str, type: py_obj_to_str, types.ModuleType: py_obj_to_str, types.FunctionType: py_obj_to_str, compiled_regexp_type: lambda x: x.pattern, } #------------------------------------------------------------------------------ #converters_requiring_quotes = [eval, eval_to_regex_converter] converters_requiring_quotes = [eval, regex_converter]
AdrianGaudebert/configman
configman/converters.py
Python
bsd-3-clause
15,400
<?php //AJAX Poll System Hack Start - 5:03 PM 3/24/2007 $language['POLL_ID']='الرقم'; $language['LATEST_POLL']='آخر استفتاء'; $language['CAST_VOTE']='قدم صوتي'; $language['FETCHING_RESULTS']='جلب نتائج الاستفتاء الرجاء الانتظار'; $language['POLL_TITLE']='عنوان الاستفتاء'; $language['POLL_TITLE_MISSING']='عنوان الاستفتاء مفقود'; $language['POLLING_SYSTEM']='AJAX نظام استفتاء'; $language['CURRENT_POLLS']='الاستفتاءت الحالية'; $language['POLL_STARTED']='بدات في'; $language['POLL_ENDED']='انتهت في'; $language['POLL_LASTED']='استمرت'; $language['POLL_BY']='قدمها'; $language['POLL_VOTES']='الاصوات'; $language['POLL_STILL_ACTIVE']='فعالة'; $language['POLL_NEW']='جديد'; $language['POLL_START_NEW']='ابدى استفتاء جديد'; $language['POLL_ACTIVE']='فعال'; $language['POLL_ACTIVE_TRUE']='فعالة'; $language['POLL_ACTIVE_FALSE']='معطلة'; $language['POLL_OPTION']='خيار'; $language['POLL_OPTIONS']='خيارات'; $language['POLL_MOVE']='الى الاسفل'; $language['POLL_NEW_OPTIONS']='خيارات اخرى'; $language['POLL_SAVE']='حفظ'; $language['POLL_CANCEL']='الغاء'; $language['POLL_DELETE']='مسح'; $language['POLL_DEL_CONFIRM']='اكبس موافق لمسح الاستفتاء'; $language['POLL_VOTERS']='مصوتين الاستفتاء'; $language['POLL_IP_ADDRESS']='IP عناوين الـ'; $language['POLL_DATE']='اليوم'; $language['POLL_USER']='المستخدم'; $language['POLL_ACCOUNT_DEL']='<i>الحساب الغي</i>'; $language['POLL_BACK']='وراء'; $language['YEAR']='سنة'; $language['MONTH']='شهر'; $language['WEEK']='اسبوع'; $language['DAY']='يوم'; $language['HOUR']='ساعة'; $language['MINUTE']='دقيقة'; $language['SECOND']='ثانية'; $language['YEARS']='سنوات'; $language['MONTHS']='شهور'; $language['WEEKS']='اسابيع'; $language['DAYS']='ايام'; $language['HOURS']='سا عات'; $language['MINUTES']='دقائق'; $language['SECONDS']='ثواني'; //AJAX Poll System Hack Stop ?>
cybyd/cybyd
language/arabic/lang_polls.php
PHP
bsd-3-clause
2,204
package org.mafagafogigante.dungeon.stats; import org.mafagafogigante.dungeon.game.Id; import org.jetbrains.annotations.NotNull; import java.io.Serializable; /** * CauseOfDeath class that defines what kind of death happened and the ID of the related Item or Spell. */ public class CauseOfDeath implements Serializable { private static final CauseOfDeath UNARMED = new CauseOfDeath(TypeOfCauseOfDeath.UNARMED, new Id("UNARMED")); private final TypeOfCauseOfDeath type; private final Id id; /** * Constructs a CauseOfDeath with the specified TypeOfCauseOfDeath and ID. * * @param type a TypeOfCauseOfDeath * @param id an ID */ public CauseOfDeath(@NotNull TypeOfCauseOfDeath type, @NotNull Id id) { this.type = type; this.id = id; } /** * Convenience method that returns a CauseOfDeath that represents an unarmed kill. */ public static CauseOfDeath getUnarmedCauseOfDeath() { return UNARMED; } @Override public boolean equals(Object object) { if (this == object) { return true; } if (object == null || getClass() != object.getClass()) { return false; } CauseOfDeath that = (CauseOfDeath) object; return id.equals(that.id) && type == that.type; } @Override public int hashCode() { int result = type.hashCode(); result = 31 * result + id.hashCode(); return result; } @Override public String toString() { return String.format("%s : %s", type, id); } }
ffurkanhas/dungeon
src/main/java/org/mafagafogigante/dungeon/stats/CauseOfDeath.java
Java
bsd-3-clause
1,483
--- title: Towers of Hanoi id: 5951ed8945deab770972ae56 challengeType: 5 isHidden: false forumTopicId: 302341 --- ## Description <section id='description'> Solve the <a href="https://en.wikipedia.org/wiki/Towers_of_Hanoi" title="wp: Towers_of_Hanoi" target="_blank">Towers of Hanoi</a> problem.</p> Your solution should accept the number of discs as the first parameters, and three string used to identify each of the three stacks of discs, for example <code>towerOfHanoi(4, 'A', 'B', 'C')</code>. The function should return an array of arrays containing the list of moves, source -> destination. For example, the array <code>[['A', 'C'], ['B', 'A']]</code> indicates that the 1st move was to move a disc from stack A to C, and the 2nd move was to move a disc from stack B to A. </p> </section> ## Instructions <section id='instructions'> </section> ## Tests <section id='tests'> ```yml tests: - text: <code>towerOfHanoi</code> should be a function. testString: assert(typeof towerOfHanoi === 'function'); - text: <code>towerOfHanoi(3, ...)</code> should return 7 moves. testString: assert(res3.length === 7); - text: <code>towerOfHanoi(3, 'A', 'B', 'C')</code> should return <code>[['A','B'], ['A','C'], ['B','C'], ['A','B'], ['C','A'], ['C','B'], ['A','B']]</code>. testString: assert.deepEqual(towerOfHanoi(3, 'A', 'B', 'C'), res3Moves); - text: <code>towerOfHanoi(5, "X", "Y", "Z")</code> 10th move should be Y -> X. testString: assert.deepEqual(res5[9], ['Y', 'X']); - text: <code>towerOfHanoi(7, 'A', 'B', 'C')</code> first ten moves should be <code>[['A','B'], ['A','C'], ['B','C'], ['A','B'], ['C','A'], ['C','B'], ['A','B'], ['A','C'], ['B','C'], ['B','A']]</code> testString: assert.deepEqual(towerOfHanoi(7, 'A', 'B', 'C').slice(0, 10), res7First10Moves); ``` </section> ## Challenge Seed <section id='challengeSeed'> <div id='js-seed'> ```js function towerOfHanoi(n, a, b, c) { // Good luck! return [[]]; } ``` </div> ### After Test <div id='js-teardown'> ```js const res3 = towerOfHanoi(3, 'A', 'B', 'C'); const res3Moves = [['A', 'B'], ['A', 'C'], ['B', 'C'], ['A', 'B'], ['C', 'A'], ['C', 'B'], ['A', 'B']]; const res5 = towerOfHanoi(5, 'X', 'Y', 'Z'); const res7First10Moves = [['A', 'B'], ['A', 'C'], ['B', 'C'], ['A', 'B'], ['C', 'A'], ['C', 'B'], ['A', 'B'], ['A', 'C'], ['B', 'C'], ['B', 'A']]; ``` </div> </section> ## Solution <section id='solution'> ```js function towerOfHanoi(n, a, b, c) { const res = []; towerOfHanoiHelper(n, a, c, b, res); return res; } function towerOfHanoiHelper(n, a, b, c, res) { if (n > 0) { towerOfHanoiHelper(n - 1, a, c, b, res); res.push([a, c]); towerOfHanoiHelper(n - 1, b, a, c, res); } } ``` </section>
jonathanihm/freeCodeCamp
curriculum/challenges/english/10-coding-interview-prep/rosetta-code/towers-of-hanoi.english.md
Markdown
bsd-3-clause
2,739
// Benoit 2011-05-16 #include <ros/node_handle.h> #include <ros/subscriber.h> #include <ros/rate.h> #include <eu_nifti_env_msg_ros/RequestForUUIDs.h> #include "NIFTiROSUtil.h" #include "UUIDsManager.h" namespace eu { namespace nifti { namespace ocu { const char* UUIDsManager::TOPIC = "/eoi/RequestForUUIDs"; const u_int UUIDsManager::NUM_REQUESTED(10); UUIDsManager* UUIDsManager::instance = NULL; UUIDsManager* UUIDsManager::getInstance() { if (instance == NULL) { instance = new UUIDsManager(); } return instance; } UUIDsManager::UUIDsManager() : wxThread(wxTHREAD_JOINABLE) , condition(mutexForCondition) , keepManaging(true) { } void UUIDsManager::stopManaging() { //printf("IN UUIDsManager::stopManaging \n"); keepManaging = false; if (instance != NULL) { instance->condition.Signal(); // Will make it go out of the main loop and terminate } //printf("OUT UUIDsManager::stopManaging \n"); } void* UUIDsManager::Entry() { //printf("%s\n", "UUIDsManager::Entry()"); ::ros::ServiceClient client = NIFTiROSUtil::getNodeHandle()->serviceClient<eu_nifti_env_msg_ros::RequestForUUIDs > (TOPIC); eu_nifti_env_msg_ros::RequestForUUIDs srv; srv.request.numRequested = NUM_REQUESTED; mutexForCondition.Lock(); // This must be called before the first wait() while (keepManaging) { //ROS_INFO("In the loop (keepManaging)"); // This is a requirement from wxThread // http://docs.wxwidgets.org/2.8/wx_wxthread.html#wxthreadtestdestroy if (TestDestroy()) break; if (!client.call(srv)) { std::cerr << "Failed to call ROS service \"RequestForUUIDs\"" << std::endl; //return 0; // Removed this on 2012-03-02 so that it would re-check the service every time, since CAST is unstable } else { //ROS_INFO("Got UUIDs"); { wxMutexLocker lock(instance->mutexForQueue); // Adds all new UUIDs to the list for (u_int i = 0; i < srv.response.uuids.size(); i++) { availableUUIDs.push(srv.response.uuids.at(i)); //std::cout << "Added " << srv.response.uuids.at(i) << std::endl; } } } // Waits until more ids are needed (signal will be called on the condition) //ROS_INFO("Before waiting"); condition.Wait(); //ROS_INFO("After waiting"); } return 0; } int UUIDsManager::getUUID() { //ROS_INFO("int UUIDsManager::getUUID()"); int uuid; { wxMutexLocker lock(instance->mutexForQueue); //ROS_INFO("Num left: %i/%i", instance->availableUUIDs.size(), NUM_REQUESTED); //ROS_INFO("Enough? %i", instance->availableUUIDs.size() <= NUM_REQUESTED / 2); assert(instance != NULL); // Requests more id's when the list is half empty if (instance->availableUUIDs.size() <= NUM_REQUESTED / 2) { //ROS_INFO("Will try waking up the thread to request UUIDs"); instance->condition.Signal(); if (instance->availableUUIDs.size() == 0) { throw "No UUID available"; } } uuid = instance->availableUUIDs.front(); instance->availableUUIDs.pop(); } //ROS_INFO("int UUIDsManager::getUUID() returned %i. Num left: %i", uuid, instance->availableUUIDs.size()); return uuid; } } } }
talkingrobots/NIFTi_OCU
nifti_user/ocu/src/UUIDsManager.cpp
C++
bsd-3-clause
4,758
// Copyright (c) 2021 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_RESERVATION_OFFSET_TABLE_H_ #define BASE_ALLOCATOR_PARTITION_ALLOCATOR_RESERVATION_OFFSET_TABLE_H_ #include <cstddef> #include <cstdint> #include <limits> #include <tuple> #include "base/allocator/buildflags.h" #include "base/allocator/partition_allocator/address_pool_manager.h" #include "base/allocator/partition_allocator/partition_address_space.h" #include "base/allocator/partition_allocator/partition_alloc_check.h" #include "base/allocator/partition_allocator/partition_alloc_constants.h" #include "base/compiler_specific.h" #include "build/build_config.h" namespace base { namespace internal { static constexpr uint16_t kOffsetTagNotAllocated = std::numeric_limits<uint16_t>::max(); static constexpr uint16_t kOffsetTagNormalBuckets = std::numeric_limits<uint16_t>::max() - 1; // The main purpose of the reservation offset table is to easily locate the // direct map reservation start address for any given address. There is one // entry in the table for each super page. // // When PartitionAlloc reserves an address region it is always aligned to // super page boundary. However, in 32-bit mode, the size may not be aligned // super-page-aligned, so it may look like this: // |<--------- actual reservation size --------->| // +----------+----------+-----+-----------+-----+ - - - + // |SuperPage0|SuperPage1| ... |SuperPage K|SuperPage K+1| // +----------+----------+-----+-----------+-----+ - - -.+ // |<-X->|<-Y*)->| // // The table entries for reserved super pages say how many pages away from the // reservation the super page is: // +----------+----------+-----+-----------+-------------+ // |Entry for |Entry for | ... |Entry for |Entry for | // |SuperPage0|SuperPage1| |SuperPage K|SuperPage K+1| // +----------+----------+-----+-----------+-------------+ // | 0 | 1 | ... | K | K + 1 | // +----------+----------+-----+-----------+-------------+ // // For an address Z, the reservation start can be found using this formula: // ((Z >> kSuperPageShift) - (the entry for Z)) << kSuperPageShift // // kOffsetTagNotAllocated is a special tag denoting that the super page isn't // allocated by PartitionAlloc and kOffsetTagNormalBuckets denotes that it is // used for a normal-bucket allocation, not for a direct-map allocation. // // *) In 32-bit mode, Y is not used by PartitionAlloc, and cannot be used // until X is unreserved, because PartitionAlloc always uses kSuperPageSize // alignment when reserving address spaces. One can use "GigaCage" to // further determine which part of the supe page is used by PartitionAlloc. // This isn't a problem in 64-bit mode, where allocation granularity is // kSuperPageSize. class BASE_EXPORT ReservationOffsetTable { public: #if defined(PA_HAS_64_BITS_POINTERS) // There is one reservation offset table per Pool in 64-bit mode. static constexpr size_t kReservationOffsetTableCoverage = kPoolMaxSize; static constexpr size_t kReservationOffsetTableLength = kReservationOffsetTableCoverage >> kSuperPageShift; #else // The size of the reservation offset table should cover the entire 32-bit // address space, one element per super page. static constexpr uint64_t kGiB = 1024 * 1024 * 1024ull; static constexpr size_t kReservationOffsetTableLength = 4 * kGiB / kSuperPageSize; #endif static_assert(kReservationOffsetTableLength < kOffsetTagNormalBuckets, "Offsets should be smaller than kOffsetTagNormalBuckets."); static struct _ReservationOffsetTable { // The number of table elements is less than MAX_UINT16, so the element type // can be uint16_t. static_assert( kReservationOffsetTableLength <= std::numeric_limits<uint16_t>::max(), "Length of the reservation offset table must be less than MAX_UINT16"); uint16_t offsets[kReservationOffsetTableLength] = {}; constexpr _ReservationOffsetTable() { for (uint16_t& offset : offsets) offset = kOffsetTagNotAllocated; } #if defined(PA_HAS_64_BITS_POINTERS) // One table per Pool. } reservation_offset_tables_[kNumPools]; #else // A single table for the entire 32-bit address space. } reservation_offset_table_; #endif }; #if defined(PA_HAS_64_BITS_POINTERS) ALWAYS_INLINE uint16_t* GetReservationOffsetTable(pool_handle handle) { PA_DCHECK(0 < handle && handle <= kNumPools); return ReservationOffsetTable::reservation_offset_tables_[handle - 1].offsets; } ALWAYS_INLINE const uint16_t* GetReservationOffsetTableEnd(pool_handle handle) { return GetReservationOffsetTable(handle) + ReservationOffsetTable::kReservationOffsetTableLength; } ALWAYS_INLINE uint16_t* GetReservationOffsetTable(uintptr_t address) { pool_handle handle = GetPool(address); return GetReservationOffsetTable(handle); } ALWAYS_INLINE const uint16_t* GetReservationOffsetTableEnd(uintptr_t address) { pool_handle handle = GetPool(address); return GetReservationOffsetTableEnd(handle); } ALWAYS_INLINE uint16_t* ReservationOffsetPointer(pool_handle pool, uintptr_t offset_in_pool) { size_t table_index = offset_in_pool >> kSuperPageShift; PA_DCHECK(table_index < ReservationOffsetTable::kReservationOffsetTableLength); return GetReservationOffsetTable(pool) + table_index; } #else ALWAYS_INLINE uint16_t* GetReservationOffsetTable(uintptr_t address) { return ReservationOffsetTable::reservation_offset_table_.offsets; } ALWAYS_INLINE const uint16_t* GetReservationOffsetTableEnd(uintptr_t address) { return ReservationOffsetTable::reservation_offset_table_.offsets + ReservationOffsetTable::kReservationOffsetTableLength; } #endif ALWAYS_INLINE uint16_t* ReservationOffsetPointer(uintptr_t address) { #if defined(PA_HAS_64_BITS_POINTERS) // In 64-bit mode, find the owning Pool and compute the offset from its base. pool_handle pool; address = memory::UnmaskPtr(address); uintptr_t offset; std::tie(pool, offset) = GetPoolAndOffset(address); return ReservationOffsetPointer(pool, offset); #else size_t table_index = address >> kSuperPageShift; PA_DCHECK(table_index < ReservationOffsetTable::kReservationOffsetTableLength); return GetReservationOffsetTable(address) + table_index; #endif } ALWAYS_INLINE uintptr_t ComputeReservationStart(uintptr_t address, uint16_t* offset_ptr) { return (address & kSuperPageBaseMask) - (static_cast<size_t>(*offset_ptr) << kSuperPageShift); } // If the given address doesn't point to direct-map allocated memory, // returns 0. ALWAYS_INLINE uintptr_t GetDirectMapReservationStart(uintptr_t address) { #if DCHECK_IS_ON() bool is_in_brp_pool = IsManagedByPartitionAllocBRPPool(address); bool is_in_regular_pool = IsManagedByPartitionAllocRegularPool(address); // When USE_BACKUP_REF_PTR is off, BRP pool isn't used. #if !BUILDFLAG(USE_BACKUP_REF_PTR) PA_DCHECK(!is_in_brp_pool); #endif #endif // DCHECK_IS_ON() uint16_t* offset_ptr = ReservationOffsetPointer(address); PA_DCHECK(*offset_ptr != kOffsetTagNotAllocated); if (*offset_ptr == kOffsetTagNormalBuckets) return 0; uintptr_t reservation_start = ComputeReservationStart(address, offset_ptr); #if DCHECK_IS_ON() // Make sure the reservation start is in the same pool as |address|. // In the 32-bit mode, the beginning of a reservation may be excluded from the // BRP pool, so shift the pointer. The other pools don't have this logic. PA_DCHECK(is_in_brp_pool == IsManagedByPartitionAllocBRPPool( reservation_start #if !defined(PA_HAS_64_BITS_POINTERS) + AddressPoolManagerBitmap::kBytesPer1BitOfBRPPoolBitmap * AddressPoolManagerBitmap::kGuardOffsetOfBRPPoolBitmap #endif // !defined(PA_HAS_64_BITS_POINTERS) )); PA_DCHECK(is_in_regular_pool == IsManagedByPartitionAllocRegularPool(reservation_start)); PA_DCHECK(*ReservationOffsetPointer(reservation_start) == 0); #endif // DCHECK_IS_ON() return reservation_start; } #if defined(PA_HAS_64_BITS_POINTERS) // If the given address doesn't point to direct-map allocated memory, // returns 0. // This variant has better performance than the regular one on 64-bit builds if // the Pool that an allocation belongs to is known. ALWAYS_INLINE uintptr_t GetDirectMapReservationStart(uintptr_t address, pool_handle pool, uintptr_t offset_in_pool) { PA_DCHECK(AddressPoolManager::GetInstance()->GetPoolBaseAddress(pool) + offset_in_pool == address); uint16_t* offset_ptr = ReservationOffsetPointer(pool, offset_in_pool); PA_DCHECK(*offset_ptr != kOffsetTagNotAllocated); if (*offset_ptr == kOffsetTagNormalBuckets) return 0; uintptr_t reservation_start = ComputeReservationStart(address, offset_ptr); PA_DCHECK(*ReservationOffsetPointer(reservation_start) == 0); return reservation_start; } #endif // defined(PA_HAS_64_BITS_POINTERS) // Returns true if |address| is the beginning of the first super page of a // reservation, i.e. either a normal bucket super page, or the first super page // of direct map. // |address| must belong to an allocated super page. ALWAYS_INLINE bool IsReservationStart(uintptr_t address) { uint16_t* offset_ptr = ReservationOffsetPointer(address); PA_DCHECK(*offset_ptr != kOffsetTagNotAllocated); return ((*offset_ptr == kOffsetTagNormalBuckets) || (*offset_ptr == 0)) && (address % kSuperPageSize == 0); } // Returns true if |address| belongs to a normal bucket super page. ALWAYS_INLINE bool IsManagedByNormalBuckets(uintptr_t address) { uint16_t* offset_ptr = ReservationOffsetPointer(address); return *offset_ptr == kOffsetTagNormalBuckets; } // Returns true if |address| belongs to a direct map region. ALWAYS_INLINE bool IsManagedByDirectMap(uintptr_t address) { uint16_t* offset_ptr = ReservationOffsetPointer(address); return *offset_ptr != kOffsetTagNormalBuckets && *offset_ptr != kOffsetTagNotAllocated; } // Returns true if |address| belongs to a normal bucket super page or a direct // map region, i.e. belongs to an allocated super page. ALWAYS_INLINE bool IsManagedByNormalBucketsOrDirectMap(uintptr_t address) { uint16_t* offset_ptr = ReservationOffsetPointer(address); return *offset_ptr != kOffsetTagNotAllocated; } } // namespace internal } // namespace base #endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_RESERVATION_OFFSET_TABLE_H_
ric2b/Vivaldi-browser
chromium/base/allocator/partition_allocator/reservation_offset_table.h
C
bsd-3-clause
10,872
package net.jloop.rejoice; import net.jloop.rejoice.types.Symbol; import net.jloop.rejoice.types.Type; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class MacroHelper { public static List<Value> collect(Env env, Iterator<Value> input, Symbol terminator) { List<Value> output = new ArrayList<>(); while (true) { if (!input.hasNext()) { throw new RuntimeError("MACRO", "Input stream ended before finding the terminating symbol '" + terminator.print() + "'"); } Value next = input.next(); if (next instanceof Symbol) { if (next.equals(terminator)) { return output; } Function function = env.lookup((Symbol) next); if (function instanceof Macro) { env.trace().push((Symbol) next); Iterator<Value> values = ((Macro) function).call(env, input); while (values.hasNext()) { output.add(values.next()); } env.trace().pop(); } else { output.add(next); } } else { output.add(next); } } } @SuppressWarnings("unchecked") public static <T extends Value> T match(Iterator<Value> input, Type type) { if (!input.hasNext()) { throw new RuntimeError("MACRO", "Unexpected EOF when attempting to match " + type.print()); } Value next = input.next(); if (type == next.type()) { return (T) next; } else { throw new RuntimeError("MACRO", "Expecting to match " + type.print() + ", but found " + next.type().print() + " with value '" + next.print() + "'"); } } public static void match(Iterator<Value> input, Symbol symbol) { if (!input.hasNext()) { throw new RuntimeError("MACRO", "Unexpected EOF when attempting to match ^symbol '" + symbol.print() + "'"); } Value next = input.next(); if (!next.equals(symbol)) { throw new RuntimeError("MACRO", "Expecting to match symbol '" + symbol.print() + "' , but found " + next.type().print() + " with value '" + next.print() + "'"); } } }
jeremyheiler/rejoice
src/main/java/net/jloop/rejoice/MacroHelper.java
Java
bsd-3-clause
2,365
import React from "react"; import { Text, View } from "react-native"; import { defaultProps, propTypes } from "./caption-prop-types"; import styles from "./styles"; const renderCredits = (style, credits) => { if (!credits || credits === "") { return null; } return ( <Text style={[styles.text, styles.credits, style.text, style.credits]}> {credits.toUpperCase()} </Text> ); }; const renderText = (style, text) => { if (!text || text === "") { return null; } return <Text style={[styles.text, style.text, style.caption]}>{text}</Text>; }; const Caption = ({ children, credits, style, text }) => ( <View> {children} <View style={[styles.container, style.container]}> {renderText(style, text)} {renderCredits(style, credits)} </View> </View> ); Caption.propTypes = propTypes; Caption.defaultProps = defaultProps; export default Caption; export { default as CentredCaption } from "./centred-caption";
newsuk/times-components
packages/caption/src/caption.js
JavaScript
bsd-3-clause
967
# clojure-stemmer A Clojure version of the [porter stemming](http://tartarus.org/martin/PorterStemmer/). Use the ruby version [here](https://github.com/raypereda/stemmify/blob/master/lib/stemmify.rb) to do the contrast test. This is an open source program, you can copy it, modified it or redistribute it, but must comply with the new BSD licence. ## Usage With leiningen, you should add the following in you `project.clj`: ```clojure [clojure-stemmer "0.1.0"] ``` With maven, you should add the following configuration to you `pom.xml`: ```xml <dependency> <groupId>clojure-stemmer</groupId> <artifactId>clojure-stemmer</artifactId> <version>0.1.0</version> </dependency> ``` After you start the clojure repl with command `lein repl`, you can do as following to use it: ```clojure user=> (use '[clojure-stemmer.porter.stemmer]) nil user=> (stemming "chinese") "chines" user=> (stemming "feeds") "feed" user=> (stemming "reeds") "reed" user=> (stemming "saying") "sai" ``` You can also run the all test, if you use the lein to manager clojure project, just by typing `lein test` under the project root directory. Running result is something like : ```shell ➜ clojure-stemmer git:(master) ✗ lein test lein test clojure-stemmer.core-test Ran 10000 tests containing 10000 assertions. 0 failures, 0 errors. ➜ clojure-stemmer git:(master) ✗ ``` The code was tested under Clojure version 1.4.0 and 1.5.1 and 1.6.0. ## License Copyright © 2013-2015 m00nlight Distributed under the new BSD License.
m00nlight/clojure-stemmer
README.md
Markdown
bsd-3-clause
1,529
<h1>Header</h1> <p>Now, let's try something <em>inline</em>, to see if it works</p> <p>Blah blah blah <a href="http://www.slashdot.org">http://www.slashdot.org</a></p> <ul> <li>Basic list</li> <li>Basic list 2</li> </ul> <p>addss</p> <ul> <li>Lazy list</li> </ul> <p>An <a href="http://example.com" title="Title">example</a> (oops)</p> <p>Now, let's use a footnote[^1]. Not bad, eh? Let's continue.</p> <p>[^1]: Here is the text of the footnote continued on several lines. some more of the footnote, etc.</p> <pre><code>Actually, another paragraph too. </code></pre> <p>And then there is a little bit of text.</p>
zestedesavoir/Python-ZMarkdown
tests/misc/multi-test.html
HTML
bsd-3-clause
622
<?php /** * @link http://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license http://www.yiiframework.com/license/ */ namespace yii\db; /** * SchemaBuilderTrait contains shortcut methods to create instances of [[ColumnSchemaBuilder]]. * * These can be used in database migrations to define database schema types using a PHP interface. * This is useful to define a schema in a DBMS independent way so that the application may run on * different DBMS the same way. * * For example you may use the following code inside your migration files: * * ```php * $this->createTable('example_table', [ * 'id' => $this->primaryKey(), * 'name' => $this->string(64)->notNull(), * 'type' => $this->integer()->notNull()->defaultValue(10), * 'description' => $this->text(), * 'rule_name' => $this->string(64), * 'data' => $this->text(), * 'CreatedDateTime' => $this->datetime()->notNull(), * 'LastModifiedDateTime' => $this->datetime(), * ]); * ``` * * @author Vasenin Matvey <[email protected]> * @since 2.0.6 */ trait SchemaBuilderTrait { /** * @return Connection the database connection to be used for schema building. */ protected abstract function getDb(); /** * Creates a primary key column. * @param integer $length column size or precision definition. * This parameter will be ignored if not supported by the DBMS. * @return ColumnSchemaBuilder the column instance which can be further customized. * @since 2.0.6 */ public function primaryKey($length = null) { return $this->getDb()->getSchema()->createColumnSchemaBuilder(Schema::TYPE_PK, $length); } /** * Creates a big primary key column. * @param integer $length column size or precision definition. * This parameter will be ignored if not supported by the DBMS. * @return ColumnSchemaBuilder the column instance which can be further customized. * @since 2.0.6 */ public function bigPrimaryKey($length = null) { return $this->getDb()->getSchema()->createColumnSchemaBuilder(Schema::TYPE_BIGPK, $length); } /** * Creates a char column. * @param integer $length column size definition i.e. the maximum string length. * This parameter will be ignored if not supported by the DBMS. * @return ColumnSchemaBuilder the column instance which can be further customized. * @since 2.0.8 */ public function char($length = null) { return $this->getDb()->getSchema()->createColumnSchemaBuilder(Schema::TYPE_CHAR, $length); } /** * Creates a string column. * @param integer $length column size definition i.e. the maximum string length. * This parameter will be ignored if not supported by the DBMS. * @return ColumnSchemaBuilder the column instance which can be further customized. * @since 2.0.6 */ public function string($length = null) { return $this->getDb()->getSchema()->createColumnSchemaBuilder(Schema::TYPE_STRING, $length); } /** * Creates a text column. * @return ColumnSchemaBuilder the column instance which can be further customized. * @since 2.0.6 */ public function text() { return $this->getDb()->getSchema()->createColumnSchemaBuilder(Schema::TYPE_TEXT); } /** * Creates a smallint column. * @param integer $length column size or precision definition. * This parameter will be ignored if not supported by the DBMS. * @return ColumnSchemaBuilder the column instance which can be further customized. * @since 2.0.6 */ public function smallInteger($length = null) { return $this->getDb()->getSchema()->createColumnSchemaBuilder(Schema::TYPE_SMALLINT, $length); } /** * Creates an integer column. * @param integer $length column size or precision definition. * This parameter will be ignored if not supported by the DBMS. * @return ColumnSchemaBuilder the column instance which can be further customized. * @since 2.0.6 */ public function integer($length = null) { return $this->getDb()->getSchema()->createColumnSchemaBuilder(Schema::TYPE_INTEGER, $length); } /** * Creates a bigint column. * @param integer $length column size or precision definition. * This parameter will be ignored if not supported by the DBMS. * @return ColumnSchemaBuilder the column instance which can be further customized. * @since 2.0.6 */ public function bigInteger($length = null) { return $this->getDb()->getSchema()->createColumnSchemaBuilder(Schema::TYPE_BIGINT, $length); } /** * Creates a float column. * @param integer $precision column value precision. First parameter passed to the column type, e.g. FLOAT(precision). * This parameter will be ignored if not supported by the DBMS. * @return ColumnSchemaBuilder the column instance which can be further customized. * @since 2.0.6 */ public function float($precision = null) { return $this->getDb()->getSchema()->createColumnSchemaBuilder(Schema::TYPE_FLOAT, $precision); } /** * Creates a double column. * @param integer $precision column value precision. First parameter passed to the column type, e.g. DOUBLE(precision). * This parameter will be ignored if not supported by the DBMS. * @return ColumnSchemaBuilder the column instance which can be further customized. * @since 2.0.6 */ public function double($precision = null) { return $this->getDb()->getSchema()->createColumnSchemaBuilder(Schema::TYPE_DOUBLE, $precision); } /** * Creates a decimal column. * @param integer $precision column value precision, which is usually the total number of digits. * First parameter passed to the column type, e.g. DECIMAL(precision, scale). * This parameter will be ignored if not supported by the DBMS. * @param integer $scale column value scale, which is usually the number of digits after the decimal point. * Second parameter passed to the column type, e.g. DECIMAL(precision, scale). * This parameter will be ignored if not supported by the DBMS. * @return ColumnSchemaBuilder the column instance which can be further customized. * @since 2.0.6 */ public function decimal($precision = null, $scale = null) { $length = []; if ($precision !== null) { $length[] = $precision; } if ($scale !== null) { $length[] = $scale; } return $this->getDb()->getSchema()->createColumnSchemaBuilder(Schema::TYPE_DECIMAL, $length); } /** * Creates a datetime column. * @param integer $precision column value precision. First parameter passed to the column type, e.g. DATETIME(precision). * This parameter will be ignored if not supported by the DBMS. * @return ColumnSchemaBuilder the column instance which can be further customized. * @since 2.0.6 */ public function dateTime($precision = null) { return $this->getDb()->getSchema()->createColumnSchemaBuilder(Schema::TYPE_DATETIME, $precision); } /** * Creates a timestamp column. * @param integer $precision column value precision. First parameter passed to the column type, e.g. TIMESTAMP(precision). * This parameter will be ignored if not supported by the DBMS. * @return ColumnSchemaBuilder the column instance which can be further customized. * @since 2.0.6 */ public function timestamp($precision = null) { return $this->getDb()->getSchema()->createColumnSchemaBuilder(Schema::TYPE_TIMESTAMP, $precision); } /** * Creates a time column. * @param integer $precision column value precision. First parameter passed to the column type, e.g. TIME(precision). * This parameter will be ignored if not supported by the DBMS. * @return ColumnSchemaBuilder the column instance which can be further customized. * @since 2.0.6 */ public function time($precision = null) { return $this->getDb()->getSchema()->createColumnSchemaBuilder(Schema::TYPE_TIME, $precision); } /** * Creates a date column. * @return ColumnSchemaBuilder the column instance which can be further customized. * @since 2.0.6 */ public function date() { return $this->getDb()->getSchema()->createColumnSchemaBuilder(Schema::TYPE_DATE); } /** * Creates a binary column. * @param integer $length column size or precision definition. * This parameter will be ignored if not supported by the DBMS. * @return ColumnSchemaBuilder the column instance which can be further customized. * @since 2.0.6 */ public function binary($length = null) { return $this->getDb()->getSchema()->createColumnSchemaBuilder(Schema::TYPE_BINARY, $length); } /** * Creates a boolean column. * @return ColumnSchemaBuilder the column instance which can be further customized. * @since 2.0.6 */ public function boolean() { return $this->getDb()->getSchema()->createColumnSchemaBuilder(Schema::TYPE_BOOLEAN); } /** * Creates a money column. * @param integer $precision column value precision, which is usually the total number of digits. * First parameter passed to the column type, e.g. DECIMAL(precision, scale). * This parameter will be ignored if not supported by the DBMS. * @param integer $scale column value scale, which is usually the number of digits after the decimal point. * Second parameter passed to the column type, e.g. DECIMAL(precision, scale). * This parameter will be ignored if not supported by the DBMS. * @return ColumnSchemaBuilder the column instance which can be further customized. * @since 2.0.6 */ public function money($precision = null, $scale = null) { $length = []; if ($precision !== null) { $length[] = $precision; } if ($scale !== null) { $length[] = $scale; } return $this->getDb()->getSchema()->createColumnSchemaBuilder(Schema::TYPE_MONEY, $length); } }
microdisk/customre_website
vendor/yiisoft/yii2/db/SchemaBuilderTrait.php
PHP
bsd-3-clause
10,360
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <title>Document Info and Metadata - Zend Framework Manual</title> </head> <body> <table width="100%"> <tr valign="top"> <td width="85%"> <table width="100%"> <tr> <td width="25%" style="text-align: left;"> <a href="zend.pdf.interactive-features.html">Interactive Features</a> </td> <td width="50%" style="text-align: center;"> <div class="up"><span class="up"><a href="zend.pdf.html">Zend_Pdf</a></span><br /> <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div> </td> <td width="25%" style="text-align: right;"> <div class="next" style="text-align: right; float: right;"><a href="zend.pdf.usage.html">Zend_Pdf module usage example</a></div> </td> </tr> </table> <hr /> <div id="zend.pdf.info" class="section"><div class="info"><h1 class="title">Document Info and Metadata</h1></div> <p class="para"> A <acronym class="acronym">PDF</acronym> document may include general information such as the document&#039;s title, author, and creation and modification dates. </p> <p class="para"> Historically this information is stored using special Info structure. This structure is available for read and writing as an associative array using <span class="property">properties</span> public property of <span class="classname">Zend_Pdf</span> objects: </p> <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$pdf</span> = Zend_Pdf::<span style="color: #006600;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pdfPath</span><span style="color: #66cc66;">&#41;</span>;</div></li> <li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li> <li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #0000ff;">$pdf</span>-&gt;<span style="color: #006600;">properties</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'Title'</span><span style="color: #66cc66;">&#93;</span> . <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;</div></li> <li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #0000ff;">$pdf</span>-&gt;<span style="color: #006600;">properties</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'Author'</span><span style="color: #66cc66;">&#93;</span> . <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;</div></li> <li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li> <li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$pdf</span>-&gt;<span style="color: #006600;">properties</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'Title'</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #ff0000;">'New Title.'</span>;</div></li> <li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$pdf</span>-&gt;<span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pdfPath</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></div></div></div> <p class="para"> The following keys are defined by <acronym class="acronym">PDF</acronym> v1.4 (Acrobat 5) standard: <ul class="itemizedlist"> <li class="listitem"> <p class="para"> <em class="emphasis">Title</em> - string, optional, the document&#039;s title. </p> </li> <li class="listitem"> <p class="para"> <em class="emphasis">Author</em> - string, optional, the name of the person who created the document. </p> </li> <li class="listitem"> <p class="para"> <em class="emphasis">Subject</em> - string, optional, the subject of the document. </p> </li> <li class="listitem"> <p class="para"> <em class="emphasis">Keywords</em> - string, optional, keywords associated with the document. </p> </li> <li class="listitem"> <p class="para"> <em class="emphasis">Creator</em> - string, optional, if the document was converted to <acronym class="acronym">PDF</acronym> from another format, the name of the application (for example, Adobe FrameMaker®) that created the original document from which it was converted. </p> </li> <li class="listitem"> <p class="para"> <em class="emphasis">Producer</em> - string, optional, if the document was converted to <acronym class="acronym">PDF</acronym> from another format, the name of the application (for example, Acrobat Distiller) that converted it to <acronym class="acronym">PDF</acronym>.. </p> </li> <li class="listitem"> <p class="para"> <em class="emphasis">CreationDate</em> - string, optional, the date and time the document was created, in the following form: &quot;D:YYYYMMDDHHmmSSOHH&#039;mm&#039;&quot;, where: <ul class="itemizedlist"> <li class="listitem"> <p class="para"> <em class="emphasis">YYYY</em> is the year. </p> </li> <li class="listitem"> <p class="para"> <em class="emphasis">MM</em> is the month. </p> </li> <li class="listitem"> <p class="para"> <em class="emphasis">DD</em> is the day (01–31). </p> </li> <li class="listitem"> <p class="para"> <em class="emphasis">HH</em> is the hour (00–23). </p> </li> <li class="listitem"> <p class="para"> <em class="emphasis">mm</em>is the minute (00–59). </p> </li> <li class="listitem"> <p class="para"> <em class="emphasis">SS</em> is the second (00–59). </p> </li> <li class="listitem"> <p class="para"> <em class="emphasis">O</em> is the relationship of local time to Universal Time (UT), denoted by one of the characters +, −, or Z (see below). </p> </li> <li class="listitem"> <p class="para"> <em class="emphasis">HH</em> followed by &#039; is the absolute value of the offset from UT in hours (00–23). </p> </li> <li class="listitem"> <p class="para"> <em class="emphasis">mm</em> followed by &#039; is the absolute value of the offset from UT in minutes (00–59). </p> </li> </ul> The apostrophe character (&#039;) after HH and mm is part of the syntax. All fields after the year are optional. (The prefix D:, although also optional, is strongly recommended.) The default values for MM and DD are both 01; all other numerical fields default to zero values. A plus sign (+) as the value of the O field signifies that local time is later than UT, a minus sign (−) that local time is earlier than UT, and the letter Z that local time is equal to UT. If no UT information is specified, the relationship of the specified time to UT is considered to be unknown. Whether or not the time zone is known, the rest of the date should be specified in local time. </p> <p class="para"> For example, December 23, 1998, at 7:52 PM, U.S. Pacific Standard Time, is represented by the string &quot;D:199812231952−08&#039;00&#039;&quot;. </p> </li> <li class="listitem"> <p class="para"> <em class="emphasis">ModDate</em> - string, optional, the date and time the document was most recently modified, in the same form as <em class="emphasis">CreationDate</em>. </p> </li> <li class="listitem"> <p class="para"> <em class="emphasis">Trapped</em> - boolean, optional, indicates whether the document has been modified to include trapping information. <ul class="itemizedlist"> <li class="listitem"> <p class="para"> <em class="emphasis"><b><tt>TRUE</tt></b></em> - The document has been fully trapped; no further trapping is needed. </p> </li> <li class="listitem"> <p class="para"> <em class="emphasis"><b><tt>FALSE</tt></b></em> - The document has not yet been trapped; any desired trapping must still be done. </p> </li> <li class="listitem"> <p class="para"> <em class="emphasis"><b><tt>NULL</tt></b></em> - Either it is unknown whether the document has been trapped or it has been partly but not yet fully trapped; some additional trapping may still be needed. </p> </li> </ul> </p> </li> </ul> </p> <p class="para"> Since <acronym class="acronym">PDF</acronym> v 1.6 metadata can be stored in the special <acronym class="acronym">XML</acronym> document attached to the <acronym class="acronym">PDF</acronym> (XMP - <a href="http://www.adobe.com/products/xmp/" class="link external">&raquo; Extensible Metadata Platform</a>). </p> <p class="para"> This <acronym class="acronym">XML</acronym> document can be retrieved and attached to the PDF with <span class="methodname">Zend_Pdf::getMetadata()</span> and <span class="methodname">Zend_Pdf::setMetadata($metadata)</span> methods: </p> <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$pdf</span> = Zend_Pdf::<span style="color: #006600;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pdfPath</span><span style="color: #66cc66;">&#41;</span>;</div></li> <li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$metadata</span> = <span style="color: #0000ff;">$pdf</span>-&gt;<span style="color: #006600;">getMetadata</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li> <li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$metadataDOM</span> = <span style="color: #000000; font-weight: bold;">new</span> DOMDocument<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li> <li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$metadataDOM</span>-&gt;<span style="color: #006600;">loadXML</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$metadata</span><span style="color: #66cc66;">&#41;</span>;</div></li> <li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li> <li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$xpath</span> = <span style="color: #000000; font-weight: bold;">new</span> DOMXPath<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$metadataDOM</span><span style="color: #66cc66;">&#41;</span>;</div></li> <li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$pdfPreffixNamespaceURI</span> = <span style="color: #0000ff;">$xpath</span>-&gt;<span style="color: #006600;">query</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'/rdf:RDF/rdf:Description'</span><span style="color: #66cc66;">&#41;</span></div></li> <li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&gt;<span style="color: #006600;">item</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span></div></li> <li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&gt;<span style="color: #006600;">lookupNamespaceURI</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'pdf'</span><span style="color: #66cc66;">&#41;</span>;</div></li> <li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$xpath</span>-&gt;<span style="color: #006600;">registerNamespace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'pdf'</span>, <span style="color: #0000ff;">$pdfPreffixNamespaceURI</span><span style="color: #66cc66;">&#41;</span>;</div></li> <li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li> <li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$titleNode</span> = <span style="color: #0000ff;">$xpath</span>-&gt;<span style="color: #006600;">query</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'/rdf:RDF/rdf:Description/pdf:Title'</span><span style="color: #66cc66;">&#41;</span>-&gt;<span style="color: #006600;">item</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;</div></li> <li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$title</span> = <span style="color: #0000ff;">$titleNode</span>-&gt;<span style="color: #006600;">nodeValue</span>;</div></li> <li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">...</div></li> <li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li> <li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$titleNode</span>-&gt;<span style="color: #006600;">nodeValue</span> = <span style="color: #ff0000;">'New title'</span>;</div></li> <li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$pdf</span>-&gt;<span style="color: #006600;">setMetadata</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$metadataDOM</span>-&gt;<span style="color: #006600;">saveXML</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div></li> <li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$pdf</span>-&gt;<span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pdfPath</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></div></div></div> <p class="para"> Common document properties are duplicated in the Info structure and Metadata document (if presented). It&#039;s user application responsibility now to keep them synchronized. </p> </div> <hr /> <table width="100%"> <tr> <td width="25%" style="text-align: left;"> <a href="zend.pdf.interactive-features.html">Interactive Features</a> </td> <td width="50%" style="text-align: center;"> <div class="up"><span class="up"><a href="zend.pdf.html">Zend_Pdf</a></span><br /> <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div> </td> <td width="25%" style="text-align: right;"> <div class="next" style="text-align: right; float: right;"><a href="zend.pdf.usage.html">Zend_Pdf module usage example</a></div> </td> </tr> </table> </td> <td style="font-size: smaller;" width="15%"> <style type="text/css"> #leftbar { float: left; width: 186px; padding: 5px; font-size: smaller; } ul.toc { margin: 0px 5px 5px 5px; padding: 0px; } ul.toc li { font-size: 85%; margin: 1px 0 1px 1px; padding: 1px 0 1px 11px; list-style-type: none; background-repeat: no-repeat; background-position: center left; } ul.toc li.header { font-size: 115%; padding: 5px 0px 5px 11px; border-bottom: 1px solid #cccccc; margin-bottom: 5px; } ul.toc li.active { font-weight: bold; } ul.toc li a { text-decoration: none; } ul.toc li a:hover { text-decoration: underline; } </style> <ul class="toc"> <li class="header home"><a href="manual.html">Programmer's Reference Guide</a></li> <li class="header up"><a href="manual.html">Programmer's Reference Guide</a></li> <li class="header up"><a href="reference.html">Zend Framework Reference</a></li> <li class="header up"><a href="zend.pdf.html">Zend_Pdf</a></li> <li><a href="zend.pdf.introduction.html">简介</a></li> <li><a href="zend.pdf.create.html">生成和加载 PDF 文档</a></li> <li><a href="zend.pdf.save.html">保存修改到 PDF 文档</a></li> <li><a href="zend.pdf.pages.html">文档页面</a></li> <li><a href="zend.pdf.drawing.html">Drawing</a></li> <li><a href="zend.pdf.interactive-features.html">Interactive Features</a></li> <li class="active"><a href="zend.pdf.info.html">Document Info and Metadata</a></li> <li><a href="zend.pdf.usage.html">Zend_Pdf module usage example</a></li> </ul> </td> </tr> </table> </body> </html>
wukchung/Home-development
documentation/manual/core/zh/zend.pdf.info.html
HTML
bsd-3-clause
23,777
import Control.Monad (when) import Distribution.Simple import System.Directory (doesFileExist) import System.Process (readProcess) import Data.ByteString.Char8 as BS gitVersion :: IO () gitVersion = do let filename = "app/Internal/Version.hs" versionSh = "./version.sh" hasVersionSh <- doesFileExist versionSh when hasVersionSh $ do ver <- fmap BS.pack $ readProcess "bash" [versionSh] "" let override = BS.writeFile filename ver e <- doesFileExist filename if e then do orig_ver <- BS.readFile filename when (ver /= orig_ver) $ do override else override main :: IO () main = gitVersion >> defaultMain
da-x/fancydiff
Setup.hs
Haskell
bsd-3-clause
780
module Vector where data Vec = V !Int !Int deriving (Show, Eq) instance Num Vec where V x1 y1 + V x2 y2 = V (x1+x2) (y1+y2) V x1 y1 - V x2 y2 = V (x1-x2) (y1-y2) V x1 y1 * V x2 y2 = V (x1*x2) (y1*y2) abs (V x y) = V (abs x) (abs y) signum (V x y) = V (signum x) (signum y) fromInteger x = V (fromInteger x) (fromInteger x)
cobbpg/dow
src/Vector.hs
Haskell
bsd-3-clause
337
### # Copyright (c) 2005, Jeremiah Fincher # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions, and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright notice, # this list of conditions, and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the name of the author of this software nor the name of # contributors to this software may be used to endorse or promote products # derived from this software without specific prior written consent. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. ### from supybot.test import * class MyChannelLoggerTestCase(PluginTestCase): plugins = ('MyChannelLogger',) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
octete/octete-supybot-plugins
MyChannelLogger/test.py
Python
bsd-3-clause
1,757
/** * Copyright (c) 2019, Łukasz Marcin Podkalicki <[email protected]> * ESP8266/005 * Blinky example using pure ESP8266 Non-OS SDK. */ #include "ets_sys.h" #include "osapi.h" #include "gpio.h" #include "os_type.h" #include "user_config.h" #define LED_PIN (2) static volatile os_timer_t blinky_timer; static void blinky_timer_handler(void *prv); void ICACHE_FLASH_ATTR user_init() { uint8_t value = 0; /* setup */ gpio_init(); // init gpio subsytem gpio_output_set(0, 0, (1 << LED_PIN), 0); // set LED pin as output with low state uart_div_modify(0, UART_CLK_FREQ / 115200); // set UART baudrate os_printf("\n\nSDK version:%s\n\n", system_get_sdk_version()); /* start timer (500ms) */ os_timer_setfn(&blinky_timer, (os_timer_func_t *)blinky_timer_handler, NULL); os_timer_arm(&blinky_timer, 500, 1); } void blinky_timer_handler(void *prv) { if (GPIO_REG_READ(GPIO_OUT_ADDRESS) & (1 << LED_PIN)) { gpio_output_set(0, (1 << LED_PIN), 0, 0); // LED off } else { gpio_output_set((1 << LED_PIN), 0, 0, 0); // LED on } }
lpodkalicki/blog
esp8266/005_nonos_sdk_blinky/user/main.c
C
bsd-3-clause
1,066
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; /** Get all roles */ $authManager = Yii::$app->authManager; ?> <div class="user-assignment-form"> <?php $form = ActiveForm::begin(); ?> <?= Html::activeHiddenInput($formModel, 'userId')?> <label class="control-label"><?=$formModel->attributeLabels()['roles']?></label> <input type="hidden" name="AssignmentForm[roles]" value=""> <table class="table table-striped table-bordered detail-view"> <thead> <tr> <th style="width:1px"></th> <th style="width:150px">Name</th> <th>Description</th> </tr> <tbody> <?php foreach ($authManager->getRoles() as $role): ?> <tr> <?php $checked = true; if($formModel->roles==null||!is_array($formModel->roles)||count($formModel->roles)==0){ $checked = false; }else if(!in_array($role->name, $formModel->roles) ){ $checked = false; } ?> <td><input <?= $checked? "checked":"" ?> type="checkbox" name="AssignmentForm[roles][]" value="<?= $role->name?>"></td> <td><?= $role->name ?></td> <td><?= $role->description ?></td> </tr> <?php endforeach; ?> </tbody> </table> <?php if (!Yii::$app->request->isAjax) { ?> <div class="form-group"> <?= Html::submitButton(Yii::t('rbac', 'Save'), ['class' => 'btn btn-success']) ?> </div> <?php } ?> <?php ActiveForm::end(); ?> </div>
bara-artur/mailtousacom
modules/user/views/admin/assignment.php
PHP
bsd-3-clause
1,440
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Control.Lens.Internal.Getter</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[ window.onload = function () {pageLoad();}; //]]> </script></head><body id="mini"><div id="module-header"><p class="caption">Control.Lens.Internal.Getter</p></div><div id="interface"><div class="top"><p class="src"><a href="Control-Lens-Internal-Getter.html#v:noEffect" target="main">noEffect</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="Control-Lens-Internal-Getter.html#t:AlongsideLeft" target="main">AlongsideLeft</a> f b a</p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="Control-Lens-Internal-Getter.html#t:AlongsideRight" target="main">AlongsideRight</a> f a b</p></div></div></body></html>
nmattia/halytics
docs/lens-4.13/mini_Control-Lens-Internal-Getter.html
HTML
bsd-3-clause
1,132
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // IPC messages for resource loading. // // NOTE: All messages must send an |int request_id| as their first parameter. // Multiply-included message file, hence no include guard. #include "base/memory/shared_memory.h" #include "base/process/process.h" #include "content/common/content_param_traits_macros.h" #include "content/common/navigation_params.h" #include "content/common/resource_request_body.h" #include "content/common/service_worker/service_worker_types.h" #include "content/public/common/common_param_traits.h" #include "content/public/common/resource_response.h" #include "ipc/ipc_message_macros.h" #include "net/base/request_priority.h" #include "net/http/http_response_info.h" #include "net/url_request/redirect_info.h" #ifndef CONTENT_COMMON_RESOURCE_MESSAGES_H_ #define CONTENT_COMMON_RESOURCE_MESSAGES_H_ namespace net { struct LoadTimingInfo; } namespace content { struct ResourceDevToolsInfo; } namespace IPC { template <> struct ParamTraits<scoped_refptr<net::HttpResponseHeaders> > { typedef scoped_refptr<net::HttpResponseHeaders> param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); static void Log(const param_type& p, std::string* l); }; template <> struct CONTENT_EXPORT ParamTraits<storage::DataElement> { typedef storage::DataElement param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); static void Log(const param_type& p, std::string* l); }; template <> struct ParamTraits<scoped_refptr<content::ResourceDevToolsInfo> > { typedef scoped_refptr<content::ResourceDevToolsInfo> param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); static void Log(const param_type& p, std::string* l); }; template <> struct ParamTraits<net::LoadTimingInfo> { typedef net::LoadTimingInfo param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); static void Log(const param_type& p, std::string* l); }; template <> struct ParamTraits<scoped_refptr<content::ResourceRequestBody> > { typedef scoped_refptr<content::ResourceRequestBody> param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); static void Log(const param_type& p, std::string* l); }; } // namespace IPC #endif // CONTENT_COMMON_RESOURCE_MESSAGES_H_ #define IPC_MESSAGE_START ResourceMsgStart #undef IPC_MESSAGE_EXPORT #define IPC_MESSAGE_EXPORT CONTENT_EXPORT IPC_ENUM_TRAITS_MAX_VALUE( \ net::HttpResponseInfo::ConnectionInfo, \ net::HttpResponseInfo::NUM_OF_CONNECTION_INFOS - 1) IPC_ENUM_TRAITS_MAX_VALUE(content::FetchRequestMode, content::FETCH_REQUEST_MODE_LAST) IPC_ENUM_TRAITS_MAX_VALUE(content::FetchCredentialsMode, content::FETCH_CREDENTIALS_MODE_LAST) IPC_ENUM_TRAITS_MAX_VALUE(content::FetchRedirectMode, content::FetchRedirectMode::LAST) IPC_STRUCT_TRAITS_BEGIN(content::ResourceResponseHead) IPC_STRUCT_TRAITS_PARENT(content::ResourceResponseInfo) IPC_STRUCT_TRAITS_MEMBER(request_start) IPC_STRUCT_TRAITS_MEMBER(response_start) IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(content::SyncLoadResult) IPC_STRUCT_TRAITS_PARENT(content::ResourceResponseHead) IPC_STRUCT_TRAITS_MEMBER(error_code) IPC_STRUCT_TRAITS_MEMBER(final_url) IPC_STRUCT_TRAITS_MEMBER(data) IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(content::ResourceResponseInfo) IPC_STRUCT_TRAITS_MEMBER(request_time) IPC_STRUCT_TRAITS_MEMBER(response_time) IPC_STRUCT_TRAITS_MEMBER(headers) IPC_STRUCT_TRAITS_MEMBER(mime_type) IPC_STRUCT_TRAITS_MEMBER(charset) IPC_STRUCT_TRAITS_MEMBER(security_info) IPC_STRUCT_TRAITS_MEMBER(content_length) IPC_STRUCT_TRAITS_MEMBER(encoded_data_length) IPC_STRUCT_TRAITS_MEMBER(appcache_id) IPC_STRUCT_TRAITS_MEMBER(appcache_manifest_url) IPC_STRUCT_TRAITS_MEMBER(load_timing) IPC_STRUCT_TRAITS_MEMBER(devtools_info) IPC_STRUCT_TRAITS_MEMBER(download_file_path) IPC_STRUCT_TRAITS_MEMBER(was_fetched_via_spdy) IPC_STRUCT_TRAITS_MEMBER(was_npn_negotiated) IPC_STRUCT_TRAITS_MEMBER(was_alternate_protocol_available) IPC_STRUCT_TRAITS_MEMBER(connection_info) IPC_STRUCT_TRAITS_MEMBER(was_fetched_via_proxy) IPC_STRUCT_TRAITS_MEMBER(npn_negotiated_protocol) IPC_STRUCT_TRAITS_MEMBER(socket_address) IPC_STRUCT_TRAITS_MEMBER(was_fetched_via_service_worker) IPC_STRUCT_TRAITS_MEMBER(was_fallback_required_by_service_worker) IPC_STRUCT_TRAITS_MEMBER(original_url_via_service_worker) IPC_STRUCT_TRAITS_MEMBER(response_type_via_service_worker) IPC_STRUCT_TRAITS_MEMBER(service_worker_start_time) IPC_STRUCT_TRAITS_MEMBER(service_worker_ready_time) IPC_STRUCT_TRAITS_MEMBER(proxy_server) IPC_STRUCT_TRAITS_MEMBER(is_using_lofi) IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(net::RedirectInfo) IPC_STRUCT_TRAITS_MEMBER(status_code) IPC_STRUCT_TRAITS_MEMBER(new_method) IPC_STRUCT_TRAITS_MEMBER(new_url) IPC_STRUCT_TRAITS_MEMBER(new_first_party_for_cookies) IPC_STRUCT_TRAITS_MEMBER(new_referrer) IPC_STRUCT_TRAITS_END() // Parameters for a resource request. IPC_STRUCT_BEGIN(ResourceHostMsg_Request) // The request method: GET, POST, etc. IPC_STRUCT_MEMBER(std::string, method) // The requested URL. IPC_STRUCT_MEMBER(GURL, url) // Usually the URL of the document in the top-level window, which may be // checked by the third-party cookie blocking policy. Leaving it empty may // lead to undesired cookie blocking. Third-party cookie blocking can be // bypassed by setting first_party_for_cookies = url, but this should ideally // only be done if there really is no way to determine the correct value. IPC_STRUCT_MEMBER(GURL, first_party_for_cookies) // The referrer to use (may be empty). IPC_STRUCT_MEMBER(GURL, referrer) // The referrer policy to use. IPC_STRUCT_MEMBER(blink::WebReferrerPolicy, referrer_policy) // The frame's visiblity state. IPC_STRUCT_MEMBER(blink::WebPageVisibilityState, visiblity_state) // Additional HTTP request headers. IPC_STRUCT_MEMBER(std::string, headers) // net::URLRequest load flags (0 by default). IPC_STRUCT_MEMBER(int, load_flags) // Process ID from which this request originated, or zero if it originated // in the renderer itself. // If kDirectNPAPIRequests isn't specified, then plugin requests get routed // through the renderer and and this holds the pid of the plugin process. // Otherwise this holds the render_process_id of the view that has the plugin. IPC_STRUCT_MEMBER(int, origin_pid) // What this resource load is for (main frame, sub-frame, sub-resource, // object). IPC_STRUCT_MEMBER(content::ResourceType, resource_type) // The priority of this request. IPC_STRUCT_MEMBER(net::RequestPriority, priority) // Used by plugin->browser requests to get the correct net::URLRequestContext. IPC_STRUCT_MEMBER(uint32, request_context) // Indicates which frame (or worker context) the request is being loaded into, // or kAppCacheNoHostId. IPC_STRUCT_MEMBER(int, appcache_host_id) // True if corresponding AppCache group should be resetted. IPC_STRUCT_MEMBER(bool, should_reset_appcache) // Indicates which frame (or worker context) the request is being loaded into, // or kInvalidServiceWorkerProviderId. IPC_STRUCT_MEMBER(int, service_worker_provider_id) // True if the request should not be handled by the ServiceWorker. IPC_STRUCT_MEMBER(bool, skip_service_worker) // The request mode passed to the ServiceWorker. IPC_STRUCT_MEMBER(content::FetchRequestMode, fetch_request_mode) // The credentials mode passed to the ServiceWorker. IPC_STRUCT_MEMBER(content::FetchCredentialsMode, fetch_credentials_mode) // The redirect mode used in Fetch API. IPC_STRUCT_MEMBER(content::FetchRedirectMode, fetch_redirect_mode) // The request context passed to the ServiceWorker. IPC_STRUCT_MEMBER(content::RequestContextType, fetch_request_context_type) // The frame type passed to the ServiceWorker. IPC_STRUCT_MEMBER(content::RequestContextFrameType, fetch_frame_type) // Optional resource request body (may be null). IPC_STRUCT_MEMBER(scoped_refptr<content::ResourceRequestBody>, request_body) IPC_STRUCT_MEMBER(bool, download_to_file) // True if the request was user initiated. IPC_STRUCT_MEMBER(bool, has_user_gesture) // True if load timing data should be collected for request. IPC_STRUCT_MEMBER(bool, enable_load_timing) // True if upload progress should be available for request. IPC_STRUCT_MEMBER(bool, enable_upload_progress) // True if login prompts for this request should be supressed. IPC_STRUCT_MEMBER(bool, do_not_prompt_for_login) // The routing id of the RenderFrame. IPC_STRUCT_MEMBER(int, render_frame_id) // True if |frame_id| is the main frame of a RenderView. IPC_STRUCT_MEMBER(bool, is_main_frame) // True if |parent_render_frame_id| is the main frame of a RenderView. IPC_STRUCT_MEMBER(bool, parent_is_main_frame) // Identifies the parent frame of the frame that sent the request. // -1 if unknown / invalid. IPC_STRUCT_MEMBER(int, parent_render_frame_id) IPC_STRUCT_MEMBER(ui::PageTransition, transition_type) // For navigations, whether this navigation should replace the current session // history entry on commit. IPC_STRUCT_MEMBER(bool, should_replace_current_entry) // The following two members identify a previous request that has been // created before this navigation has been transferred to a new render view. // This serves the purpose of recycling the old request. // Unless this refers to a transferred navigation, these values are -1 and -1. IPC_STRUCT_MEMBER(int, transferred_request_child_id) IPC_STRUCT_MEMBER(int, transferred_request_request_id) // Whether or not we should allow the URL to download. IPC_STRUCT_MEMBER(bool, allow_download) // Whether to intercept headers to pass back to the renderer. IPC_STRUCT_MEMBER(bool, report_raw_headers) // Whether or not to request a LoFi version of the resource or let the browser // decide. IPC_STRUCT_MEMBER(content::LoFiState, lofi_state) IPC_STRUCT_END() // Parameters for a ResourceMsg_RequestComplete IPC_STRUCT_BEGIN(ResourceMsg_RequestCompleteData) // The error code. IPC_STRUCT_MEMBER(int, error_code) // Was ignored by the request handler. IPC_STRUCT_MEMBER(bool, was_ignored_by_handler) // A copy of the data requested exists in the cache. IPC_STRUCT_MEMBER(bool, exists_in_cache) // Serialized security info; see content/common/ssl_status_serialization.h. IPC_STRUCT_MEMBER(std::string, security_info) // Time the request completed. IPC_STRUCT_MEMBER(base::TimeTicks, completion_time) // Total amount of data received from the network. IPC_STRUCT_MEMBER(int64, encoded_data_length) IPC_STRUCT_END() // Resource messages sent from the browser to the renderer. // Sent when the headers are available for a resource request. IPC_MESSAGE_CONTROL2(ResourceMsg_ReceivedResponse, int /* request_id */, content::ResourceResponseHead) // Sent when cached metadata from a resource request is ready. IPC_MESSAGE_CONTROL2(ResourceMsg_ReceivedCachedMetadata, int /* request_id */, std::vector<char> /* data */) // Sent as upload progress is being made. IPC_MESSAGE_CONTROL3(ResourceMsg_UploadProgress, int /* request_id */, int64 /* position */, int64 /* size */) // Sent when the request has been redirected. The receiver is expected to // respond with either a FollowRedirect message (if the redirect is to be // followed) or a CancelRequest message (if it should not be followed). IPC_MESSAGE_CONTROL3(ResourceMsg_ReceivedRedirect, int /* request_id */, net::RedirectInfo /* redirect_info */, content::ResourceResponseHead) // Sent to set the shared memory buffer to be used to transmit response data to // the renderer. Subsequent DataReceived messages refer to byte ranges in the // shared memory buffer. The shared memory buffer should be retained by the // renderer until the resource request completes. // // NOTE: The shared memory handle should already be mapped into the process // that receives this message. // // TODO(darin): The |renderer_pid| parameter is just a temporary parameter, // added to help in debugging crbug/160401. // IPC_MESSAGE_CONTROL4(ResourceMsg_SetDataBuffer, int /* request_id */, base::SharedMemoryHandle /* shm_handle */, int /* shm_size */, base::ProcessId /* renderer_pid */) // Sent when some data from a resource request is ready. The data offset and // length specify a byte range into the shared memory buffer provided by the // SetDataBuffer message. IPC_MESSAGE_CONTROL4(ResourceMsg_DataReceived, int /* request_id */, int /* data_offset */, int /* data_length */, int /* encoded_data_length */) // Sent when some data from a resource request has been downloaded to // file. This is only called in the 'download_to_file' case and replaces // ResourceMsg_DataReceived in the call sequence in that case. IPC_MESSAGE_CONTROL3(ResourceMsg_DataDownloaded, int /* request_id */, int /* data_len */, int /* encoded_data_length */) // Sent when the request has been completed. IPC_MESSAGE_CONTROL2(ResourceMsg_RequestComplete, int /* request_id */, ResourceMsg_RequestCompleteData) // Resource messages sent from the renderer to the browser. // Makes a resource request via the browser. IPC_MESSAGE_CONTROL3(ResourceHostMsg_RequestResource, int /* routing_id */, int /* request_id */, ResourceHostMsg_Request) // Cancels a resource request with the ID given as the parameter. IPC_MESSAGE_CONTROL1(ResourceHostMsg_CancelRequest, int /* request_id */) // Follows a redirect that occured for the resource request with the ID given // as the parameter. IPC_MESSAGE_CONTROL1(ResourceHostMsg_FollowRedirect, int /* request_id */) // Makes a synchronous resource request via the browser. IPC_SYNC_MESSAGE_ROUTED2_1(ResourceHostMsg_SyncLoad, int /* request_id */, ResourceHostMsg_Request, content::SyncLoadResult) // Sent when the renderer process is done processing a DataReceived // message. IPC_MESSAGE_CONTROL1(ResourceHostMsg_DataReceived_ACK, int /* request_id */) // Sent when the renderer has processed a DataDownloaded message. IPC_MESSAGE_CONTROL1(ResourceHostMsg_DataDownloaded_ACK, int /* request_id */) // Sent by the renderer process to acknowledge receipt of a // UploadProgress message. IPC_MESSAGE_CONTROL1(ResourceHostMsg_UploadProgress_ACK, int /* request_id */) // Sent when the renderer process deletes a resource loader. IPC_MESSAGE_CONTROL1(ResourceHostMsg_ReleaseDownloadedFile, int /* request_id */) // Sent by the renderer when a resource request changes priority. IPC_MESSAGE_CONTROL3(ResourceHostMsg_DidChangePriority, int /* request_id */, net::RequestPriority, int /* intra_priority_value */)
Bysmyyr/chromium-crosswalk
content/common/resource_messages.h
C
bsd-3-clause
16,094
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/ui/simple_message_box.h" #include <utility> #include "base/bind.h" #include "base/callback.h" #include "base/compiler_specific.h" #include "base/macros.h" #include "base/message_loop/message_loop_current.h" #include "base/run_loop.h" #include "build/build_config.h" #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/simple_message_box_internal.h" #include "chrome/browser/ui/views/message_box_dialog.h" #include "chrome/grit/generated_resources.h" #include "components/constrained_window/constrained_window_views.h" #include "components/startup_metric_utils/browser/startup_metric_utils.h" #include "components/strings/grit/components_strings.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/display/screen.h" #include "ui/gfx/native_widget_types.h" #include "ui/views/controls/message_box_view.h" #include "ui/views/widget/widget.h" #include "ui/views/window/dialog_delegate.h" #if defined(OS_WIN) #include "ui/base/win/message_box_win.h" #include "ui/views/win/hwnd_util.h" #endif #if defined(OS_MACOSX) #include "chrome/browser/ui/cocoa/simple_message_box_cocoa.h" #endif namespace { #if defined(OS_WIN) UINT GetMessageBoxFlagsFromType(chrome::MessageBoxType type) { UINT flags = MB_SETFOREGROUND; switch (type) { case chrome::MESSAGE_BOX_TYPE_WARNING: return flags | MB_OK | MB_ICONWARNING; case chrome::MESSAGE_BOX_TYPE_QUESTION: return flags | MB_YESNO | MB_ICONQUESTION; } NOTREACHED(); return flags | MB_OK | MB_ICONWARNING; } #endif // static chrome::MessageBoxResult ShowSync(gfx::NativeWindow parent, const base::string16& title, const base::string16& message, chrome::MessageBoxType type, const base::string16& yes_text, const base::string16& no_text, const base::string16& checkbox_text) { chrome::MessageBoxResult result = chrome::MESSAGE_BOX_RESULT_NO; // TODO(pkotwicz): Exit message loop when the dialog is closed by some other // means than |Cancel| or |Accept|. crbug.com/404385 base::RunLoop run_loop(base::RunLoop::Type::kNestableTasksAllowed); MessageBoxDialog::Show( parent, title, message, type, yes_text, no_text, checkbox_text, base::BindOnce( [](base::RunLoop* run_loop, chrome::MessageBoxResult* out_result, chrome::MessageBoxResult messagebox_result) { *out_result = messagebox_result; run_loop->Quit(); }, &run_loop, &result)); run_loop.Run(); return result; } } // namespace //////////////////////////////////////////////////////////////////////////////// // MessageBoxDialog, public: // static chrome::MessageBoxResult MessageBoxDialog::Show( gfx::NativeWindow parent, const base::string16& title, const base::string16& message, chrome::MessageBoxType type, const base::string16& yes_text, const base::string16& no_text, const base::string16& checkbox_text, MessageBoxDialog::MessageBoxResultCallback callback) { if (!callback) return ShowSync(parent, title, message, type, yes_text, no_text, checkbox_text); startup_metric_utils::SetNonBrowserUIDisplayed(); if (chrome::internal::g_should_skip_message_box_for_test) { std::move(callback).Run(chrome::MESSAGE_BOX_RESULT_YES); return chrome::MESSAGE_BOX_RESULT_DEFERRED; } // Views dialogs cannot be shown outside the UI thread message loop or if the // ResourceBundle is not initialized yet. // Fallback to logging with a default response or a Windows MessageBox. #if defined(OS_WIN) if (!base::MessageLoopCurrentForUI::IsSet() || !base::RunLoop::IsRunningOnCurrentThread() || !ui::ResourceBundle::HasSharedInstance()) { LOG_IF(ERROR, !checkbox_text.empty()) << "Dialog checkbox won't be shown"; int result = ui::MessageBox(views::HWNDForNativeWindow(parent), message, title, GetMessageBoxFlagsFromType(type)); std::move(callback).Run((result == IDYES || result == IDOK) ? chrome::MESSAGE_BOX_RESULT_YES : chrome::MESSAGE_BOX_RESULT_NO); return chrome::MESSAGE_BOX_RESULT_DEFERRED; } #elif defined(OS_MACOSX) if (!base::MessageLoopCurrentForUI::IsSet() || !base::RunLoop::IsRunningOnCurrentThread() || !ui::ResourceBundle::HasSharedInstance()) { // Even though this function could return a value synchronously here in // principle, in practice call sites do not expect any behavior other than a // return of DEFERRED and an invocation of the callback. std::move(callback).Run( chrome::ShowMessageBoxCocoa(message, type, checkbox_text)); return chrome::MESSAGE_BOX_RESULT_DEFERRED; } #else if (!base::MessageLoopCurrentForUI::IsSet() || !ui::ResourceBundle::HasSharedInstance() || !display::Screen::GetScreen()) { LOG(ERROR) << "Unable to show a dialog outside the UI thread message loop: " << title << " - " << message; std::move(callback).Run(chrome::MESSAGE_BOX_RESULT_NO); return chrome::MESSAGE_BOX_RESULT_DEFERRED; } #endif bool is_system_modal = !parent; #if defined(OS_MACOSX) // Mac does not support system modals, so never ask MessageBoxDialog to // be system modal. is_system_modal = false; #endif MessageBoxDialog* dialog = new MessageBoxDialog( title, message, type, yes_text, no_text, checkbox_text, is_system_modal); views::Widget* widget = constrained_window::CreateBrowserModalDialogViews(dialog, parent); #if defined(OS_MACOSX) // Mac does not support system modal dialogs. If there is no parent window to // attach to, move the dialog's widget on top so other windows do not obscure // it. if (!parent) widget->SetZOrderLevel(ui::ZOrderLevel::kFloatingWindow); #endif widget->Show(); dialog->Run(std::move(callback)); return chrome::MESSAGE_BOX_RESULT_DEFERRED; } void MessageBoxDialog::OnDialogAccepted() { if (!message_box_view_->HasCheckBox() || message_box_view_->IsCheckBoxSelected()) { Done(chrome::MESSAGE_BOX_RESULT_YES); } else { Done(chrome::MESSAGE_BOX_RESULT_NO); } } base::string16 MessageBoxDialog::GetWindowTitle() const { return window_title_; } void MessageBoxDialog::DeleteDelegate() { delete this; } ui::ModalType MessageBoxDialog::GetModalType() const { return is_system_modal_ ? ui::MODAL_TYPE_SYSTEM : ui::MODAL_TYPE_WINDOW; } views::View* MessageBoxDialog::GetContentsView() { return message_box_view_; } bool MessageBoxDialog::ShouldShowCloseButton() const { return true; } void MessageBoxDialog::OnWidgetActivationChanged(views::Widget* widget, bool active) { if (!active) GetWidget()->Close(); } //////////////////////////////////////////////////////////////////////////////// // MessageBoxDialog, private: MessageBoxDialog::MessageBoxDialog(const base::string16& title, const base::string16& message, chrome::MessageBoxType type, const base::string16& yes_text, const base::string16& no_text, const base::string16& checkbox_text, bool is_system_modal) : window_title_(title), type_(type), message_box_view_(new views::MessageBoxView( views::MessageBoxView::InitParams(message))), is_system_modal_(is_system_modal) { SetButtons(type_ == chrome::MESSAGE_BOX_TYPE_QUESTION ? ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL : ui::DIALOG_BUTTON_OK); SetAcceptCallback(base::BindOnce(&MessageBoxDialog::OnDialogAccepted, base::Unretained(this))); SetCancelCallback(base::BindOnce(&MessageBoxDialog::Done, base::Unretained(this), chrome::MESSAGE_BOX_RESULT_NO)); SetCloseCallback(base::BindOnce(&MessageBoxDialog::Done, base::Unretained(this), chrome::MESSAGE_BOX_RESULT_NO)); base::string16 ok_text = yes_text; if (ok_text.empty()) { ok_text = type_ == chrome::MESSAGE_BOX_TYPE_QUESTION ? l10n_util::GetStringUTF16(IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL) : l10n_util::GetStringUTF16(IDS_OK); } SetButtonLabel(ui::DIALOG_BUTTON_OK, ok_text); // Only MESSAGE_BOX_TYPE_QUESTION has a Cancel button. if (type_ == chrome::MESSAGE_BOX_TYPE_QUESTION) { base::string16 cancel_text = no_text; if (cancel_text.empty()) cancel_text = l10n_util::GetStringUTF16(IDS_CANCEL); SetButtonLabel(ui::DIALOG_BUTTON_CANCEL, cancel_text); } if (!checkbox_text.empty()) message_box_view_->SetCheckBoxLabel(checkbox_text); chrome::RecordDialogCreation(chrome::DialogIdentifier::SIMPLE_MESSAGE_BOX); } MessageBoxDialog::~MessageBoxDialog() { GetWidget()->RemoveObserver(this); } void MessageBoxDialog::Run(MessageBoxResultCallback result_callback) { GetWidget()->AddObserver(this); result_callback_ = std::move(result_callback); } void MessageBoxDialog::Done(chrome::MessageBoxResult result) { CHECK(!result_callback_.is_null()); std::move(result_callback_).Run(result); } views::Widget* MessageBoxDialog::GetWidget() { return message_box_view_->GetWidget(); } const views::Widget* MessageBoxDialog::GetWidget() const { return message_box_view_->GetWidget(); } namespace chrome { void ShowWarningMessageBox(gfx::NativeWindow parent, const base::string16& title, const base::string16& message) { MessageBoxDialog::Show(parent, title, message, chrome::MESSAGE_BOX_TYPE_WARNING, base::string16(), base::string16(), base::string16()); } void ShowWarningMessageBoxWithCheckbox( gfx::NativeWindow parent, const base::string16& title, const base::string16& message, const base::string16& checkbox_text, base::OnceCallback<void(bool checked)> callback) { MessageBoxDialog::Show(parent, title, message, chrome::MESSAGE_BOX_TYPE_WARNING, base::string16(), base::string16(), checkbox_text, base::BindOnce( [](base::OnceCallback<void(bool checked)> callback, MessageBoxResult message_box_result) { std::move(callback).Run(message_box_result == MESSAGE_BOX_RESULT_YES); }, base::Passed(std::move(callback)))); } MessageBoxResult ShowQuestionMessageBox(gfx::NativeWindow parent, const base::string16& title, const base::string16& message) { return MessageBoxDialog::Show( parent, title, message, chrome::MESSAGE_BOX_TYPE_QUESTION, base::string16(), base::string16(), base::string16()); } MessageBoxResult ShowMessageBoxWithButtonText(gfx::NativeWindow parent, const base::string16& title, const base::string16& message, const base::string16& yes_text, const base::string16& no_text) { return MessageBoxDialog::Show(parent, title, message, chrome::MESSAGE_BOX_TYPE_QUESTION, yes_text, no_text, base::string16()); } } // namespace chrome
endlessm/chromium-browser
chrome/browser/ui/views/message_box_dialog.cc
C++
bsd-3-clause
12,172
<?php session_start(); // ---------------- PRE DEFINED VARIABLES ---------------- // if ($_SESSION['user_name']=='') { $user_name_session = $_POST['id']; echo "no session set"; } else { $user_name_session = $_SESSION['user_name']; } //print_r($user_name_session); include_once('/kunden/homepages/0/d643120834/htdocs/config/index.php'); $db = new UserDashboard($_SESSION); // $user = $db->getUserData($user_name_session); // //print_r($user); // $user['stats']['total'] = $db->getUserStats($user_name_session , 'total'); // $user['stats']['total'] = $db->getUserStats($user_name_session , 'fans'); // $user['id'] = $user['user_id']; // $user['photo'] = $db->getProfilePhoto($user_name_session); // $user['profile_url'] = 'http://freela.be/l/'.$user['user_name']; // $user['media']['audio'] = $db->getUserMedia($user_name_session); // Grab Users Posts // $user['stats']['tracks'] = count($user['media']['audio']); // $user['twitter'] = $user['media']['audio'][0]['twitter']; // ------ data fixes ------- // if (isset($user['photo']) && $user['photo']!='' ) { $profile_image = '<img src="'.$user['photo'].'" alt="'.$user['photo'].'" style="width:100%;">'; } else { if (strpos($user['media']['audio'][0]['photo'], 'http://')) { $media = 'http://freelabel.net/images/'.$user['media']['audio'][0]['photo']; //echo 'I needs to be formated'; } else { $media = $user['media']['audio'][0]['photo']; //echo 'it doesnt need to be!!'; } $profile_image = '<img src="'.$media.'" alt="from-media-'.$media.'" style="width:100%;">'; } if ($user['custom']==''){ $user['custom'] = $db->getCustomData($user); } //print_r($user['media']['audio']); //exit; //print_r($user['user_name']); //exit; //echo '<hr><hr><hr>'; //print_r(); //$user_name_session = $user['user_name']; //echo 'THEUSERER: '.$user_name_session.'<hr>'; $todays_date = date('Y-m-d'); $dashboard_options = ' <div class="btn-group-vertical dashboard-navigation " style="width:100%;"> <a onclick="loadPage(\'http://freelabel.net/submit/views/db/recent_posts.php\', \'#dashboard_view_panel\', \'dashboard\', \''.$user_name_session.'\')" class="btn btn-default btn-lg"><span class="glyphicon glyphicon-dashboard"></span> - Dashboard</a> <a href="http://freelabel.net/@'.strtolower($user['twitter']).'" class="btn btn-default btn-lg" target="_blank" ><span class="glyphicon glyphicon-user"></span> - View Profile</a> <a href="#music" onclick="loadPage(\'http://freelabel.net/submit/views/single_uploader.php\', \'#dashboard_view_panel\', \'dashboard\', \''.$user_name_session.'\')" class="btn btn-default btn-lg"><span class="glyphicon glyphicon-music"></span> - Music</a> <a href="#photos" onclick="loadPage(\'http://freelabel.net/submit/views/db/user_photos.php\', \'#dashboard_view_panel\', \'dashboard\', \''.$user_name_session.'\')" class="btn btn-default btn-lg"><span class="glyphicon glyphicon-picture"></span> - Photos</a> <a href="#videos" onclick="loadPage(\'http://freelabel.net/submit/views/db/video_saver.php\', \'#dashboard_view_panel\', \'dashboard\', \''.$user_name_session.'\')" class="btn btn-default btn-lg"><span class="glyphicon glyphicon-film"></span> - Videos</a> <a href="#schedule" onclick="loadPage(\'http://freelabel.net/submit/views/db/showcase_schedule.php\', \'#dashboard_view_panel\', \'dashboard\', \''.$user_name_session.'\')" class="btn btn-default btn-lg"><span class="glyphicon glyphicon-calendar"></span> - Schedule</a> <a href="#howtouse" onclick="loadPage(\'http://freelabel.net/submit/views/db/howtouse.php\', \'#dashboard_view_panel\', \'dashboard\', \''.$user_name_session.'\')" class="btn btn-default btn-lg" ><span class="glyphicon glyphicon-question-sign"></span> - How To Use</a> <a href="#email" onclick="loadPage(\'http://freelabel.net/test/send_email.php\', \'#dashboard_view_panel\', \'dashboard\', \''.$user_name_session.'\')" class="btn btn-default btn-lg" ><span class="glyphicon glyphicon-envelope"></span> - Contact Support</a> <a href="http://freelabel.net/submit/index.php?logout" class="btn btn-danger btn-lg" ><span class="glyphicon glyphicon-log-out"></span> - Logout</a> '; $admin_options = " <hr> <h3>Admin Only:</h3> <a onclick=\"loadPage('http://freelabel.net/submit/views/db/blog_poster.php', '#main_display_panel', 'dashboard', 'admin')\" class='btn btn-warning btn-lg'> <span class='glyphicon glyphicon-pencil'></span>Post</a> <a onclick=\"loadPage('http://freelabel.net/submit/views/db/lead_conversion.php', '#main_display_panel', 'dashboard', 'admin')\" class='btn btn-warning btn-lg'> <span class='glyphicon glyphicon-usd'></span>Clients</a> <a onclick=\"loadPage('http://freelabel.net/twitter/index.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-warning btn-lg'> <span class='glyphicon glyphicon-comment'></span>Twitter</a> <a onclick=\"loadPage('http://freelabel.net/x/s.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-warning btn-lg'><span class='glyphicon glyphicon-list-alt'></span>Script</a> <hr> <h4>Soon-To-Be-Launched</h4> <a onclick=\"loadPage('http://freelabel.net/twitter/index.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-warning btn-lg'> <span class='glyphicon glyphicon-comment'></span>Respond</a> <a onclick=\"loadPage('http://freelabel.net/submit/views/db/blog_poster.php', '#main_display_panel', 'dashboard', 'admin')\" class='btn btn-warning btn-lg'> <span class='glyphicon glyphicon-usd'></span>Release</a> <a onclick=\"loadPage('http://freelabel.net/submit/views/db/current_clients.php', '#main_display_panel', 'dashboard', 'admin')\" class='btn btn-warning btn-lg'> <span class='glyphicon glyphicon-pencil'></span>Reproduce</a> <hr> <h4>Still Testing</h4> <a onclick=\"loadPage('http://freelabel.net/upload/index.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-warning btn-lg'>Uploader</a> <a onclick=\"loadPage('http://freelabel.net/submit/views/uploadedsingles.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-warning btn-lg'>Payouts</a> <a onclick=\"loadPage('http://freelabel.net/tweeter.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-warning btn-lg'>Saved</a> <a onclick=\"loadPage('http://freelabel.net/tweeter.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-warning btn-lg'>Saved</a> <a onclick=\"loadPage('http://freelabel.net/FullWidthTabs/index.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-warning btn-lg'>Full Width</a>"; $update_successful = '<script type="text/javascript"> function redirectToSite() { alert("Your Changes Have Been Saved! Now Returning you to your Dashboard.."); window.location.assign("http://freelabel.net/submit/") } </script>'; $profile_builder_form = '<div class="create_profile_form_wrapper">'; //$profile_builder_form .= '<h3 >Hello, '.$user_name_session.'! </h3>'; $profile_builder_form .= '<div class="label label-warning" role="alert">You\'ll need to finish completing all the additional information regarding creating your profile, '.$user_name_session.'! </div>'; //$profile_builder_form .= '<div class="alert alert-warning" role="alert">You\'ll need to <a href="#" class="alert-link">make your payment</a> before we can get you booked in rotation!</div>'; $profile_builder_form .= " <form name='profile_builder_form' action='http://freelabel.net/submit/views/db/campaign_info.php' method='post' enctype=\"multipart/form-data\" class='profile_builder_form panel-body row' > <h1>Complete Profile</h1> <p class='section-description text-muted' >Use this form to complete your FREELABEL Profile. We will use this information to build your campaign as well as tag you during promotional campaigns!</p> <div class='col-md-3 col-sm-6' > <h4><i class='fa fa-photo' ></i> Upload Profile Photo</h4><input type='file' class='form-control' name='photo' required> </div> <div class='col-md-3 col-sm-6' > <h4><i class='fa fa-comment'></i> Display Name</h4> <input type='text' class='form-control' name='artist_name' placeholder='What is your Artist or Brand Name?' required> </div> <div class='col-md-3 col-sm-6' > <h4><i class='fa fa-map-marker'></i> Location</h4> <input type='text' class='form-control' name='artist_location' placeholder='Where are you from?' required> </div> <div class='col-md-3 col-sm-6' > <h4><i class='fa fa-users'></i> Brand or Management <small>(optional)</small></h4> <input type='text' class='form-control' name='artist_location' placeholder='Enter management contact information (Name, Phone, Email, etc..)' > </div> <div class='col-md-12'> <h4><i class='fa fa-book'></i> Artist Bio</h4><br> <textarea name='artist_description' class='form-control' rows='4' cols='53' placeholder='Tell us a little (or alot) about yourself..'></textarea> </div> <h1>Link Social Media</h1> <div class=' col-md-4 col-sm-6' > <h4><i class='fa fa-twitter'></i> Twitter</h4> <input type='text' class='form-control' name='artist_twitter' placeholder='Enter your Twitter username.. (include \"@\" sign)' required > </div> <div class=' col-md-4 col-sm-6' > <h4><i class='fa fa-instagram'></i> Instagram <small>(optional)</small></h4> <input type='text' class='form-control' name='artist_twitter' placeholder='Enter Your Instagram Username.. (include \"@\" sign)' > </div> <div class=' col-md-4 col-sm-6' > <h4><i class='fa fa-soundcloud'></i> Soundcloud <small>(optional)</small></h4> <input type='text' class='form-control' name='artist_twitter' placeholder='Enter Your Soundcloud Username.. (include \"@\" sign)' > </div> <div class=' col-md-4 col-sm-6' > <h4><i class='fa fa-youtube'></i> Youtube <small>(optional)</small></h4> <input type='text' class='form-control' name='artist_twitter' placeholder='Enter Your Youtube Username.. (include \"@\" sign)' > </div> <div class=' col-md-4 col-sm-6' > <h4><i class='fa fa-paypal'></i> Paypal <small>(optional)</small></h4> <input type='text' class='form-control' name='artist_twitter' placeholder='Enter Your Paypal Email..' > </div> <div class=' col-md-4 col-sm-6' > <h4><i class='fa fa-snapchat'></i> Snapchat <small>(optional)</small></h4> <input type='text' class='form-control' name='artist_twitter' placeholder='Enter Your Paypal Email..' > </div> <div class='col-md-12'> <input name='update_profile' type='submit' class='btn btn-warning complete-profile-button' value='SAVE PROFILE'> </div> <input type='hidden' name='id' value='".$user_name_session."' > <input type='hidden' name='update_profile'> <br> </form> <hr> </div>"; $confirm_profile = " <h2 id='subtitle'>Confirm Profile!</h2> <div id='body'> <h2>Make sure your information is correct before we make these changes to your profile!</h2> <br><br> <table id='body'> <tr> <td> <img id='preview_photo' src='".$full_photo_path."'> </td> <td> <span id='sub_label' >Arist Name:</span> <span id='pricing1' >".$artist_name."</span><br> <span id='sub_label' >Twitter UserName:</span> <span id='pricing1' >".$artist_twitter."</span><br> <span id='sub_label' >Artist Location:</span> <span id='pricing1' >".$artist_location."</span><br> <h3>Description:</h3><br> ".$artist_description." <center> <button class='confirm_update' type='button' onclick='redirectToSite()'>SAVE CHANGES TO PROFILE</button> </center> </td> </tr> </table> <br><br> </div>"; ?> <style type="text/css"> #preview_photo { width:400px; vertical-align: text-top; } #profile_builder_form { width:300px; } .download_button { display:block; } .create_profile_form_wrapper h3 { color:#101010; } .uploaded_singles { border-radius:0px; } .more-options-button { display:none; } .events-panel { text-align: left; } .dashboard-panel { min-height: 50vh; } .db-details { color:#303030; font-size: 0.75em; } .overflow { max-height:300px; overflow-y:scroll; } .profile_builder_form input, .profile_builder_form textarea, .profile_builder_form select, .profile_builder_form option { font-size: 125%; padding:2.5%; margin-bottom:2.5%; } .complete-profile-button { margin:auto; display:block; } .form-section-title h3 { color:#e3e3e3; } .events-panel { padding-bottom:0px; margin-bottom:4%; border-bottom:2px solid #101010; } .overflow, .dashboard-profile-details { min-height: 80vh; } .events-panel .overflow { height:80vh; } </style> <script type="text/javascript"> $(function(){ var pleaseWait = 'Please wait..'; $('.more-options-button').click(function(){ $('.more-options').slideToggle('fast'); }); $('#edit-default-pxhoto').change(function() { // ------ NEW NEW NEW NEW ------ // $('.photo-upload-results').html(' '); $('#edit-default-photo').append(pleaseWait); //$('.confirm-upload-buttons').prepend('<p class="wait" style="color:#303030;">Please wait..<p>'); //$('.confirm-upload-buttons').hide('fast'); var path = 'submit/updateprofile.php'; var data; var formdata_PHO = $('#edit-default-photo')[0].files[0]; var formdata = new FormData(); // Add the file to the request. formdata.append('photos[]', formdata_PHO); //var formdata = $('#single_upload_form').serialize(); //console.log(formdata_PHO); //alert(formdata_PHO); $.ajax({ // Uncomment the following to send cross-domain cookies: xhrFields: {withCredentials: true}, url: path, //dataType: 'json', method: 'POST', cache : false, processData: false, contentType: false, fileElementId: 'image-upload', data: formdata, beforeSend: function (x) { if (x && x.overrideMimeType) { x.overrideMimeType("multipart/form-data"); } }, // Now you should be able to do this: mimeType: 'multipart/form-data' //Property added in 1.5.1 }).always(function () { //alert(formdata_PHO); console.log(formdata_PHO); //$('#confirm_upload').html('please wait..'); //$(this).removeClass('fileupload-processing'); }).fail(function(jqXHR){ alert(jqXHR.statusText + 'oh no it didnt work!') }).done(function (result) { //alert('YES'); $('.edit-default-form').append(result); //$('.confirm-upload-buttons').show('fast'); // $('.confirm-upload-buttons').css('opacity',1); //$('.wait').hide('fast'); }) }); }); function showPhotoOptions(id) { //alert(id); $('.edit-profile-block').slideToggle('fast'); } </script> <?php // IF ARTIST PROFILE EXISTS, SHOW PANELS include(ROOT.'inc/connection.php'); if ($user_name == false) { $user_name = 'no username'; } // ------------------------------------------------------- // // CHECK IF EXISTS IN ARTIST WEBSITE DATABASE // ------------------------------------------------------- // $sql ="SELECT * FROM user_profiles WHERE id='".$user_name_session."'"; $result = mysqli_query($con,$sql); if($row = mysqli_fetch_array($result)) { // ------------------------------------------------------- // // IF EXISTS, DISPLAY FULL USER DATA & CONTROL OPTIONS // ------------------------------------------------------- // // PROFILE IMAGE $profile_info = ' <a target="_blank" href="'.$user['profile_url'].'">'.$profile_image.'</a>'; $profile_options.=" <!-- <a onclick=\"loadPage('http://freelabel.net/mag/pull_mag.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-signal\"></span>Feed</a> <a onclick=\"loadPage('http://freelabel.net/submit/views/db/user_photos.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-picture\"></span>Photos</a> <a onclick=\"loadPage('http://freelabel.net/submit/views/db/recent_posts.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-envelope\"></span>Messages</a> <a onclick=\"loadPage('http://freelabel.net/submit/views/db/recent_uploads.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-envelope\"></span>Notifications</a> --> <a class='btn btn-default lead_control' href='".$user['profile_url']."' target='_blank' ><span class=\"glyphicon glyphicon-phone\"></span>View Website</a> <a onclick=\"loadPage('http://freelabel.net/submit/views/db/recent_posts.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-cloud-upload\"></span>Your Uploads</a> <a onclick=\"loadPage('http://freelabel.net/submit/views/db/showcase_schedule.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-calendar\"></span>Your Schedule</a> <a onclick=\"loadPage('http://freelabel.net/submit/views/db/howtouse.php', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-shopping-cart\"></span>Help</a> <a class='btn btn-default lead_control more-options-button'><span class=\"glyphicon glyphicon-cog\"></span>Settings</a> <div class='more-options' style='display:none;'> ".$user['custom']." </div> "; $profile_info.=' <div class="" id="dashboard_profile_photo" > <!--<h5 class="sub_title" >http://FREELA.BE/L/'.$user_name_session.'</h5>--> '; /*$profile_info .= " <a onclick=\"loadPage('http://freelabel.net/submit/views/db/lead_conversion.php?leads=today', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-usd\"></span>Leads</a> <a class='btn btn-default lead_control' onclick=\"loadPage('http://freelabel.net/rssreader/cosign.php?control=update&rss=1', '#main_display_panel', 'mag')\" ><span class=\"glyphicon glyphicon-usd\"></span>RSS</a> <a class='btn btn-default lead_control schedule' onclick=\"loadWidget('schedule')\"><span class=\"glyphicon glyphicon-usd\"></span>Schedule</a> <a class='btn btn-default lead_control twitter' onclick=\"loadWidget('twitter')\"><span class=\"glyphicon glyphicon-usd\"></span>Twitter</a> <a class='btn btn-default lead_control submissions' onclick=\"loadWidget('submissions')\"><span class=\"glyphicon glyphicon-usd\"></span>Submissions</a> <a class='btn btn-default lead_control clients' onclick=\"loadWidget('clients')\"><span class=\"glyphicon glyphicon-usd\"></span>Clients</a> <a onclick=\"loadPage('http://freelabel.net/x/s.php', '#lead_widget_container', 'dashboard', 'admin')\" class='btn btn-default lead_control'><span class='glyphicon glyphicon-list-alt'></span>Script</a>";*/ /* $profile_info .= " <a onclick=\"loadPage('http://freelabel.net/submit/views/db/lead_conversion.php?leads=today', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-signal\"></span>Feed</a> <a onclick=\"loadPage('http://freelabel.net/submit/views/db/lead_conversion.php?leads=today', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-envelope\"></span>Messages</a> <a onclick=\"loadPage('http://freelabel.net/submit/views/db/lead_conversion.php?leads=today', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-envelope\"></span>Notifications</a> <a onclick=\"loadPage('http://freelabel.net/submit/views/db/lead_conversion.php?leads=today', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-music\"></span>Audio</a> <a onclick=\"loadPage('http://freelabel.net/submit/views/db/lead_conversion.php?leads=today', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-picture\"></span>Photos</a> <a onclick=\"loadPage('http://freelabel.net/submit/views/db/lead_conversion.php?leads=today', '#main_display_panel', 'dashboard', '".$user_name_session."')\" class='btn btn-default lead_control'><span class=\"glyphicon glyphicon-shopping-cart\"></span>Products</a> <a class='btn btn-default lead_control' onclick=\"loadPage('http://freelabel.net/rssreader/cosign.php?control=update&rss=1', '#main_display_panel', 'mag')\" ><span class=\"glyphicon glyphicon-calendar\"></span>Schedule</a> <a class='btn btn-default lead_control' href='http://freelabel.net/x/?i=".$user_name_session."' target='_blank' ><span class=\"glyphicon glyphicon-user\"></span>View Website</a> ";*/ $profile_info .= ' <div class="panel-body profile_default_options"> <a onclick="showPhotoOptions('.$user['user_id'].')" class=\'btn btn-default btn-xs col-md-6\' id="update_photo_button"> <span class="glyphicon glyphicon-pencil"></span>Change Default</a> <!--<a onclick="loadPage(\'http://freelabel.net/submit/views/db/user_photos.php\', \'#main_display_panel\', \'dashboard\', \''.$user_name_session.'\')" class=\'btn btn-default btn-xs col-md-6\'> <span class="glyphicon glyphicon-plus"></span>Photos</a>--> <div id=\'dashboard_navigation\' style=\'margin-top:5%;display:none;\' > <!--<a class=\'btn btn-primary\' href="http://freelabel.net/submit/" style=\'display:none;\'>Artist Control Panel</a> <a class=\'btn btn-primary\' href="edit.php">View Profile</a> <a class=\'btn btn-primary\' href="edit.php">'.WORDING_EDIT_USER_DATA.'</a> <a class=\'btn btn-danger\' href="../index.php?logout">'.WORDING_LOGOUT.'</a>--> </div> </div> <div class="edit-profile-block" style="display:none;background-color:#e3e3e3;border-radius:10px;padding:2% 1%" > <form action="http://freelabel.net/submit/updateprofile.php" method="POST" enctype="multipart/form-data" class="edit-default-form"> <span id="photo-upload-results" ></span> <input type="file" name="file" id="edit-default-photo"> <br> <input type="hidden" name="user_name" value="'.$user['user_name'].'"> <input type="hidden" name="user_id" value="'.$user['user_id'].'"> <input type="submit" value="UPDATE PHOTO" class="btn btn-primary"> </form> </div> </div>'; /*echo " <div class=''> <!--<h1 class='panel-heading'>Uploads</h1>--> <nav class='panel-body upload_buttons'> <a onclick=\"window.open('http://upload.freelabel.net/?uid=". $user_name_session. "')\" class='btn btn-success btn-lg col-md-3'> <span class=\"glyphicon glyphicon-plus\"></span>Upload</a> <a onclick=\"loadPage('http://freelabel.net/submit/views/db/user_photos.php', '#main_display_panel', 'dashboard', '". $user_name_session. "')\" class='btn btn-warning btn-lg col-md-3'> <span class=\"glyphicon glyphicon-camera\"></span>Photos</a> <a onclick=\"loadPage('http://freelabel.net/submit/views/db/recent_posts.php', '#main_display_panel', 'dashboard', '". $user_name_session. "')\" class='btn btn-warning btn-lg col-md-3'> <span class=\"glyphicon glyphicon-music\"></span>Music</a> <a onclick=\"loadPage('http://freelabel.net/submit/views/db/video_saver.php', '#recent_post_wrapper', 'dashboard', '". $user_name_session. "','','facetime-video')\" class='btn btn-warning btn-lg col-md-3'> <span class=\"glyphicon glyphicon-facetime-video\"></span>Videos</a> <!-- <a onclick=\"loadPage('http://freelabel.net/submit/views/db/recent_posts.php?control=blog&view=all#blog_posts', '#main_display_panel', 'dashboard', '". $user_name_session. "')\" class='btn btn-default btn-lg col-md-2' >All</a> <a onclick=\"loadPage('http://freelabel.net/submit/views/db/recent_posts.php?control=blog&view=all#blog_posts', '#main_display_panel', 'dashboard', '". $user_name_session. "')\" class='btn btn-default btn-lg col-md-2' >Recent</a> <a href='http://freelabel.net/?ctrl=trx&view=submissions#blog_posts' style='display:none;' class='btn btn-default btn-lg col-md-2' >Submissions</a> --> </nav> </div>";*/ echo $upload_options; echo '<div class="row user-dashboard-panel">'; echo '<div class="col-md-4 col-sm-4 dashboard-profile-details">'; echo $profile_info; echo $profile_options; echo '</div>'; echo '<div class="col-md-8 col-sm-8">'; echo '<div class="panel-body col-md-10 col-xs-10 dashboard-panel events-panel ">'; //echo '<h4 class="section_title" style="text-align:left;">Events</h4>'; echo '<div class="overflow" >'; include(ROOT.'submit/views/db/showcase_schedule.php'); echo '</div>'; echo '</div>'; echo '<div class="panel-body col-md-2 col-xs-2 dashboard-panel uploaded_singles">'; echo '<h3 class="db-details">Total Views:<h3> '.$user['stats']['total']; echo '<h3 class="db-details">Tracks:<h3> '.$user['stats']['tracks']; //echo 'Total Fans: '.$user['stats']; //$user_media = $user['media']['audio']; //include(ROOT.'submit/views/uploadedsingles.php'); echo '</div>'; echo '</div>'; echo '</div>'; // FULL ADMIN DASHBOARD PANEL $i=0; if ($user_name_session == 'admin' OR $user_name_session == 'mayoalexander' //OR $user_name_session == 'sierra' OR $user_name_session == 'sales' OR $user_name_session == 'Mia' OR $user_name_session == 'nickhustle' //OR $user_name_session == 'ghost' ) { $i=1; //echo $admin_options; } // BLOGGER DASHBOARD NAVIGATION if ($user_name_session == 'sierra' OR $user_name_session == 'siralexmayo' OR $user_name_session == 'KingMilitia' ) { $i=1; echo $blogger_options; } if ($i!=1) { echo '</div>'; } } else { /* -------------------------------------------- IF NOT EXISTING IN DATABASE, DISPLAY FORM OR SAVE FORM DATA --------------------------------------------*/ if (isset($_POST["update_profile"])) { // echo 'it worked'; // include('../../../header.php'); //echo '<pre>'; //print_r($_POST); $profile_data['id'] = $_POST['id']; $profile_data['name'] = $_POST['artist_name']; $profile_data['twitter'] = $_POST['artist_twitter']; $profile_data['location'] = $_POST['artist_location']; $profile_data['description'] = $_POST['artist_description']; $profile_data['photo'] = $_POST['photo']; $profile_data['profile_url'] = $_POST['id']; $profile_data['photo'] = $_POST['id']; $profile_data['date_created'] = $_POST['id']; $id = $_POST['id']; $artist_name = $_POST['artist_name']; $artist_twitter = $_POST['artist_twitter']; // TWITTERFIX $artist_twitter = str_replace('@@', '@', $artist_twitter); $artist_twitter = str_replace('@@@', '@', $artist_twitter); $artist_location = $_POST['artist_location']; $artist_description = $_POST['artist_description']; $photo = $_POST['photo']; $tmp_name = $_FILES["photo"]["tmp_name"]; $ext_arr = explode('.',$_FILES["photo"]["name"]); $ext_arr = array_reverse($ext_arr); $ext = $ext_arr[0]; $name = $_FILES["photo"]["name"]; $photo_path = "uploads/".$profile_data['id'].'-'.rand(1111111111,9999999999).'.'.$ext; $photo_path_save = "../../".$photo_path; $full_photo_path = "http://freelabel.net/submit/".$photo_path; //$profile_img_exists = getimagesize($full_photo_path); $profile_url = 'http://FREELA.BE/'.strtolower($profile_data['id']); //echo '<pre>'; //print_r($_FILES); //print_r($photo_path_save); //exit; move_uploaded_file($tmp_name, $photo_path_save ); // CONFIRM PROFILE //echo 'PROFILE UPDATED!'; // CREATE PROFILE include('../../../inc/connection.php'); // Insert into database $sql='INSERT INTO `amrusers`.`user_profiles` ( `id` , `name` , `twitter` , `location` , `description` , `photo`, `profile_url`, `date_created` ) VALUES ( "'.$id.'", "'.$artist_name.'", "'.$artist_twitter.'", "'.$artist_location.'", "'.$artist_description.'", "'.$full_photo_path.'", "'.$profile_url.'", "'.$todays_date.'" );'; if (mysqli_query($con,$sql)) { //echo "Entry Created Successfully!"; echo '<script> alert("Entry Created Successfully!"); window.location.assign("http://freelabel.net/users/dashboard/?ctrl=analytics"); </script>'; } else { echo "Error creating database entry: " . mysqli_error($con); } //echo '<br><br><br><br><br><br>'; } else { /* -------------------------------------------- IF NO POST DATA SENT, SHOW FORM --------------------------------------------*/ echo $profile_builder_form; //exit; } } ?> <script type="text/javascript"> $(function(){ $('.profile_builder_form').submit(function(event){ var data = $(this).seralize(); event.preventDefault(); alert(data); }); }); </script>
mayoalexander/fl-two
submit/views/db/campaign_info.php
PHP
bsd-3-clause
31,569
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=Edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>statsmodels.tsa.statespace.structural.UnobservedComponents.loglike &#8212; statsmodels 0.9.0 documentation</title> <link rel="stylesheet" href="../_static/nature.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript" src="../_static/documentation_options.js"></script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> <link rel="shortcut icon" href="../_static/statsmodels_hybi_favico.ico"/> <link rel="author" title="About these documents" href="../about.html" /> <link rel="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="next" title="statsmodels.tsa.statespace.structural.UnobservedComponents.loglikeobs" href="statsmodels.tsa.statespace.structural.UnobservedComponents.loglikeobs.html" /> <link rel="prev" title="statsmodels.tsa.statespace.structural.UnobservedComponents.initialize_stationary" href="statsmodels.tsa.statespace.structural.UnobservedComponents.initialize_stationary.html" /> <link rel="stylesheet" href="../_static/examples.css" type="text/css" /> <link rel="stylesheet" href="../_static/facebox.css" type="text/css" /> <script type="text/javascript" src="../_static/scripts.js"> </script> <script type="text/javascript" src="../_static/facebox.js"> </script> <script type="text/javascript"> $.facebox.settings.closeImage = "../_static/closelabel.png" $.facebox.settings.loadingImage = "../_static/loading.gif" </script> </head><body> <div class="headerwrap"> <div class = "header"> <a href = "../index.html"> <img src="../_static/statsmodels_hybi_banner.png" alt="Logo" style="padding-left: 15px"/></a> </div> </div> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="statsmodels.tsa.statespace.structural.UnobservedComponents.loglikeobs.html" title="statsmodels.tsa.statespace.structural.UnobservedComponents.loglikeobs" accesskey="N">next</a> |</li> <li class="right" > <a href="statsmodels.tsa.statespace.structural.UnobservedComponents.initialize_stationary.html" title="statsmodels.tsa.statespace.structural.UnobservedComponents.initialize_stationary" accesskey="P">previous</a> |</li> <li><a href ="../install.html">Install</a></li> &nbsp;|&nbsp; <li><a href="https://groups.google.com/forum/?hl=en#!forum/pystatsmodels">Support</a></li> &nbsp;|&nbsp; <li><a href="https://github.com/statsmodels/statsmodels/issues">Bugs</a></li> &nbsp;|&nbsp; <li><a href="../dev/index.html">Develop</a></li> &nbsp;|&nbsp; <li><a href="../examples/index.html">Examples</a></li> &nbsp;|&nbsp; <li><a href="../faq.html">FAQ</a></li> &nbsp;|&nbsp; <li class="nav-item nav-item-1"><a href="../statespace.html" >Time Series Analysis by State Space Methods <code class="docutils literal notranslate"><span class="pre">statespace</span></code></a> |</li> <li class="nav-item nav-item-2"><a href="statsmodels.tsa.statespace.structural.UnobservedComponents.html" accesskey="U">statsmodels.tsa.statespace.structural.UnobservedComponents</a> |</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <div class="section" id="statsmodels-tsa-statespace-structural-unobservedcomponents-loglike"> <h1>statsmodels.tsa.statespace.structural.UnobservedComponents.loglike<a class="headerlink" href="#statsmodels-tsa-statespace-structural-unobservedcomponents-loglike" title="Permalink to this headline">¶</a></h1> <dl class="method"> <dt id="statsmodels.tsa.statespace.structural.UnobservedComponents.loglike"> <code class="descclassname">UnobservedComponents.</code><code class="descname">loglike</code><span class="sig-paren">(</span><em>params</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#statsmodels.tsa.statespace.structural.UnobservedComponents.loglike" title="Permalink to this definition">¶</a></dt> <dd><p>Loglikelihood evaluation</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>params</strong> (<em>array_like</em>) – Array of parameters at which to evaluate the loglikelihood function.</li> <li><strong>transformed</strong> (<em>boolean</em><em>, </em><em>optional</em>) – Whether or not <cite>params</cite> is already transformed. Default is True.</li> <li><strong>kwargs</strong> – Additional keyword arguments to pass to the Kalman filter. See <cite>KalmanFilter.filter</cite> for more details.</li> </ul> </td> </tr> </tbody> </table> <p class="rubric">Notes</p> <p><a class="footnote-reference" href="#id2" id="id1">[1]</a> recommend maximizing the average likelihood to avoid scale issues; this is done automatically by the base Model fit method.</p> <p class="rubric">References</p> <table class="docutils footnote" frame="void" id="id2" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> <tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>Koopman, Siem Jan, Neil Shephard, and Jurgen A. Doornik. 1999. Statistical Algorithms for Models in State Space Using SsfPack 2.2. Econometrics Journal 2 (1): 107-60. doi:10.1111/1368-423X.00023.</td></tr> </tbody> </table> <div class="admonition seealso"> <p class="first admonition-title">See also</p> <dl class="last docutils"> <dt><a class="reference internal" href="statsmodels.tsa.statespace.structural.UnobservedComponents.update.html#statsmodels.tsa.statespace.structural.UnobservedComponents.update" title="statsmodels.tsa.statespace.structural.UnobservedComponents.update"><code class="xref py py-meth docutils literal notranslate"><span class="pre">update</span></code></a></dt> <dd>modifies the internal state of the state space model to reflect new params</dd> </dl> </div> </dd></dl> </div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <h4>Previous topic</h4> <p class="topless"><a href="statsmodels.tsa.statespace.structural.UnobservedComponents.initialize_stationary.html" title="previous chapter">statsmodels.tsa.statespace.structural.UnobservedComponents.initialize_stationary</a></p> <h4>Next topic</h4> <p class="topless"><a href="statsmodels.tsa.statespace.structural.UnobservedComponents.loglikeobs.html" title="next chapter">statsmodels.tsa.statespace.structural.UnobservedComponents.loglikeobs</a></p> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/generated/statsmodels.tsa.statespace.structural.UnobservedComponents.loglike.rst.txt" rel="nofollow">Show Source</a></li> </ul> </div> <div id="searchbox" style="display: none" role="search"> <h3>Quick search</h3> <div class="searchformwrapper"> <form class="search" action="../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="footer" role="contentinfo"> &#169; Copyright 2009-2017, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.4. </div> </body> </html>
statsmodels/statsmodels.github.io
0.9.0/generated/statsmodels.tsa.statespace.structural.UnobservedComponents.loglike.html
HTML
bsd-3-clause
8,947
/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 Data Differential, http://datadifferential.com/ * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * * The names of its contributors may not be used to endorse or * promote products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #pragma once #if defined(BUILDING_LIBHOSTILE) # if defined(HAVE_VISIBILITY) && HAVE_VISIBILITY # define LIBHOSTILE_API __attribute__ ((visibility("default"))) # define LIBHOSTILE_LOCAL __attribute__ ((visibility("hidden"))) # elif defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550) # define LIBHOSTILE_API __global # define LIBHOSTILE_LOCAL __global # elif defined(_MSC_VER) # define LIBHOSTILE_API extern __declspec(dllexport) # define LIBHOSTILE_LOCAL extern __declspec(dllexport) # else # define LIBHOSTILE_API # define LIBHOSTILE_LOCAL # endif /* defined(HAVE_VISIBILITY) */ #else /* defined(BUILDING_LIBHOSTILE) */ # if defined(_MSC_VER) # define LIBHOSTILE_API extern __declspec(dllimport) # define LIBHOSTILE_LOCAL # else # define LIBHOSTILE_API # define LIBHOSTILE_LOCAL # endif /* defined(_MSC_VER) */ #endif /* defined(BUILDING_LIBHOSTILE) */
libhostile/libhostile
src/visibility.h
C
bsd-3-clause
2,550
// // text_recognizer.h // STR // // Created by vampirewalk on 2015/4/14. // Copyright (c) 2015年 mocacube. All rights reserved. // #ifndef __STR__text_recognizer__ #define __STR__text_recognizer__ #include <iostream> #include <string> #include <vector> #include <opencv2/text.hpp> #include <opencv2/core/utility.hpp> #include <opencv2/highgui.hpp> #include <opencv2/imgproc.hpp> class TextRecognizer { public: TextRecognizer(){}; std::vector<std::string> recognize(std::vector<char> data); }; #endif /* defined(__STR__text_recognizer__) */
vampirewalk/gocvtext
text_recognizer.h
C
bsd-3-clause
564
/* * ArrayEntryType.h * * Created on: Nov 14, 2012 * Author: Mitchell Wills */ #ifndef ARRAYENTRYTYPE_H_ #define ARRAYENTRYTYPE_H_ #include <stdlib.h> #include <stdio.h> #ifndef _WRS_KERNEL #include <stdint.h> #endif class ArrayEntryType; #include "ArrayData.h" #include "ComplexEntryType.h" struct ArrayEntryData{ uint8_t length; EntryValue* array; }; /** * Represents the size and contents of an array. */ typedef struct ArrayEntryData ArrayEntryData; /** * Represents the type of an array entry value. */ class ArrayEntryType : public ComplexEntryType {//TODO allow for array of complex type private: NetworkTableEntryType& m_elementType; public: /** * Creates a new ArrayEntryType. * * @param id The ID which identifies this type to other nodes on * across the network. * @param elementType The type of the elements this array contains. */ ArrayEntryType(TypeId id, NetworkTableEntryType& elementType); /** * Creates a copy of an value which is of the type contained by * this array. * * @param value The element, of this array's contained type, to * copy. * @return A copy of the given value. */ EntryValue copyElement(EntryValue value); /** * Deletes a entry value which is of the type contained by * this array. * * After calling this method, the given entry value is * no longer valid. * * @param value The value to delete. */ void deleteElement(EntryValue value); /** * See {@link NetworkTableEntryType}::sendValue */ void sendValue(EntryValue value, DataIOStream& os); /** * See {@link NetworkTableEntryType}::readValue */ EntryValue readValue(DataIOStream& is); /** * See {@link NetworkTableEntryType}::copyValue */ EntryValue copyValue(EntryValue value); /** * See {@link NetworkTableEntryType}::deleteValue */ void deleteValue(EntryValue value); /** * See {@link ComplexEntryType}::internalizeValue */ EntryValue internalizeValue(std::string& key, ComplexData& externalRepresentation, EntryValue currentInteralValue); /** * See {@link ComplexEntryType}::exportValue */ void exportValue(std::string& key, EntryValue internalData, ComplexData& externalRepresentation); }; #endif /* ARRAYENTRYTYPE_H_ */
anidev/networktables-pc
networktables2/type/ArrayEntryType.h
C
bsd-3-clause
2,420
#!/usr/bin/env python import sys def inv(s): if s[0] == '-': return s[1:] elif s[0] == '+': return '-' + s[1:] else: # plain number return '-' + s if len(sys.argv) != 1: print 'Usage:', sys.argv[0] sys.exit(1) for line in sys.stdin: linesplit = line.strip().split() if len(linesplit) == 3: assert(linesplit[0] == 'p') print('p ' + inv(linesplit[2]) + ' ' + linesplit[1]) elif len(linesplit) == 5: assert(linesplit[0] == 's') print('s ' + \ inv(linesplit[2]) + ' ' + linesplit[1] + ' ' + \ inv(linesplit[4]) + ' ' + linesplit[3] ) elif len(linesplit) == 0: print
hlzz/dotfiles
graphics/cgal/Segment_Delaunay_graph_Linf_2/developer_scripts/lsprotate90.py
Python
bsd-3-clause
636
def test_default(cookies): """ Checks if default configuration is working """ result = cookies.bake() assert result.exit_code == 0 assert result.project.isdir() assert result.exception is None
vchaptsev/cookiecutter-django-vue
tests/test_generation.py
Python
bsd-3-clause
222
// Test for "sancov.py missing ...". // First case: coverage from executable. main() is called on every code path. // RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s -o %t -DFOOBAR -DMAIN // RUN: rm -rf %t-dir // RUN: mkdir -p %t-dir // RUN: cd %t-dir // RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t // RUN: %sancov print *.sancov > main.txt // RUN: rm *.sancov // RUN: count 1 < main.txt // RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t x // RUN: %sancov print *.sancov > foo.txt // RUN: rm *.sancov // RUN: count 3 < foo.txt // RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t x x // RUN: %sancov print *.sancov > bar.txt // RUN: rm *.sancov // RUN: count 4 < bar.txt // RUN: %sancov missing %t < foo.txt > foo-missing.txt // RUN: sort main.txt foo-missing.txt -o foo-missing-with-main.txt // The "missing from foo" set may contain a few bogus PCs from the sanitizer // runtime, but it must include the entire "bar" code path as a subset. Sorted // lists can be tested for set inclusion with diff + grep. // RUN: diff bar.txt foo-missing-with-main.txt > %t.log || true // RUN: not grep "^<" %t.log // Second case: coverage from DSO. // cd %t-dir // RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s -o %dynamiclib -DFOOBAR -shared -fPIC // RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s %dynamiclib -o %t -DMAIN // RUN: cd .. // RUN: rm -rf %t-dir // RUN: mkdir -p %t-dir // RUN: cd %t-dir // RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t x // RUN: %sancov print %xdynamiclib_filename.*.sancov > foo.txt // RUN: rm *.sancov // RUN: count 2 < foo.txt // RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir %run %t x x // RUN: %sancov print %xdynamiclib_filename.*.sancov > bar.txt // RUN: rm *.sancov // RUN: count 3 < bar.txt // RUN: %sancov missing %dynamiclib < foo.txt > foo-missing.txt // RUN: diff bar.txt foo-missing.txt > %t.log || true // RUN: not grep "^<" %t.log // REQUIRES: x86-target-arch // XFAIL: android #include <stdio.h> void foo1(); void foo2(); void bar1(); void bar2(); void bar3(); #if defined(FOOBAR) void foo1() { fprintf(stderr, "foo1\n"); } void foo2() { fprintf(stderr, "foo2\n"); } void bar1() { fprintf(stderr, "bar1\n"); } void bar2() { fprintf(stderr, "bar2\n"); } void bar3() { fprintf(stderr, "bar3\n"); } #endif #if defined(MAIN) int main(int argc, char **argv) { switch (argc) { case 1: break; case 2: foo1(); foo2(); break; case 3: bar1(); bar2(); bar3(); break; } } #endif
youtube/cobalt
third_party/llvm-project/compiler-rt/test/asan/TestCases/Linux/coverage-missing.cc
C++
bsd-3-clause
2,574
# Copyright (c) 2014-2015 Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # 3. Neither the name of the copyright holder nor the names of its # contributors may be used to endorse or promote products derived from this # software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. obj-y += dwc_otg_adp.o obj-y += dwc_otg_cfi.o obj-y += dwc_otg_cil.o obj-y += dwc_otg_cil_intr.o obj-y += dwc_otg_driver.o obj-y += dwc_common_phabos.o obj-$(CONFIG_USB_HOST) += dwc_otg_hcd.o obj-$(CONFIG_USB_HOST) += dwc_otg_hcd_ddma.o obj-$(CONFIG_USB_HOST) += dwc_otg_hcd_intr.o obj-$(CONFIG_USB_HOST) += dwc_otg_hcd_queue.o obj-$(CONFIG_USB_DEVICE) += dwc_otg_pcd.o obj-$(CONFIG_USB_DEVICE) += dwc_otg_pcd_intr.o CFLAGS += -DDWC_PHABOS ifeq ($(CONFIG_USB_DWC2_DEBUG),y) CFLAGS += -DDEBUG endif ifeq ($(CONFIG_USB_DEVICE),y) ifneq ($(CONFIG_USB_HOST),y) CFLAGS += -DDWC_DEVICE_ONLY endif endif
mtitinger/phabos
drivers/usb/dwc2/Makefile
Makefile
bsd-3-clause
2,133
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__char_environment_w32_spawnv_61b.c Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-61b.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: environment Read input from an environment variable * GoodSource: Fixed string * Sinks: w32_spawnv * BadSink : execute command with spawnv * Flow Variant: 61 Data flow: data returned from one function to another in different source files * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define COMMAND_INT_PATH "%WINDIR%\\system32\\cmd.exe" #define COMMAND_INT "cmd.exe" #define COMMAND_ARG1 "/c" #define COMMAND_ARG2 "dir " #define COMMAND_ARG3 data #else /* NOT _WIN32 */ #include <unistd.h> #define COMMAND_INT_PATH "/bin/sh" #define COMMAND_INT "sh" #define COMMAND_ARG1 "-c" #define COMMAND_ARG2 "ls " #define COMMAND_ARG3 data #endif #define ENV_VARIABLE "ADD" #ifdef _WIN32 #define GETENV getenv #else #define GETENV getenv #endif #include <process.h> #ifndef OMITBAD char * CWE78_OS_Command_Injection__char_environment_w32_spawnv_61b_badSource(char * data) { { /* Append input from an environment variable to data */ size_t dataLen = strlen(data); char * environment = GETENV(ENV_VARIABLE); /* If there is data in the environment variable */ if (environment != NULL) { /* POTENTIAL FLAW: Read data from an environment variable */ strncat(data+dataLen, environment, 100-dataLen-1); } } return data; } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B() uses the GoodSource with the BadSink */ char * CWE78_OS_Command_Injection__char_environment_w32_spawnv_61b_goodG2BSource(char * data) { /* FIX: Append a fixed string to data (not user / external input) */ strcat(data, "*.*"); return data; } #endif /* OMITGOOD */
JianpingZeng/xcc
xcc/test/juliet/testcases/CWE78_OS_Command_Injection/s03/CWE78_OS_Command_Injection__char_environment_w32_spawnv_61b.c
C
bsd-3-clause
2,024
#region License Header // /******************************************************************************* // * Open Behavioral Health Information Technology Architecture (OBHITA.org) // * // * Redistribution and use in source and binary forms, with or without // * modification, are permitted provided that the following conditions are met: // * * Redistributions of source code must retain the above copyright // * notice, this list of conditions and the following disclaimer. // * * Redistributions in binary form must reproduce the above copyright // * notice, this list of conditions and the following disclaimer in the // * documentation and/or other materials provided with the distribution. // * * Neither the name of the <organization> nor the // * names of its contributors may be used to endorse or promote products // * derived from this software without specific prior written permission. // * // * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND // * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> 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. // ******************************************************************************/ #endregion namespace ProCenter.Domain.Psc { #region Using Statements using System; using Pillar.FluentRuleEngine; using ProCenter.Domain.AssessmentModule; using ProCenter.Domain.AssessmentModule.Rules; #endregion /// <summary>The PediatricSymptonChecklistRuleCollection rule collection class.</summary> public class PediatricSymptonChecklistRuleCollection : AbstractAssessmentRuleCollection { private readonly IAssessmentDefinitionRepository _assessmentDefinitionRepository; private static Guid? _pediatricSymptomCheckListAssessmentDefinitionKey; #region Constructors and Destructors /// <summary>Initializes a new instance of the <see cref="PediatricSymptonChecklistRuleCollection" /> class.</summary> /// <param name="assessmentDefinitionRepository">The assessment definition repository.</param> public PediatricSymptonChecklistRuleCollection(IAssessmentDefinitionRepository assessmentDefinitionRepository) { _assessmentDefinitionRepository = assessmentDefinitionRepository; NewItemSkippingRule(() => SkipItem71250040) .ForItemInstance<bool>("71250039") .EqualTo(false) .SkipItem(GetItemDefinition("71250040")); NewRuleSet(() => ItemUpdatedRuleSet71250039, SkipItem71250040); } #endregion #region Public Properties /// <summary> /// Gets or sets the skip item71250040. /// </summary> /// <value> /// The skip item71250040. /// </value> public IItemSkippingRule SkipItem71250040 { get; set; } /// <summary> /// Gets or sets the item updated rule set71250039. /// </summary> /// <value> /// The item updated rule set71250039. /// </value> public IRuleSet ItemUpdatedRuleSet71250039 { get; set; } #endregion /// <summary> /// Gets the item definition. /// </summary> /// <param name="itemDefinitionCode">The item definition code.</param> /// <returns>Returns and ItemDefinition for the itemDefinitionCode if found by key.</returns> private ItemDefinition GetItemDefinition(string itemDefinitionCode) { if (!_pediatricSymptomCheckListAssessmentDefinitionKey.HasValue) { _pediatricSymptomCheckListAssessmentDefinitionKey = _assessmentDefinitionRepository.GetKeyByCode(PediatricSymptonChecklist.AssessmentCodedConcept.Code); } var assessmentDefinition = _assessmentDefinitionRepository.GetByKey(_pediatricSymptomCheckListAssessmentDefinitionKey.Value); return assessmentDefinition.GetItemDefinitionByCode(itemDefinitionCode); } } }
OBHITA/PROCenter
ProCenter.Domain.Psc/PediatricSymptonChecklistRuleCollection.cs
C#
bsd-3-clause
4,652
/* * Copyright Matt Palmer 2011-2013, All rights reserved. * * This code is licensed under a standard 3-clause BSD license: * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * * The names of its contributors may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ package net.byteseek.searcher.sequence.sunday; import java.io.IOException; import java.util.Arrays; import java.util.List; import net.byteseek.io.reader.Window; import net.byteseek.io.reader.WindowReader; import net.byteseek.matcher.bytes.ByteMatcher; import net.byteseek.matcher.sequence.SequenceMatcher; import net.byteseek.object.factory.DoubleCheckImmutableLazyObject; import net.byteseek.object.factory.LazyObject; import net.byteseek.object.factory.ObjectFactory; import net.byteseek.searcher.SearchResult; import net.byteseek.searcher.SearchUtils; import net.byteseek.searcher.sequence.AbstractSequenceSearcher; /** * * @author Matt Palmer */ public final class SundayQuickSearcher extends AbstractSequenceSearcher { private final LazyObject<int[]> forwardInfo; private final LazyObject<int[]> backwardInfo; /** * Constructs a Sunday Quick searcher given a {@link SequenceMatcher} * to search for. * * @param sequence The sequence to search for. */ public SundayQuickSearcher(final SequenceMatcher sequence) { super(sequence); forwardInfo = new DoubleCheckImmutableLazyObject<int[]>(new ForwardInfoFactory()); backwardInfo = new DoubleCheckImmutableLazyObject<int[]>(new BackwardInfoFactory()); } /** * {@inheritDoc} */ @Override public List<SearchResult<SequenceMatcher>> searchForwards(final byte[] bytes, final int fromPosition, final int toPosition) { // Get the objects needed to search: final int[] safeShifts = forwardInfo.get(); final SequenceMatcher sequence = getMatcher(); // Calculate safe bounds for the search: final int length = sequence.length(); final int finalPosition = bytes.length - length; final int lastLoopPosition = finalPosition - 1; final int lastPosition = toPosition < lastLoopPosition? toPosition : lastLoopPosition; int searchPosition = fromPosition > 0? fromPosition : 0; // Search forwards. The loop does not check for the final // position, as we shift on the byte after the sequence. while (searchPosition <= lastPosition) { if (sequence.matchesNoBoundsCheck(bytes, searchPosition)) { return SearchUtils.singleResult(searchPosition, sequence); } searchPosition += safeShifts[bytes[searchPosition + length] & 0xFF]; } // Check the final position if necessary: if (searchPosition == finalPosition && toPosition >= finalPosition && sequence.matches(bytes, finalPosition)) { return SearchUtils.singleResult(finalPosition, sequence); } return SearchUtils.noResults(); } /** * {@inheritDoc} */ @Override public List<SearchResult<SequenceMatcher>> doSearchForwards(final WindowReader reader, final long fromPosition, final long toPosition ) throws IOException { // Initialise final int[] safeShifts = forwardInfo.get(); final SequenceMatcher sequence = getMatcher(); final int length = sequence.length(); long searchPosition = fromPosition; // While there is a window to search in... // If there is no window immediately after the sequence, // then there is no match, since this is only invoked if the // sequence is already crossing into another window. Window window; while (searchPosition <= toPosition && (window = reader.getWindow(searchPosition + length)) != null) { // Initialise array search: final byte[] array = window.getArray(); final int arrayStartPosition = reader.getWindowOffset(searchPosition + length); final int arrayEndPosition = window.length() - 1; final long distanceToEnd = toPosition - window.getWindowPosition() + length ; final int finalPosition = distanceToEnd < arrayEndPosition? (int) distanceToEnd : arrayEndPosition; int arraySearchPosition = arrayStartPosition; // Search fowards in the array using the reader interface to match. // The loop does not check the final position, as we shift on the byte // after the sequence (so would get an IndexOutOfBoundsException in the final position). while (arraySearchPosition < finalPosition) { if (sequence.matches(reader, searchPosition)) { return SearchUtils.singleResult(searchPosition, sequence); } final int shift = safeShifts[array[arraySearchPosition] & 0xFF]; searchPosition += shift; arraySearchPosition += shift; } // Check final position if necessary: if (arraySearchPosition == finalPosition || searchPosition == toPosition) { if (sequence.matches(reader, searchPosition)) { return SearchUtils.singleResult(searchPosition, sequence); } searchPosition += safeShifts[array[arraySearchPosition] & 0xFF]; } } return SearchUtils.noResults(); } /** * {@inheritDoc} */ @Override public List<SearchResult<SequenceMatcher>> searchBackwards(final byte[] bytes, final int fromPosition, final int toPosition) { // Get objects needed to search: final int[] safeShifts = backwardInfo.get(); final SequenceMatcher sequence = getMatcher(); // Calculate safe bounds for the search: final int lastLoopPosition = toPosition > 1? toPosition : 1; final int firstPossiblePosition = bytes.length - sequence.length(); int searchPosition = fromPosition < firstPossiblePosition ? fromPosition : firstPossiblePosition; // Search backwards. The loop does not check the // first position in the array, because we shift on the byte // immediately before the current search position. while (searchPosition >= lastLoopPosition) { if (sequence.matchesNoBoundsCheck(bytes, searchPosition)) { return SearchUtils.singleResult(searchPosition, sequence); } searchPosition -= safeShifts[bytes[searchPosition - 1] & 0xFF]; } // Check for first position if necessary: if (searchPosition == 0 && toPosition < 1 && sequence.matches(bytes, 0)) { return SearchUtils.singleResult(0, sequence); } return SearchUtils.noResults(); } /** * {@inheritDoc} */ @Override public List<SearchResult<SequenceMatcher>> doSearchBackwards(final WindowReader reader, final long fromPosition, final long toPosition ) throws IOException { // Initialise final int[] safeShifts = forwardInfo.get(); final SequenceMatcher sequence = getMatcher(); long searchPosition = fromPosition; // While there is a window to search in... // If there is no window immediately before the sequence, // then there is no match, since this is only invoked if the // sequence is already crossing into another window. Window window; while (searchPosition >= toPosition && (window = reader.getWindow(searchPosition - 1)) != null) { // Initialise array search: final byte[] array = window.getArray(); final int arrayStartPosition = reader.getWindowOffset(searchPosition - 1); // Search to the beginning of the array, or the final search position, // whichver comes first. final long endRelativeToWindow = toPosition - window.getWindowPosition(); final int arrayEndSearchPosition = endRelativeToWindow > 0? (int) endRelativeToWindow : 0; int arraySearchPosition = arrayStartPosition; // Search backwards in the array using the reader interface to match. // The loop does not check the final position, as we shift on the byte // before it. while (arraySearchPosition > arrayEndSearchPosition) { if (sequence.matches(reader, searchPosition)) { return SearchUtils.singleResult(searchPosition, sequence); } final int shift = safeShifts[array[arraySearchPosition] & 0xFF]; searchPosition -= shift; arraySearchPosition -= shift; } // Check final position if necessary: if (arraySearchPosition == arrayEndSearchPosition || searchPosition == toPosition) { if (sequence.matches(reader, searchPosition)) { return SearchUtils.singleResult(searchPosition, sequence); } searchPosition -= safeShifts[array[arraySearchPosition] & 0xFF]; } } return SearchUtils.noResults(); } /** * {@inheritDoc} */ @Override public void prepareForwards() { forwardInfo.get(); } /** * {@inheritDoc} */ @Override public void prepareBackwards() { backwardInfo.get(); } @Override public String toString() { return getClass().getSimpleName() + "[sequence:" + matcher + ']'; } private final class ForwardInfoFactory implements ObjectFactory<int[]> { private ForwardInfoFactory() { } /** * Calculates the safe shifts to use if searching forwards. * A safe shift is either the length of the sequence plus one, if the * byte does not appear in the {@link SequenceMatcher}, or * the shortest distance it appears from the end of the matcher. */ @Override public int[] create() { // First set the default shift to the length of the sequence plus one. final int[] shifts = new int[256]; final SequenceMatcher sequence = getMatcher(); final int numBytes = sequence.length(); Arrays.fill(shifts, numBytes + 1); // Now set specific byte shifts for the bytes actually in // the sequence itself. The shift is the distance of each character // from the end of the sequence, where the last position equals 1. // Each position can match more than one byte (e.g. if a byte class appears). for (int sequenceByteIndex = 0; sequenceByteIndex < numBytes; sequenceByteIndex++) { final ByteMatcher aMatcher = sequence.getMatcherForPosition(sequenceByteIndex); final byte[] matchingBytes = aMatcher.getMatchingBytes(); final int distanceFromEnd = numBytes - sequenceByteIndex; for (final byte b : matchingBytes) { shifts[b & 0xFF] = distanceFromEnd; } } return shifts; } } private final class BackwardInfoFactory implements ObjectFactory<int[]> { private BackwardInfoFactory() { } /** * Calculates the safe shifts to use if searching backwards. * A safe shift is either the length of the sequence plus one, if the * byte does not appear in the {@link SequenceMatcher}, or * the shortest distance it appears from the beginning of the matcher. */ @Override public int[] create() { // First set the default shift to the length of the sequence // (negative if search direction is reversed) final int[] shifts = new int[256]; final SequenceMatcher sequence = getMatcher(); final int numBytes = sequence.length(); Arrays.fill(shifts, numBytes + 1); // Now set specific byte shifts for the bytes actually in // the sequence itself. The shift is the distance of each character // from the start of the sequence, where the first position equals 1. // Each position can match more than one byte (e.g. if a byte class appears). for (int sequenceByteIndex = numBytes - 1; sequenceByteIndex >= 0; sequenceByteIndex--) { final ByteMatcher aMatcher = sequence.getMatcherForPosition(sequenceByteIndex); final byte[] matchingBytes = aMatcher.getMatchingBytes(); final int distanceFromStart = sequenceByteIndex + 1; for (final byte b : matchingBytes) { shifts[b & 0xFF] = distanceFromStart; } } return shifts; } } }
uzen/byteseek
src/net/byteseek/searcher/sequence/sunday/SundayQuickSearcher.java
Java
bsd-3-clause
14,817
# `pub.dev` API for developers ## Stay informed This document describes the officially supported API of the `pub.dev` site. `pub.dev` may expose API endpoints that are available publicly, but unless they are documented here, we don't consider them as officially supported, and may change or remove them without notice. Changes to the officially supported `pub.dev` API will be announced at [Dart announce][announce]. ## Hosted Pub Repository API `pub.dev` implements the [Hosted Pub Repository Specification V2][repo-v2], used by the `pub` command line client application. ## Additional APIs ### Package names for name completion **GET** `https://pub.dev/api/package-name-completion-data` **Headers:** * `accept-encoding: gzip` **Response** * `cache-control: public, max-age=28800` * `content-encoding: gzip` * `content-type: application/json; charset="utf-8"` ```js { "packages": [ "http", "provider", /* further package names */ ] } ``` The API returns the top package names on `pub.dev`. To reduce payload size the result may not include all package names. The size limitation is subject to change. The response is always a gzip-ed JSON content, and should be cached on the client side for at least 8 hours between requests (as indicated by the `cache-control` header). Notes: * Not all package names are included in this response. * The inclusion criteria used by `pub.dev` may change without notice. ## FAQ ### I'd like to implement search, what API can I use? Please use the above [package names for name completion data](#package-names-for-name-completion) to fetch the list of package names, and implement search in your app based on that list. ### I'd like to request a new API. What should I do? Please check if there is already a similar request or open a [new issue][pub-dev-issues]. The following requirements are must have for an API endpoint to be considered as official: * The data must be public. * The API must be without side effects (e.g. read-only). * The response must be cacheable (e.g. we should be able to offload it to a CDN). [announce]: https://groups.google.com/a/dartlang.org/g/announce [repo-v2]: https://github.com/dart-lang/pub/blob/master/doc/repository-spec-v2.md [pub-dev-issues]: https://github.com/dart-lang/pub-dev/issues
dart-lang/pub-dev
doc/api.md
Markdown
bsd-3-clause
2,303
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; use app\models\general\GeneralLabel; /* @var $this yii\web\View */ /* @var $model app\models\RefPemohonJaringanAntarabangsa */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="ref-pemohon-jaringan-antarabangsa-form"> <p class="text-muted"><span style="color: red">*</span> <?= GeneralLabel::lapangan_mandatori ?></p> <?php $form = ActiveForm::begin(); ?> <?= $form->field($model, 'desc')->textInput(['maxlength' => true]) ?> <?php $model->isNewRecord ? $model->aktif = 1: $model->aktif = $model->aktif ; ?> <?= $form->field($model, 'aktif')->radioList(array(true=>GeneralLabel::yes,false=>GeneralLabel::no)); ?> <div class="form-group"> <?= Html::submitButton($model->isNewRecord ? GeneralLabel::create : GeneralLabel::update, ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> </div> <?php ActiveForm::end(); ?> </div>
hung101/kbs
frontend/views/ref-pemohon-jaringan-antarabangsa/_form.php
PHP
bsd-3-clause
982
#! /usr/bin/perl # # configure.pl (bootstrap cgixx) # Use on *nix platforms. # # cgixx CGI C++ Class Library # Copyright (C) 2002-2004 Isaac W. Foraker (isaac at noscience dot net) # All Rights Reserved # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the # distribution. # # 3. Neither the name of the Author nor the names of its contributors # may be used to endorse or promote products derived from this # software without specific prior written permission. # # THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE AUTHOR AND # CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # Most of this code is plagerized from configure.pl, written by Peter J Jones # for use in clo++, and uses Peter's cxxtools. ##### # Includes use strict; use Getopt::Long; use Cwd qw(cwd chdir); ##### # Constants use constant DATE => 'Thu May 10 4:44:54 2002'; use constant ID => '$Id$'; ##### # Global Variables my $cwd = cwd(); my %clo; # Possible names for the compiler my @cxx_guess = qw(g++ c++ CC cl bcc32); my $mkmf = "${cwd}/tools/mkmf"; my $cxxflags = "${cwd}/tools/cxxflags"; my $mkmf_flags = "--cxxflags '$cxxflags' --quiet "; my $libname = "cgixx"; my $install_spec= "doc/install.spec"; my $includes = "--include '${cwd}/inc' "; my $libraries = "--slinkwith '${cwd}/src,$libname' "; my @compile_dirs = ( "${cwd}/src", "${cwd}/test" ); ##### # Code Start $|++; GetOptions( \%clo, 'help', 'bundle', 'developer', 'prefix=s', 'bindir=s', 'incdir=s', 'libdir=s', 'cxx=s' ) or usage(); $clo{'help'} && usage(); sub usage { print "Usage: $0 [options]\n", <<EOT; --developer Turn on developer mode --prefix path Set the install prefix to path [/usr/local] --bindir path Set the install bin dir to path [PREFIX/bin] --incdir path Set the install inc dir to path [PREFIX/inc] --libdir path Set the install lib dir to path [PREFIX/lib] EOT exit; } $clo{'prefix'} ||= "/usr/local"; $clo{'bindir'} ||= "$clo{'prefix'}/bin"; $clo{'incdir'} ||= "$clo{'prefix'}/include"; $clo{'libdir'} ||= "$clo{'prefix'}/lib"; print "Configuring cgixx...\n"; if ($clo{'developer'}) { print "Developer extensions... enabled\n"; $mkmf_flags .= "--developer "; } ##### # Determine C++ compiler settings $clo{'cxx'} ||= $ENV{'CXX'}; if (not $clo{'cxx'}) { print "Checking C++ compiler... "; my $path; # search for a compiler foreach (@cxx_guess) { if ($path = search_path($_)) { $clo{'cxx'} = "$path/$_"; last; } } if ($clo{'cxx'}) { print "$clo{'cxx'}\n"; } else { print <<EOT; Not found. You must specify your C++ compiler with the --cxx parameter or by setting the CXX environment variable. EOT exit; } } else { print "Using C++ compiler... $clo{'cxx'}\n"; } print "Generating cgixx Makefiles "; generate_toplevel_makefile(); generate_library_makefile(); generate_tests_makefile(); print "\n"; if (!$clo{'bundle'}) { print "\n"; print "Install Prefix: $clo{'prefix'}\n"; print "Binary Install Path: $clo{'bindir'}\n"; print "Includes Install Path: $clo{'incdir'}\n"; print "Libraries Install Path: $clo{'libdir'}\n"; print "\n"; print <<EOT; =============================================================================== Configuration complete. To build, type: make To install, type: make install =============================================================================== EOT } sub generate_toplevel_makefile { unless (open(SPEC, ">$install_spec")) { print STDERR "\n$0: can't open $install_spec: $!\n"; exit 1; } print SPEC "libdir=$clo{'libdir'}\n"; print SPEC "static-lib src cgixx\n"; print SPEC "includedir=$clo{'incdir'}\n"; print SPEC "include-dir inc/cgixx cgixx\n"; close SPEC; system("$^X $mkmf $mkmf_flags --install $install_spec --wrapper @compile_dirs"); print "."; } sub generate_library_makefile { if (not chdir("$cwd/src")) { print STDERR "\n$0: can't chdir to src: $!\n"; exit 1; } system("$^X $mkmf $mkmf_flags $includes --static-lib $libname *.cxx"); print "."; chdir $cwd; } sub generate_tests_makefile { unless (chdir("$cwd/test")) { print STDERR "\n$0: can't chdir $cwd/test: $!\n"; exit 1; } system("$^X $mkmf $mkmf_flags $includes $libraries --quiet --many-exec *.cxx"); print "."; chdir $cwd; } # Search the path for the specified program. sub search_path { my $prog = shift; # Determine search paths my $path = $ENV{'PATH'} || $ENV{'Path'} || $ENV{'path'}; my @paths = split /[;| |:]/, $path; my $ext = $^O =~ /win/i ? '.exe' : ''; foreach (@paths) { if (-e "$_/$prog$ext") { return $_; } } return undef; }
codemer/cgixx
configure.pl
Perl
bsd-3-clause
5,698
#!/usr/bin/env python # -*- mode: python; sh-basic-offset: 4; indent-tabs-mode: nil; coding: utf-8 -*- # vim: tabstop=4 softtabstop=4 expandtab shiftwidth=4 fileencoding=utf-8 # # Shell command # Copyright 2010, Jeremy Grosser <[email protected]> import argparse import os import sys import clusto from clusto import script_helper class Console(script_helper.Script): ''' Use clusto's hardware port mappings to console to a remote server using the serial console. ''' def __init__(self): script_helper.Script.__init__(self) def _add_arguments(self, parser): user = os.environ.get('USER') parser.add_argument('--user', '-u', default=user, help='SSH User (you can also set this in clusto.conf too' 'in console.user: --user > clusto.conf:console.user > "%s")' % user) parser.add_argument('server', nargs=1, help='Object to console to (IP or name)') def add_subparser(self, subparsers): parser = self._setup_subparser(subparsers) self._add_arguments(parser) def run(self, args): try: server = clusto.get(args.server[0]) if not server: raise LookupError('Object "%s" does not exist' % args.server) except Exception as e: self.debug(e) self.error('No object like "%s" was found' % args.server) return 1 server = server[0] if not hasattr(server, 'console'): self.error('The object %s lacks a console method' % server.name) return 2 user = os.environ.get('USER') if args.user: self.debug('Grabbing user from parameter') user = args.user else: self.debug('Grabbing user from config file or default') user = self.get_conf('console.user', user) self.debug('User is "%s"' % user) return(server.console(ssh_user=user)) def main(): console, args = script_helper.init_arguments(Console) return(console.run(args)) if __name__ == '__main__': sys.exit(main())
sanyaade-mobiledev/clusto
src/clusto/commands/console.py
Python
bsd-3-clause
2,107
/** * Copyright (c) 2013, impossibl.com * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of impossibl.com nor the names of its contributors may * be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ package com.impossibl.postgres.system.procs; /** * Marker interface for dynamically loaded postgis data types, to be used by {@link ServiceLoader}. */ public interface OptionalProcProvider extends ProcProvider { }
frode-carlsen/pgjdbc-ng
src/main/java/com/impossibl/postgres/system/procs/OptionalProcProvider.java
Java
bsd-3-clause
1,789
// // $Id$ package org.ductilej.tests; import org.junit.Test; import static org.junit.Assert.*; /** * Tests handling of varags with parameterized variable argument. Edge case extraordinaire! */ public class ParamVarArgsTest { public static interface Predicate<T> { boolean apply (T arg); } public static <T> Predicate<T> or (final Predicate<? super T>... preds) { return new Predicate<T>() { public boolean apply (T arg) { for (Predicate<? super T> pred : preds) { if (pred.apply(arg)) { return true; } } return false; } }; } @SuppressWarnings("unchecked") // this use of parameterized varargs is safe @Test public void testParamVarArgs () { Predicate<Integer> test = or(FALSE); assertEquals(false, test.apply(1)); } protected static final Predicate<Integer> FALSE = new Predicate<Integer>() { public boolean apply (Integer arg) { return false; } }; }
scaladyno/ductilej
src/test/java/org/ductilej/tests/ParamVarArgsTest.java
Java
bsd-3-clause
1,100
package ga; import engine.*; import java.util.*; public class GAPopulation { /* Evolutionary parameters: */ public int size; // size of the population public int ngens; // total number of generations public int currgen; // current generation /* Crossover parameters */ int tournamentK; // size of tournament int elite; // size of elite int immigrant; // number of new random individuals double mutrate; // chance that a mutation will occur double xoverrate; // chance that the xover will occur /* Containers */ public ArrayList<Genome> individual; Genome parent; Trainer T; /* Progress data */ public double[] max_fitness; public double[] avg_fitness; public double[] terminals; // average total number of terminals public double[] bigterminals; // average total number of sig. terminals /** * Initialize and load parameters. * Parameter comp is a node from a previous * scenario, which is used for distance calculations. */ public GAPopulation(Genome comp) { individual = new ArrayList<Genome>(); parent = comp; // reading parameters Parameter param = Parameter.getInstance(); String paramval; paramval = param.getParam("population size"); if (paramval != null) size = Integer.valueOf(paramval); else { System.err.println("\"population size\" not defined on parameter file."); size = 10; } paramval = param.getParam("generation number"); if (paramval != null) ngens = Integer.valueOf(paramval); else { System.err.println("\"generation number\" not defined on parameter file."); ngens = 10; } paramval = param.getParam("tournament K"); if (paramval != null) tournamentK = Integer.valueOf(paramval); else { System.err.println("\"tournament K\" not defined on parameter file."); tournamentK = 5; } paramval = param.getParam("elite size"); if (paramval != null) elite = Integer.valueOf(paramval); else { System.err.println("\"elite size\" not defined on parameter file."); elite = 1; } paramval = param.getParam("immigrant size"); if (paramval != null) immigrant = Integer.valueOf(paramval); else { System.err.println("\"immigrant size\" not defined on parameter file."); immigrant = 0;; } paramval = param.getParam("mutation rate"); if (paramval != null) mutrate = Double.valueOf(paramval); else { System.err.println("\"mutation rate\" not defined on parameter file."); mutrate = 0.01; } paramval = param.getParam("crossover rate"); if (paramval != null) xoverrate = Double.valueOf(paramval); else { System.err.println("\"crossover rate\" not defined on parameter file."); xoverrate = 0.9; } } /** * Initialize the new population and the local * variables. Startd is the target date for the * @param startd */ public void initPopulation(Date startd) { T = new Trainer(startd); currgen = 0; for (int i = 0; i < size; i++) { Genome n = new Genome(); n.init(); individual.add(n); } max_fitness = new double[ngens]; avg_fitness = new double[ngens]; terminals = new double[ngens]; bigterminals = new double[ngens]; } /** * Runs one generation loop * */ public void runGeneration() { eval(); breed(); currgen++; } /** * update the values of the maxfitness/avg fitness/etc * public arrays; */ public void updateStatus() { Parameter p = Parameter.getInstance(); String param = p.getParam("asset treshold"); double tresh = Double.valueOf(param); avg_fitness[currgen-1] = 0; terminals[currgen-1] = 0; bigterminals[currgen-1] = 0; for (int i = 0; i < individual.size(); i++) { avg_fitness[currgen-1] += individual.get(i).fitness; terminals[currgen-1] += individual.get(i).countAsset(0.0); bigterminals[currgen-1] += individual.get(i).countAsset(tresh); } max_fitness[currgen-1] = individual.get(0).fitness; avg_fitness[currgen-1] /= size; terminals[currgen-1] /= size; bigterminals[currgen-1] /= size; } /** * Calculates the fitness value for each individual * in the population. */ public void eval() { for (int i = 0; i < size; i++) { individual.get(i).eval(T); } Collections.sort(individual); } /** * Perform selection, crossover, mutation in * order to create a new population. * * Assumes the eval function has already been * performed. * */ public void breed() { RNG d = RNG.getInstance(); ArrayList<Genome> nextGen = new ArrayList<Genome>(); Genome p1,p2; // elite: (few copied individuals) for (int i = 0; i < elite; i++) { nextGen.add(individual.get(i).copy()); } // immigrant: (usually 0) for (int i = 0; i < immigrant; i++) { Genome n = new Genome(); n.init(); nextGen.add(n); } // crossover: for (int i = 0; i < size - (immigrant + elite); i+=2) { // selection - the selection function should // return copies already. p1 = Tournament(); p2 = Tournament(); // rolls for xover if (d.nextDouble() < xoverrate) { p1.crossover(p2); } // rolls for mutation if (d.nextDouble() < mutrate) p1.mutation(); if (d.nextDouble() < mutrate) p2.mutation(); nextGen.add(p1); nextGen.add(p2); } individual = nextGen; } /** * Select one parent from the population by using * fitness-proportional tournament selection * (eat candidate has a chance proportional to his * fitness of being chosen). * * The function copy the chosen candidate and send * him back. * @return */ public Genome Tournament() { RNG d = RNG.getInstance(); Genome[] list = new Genome[tournamentK]; double[] rank = new double[tournamentK]; double sum = 0.0; double ticket = 0.0; double min = 0.0; /* Selects individuals and removes negative fitness */ for (int i = 0; i < tournamentK; i++) { list[i] = individual.get(d.nextInt(size)); if (list[i].fitness < min) min = list[i].fitness; } /* I'm not sure if this is the best way to * make the proportion between the fitnesses. * Some sort of scaling factor should be put here * to avoit high fitnesses from superdominating. * * But maybe the tournament proccess already guarantees this? */ for (int i = 0; i < tournamentK; i++) { sum += list[i].fitness - min; rank[i] = sum; } ticket = d.nextDouble()*sum; for (int i = 0; i < tournamentK; i++) { if ((ticket) <= rank[i]) return list[i].copy(); } // should never get here System.err.println("x" + ticket + " + " + sum); System.err.println("Warning: MemeTournament - reached unreachable line"); return list[0].copy(); } }
caranha/MTGA-old
code/ga/GAPopulation.java
Java
bsd-3-clause
6,710
//=====================================================================// /*! @file @brief R8C LCD メイン @n for ST7567 SPI (128 x 32) @n LCD: Aitendo M-G0812P7567 @author 平松邦仁 ([email protected]) @copyright Copyright (C) 2017 Kunihito Hiramatsu @n Released under the MIT license @n https://github.com/hirakuni45/R8C/blob/master/LICENSE */ //=====================================================================// #include "common/renesas.hpp" #include "common/fifo.hpp" #include "common/uart_io.hpp" #include "common/command.hpp" #include "common/format.hpp" #include "common/trb_io.hpp" #include "common/spi_io.hpp" #include "chip/ST7565.hpp" #include "common/monograph.hpp" namespace { device::trb_io<utils::null_task, uint8_t> timer_b_; typedef utils::fifo<uint8_t, 16> buffer; typedef device::uart_io<device::UART0, buffer, buffer> uart; uart uart_; utils::command<64> command_; // LCD SCL: P4_2(1) typedef device::PORT<device::PORT4, device::bitpos::B2> SPI_SCL; // LCD SDA: P4_5(12) typedef device::PORT<device::PORT4, device::bitpos::B5> SPI_SDA; // MISO, MOSI, SCK typedef device::spi_io<device::NULL_PORT, SPI_SDA, SPI_SCL, device::soft_spi_mode::CK10> SPI; SPI spi_; // LCD /CS: P3_7(2) typedef device::PORT<device::PORT3, device::bitpos::B7> LCD_SEL; // LCD A0: P1_6(14) typedef device::PORT<device::PORT1, device::bitpos::B6> LCD_A0; // LCD RESET typedef device::NULL_PORT LCD_RES; typedef chip::ST7565<SPI, LCD_SEL, LCD_A0, LCD_RES> LCD; LCD lcd_(spi_); class PLOT { public: typedef int8_t value_type; static const int8_t WIDTH = 128; static const int8_t HEIGHT = 64; void clear(uint8_t v = 0) { } void operator() (int8_t x, int8_t y, bool val) { if(x < 0 || x >= WIDTH) return; if(y < 0 || y >= HEIGHT) return; } }; graphics::kfont_null kfont_; graphics::monograph<PLOT> bitmap_(kfont_); } extern "C" { void sci_putch(char ch) { uart_.putch(ch); } char sci_getch(void) { return uart_.getch(); } uint16_t sci_length() { return uart_.length(); } void sci_puts(const char* str) { uart_.puts(str); } void TIMER_RB_intr(void) { timer_b_.itask(); } void UART0_TX_intr(void) { uart_.isend(); } void UART0_RX_intr(void) { uart_.irecv(); } } static uint8_t v_ = 91; static uint8_t m_ = 123; #if 0 static void randmize_(uint8_t v, uint8_t m) { v_ = v; m_ = m; } #endif static uint8_t rand_() { v_ += v_ << 2; ++v_; uint8_t n = 0; if(m_ & 0x02) n = 1; if(m_ & 0x40) n ^= 1; m_ += m_; if(n == 0) ++m_; return v_ ^ m_; } // __attribute__ ((section (".exttext"))) int main(int argc, char *argv[]) { using namespace device; // クロック関係レジスタ・プロテクト解除 PRCR.PRC0 = 1; // 高速オンチップオシレーターへ切り替え(20MHz) // ※ F_CLK を設定する事(Makefile内) OCOCR.HOCOE = 1; utils::delay::micro_second(1); // >=30us(125KHz) SCKCR.HSCKSEL = 1; CKSTPR.SCKSEL = 1; // タイマーB初期化 { uint8_t ir_level = 2; timer_b_.start(60, ir_level); } // UART の設定 (P1_4: TXD0[out], P1_5: RXD0[in]) // ※シリアルライターでは、RXD 端子は、P1_6 となっているので注意! { utils::PORT_MAP(utils::port_map::P14::TXD0); utils::PORT_MAP(utils::port_map::P15::RXD0); uint8_t ir_level = 1; uart_.start(57600, ir_level); } // SPI 開始 { spi_.start(10000000); } // LCD を開始 { lcd_.start(0x00); spi_.start(0); // Boost SPI clock bitmap_.clear(0); } sci_puts("Start R8C LCD monitor\n"); command_.set_prompt("# "); // LED シグナル用ポートを出力 // PD1.B0 = 1; uint8_t cnt = 0; uint16_t x = rand_() & 127; uint16_t y = rand_() & 31; uint16_t xx; uint16_t yy; uint8_t loop = 20; while(1) { timer_b_.sync(); /// lcd_.copy(bitmap_.fb(), bitmap_.page_num()); if(loop >= 20) { loop = 0; bitmap_.clear(0); bitmap_.frame(0, 0, 128, 32, 1); } xx = rand_() & 127; yy = rand_() & 31; bitmap_.line(x, y, xx, yy, 1); x = xx; y = yy; ++loop; // bitmap_.line(0, 0, 127, 31, 1); // bitmap_.line(0, 31, 127, 0, 1); if(cnt >= 20) { cnt = 0; } ++cnt; // コマンド入力と、コマンド解析 if(command_.service()) { } } }
hirakuni45/R8C
LCD_DOT_sample/main.cpp
C++
bsd-3-clause
4,261
<?php namespace Application\Entity\Repository; use Doctrine\ORM\EntityRepository; Class RubricsRepository extends EntityRepository{ }
Romez/zend.local
module/Application/src/Application/Entity/Repository/RubricsRepository.php
PHP
bsd-3-clause
137
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE NoImplicitPrelude #-} module Ircbrowse.View.Template where import Ircbrowse.View import Ircbrowse.Types.Import import qualified Text.Blaze.Html5 as H import Data.Text (Text) template :: AttributeValue -> Text -> Html -> Html -> Html template name thetitle innerhead innerbody = do docType html $ do head $ do H.title $ toHtml thetitle link ! rel "stylesheet" ! type_ "text/css" ! href "/css/bootstrap.min.css" link ! rel "stylesheet" ! type_ "text/css" ! href "/css/bootstrap-responsive.css" link ! rel "stylesheet" ! type_ "text/css" ! href "/css/ircbrowse.css" meta ! httpEquiv "Content-Type" ! content "text/html; charset=UTF-8" innerhead body !# name $ do innerbody preEscapedToHtml ("<script type=\"text/javascript\"> var _gaq = _gaq \ \|| []; _gaq.push(['_setAccount', 'UA-38975161-1']);\ \ _gaq.push(['_trackPageview']); (function() {var ga\ \ = document.createElement('script'); ga.type = 'tex\ \t/javascript'; ga.async = true; ga.src = ('https:' \ \== document.location.protocol ? 'https://ssl' : \ \'http://www') + '.google-analytics.com/ga.js'; var\ \ s = document.getElementsByTagName('script')[0]; \ \s.parentNode.insertBefore(ga, s);})(); </script>" :: Text) channelNav :: Channel -> Html channelNav channel = div !. "navbar navbar-static-top navbar-inverse" $ div !. "navbar-inner" $ do div !. "container" $ do a !. "brand" ! href "/" $ "IRCBrowse" ul !. "nav" $ do li $ a ! href (toValue ("/" ++ showChan channel)) $ do (toHtml (prettyChan channel)) li $ a ! href (toValue ("/browse/" ++ showChan channel)) $ do "Browse" -- li $ a ! href (toValue ("/day/" ++ showChan channel ++ "/today/recent")) $ do -- "Recent" -- li $ a ! href (toValue ("/day/" ++ showChan channel ++ "/today")) $ do -- "Today" -- li $ a ! href (toValue ("/calendar/" ++ showChan channel)) $ do -- "Calendar" -- li $ a ! href (toValue ("/nicks/" ++ showChan channel)) $ do -- "Nicks" -- li $ a ! href (toValue ("/pdfs/" ++ showChan channel)) $ do -- "PDFs" showCount :: (Show n,Integral n) => n -> String showCount = reverse . foldr merge "" . zip ("000,00,00,00"::String) . reverse . show where merge (f,c) rest | f == ',' = "," ++ [c] ++ rest | otherwise = [c] ++ rest footer :: Html footer = div !# "footer" $ div !. "container" $ do p !. "muted credit" $ do a ! href "http://ircbrowse.net" $ "IRC Browse" " by " a ! href "http://chrisdone.com" $ "Chris Done" " | " a ! href "https://github.com/chrisdone/ircbrowse" $ "Source code" " | " a ! href "http://haskell.org/" $ "Haskell" mainHeading :: Html -> Html mainHeading inner = h1 $ do a ! href "/" $ do "IRC Browse" ": " inner
chrisdone/ircbrowse
src/Ircbrowse/View/Template.hs
Haskell
bsd-3-clause
3,220
<!-- This comment will put IE 6, 7 and 8 in quirks mode --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>eusci_a_uart.c File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="$relpath/search.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <table width="100%"> <tr> <td bgcolor="black" width="1"><a href="http://www.ti.com"><img border="0" src="tilogo.gif" /></a></td> <td bgcolor="red"><img src="titagline.gif" /></td> </tr> </table> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">MSP430 Driver Library &#160;<span id="projectnumber">1.90.00.65</span> </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.5 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="pages.html"><span>Related&#160;Pages</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="dir_e1cf65e5caa5b20be391e0669541b825.html">cygdrive</a></li><li class="navelem"><a class="el" href="dir_7a9e18c03596d8465cf006c2a17f1e00.html">c</a></li><li class="navelem"><a class="el" href="dir_fe6c554c444e3227c5f1951b4a377054.html">msp430-driverlib</a></li><li class="navelem"><a class="el" href="dir_4229c540f648bf499d1f78361c546dba.html">driverlib</a></li><li class="navelem"><a class="el" href="dir_da973e413be0b1716c582265c873f56b.html">MSP430i2xx</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">eusci_a_uart.c File Reference</div> </div> </div><!--header--> <div class="contents"> <div class="textblock"><code>#include &quot;<a class="el" href="driverlib_2_m_s_p430i2xx_2inc_2hw__regaccess_8h_source.html">inc/hw_regaccess.h</a>&quot;</code><br/> <code>#include &quot;<a class="el" href="driverlib_2_m_s_p430i2xx_2inc_2hw__memmap_8h_source.html">inc/hw_memmap.h</a>&quot;</code><br/> <code>#include &quot;<a class="el" href="eusci__a__uart_8h_source.html">eusci_a_uart.h</a>&quot;</code><br/> <code>#include &lt;assert.h&gt;</code><br/> </div><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:ga2a08645b3003df7cdf0b9bd416efcddf"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#ga2a08645b3003df7cdf0b9bd416efcddf">EUSCI_A_UART_init</a> (uint16_t baseAddress, <a class="el" href="struct_e_u_s_c_i___a___u_a_r_t__init_param.html">EUSCI_A_UART_initParam</a> *param)</td></tr> <tr class="memdesc:ga2a08645b3003df7cdf0b9bd416efcddf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Advanced initialization routine for the UART block. The values to be written into the clockPrescalar, firstModReg, secondModReg and overSampling parameters should be pre-computed and passed into the initialization function. <a href="group__eusci__a__uart__api.html#ga2a08645b3003df7cdf0b9bd416efcddf">More...</a><br/></td></tr> <tr class="separator:ga2a08645b3003df7cdf0b9bd416efcddf"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:gaf637ca8f96fc93101f1111b23da6c87f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#gaf637ca8f96fc93101f1111b23da6c87f">EUSCI_A_UART_transmitData</a> (uint16_t baseAddress, uint8_t transmitData)</td></tr> <tr class="memdesc:gaf637ca8f96fc93101f1111b23da6c87f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Transmits a byte from the UART Module. <a href="group__eusci__a__uart__api.html#gaf637ca8f96fc93101f1111b23da6c87f">More...</a><br/></td></tr> <tr class="separator:gaf637ca8f96fc93101f1111b23da6c87f"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:gab18364db57b4719f71e83a5f69897d66"><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#gab18364db57b4719f71e83a5f69897d66">EUSCI_A_UART_receiveData</a> (uint16_t baseAddress)</td></tr> <tr class="memdesc:gab18364db57b4719f71e83a5f69897d66"><td class="mdescLeft">&#160;</td><td class="mdescRight">Receives a byte that has been sent to the UART Module. <a href="group__eusci__a__uart__api.html#gab18364db57b4719f71e83a5f69897d66">More...</a><br/></td></tr> <tr class="separator:gab18364db57b4719f71e83a5f69897d66"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ga8264a417944411b5fbe988d94ae21d20"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#ga8264a417944411b5fbe988d94ae21d20">EUSCI_A_UART_enableInterrupt</a> (uint16_t baseAddress, uint8_t mask)</td></tr> <tr class="memdesc:ga8264a417944411b5fbe988d94ae21d20"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enables individual UART interrupt sources. <a href="group__eusci__a__uart__api.html#ga8264a417944411b5fbe988d94ae21d20">More...</a><br/></td></tr> <tr class="separator:ga8264a417944411b5fbe988d94ae21d20"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:gaf1c34e38356e6918732151dc92b47b50"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#gaf1c34e38356e6918732151dc92b47b50">EUSCI_A_UART_disableInterrupt</a> (uint16_t baseAddress, uint8_t mask)</td></tr> <tr class="memdesc:gaf1c34e38356e6918732151dc92b47b50"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disables individual UART interrupt sources. <a href="group__eusci__a__uart__api.html#gaf1c34e38356e6918732151dc92b47b50">More...</a><br/></td></tr> <tr class="separator:gaf1c34e38356e6918732151dc92b47b50"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:gab10882f5122070c22250ab4241ea7a6f"><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#gab10882f5122070c22250ab4241ea7a6f">EUSCI_A_UART_getInterruptStatus</a> (uint16_t baseAddress, uint8_t mask)</td></tr> <tr class="memdesc:gab10882f5122070c22250ab4241ea7a6f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the current UART interrupt status. <a href="group__eusci__a__uart__api.html#gab10882f5122070c22250ab4241ea7a6f">More...</a><br/></td></tr> <tr class="separator:gab10882f5122070c22250ab4241ea7a6f"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:gacec66a5ffbc9c60bb52b7a1dacc445ad"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#gacec66a5ffbc9c60bb52b7a1dacc445ad">EUSCI_A_UART_clearInterruptFlag</a> (uint16_t baseAddress, uint8_t mask)</td></tr> <tr class="memdesc:gacec66a5ffbc9c60bb52b7a1dacc445ad"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clears UART interrupt sources. <a href="group__eusci__a__uart__api.html#gacec66a5ffbc9c60bb52b7a1dacc445ad">More...</a><br/></td></tr> <tr class="separator:gacec66a5ffbc9c60bb52b7a1dacc445ad"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:gaf2bd04f23261ebafd4890c35945a7877"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#gaf2bd04f23261ebafd4890c35945a7877">EUSCI_A_UART_enable</a> (uint16_t baseAddress)</td></tr> <tr class="memdesc:gaf2bd04f23261ebafd4890c35945a7877"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enables the UART block. <a href="group__eusci__a__uart__api.html#gaf2bd04f23261ebafd4890c35945a7877">More...</a><br/></td></tr> <tr class="separator:gaf2bd04f23261ebafd4890c35945a7877"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:gaae82375105abc8655ef50f8c36ffcf13"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#gaae82375105abc8655ef50f8c36ffcf13">EUSCI_A_UART_disable</a> (uint16_t baseAddress)</td></tr> <tr class="memdesc:gaae82375105abc8655ef50f8c36ffcf13"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disables the UART block. <a href="group__eusci__a__uart__api.html#gaae82375105abc8655ef50f8c36ffcf13">More...</a><br/></td></tr> <tr class="separator:gaae82375105abc8655ef50f8c36ffcf13"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ga8c4cf3e29c3200191506e8d576393c26"><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#ga8c4cf3e29c3200191506e8d576393c26">EUSCI_A_UART_queryStatusFlags</a> (uint16_t baseAddress, uint8_t mask)</td></tr> <tr class="memdesc:ga8c4cf3e29c3200191506e8d576393c26"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the current UART status flags. <a href="group__eusci__a__uart__api.html#ga8c4cf3e29c3200191506e8d576393c26">More...</a><br/></td></tr> <tr class="separator:ga8c4cf3e29c3200191506e8d576393c26"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ga929c7fbd7c476127cd511beea6d01294"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#ga929c7fbd7c476127cd511beea6d01294">EUSCI_A_UART_setDormant</a> (uint16_t baseAddress)</td></tr> <tr class="memdesc:ga929c7fbd7c476127cd511beea6d01294"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the UART module in dormant mode. <a href="group__eusci__a__uart__api.html#ga929c7fbd7c476127cd511beea6d01294">More...</a><br/></td></tr> <tr class="separator:ga929c7fbd7c476127cd511beea6d01294"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ga36bc7fc49217a06c33a397cd71c571ee"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#ga36bc7fc49217a06c33a397cd71c571ee">EUSCI_A_UART_resetDormant</a> (uint16_t baseAddress)</td></tr> <tr class="memdesc:ga36bc7fc49217a06c33a397cd71c571ee"><td class="mdescLeft">&#160;</td><td class="mdescRight">Re-enables UART module from dormant mode. <a href="group__eusci__a__uart__api.html#ga36bc7fc49217a06c33a397cd71c571ee">More...</a><br/></td></tr> <tr class="separator:ga36bc7fc49217a06c33a397cd71c571ee"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ga1b4fa41e9447eef4c5f270369b8902c7"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#ga1b4fa41e9447eef4c5f270369b8902c7">EUSCI_A_UART_transmitAddress</a> (uint16_t baseAddress, uint8_t transmitAddress)</td></tr> <tr class="memdesc:ga1b4fa41e9447eef4c5f270369b8902c7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Transmits the next byte to be transmitted marked as address depending on selected multiprocessor mode. <a href="group__eusci__a__uart__api.html#ga1b4fa41e9447eef4c5f270369b8902c7">More...</a><br/></td></tr> <tr class="separator:ga1b4fa41e9447eef4c5f270369b8902c7"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:gae0a01876b95bcd1396eddbb26e7ffabe"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#gae0a01876b95bcd1396eddbb26e7ffabe">EUSCI_A_UART_transmitBreak</a> (uint16_t baseAddress)</td></tr> <tr class="memdesc:gae0a01876b95bcd1396eddbb26e7ffabe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Transmit break. <a href="group__eusci__a__uart__api.html#gae0a01876b95bcd1396eddbb26e7ffabe">More...</a><br/></td></tr> <tr class="separator:gae0a01876b95bcd1396eddbb26e7ffabe"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ga97ed7748495844b3506d778ecdbb5dfa"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#ga97ed7748495844b3506d778ecdbb5dfa">EUSCI_A_UART_getReceiveBufferAddress</a> (uint16_t baseAddress)</td></tr> <tr class="memdesc:ga97ed7748495844b3506d778ecdbb5dfa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the address of the RX Buffer of the UART for the DMA module. <a href="group__eusci__a__uart__api.html#ga97ed7748495844b3506d778ecdbb5dfa">More...</a><br/></td></tr> <tr class="separator:ga97ed7748495844b3506d778ecdbb5dfa"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:gaf873d22baa0ed6b207b5f3aebbea1a4c"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#gaf873d22baa0ed6b207b5f3aebbea1a4c">EUSCI_A_UART_getTransmitBufferAddress</a> (uint16_t baseAddress)</td></tr> <tr class="memdesc:gaf873d22baa0ed6b207b5f3aebbea1a4c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the address of the TX Buffer of the UART for the DMA module. <a href="group__eusci__a__uart__api.html#gaf873d22baa0ed6b207b5f3aebbea1a4c">More...</a><br/></td></tr> <tr class="separator:gaf873d22baa0ed6b207b5f3aebbea1a4c"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ga09f2b714ce0556e210b5c054b3138eaa"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__eusci__a__uart__api.html#ga09f2b714ce0556e210b5c054b3138eaa">EUSCI_A_UART_selectDeglitchTime</a> (uint16_t baseAddress, uint16_t deglitchTime)</td></tr> <tr class="memdesc:ga09f2b714ce0556e210b5c054b3138eaa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the deglitch time. <a href="group__eusci__a__uart__api.html#ga09f2b714ce0556e210b5c054b3138eaa">More...</a><br/></td></tr> <tr class="separator:ga09f2b714ce0556e210b5c054b3138eaa"><td class="memSeparator" colspan="2">&#160;</td></tr> </table> </div><!-- contents --> <hr size="1" /><small> Copyright 2014, Texas Instruments Incorporated</small> </body> </html>
ekawahyu/MSP430Ware
doc/MSP430i2xx/html/eusci__a__uart_8c.html
HTML
bsd-3-clause
15,437
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" /> <meta name="viewport" content="width=device-width,initial-scale=1"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="lang:clipboard.copy" content="Copy to clipboard"> <meta name="lang:clipboard.copied" content="Copied to clipboard"> <meta name="lang:search.language" content="en"> <meta name="lang:search.pipeline.stopwords" content="True"> <meta name="lang:search.pipeline.trimmer" content="True"> <meta name="lang:search.result.none" content="No matching documents"> <meta name="lang:search.result.one" content="1 matching document"> <meta name="lang:search.result.other" content="# matching documents"> <meta name="lang:search.tokenizer" content="[\s\-]+"> <link href="https://fonts.gstatic.com/" rel="preconnect" crossorigin> <link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500,700|Roboto:300,400,400i,700&display=fallback" rel="stylesheet"> <style> body, input { font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif } code, kbd, pre { font-family: "Roboto Mono", "Courier New", Courier, monospace } </style> <link rel="stylesheet" href="../_static/stylesheets/application.css"/> <link rel="stylesheet" href="../_static/stylesheets/application-palette.css"/> <link rel="stylesheet" href="../_static/stylesheets/application-fixes.css"/> <link rel="stylesheet" href="../_static/fonts/material-icons.css"/> <meta name="theme-color" content="#3f51b5"> <script src="../_static/javascripts/modernizr.js"></script> <title>statsmodels.tsa.holtwinters.Holt.initialize &#8212; statsmodels</title> <link rel="icon" type="image/png" sizes="32x32" href="../_static/icons/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="16x16" href="../_static/icons/favicon-16x16.png"> <link rel="manifest" href="../_static/icons/site.webmanifest"> <link rel="mask-icon" href="../_static/icons/safari-pinned-tab.svg" color="#919191"> <meta name="msapplication-TileColor" content="#2b5797"> <meta name="msapplication-config" content="../_static/icons/browserconfig.xml"> <link rel="stylesheet" href="../_static/stylesheets/examples.css"> <link rel="stylesheet" href="../_static/stylesheets/deprecation.css"> <link rel="stylesheet" type="text/css" href="../_static/pygments.css" /> <link rel="stylesheet" type="text/css" href="../_static/material.css" /> <link rel="stylesheet" type="text/css" href="../_static/graphviz.css" /> <link rel="stylesheet" type="text/css" href="../_static/plot_directive.css" /> <script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script> <script src="../_static/jquery.js"></script> <script src="../_static/underscore.js"></script> <script src="../_static/doctools.js"></script> <script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script> <link rel="shortcut icon" href="../_static/favicon.ico"/> <link rel="author" title="About these documents" href="../about.html" /> <link rel="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="next" title="statsmodels.tsa.holtwinters.Holt.loglike" href="statsmodels.tsa.holtwinters.Holt.loglike.html" /> <link rel="prev" title="statsmodels.tsa.holtwinters.Holt.initial_values" href="statsmodels.tsa.holtwinters.Holt.initial_values.html" /> </head> <body dir=ltr data-md-color-primary=indigo data-md-color-accent=blue> <svg class="md-svg"> <defs data-children-count="0"> <svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="__github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg> </defs> </svg> <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer"> <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search"> <label class="md-overlay" data-md-component="overlay" for="__drawer"></label> <a href="#generated/statsmodels.tsa.holtwinters.Holt.initialize" tabindex="1" class="md-skip"> Skip to content </a> <header class="md-header" data-md-component="header"> <nav class="md-header-nav md-grid"> <div class="md-flex navheader"> <div class="md-flex__cell md-flex__cell--shrink"> <a href="../index.html" title="statsmodels" class="md-header-nav__button md-logo"> <img src="../_static/statsmodels-logo-v2-bw.svg" height="26" alt="statsmodels logo"> </a> </div> <div class="md-flex__cell md-flex__cell--shrink"> <label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label> </div> <div class="md-flex__cell md-flex__cell--stretch"> <div class="md-flex__ellipsis md-header-nav__title" data-md-component="title"> <span class="md-header-nav__topic">statsmodels v0.14.0.dev0 (+325)</span> <span class="md-header-nav__topic"> statsmodels.tsa.holtwinters.Holt.initialize </span> </div> </div> <div class="md-flex__cell md-flex__cell--shrink"> <label class="md-icon md-icon--search md-header-nav__button" for="__search"></label> <div class="md-search" data-md-component="search" role="dialog"> <label class="md-search__overlay" for="__search"></label> <div class="md-search__inner" role="search"> <form class="md-search__form" action="../search.html" method="get" name="search"> <input type="text" class="md-search__input" name="q" placeholder="Search" autocapitalize="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active"> <label class="md-icon md-search__icon" for="__search"></label> <button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1"> &#xE5CD; </button> </form> <div class="md-search__output"> <div class="md-search__scrollwrap" data-md-scrollfix> <div class="md-search-result" data-md-component="result"> <div class="md-search-result__meta"> Type to start searching </div> <ol class="md-search-result__list"></ol> </div> </div> </div> </div> </div> </div> <div class="md-flex__cell md-flex__cell--shrink"> <div class="md-header-nav__source"> <a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github"> <div class="md-source__icon"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28"> <use xlink:href="#__github" width="24" height="24"></use> </svg> </div> <div class="md-source__repository"> statsmodels </div> </a> </div> </div> <script src="../_static/javascripts/version_dropdown.js"></script> <script> var json_loc = "../../versions-v2.json", target_loc = "../../", text = "Versions"; $( document ).ready( add_version_dropdown(json_loc, target_loc, text)); </script> </div> </nav> </header> <div class="md-container"> <nav class="md-tabs" data-md-component="tabs"> <div class="md-tabs__inner md-grid"> <ul class="md-tabs__list"> <li class="md-tabs__item"><a href="../user-guide.html" class="md-tabs__link">User Guide</a></li> <li class="md-tabs__item"><a href="../tsa.html" class="md-tabs__link">Time Series analysis <code class="xref py py-mod docutils literal notranslate"><span class="pre">tsa</span></code></a></li> <li class="md-tabs__item"><a href="statsmodels.tsa.holtwinters.Holt.html" class="md-tabs__link">statsmodels.tsa.holtwinters.Holt</a></li> </ul> </div> </nav> <main class="md-main"> <div class="md-main__inner md-grid" data-md-component="container"> <div class="md-sidebar md-sidebar--primary" data-md-component="navigation"> <div class="md-sidebar__scrollwrap"> <div class="md-sidebar__inner"> <nav class="md-nav md-nav--primary" data-md-level="0"> <label class="md-nav__title md-nav__title--site" for="__drawer"> <a href="../index.html" title="statsmodels" class="md-nav__button md-logo"> <img src="../_static/statsmodels-logo-v2-bw.svg" alt=" logo" width="48" height="48"> </a> <a href="../index.html" title="statsmodels">statsmodels v0.14.0.dev0 (+325)</a> </label> <div class="md-nav__source"> <a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github"> <div class="md-source__icon"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28"> <use xlink:href="#__github" width="24" height="24"></use> </svg> </div> <div class="md-source__repository"> statsmodels </div> </a> </div> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="../install.html" class="md-nav__link">Installing statsmodels</a> </li> <li class="md-nav__item"> <a href="../gettingstarted.html" class="md-nav__link">Getting started</a> </li> <li class="md-nav__item"> <a href="../user-guide.html" class="md-nav__link">User Guide</a> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="../user-guide.html#background" class="md-nav__link">Background</a> </li> <li class="md-nav__item"> <a href="../user-guide.html#regression-and-linear-models" class="md-nav__link">Regression and Linear Models</a> </li> <li class="md-nav__item"> <a href="../user-guide.html#time-series-analysis" class="md-nav__link">Time Series Analysis</a> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="../tsa.html" class="md-nav__link">Time Series analysis <code class="xref py py-mod docutils literal notranslate"><span class="pre">tsa</span></code></a> </li> <li class="md-nav__item"> <a href="../statespace.html" class="md-nav__link">Time Series Analysis by State Space Methods <code class="xref py py-mod docutils literal notranslate"><span class="pre">statespace</span></code></a> </li> <li class="md-nav__item"> <a href="../vector_ar.html" class="md-nav__link">Vector Autoregressions <code class="xref py py-mod docutils literal notranslate"><span class="pre">tsa.vector_ar</span></code></a> </li></ul> </li> <li class="md-nav__item"> <a href="../user-guide.html#other-models" class="md-nav__link">Other Models</a> </li> <li class="md-nav__item"> <a href="../user-guide.html#statistics-and-tools" class="md-nav__link">Statistics and Tools</a> </li> <li class="md-nav__item"> <a href="../user-guide.html#data-sets" class="md-nav__link">Data Sets</a> </li> <li class="md-nav__item"> <a href="../user-guide.html#sandbox" class="md-nav__link">Sandbox</a> </li></ul> </li> <li class="md-nav__item"> <a href="../examples/index.html" class="md-nav__link">Examples</a> </li> <li class="md-nav__item"> <a href="../api.html" class="md-nav__link">API Reference</a> </li> <li class="md-nav__item"> <a href="../about.html" class="md-nav__link">About statsmodels</a> </li> <li class="md-nav__item"> <a href="../dev/index.html" class="md-nav__link">Developer Page</a> </li> <li class="md-nav__item"> <a href="../release/index.html" class="md-nav__link">Release Notes</a> </li> </ul> </nav> </div> </div> </div> <div class="md-sidebar md-sidebar--secondary" data-md-component="toc"> <div class="md-sidebar__scrollwrap"> <div class="md-sidebar__inner"> <nav class="md-nav md-nav--secondary"> <ul class="md-nav__list" data-md-scrollfix=""> <li class="md-nav__item"><a class="md-nav__extra_link" href="../_sources/generated/statsmodels.tsa.holtwinters.Holt.initialize.rst.txt">Show Source</a> </li> <li id="searchbox" class="md-nav__item"></li> </ul> </nav> </div> </div> </div> <div class="md-content"> <article class="md-content__inner md-typeset" role="main"> <section id="statsmodels-tsa-holtwinters-holt-initialize"> <h1 id="generated-statsmodels-tsa-holtwinters-holt-initialize--page-root">statsmodels.tsa.holtwinters.Holt.initialize<a class="headerlink" href="#generated-statsmodels-tsa-holtwinters-holt-initialize--page-root" title="Permalink to this headline">¶</a></h1> <dl class="py method"> <dt class="sig sig-object py" id="statsmodels.tsa.holtwinters.Holt.initialize"> <span class="sig-prename descclassname"><span class="pre">Holt.</span></span><span class="sig-name descname"><span class="pre">initialize</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#statsmodels.tsa.holtwinters.Holt.initialize" title="Permalink to this definition">¶</a></dt> <dd><p>Initialize (possibly re-initialize) a Model instance.</p> <p>For example, if the the design matrix of a linear model changes then initialized can be used to recompute values using the modified design matrix.</p> </dd></dl> </section> </article> </div> </div> </main> </div> <footer class="md-footer"> <div class="md-footer-nav"> <nav class="md-footer-nav__inner md-grid"> <a href="statsmodels.tsa.holtwinters.Holt.initial_values.html" title="statsmodels.tsa.holtwinters.Holt.initial_values" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev"> <div class="md-flex__cell md-flex__cell--shrink"> <i class="md-icon md-icon--arrow-back md-footer-nav__button"></i> </div> <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"> <span class="md-flex__ellipsis"> <span class="md-footer-nav__direction"> Previous </span> statsmodels.tsa.holtwinters.Holt.initial_values </span> </div> </a> <a href="statsmodels.tsa.holtwinters.Holt.loglike.html" title="statsmodels.tsa.holtwinters.Holt.loglike" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next"> <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"><span class="md-flex__ellipsis"> <span class="md-footer-nav__direction"> Next </span> statsmodels.tsa.holtwinters.Holt.loglike </span> </div> <div class="md-flex__cell md-flex__cell--shrink"><i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i> </div> </a> </nav> </div> <div class="md-footer-meta md-typeset"> <div class="md-footer-meta__inner md-grid"> <div class="md-footer-copyright"> <div class="md-footer-copyright__highlight"> &#169; Copyright 2009-2019, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers. </div> Last updated on Feb 23, 2022. <br/> Created using <a href="http://www.sphinx-doc.org/">Sphinx</a> 4.4.0. and <a href="https://github.com/bashtage/sphinx-material/">Material for Sphinx</a> </div> </div> </div> </footer> <script src="../_static/javascripts/application.js"></script> <script>app.initialize({version: "1.0.4", url: {base: ".."}})</script> </body> </html>
statsmodels/statsmodels.github.io
devel/generated/statsmodels.tsa.holtwinters.Holt.initialize.html
HTML
bsd-3-clause
17,676
// Copyright 2021-present 650 Industries. All rights reserved. #import <Foundation/Foundation.h> #import <ABI44_0_0UMTaskManagerInterface/ABI44_0_0UMTaskConsumerInterface.h> NS_ASSUME_NONNULL_BEGIN @interface ABI44_0_0EXBackgroundRemoteNotificationConsumer : NSObject <ABI44_0_0UMTaskConsumerInterface> @property (nonatomic, strong) id<ABI44_0_0UMTaskInterface> task; @end NS_ASSUME_NONNULL_END
exponentjs/exponent
ios/versioned/sdk44/EXNotifications/EXNotifications/Notifications/Background/ABI44_0_0EXBackgroundRemoteNotificationConsumer.h
C
bsd-3-clause
401
<!DOCTYPE html> <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Hodograph &mdash; MetPy 0.8</title> <link rel="shortcut icon" href="../../_static/metpy_32x32.ico"/> <link rel="canonical" href="https://unidata.github.io/MetPy/latest/api/generated/metpy.plots.Hodograph.html"/> <link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" /> <link rel="stylesheet" href="../../_static/gallery.css" type="text/css" /> <link rel="stylesheet" href="../../_static/theme_override.css" type="text/css" /> <link rel="index" title="Index" href="../../genindex.html"/> <link rel="search" title="Search" href="../../search.html"/> <link rel="top" title="MetPy 0.8" href="../../index.html"/> <link rel="up" title="plots" href="metpy.plots.html"/> <link rel="next" title="SkewT" href="metpy.plots.SkewT.html"/> <link rel="prev" title="read_colortable" href="metpy.plots.read_colortable.html"/> <script src="../../_static/js/modernizr.min.js"></script> </head> <body class="wy-body-for-nav" role="document"> <div class="wy-grid-for-nav"> <nav data-toggle="wy-nav-shift" class="wy-nav-side"> <div class="wy-side-scroll"> <div class="wy-side-nav-search"> <a href="../../index.html" class="icon icon-home"> MetPy <img src="../../_static/metpy_150x150.png" class="logo" /> </a> <div class="version"> <div class="version-dropdown"> <select class="version-list" id="version-list"> <option value=''>0.8</option> <option value="../latest">latest</option> <option value="../dev">dev</option> </select> </div> </div> <div role="search"> <form id="rtd-search-form" class="wy-form" action="../../search.html" method="get"> <input type="text" name="q" placeholder="Search docs" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div> <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> <ul class="current"> <li class="toctree-l1"><a class="reference internal" href="../../installguide.html">Installation Guide</a></li> <li class="toctree-l1"><a class="reference internal" href="../../units.html">Unit Support</a></li> <li class="toctree-l1"><a class="reference internal" href="../../examples/index.html">MetPy Examples</a></li> <li class="toctree-l1"><a class="reference internal" href="../../tutorials/index.html">MetPy Tutorials</a></li> <li class="toctree-l1 current"><a class="reference internal" href="../index.html">The MetPy API</a><ul class="current"> <li class="toctree-l2"><a class="reference internal" href="metpy.constants.html">constants</a></li> <li class="toctree-l2"><a class="reference internal" href="metpy.units.html">units</a></li> <li class="toctree-l2"><a class="reference internal" href="metpy.io.html">io</a></li> <li class="toctree-l2"><a class="reference internal" href="metpy.io.cdm.html">cdm</a></li> <li class="toctree-l2"><a class="reference internal" href="metpy.calc.html">calc</a></li> <li class="toctree-l2 current"><a class="reference internal" href="metpy.plots.html">plots</a><ul class="current"> <li class="toctree-l3"><a class="reference internal" href="metpy.plots.add_metpy_logo.html">add_metpy_logo</a></li> <li class="toctree-l3"><a class="reference internal" href="metpy.plots.add_timestamp.html">add_timestamp</a></li> <li class="toctree-l3"><a class="reference internal" href="metpy.plots.add_unidata_logo.html">add_unidata_logo</a></li> <li class="toctree-l3"><a class="reference internal" href="metpy.plots.read_colortable.html">read_colortable</a></li> <li class="toctree-l3 current"><a class="current reference internal" href="#">Hodograph</a><ul> <li class="toctree-l4"><a class="reference internal" href="#examples-using-metpy-plots-hodograph">Examples using <code class="docutils literal notranslate"><span class="pre">metpy.plots.Hodograph</span></code></a></li> </ul> </li> <li class="toctree-l3"><a class="reference internal" href="metpy.plots.SkewT.html">SkewT</a></li> <li class="toctree-l3"><a class="reference internal" href="metpy.plots.StationPlot.html">StationPlot</a></li> <li class="toctree-l3"><a class="reference internal" href="metpy.plots.StationPlotLayout.html">StationPlotLayout</a></li> </ul> </li> <li class="toctree-l2"><a class="reference internal" href="metpy.plots.ctables.html">ctables</a></li> <li class="toctree-l2"><a class="reference internal" href="metpy.gridding.html">gridding</a></li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="../../gempak.html">GEMPAK Conversion Guide</a></li> <li class="toctree-l1"><a class="reference internal" href="../../CONTRIBUTING.html">Contributors Guide</a></li> <li class="toctree-l1"><a class="reference internal" href="../../infrastructureguide.html">Infrastructure Guide</a></li> <li class="toctree-l1"><a class="reference internal" href="../../citing.html">Citing MetPy</a></li> <li class="toctree-l1"><a class="reference internal" href="../../references.html">References</a></li> </ul> </div> </div> </nav> <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> <i data-toggle="wy-nav-top" class="fa fa-bars"></i> <a href="../../index.html">MetPy</a> </nav> <div class="wy-nav-content"> <div class="rst-content"> <div role="navigation" aria-label="breadcrumbs navigation"> <ul class="wy-breadcrumbs"> <li><a href="../../index.html">Docs</a> &raquo;</li> <li><a href="../index.html">The MetPy API</a> &raquo;</li> <li><a href="metpy.plots.html">plots</a> &raquo;</li> <li>Hodograph</li> <li class="source-link"> <a href="https://github.com/Unidata/MetPy/issues/new?title=Suggested%20improvement%20for%20api/generated/metpy.plots.Hodograph&body=Please%20describe%20what%20could%20be%20improved%20about%20this%20page%20or%20the%20typo/mistake%20that%20you%20found%3A" class="fa fa-github"> Improve this page</a> </li> </ul> <hr/> </div> <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> <div itemprop="articleBody"> <div class="section" id="hodograph"> <h1>Hodograph<a class="headerlink" href="#hodograph" title="Permalink to this headline">¶</a></h1> <dl class="class"> <dt id="metpy.plots.Hodograph"> <em class="property">class </em><code class="descclassname">metpy.plots.</code><code class="descname">Hodograph</code><span class="sig-paren">(</span><em>ax=None</em>, <em>component_range=80</em><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/metpy/plots/skewt.html#Hodograph"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#metpy.plots.Hodograph" title="Permalink to this definition">¶</a></dt> <dd><p>Make a hodograph of wind data.</p> <p>Plots the u and v components of the wind along the x and y axes, respectively.</p> <p>This class simplifies the process of creating a hodograph using matplotlib. It provides helpers for creating a circular grid and for plotting the wind as a line colored by another value (such as wind speed).</p> <dl class="attribute"> <dt id="metpy.plots.Hodograph.ax"> <code class="descname">ax</code><a class="headerlink" href="#metpy.plots.Hodograph.ax" title="Permalink to this definition">¶</a></dt> <dd><p><a class="reference external" href="https://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes" title="(in Matplotlib v2.2.2)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">matplotlib.axes.Axes</span></code></a> – The underlying Axes instance used for all plotting</p> </dd></dl> <p>Create a Hodograph instance.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>ax</strong> (<a class="reference external" href="https://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes" title="(in Matplotlib v2.2.2)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">matplotlib.axes.Axes</span></code></a>, optional) – The <em class="xref py py-obj">Axes</em> instance used for plotting</li> <li><strong>component_range</strong> (<em>value</em>) – The maximum range of the plot. Used to set plot bounds and control the maximum number of grid rings needed.</li> </ul> </td> </tr> </tbody> </table> <p class="rubric">Methods Summary</p> <table border="1" class="longtable docutils"> <colgroup> <col width="10%" /> <col width="90%" /> </colgroup> <tbody valign="top"> <tr class="row-odd"><td><a class="reference internal" href="#metpy.plots.Hodograph.__init__" title="metpy.plots.Hodograph.__init__"><code class="xref py py-obj docutils literal notranslate"><span class="pre">__init__</span></code></a>([ax,&nbsp;component_range])</td> <td>Create a Hodograph instance.</td> </tr> <tr class="row-even"><td><a class="reference internal" href="#metpy.plots.Hodograph.add_grid" title="metpy.plots.Hodograph.add_grid"><code class="xref py py-obj docutils literal notranslate"><span class="pre">add_grid</span></code></a>([increment])</td> <td>Add grid lines to hodograph.</td> </tr> <tr class="row-odd"><td><a class="reference internal" href="#metpy.plots.Hodograph.plot" title="metpy.plots.Hodograph.plot"><code class="xref py py-obj docutils literal notranslate"><span class="pre">plot</span></code></a>(u,&nbsp;v,&nbsp;**kwargs)</td> <td>Plot u, v data.</td> </tr> <tr class="row-even"><td><a class="reference internal" href="#metpy.plots.Hodograph.plot_colormapped" title="metpy.plots.Hodograph.plot_colormapped"><code class="xref py py-obj docutils literal notranslate"><span class="pre">plot_colormapped</span></code></a>(u,&nbsp;v,&nbsp;c[,&nbsp;bounds,&nbsp;colors])</td> <td>Plot u, v data, with line colored based on a third set of data.</td> </tr> <tr class="row-odd"><td><a class="reference internal" href="#metpy.plots.Hodograph.wind_vectors" title="metpy.plots.Hodograph.wind_vectors"><code class="xref py py-obj docutils literal notranslate"><span class="pre">wind_vectors</span></code></a>(u,&nbsp;v,&nbsp;**kwargs)</td> <td>Plot u, v data as wind vectors.</td> </tr> </tbody> </table> <p class="rubric">Methods Documentation</p> <dl class="method"> <dt id="metpy.plots.Hodograph.__init__"> <code class="descname">__init__</code><span class="sig-paren">(</span><em>ax=None</em>, <em>component_range=80</em><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/metpy/plots/skewt.html#Hodograph.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#metpy.plots.Hodograph.__init__" title="Permalink to this definition">¶</a></dt> <dd><p>Create a Hodograph instance.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>ax</strong> (<a class="reference external" href="https://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes" title="(in Matplotlib v2.2.2)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">matplotlib.axes.Axes</span></code></a>, optional) – The <em class="xref py py-obj">Axes</em> instance used for plotting</li> <li><strong>component_range</strong> (<em>value</em>) – The maximum range of the plot. Used to set plot bounds and control the maximum number of grid rings needed.</li> </ul> </td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="metpy.plots.Hodograph.add_grid"> <code class="descname">add_grid</code><span class="sig-paren">(</span><em>increment=10.0</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/metpy/plots/skewt.html#Hodograph.add_grid"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#metpy.plots.Hodograph.add_grid" title="Permalink to this definition">¶</a></dt> <dd><p>Add grid lines to hodograph.</p> <p>Creates lines for the x- and y-axes, as well as circles denoting wind speed values.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>increment</strong> (<em>value</em><em>, </em><em>optional</em>) – The value increment between rings</li> <li><strong>kwargs</strong> – Other kwargs to control appearance of lines</li> </ul> </td> </tr> </tbody> </table> <div class="admonition seealso"> <p class="first admonition-title">See also</p> <p class="last"><a class="reference external" href="https://matplotlib.org/api/_as_gen/matplotlib.patches.Circle.html#matplotlib.patches.Circle" title="(in Matplotlib v2.2.2)"><code class="xref py py-class docutils literal notranslate"><span class="pre">matplotlib.patches.Circle</span></code></a>, <a class="reference external" href="https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.axhline.html#matplotlib.axes.Axes.axhline" title="(in Matplotlib v2.2.2)"><code class="xref py py-meth docutils literal notranslate"><span class="pre">matplotlib.axes.Axes.axhline()</span></code></a>, <a class="reference external" href="https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.axvline.html#matplotlib.axes.Axes.axvline" title="(in Matplotlib v2.2.2)"><code class="xref py py-meth docutils literal notranslate"><span class="pre">matplotlib.axes.Axes.axvline()</span></code></a></p> </div> </dd></dl> <dl class="method"> <dt id="metpy.plots.Hodograph.plot"> <code class="descname">plot</code><span class="sig-paren">(</span><em>u</em>, <em>v</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/metpy/plots/skewt.html#Hodograph.plot"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#metpy.plots.Hodograph.plot" title="Permalink to this definition">¶</a></dt> <dd><p>Plot u, v data.</p> <p>Plots the wind data on the hodograph.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>u</strong> (<em>array_like</em>) – u-component of wind</li> <li><strong>v</strong> (<em>array_like</em>) – v-component of wind</li> <li><strong>kwargs</strong> – Other keyword arguments to pass to <a class="reference external" href="https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.plot.html#matplotlib.axes.Axes.plot" title="(in Matplotlib v2.2.2)"><code class="xref py py-meth docutils literal notranslate"><span class="pre">matplotlib.axes.Axes.plot()</span></code></a></li> </ul> </td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><em>list[matplotlib.lines.Line2D]</em> – lines plotted</p> </td> </tr> </tbody> </table> <div class="admonition seealso"> <p class="first admonition-title">See also</p> <p class="last"><a class="reference internal" href="#metpy.plots.Hodograph.plot_colormapped" title="metpy.plots.Hodograph.plot_colormapped"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Hodograph.plot_colormapped()</span></code></a></p> </div> </dd></dl> <dl class="method"> <dt id="metpy.plots.Hodograph.plot_colormapped"> <code class="descname">plot_colormapped</code><span class="sig-paren">(</span><em>u</em>, <em>v</em>, <em>c</em>, <em>bounds=None</em>, <em>colors=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/metpy/plots/skewt.html#Hodograph.plot_colormapped"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#metpy.plots.Hodograph.plot_colormapped" title="Permalink to this definition">¶</a></dt> <dd><p>Plot u, v data, with line colored based on a third set of data.</p> <p>Plots the wind data on the hodograph, but with a colormapped line. Takes a third variable besides the winds and either a colormap to color it with or a series of bounds and colors to create a colormap and norm to control colormapping. The bounds must always be in increasing order. For using custom bounds with height data, the function will automatically interpolate to the actual bounds from the height and wind data, as well as convert the input bounds from height AGL to height above MSL to work with the provided heights.</p> <p>Simple wrapper around plot so that pressure is the first (independent) input. This is essentially a wrapper around <em class="xref py py-obj">semilogy</em>. It also sets some appropriate ticking and plot ranges.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>u</strong> (<em>array_like</em>) – u-component of wind</li> <li><strong>v</strong> (<em>array_like</em>) – v-component of wind</li> <li><strong>c</strong> (<em>array_like</em>) – data to use for colormapping</li> <li><strong>bounds</strong> (<em>array-like</em><em>, </em><em>optional</em>) – Array of bounds for c to use in coloring the hodograph.</li> <li><strong>colors</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.6)"><em>list</em></a><em>, </em><em>optional</em>) – Array of strings representing colors for the hodograph segments.</li> <li><strong>kwargs</strong> – Other keyword arguments to pass to <a class="reference external" href="https://matplotlib.org/api/collections_api.html#matplotlib.collections.LineCollection" title="(in Matplotlib v2.2.2)"><code class="xref py py-class docutils literal notranslate"><span class="pre">matplotlib.collections.LineCollection</span></code></a></li> </ul> </td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><em>matplotlib.collections.LineCollection</em> – instance created</p> </td> </tr> </tbody> </table> <div class="admonition seealso"> <p class="first admonition-title">See also</p> <p class="last"><a class="reference internal" href="#metpy.plots.Hodograph.plot" title="metpy.plots.Hodograph.plot"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Hodograph.plot()</span></code></a></p> </div> </dd></dl> <dl class="method"> <dt id="metpy.plots.Hodograph.wind_vectors"> <code class="descname">wind_vectors</code><span class="sig-paren">(</span><em>u</em>, <em>v</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/metpy/plots/skewt.html#Hodograph.wind_vectors"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#metpy.plots.Hodograph.wind_vectors" title="Permalink to this definition">¶</a></dt> <dd><p>Plot u, v data as wind vectors.</p> <p>Plot the wind data as vectors for each level, beginning at the origin.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>u</strong> (<em>array_like</em>) – u-component of wind</li> <li><strong>v</strong> (<em>array_like</em>) – v-component of wind</li> <li><strong>kwargs</strong> – Other keyword arguments to pass to <a class="reference external" href="https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.quiver.html#matplotlib.axes.Axes.quiver" title="(in Matplotlib v2.2.2)"><code class="xref py py-meth docutils literal notranslate"><span class="pre">matplotlib.axes.Axes.quiver()</span></code></a></li> </ul> </td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><em>matplotlib.quiver.Quiver</em> – arrows plotted</p> </td> </tr> </tbody> </table> </dd></dl> </dd></dl> <div class="section" id="examples-using-metpy-plots-hodograph"> <h2>Examples using <code class="docutils literal notranslate"><span class="pre">metpy.plots.Hodograph</span></code><a class="headerlink" href="#examples-using-metpy-plots-hodograph" title="Permalink to this headline">¶</a></h2> <div class="sphx-glr-thumbcontainer" tooltip="Combine a Skew-T and a hodograph using Matplotlib&#x27;s `GridSpec` layout capability. "><div class="figure" id="id1"> <img alt="../../_images/sphx_glr_Skew-T_Layout_thumb.png" src="../../_images/sphx_glr_Skew-T_Layout_thumb.png" /> <p class="caption"><span class="caption-text"><a class="reference internal" href="../../examples/plots/Skew-T_Layout.html#sphx-glr-examples-plots-skew-t-layout-py"><span class="std std-ref">Skew-T with Complex Layout</span></a></span></p> </div> </div><div class="sphx-glr-thumbcontainer" tooltip="Layout a Skew-T plot with a hodograph inset into the plot. "><div class="figure" id="id2"> <img alt="../../_images/sphx_glr_Hodograph_Inset_thumb.png" src="../../_images/sphx_glr_Hodograph_Inset_thumb.png" /> <p class="caption"><span class="caption-text"><a class="reference internal" href="../../examples/plots/Hodograph_Inset.html#sphx-glr-examples-plots-hodograph-inset-py"><span class="std std-ref">Hodograph Inset</span></a></span></p> </div> </div><div class="sphx-glr-thumbcontainer" tooltip="Upper air analysis is a staple of many synoptic and mesoscale analysis problems. In this tutori..."><div class="figure" id="id3"> <img alt="../../_images/sphx_glr_upperair_soundings_thumb.png" src="../../_images/sphx_glr_upperair_soundings_thumb.png" /> <p class="caption"><span class="caption-text"><a class="reference internal" href="../../tutorials/upperair_soundings.html#sphx-glr-tutorials-upperair-soundings-py"><span class="std std-ref">Upper Air Sounding Tutorial</span></a></span></p> </div> </div><div style='clear:both'></div></div> </div> </div> <div class="articleComments"> </div> </div> <footer> <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> <a href="metpy.plots.SkewT.html" class="btn btn-neutral float-right" title="SkewT" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a> <a href="metpy.plots.read_colortable.html" class="btn btn-neutral" title="read_colortable" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a> </div> <hr/> <div role="contentinfo"> <p> &copy; Copyright 2017, MetPy Developers. Last updated on May 17, 2018 at 20:56:37. </p> </div> Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-92978945-1', 'auto'); ga('send', 'pageview'); </script> <script>var version_json_loc = "../../../versions.json";</script> <p>Do you enjoy using MetPy? <a href="https://saythanks.io/to/unidata" class="btn btn-neutral" title="Say Thanks!" accesskey="n">Say Thanks!</a> </p> </footer> </div> </div> </section> </div> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT:'../../', VERSION:'0.8.0', LANGUAGE:'None', COLLAPSE_INDEX:false, FILE_SUFFIX:'.html', HAS_SOURCE: true, SOURCELINK_SUFFIX: '.txt' }; </script> <script type="text/javascript" src="../../_static/jquery.js"></script> <script type="text/javascript" src="../../_static/underscore.js"></script> <script type="text/javascript" src="../../_static/doctools.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> <script type="text/javascript" src="../../_static/pop_ver.js"></script> <script type="text/javascript" src="../../_static/js/theme.js"></script> <script type="text/javascript"> jQuery(function () { SphinxRtdTheme.StickyNav.enable(); }); </script> </body> </html>
metpy/MetPy
v0.8/api/generated/metpy.plots.Hodograph.html
HTML
bsd-3-clause
26,366
/* Document : mycss Created on : 8/06/2013, 09:43:46 AM Author : RobertoCarlos Description: Purpose of the stylesheet follows. */ .mydesing{ border: solid 2px #333; background-color: #0008cc; color: #e9322d; font-size: 20px; margin: 0 auto 0 auto; width: 1200px }
rcapuchino/myfirstapp
public/css/mycss.css
CSS
bsd-3-clause
321
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "third_party/blink/renderer/core/script/dynamic_module_resolver.h" #include "base/test/scoped_feature_list.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/features.h" #include "third_party/blink/renderer/bindings/core/v8/referrer_script_info.h" #include "third_party/blink/renderer/bindings/core/v8/script_function.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" #include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/loader/modulescript/module_script_fetch_request.h" #include "third_party/blink/renderer/core/script/js_module_script.h" #include "third_party/blink/renderer/core/testing/dummy_modulator.h" #include "third_party/blink/renderer/core/testing/module_test_base.h" #include "v8/include/v8.h" namespace blink { namespace { constexpr const char* kTestReferrerURL = "https://example.com/referrer.js"; constexpr const char* kTestDependencyURL = "https://example.com/dependency.js"; const KURL TestReferrerURL() { return KURL(kTestReferrerURL); } const KURL TestDependencyURL() { return KURL(kTestDependencyURL); } class DynamicModuleResolverTestModulator final : public DummyModulator { public: explicit DynamicModuleResolverTestModulator(ScriptState* script_state) : script_state_(script_state) {} ~DynamicModuleResolverTestModulator() override = default; void ResolveTreeFetch(ModuleScript* module_script) { ASSERT_TRUE(pending_client_); pending_client_->NotifyModuleTreeLoadFinished(module_script); pending_client_ = nullptr; } void SetExpectedFetchTreeURL(const KURL& url) { expected_fetch_tree_url_ = url; } bool fetch_tree_was_called() const { return fetch_tree_was_called_; } void Trace(Visitor*) override; private: // Implements Modulator: ScriptState* GetScriptState() final { return script_state_; } ModuleScript* GetFetchedModuleScript(const KURL& url) final { EXPECT_EQ(TestReferrerURL(), url); ModuleScript* module_script = JSModuleScript::CreateForTest(this, v8::Local<v8::Module>(), url); return module_script; } KURL ResolveModuleSpecifier(const String& module_request, const KURL& base_url, String* failure_reason) final { if (module_request == "invalid-specifier") return KURL(); return KURL(base_url, module_request); } void ClearIsAcquiringImportMaps() final {} void FetchTree(const KURL& url, ResourceFetcher*, mojom::RequestContextType, network::mojom::RequestDestination, const ScriptFetchOptions&, ModuleScriptCustomFetchType custom_fetch_type, ModuleTreeClient* client) final { EXPECT_EQ(expected_fetch_tree_url_, url); // Currently there are no usage of custom fetch hooks for dynamic import in // web specifications. EXPECT_EQ(ModuleScriptCustomFetchType::kNone, custom_fetch_type); pending_client_ = client; fetch_tree_was_called_ = true; } ModuleEvaluationResult ExecuteModule( ModuleScript* module_script, CaptureEvalErrorFlag capture_error) final { EXPECT_EQ(CaptureEvalErrorFlag::kCapture, capture_error); ScriptState::EscapableScope scope(script_state_); ModuleEvaluationResult result = ModuleRecord::Evaluate( script_state_, module_script->V8Module(), module_script->SourceURL()); return result.Escape(&scope); } Member<ScriptState> script_state_; Member<ModuleTreeClient> pending_client_; KURL expected_fetch_tree_url_; bool fetch_tree_was_called_ = false; }; void DynamicModuleResolverTestModulator::Trace(Visitor* visitor) { visitor->Trace(script_state_); visitor->Trace(pending_client_); DummyModulator::Trace(visitor); } // CaptureExportedStringFunction implements a javascript function // with a single argument of type module namespace. // CaptureExportedStringFunction captures the exported string value // from the module namespace as a WTF::String, exposed via CapturedValue(). class CaptureExportedStringFunction final : public ScriptFunction { public: CaptureExportedStringFunction(ScriptState* script_state, const String& export_name) : ScriptFunction(script_state), export_name_(export_name) {} v8::Local<v8::Function> Bind() { return BindToV8Function(); } bool WasCalled() const { return was_called_; } const String& CapturedValue() const { return captured_value_; } private: ScriptValue Call(ScriptValue value) override { was_called_ = true; v8::Isolate* isolate = GetScriptState()->GetIsolate(); v8::Local<v8::Context> context = GetScriptState()->GetContext(); v8::Local<v8::Object> module_namespace = value.V8Value()->ToObject(context).ToLocalChecked(); v8::Local<v8::Value> exported_value = module_namespace->Get(context, V8String(isolate, export_name_)) .ToLocalChecked(); captured_value_ = ToCoreString(exported_value->ToString(context).ToLocalChecked()); return ScriptValue(); } const String export_name_; bool was_called_ = false; String captured_value_; }; // CaptureErrorFunction implements a javascript function which captures // name and error of the exception passed as its argument. class CaptureErrorFunction final : public ScriptFunction { public: explicit CaptureErrorFunction(ScriptState* script_state) : ScriptFunction(script_state) {} v8::Local<v8::Function> Bind() { return BindToV8Function(); } bool WasCalled() const { return was_called_; } const String& Name() const { return name_; } const String& Message() const { return message_; } private: ScriptValue Call(ScriptValue value) override { was_called_ = true; v8::Isolate* isolate = GetScriptState()->GetIsolate(); v8::Local<v8::Context> context = GetScriptState()->GetContext(); v8::Local<v8::Object> error_object = value.V8Value()->ToObject(context).ToLocalChecked(); v8::Local<v8::Value> name = error_object->Get(context, V8String(isolate, "name")).ToLocalChecked(); name_ = ToCoreString(name->ToString(context).ToLocalChecked()); v8::Local<v8::Value> message = error_object->Get(context, V8String(isolate, "message")) .ToLocalChecked(); message_ = ToCoreString(message->ToString(context).ToLocalChecked()); return ScriptValue(); } bool was_called_ = false; String name_; String message_; }; class DynamicModuleResolverTestNotReached final : public ScriptFunction { public: static v8::Local<v8::Function> CreateFunction(ScriptState* script_state) { auto* not_reached = MakeGarbageCollected<DynamicModuleResolverTestNotReached>(script_state); return not_reached->BindToV8Function(); } explicit DynamicModuleResolverTestNotReached(ScriptState* script_state) : ScriptFunction(script_state) {} private: ScriptValue Call(ScriptValue) override { ADD_FAILURE(); return ScriptValue(); } }; class DynamicModuleResolverTest : public testing::Test, public ParametrizedModuleTest { public: void SetUp() override { ParametrizedModuleTest::SetUp(); } void TearDown() override { ParametrizedModuleTest::TearDown(); } }; } // namespace TEST_P(DynamicModuleResolverTest, ResolveSuccess) { V8TestingScope scope; auto* modulator = MakeGarbageCollected<DynamicModuleResolverTestModulator>( scope.GetScriptState()); modulator->SetExpectedFetchTreeURL(TestDependencyURL()); auto* promise_resolver = MakeGarbageCollected<ScriptPromiseResolver>(scope.GetScriptState()); ScriptPromise promise = promise_resolver->Promise(); auto* capture = MakeGarbageCollected<CaptureExportedStringFunction>( scope.GetScriptState(), "foo"); promise.Then(capture->Bind(), DynamicModuleResolverTestNotReached::CreateFunction( scope.GetScriptState())); auto* resolver = MakeGarbageCollected<DynamicModuleResolver>(modulator); resolver->ResolveDynamically("./dependency.js", TestReferrerURL(), ReferrerScriptInfo(), promise_resolver); v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate()); EXPECT_FALSE(capture->WasCalled()); v8::Local<v8::Module> record = ModuleRecord::Compile( scope.GetIsolate(), "export const foo = 'hello';", TestReferrerURL(), TestReferrerURL(), ScriptFetchOptions(), TextPosition::MinimumPosition(), ASSERT_NO_EXCEPTION); ModuleScript* module_script = JSModuleScript::CreateForTest(modulator, record, TestDependencyURL()); EXPECT_TRUE(ModuleRecord::Instantiate(scope.GetScriptState(), record, TestReferrerURL()) .IsEmpty()); modulator->ResolveTreeFetch(module_script); v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate()); EXPECT_TRUE(capture->WasCalled()); EXPECT_EQ("hello", capture->CapturedValue()); } TEST_P(DynamicModuleResolverTest, ResolveSpecifierFailure) { V8TestingScope scope; auto* modulator = MakeGarbageCollected<DynamicModuleResolverTestModulator>( scope.GetScriptState()); modulator->SetExpectedFetchTreeURL(TestDependencyURL()); auto* promise_resolver = MakeGarbageCollected<ScriptPromiseResolver>(scope.GetScriptState()); ScriptPromise promise = promise_resolver->Promise(); auto* capture = MakeGarbageCollected<CaptureErrorFunction>(scope.GetScriptState()); promise.Then(DynamicModuleResolverTestNotReached::CreateFunction( scope.GetScriptState()), capture->Bind()); auto* resolver = MakeGarbageCollected<DynamicModuleResolver>(modulator); resolver->ResolveDynamically("invalid-specifier", TestReferrerURL(), ReferrerScriptInfo(), promise_resolver); v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate()); EXPECT_TRUE(capture->WasCalled()); EXPECT_EQ("TypeError", capture->Name()); EXPECT_TRUE(capture->Message().StartsWith("Failed to resolve")); } TEST_P(DynamicModuleResolverTest, FetchFailure) { V8TestingScope scope; auto* modulator = MakeGarbageCollected<DynamicModuleResolverTestModulator>( scope.GetScriptState()); modulator->SetExpectedFetchTreeURL(TestDependencyURL()); auto* promise_resolver = MakeGarbageCollected<ScriptPromiseResolver>(scope.GetScriptState()); ScriptPromise promise = promise_resolver->Promise(); auto* capture = MakeGarbageCollected<CaptureErrorFunction>(scope.GetScriptState()); promise.Then(DynamicModuleResolverTestNotReached::CreateFunction( scope.GetScriptState()), capture->Bind()); auto* resolver = MakeGarbageCollected<DynamicModuleResolver>(modulator); resolver->ResolveDynamically("./dependency.js", TestReferrerURL(), ReferrerScriptInfo(), promise_resolver); EXPECT_FALSE(capture->WasCalled()); modulator->ResolveTreeFetch(nullptr); v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate()); EXPECT_TRUE(capture->WasCalled()); EXPECT_EQ("TypeError", capture->Name()); EXPECT_TRUE(capture->Message().StartsWith("Failed to fetch")); } TEST_P(DynamicModuleResolverTest, ExceptionThrown) { V8TestingScope scope; auto* modulator = MakeGarbageCollected<DynamicModuleResolverTestModulator>( scope.GetScriptState()); modulator->SetExpectedFetchTreeURL(TestDependencyURL()); auto* promise_resolver = MakeGarbageCollected<ScriptPromiseResolver>(scope.GetScriptState()); ScriptPromise promise = promise_resolver->Promise(); auto* capture = MakeGarbageCollected<CaptureErrorFunction>(scope.GetScriptState()); promise.Then(DynamicModuleResolverTestNotReached::CreateFunction( scope.GetScriptState()), capture->Bind()); auto* resolver = MakeGarbageCollected<DynamicModuleResolver>(modulator); resolver->ResolveDynamically("./dependency.js", TestReferrerURL(), ReferrerScriptInfo(), promise_resolver); EXPECT_FALSE(capture->WasCalled()); v8::Local<v8::Module> record = ModuleRecord::Compile( scope.GetIsolate(), "throw Error('bar')", TestReferrerURL(), TestReferrerURL(), ScriptFetchOptions(), TextPosition::MinimumPosition(), ASSERT_NO_EXCEPTION); ModuleScript* module_script = JSModuleScript::CreateForTest(modulator, record, TestDependencyURL()); EXPECT_TRUE(ModuleRecord::Instantiate(scope.GetScriptState(), record, TestReferrerURL()) .IsEmpty()); modulator->ResolveTreeFetch(module_script); v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate()); EXPECT_TRUE(capture->WasCalled()); EXPECT_EQ("Error", capture->Name()); EXPECT_EQ("bar", capture->Message()); } TEST_P(DynamicModuleResolverTest, ResolveWithNullReferrerScriptSuccess) { V8TestingScope scope; scope.GetDocument().SetURL(KURL("https://example.com")); auto* modulator = MakeGarbageCollected<DynamicModuleResolverTestModulator>( scope.GetScriptState()); modulator->SetExpectedFetchTreeURL(TestDependencyURL()); auto* promise_resolver = MakeGarbageCollected<ScriptPromiseResolver>(scope.GetScriptState()); ScriptPromise promise = promise_resolver->Promise(); auto* capture = MakeGarbageCollected<CaptureExportedStringFunction>( scope.GetScriptState(), "foo"); promise.Then(capture->Bind(), DynamicModuleResolverTestNotReached::CreateFunction( scope.GetScriptState())); auto* resolver = MakeGarbageCollected<DynamicModuleResolver>(modulator); resolver->ResolveDynamically("./dependency.js", /* null referrer */ KURL(), ReferrerScriptInfo(), promise_resolver); v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate()); EXPECT_FALSE(capture->WasCalled()); v8::Local<v8::Module> record = ModuleRecord::Compile( scope.GetIsolate(), "export const foo = 'hello';", TestDependencyURL(), TestDependencyURL(), ScriptFetchOptions(), TextPosition::MinimumPosition(), ASSERT_NO_EXCEPTION); ModuleScript* module_script = JSModuleScript::CreateForTest(modulator, record, TestDependencyURL()); EXPECT_TRUE(ModuleRecord::Instantiate(scope.GetScriptState(), record, TestDependencyURL()) .IsEmpty()); modulator->ResolveTreeFetch(module_script); v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate()); EXPECT_TRUE(capture->WasCalled()); EXPECT_EQ("hello", capture->CapturedValue()); } TEST_P(DynamicModuleResolverTest, ResolveWithReferrerScriptInfoBaseURL) { V8TestingScope scope; scope.GetDocument().SetURL(KURL("https://example.com")); auto* modulator = MakeGarbageCollected<DynamicModuleResolverTestModulator>( scope.GetScriptState()); modulator->SetExpectedFetchTreeURL( KURL("https://example.com/correct/dependency.js")); auto* promise_resolver = MakeGarbageCollected<ScriptPromiseResolver>(scope.GetScriptState()); auto* resolver = MakeGarbageCollected<DynamicModuleResolver>(modulator); KURL wrong_base_url("https://example.com/wrong/bar.js"); KURL correct_base_url("https://example.com/correct/baz.js"); resolver->ResolveDynamically( "./dependency.js", wrong_base_url, ReferrerScriptInfo(correct_base_url, ScriptFetchOptions()), promise_resolver); v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate()); EXPECT_TRUE(modulator->fetch_tree_was_called()); } // Instantiate tests once with TLA and once without: INSTANTIATE_TEST_SUITE_P(DynamicModuleResolverTestGroup, DynamicModuleResolverTest, testing::Bool(), ParametrizedModuleTestParamName()); } // namespace blink
endlessm/chromium-browser
third_party/blink/renderer/core/script/dynamic_module_resolver_test.cc
C++
bsd-3-clause
16,317
<?php namespace app\models; use Yii; /** * This is the model class for table "book". * * @property integer $id * @property string $title * @property string $published_date * * @property BookAuthor[] $bookAuthors * @property BookGenre[] $bookGenres */ class Book extends \yii\db\ActiveRecord { /** * @inheritdoc */ public static function tableName() { return 'book'; } /** * @inheritdoc */ public function rules() { return [ [['title', 'published_date'], 'required'], [['published_date'], 'safe'], [['title'], 'string', 'max' => 256] ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => 'ID', 'title' => 'Title', 'published_date' => 'Published Date', ]; } /** * @return \yii\db\ActiveQuery */ public function getBookAuthors() { return $this->hasMany('book_author', ['book_id' => 'id']); } /** * @return \yii\db\ActiveQuery */ public function getBookGenres() { return $this->hasMany('book_genre', ['book_id' => 'id']); } /** * @inheritdoc * @return BookQuery the active query used by this AR class. */ public static function find() { return new BookQuery(get_called_class()); } }
uaman89/library
models/Book.php
PHP
bsd-3-clause
1,418
-------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.Raw.Compatibility31 -- Copyright : (c) Sven Panne 2015 -- License : BSD3 -- -- Maintainer : Sven Panne <[email protected]> -- Stability : stable -- Portability : portable -- -------------------------------------------------------------------------------- module Graphics.Rendering.OpenGL.Raw.Compatibility31 ( -- * Types GLbitfield, GLboolean, GLbyte, GLchar, GLclampd, GLclampf, GLdouble, GLenum, GLfloat, GLhalf, GLint, GLintptr, GLshort, GLsizei, GLsizeiptr, GLubyte, GLuint, GLushort, GLvoid, -- * Enums gl_2D, gl_2_BYTES, gl_3D, gl_3D_COLOR, gl_3D_COLOR_TEXTURE, gl_3_BYTES, gl_4D_COLOR_TEXTURE, gl_4_BYTES, gl_ACCUM, gl_ACCUM_ALPHA_BITS, gl_ACCUM_BLUE_BITS, gl_ACCUM_BUFFER_BIT, gl_ACCUM_CLEAR_VALUE, gl_ACCUM_GREEN_BITS, gl_ACCUM_RED_BITS, gl_ACTIVE_ATTRIBUTES, gl_ACTIVE_ATTRIBUTE_MAX_LENGTH, gl_ACTIVE_TEXTURE, gl_ACTIVE_UNIFORMS, gl_ACTIVE_UNIFORM_BLOCKS, gl_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, gl_ACTIVE_UNIFORM_MAX_LENGTH, gl_ADD, gl_ADD_SIGNED, gl_ALIASED_LINE_WIDTH_RANGE, gl_ALIASED_POINT_SIZE_RANGE, gl_ALL_ATTRIB_BITS, gl_ALPHA, gl_ALPHA12, gl_ALPHA16, gl_ALPHA4, gl_ALPHA8, gl_ALPHA_BIAS, gl_ALPHA_BITS, gl_ALPHA_INTEGER, gl_ALPHA_SCALE, gl_ALPHA_TEST, gl_ALPHA_TEST_FUNC, gl_ALPHA_TEST_REF, gl_ALWAYS, gl_AMBIENT, gl_AMBIENT_AND_DIFFUSE, gl_AND, gl_AND_INVERTED, gl_AND_REVERSE, gl_ARRAY_BUFFER, gl_ARRAY_BUFFER_BINDING, gl_ATTACHED_SHADERS, gl_ATTRIB_STACK_DEPTH, gl_AUTO_NORMAL, gl_AUX0, gl_AUX1, gl_AUX2, gl_AUX3, gl_AUX_BUFFERS, gl_BACK, gl_BACK_LEFT, gl_BACK_RIGHT, gl_BGR, gl_BGRA, gl_BGRA_INTEGER, gl_BGR_INTEGER, gl_BITMAP, gl_BITMAP_TOKEN, gl_BLEND, gl_BLEND_DST, gl_BLEND_DST_ALPHA, gl_BLEND_DST_RGB, gl_BLEND_EQUATION_ALPHA, gl_BLEND_EQUATION_RGB, gl_BLEND_SRC, gl_BLEND_SRC_ALPHA, gl_BLEND_SRC_RGB, gl_BLUE, gl_BLUE_BIAS, gl_BLUE_BITS, gl_BLUE_INTEGER, gl_BLUE_SCALE, gl_BOOL, gl_BOOL_VEC2, gl_BOOL_VEC3, gl_BOOL_VEC4, gl_BUFFER_ACCESS, gl_BUFFER_ACCESS_FLAGS, gl_BUFFER_MAPPED, gl_BUFFER_MAP_LENGTH, gl_BUFFER_MAP_OFFSET, gl_BUFFER_MAP_POINTER, gl_BUFFER_SIZE, gl_BUFFER_USAGE, gl_BYTE, gl_C3F_V3F, gl_C4F_N3F_V3F, gl_C4UB_V2F, gl_C4UB_V3F, gl_CCW, gl_CLAMP, gl_CLAMP_FRAGMENT_COLOR, gl_CLAMP_READ_COLOR, gl_CLAMP_TO_BORDER, gl_CLAMP_TO_EDGE, gl_CLAMP_VERTEX_COLOR, gl_CLEAR, gl_CLIENT_ACTIVE_TEXTURE, gl_CLIENT_ALL_ATTRIB_BITS, gl_CLIENT_ATTRIB_STACK_DEPTH, gl_CLIENT_PIXEL_STORE_BIT, gl_CLIENT_VERTEX_ARRAY_BIT, gl_CLIP_DISTANCE0, gl_CLIP_DISTANCE1, gl_CLIP_DISTANCE2, gl_CLIP_DISTANCE3, gl_CLIP_DISTANCE4, gl_CLIP_DISTANCE5, gl_CLIP_DISTANCE6, gl_CLIP_DISTANCE7, gl_CLIP_PLANE0, gl_CLIP_PLANE1, gl_CLIP_PLANE2, gl_CLIP_PLANE3, gl_CLIP_PLANE4, gl_CLIP_PLANE5, gl_COEFF, gl_COLOR, gl_COLOR_ARRAY, gl_COLOR_ARRAY_BUFFER_BINDING, gl_COLOR_ARRAY_POINTER, gl_COLOR_ARRAY_SIZE, gl_COLOR_ARRAY_STRIDE, gl_COLOR_ARRAY_TYPE, gl_COLOR_ATTACHMENT0, gl_COLOR_ATTACHMENT1, gl_COLOR_ATTACHMENT10, gl_COLOR_ATTACHMENT11, gl_COLOR_ATTACHMENT12, gl_COLOR_ATTACHMENT13, gl_COLOR_ATTACHMENT14, gl_COLOR_ATTACHMENT15, gl_COLOR_ATTACHMENT2, gl_COLOR_ATTACHMENT3, gl_COLOR_ATTACHMENT4, gl_COLOR_ATTACHMENT5, gl_COLOR_ATTACHMENT6, gl_COLOR_ATTACHMENT7, gl_COLOR_ATTACHMENT8, gl_COLOR_ATTACHMENT9, gl_COLOR_BUFFER_BIT, gl_COLOR_CLEAR_VALUE, gl_COLOR_INDEX, gl_COLOR_INDEXES, gl_COLOR_LOGIC_OP, gl_COLOR_MATERIAL, gl_COLOR_MATERIAL_FACE, gl_COLOR_MATERIAL_PARAMETER, gl_COLOR_SUM, gl_COLOR_WRITEMASK, gl_COMBINE, gl_COMBINE_ALPHA, gl_COMBINE_RGB, gl_COMPARE_REF_TO_TEXTURE, gl_COMPARE_R_TO_TEXTURE, gl_COMPILE, gl_COMPILE_AND_EXECUTE, gl_COMPILE_STATUS, gl_COMPRESSED_ALPHA, gl_COMPRESSED_INTENSITY, gl_COMPRESSED_LUMINANCE, gl_COMPRESSED_LUMINANCE_ALPHA, gl_COMPRESSED_RED, gl_COMPRESSED_RED_RGTC1, gl_COMPRESSED_RG, gl_COMPRESSED_RGB, gl_COMPRESSED_RGBA, gl_COMPRESSED_RG_RGTC2, gl_COMPRESSED_SIGNED_RED_RGTC1, gl_COMPRESSED_SIGNED_RG_RGTC2, gl_COMPRESSED_SLUMINANCE, gl_COMPRESSED_SLUMINANCE_ALPHA, gl_COMPRESSED_SRGB, gl_COMPRESSED_SRGB_ALPHA, gl_COMPRESSED_TEXTURE_FORMATS, gl_CONSTANT, gl_CONSTANT_ALPHA, gl_CONSTANT_ATTENUATION, gl_CONSTANT_COLOR, gl_CONTEXT_FLAGS, gl_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT, gl_COORD_REPLACE, gl_COPY, gl_COPY_INVERTED, gl_COPY_PIXEL_TOKEN, gl_COPY_READ_BUFFER, gl_COPY_WRITE_BUFFER, gl_CULL_FACE, gl_CULL_FACE_MODE, gl_CURRENT_BIT, gl_CURRENT_COLOR, gl_CURRENT_FOG_COORD, gl_CURRENT_FOG_COORDINATE, gl_CURRENT_INDEX, gl_CURRENT_NORMAL, gl_CURRENT_PROGRAM, gl_CURRENT_QUERY, gl_CURRENT_RASTER_COLOR, gl_CURRENT_RASTER_DISTANCE, gl_CURRENT_RASTER_INDEX, gl_CURRENT_RASTER_POSITION, gl_CURRENT_RASTER_POSITION_VALID, gl_CURRENT_RASTER_SECONDARY_COLOR, gl_CURRENT_RASTER_TEXTURE_COORDS, gl_CURRENT_SECONDARY_COLOR, gl_CURRENT_TEXTURE_COORDS, gl_CURRENT_VERTEX_ATTRIB, gl_CW, gl_DECAL, gl_DECR, gl_DECR_WRAP, gl_DELETE_STATUS, gl_DEPTH, gl_DEPTH24_STENCIL8, gl_DEPTH32F_STENCIL8, gl_DEPTH_ATTACHMENT, gl_DEPTH_BIAS, gl_DEPTH_BITS, gl_DEPTH_BUFFER_BIT, gl_DEPTH_CLEAR_VALUE, gl_DEPTH_COMPONENT, gl_DEPTH_COMPONENT16, gl_DEPTH_COMPONENT24, gl_DEPTH_COMPONENT32, gl_DEPTH_COMPONENT32F, gl_DEPTH_FUNC, gl_DEPTH_RANGE, gl_DEPTH_SCALE, gl_DEPTH_STENCIL, gl_DEPTH_STENCIL_ATTACHMENT, gl_DEPTH_TEST, gl_DEPTH_TEXTURE_MODE, gl_DEPTH_WRITEMASK, gl_DIFFUSE, gl_DITHER, gl_DOMAIN, gl_DONT_CARE, gl_DOT3_RGB, gl_DOT3_RGBA, gl_DOUBLE, gl_DOUBLEBUFFER, gl_DRAW_BUFFER, gl_DRAW_BUFFER0, gl_DRAW_BUFFER1, gl_DRAW_BUFFER10, gl_DRAW_BUFFER11, gl_DRAW_BUFFER12, gl_DRAW_BUFFER13, gl_DRAW_BUFFER14, gl_DRAW_BUFFER15, gl_DRAW_BUFFER2, gl_DRAW_BUFFER3, gl_DRAW_BUFFER4, gl_DRAW_BUFFER5, gl_DRAW_BUFFER6, gl_DRAW_BUFFER7, gl_DRAW_BUFFER8, gl_DRAW_BUFFER9, gl_DRAW_FRAMEBUFFER, gl_DRAW_FRAMEBUFFER_BINDING, gl_DRAW_PIXEL_TOKEN, gl_DST_ALPHA, gl_DST_COLOR, gl_DYNAMIC_COPY, gl_DYNAMIC_DRAW, gl_DYNAMIC_READ, gl_EDGE_FLAG, gl_EDGE_FLAG_ARRAY, gl_EDGE_FLAG_ARRAY_BUFFER_BINDING, gl_EDGE_FLAG_ARRAY_POINTER, gl_EDGE_FLAG_ARRAY_STRIDE, gl_ELEMENT_ARRAY_BUFFER, gl_ELEMENT_ARRAY_BUFFER_BINDING, gl_EMISSION, gl_ENABLE_BIT, gl_EQUAL, gl_EQUIV, gl_EVAL_BIT, gl_EXP, gl_EXP2, gl_EXTENSIONS, gl_EYE_LINEAR, gl_EYE_PLANE, gl_FALSE, gl_FASTEST, gl_FEEDBACK, gl_FEEDBACK_BUFFER_POINTER, gl_FEEDBACK_BUFFER_SIZE, gl_FEEDBACK_BUFFER_TYPE, gl_FILL, gl_FIXED_ONLY, gl_FLAT, gl_FLOAT, gl_FLOAT_32_UNSIGNED_INT_24_8_REV, gl_FLOAT_MAT2, gl_FLOAT_MAT2x3, gl_FLOAT_MAT2x4, gl_FLOAT_MAT3, gl_FLOAT_MAT3x2, gl_FLOAT_MAT3x4, gl_FLOAT_MAT4, gl_FLOAT_MAT4x2, gl_FLOAT_MAT4x3, gl_FLOAT_VEC2, gl_FLOAT_VEC3, gl_FLOAT_VEC4, gl_FOG, gl_FOG_BIT, gl_FOG_COLOR, gl_FOG_COORD, gl_FOG_COORDINATE, gl_FOG_COORDINATE_ARRAY, gl_FOG_COORDINATE_ARRAY_BUFFER_BINDING, gl_FOG_COORDINATE_ARRAY_POINTER, gl_FOG_COORDINATE_ARRAY_STRIDE, gl_FOG_COORDINATE_ARRAY_TYPE, gl_FOG_COORDINATE_SOURCE, gl_FOG_COORD_ARRAY, gl_FOG_COORD_ARRAY_BUFFER_BINDING, gl_FOG_COORD_ARRAY_POINTER, gl_FOG_COORD_ARRAY_STRIDE, gl_FOG_COORD_ARRAY_TYPE, gl_FOG_COORD_SRC, gl_FOG_DENSITY, gl_FOG_END, gl_FOG_HINT, gl_FOG_INDEX, gl_FOG_MODE, gl_FOG_START, gl_FRAGMENT_DEPTH, gl_FRAGMENT_SHADER, gl_FRAGMENT_SHADER_DERIVATIVE_HINT, gl_FRAMEBUFFER, gl_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, gl_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE, gl_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, gl_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE, gl_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE, gl_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE, gl_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, gl_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, gl_FRAMEBUFFER_ATTACHMENT_RED_SIZE, gl_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, gl_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE, gl_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER, gl_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL, gl_FRAMEBUFFER_BINDING, gl_FRAMEBUFFER_COMPLETE, gl_FRAMEBUFFER_DEFAULT, gl_FRAMEBUFFER_INCOMPLETE_ATTACHMENT, gl_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER, gl_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT, gl_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE, gl_FRAMEBUFFER_INCOMPLETE_READ_BUFFER, gl_FRAMEBUFFER_SRGB, gl_FRAMEBUFFER_UNDEFINED, gl_FRAMEBUFFER_UNSUPPORTED, gl_FRONT, gl_FRONT_AND_BACK, gl_FRONT_FACE, gl_FRONT_LEFT, gl_FRONT_RIGHT, gl_FUNC_ADD, gl_FUNC_REVERSE_SUBTRACT, gl_FUNC_SUBTRACT, gl_GENERATE_MIPMAP, gl_GENERATE_MIPMAP_HINT, gl_GEQUAL, gl_GREATER, gl_GREEN, gl_GREEN_BIAS, gl_GREEN_BITS, gl_GREEN_INTEGER, gl_GREEN_SCALE, gl_HALF_FLOAT, gl_HINT_BIT, gl_INCR, gl_INCR_WRAP, gl_INDEX, gl_INDEX_ARRAY, gl_INDEX_ARRAY_BUFFER_BINDING, gl_INDEX_ARRAY_POINTER, gl_INDEX_ARRAY_STRIDE, gl_INDEX_ARRAY_TYPE, gl_INDEX_BITS, gl_INDEX_CLEAR_VALUE, gl_INDEX_LOGIC_OP, gl_INDEX_MODE, gl_INDEX_OFFSET, gl_INDEX_SHIFT, gl_INDEX_WRITEMASK, gl_INFO_LOG_LENGTH, gl_INT, gl_INTENSITY, gl_INTENSITY12, gl_INTENSITY16, gl_INTENSITY4, gl_INTENSITY8, gl_INTERLEAVED_ATTRIBS, gl_INTERPOLATE, gl_INT_SAMPLER_1D, gl_INT_SAMPLER_1D_ARRAY, gl_INT_SAMPLER_2D, gl_INT_SAMPLER_2D_ARRAY, gl_INT_SAMPLER_2D_RECT, gl_INT_SAMPLER_3D, gl_INT_SAMPLER_BUFFER, gl_INT_SAMPLER_CUBE, gl_INT_VEC2, gl_INT_VEC3, gl_INT_VEC4, gl_INVALID_ENUM, gl_INVALID_FRAMEBUFFER_OPERATION, gl_INVALID_INDEX, gl_INVALID_OPERATION, gl_INVALID_VALUE, gl_INVERT, gl_KEEP, gl_LEFT, gl_LEQUAL, gl_LESS, gl_LIGHT0, gl_LIGHT1, gl_LIGHT2, gl_LIGHT3, gl_LIGHT4, gl_LIGHT5, gl_LIGHT6, gl_LIGHT7, gl_LIGHTING, gl_LIGHTING_BIT, gl_LIGHT_MODEL_AMBIENT, gl_LIGHT_MODEL_COLOR_CONTROL, gl_LIGHT_MODEL_LOCAL_VIEWER, gl_LIGHT_MODEL_TWO_SIDE, gl_LINE, gl_LINEAR, gl_LINEAR_ATTENUATION, gl_LINEAR_MIPMAP_LINEAR, gl_LINEAR_MIPMAP_NEAREST, gl_LINES, gl_LINE_BIT, gl_LINE_LOOP, gl_LINE_RESET_TOKEN, gl_LINE_SMOOTH, gl_LINE_SMOOTH_HINT, gl_LINE_STIPPLE, gl_LINE_STIPPLE_PATTERN, gl_LINE_STIPPLE_REPEAT, gl_LINE_STRIP, gl_LINE_TOKEN, gl_LINE_WIDTH, gl_LINE_WIDTH_GRANULARITY, gl_LINE_WIDTH_RANGE, gl_LINK_STATUS, gl_LIST_BASE, gl_LIST_BIT, gl_LIST_INDEX, gl_LIST_MODE, gl_LOAD, gl_LOGIC_OP, gl_LOGIC_OP_MODE, gl_LOWER_LEFT, gl_LUMINANCE, gl_LUMINANCE12, gl_LUMINANCE12_ALPHA12, gl_LUMINANCE12_ALPHA4, gl_LUMINANCE16, gl_LUMINANCE16_ALPHA16, gl_LUMINANCE4, gl_LUMINANCE4_ALPHA4, gl_LUMINANCE6_ALPHA2, gl_LUMINANCE8, gl_LUMINANCE8_ALPHA8, gl_LUMINANCE_ALPHA, gl_MAJOR_VERSION, gl_MAP1_COLOR_4, gl_MAP1_GRID_DOMAIN, gl_MAP1_GRID_SEGMENTS, gl_MAP1_INDEX, gl_MAP1_NORMAL, gl_MAP1_TEXTURE_COORD_1, gl_MAP1_TEXTURE_COORD_2, gl_MAP1_TEXTURE_COORD_3, gl_MAP1_TEXTURE_COORD_4, gl_MAP1_VERTEX_3, gl_MAP1_VERTEX_4, gl_MAP2_COLOR_4, gl_MAP2_GRID_DOMAIN, gl_MAP2_GRID_SEGMENTS, gl_MAP2_INDEX, gl_MAP2_NORMAL, gl_MAP2_TEXTURE_COORD_1, gl_MAP2_TEXTURE_COORD_2, gl_MAP2_TEXTURE_COORD_3, gl_MAP2_TEXTURE_COORD_4, gl_MAP2_VERTEX_3, gl_MAP2_VERTEX_4, gl_MAP_COLOR, gl_MAP_FLUSH_EXPLICIT_BIT, gl_MAP_INVALIDATE_BUFFER_BIT, gl_MAP_INVALIDATE_RANGE_BIT, gl_MAP_READ_BIT, gl_MAP_STENCIL, gl_MAP_UNSYNCHRONIZED_BIT, gl_MAP_WRITE_BIT, gl_MATRIX_MODE, gl_MAX, gl_MAX_3D_TEXTURE_SIZE, gl_MAX_ARRAY_TEXTURE_LAYERS, gl_MAX_ATTRIB_STACK_DEPTH, gl_MAX_CLIENT_ATTRIB_STACK_DEPTH, gl_MAX_CLIP_DISTANCES, gl_MAX_CLIP_PLANES, gl_MAX_COLOR_ATTACHMENTS, gl_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS, gl_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS, gl_MAX_COMBINED_TEXTURE_IMAGE_UNITS, gl_MAX_COMBINED_UNIFORM_BLOCKS, gl_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS, gl_MAX_CUBE_MAP_TEXTURE_SIZE, gl_MAX_DRAW_BUFFERS, gl_MAX_ELEMENTS_INDICES, gl_MAX_ELEMENTS_VERTICES, gl_MAX_EVAL_ORDER, gl_MAX_FRAGMENT_UNIFORM_BLOCKS, gl_MAX_FRAGMENT_UNIFORM_COMPONENTS, gl_MAX_GEOMETRY_UNIFORM_BLOCKS, gl_MAX_LIGHTS, gl_MAX_LIST_NESTING, gl_MAX_MODELVIEW_STACK_DEPTH, gl_MAX_NAME_STACK_DEPTH, gl_MAX_PIXEL_MAP_TABLE, gl_MAX_PROGRAM_TEXEL_OFFSET, gl_MAX_PROJECTION_STACK_DEPTH, gl_MAX_RECTANGLE_TEXTURE_SIZE, gl_MAX_RENDERBUFFER_SIZE, gl_MAX_SAMPLES, gl_MAX_TEXTURE_BUFFER_SIZE, gl_MAX_TEXTURE_COORDS, gl_MAX_TEXTURE_IMAGE_UNITS, gl_MAX_TEXTURE_LOD_BIAS, gl_MAX_TEXTURE_SIZE, gl_MAX_TEXTURE_STACK_DEPTH, gl_MAX_TEXTURE_UNITS, gl_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS, gl_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, gl_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS, gl_MAX_UNIFORM_BLOCK_SIZE, gl_MAX_UNIFORM_BUFFER_BINDINGS, gl_MAX_VARYING_COMPONENTS, gl_MAX_VARYING_FLOATS, gl_MAX_VERTEX_ATTRIBS, gl_MAX_VERTEX_TEXTURE_IMAGE_UNITS, gl_MAX_VERTEX_UNIFORM_BLOCKS, gl_MAX_VERTEX_UNIFORM_COMPONENTS, gl_MAX_VIEWPORT_DIMS, gl_MIN, gl_MINOR_VERSION, gl_MIN_PROGRAM_TEXEL_OFFSET, gl_MIRRORED_REPEAT, gl_MODELVIEW, gl_MODELVIEW_MATRIX, gl_MODELVIEW_STACK_DEPTH, gl_MODULATE, gl_MULT, gl_MULTISAMPLE, gl_MULTISAMPLE_BIT, gl_N3F_V3F, gl_NAME_STACK_DEPTH, gl_NAND, gl_NEAREST, gl_NEAREST_MIPMAP_LINEAR, gl_NEAREST_MIPMAP_NEAREST, gl_NEVER, gl_NICEST, gl_NONE, gl_NOOP, gl_NOR, gl_NORMALIZE, gl_NORMAL_ARRAY, gl_NORMAL_ARRAY_BUFFER_BINDING, gl_NORMAL_ARRAY_POINTER, gl_NORMAL_ARRAY_STRIDE, gl_NORMAL_ARRAY_TYPE, gl_NORMAL_MAP, gl_NOTEQUAL, gl_NO_ERROR, gl_NUM_COMPRESSED_TEXTURE_FORMATS, gl_NUM_EXTENSIONS, gl_OBJECT_LINEAR, gl_OBJECT_PLANE, gl_ONE, gl_ONE_MINUS_CONSTANT_ALPHA, gl_ONE_MINUS_CONSTANT_COLOR, gl_ONE_MINUS_DST_ALPHA, gl_ONE_MINUS_DST_COLOR, gl_ONE_MINUS_SRC_ALPHA, gl_ONE_MINUS_SRC_COLOR, gl_OPERAND0_ALPHA, gl_OPERAND0_RGB, gl_OPERAND1_ALPHA, gl_OPERAND1_RGB, gl_OPERAND2_ALPHA, gl_OPERAND2_RGB, gl_OR, gl_ORDER, gl_OR_INVERTED, gl_OR_REVERSE, gl_OUT_OF_MEMORY, gl_PACK_ALIGNMENT, gl_PACK_IMAGE_HEIGHT, gl_PACK_LSB_FIRST, gl_PACK_ROW_LENGTH, gl_PACK_SKIP_IMAGES, gl_PACK_SKIP_PIXELS, gl_PACK_SKIP_ROWS, gl_PACK_SWAP_BYTES, gl_PASS_THROUGH_TOKEN, gl_PERSPECTIVE_CORRECTION_HINT, gl_PIXEL_MAP_A_TO_A, gl_PIXEL_MAP_A_TO_A_SIZE, gl_PIXEL_MAP_B_TO_B, gl_PIXEL_MAP_B_TO_B_SIZE, gl_PIXEL_MAP_G_TO_G, gl_PIXEL_MAP_G_TO_G_SIZE, gl_PIXEL_MAP_I_TO_A, gl_PIXEL_MAP_I_TO_A_SIZE, gl_PIXEL_MAP_I_TO_B, gl_PIXEL_MAP_I_TO_B_SIZE, gl_PIXEL_MAP_I_TO_G, gl_PIXEL_MAP_I_TO_G_SIZE, gl_PIXEL_MAP_I_TO_I, gl_PIXEL_MAP_I_TO_I_SIZE, gl_PIXEL_MAP_I_TO_R, gl_PIXEL_MAP_I_TO_R_SIZE, gl_PIXEL_MAP_R_TO_R, gl_PIXEL_MAP_R_TO_R_SIZE, gl_PIXEL_MAP_S_TO_S, gl_PIXEL_MAP_S_TO_S_SIZE, gl_PIXEL_MODE_BIT, gl_PIXEL_PACK_BUFFER, gl_PIXEL_PACK_BUFFER_BINDING, gl_PIXEL_UNPACK_BUFFER, gl_PIXEL_UNPACK_BUFFER_BINDING, gl_POINT, gl_POINTS, gl_POINT_BIT, gl_POINT_DISTANCE_ATTENUATION, gl_POINT_FADE_THRESHOLD_SIZE, gl_POINT_SIZE, gl_POINT_SIZE_GRANULARITY, gl_POINT_SIZE_MAX, gl_POINT_SIZE_MIN, gl_POINT_SIZE_RANGE, gl_POINT_SMOOTH, gl_POINT_SMOOTH_HINT, gl_POINT_SPRITE, gl_POINT_SPRITE_COORD_ORIGIN, gl_POINT_TOKEN, gl_POLYGON, gl_POLYGON_BIT, gl_POLYGON_MODE, gl_POLYGON_OFFSET_FACTOR, gl_POLYGON_OFFSET_FILL, gl_POLYGON_OFFSET_LINE, gl_POLYGON_OFFSET_POINT, gl_POLYGON_OFFSET_UNITS, gl_POLYGON_SMOOTH, gl_POLYGON_SMOOTH_HINT, gl_POLYGON_STIPPLE, gl_POLYGON_STIPPLE_BIT, gl_POLYGON_TOKEN, gl_POSITION, gl_PREVIOUS, gl_PRIMARY_COLOR, gl_PRIMITIVES_GENERATED, gl_PRIMITIVE_RESTART, gl_PRIMITIVE_RESTART_INDEX, gl_PROJECTION, gl_PROJECTION_MATRIX, gl_PROJECTION_STACK_DEPTH, gl_PROXY_TEXTURE_1D, gl_PROXY_TEXTURE_1D_ARRAY, gl_PROXY_TEXTURE_2D, gl_PROXY_TEXTURE_2D_ARRAY, gl_PROXY_TEXTURE_3D, gl_PROXY_TEXTURE_CUBE_MAP, gl_PROXY_TEXTURE_RECTANGLE, gl_Q, gl_QUADRATIC_ATTENUATION, gl_QUADS, gl_QUAD_STRIP, gl_QUERY_BY_REGION_NO_WAIT, gl_QUERY_BY_REGION_WAIT, gl_QUERY_COUNTER_BITS, gl_QUERY_NO_WAIT, gl_QUERY_RESULT, gl_QUERY_RESULT_AVAILABLE, gl_QUERY_WAIT, gl_R, gl_R11F_G11F_B10F, gl_R16, gl_R16F, gl_R16I, gl_R16UI, gl_R16_SNORM, gl_R32F, gl_R32I, gl_R32UI, gl_R3_G3_B2, gl_R8, gl_R8I, gl_R8UI, gl_R8_SNORM, gl_RASTERIZER_DISCARD, gl_READ_BUFFER, gl_READ_FRAMEBUFFER, gl_READ_FRAMEBUFFER_BINDING, gl_READ_ONLY, gl_READ_WRITE, gl_RED, gl_RED_BIAS, gl_RED_BITS, gl_RED_INTEGER, gl_RED_SCALE, gl_REFLECTION_MAP, gl_RENDER, gl_RENDERBUFFER, gl_RENDERBUFFER_ALPHA_SIZE, gl_RENDERBUFFER_BINDING, gl_RENDERBUFFER_BLUE_SIZE, gl_RENDERBUFFER_DEPTH_SIZE, gl_RENDERBUFFER_GREEN_SIZE, gl_RENDERBUFFER_HEIGHT, gl_RENDERBUFFER_INTERNAL_FORMAT, gl_RENDERBUFFER_RED_SIZE, gl_RENDERBUFFER_SAMPLES, gl_RENDERBUFFER_STENCIL_SIZE, gl_RENDERBUFFER_WIDTH, gl_RENDERER, gl_RENDER_MODE, gl_REPEAT, gl_REPLACE, gl_RESCALE_NORMAL, gl_RETURN, gl_RG, gl_RG16, gl_RG16F, gl_RG16I, gl_RG16UI, gl_RG16_SNORM, gl_RG32F, gl_RG32I, gl_RG32UI, gl_RG8, gl_RG8I, gl_RG8UI, gl_RG8_SNORM, gl_RGB, gl_RGB10, gl_RGB10_A2, gl_RGB12, gl_RGB16, gl_RGB16F, gl_RGB16I, gl_RGB16UI, gl_RGB16_SNORM, gl_RGB32F, gl_RGB32I, gl_RGB32UI, gl_RGB4, gl_RGB5, gl_RGB5_A1, gl_RGB8, gl_RGB8I, gl_RGB8UI, gl_RGB8_SNORM, gl_RGB9_E5, gl_RGBA, gl_RGBA12, gl_RGBA16, gl_RGBA16F, gl_RGBA16I, gl_RGBA16UI, gl_RGBA16_SNORM, gl_RGBA2, gl_RGBA32F, gl_RGBA32I, gl_RGBA32UI, gl_RGBA4, gl_RGBA8, gl_RGBA8I, gl_RGBA8UI, gl_RGBA8_SNORM, gl_RGBA_INTEGER, gl_RGBA_MODE, gl_RGB_INTEGER, gl_RGB_SCALE, gl_RG_INTEGER, gl_RIGHT, gl_S, gl_SAMPLER_1D, gl_SAMPLER_1D_ARRAY, gl_SAMPLER_1D_ARRAY_SHADOW, gl_SAMPLER_1D_SHADOW, gl_SAMPLER_2D, gl_SAMPLER_2D_ARRAY, gl_SAMPLER_2D_ARRAY_SHADOW, gl_SAMPLER_2D_RECT, gl_SAMPLER_2D_RECT_SHADOW, gl_SAMPLER_2D_SHADOW, gl_SAMPLER_3D, gl_SAMPLER_BUFFER, gl_SAMPLER_CUBE, gl_SAMPLER_CUBE_SHADOW, gl_SAMPLES, gl_SAMPLES_PASSED, gl_SAMPLE_ALPHA_TO_COVERAGE, gl_SAMPLE_ALPHA_TO_ONE, gl_SAMPLE_BUFFERS, gl_SAMPLE_COVERAGE, gl_SAMPLE_COVERAGE_INVERT, gl_SAMPLE_COVERAGE_VALUE, gl_SCISSOR_BIT, gl_SCISSOR_BOX, gl_SCISSOR_TEST, gl_SECONDARY_COLOR_ARRAY, gl_SECONDARY_COLOR_ARRAY_BUFFER_BINDING, gl_SECONDARY_COLOR_ARRAY_POINTER, gl_SECONDARY_COLOR_ARRAY_SIZE, gl_SECONDARY_COLOR_ARRAY_STRIDE, gl_SECONDARY_COLOR_ARRAY_TYPE, gl_SELECT, gl_SELECTION_BUFFER_POINTER, gl_SELECTION_BUFFER_SIZE, gl_SEPARATE_ATTRIBS, gl_SEPARATE_SPECULAR_COLOR, gl_SET, gl_SHADER_SOURCE_LENGTH, gl_SHADER_TYPE, gl_SHADE_MODEL, gl_SHADING_LANGUAGE_VERSION, gl_SHININESS, gl_SHORT, gl_SIGNED_NORMALIZED, gl_SINGLE_COLOR, gl_SLUMINANCE, gl_SLUMINANCE8, gl_SLUMINANCE8_ALPHA8, gl_SLUMINANCE_ALPHA, gl_SMOOTH, gl_SMOOTH_LINE_WIDTH_GRANULARITY, gl_SMOOTH_LINE_WIDTH_RANGE, gl_SMOOTH_POINT_SIZE_GRANULARITY, gl_SMOOTH_POINT_SIZE_RANGE, gl_SOURCE0_ALPHA, gl_SOURCE0_RGB, gl_SOURCE1_ALPHA, gl_SOURCE1_RGB, gl_SOURCE2_ALPHA, gl_SOURCE2_RGB, gl_SPECULAR, gl_SPHERE_MAP, gl_SPOT_CUTOFF, gl_SPOT_DIRECTION, gl_SPOT_EXPONENT, gl_SRC0_ALPHA, gl_SRC0_RGB, gl_SRC1_ALPHA, gl_SRC1_RGB, gl_SRC2_ALPHA, gl_SRC2_RGB, gl_SRC_ALPHA, gl_SRC_ALPHA_SATURATE, gl_SRC_COLOR, gl_SRGB, gl_SRGB8, gl_SRGB8_ALPHA8, gl_SRGB_ALPHA, gl_STACK_OVERFLOW, gl_STACK_UNDERFLOW, gl_STATIC_COPY, gl_STATIC_DRAW, gl_STATIC_READ, gl_STENCIL, gl_STENCIL_ATTACHMENT, gl_STENCIL_BACK_FAIL, gl_STENCIL_BACK_FUNC, gl_STENCIL_BACK_PASS_DEPTH_FAIL, gl_STENCIL_BACK_PASS_DEPTH_PASS, gl_STENCIL_BACK_REF, gl_STENCIL_BACK_VALUE_MASK, gl_STENCIL_BACK_WRITEMASK, gl_STENCIL_BITS, gl_STENCIL_BUFFER_BIT, gl_STENCIL_CLEAR_VALUE, gl_STENCIL_FAIL, gl_STENCIL_FUNC, gl_STENCIL_INDEX, gl_STENCIL_INDEX1, gl_STENCIL_INDEX16, gl_STENCIL_INDEX4, gl_STENCIL_INDEX8, gl_STENCIL_PASS_DEPTH_FAIL, gl_STENCIL_PASS_DEPTH_PASS, gl_STENCIL_REF, gl_STENCIL_TEST, gl_STENCIL_VALUE_MASK, gl_STENCIL_WRITEMASK, gl_STEREO, gl_STREAM_COPY, gl_STREAM_DRAW, gl_STREAM_READ, gl_SUBPIXEL_BITS, gl_SUBTRACT, gl_T, gl_T2F_C3F_V3F, gl_T2F_C4F_N3F_V3F, gl_T2F_C4UB_V3F, gl_T2F_N3F_V3F, gl_T2F_V3F, gl_T4F_C4F_N3F_V4F, gl_T4F_V4F, gl_TEXTURE, gl_TEXTURE0, gl_TEXTURE1, gl_TEXTURE10, gl_TEXTURE11, gl_TEXTURE12, gl_TEXTURE13, gl_TEXTURE14, gl_TEXTURE15, gl_TEXTURE16, gl_TEXTURE17, gl_TEXTURE18, gl_TEXTURE19, gl_TEXTURE2, gl_TEXTURE20, gl_TEXTURE21, gl_TEXTURE22, gl_TEXTURE23, gl_TEXTURE24, gl_TEXTURE25, gl_TEXTURE26, gl_TEXTURE27, gl_TEXTURE28, gl_TEXTURE29, gl_TEXTURE3, gl_TEXTURE30, gl_TEXTURE31, gl_TEXTURE4, gl_TEXTURE5, gl_TEXTURE6, gl_TEXTURE7, gl_TEXTURE8, gl_TEXTURE9, gl_TEXTURE_1D, gl_TEXTURE_1D_ARRAY, gl_TEXTURE_2D, gl_TEXTURE_2D_ARRAY, gl_TEXTURE_3D, gl_TEXTURE_ALPHA_SIZE, gl_TEXTURE_ALPHA_TYPE, gl_TEXTURE_BASE_LEVEL, gl_TEXTURE_BINDING_1D, gl_TEXTURE_BINDING_1D_ARRAY, gl_TEXTURE_BINDING_2D, gl_TEXTURE_BINDING_2D_ARRAY, gl_TEXTURE_BINDING_3D, gl_TEXTURE_BINDING_BUFFER, gl_TEXTURE_BINDING_CUBE_MAP, gl_TEXTURE_BINDING_RECTANGLE, gl_TEXTURE_BIT, gl_TEXTURE_BLUE_SIZE, gl_TEXTURE_BLUE_TYPE, gl_TEXTURE_BORDER, gl_TEXTURE_BORDER_COLOR, gl_TEXTURE_BUFFER, gl_TEXTURE_BUFFER_DATA_STORE_BINDING, gl_TEXTURE_COMPARE_FUNC, gl_TEXTURE_COMPARE_MODE, gl_TEXTURE_COMPONENTS, gl_TEXTURE_COMPRESSED, gl_TEXTURE_COMPRESSED_IMAGE_SIZE, gl_TEXTURE_COMPRESSION_HINT, gl_TEXTURE_COORD_ARRAY, gl_TEXTURE_COORD_ARRAY_BUFFER_BINDING, gl_TEXTURE_COORD_ARRAY_POINTER, gl_TEXTURE_COORD_ARRAY_SIZE, gl_TEXTURE_COORD_ARRAY_STRIDE, gl_TEXTURE_COORD_ARRAY_TYPE, gl_TEXTURE_CUBE_MAP, gl_TEXTURE_CUBE_MAP_NEGATIVE_X, gl_TEXTURE_CUBE_MAP_NEGATIVE_Y, gl_TEXTURE_CUBE_MAP_NEGATIVE_Z, gl_TEXTURE_CUBE_MAP_POSITIVE_X, gl_TEXTURE_CUBE_MAP_POSITIVE_Y, gl_TEXTURE_CUBE_MAP_POSITIVE_Z, gl_TEXTURE_DEPTH, gl_TEXTURE_DEPTH_SIZE, gl_TEXTURE_DEPTH_TYPE, gl_TEXTURE_ENV, gl_TEXTURE_ENV_COLOR, gl_TEXTURE_ENV_MODE, gl_TEXTURE_FILTER_CONTROL, gl_TEXTURE_GEN_MODE, gl_TEXTURE_GEN_Q, gl_TEXTURE_GEN_R, gl_TEXTURE_GEN_S, gl_TEXTURE_GEN_T, gl_TEXTURE_GREEN_SIZE, gl_TEXTURE_GREEN_TYPE, gl_TEXTURE_HEIGHT, gl_TEXTURE_INTENSITY_SIZE, gl_TEXTURE_INTENSITY_TYPE, gl_TEXTURE_INTERNAL_FORMAT, gl_TEXTURE_LOD_BIAS, gl_TEXTURE_LUMINANCE_SIZE, gl_TEXTURE_LUMINANCE_TYPE, gl_TEXTURE_MAG_FILTER, gl_TEXTURE_MATRIX, gl_TEXTURE_MAX_LEVEL, gl_TEXTURE_MAX_LOD, gl_TEXTURE_MIN_FILTER, gl_TEXTURE_MIN_LOD, gl_TEXTURE_PRIORITY, gl_TEXTURE_RECTANGLE, gl_TEXTURE_RED_SIZE, gl_TEXTURE_RED_TYPE, gl_TEXTURE_RESIDENT, gl_TEXTURE_SHARED_SIZE, gl_TEXTURE_STACK_DEPTH, gl_TEXTURE_STENCIL_SIZE, gl_TEXTURE_WIDTH, gl_TEXTURE_WRAP_R, gl_TEXTURE_WRAP_S, gl_TEXTURE_WRAP_T, gl_TRANSFORM_BIT, gl_TRANSFORM_FEEDBACK_BUFFER, gl_TRANSFORM_FEEDBACK_BUFFER_BINDING, gl_TRANSFORM_FEEDBACK_BUFFER_MODE, gl_TRANSFORM_FEEDBACK_BUFFER_SIZE, gl_TRANSFORM_FEEDBACK_BUFFER_START, gl_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, gl_TRANSFORM_FEEDBACK_VARYINGS, gl_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH, gl_TRANSPOSE_COLOR_MATRIX, gl_TRANSPOSE_MODELVIEW_MATRIX, gl_TRANSPOSE_PROJECTION_MATRIX, gl_TRANSPOSE_TEXTURE_MATRIX, gl_TRIANGLES, gl_TRIANGLE_FAN, gl_TRIANGLE_STRIP, gl_TRUE, gl_UNIFORM_ARRAY_STRIDE, gl_UNIFORM_BLOCK_ACTIVE_UNIFORMS, gl_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES, gl_UNIFORM_BLOCK_BINDING, gl_UNIFORM_BLOCK_DATA_SIZE, gl_UNIFORM_BLOCK_INDEX, gl_UNIFORM_BLOCK_NAME_LENGTH, gl_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER, gl_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER, gl_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER, gl_UNIFORM_BUFFER, gl_UNIFORM_BUFFER_BINDING, gl_UNIFORM_BUFFER_OFFSET_ALIGNMENT, gl_UNIFORM_BUFFER_SIZE, gl_UNIFORM_BUFFER_START, gl_UNIFORM_IS_ROW_MAJOR, gl_UNIFORM_MATRIX_STRIDE, gl_UNIFORM_NAME_LENGTH, gl_UNIFORM_OFFSET, gl_UNIFORM_SIZE, gl_UNIFORM_TYPE, gl_UNPACK_ALIGNMENT, gl_UNPACK_IMAGE_HEIGHT, gl_UNPACK_LSB_FIRST, gl_UNPACK_ROW_LENGTH, gl_UNPACK_SKIP_IMAGES, gl_UNPACK_SKIP_PIXELS, gl_UNPACK_SKIP_ROWS, gl_UNPACK_SWAP_BYTES, gl_UNSIGNED_BYTE, gl_UNSIGNED_BYTE_2_3_3_REV, gl_UNSIGNED_BYTE_3_3_2, gl_UNSIGNED_INT, gl_UNSIGNED_INT_10F_11F_11F_REV, gl_UNSIGNED_INT_10_10_10_2, gl_UNSIGNED_INT_24_8, gl_UNSIGNED_INT_2_10_10_10_REV, gl_UNSIGNED_INT_5_9_9_9_REV, gl_UNSIGNED_INT_8_8_8_8, gl_UNSIGNED_INT_8_8_8_8_REV, gl_UNSIGNED_INT_SAMPLER_1D, gl_UNSIGNED_INT_SAMPLER_1D_ARRAY, gl_UNSIGNED_INT_SAMPLER_2D, gl_UNSIGNED_INT_SAMPLER_2D_ARRAY, gl_UNSIGNED_INT_SAMPLER_2D_RECT, gl_UNSIGNED_INT_SAMPLER_3D, gl_UNSIGNED_INT_SAMPLER_BUFFER, gl_UNSIGNED_INT_SAMPLER_CUBE, gl_UNSIGNED_INT_VEC2, gl_UNSIGNED_INT_VEC3, gl_UNSIGNED_INT_VEC4, gl_UNSIGNED_NORMALIZED, gl_UNSIGNED_SHORT, gl_UNSIGNED_SHORT_1_5_5_5_REV, gl_UNSIGNED_SHORT_4_4_4_4, gl_UNSIGNED_SHORT_4_4_4_4_REV, gl_UNSIGNED_SHORT_5_5_5_1, gl_UNSIGNED_SHORT_5_6_5, gl_UNSIGNED_SHORT_5_6_5_REV, gl_UPPER_LEFT, gl_V2F, gl_V3F, gl_VALIDATE_STATUS, gl_VENDOR, gl_VERSION, gl_VERTEX_ARRAY, gl_VERTEX_ARRAY_BINDING, gl_VERTEX_ARRAY_BUFFER_BINDING, gl_VERTEX_ARRAY_POINTER, gl_VERTEX_ARRAY_SIZE, gl_VERTEX_ARRAY_STRIDE, gl_VERTEX_ARRAY_TYPE, gl_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, gl_VERTEX_ATTRIB_ARRAY_ENABLED, gl_VERTEX_ATTRIB_ARRAY_INTEGER, gl_VERTEX_ATTRIB_ARRAY_NORMALIZED, gl_VERTEX_ATTRIB_ARRAY_POINTER, gl_VERTEX_ATTRIB_ARRAY_SIZE, gl_VERTEX_ATTRIB_ARRAY_STRIDE, gl_VERTEX_ATTRIB_ARRAY_TYPE, gl_VERTEX_PROGRAM_POINT_SIZE, gl_VERTEX_PROGRAM_TWO_SIDE, gl_VERTEX_SHADER, gl_VIEWPORT, gl_VIEWPORT_BIT, gl_WEIGHT_ARRAY_BUFFER_BINDING, gl_WRITE_ONLY, gl_XOR, gl_ZERO, gl_ZOOM_X, gl_ZOOM_Y, -- * Functions glAccum, glActiveTexture, glAlphaFunc, glAreTexturesResident, glArrayElement, glAttachShader, glBegin, glBeginConditionalRender, glBeginQuery, glBeginTransformFeedback, glBindAttribLocation, glBindBuffer, glBindBufferBase, glBindBufferRange, glBindFragDataLocation, glBindFramebuffer, glBindRenderbuffer, glBindTexture, glBindVertexArray, glBitmap, glBlendColor, glBlendEquation, glBlendEquationSeparate, glBlendFunc, glBlendFuncSeparate, glBlitFramebuffer, glBufferData, glBufferSubData, glCallList, glCallLists, glCheckFramebufferStatus, glClampColor, glClear, glClearAccum, glClearBufferfi, glClearBufferfv, glClearBufferiv, glClearBufferuiv, glClearColor, glClearDepth, glClearIndex, glClearStencil, glClientActiveTexture, glClipPlane, glColor3b, glColor3bv, glColor3d, glColor3dv, glColor3f, glColor3fv, glColor3i, glColor3iv, glColor3s, glColor3sv, glColor3ub, glColor3ubv, glColor3ui, glColor3uiv, glColor3us, glColor3usv, glColor4b, glColor4bv, glColor4d, glColor4dv, glColor4f, glColor4fv, glColor4i, glColor4iv, glColor4s, glColor4sv, glColor4ub, glColor4ubv, glColor4ui, glColor4uiv, glColor4us, glColor4usv, glColorMask, glColorMaski, glColorMaterial, glColorPointer, glCompileShader, glCompressedTexImage1D, glCompressedTexImage2D, glCompressedTexImage3D, glCompressedTexSubImage1D, glCompressedTexSubImage2D, glCompressedTexSubImage3D, glCopyBufferSubData, glCopyPixels, glCopyTexImage1D, glCopyTexImage2D, glCopyTexSubImage1D, glCopyTexSubImage2D, glCopyTexSubImage3D, glCreateProgram, glCreateShader, glCullFace, glDeleteBuffers, glDeleteFramebuffers, glDeleteLists, glDeleteProgram, glDeleteQueries, glDeleteRenderbuffers, glDeleteShader, glDeleteTextures, glDeleteVertexArrays, glDepthFunc, glDepthMask, glDepthRange, glDetachShader, glDisable, glDisableClientState, glDisableVertexAttribArray, glDisablei, glDrawArrays, glDrawArraysInstanced, glDrawBuffer, glDrawBuffers, glDrawElements, glDrawElementsInstanced, glDrawPixels, glDrawRangeElements, glEdgeFlag, glEdgeFlagPointer, glEdgeFlagv, glEnable, glEnableClientState, glEnableVertexAttribArray, glEnablei, glEnd, glEndConditionalRender, glEndList, glEndQuery, glEndTransformFeedback, glEvalCoord1d, glEvalCoord1dv, glEvalCoord1f, glEvalCoord1fv, glEvalCoord2d, glEvalCoord2dv, glEvalCoord2f, glEvalCoord2fv, glEvalMesh1, glEvalMesh2, glEvalPoint1, glEvalPoint2, glFeedbackBuffer, glFinish, glFlush, glFlushMappedBufferRange, glFogCoordPointer, glFogCoordd, glFogCoorddv, glFogCoordf, glFogCoordfv, glFogf, glFogfv, glFogi, glFogiv, glFramebufferRenderbuffer, glFramebufferTexture1D, glFramebufferTexture2D, glFramebufferTexture3D, glFramebufferTextureLayer, glFrontFace, glFrustum, glGenBuffers, glGenFramebuffers, glGenLists, glGenQueries, glGenRenderbuffers, glGenTextures, glGenVertexArrays, glGenerateMipmap, glGetActiveAttrib, glGetActiveUniform, glGetActiveUniformBlockName, glGetActiveUniformBlockiv, glGetActiveUniformName, glGetActiveUniformsiv, glGetAttachedShaders, glGetAttribLocation, glGetBooleani_v, glGetBooleanv, glGetBufferParameteriv, glGetBufferPointerv, glGetBufferSubData, glGetClipPlane, glGetCompressedTexImage, glGetDoublev, glGetError, glGetFloatv, glGetFragDataLocation, glGetFramebufferAttachmentParameteriv, glGetIntegeri_v, glGetIntegerv, glGetLightfv, glGetLightiv, glGetMapdv, glGetMapfv, glGetMapiv, glGetMaterialfv, glGetMaterialiv, glGetPixelMapfv, glGetPixelMapuiv, glGetPixelMapusv, glGetPointerv, glGetPolygonStipple, glGetProgramInfoLog, glGetProgramiv, glGetQueryObjectiv, glGetQueryObjectuiv, glGetQueryiv, glGetRenderbufferParameteriv, glGetShaderInfoLog, glGetShaderSource, glGetShaderiv, glGetString, glGetStringi, glGetTexEnvfv, glGetTexEnviv, glGetTexGendv, glGetTexGenfv, glGetTexGeniv, glGetTexImage, glGetTexLevelParameterfv, glGetTexLevelParameteriv, glGetTexParameterIiv, glGetTexParameterIuiv, glGetTexParameterfv, glGetTexParameteriv, glGetTransformFeedbackVarying, glGetUniformBlockIndex, glGetUniformIndices, glGetUniformLocation, glGetUniformfv, glGetUniformiv, glGetUniformuiv, glGetVertexAttribIiv, glGetVertexAttribIuiv, glGetVertexAttribPointerv, glGetVertexAttribdv, glGetVertexAttribfv, glGetVertexAttribiv, glHint, glIndexMask, glIndexPointer, glIndexd, glIndexdv, glIndexf, glIndexfv, glIndexi, glIndexiv, glIndexs, glIndexsv, glIndexub, glIndexubv, glInitNames, glInterleavedArrays, glIsBuffer, glIsEnabled, glIsEnabledi, glIsFramebuffer, glIsList, glIsProgram, glIsQuery, glIsRenderbuffer, glIsShader, glIsTexture, glIsVertexArray, glLightModelf, glLightModelfv, glLightModeli, glLightModeliv, glLightf, glLightfv, glLighti, glLightiv, glLineStipple, glLineWidth, glLinkProgram, glListBase, glLoadIdentity, glLoadMatrixd, glLoadMatrixf, glLoadName, glLoadTransposeMatrixd, glLoadTransposeMatrixf, glLogicOp, glMap1d, glMap1f, glMap2d, glMap2f, glMapBuffer, glMapBufferRange, glMapGrid1d, glMapGrid1f, glMapGrid2d, glMapGrid2f, glMaterialf, glMaterialfv, glMateriali, glMaterialiv, glMatrixMode, glMultMatrixd, glMultMatrixf, glMultTransposeMatrixd, glMultTransposeMatrixf, glMultiDrawArrays, glMultiDrawElements, glMultiTexCoord1d, glMultiTexCoord1dv, glMultiTexCoord1f, glMultiTexCoord1fv, glMultiTexCoord1i, glMultiTexCoord1iv, glMultiTexCoord1s, glMultiTexCoord1sv, glMultiTexCoord2d, glMultiTexCoord2dv, glMultiTexCoord2f, glMultiTexCoord2fv, glMultiTexCoord2i, glMultiTexCoord2iv, glMultiTexCoord2s, glMultiTexCoord2sv, glMultiTexCoord3d, glMultiTexCoord3dv, glMultiTexCoord3f, glMultiTexCoord3fv, glMultiTexCoord3i, glMultiTexCoord3iv, glMultiTexCoord3s, glMultiTexCoord3sv, glMultiTexCoord4d, glMultiTexCoord4dv, glMultiTexCoord4f, glMultiTexCoord4fv, glMultiTexCoord4i, glMultiTexCoord4iv, glMultiTexCoord4s, glMultiTexCoord4sv, glNewList, glNormal3b, glNormal3bv, glNormal3d, glNormal3dv, glNormal3f, glNormal3fv, glNormal3i, glNormal3iv, glNormal3s, glNormal3sv, glNormalPointer, glOrtho, glPassThrough, glPixelMapfv, glPixelMapuiv, glPixelMapusv, glPixelStoref, glPixelStorei, glPixelTransferf, glPixelTransferi, glPixelZoom, glPointParameterf, glPointParameterfv, glPointParameteri, glPointParameteriv, glPointSize, glPolygonMode, glPolygonOffset, glPolygonStipple, glPopAttrib, glPopClientAttrib, glPopMatrix, glPopName, glPrimitiveRestartIndex, glPrioritizeTextures, glPushAttrib, glPushClientAttrib, glPushMatrix, glPushName, glRasterPos2d, glRasterPos2dv, glRasterPos2f, glRasterPos2fv, glRasterPos2i, glRasterPos2iv, glRasterPos2s, glRasterPos2sv, glRasterPos3d, glRasterPos3dv, glRasterPos3f, glRasterPos3fv, glRasterPos3i, glRasterPos3iv, glRasterPos3s, glRasterPos3sv, glRasterPos4d, glRasterPos4dv, glRasterPos4f, glRasterPos4fv, glRasterPos4i, glRasterPos4iv, glRasterPos4s, glRasterPos4sv, glReadBuffer, glReadPixels, glRectd, glRectdv, glRectf, glRectfv, glRecti, glRectiv, glRects, glRectsv, glRenderMode, glRenderbufferStorage, glRenderbufferStorageMultisample, glRotated, glRotatef, glSampleCoverage, glScaled, glScalef, glScissor, glSecondaryColor3b, glSecondaryColor3bv, glSecondaryColor3d, glSecondaryColor3dv, glSecondaryColor3f, glSecondaryColor3fv, glSecondaryColor3i, glSecondaryColor3iv, glSecondaryColor3s, glSecondaryColor3sv, glSecondaryColor3ub, glSecondaryColor3ubv, glSecondaryColor3ui, glSecondaryColor3uiv, glSecondaryColor3us, glSecondaryColor3usv, glSecondaryColorPointer, glSelectBuffer, glShadeModel, glShaderSource, glStencilFunc, glStencilFuncSeparate, glStencilMask, glStencilMaskSeparate, glStencilOp, glStencilOpSeparate, glTexBuffer, glTexCoord1d, glTexCoord1dv, glTexCoord1f, glTexCoord1fv, glTexCoord1i, glTexCoord1iv, glTexCoord1s, glTexCoord1sv, glTexCoord2d, glTexCoord2dv, glTexCoord2f, glTexCoord2fv, glTexCoord2i, glTexCoord2iv, glTexCoord2s, glTexCoord2sv, glTexCoord3d, glTexCoord3dv, glTexCoord3f, glTexCoord3fv, glTexCoord3i, glTexCoord3iv, glTexCoord3s, glTexCoord3sv, glTexCoord4d, glTexCoord4dv, glTexCoord4f, glTexCoord4fv, glTexCoord4i, glTexCoord4iv, glTexCoord4s, glTexCoord4sv, glTexCoordPointer, glTexEnvf, glTexEnvfv, glTexEnvi, glTexEnviv, glTexGend, glTexGendv, glTexGenf, glTexGenfv, glTexGeni, glTexGeniv, glTexImage1D, glTexImage2D, glTexImage3D, glTexParameterIiv, glTexParameterIuiv, glTexParameterf, glTexParameterfv, glTexParameteri, glTexParameteriv, glTexSubImage1D, glTexSubImage2D, glTexSubImage3D, glTransformFeedbackVaryings, glTranslated, glTranslatef, glUniform1f, glUniform1fv, glUniform1i, glUniform1iv, glUniform1ui, glUniform1uiv, glUniform2f, glUniform2fv, glUniform2i, glUniform2iv, glUniform2ui, glUniform2uiv, glUniform3f, glUniform3fv, glUniform3i, glUniform3iv, glUniform3ui, glUniform3uiv, glUniform4f, glUniform4fv, glUniform4i, glUniform4iv, glUniform4ui, glUniform4uiv, glUniformBlockBinding, glUniformMatrix2fv, glUniformMatrix2x3fv, glUniformMatrix2x4fv, glUniformMatrix3fv, glUniformMatrix3x2fv, glUniformMatrix3x4fv, glUniformMatrix4fv, glUniformMatrix4x2fv, glUniformMatrix4x3fv, glUnmapBuffer, glUseProgram, glValidateProgram, glVertex2d, glVertex2dv, glVertex2f, glVertex2fv, glVertex2i, glVertex2iv, glVertex2s, glVertex2sv, glVertex3d, glVertex3dv, glVertex3f, glVertex3fv, glVertex3i, glVertex3iv, glVertex3s, glVertex3sv, glVertex4d, glVertex4dv, glVertex4f, glVertex4fv, glVertex4i, glVertex4iv, glVertex4s, glVertex4sv, glVertexAttrib1d, glVertexAttrib1dv, glVertexAttrib1f, glVertexAttrib1fv, glVertexAttrib1s, glVertexAttrib1sv, glVertexAttrib2d, glVertexAttrib2dv, glVertexAttrib2f, glVertexAttrib2fv, glVertexAttrib2s, glVertexAttrib2sv, glVertexAttrib3d, glVertexAttrib3dv, glVertexAttrib3f, glVertexAttrib3fv, glVertexAttrib3s, glVertexAttrib3sv, glVertexAttrib4Nbv, glVertexAttrib4Niv, glVertexAttrib4Nsv, glVertexAttrib4Nub, glVertexAttrib4Nubv, glVertexAttrib4Nuiv, glVertexAttrib4Nusv, glVertexAttrib4bv, glVertexAttrib4d, glVertexAttrib4dv, glVertexAttrib4f, glVertexAttrib4fv, glVertexAttrib4iv, glVertexAttrib4s, glVertexAttrib4sv, glVertexAttrib4ubv, glVertexAttrib4uiv, glVertexAttrib4usv, glVertexAttribI1i, glVertexAttribI1iv, glVertexAttribI1ui, glVertexAttribI1uiv, glVertexAttribI2i, glVertexAttribI2iv, glVertexAttribI2ui, glVertexAttribI2uiv, glVertexAttribI3i, glVertexAttribI3iv, glVertexAttribI3ui, glVertexAttribI3uiv, glVertexAttribI4bv, glVertexAttribI4i, glVertexAttribI4iv, glVertexAttribI4sv, glVertexAttribI4ubv, glVertexAttribI4ui, glVertexAttribI4uiv, glVertexAttribI4usv, glVertexAttribIPointer, glVertexAttribPointer, glVertexPointer, glViewport, glWindowPos2d, glWindowPos2dv, glWindowPos2f, glWindowPos2fv, glWindowPos2i, glWindowPos2iv, glWindowPos2s, glWindowPos2sv, glWindowPos3d, glWindowPos3dv, glWindowPos3f, glWindowPos3fv, glWindowPos3i, glWindowPos3iv, glWindowPos3s, glWindowPos3sv ) where import Graphics.Rendering.OpenGL.Raw.Types import Graphics.Rendering.OpenGL.Raw.Tokens import Graphics.Rendering.OpenGL.Raw.Functions
phaazon/OpenGLRaw
src/Graphics/Rendering/OpenGL/Raw/Compatibility31.hs
Haskell
bsd-3-clause
38,287
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width,initial-scale=1"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="lang:clipboard.copy" content="Copy to clipboard"> <meta name="lang:clipboard.copied" content="Copied to clipboard"> <meta name="lang:search.language" content="en"> <meta name="lang:search.pipeline.stopwords" content="True"> <meta name="lang:search.pipeline.trimmer" content="True"> <meta name="lang:search.result.none" content="No matching documents"> <meta name="lang:search.result.one" content="1 matching document"> <meta name="lang:search.result.other" content="# matching documents"> <meta name="lang:search.tokenizer" content="[\s\-]+"> <link href="https://fonts.gstatic.com/" rel="preconnect" crossorigin> <link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500,700|Roboto:300,400,400i,700&display=fallback" rel="stylesheet"> <style> body, input { font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif } code, kbd, pre { font-family: "Roboto Mono", "Courier New", Courier, monospace } </style> <link rel="stylesheet" href="../_static/stylesheets/application.css"/> <link rel="stylesheet" href="../_static/stylesheets/application-palette.css"/> <link rel="stylesheet" href="../_static/stylesheets/application-fixes.css"/> <link rel="stylesheet" href="../_static/fonts/material-icons.css"/> <meta name="theme-color" content="#3f51b5"> <script src="../_static/javascripts/modernizr.js"></script> <title>Release 0.11.1 &#8212; statsmodels</title> <link rel="icon" type="image/png" sizes="32x32" href="../_static/icons/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="16x16" href="../_static/icons/favicon-16x16.png"> <link rel="manifest" href="../_static/icons/site.webmanifest"> <link rel="mask-icon" href="../_static/icons/safari-pinned-tab.svg" color="#919191"> <meta name="msapplication-TileColor" content="#2b5797"> <meta name="msapplication-config" content="../_static/icons/browserconfig.xml"> <link rel="stylesheet" href="../_static/stylesheets/examples.css"> <link rel="stylesheet" href="../_static/stylesheets/deprecation.css"> <link rel="stylesheet" href="../_static/material.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <link rel="stylesheet" type="text/css" href="../_static/graphviz.css" /> <script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script> <script src="../_static/jquery.js"></script> <script src="../_static/underscore.js"></script> <script src="../_static/doctools.js"></script> <script src="../_static/language_data.js"></script> <script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script> <script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script> <script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["$", "$"], ["\\(", "\\)"]], "processEscapes": true, "ignoreClass": "document", "processClass": "math|output_area"}})</script> <link rel="shortcut icon" href="../_static/favicon.ico"/> <link rel="author" title="About these documents" href="../about.html" /> <link rel="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="next" title="Release 0.11.0" href="version0.11.html" /> <link rel="prev" title="Release 0.12.0" href="version0.12.html" /> </head> <body dir=ltr data-md-color-primary=indigo data-md-color-accent=blue> <svg class="md-svg"> <defs data-children-count="0"> <svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="__github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg> </defs> </svg> <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer"> <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search"> <label class="md-overlay" data-md-component="overlay" for="__drawer"></label> <a href="#release/version0.11.1" tabindex="1" class="md-skip"> Skip to content </a> <header class="md-header" data-md-component="header"> <nav class="md-header-nav md-grid"> <div class="md-flex navheader"> <div class="md-flex__cell md-flex__cell--shrink"> <a href="../index.html" title="statsmodels" class="md-header-nav__button md-logo"> <img src="../_static/statsmodels-logo-v2-bw.svg" height="26" alt="statsmodels logo"> </a> </div> <div class="md-flex__cell md-flex__cell--shrink"> <label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label> </div> <div class="md-flex__cell md-flex__cell--stretch"> <div class="md-flex__ellipsis md-header-nav__title" data-md-component="title"> <span class="md-header-nav__topic">statsmodels v0.12.0</span> <span class="md-header-nav__topic"> Release 0.11.1 </span> </div> </div> <div class="md-flex__cell md-flex__cell--shrink"> <label class="md-icon md-icon--search md-header-nav__button" for="__search"></label> <div class="md-search" data-md-component="search" role="dialog"> <label class="md-search__overlay" for="__search"></label> <div class="md-search__inner" role="search"> <form class="md-search__form" action="../search.html" method="GET" name="search"> <input type="text" class="md-search__input" name="q" placeholder="Search" autocapitalize="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active"> <label class="md-icon md-search__icon" for="__search"></label> <button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1"> &#xE5CD; </button> </form> <div class="md-search__output"> <div class="md-search__scrollwrap" data-md-scrollfix> <div class="md-search-result" data-md-component="result"> <div class="md-search-result__meta"> Type to start searching </div> <ol class="md-search-result__list"></ol> </div> </div> </div> </div> </div> </div> <div class="md-flex__cell md-flex__cell--shrink"> <div class="md-header-nav__source"> <a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github"> <div class="md-source__icon"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28"> <use xlink:href="#__github" width="24" height="24"></use> </svg> </div> <div class="md-source__repository"> statsmodels </div> </a> </div> </div> <script src="../_static/javascripts/version_dropdown.js"></script> <script> var json_loc = "../_static/versions.json", target_loc = "../../", text = "Versions"; $( document ).ready( add_version_dropdown(json_loc, target_loc, text)); </script> </div> </nav> </header> <div class="md-container"> <nav class="md-tabs" data-md-component="tabs"> <div class="md-tabs__inner md-grid"> <ul class="md-tabs__list"> <li class="md-tabs__item"><a href="index.html" class="md-tabs__link">Release Notes</a></li> </ul> </div> </nav> <main class="md-main"> <div class="md-main__inner md-grid" data-md-component="container"> <div class="md-sidebar md-sidebar--primary" data-md-component="navigation"> <div class="md-sidebar__scrollwrap"> <div class="md-sidebar__inner"> <nav class="md-nav md-nav--primary" data-md-level="0"> <label class="md-nav__title md-nav__title--site" for="__drawer"> <a href="../index.html" title="statsmodels" class="md-nav__button md-logo"> <img src="../_static/statsmodels-logo-v2-bw.svg" alt=" logo" width="48" height="48"> </a> <a href="../index.html" title="statsmodels">statsmodels v0.12.0</a> </label> <div class="md-nav__source"> <a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github"> <div class="md-source__icon"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28"> <use xlink:href="#__github" width="24" height="24"></use> </svg> </div> <div class="md-source__repository"> statsmodels </div> </a> </div> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="../install.html" class="md-nav__link">Installing statsmodels</a> </li> <li class="md-nav__item"> <a href="../gettingstarted.html" class="md-nav__link">Getting started</a> </li> <li class="md-nav__item"> <a href="../user-guide.html" class="md-nav__link">User Guide</a> </li> <li class="md-nav__item"> <a href="../examples/index.html" class="md-nav__link">Examples</a> </li> <li class="md-nav__item"> <a href="../api.html" class="md-nav__link">API Reference</a> </li> <li class="md-nav__item"> <a href="../about.html" class="md-nav__link">About statsmodels</a> </li> <li class="md-nav__item"> <a href="../dev/index.html" class="md-nav__link">Developer Page</a> </li> <li class="md-nav__item"> <a href="index.html" class="md-nav__link">Release Notes</a> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="version0.12.html" class="md-nav__link">Release 0.12.0</a> </li> <li class="md-nav__item"> <input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc"> <label class="md-nav__link md-nav__link--active" for="__toc"> Release 0.11.1 </label> <a href="#" class="md-nav__link md-nav__link--active">Release 0.11.1</a> <nav class="md-nav md-nav--secondary"> <label class="md-nav__title" for="__toc">Contents</label> <ul class="md-nav__list" data-md-scrollfix=""> <li class="md-nav__item"><a href="#release-version0-11-1--page-root" class="md-nav__link">Release 0.11.1</a><nav class="md-nav"> <ul class="md-nav__list"> <li class="md-nav__item"><a href="#release-summary" class="md-nav__link">Release summary</a> </li> <li class="md-nav__item"><a href="#development-summary-and-credits" class="md-nav__link">Development summary and credits</a><nav class="md-nav"> <ul class="md-nav__list"> <li class="md-nav__item"><a href="#merged-pull-requests" class="md-nav__link">Merged Pull Requests</a> </li></ul> </nav> </li></ul> </nav> </li> <li class="md-nav__item"><a class="md-nav__extra_link" href="../_sources/release/version0.11.1.rst.txt">Show Source</a> </li> </ul> </nav> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="#release-summary" class="md-nav__link">Release summary</a> </li> <li class="md-nav__item"> <a href="#development-summary-and-credits" class="md-nav__link">Development summary and credits</a> </li></ul> </li> <li class="md-nav__item"> <a href="version0.11.html" class="md-nav__link">Release 0.11.0</a> </li> <li class="md-nav__item"> <a href="version0.10.2.html" class="md-nav__link">Release 0.10.2</a> </li> <li class="md-nav__item"> <a href="version0.10.1.html" class="md-nav__link">Release 0.10.1</a> </li> <li class="md-nav__item"> <a href="version0.10.html" class="md-nav__link">Release 0.10.0</a> </li> <li class="md-nav__item"> <a href="version0.9.html" class="md-nav__link">Release 0.9.0</a> </li> <li class="md-nav__item"> <a href="version0.8.html" class="md-nav__link">Release 0.8.0</a> </li> <li class="md-nav__item"> <a href="version0.7.html" class="md-nav__link">Release 0.7.0</a> </li> <li class="md-nav__item"> <a href="version0.6.html" class="md-nav__link">Release 0.6.1</a> </li> <li class="md-nav__item"> <a href="version0.6.html#release-0-6-0" class="md-nav__link">Release 0.6.0</a> </li> <li class="md-nav__item"> <a href="version0.5.html" class="md-nav__link">Release 0.5.0</a> </li></ul> </li> </ul> </nav> </div> </div> </div> <div class="md-sidebar md-sidebar--secondary" data-md-component="toc"> <div class="md-sidebar__scrollwrap"> <div class="md-sidebar__inner"> <nav class="md-nav md-nav--secondary"> <label class="md-nav__title" for="__toc">Contents</label> <ul class="md-nav__list" data-md-scrollfix=""> <li class="md-nav__item"><a href="#release-version0-11-1--page-root" class="md-nav__link">Release 0.11.1</a><nav class="md-nav"> <ul class="md-nav__list"> <li class="md-nav__item"><a href="#release-summary" class="md-nav__link">Release summary</a> </li> <li class="md-nav__item"><a href="#development-summary-and-credits" class="md-nav__link">Development summary and credits</a><nav class="md-nav"> <ul class="md-nav__list"> <li class="md-nav__item"><a href="#merged-pull-requests" class="md-nav__link">Merged Pull Requests</a> </li></ul> </nav> </li></ul> </nav> </li> <li class="md-nav__item"><a class="md-nav__extra_link" href="../_sources/release/version0.11.1.rst.txt">Show Source</a> </li> <li id="searchbox" class="md-nav__item"></li> </ul> </nav> </div> </div> </div> <div class="md-content"> <article class="md-content__inner md-typeset" role="main"> <h1 id="release-version0-11-1--page-root">Release 0.11.1<a class="headerlink" href="#release-version0-11-1--page-root" title="Permalink to this headline">¶</a></h1> <h2 id="release-summary">Release summary<a class="headerlink" href="#release-summary" title="Permalink to this headline">¶</a></h2> <p>This is a bug release.</p> <h2 id="development-summary-and-credits">Development summary and credits<a class="headerlink" href="#development-summary-and-credits" title="Permalink to this headline">¶</a></h2> <p>Besides receiving contributions for new and improved features and for bugfixes, important contributions to general maintenance for this release came from</p> <ul class="simple"> <li><p>Kerby Shedden</p></li> <li><p>Josef Perktold</p></li> <li><p>Alex Lyttle</p></li> <li><p>Chad Fulton</p></li> <li><p>Kevin Sheppard</p></li> <li><p>Wouter De Coster</p></li> </ul> <h3 id="merged-pull-requests">Merged Pull Requests<a class="headerlink" href="#merged-pull-requests" title="Permalink to this headline">¶</a></h3> <p>The following Pull Requests were merged since the last release:</p> <ul class="simple"> <li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6433">PR #6433</a>: TST/BUG: use reset_randomstate</p></li> <li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6438">PR #6438</a>: BUG: Change default optimizer for glm/ridge and make it user-settable</p></li> <li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6453">PR #6453</a>: DOC: Fix the version that appears in the documentation</p></li> <li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6456">PR #6456</a>: DOC: Send log to dev/null/</p></li> <li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6461">PR #6461</a>: MAINT: correcting typo</p></li> <li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6465">PR #6465</a>: MAINT: Avoid noise in f-pvalue</p></li> <li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6469">PR #6469</a>: MAINT: Fix future warnings</p></li> <li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6470">PR #6470</a>: BUG: fix tukey-hsd for 1 pvalue</p></li> <li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6471">PR #6471</a>: MAINT: Fix issue with ragged array</p></li> <li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6474">PR #6474</a>: BLD: Use pip on Azure</p></li> <li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6515">PR #6515</a>: BUG: fix #6511</p></li> <li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6520">PR #6520</a>: BUG: fix GAM for 1-dim exog_linear</p></li> <li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6534">PR #6534</a>: MAINT: Relax tolerance on test that occasionally fails</p></li> <li><p><a class="reference external" href="https://github.com/statsmodels/statsmodels/pull/6535">PR #6535</a>: MAINT: Restrict to Python 3.5+</p></li> </ul> </article> </div> </div> </main> </div> <footer class="md-footer"> <div class="md-footer-nav"> <nav class="md-footer-nav__inner md-grid"> <a href="version0.12.html" title="Release 0.12.0" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev"> <div class="md-flex__cell md-flex__cell--shrink"> <i class="md-icon md-icon--arrow-back md-footer-nav__button"></i> </div> <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"> <span class="md-flex__ellipsis"> <span class="md-footer-nav__direction"> Previous </span> Release 0.12.0 </span> </div> </a> <a href="version0.11.html" title="Release 0.11.0" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next"> <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"><span class="md-flex__ellipsis"> <span class="md-footer-nav__direction"> Next </span> Release 0.11.0 </span> </div> <div class="md-flex__cell md-flex__cell--shrink"><i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i> </div> </a> </nav> </div> <div class="md-footer-meta md-typeset"> <div class="md-footer-meta__inner md-grid"> <div class="md-footer-copyright"> <div class="md-footer-copyright__highlight"> &#169; Copyright 2009-2019, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers. </div> Last updated on Aug 27, 2020. <br/> Created using <a href="http://www.sphinx-doc.org/">Sphinx</a> 3.2.1. and <a href="https://github.com/bashtage/sphinx-material/">Material for Sphinx</a> </div> </div> </div> </footer> <script src="../_static/javascripts/application.js"></script> <script>app.initialize({version: "1.0.4", url: {base: ".."}})</script> </body> </html>
statsmodels/statsmodels.github.io
v0.12.0/release/version0.11.1.html
HTML
bsd-3-clause
21,439
<?php namespace app\models; use Yii; /** * This is the model class for table "content". * * @property integer $id * @property string $title * @property integer $moderation * @property integer $listsql_id * @property integer $parent_id * @property integer $grade_id * @property string $comment_TutorAboutPupil1 * @property integer $mark_TutorAboutPupil1 * @property string $date_TutorAboutPupil1 * @property string $comment_Pupil1AboutTutor * @property integer $mark_Pupil1AboutTutor * @property string $date_Pupil1AboutTutor * @property string $commentMaximum_TutorAboutPupil1 * @property integer $markMaximum_TutorAboutPupil1 * @property string $dateMaximum_TutorAboutPupil1 * @property string $commentMaximum_Pupil1AboutTutor * @property integer $markMaximum_Pupil1AboutTutor * @property string $dateMaximum_Pupil1AboutTutor * @property string $comment_Pupil1AboutPupil1 * @property integer $mark_Pupil1AboutPupil1 * @property string $date_Pupil1AboutPupil1 * @property string $commentMaximum_Pupil1AboutPupil1 * @property integer $markMaximum_Pupil1AboutPupil1 * @property string $dateMaximum_Pupil1AboutPupil1 */ class Content extends \yii\db\ActiveRecord { /** * @inheritdoc */ public static function tableName() { return 'content'; } /** * @inheritdoc */ public function rules() { return [ [['title', 'moderation', 'listsql_id', 'parent_id', 'comment_TutorAboutPupil1', 'mark_TutorAboutPupil1', 'date_TutorAboutPupil1', 'comment_Pupil1AboutTutor', 'mark_Pupil1AboutTutor', 'date_Pupil1AboutTutor', 'commentMaximum_TutorAboutPupil1', 'markMaximum_TutorAboutPupil1', 'dateMaximum_TutorAboutPupil1', 'commentMaximum_Pupil1AboutTutor', 'markMaximum_Pupil1AboutTutor', 'dateMaximum_Pupil1AboutTutor', 'comment_Pupil1AboutPupil1', 'mark_Pupil1AboutPupil1', 'date_Pupil1AboutPupil1', 'commentMaximum_Pupil1AboutPupil1', 'markMaximum_Pupil1AboutPupil1', 'dateMaximum_Pupil1AboutPupil1'], 'required'], [['moderation', 'listsql_id', 'parent_id', 'grade_id', 'mark_TutorAboutPupil1', 'mark_Pupil1AboutTutor', 'markMaximum_TutorAboutPupil1', 'markMaximum_Pupil1AboutTutor', 'mark_Pupil1AboutPupil1', 'markMaximum_Pupil1AboutPupil1'], 'integer'], [['comment_TutorAboutPupil1', 'comment_Pupil1AboutTutor', 'commentMaximum_TutorAboutPupil1', 'commentMaximum_Pupil1AboutTutor', 'comment_Pupil1AboutPupil1', 'commentMaximum_Pupil1AboutPupil1'], 'string'], [['date_TutorAboutPupil1', 'date_Pupil1AboutTutor', 'dateMaximum_TutorAboutPupil1', 'dateMaximum_Pupil1AboutTutor', 'date_Pupil1AboutPupil1', 'dateMaximum_Pupil1AboutPupil1'], 'safe'], [['title'], 'string', 'max' => 500], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => 'ID', 'title' => 'Title', 'moderation' => 'Moderation', 'listsql_id' => 'Listsql ID', 'parent_id' => 'Parent ID', 'grade_id' => 'Grade ID', 'comment_TutorAboutPupil1' => 'Comment Tutor About Pupil1', 'mark_TutorAboutPupil1' => 'Mark Tutor About Pupil1', 'date_TutorAboutPupil1' => 'Date Tutor About Pupil1', 'comment_Pupil1AboutTutor' => 'Comment Pupil1 About Tutor', 'mark_Pupil1AboutTutor' => 'Mark Pupil1 About Tutor', 'date_Pupil1AboutTutor' => 'Date Pupil1 About Tutor', 'commentMaximum_TutorAboutPupil1' => 'Comment Maximum Tutor About Pupil1', 'markMaximum_TutorAboutPupil1' => 'Mark Maximum Tutor About Pupil1', 'dateMaximum_TutorAboutPupil1' => 'Date Maximum Tutor About Pupil1', 'commentMaximum_Pupil1AboutTutor' => 'Comment Maximum Pupil1 About Tutor', 'markMaximum_Pupil1AboutTutor' => 'Mark Maximum Pupil1 About Tutor', 'dateMaximum_Pupil1AboutTutor' => 'Date Maximum Pupil1 About Tutor', 'comment_Pupil1AboutPupil1' => 'Comment Pupil1 About Pupil1', 'mark_Pupil1AboutPupil1' => 'Mark Pupil1 About Pupil1', 'date_Pupil1AboutPupil1' => 'Date Pupil1 About Pupil1', 'commentMaximum_Pupil1AboutPupil1' => 'Comment Maximum Pupil1 About Pupil1', 'markMaximum_Pupil1AboutPupil1' => 'Mark Maximum Pupil1 About Pupil1', 'dateMaximum_Pupil1AboutPupil1' => 'Date Maximum Pupil1 About Pupil1', ]; } }
halva202/halva202.by
backend/models/160501/Content.php
PHP
bsd-3-clause
4,464
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width,initial-scale=1"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="lang:clipboard.copy" content="Copy to clipboard"> <meta name="lang:clipboard.copied" content="Copied to clipboard"> <meta name="lang:search.language" content="en"> <meta name="lang:search.pipeline.stopwords" content="True"> <meta name="lang:search.pipeline.trimmer" content="True"> <meta name="lang:search.result.none" content="No matching documents"> <meta name="lang:search.result.one" content="1 matching document"> <meta name="lang:search.result.other" content="# matching documents"> <meta name="lang:search.tokenizer" content="[\s\-]+"> <link href="https://fonts.gstatic.com/" rel="preconnect" crossorigin> <link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500,700|Roboto:300,400,400i,700&display=fallback" rel="stylesheet"> <style> body, input { font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif } code, kbd, pre { font-family: "Roboto Mono", "Courier New", Courier, monospace } </style> <link rel="stylesheet" href="../../../../_static/stylesheets/application.css"/> <link rel="stylesheet" href="../../../../_static/stylesheets/application-palette.css"/> <link rel="stylesheet" href="../../../../_static/stylesheets/application-fixes.css"/> <link rel="stylesheet" href="../../../../_static/fonts/material-icons.css"/> <meta name="theme-color" content="#3f51b5"> <script src="../../../../_static/javascripts/modernizr.js"></script> <title>statsmodels.tsa.statespace.representation &#8212; statsmodels</title> <link rel="icon" type="image/png" sizes="32x32" href="../../../../_static/icons/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="16x16" href="../../../../_static/icons/favicon-16x16.png"> <link rel="manifest" href="../../../../_static/icons/site.webmanifest"> <link rel="mask-icon" href="../../../../_static/icons/safari-pinned-tab.svg" color="#919191"> <meta name="msapplication-TileColor" content="#2b5797"> <meta name="msapplication-config" content="../../../../_static/icons/browserconfig.xml"> <link rel="stylesheet" href="../../../../_static/stylesheets/examples.css"> <link rel="stylesheet" href="../../../../_static/stylesheets/deprecation.css"> <link rel="stylesheet" type="text/css" href="../../../../_static/pygments.css" /> <link rel="stylesheet" type="text/css" href="../../../../_static/material.css" /> <link rel="stylesheet" type="text/css" href="../../../../_static/graphviz.css" /> <link rel="stylesheet" type="text/css" href="../../../../_static/plot_directive.css" /> <script data-url_root="../../../../" id="documentation_options" src="../../../../_static/documentation_options.js"></script> <script src="../../../../_static/jquery.js"></script> <script src="../../../../_static/underscore.js"></script> <script src="../../../../_static/doctools.js"></script> <script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script> <link rel="shortcut icon" href="../../../../_static/favicon.ico"/> <link rel="author" title="About these documents" href="../../../../about.html" /> <link rel="index" title="Index" href="../../../../genindex.html" /> <link rel="search" title="Search" href="../../../../search.html" /> </head> <body dir=ltr data-md-color-primary=indigo data-md-color-accent=blue> <svg class="md-svg"> <defs data-children-count="0"> <svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="__github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg> </defs> </svg> <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer"> <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search"> <label class="md-overlay" data-md-component="overlay" for="__drawer"></label> <a href="#_modules/statsmodels/tsa/statespace/representation" tabindex="1" class="md-skip"> Skip to content </a> <header class="md-header" data-md-component="header"> <nav class="md-header-nav md-grid"> <div class="md-flex navheader"> <div class="md-flex__cell md-flex__cell--shrink"> <a href="../../../../index.html" title="statsmodels" class="md-header-nav__button md-logo"> <img src="../../../../_static/statsmodels-logo-v2-bw.svg" height="26" alt="statsmodels logo"> </a> </div> <div class="md-flex__cell md-flex__cell--shrink"> <label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label> </div> <div class="md-flex__cell md-flex__cell--stretch"> <div class="md-flex__ellipsis md-header-nav__title" data-md-component="title"> <span class="md-header-nav__topic">statsmodels v0.13.0</span> <span class="md-header-nav__topic"> statsmodels.tsa.statespace.representation </span> </div> </div> <div class="md-flex__cell md-flex__cell--shrink"> <label class="md-icon md-icon--search md-header-nav__button" for="__search"></label> <div class="md-search" data-md-component="search" role="dialog"> <label class="md-search__overlay" for="__search"></label> <div class="md-search__inner" role="search"> <form class="md-search__form" action="../../../../search.html" method="get" name="search"> <input type="text" class="md-search__input" name="q" placeholder="Search" autocapitalize="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active"> <label class="md-icon md-search__icon" for="__search"></label> <button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1"> &#xE5CD; </button> </form> <div class="md-search__output"> <div class="md-search__scrollwrap" data-md-scrollfix> <div class="md-search-result" data-md-component="result"> <div class="md-search-result__meta"> Type to start searching </div> <ol class="md-search-result__list"></ol> </div> </div> </div> </div> </div> </div> <div class="md-flex__cell md-flex__cell--shrink"> <div class="md-header-nav__source"> <a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github"> <div class="md-source__icon"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28"> <use xlink:href="#__github" width="24" height="24"></use> </svg> </div> <div class="md-source__repository"> statsmodels </div> </a> </div> </div> <script src="../../../../_static/javascripts/version_dropdown.js"></script> <script> var json_loc = "../../../../../versions-v2.json", target_loc = "../../../../../", text = "Versions"; $( document ).ready( add_version_dropdown(json_loc, target_loc, text)); </script> </div> </nav> </header> <div class="md-container"> <nav class="md-tabs" data-md-component="tabs"> <div class="md-tabs__inner md-grid"> <ul class="md-tabs__list"> <li class="md-tabs__item"><a href="../../../index.html" class="md-tabs__link">Module code</a></li> </ul> </div> </nav> <main class="md-main"> <div class="md-main__inner md-grid" data-md-component="container"> <div class="md-sidebar md-sidebar--primary" data-md-component="navigation"> <div class="md-sidebar__scrollwrap"> <div class="md-sidebar__inner"> <nav class="md-nav md-nav--primary" data-md-level="0"> <label class="md-nav__title md-nav__title--site" for="__drawer"> <a href="../../../../index.html" title="statsmodels" class="md-nav__button md-logo"> <img src="../../../../_static/statsmodels-logo-v2-bw.svg" alt=" logo" width="48" height="48"> </a> <a href="../../../../index.html" title="statsmodels">statsmodels v0.13.0</a> </label> <div class="md-nav__source"> <a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github"> <div class="md-source__icon"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28"> <use xlink:href="#__github" width="24" height="24"></use> </svg> </div> <div class="md-source__repository"> statsmodels </div> </a> </div> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="../../../../install.html" class="md-nav__link">Installing statsmodels</a> </li> <li class="md-nav__item"> <a href="../../../../gettingstarted.html" class="md-nav__link">Getting started</a> </li> <li class="md-nav__item"> <a href="../../../../user-guide.html" class="md-nav__link">User Guide</a> </li> <li class="md-nav__item"> <a href="../../../../examples/index.html" class="md-nav__link">Examples</a> </li> <li class="md-nav__item"> <a href="../../../../api.html" class="md-nav__link">API Reference</a> </li> <li class="md-nav__item"> <a href="../../../../about.html" class="md-nav__link">About statsmodels</a> </li> <li class="md-nav__item"> <a href="../../../../dev/index.html" class="md-nav__link">Developer Page</a> </li> <li class="md-nav__item"> <a href="../../../../release/index.html" class="md-nav__link">Release Notes</a> </li> </ul> </nav> </div> </div> </div> <div class="md-sidebar md-sidebar--secondary" data-md-component="toc"> <div class="md-sidebar__scrollwrap"> <div class="md-sidebar__inner"> <nav class="md-nav md-nav--secondary"> <ul class="md-nav__list" data-md-scrollfix=""> <li id="searchbox" class="md-nav__item"></li> </ul> </nav> </div> </div> </div> <div class="md-content"> <article class="md-content__inner md-typeset" role="main"> <h1 id="modules-statsmodels-tsa-statespace-representation--page-root">Source code for statsmodels.tsa.statespace.representation</h1><div class="highlight"><pre> <span></span><span class="sd">"""</span> <span class="sd">State Space Representation</span> <span class="sd">Author: Chad Fulton</span> <span class="sd">License: Simplified-BSD</span> <span class="sd">"""</span> <span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span> <span class="kn">from</span> <span class="nn">.tools</span> <span class="kn">import</span> <span class="p">(</span> <span class="n">find_best_blas_type</span><span class="p">,</span> <span class="n">validate_matrix_shape</span><span class="p">,</span> <span class="n">validate_vector_shape</span> <span class="p">)</span> <span class="kn">from</span> <span class="nn">.initialization</span> <span class="kn">import</span> <span class="n">Initialization</span> <span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">tools</span> <span class="k">class</span> <span class="nc">OptionWrapper</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">mask_attribute</span><span class="p">,</span> <span class="n">mask_value</span><span class="p">):</span> <span class="c1"># Name of the class-level bitmask attribute</span> <span class="bp">self</span><span class="o">.</span><span class="n">mask_attribute</span> <span class="o">=</span> <span class="n">mask_attribute</span> <span class="c1"># Value of this option</span> <span class="bp">self</span><span class="o">.</span><span class="n">mask_value</span> <span class="o">=</span> <span class="n">mask_value</span> <span class="k">def</span> <span class="fm">__get__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj</span><span class="p">,</span> <span class="n">objtype</span><span class="p">):</span> <span class="c1"># Return True / False based on whether the bit is set in the bitmask</span> <span class="k">return</span> <span class="nb">bool</span><span class="p">(</span><span class="nb">getattr</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">mask_attribute</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="o">&amp;</span> <span class="bp">self</span><span class="o">.</span><span class="n">mask_value</span><span class="p">)</span> <span class="k">def</span> <span class="fm">__set__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span> <span class="n">mask_attribute_value</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">mask_attribute</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="k">if</span> <span class="nb">bool</span><span class="p">(</span><span class="n">value</span><span class="p">):</span> <span class="n">value</span> <span class="o">=</span> <span class="n">mask_attribute_value</span> <span class="o">|</span> <span class="bp">self</span><span class="o">.</span><span class="n">mask_value</span> <span class="k">else</span><span class="p">:</span> <span class="n">value</span> <span class="o">=</span> <span class="n">mask_attribute_value</span> <span class="o">&amp;</span> <span class="o">~</span><span class="bp">self</span><span class="o">.</span><span class="n">mask_value</span> <span class="nb">setattr</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">mask_attribute</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> <span class="k">class</span> <span class="nc">MatrixWrapper</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">attribute</span><span class="p">):</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span> <span class="bp">self</span><span class="o">.</span><span class="n">attribute</span> <span class="o">=</span> <span class="n">attribute</span> <span class="bp">self</span><span class="o">.</span><span class="n">_attribute</span> <span class="o">=</span> <span class="s1">'_'</span> <span class="o">+</span> <span class="n">attribute</span> <span class="k">def</span> <span class="fm">__get__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj</span><span class="p">,</span> <span class="n">objtype</span><span class="p">):</span> <span class="n">matrix</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_attribute</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> <span class="c1"># # Remove last dimension if the array is not actually time-varying</span> <span class="c1"># if matrix is not None and matrix.shape[-1] == 1:</span> <span class="c1"># return np.squeeze(matrix, -1)</span> <span class="k">return</span> <span class="n">matrix</span> <span class="k">def</span> <span class="fm">__set__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span> <span class="n">value</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">asarray</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">order</span><span class="o">=</span><span class="s2">"F"</span><span class="p">)</span> <span class="n">shape</span> <span class="o">=</span> <span class="n">obj</span><span class="o">.</span><span class="n">shapes</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">attribute</span><span class="p">]</span> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">shape</span><span class="p">)</span> <span class="o">==</span> <span class="mi">3</span><span class="p">:</span> <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_set_matrix</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">shape</span><span class="p">)</span> <span class="k">else</span><span class="p">:</span> <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_set_vector</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">shape</span><span class="p">)</span> <span class="nb">setattr</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_attribute</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> <span class="n">obj</span><span class="o">.</span><span class="n">shapes</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">attribute</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span><span class="o">.</span><span class="n">shape</span> <span class="k">def</span> <span class="nf">_set_matrix</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">shape</span><span class="p">):</span> <span class="c1"># Expand 1-dimensional array if possible</span> <span class="k">if</span> <span class="p">(</span><span class="n">value</span><span class="o">.</span><span class="n">ndim</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">and</span> <span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">and</span> <span class="n">value</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">]):</span> <span class="n">value</span> <span class="o">=</span> <span class="n">value</span><span class="p">[</span><span class="kc">None</span><span class="p">,</span> <span class="p">:]</span> <span class="c1"># Enforce that the matrix is appropriate size</span> <span class="n">validate_matrix_shape</span><span class="p">(</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="o">.</span><span class="n">shape</span><span class="p">,</span> <span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">obj</span><span class="o">.</span><span class="n">nobs</span> <span class="p">)</span> <span class="c1"># Expand time-invariant matrix</span> <span class="k">if</span> <span class="n">value</span><span class="o">.</span><span class="n">ndim</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span> <span class="n">value</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">value</span><span class="p">[:,</span> <span class="p">:,</span> <span class="kc">None</span><span class="p">],</span> <span class="n">order</span><span class="o">=</span><span class="s2">"F"</span><span class="p">)</span> <span class="k">return</span> <span class="n">value</span> <span class="k">def</span> <span class="nf">_set_vector</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">shape</span><span class="p">):</span> <span class="c1"># Enforce that the vector has appropriate length</span> <span class="n">validate_vector_shape</span><span class="p">(</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="o">.</span><span class="n">shape</span><span class="p">,</span> <span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">obj</span><span class="o">.</span><span class="n">nobs</span> <span class="p">)</span> <span class="c1"># Expand the time-invariant vector</span> <span class="k">if</span> <span class="n">value</span><span class="o">.</span><span class="n">ndim</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> <span class="n">value</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">value</span><span class="p">[:,</span> <span class="kc">None</span><span class="p">],</span> <span class="n">order</span><span class="o">=</span><span class="s2">"F"</span><span class="p">)</span> <span class="k">return</span> <span class="n">value</span> <div class="viewcode-block" id="Representation"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.Representation.html#statsmodels.tsa.statespace.kalman_filter.Representation">[docs]</a><span class="k">class</span> <span class="nc">Representation</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span> <span class="sa">r</span><span class="sd">"""</span> <span class="sd"> State space representation of a time series process</span> <span class="sd"> Parameters</span> <span class="sd"> ----------</span> <span class="sd"> k_endog : {array_like, int}</span> <span class="sd"> The observed time-series process :math:`y` if array like or the</span> <span class="sd"> number of variables in the process if an integer.</span> <span class="sd"> k_states : int</span> <span class="sd"> The dimension of the unobserved state process.</span> <span class="sd"> k_posdef : int, optional</span> <span class="sd"> The dimension of a guaranteed positive definite covariance matrix</span> <span class="sd"> describing the shocks in the measurement equation. Must be less than</span> <span class="sd"> or equal to `k_states`. Default is `k_states`.</span> <span class="sd"> initial_variance : float, optional</span> <span class="sd"> Initial variance used when approximate diffuse initialization is</span> <span class="sd"> specified. Default is 1e6.</span> <span class="sd"> initialization : Initialization object or str, optional</span> <span class="sd"> Initialization method for the initial state. If a string, must be one</span> <span class="sd"> of {'diffuse', 'approximate_diffuse', 'stationary', 'known'}.</span> <span class="sd"> initial_state : array_like, optional</span> <span class="sd"> If `initialization='known'` is used, the mean of the initial state's</span> <span class="sd"> distribution.</span> <span class="sd"> initial_state_cov : array_like, optional</span> <span class="sd"> If `initialization='known'` is used, the covariance matrix of the</span> <span class="sd"> initial state's distribution.</span> <span class="sd"> nobs : int, optional</span> <span class="sd"> If an endogenous vector is not given (i.e. `k_endog` is an integer),</span> <span class="sd"> the number of observations can optionally be specified. If not</span> <span class="sd"> specified, they will be set to zero until data is bound to the model.</span> <span class="sd"> dtype : np.dtype, optional</span> <span class="sd"> If an endogenous vector is not given (i.e. `k_endog` is an integer),</span> <span class="sd"> the default datatype of the state space matrices can optionally be</span> <span class="sd"> specified. Default is `np.float64`.</span> <span class="sd"> design : array_like, optional</span> <span class="sd"> The design matrix, :math:`Z`. Default is set to zeros.</span> <span class="sd"> obs_intercept : array_like, optional</span> <span class="sd"> The intercept for the observation equation, :math:`d`. Default is set</span> <span class="sd"> to zeros.</span> <span class="sd"> obs_cov : array_like, optional</span> <span class="sd"> The covariance matrix for the observation equation :math:`H`. Default</span> <span class="sd"> is set to zeros.</span> <span class="sd"> transition : array_like, optional</span> <span class="sd"> The transition matrix, :math:`T`. Default is set to zeros.</span> <span class="sd"> state_intercept : array_like, optional</span> <span class="sd"> The intercept for the transition equation, :math:`c`. Default is set to</span> <span class="sd"> zeros.</span> <span class="sd"> selection : array_like, optional</span> <span class="sd"> The selection matrix, :math:`R`. Default is set to zeros.</span> <span class="sd"> state_cov : array_like, optional</span> <span class="sd"> The covariance matrix for the state equation :math:`Q`. Default is set</span> <span class="sd"> to zeros.</span> <span class="sd"> **kwargs</span> <span class="sd"> Additional keyword arguments. Not used directly. It is present to</span> <span class="sd"> improve compatibility with subclasses, so that they can use `**kwargs`</span> <span class="sd"> to specify any default state space matrices (e.g. `design`) without</span> <span class="sd"> having to clean out any other keyword arguments they might have been</span> <span class="sd"> passed.</span> <span class="sd"> Attributes</span> <span class="sd"> ----------</span> <span class="sd"> nobs : int</span> <span class="sd"> The number of observations.</span> <span class="sd"> k_endog : int</span> <span class="sd"> The dimension of the observation series.</span> <span class="sd"> k_states : int</span> <span class="sd"> The dimension of the unobserved state process.</span> <span class="sd"> k_posdef : int</span> <span class="sd"> The dimension of a guaranteed positive</span> <span class="sd"> definite covariance matrix describing</span> <span class="sd"> the shocks in the measurement equation.</span> <span class="sd"> shapes : dictionary of name:tuple</span> <span class="sd"> A dictionary recording the initial shapes</span> <span class="sd"> of each of the representation matrices as</span> <span class="sd"> tuples.</span> <span class="sd"> initialization : str</span> <span class="sd"> Kalman filter initialization method. Default is unset.</span> <span class="sd"> initial_variance : float</span> <span class="sd"> Initial variance for approximate diffuse</span> <span class="sd"> initialization. Default is 1e6.</span> <span class="sd"> Notes</span> <span class="sd"> -----</span> <span class="sd"> A general state space model is of the form</span> <span class="sd"> .. math::</span> <span class="sd"> y_t &amp; = Z_t \alpha_t + d_t + \varepsilon_t \\</span> <span class="sd"> \alpha_t &amp; = T_t \alpha_{t-1} + c_t + R_t \eta_t \\</span> <span class="sd"> where :math:`y_t` refers to the observation vector at time :math:`t`,</span> <span class="sd"> :math:`\alpha_t` refers to the (unobserved) state vector at time</span> <span class="sd"> :math:`t`, and where the irregular components are defined as</span> <span class="sd"> .. math::</span> <span class="sd"> \varepsilon_t \sim N(0, H_t) \\</span> <span class="sd"> \eta_t \sim N(0, Q_t) \\</span> <span class="sd"> The remaining variables (:math:`Z_t, d_t, H_t, T_t, c_t, R_t, Q_t`) in the</span> <span class="sd"> equations are matrices describing the process. Their variable names and</span> <span class="sd"> dimensions are as follows</span> <span class="sd"> Z : `design` :math:`(k\_endog \times k\_states \times nobs)`</span> <span class="sd"> d : `obs_intercept` :math:`(k\_endog \times nobs)`</span> <span class="sd"> H : `obs_cov` :math:`(k\_endog \times k\_endog \times nobs)`</span> <span class="sd"> T : `transition` :math:`(k\_states \times k\_states \times nobs)`</span> <span class="sd"> c : `state_intercept` :math:`(k\_states \times nobs)`</span> <span class="sd"> R : `selection` :math:`(k\_states \times k\_posdef \times nobs)`</span> <span class="sd"> Q : `state_cov` :math:`(k\_posdef \times k\_posdef \times nobs)`</span> <span class="sd"> In the case that one of the matrices is time-invariant (so that, for</span> <span class="sd"> example, :math:`Z_t = Z_{t+1} ~ \forall ~ t`), its last dimension may</span> <span class="sd"> be of size :math:`1` rather than size `nobs`.</span> <span class="sd"> References</span> <span class="sd"> ----------</span> <span class="sd"> .. [*] Durbin, James, and Siem Jan Koopman. 2012.</span> <span class="sd"> Time Series Analysis by State Space Methods: Second Edition.</span> <span class="sd"> Oxford University Press.</span> <span class="sd"> """</span> <span class="n">endog</span> <span class="o">=</span> <span class="kc">None</span> <span class="sa">r</span><span class="sd">"""</span> <span class="sd"> (array) The observation vector, alias for `obs`.</span> <span class="sd"> """</span> <span class="n">design</span> <span class="o">=</span> <span class="n">MatrixWrapper</span><span class="p">(</span><span class="s1">'design'</span><span class="p">,</span> <span class="s1">'design'</span><span class="p">)</span> <span class="sa">r</span><span class="sd">"""</span> <span class="sd"> (array) Design matrix: :math:`Z~(k\_endog \times k\_states \times nobs)`</span> <span class="sd"> """</span> <span class="n">obs_intercept</span> <span class="o">=</span> <span class="n">MatrixWrapper</span><span class="p">(</span><span class="s1">'observation intercept'</span><span class="p">,</span> <span class="s1">'obs_intercept'</span><span class="p">)</span> <span class="sa">r</span><span class="sd">"""</span> <span class="sd"> (array) Observation intercept: :math:`d~(k\_endog \times nobs)`</span> <span class="sd"> """</span> <span class="n">obs_cov</span> <span class="o">=</span> <span class="n">MatrixWrapper</span><span class="p">(</span><span class="s1">'observation covariance matrix'</span><span class="p">,</span> <span class="s1">'obs_cov'</span><span class="p">)</span> <span class="sa">r</span><span class="sd">"""</span> <span class="sd"> (array) Observation covariance matrix:</span> <span class="sd"> :math:`H~(k\_endog \times k\_endog \times nobs)`</span> <span class="sd"> """</span> <span class="n">transition</span> <span class="o">=</span> <span class="n">MatrixWrapper</span><span class="p">(</span><span class="s1">'transition'</span><span class="p">,</span> <span class="s1">'transition'</span><span class="p">)</span> <span class="sa">r</span><span class="sd">"""</span> <span class="sd"> (array) Transition matrix:</span> <span class="sd"> :math:`T~(k\_states \times k\_states \times nobs)`</span> <span class="sd"> """</span> <span class="n">state_intercept</span> <span class="o">=</span> <span class="n">MatrixWrapper</span><span class="p">(</span><span class="s1">'state intercept'</span><span class="p">,</span> <span class="s1">'state_intercept'</span><span class="p">)</span> <span class="sa">r</span><span class="sd">"""</span> <span class="sd"> (array) State intercept: :math:`c~(k\_states \times nobs)`</span> <span class="sd"> """</span> <span class="n">selection</span> <span class="o">=</span> <span class="n">MatrixWrapper</span><span class="p">(</span><span class="s1">'selection'</span><span class="p">,</span> <span class="s1">'selection'</span><span class="p">)</span> <span class="sa">r</span><span class="sd">"""</span> <span class="sd"> (array) Selection matrix:</span> <span class="sd"> :math:`R~(k\_states \times k\_posdef \times nobs)`</span> <span class="sd"> """</span> <span class="n">state_cov</span> <span class="o">=</span> <span class="n">MatrixWrapper</span><span class="p">(</span><span class="s1">'state covariance matrix'</span><span class="p">,</span> <span class="s1">'state_cov'</span><span class="p">)</span> <span class="sa">r</span><span class="sd">"""</span> <span class="sd"> (array) State covariance matrix:</span> <span class="sd"> :math:`Q~(k\_posdef \times k\_posdef \times nobs)`</span> <span class="sd"> """</span> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">k_endog</span><span class="p">,</span> <span class="n">k_states</span><span class="p">,</span> <span class="n">k_posdef</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">initial_variance</span><span class="o">=</span><span class="mf">1e6</span><span class="p">,</span> <span class="n">nobs</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">float64</span><span class="p">,</span> <span class="n">design</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">obs_intercept</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">obs_cov</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">transition</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">state_intercept</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">selection</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">state_cov</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">statespace_classes</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span> <span class="o">=</span> <span class="p">{}</span> <span class="c1"># Check if k_endog is actually the endog array</span> <span class="n">endog</span> <span class="o">=</span> <span class="kc">None</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">k_endog</span><span class="p">,</span> <span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">):</span> <span class="n">endog</span> <span class="o">=</span> <span class="n">k_endog</span> <span class="c1"># If so, assume that it is either column-ordered and in wide format</span> <span class="c1"># or row-ordered and in long format</span> <span class="k">if</span> <span class="p">(</span><span class="n">endog</span><span class="o">.</span><span class="n">flags</span><span class="p">[</span><span class="s1">'C_CONTIGUOUS'</span><span class="p">]</span> <span class="ow">and</span> <span class="p">(</span><span class="n">endog</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;</span> <span class="mi">1</span> <span class="ow">or</span> <span class="n">nobs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">)):</span> <span class="n">endog</span> <span class="o">=</span> <span class="n">endog</span><span class="o">.</span><span class="n">T</span> <span class="n">k_endog</span> <span class="o">=</span> <span class="n">endog</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="c1"># Endogenous array, dimensions, dtype</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_endog</span> <span class="o">=</span> <span class="n">k_endog</span> <span class="k">if</span> <span class="n">k_endog</span> <span class="o">&lt;</span> <span class="mi">1</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Number of endogenous variables in statespace'</span> <span class="s1">' model must be a positive number.'</span><span class="p">)</span> <span class="bp">self</span><span class="o">.</span><span class="n">nobs</span> <span class="o">=</span> <span class="n">nobs</span> <span class="c1"># Get dimensions from transition equation</span> <span class="k">if</span> <span class="n">k_states</span> <span class="o">&lt;</span> <span class="mi">1</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Number of states in statespace model must be a'</span> <span class="s1">' positive number.'</span><span class="p">)</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_states</span> <span class="o">=</span> <span class="n">k_states</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_posdef</span> <span class="o">=</span> <span class="n">k_posdef</span> <span class="k">if</span> <span class="n">k_posdef</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">k_states</span> <span class="c1"># Make sure k_posdef &lt;= k_states</span> <span class="c1"># TODO: we could technically allow k_posdef &gt; k_states, but the Cython</span> <span class="c1"># code needs to be more thoroughly checked to avoid seg faults.</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_posdef</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Dimension of state innovation `k_posdef` cannot'</span> <span class="s1">' be larger than the dimension of the state.'</span><span class="p">)</span> <span class="c1"># Bind endog, if it was given</span> <span class="k">if</span> <span class="n">endog</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">bind</span><span class="p">(</span><span class="n">endog</span><span class="p">)</span> <span class="c1"># Record the shapes of all of our matrices</span> <span class="c1"># Note: these are time-invariant shapes; in practice the last dimension</span> <span class="c1"># may also be `self.nobs` for any or all of these.</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span> <span class="o">=</span> <span class="p">{</span> <span class="s1">'obs'</span><span class="p">:</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_endog</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">nobs</span><span class="p">),</span> <span class="s1">'design'</span><span class="p">:</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_endog</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="s1">'obs_intercept'</span><span class="p">:</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_endog</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="s1">'obs_cov'</span><span class="p">:</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_endog</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_endog</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="s1">'transition'</span><span class="p">:</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="s1">'state_intercept'</span><span class="p">:</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="s1">'selection'</span><span class="p">:</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_posdef</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="s1">'state_cov'</span><span class="p">:</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_posdef</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_posdef</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">}</span> <span class="c1"># Representation matrices</span> <span class="c1"># These matrices are only used in the Python object as containers,</span> <span class="c1"># which will be copied to the appropriate _statespace object if a</span> <span class="c1"># filter is called.</span> <span class="n">scope</span> <span class="o">=</span> <span class="nb">locals</span><span class="p">()</span> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">shape</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s1">'obs'</span><span class="p">:</span> <span class="k">continue</span> <span class="c1"># Create the initial storage array for each matrix</span> <span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s1">'_'</span> <span class="o">+</span> <span class="n">name</span><span class="p">,</span> <span class="n">np</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="n">shape</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="n">dtype</span><span class="p">,</span> <span class="n">order</span><span class="o">=</span><span class="s2">"F"</span><span class="p">))</span> <span class="c1"># If we were given an initial value for the matrix, set it</span> <span class="c1"># (notice it is being set via the descriptor)</span> <span class="k">if</span> <span class="n">scope</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> <span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">scope</span><span class="p">[</span><span class="n">name</span><span class="p">])</span> <span class="c1"># Options</span> <span class="bp">self</span><span class="o">.</span><span class="n">initial_variance</span> <span class="o">=</span> <span class="n">initial_variance</span> <span class="bp">self</span><span class="o">.</span><span class="n">prefix_statespace_map</span> <span class="o">=</span> <span class="p">(</span><span class="n">statespace_classes</span> <span class="k">if</span> <span class="n">statespace_classes</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">tools</span><span class="o">.</span><span class="n">prefix_statespace_map</span><span class="o">.</span><span class="n">copy</span><span class="p">())</span> <span class="c1"># State-space initialization data</span> <span class="bp">self</span><span class="o">.</span><span class="n">initialization</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'initialization'</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> <span class="n">basic_inits</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'diffuse'</span><span class="p">,</span> <span class="s1">'approximate_diffuse'</span><span class="p">,</span> <span class="s1">'stationary'</span><span class="p">]</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">initialization</span> <span class="ow">in</span> <span class="n">basic_inits</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">initialize</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">initialization</span><span class="p">)</span> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">initialization</span> <span class="o">==</span> <span class="s1">'known'</span><span class="p">:</span> <span class="k">if</span> <span class="s1">'constant'</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span> <span class="n">constant</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s1">'constant'</span><span class="p">]</span> <span class="k">elif</span> <span class="s1">'initial_state'</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span> <span class="c1"># TODO deprecation warning</span> <span class="n">constant</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s1">'initial_state'</span><span class="p">]</span> <span class="k">else</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Initial state must be provided when "known"'</span> <span class="s1">' is the specified initialization method.'</span><span class="p">)</span> <span class="k">if</span> <span class="s1">'stationary_cov'</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span> <span class="n">stationary_cov</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s1">'stationary_cov'</span><span class="p">]</span> <span class="k">elif</span> <span class="s1">'initial_state_cov'</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span> <span class="c1"># TODO deprecation warning</span> <span class="n">stationary_cov</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s1">'initial_state_cov'</span><span class="p">]</span> <span class="k">else</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Initial state covariance matrix must be'</span> <span class="s1">' provided when "known" is the specified'</span> <span class="s1">' initialization method.'</span><span class="p">)</span> <span class="bp">self</span><span class="o">.</span><span class="n">initialize</span><span class="p">(</span><span class="s1">'known'</span><span class="p">,</span> <span class="n">constant</span><span class="o">=</span><span class="n">constant</span><span class="p">,</span> <span class="n">stationary_cov</span><span class="o">=</span><span class="n">stationary_cov</span><span class="p">)</span> <span class="k">elif</span> <span class="p">(</span><span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">initialization</span><span class="p">,</span> <span class="n">Initialization</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">initialization</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">):</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"Invalid state space initialization method."</span><span class="p">)</span> <span class="c1"># Matrix representations storage</span> <span class="bp">self</span><span class="o">.</span><span class="n">_representations</span> <span class="o">=</span> <span class="p">{}</span> <span class="c1"># Setup the underlying statespace object storage</span> <span class="bp">self</span><span class="o">.</span><span class="n">_statespaces</span> <span class="o">=</span> <span class="p">{}</span> <span class="c1"># Caches</span> <span class="bp">self</span><span class="o">.</span><span class="n">_time_invariant</span> <span class="o">=</span> <span class="kc">None</span> <span class="k">def</span> <span class="fm">__getitem__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">):</span> <span class="n">_type</span> <span class="o">=</span> <span class="nb">type</span><span class="p">(</span><span class="n">key</span><span class="p">)</span> <span class="c1"># If only a string is given then we must be getting an entire matrix</span> <span class="k">if</span> <span class="n">_type</span> <span class="ow">is</span> <span class="nb">str</span><span class="p">:</span> <span class="k">if</span> <span class="n">key</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">IndexError</span><span class="p">(</span><span class="s1">'"</span><span class="si">%s</span><span class="s1">" is an invalid state space matrix name'</span> <span class="o">%</span> <span class="n">key</span><span class="p">)</span> <span class="n">matrix</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s1">'_'</span> <span class="o">+</span> <span class="n">key</span><span class="p">)</span> <span class="c1"># See note on time-varying arrays, below</span> <span class="k">if</span> <span class="n">matrix</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> <span class="k">return</span> <span class="n">matrix</span><span class="p">[(</span><span class="nb">slice</span><span class="p">(</span><span class="kc">None</span><span class="p">),)</span><span class="o">*</span><span class="p">(</span><span class="n">matrix</span><span class="o">.</span><span class="n">ndim</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">+</span> <span class="p">(</span><span class="mi">0</span><span class="p">,)]</span> <span class="k">else</span><span class="p">:</span> <span class="k">return</span> <span class="n">matrix</span> <span class="c1"># Otherwise if we have a tuple, we want a slice of a matrix</span> <span class="k">elif</span> <span class="n">_type</span> <span class="ow">is</span> <span class="nb">tuple</span><span class="p">:</span> <span class="n">name</span><span class="p">,</span> <span class="n">slice_</span> <span class="o">=</span> <span class="n">key</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">key</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span> <span class="k">if</span> <span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">IndexError</span><span class="p">(</span><span class="s1">'"</span><span class="si">%s</span><span class="s1">" is an invalid state space matrix name'</span> <span class="o">%</span> <span class="n">name</span><span class="p">)</span> <span class="n">matrix</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s1">'_'</span> <span class="o">+</span> <span class="n">name</span><span class="p">)</span> <span class="c1"># Since the model can support time-varying arrays, but often we</span> <span class="c1"># will instead have time-invariant arrays, we want to allow setting</span> <span class="c1"># a matrix slice like mod['transition',0,:] even though technically</span> <span class="c1"># it should be mod['transition',0,:,0]. Thus if the array in</span> <span class="c1"># question is time-invariant but the last slice was excluded,</span> <span class="c1"># add it in as a zero.</span> <span class="k">if</span> <span class="n">matrix</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">slice_</span><span class="p">)</span> <span class="o">&lt;=</span> <span class="n">matrix</span><span class="o">.</span><span class="n">ndim</span><span class="o">-</span><span class="mi">1</span><span class="p">:</span> <span class="n">slice_</span> <span class="o">=</span> <span class="n">slice_</span> <span class="o">+</span> <span class="p">(</span><span class="mi">0</span><span class="p">,)</span> <span class="k">return</span> <span class="n">matrix</span><span class="p">[</span><span class="n">slice_</span><span class="p">]</span> <span class="c1"># Otherwise, we have only a single slice index, but it is not a string</span> <span class="k">else</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">IndexError</span><span class="p">(</span><span class="s1">'First index must the name of a valid state space'</span> <span class="s1">' matrix.'</span><span class="p">)</span> <span class="k">def</span> <span class="fm">__setitem__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span> <span class="n">_type</span> <span class="o">=</span> <span class="nb">type</span><span class="p">(</span><span class="n">key</span><span class="p">)</span> <span class="c1"># If only a string is given then we must be setting an entire matrix</span> <span class="k">if</span> <span class="n">_type</span> <span class="ow">is</span> <span class="nb">str</span><span class="p">:</span> <span class="k">if</span> <span class="n">key</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">IndexError</span><span class="p">(</span><span class="s1">'"</span><span class="si">%s</span><span class="s1">" is an invalid state space matrix name'</span> <span class="o">%</span> <span class="n">key</span><span class="p">)</span> <span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> <span class="c1"># If it's a tuple (with a string as the first element) then we must be</span> <span class="c1"># setting a slice of a matrix</span> <span class="k">elif</span> <span class="n">_type</span> <span class="ow">is</span> <span class="nb">tuple</span><span class="p">:</span> <span class="n">name</span><span class="p">,</span> <span class="n">slice_</span> <span class="o">=</span> <span class="n">key</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">key</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span> <span class="k">if</span> <span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">IndexError</span><span class="p">(</span><span class="s1">'"</span><span class="si">%s</span><span class="s1">" is an invalid state space matrix name'</span> <span class="o">%</span> <span class="n">key</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="c1"># Change the dtype of the corresponding matrix</span> <span class="n">dtype</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">value</span><span class="p">)</span><span class="o">.</span><span class="n">dtype</span> <span class="n">matrix</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s1">'_'</span> <span class="o">+</span> <span class="n">name</span><span class="p">)</span> <span class="n">valid_types</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'f'</span><span class="p">,</span> <span class="s1">'d'</span><span class="p">,</span> <span class="s1">'F'</span><span class="p">,</span> <span class="s1">'D'</span><span class="p">]</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">matrix</span><span class="o">.</span><span class="n">dtype</span> <span class="o">==</span> <span class="n">dtype</span> <span class="ow">and</span> <span class="n">dtype</span><span class="o">.</span><span class="n">char</span> <span class="ow">in</span> <span class="n">valid_types</span><span class="p">:</span> <span class="n">matrix</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s1">'_'</span> <span class="o">+</span> <span class="n">name</span><span class="p">)</span><span class="o">.</span><span class="n">real</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="n">dtype</span><span class="p">)</span> <span class="c1"># Since the model can support time-varying arrays, but often we</span> <span class="c1"># will instead have time-invariant arrays, we want to allow setting</span> <span class="c1"># a matrix slice like mod['transition',0,:] even though technically</span> <span class="c1"># it should be mod['transition',0,:,0]. Thus if the array in</span> <span class="c1"># question is time-invariant but the last slice was excluded,</span> <span class="c1"># add it in as a zero.</span> <span class="k">if</span> <span class="n">matrix</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">slice_</span><span class="p">)</span> <span class="o">==</span> <span class="n">matrix</span><span class="o">.</span><span class="n">ndim</span><span class="o">-</span><span class="mi">1</span><span class="p">:</span> <span class="n">slice_</span> <span class="o">=</span> <span class="n">slice_</span> <span class="o">+</span> <span class="p">(</span><span class="mi">0</span><span class="p">,)</span> <span class="c1"># Set the new value</span> <span class="n">matrix</span><span class="p">[</span><span class="n">slice_</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span> <span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">matrix</span><span class="p">)</span> <span class="c1"># Otherwise we got a single non-string key, (e.g. mod[:]), which is</span> <span class="c1"># invalid</span> <span class="k">else</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">IndexError</span><span class="p">(</span><span class="s1">'First index must the name of a valid state space'</span> <span class="s1">' matrix.'</span><span class="p">)</span> <span class="k">def</span> <span class="nf">_clone_kwargs</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">endog</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="sd">"""</span> <span class="sd"> Construct keyword arguments for cloning a state space model</span> <span class="sd"> Parameters</span> <span class="sd"> ----------</span> <span class="sd"> endog : array_like</span> <span class="sd"> An observed time-series process :math:`y`.</span> <span class="sd"> **kwargs</span> <span class="sd"> Keyword arguments to pass to the new state space representation</span> <span class="sd"> model constructor. Those that are not specified are copied from</span> <span class="sd"> the specification of the current state space model.</span> <span class="sd"> """</span> <span class="c1"># We always need the base dimensions, but they cannot change from</span> <span class="c1"># the base model when cloning (the idea is: if these need to change,</span> <span class="c1"># need to make a new instance manually, since it's not really cloning).</span> <span class="n">kwargs</span><span class="p">[</span><span class="s1">'nobs'</span><span class="p">]</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">endog</span><span class="p">)</span> <span class="n">kwargs</span><span class="p">[</span><span class="s1">'k_endog'</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_endog</span> <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="p">[</span><span class="s1">'k_states'</span><span class="p">,</span> <span class="s1">'k_posdef'</span><span class="p">]:</span> <span class="n">val</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">)</span> <span class="k">if</span> <span class="n">key</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">kwargs</span> <span class="ow">or</span> <span class="n">kwargs</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> <span class="n">kwargs</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="n">val</span> <span class="k">if</span> <span class="n">kwargs</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">!=</span> <span class="n">val</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Cannot change the dimension of </span><span class="si">%s</span><span class="s1"> when'</span> <span class="s1">' cloning.'</span> <span class="o">%</span> <span class="n">key</span><span class="p">)</span> <span class="c1"># Get defaults for time-invariant system matrices, if not otherwise</span> <span class="c1"># provided</span> <span class="c1"># Time-varying matrices must be replaced.</span> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span> <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s1">'obs'</span><span class="p">:</span> <span class="k">continue</span> <span class="k">if</span> <span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span> <span class="n">mat</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span> <span class="k">if</span> <span class="n">mat</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">!=</span> <span class="mi">1</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'The `</span><span class="si">%s</span><span class="s1">` matrix is time-varying. Cloning'</span> <span class="s1">' this model requires specifying an'</span> <span class="s1">' updated matrix.'</span> <span class="o">%</span> <span class="n">name</span><span class="p">)</span> <span class="n">kwargs</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">mat</span> <span class="c1"># Default is to use the same initialization</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">setdefault</span><span class="p">(</span><span class="s1">'initialization'</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">initialization</span><span class="p">)</span> <span class="k">return</span> <span class="n">kwargs</span> <div class="viewcode-block" id="Representation.clone"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.Representation.clone.html#statsmodels.tsa.statespace.kalman_filter.Representation.clone">[docs]</a> <span class="k">def</span> <span class="nf">clone</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">endog</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="sd">"""</span> <span class="sd"> Clone a state space representation while overriding some elements</span> <span class="sd"> Parameters</span> <span class="sd"> ----------</span> <span class="sd"> endog : array_like</span> <span class="sd"> An observed time-series process :math:`y`.</span> <span class="sd"> **kwargs</span> <span class="sd"> Keyword arguments to pass to the new state space representation</span> <span class="sd"> model constructor. Those that are not specified are copied from</span> <span class="sd"> the specification of the current state space model.</span> <span class="sd"> Returns</span> <span class="sd"> -------</span> <span class="sd"> Representation</span> <span class="sd"> Notes</span> <span class="sd"> -----</span> <span class="sd"> If some system matrices are time-varying, then new time-varying</span> <span class="sd"> matrices *must* be provided.</span> <span class="sd"> """</span> <span class="n">kwargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_clone_kwargs</span><span class="p">(</span><span class="n">endog</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="n">mod</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="n">mod</span><span class="o">.</span><span class="n">bind</span><span class="p">(</span><span class="n">endog</span><span class="p">)</span> <span class="k">return</span> <span class="n">mod</span></div> <div class="viewcode-block" id="Representation.extend"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.Representation.extend.html#statsmodels.tsa.statespace.kalman_filter.Representation.extend">[docs]</a> <span class="k">def</span> <span class="nf">extend</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">endog</span><span class="p">,</span> <span class="n">start</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">end</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="sd">"""</span> <span class="sd"> Extend the current state space model, or a specific (time) subset</span> <span class="sd"> Parameters</span> <span class="sd"> ----------</span> <span class="sd"> endog : array_like</span> <span class="sd"> An observed time-series process :math:`y`.</span> <span class="sd"> start : int, optional</span> <span class="sd"> The first period of a time-varying state space model to include in</span> <span class="sd"> the new model. Has no effect if the state space model is</span> <span class="sd"> time-invariant. Default is the initial period.</span> <span class="sd"> end : int, optional</span> <span class="sd"> The last period of a time-varying state space model to include in</span> <span class="sd"> the new model. Has no effect if the state space model is</span> <span class="sd"> time-invariant. Default is the final period.</span> <span class="sd"> **kwargs</span> <span class="sd"> Keyword arguments to pass to the new state space representation</span> <span class="sd"> model constructor. Those that are not specified are copied from</span> <span class="sd"> the specification of the current state space model.</span> <span class="sd"> Returns</span> <span class="sd"> -------</span> <span class="sd"> Representation</span> <span class="sd"> Notes</span> <span class="sd"> -----</span> <span class="sd"> This method does not allow replacing a time-varying system matrix with</span> <span class="sd"> a time-invariant one (or vice-versa). If that is required, use `clone`.</span> <span class="sd"> """</span> <span class="n">endog</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">atleast_1d</span><span class="p">(</span><span class="n">endog</span><span class="p">)</span> <span class="k">if</span> <span class="n">endog</span><span class="o">.</span><span class="n">ndim</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> <span class="n">endog</span> <span class="o">=</span> <span class="n">endog</span><span class="p">[:,</span> <span class="n">np</span><span class="o">.</span><span class="n">newaxis</span><span class="p">]</span> <span class="n">nobs</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">endog</span><span class="p">)</span> <span class="k">if</span> <span class="n">start</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> <span class="n">start</span> <span class="o">=</span> <span class="mi">0</span> <span class="k">if</span> <span class="n">end</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> <span class="n">end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">nobs</span> <span class="k">if</span> <span class="n">start</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span> <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">nobs</span> <span class="o">+</span> <span class="n">start</span> <span class="k">if</span> <span class="n">end</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span> <span class="n">end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">nobs</span> <span class="o">+</span> <span class="n">end</span> <span class="k">if</span> <span class="n">start</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">nobs</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'The `start` argument of the extension within the'</span> <span class="s1">' base model cannot be after the end of the'</span> <span class="s1">' base model.'</span><span class="p">)</span> <span class="k">if</span> <span class="n">end</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">nobs</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'The `end` argument of the extension within the'</span> <span class="s1">' base model cannot be after the end of the'</span> <span class="s1">' base model.'</span><span class="p">)</span> <span class="k">if</span> <span class="n">start</span> <span class="o">&gt;</span> <span class="n">end</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'The `start` argument of the extension within the'</span> <span class="s1">' base model cannot be after the `end` argument.'</span><span class="p">)</span> <span class="c1"># Note: if start == end or if end &lt; self.nobs, then we're just cloning</span> <span class="c1"># (no extension)</span> <span class="n">endog</span> <span class="o">=</span> <span class="n">tools</span><span class="o">.</span><span class="n">concat</span><span class="p">([</span><span class="bp">self</span><span class="o">.</span><span class="n">endog</span><span class="p">[:,</span> <span class="n">start</span><span class="p">:</span><span class="n">end</span><span class="p">]</span><span class="o">.</span><span class="n">T</span><span class="p">,</span> <span class="n">endog</span><span class="p">])</span> <span class="c1"># Extend any time-varying arrays</span> <span class="n">error_ti</span> <span class="o">=</span> <span class="p">(</span><span class="s1">'Model has time-invariant </span><span class="si">%s</span><span class="s1"> matrix, so cannot provide'</span> <span class="s1">' an extended matrix.'</span><span class="p">)</span> <span class="n">error_tv</span> <span class="o">=</span> <span class="p">(</span><span class="s1">'Model has time-varying </span><span class="si">%s</span><span class="s1"> matrix, so an updated'</span> <span class="s1">' time-varying matrix for the extension period'</span> <span class="s1">' is required.'</span><span class="p">)</span> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">shape</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s1">'obs'</span><span class="p">:</span> <span class="k">continue</span> <span class="n">mat</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span> <span class="c1"># If we were *not* given an extended value for this matrix...</span> <span class="k">if</span> <span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span> <span class="c1"># If this is a time-varying matrix in the existing model</span> <span class="k">if</span> <span class="n">mat</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span> <span class="c1"># If we have an extension period, then raise an error</span> <span class="c1"># because we should have been given an extended value</span> <span class="k">if</span> <span class="n">end</span> <span class="o">+</span> <span class="n">nobs</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">nobs</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="n">error_tv</span> <span class="o">%</span> <span class="n">name</span><span class="p">)</span> <span class="c1"># If we do not have an extension period, then set the new</span> <span class="c1"># time-varying matrix to be the portion of the existing</span> <span class="c1"># time-varying matrix that corresponds to the period of</span> <span class="c1"># interest</span> <span class="k">else</span><span class="p">:</span> <span class="n">kwargs</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">mat</span><span class="p">[</span><span class="o">...</span><span class="p">,</span> <span class="n">start</span><span class="p">:</span><span class="n">end</span> <span class="o">+</span> <span class="n">nobs</span><span class="p">]</span> <span class="k">elif</span> <span class="n">nobs</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Extension is being performed within-sample'</span> <span class="s1">' so cannot provide an extended matrix'</span><span class="p">)</span> <span class="c1"># If we were given an extended value for this matrix</span> <span class="k">else</span><span class="p">:</span> <span class="c1"># TODO: Need to add a check for ndim, and if the matrix has</span> <span class="c1"># one fewer dimensions than the existing matrix, add a new axis</span> <span class="c1"># If this is a time-invariant matrix in the existing model,</span> <span class="c1"># raise an error</span> <span class="k">if</span> <span class="n">mat</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">nobs</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="n">error_ti</span> <span class="o">%</span> <span class="n">name</span><span class="p">)</span> <span class="c1"># Otherwise, validate the shape of the given extended value</span> <span class="c1"># Note: we do not validate the number of observations here</span> <span class="c1"># (so we pass in updated_mat.shape[-1] as the nobs argument</span> <span class="c1"># in the validate_* calls); instead, we check below that we</span> <span class="c1"># at least `nobs` values were passed in and then only take the</span> <span class="c1"># first of them as required. This can be useful when e.g. the</span> <span class="c1"># end user knows the extension values up to some maximum</span> <span class="c1"># endpoint, but does not know what the calling methods may</span> <span class="c1"># specifically require.</span> <span class="n">updated_mat</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">asarray</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="n">name</span><span class="p">])</span> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">shape</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span> <span class="n">validate_vector_shape</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">updated_mat</span><span class="o">.</span><span class="n">shape</span><span class="p">,</span> <span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">updated_mat</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span> <span class="k">else</span><span class="p">:</span> <span class="n">validate_matrix_shape</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">updated_mat</span><span class="o">.</span><span class="n">shape</span><span class="p">,</span> <span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">updated_mat</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span> <span class="k">if</span> <span class="n">updated_mat</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">&lt;</span> <span class="n">nobs</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="n">error_tv</span> <span class="o">%</span> <span class="n">name</span><span class="p">)</span> <span class="k">else</span><span class="p">:</span> <span class="n">updated_mat</span> <span class="o">=</span> <span class="n">updated_mat</span><span class="p">[</span><span class="o">...</span><span class="p">,</span> <span class="p">:</span><span class="n">nobs</span><span class="p">]</span> <span class="c1"># Concatenate to get the new time-varying matrix</span> <span class="n">kwargs</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">c_</span><span class="p">[</span><span class="n">mat</span><span class="p">[</span><span class="o">...</span><span class="p">,</span> <span class="n">start</span><span class="p">:</span><span class="n">end</span><span class="p">],</span> <span class="n">updated_mat</span><span class="p">]</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">clone</span><span class="p">(</span><span class="n">endog</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></div> <div class="viewcode-block" id="Representation.diff_endog"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.Representation.diff_endog.html#statsmodels.tsa.statespace.kalman_filter.Representation.diff_endog">[docs]</a> <span class="k">def</span> <span class="nf">diff_endog</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">new_endog</span><span class="p">,</span> <span class="n">tolerance</span><span class="o">=</span><span class="mf">1e-10</span><span class="p">):</span> <span class="c1"># TODO: move this function to tools?</span> <span class="n">endog</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">endog</span><span class="o">.</span><span class="n">T</span> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">new_endog</span><span class="p">)</span> <span class="o">&lt;</span> <span class="nb">len</span><span class="p">(</span><span class="n">endog</span><span class="p">):</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Given data (length </span><span class="si">%d</span><span class="s1">) is too short to diff'</span> <span class="s1">' against model data (length </span><span class="si">%d</span><span class="s1">).'</span> <span class="o">%</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">new_endog</span><span class="p">),</span> <span class="nb">len</span><span class="p">(</span><span class="n">endog</span><span class="p">)))</span> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">new_endog</span><span class="p">)</span> <span class="o">&gt;</span> <span class="nb">len</span><span class="p">(</span><span class="n">endog</span><span class="p">):</span> <span class="n">nobs_append</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">new_endog</span><span class="p">)</span> <span class="o">-</span> <span class="nb">len</span><span class="p">(</span><span class="n">endog</span><span class="p">)</span> <span class="n">endog</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">c_</span><span class="p">[</span><span class="n">endog</span><span class="o">.</span><span class="n">T</span><span class="p">,</span> <span class="n">new_endog</span><span class="p">[</span><span class="o">-</span><span class="n">nobs_append</span><span class="p">:]</span><span class="o">.</span><span class="n">T</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">nan</span><span class="p">]</span><span class="o">.</span><span class="n">T</span> <span class="n">new_nan</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">isnan</span><span class="p">(</span><span class="n">new_endog</span><span class="p">)</span> <span class="n">existing_nan</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">isnan</span><span class="p">(</span><span class="n">endog</span><span class="p">)</span> <span class="n">diff</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">abs</span><span class="p">(</span><span class="n">new_endog</span> <span class="o">-</span> <span class="n">endog</span><span class="p">)</span> <span class="n">diff</span><span class="p">[</span><span class="n">new_nan</span> <span class="o">^</span> <span class="n">existing_nan</span><span class="p">]</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">inf</span> <span class="n">diff</span><span class="p">[</span><span class="n">new_nan</span> <span class="o">&amp;</span> <span class="n">existing_nan</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.</span> <span class="n">is_revision</span> <span class="o">=</span> <span class="p">(</span><span class="n">diff</span> <span class="o">&gt;</span> <span class="n">tolerance</span><span class="p">)</span> <span class="n">is_new</span> <span class="o">=</span> <span class="n">existing_nan</span> <span class="o">&amp;</span> <span class="o">~</span><span class="n">new_nan</span> <span class="n">is_revision</span><span class="p">[</span><span class="n">is_new</span><span class="p">]</span> <span class="o">=</span> <span class="kc">False</span> <span class="n">revision_ix</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">zip</span><span class="p">(</span><span class="o">*</span><span class="n">np</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">is_revision</span><span class="p">)))</span> <span class="n">new_ix</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">zip</span><span class="p">(</span><span class="o">*</span><span class="n">np</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">is_new</span><span class="p">)))</span> <span class="k">return</span> <span class="n">revision_ix</span><span class="p">,</span> <span class="n">new_ix</span></div> <span class="nd">@property</span> <span class="k">def</span> <span class="nf">prefix</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <span class="sd">"""</span> <span class="sd"> (str) BLAS prefix of currently active representation matrices</span> <span class="sd"> """</span> <span class="n">arrays</span> <span class="o">=</span> <span class="p">(</span> <span class="bp">self</span><span class="o">.</span><span class="n">_design</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_obs_intercept</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_obs_cov</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_transition</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_state_intercept</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_selection</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_state_cov</span> <span class="p">)</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">endog</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> <span class="n">arrays</span> <span class="o">=</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">endog</span><span class="p">,)</span> <span class="o">+</span> <span class="n">arrays</span> <span class="k">return</span> <span class="n">find_best_blas_type</span><span class="p">(</span><span class="n">arrays</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> <span class="nd">@property</span> <span class="k">def</span> <span class="nf">dtype</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <span class="sd">"""</span> <span class="sd"> (dtype) Datatype of currently active representation matrices</span> <span class="sd"> """</span> <span class="k">return</span> <span class="n">tools</span><span class="o">.</span><span class="n">prefix_dtype_map</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">prefix</span><span class="p">]</span> <span class="nd">@property</span> <span class="k">def</span> <span class="nf">time_invariant</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <span class="sd">"""</span> <span class="sd"> (bool) Whether or not currently active representation matrices are</span> <span class="sd"> time-invariant</span> <span class="sd"> """</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_time_invariant</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> <span class="k">return</span> <span class="p">(</span> <span class="bp">self</span><span class="o">.</span><span class="n">_design</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">_obs_intercept</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">_obs_cov</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">_transition</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">_state_intercept</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">_selection</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">_state_cov</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="p">)</span> <span class="k">else</span><span class="p">:</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_time_invariant</span> <span class="nd">@property</span> <span class="k">def</span> <span class="nf">_statespace</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <span class="n">prefix</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">prefix</span> <span class="k">if</span> <span class="n">prefix</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">:</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">[</span><span class="n">prefix</span><span class="p">]</span> <span class="k">return</span> <span class="kc">None</span> <span class="nd">@property</span> <span class="k">def</span> <span class="nf">obs</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <span class="sa">r</span><span class="sd">"""</span> <span class="sd"> (array) Observation vector: :math:`y~(k\_endog \times nobs)`</span> <span class="sd"> """</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">endog</span> <div class="viewcode-block" id="Representation.bind"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.Representation.bind.html#statsmodels.tsa.statespace.kalman_filter.Representation.bind">[docs]</a> <span class="k">def</span> <span class="nf">bind</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">endog</span><span class="p">):</span> <span class="sd">"""</span> <span class="sd"> Bind data to the statespace representation</span> <span class="sd"> Parameters</span> <span class="sd"> ----------</span> <span class="sd"> endog : ndarray</span> <span class="sd"> Endogenous data to bind to the model. Must be column-ordered</span> <span class="sd"> ndarray with shape (`k_endog`, `nobs`) or row-ordered ndarray with</span> <span class="sd"> shape (`nobs`, `k_endog`).</span> <span class="sd"> Notes</span> <span class="sd"> -----</span> <span class="sd"> The strict requirements arise because the underlying statespace and</span> <span class="sd"> Kalman filtering classes require Fortran-ordered arrays in the wide</span> <span class="sd"> format (shaped (`k_endog`, `nobs`)), and this structure is setup to</span> <span class="sd"> prevent copying arrays in memory.</span> <span class="sd"> By default, numpy arrays are row (C)-ordered and most time series are</span> <span class="sd"> represented in the long format (with time on the 0-th axis). In this</span> <span class="sd"> case, no copying or re-ordering needs to be performed, instead the</span> <span class="sd"> array can simply be transposed to get it in the right order and shape.</span> <span class="sd"> Although this class (Representation) has stringent `bind` requirements,</span> <span class="sd"> it is assumed that it will rarely be used directly.</span> <span class="sd"> """</span> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">endog</span><span class="p">,</span> <span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">):</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"Invalid endogenous array; must be an ndarray."</span><span class="p">)</span> <span class="c1"># Make sure we have a 2-dimensional array</span> <span class="c1"># Note: reshaping a 1-dim array into a 2-dim array by changing the</span> <span class="c1"># shape tuple always results in a row (C)-ordered array, so it</span> <span class="c1"># must be shaped (nobs, k_endog)</span> <span class="k">if</span> <span class="n">endog</span><span class="o">.</span><span class="n">ndim</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> <span class="c1"># In the case of nobs x 0 arrays</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_endog</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> <span class="n">endog</span><span class="o">.</span><span class="n">shape</span> <span class="o">=</span> <span class="p">(</span><span class="n">endog</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="mi">1</span><span class="p">)</span> <span class="c1"># In the case of k_endog x 0 arrays</span> <span class="k">else</span><span class="p">:</span> <span class="n">endog</span><span class="o">.</span><span class="n">shape</span> <span class="o">=</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">endog</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">endog</span><span class="o">.</span><span class="n">ndim</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Invalid endogenous array provided; must be'</span> <span class="s1">' 2-dimensional.'</span><span class="p">)</span> <span class="c1"># Check for valid column-ordered arrays</span> <span class="k">if</span> <span class="n">endog</span><span class="o">.</span><span class="n">flags</span><span class="p">[</span><span class="s1">'F_CONTIGUOUS'</span><span class="p">]</span> <span class="ow">and</span> <span class="n">endog</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_endog</span><span class="p">:</span> <span class="k">pass</span> <span class="c1"># Check for valid row-ordered arrays, and transpose them to be the</span> <span class="c1"># correct column-ordered array</span> <span class="k">elif</span> <span class="n">endog</span><span class="o">.</span><span class="n">flags</span><span class="p">[</span><span class="s1">'C_CONTIGUOUS'</span><span class="p">]</span> <span class="ow">and</span> <span class="n">endog</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_endog</span><span class="p">:</span> <span class="n">endog</span> <span class="o">=</span> <span class="n">endog</span><span class="o">.</span><span class="n">T</span> <span class="c1"># Invalid column-ordered arrays</span> <span class="k">elif</span> <span class="n">endog</span><span class="o">.</span><span class="n">flags</span><span class="p">[</span><span class="s1">'F_CONTIGUOUS'</span><span class="p">]:</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Invalid endogenous array; column-ordered'</span> <span class="s1">' arrays must have first axis shape of'</span> <span class="s1">' `k_endog`.'</span><span class="p">)</span> <span class="c1"># Invalid row-ordered arrays</span> <span class="k">elif</span> <span class="n">endog</span><span class="o">.</span><span class="n">flags</span><span class="p">[</span><span class="s1">'C_CONTIGUOUS'</span><span class="p">]:</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Invalid endogenous array; row-ordered'</span> <span class="s1">' arrays must have last axis shape of'</span> <span class="s1">' `k_endog`.'</span><span class="p">)</span> <span class="c1"># Non-contiguous arrays</span> <span class="k">else</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Invalid endogenous array; must be ordered in'</span> <span class="s1">' contiguous memory.'</span><span class="p">)</span> <span class="c1"># We may still have a non-fortran contiguous array, so double-check</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">endog</span><span class="o">.</span><span class="n">flags</span><span class="p">[</span><span class="s1">'F_CONTIGUOUS'</span><span class="p">]:</span> <span class="n">endog</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">asfortranarray</span><span class="p">(</span><span class="n">endog</span><span class="p">)</span> <span class="c1"># Set a flag for complex data</span> <span class="bp">self</span><span class="o">.</span><span class="n">_complex_endog</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">iscomplexobj</span><span class="p">(</span><span class="n">endog</span><span class="p">)</span> <span class="c1"># Set the data</span> <span class="bp">self</span><span class="o">.</span><span class="n">endog</span> <span class="o">=</span> <span class="n">endog</span> <span class="bp">self</span><span class="o">.</span><span class="n">nobs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">endog</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="c1"># Reset shapes</span> <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s1">'shapes'</span><span class="p">):</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="p">[</span><span class="s1">'obs'</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">endog</span><span class="o">.</span><span class="n">shape</span></div> <div class="viewcode-block" id="Representation.initialize"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.Representation.initialize.html#statsmodels.tsa.statespace.kalman_filter.Representation.initialize">[docs]</a> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">initialization</span><span class="p">,</span> <span class="n">approximate_diffuse_variance</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">constant</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">stationary_cov</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> <span class="sd">"""Create an Initialization object if necessary"""</span> <span class="k">if</span> <span class="n">initialization</span> <span class="o">==</span> <span class="s1">'known'</span><span class="p">:</span> <span class="n">initialization</span> <span class="o">=</span> <span class="n">Initialization</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="s1">'known'</span><span class="p">,</span> <span class="n">constant</span><span class="o">=</span><span class="n">constant</span><span class="p">,</span> <span class="n">stationary_cov</span><span class="o">=</span><span class="n">stationary_cov</span><span class="p">)</span> <span class="k">elif</span> <span class="n">initialization</span> <span class="o">==</span> <span class="s1">'approximate_diffuse'</span><span class="p">:</span> <span class="k">if</span> <span class="n">approximate_diffuse_variance</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> <span class="n">approximate_diffuse_variance</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">initial_variance</span> <span class="n">initialization</span> <span class="o">=</span> <span class="n">Initialization</span><span class="p">(</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="s1">'approximate_diffuse'</span><span class="p">,</span> <span class="n">approximate_diffuse_variance</span><span class="o">=</span><span class="n">approximate_diffuse_variance</span><span class="p">)</span> <span class="k">elif</span> <span class="n">initialization</span> <span class="o">==</span> <span class="s1">'stationary'</span><span class="p">:</span> <span class="n">initialization</span> <span class="o">=</span> <span class="n">Initialization</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="s1">'stationary'</span><span class="p">)</span> <span class="k">elif</span> <span class="n">initialization</span> <span class="o">==</span> <span class="s1">'diffuse'</span><span class="p">:</span> <span class="n">initialization</span> <span class="o">=</span> <span class="n">Initialization</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="s1">'diffuse'</span><span class="p">)</span> <span class="c1"># We must have an initialization object at this point</span> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">initialization</span><span class="p">,</span> <span class="n">Initialization</span><span class="p">):</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"Invalid state space initialization method."</span><span class="p">)</span> <span class="bp">self</span><span class="o">.</span><span class="n">initialization</span> <span class="o">=</span> <span class="n">initialization</span></div> <div class="viewcode-block" id="Representation.initialize_known"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.Representation.initialize_known.html#statsmodels.tsa.statespace.kalman_filter.Representation.initialize_known">[docs]</a> <span class="k">def</span> <span class="nf">initialize_known</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">constant</span><span class="p">,</span> <span class="n">stationary_cov</span><span class="p">):</span> <span class="sd">"""</span> <span class="sd"> Initialize the statespace model with known distribution for initial</span> <span class="sd"> state.</span> <span class="sd"> These values are assumed to be known with certainty or else</span> <span class="sd"> filled with parameters during, for example, maximum likelihood</span> <span class="sd"> estimation.</span> <span class="sd"> Parameters</span> <span class="sd"> ----------</span> <span class="sd"> constant : array_like</span> <span class="sd"> Known mean of the initial state vector.</span> <span class="sd"> stationary_cov : array_like</span> <span class="sd"> Known covariance matrix of the initial state vector.</span> <span class="sd"> """</span> <span class="n">constant</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">asarray</span><span class="p">(</span><span class="n">constant</span><span class="p">,</span> <span class="n">order</span><span class="o">=</span><span class="s2">"F"</span><span class="p">)</span> <span class="n">stationary_cov</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">asarray</span><span class="p">(</span><span class="n">stationary_cov</span><span class="p">,</span> <span class="n">order</span><span class="o">=</span><span class="s2">"F"</span><span class="p">)</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">constant</span><span class="o">.</span><span class="n">shape</span> <span class="o">==</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,):</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Invalid dimensions for constant state vector.'</span> <span class="s1">' Requires shape (</span><span class="si">%d</span><span class="s1">,), got </span><span class="si">%s</span><span class="s1">'</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">constant</span><span class="o">.</span><span class="n">shape</span><span class="p">)))</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">stationary_cov</span><span class="o">.</span><span class="n">shape</span> <span class="o">==</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">):</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">'Invalid dimensions for stationary covariance'</span> <span class="s1">' matrix. Requires shape (</span><span class="si">%d</span><span class="s1">,</span><span class="si">%d</span><span class="s1">), got </span><span class="si">%s</span><span class="s1">'</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_states</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">stationary_cov</span><span class="o">.</span><span class="n">shape</span><span class="p">)))</span> <span class="bp">self</span><span class="o">.</span><span class="n">initialize</span><span class="p">(</span><span class="s1">'known'</span><span class="p">,</span> <span class="n">constant</span><span class="o">=</span><span class="n">constant</span><span class="p">,</span> <span class="n">stationary_cov</span><span class="o">=</span><span class="n">stationary_cov</span><span class="p">)</span></div> <div class="viewcode-block" id="Representation.initialize_approximate_diffuse"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.Representation.initialize_approximate_diffuse.html#statsmodels.tsa.statespace.kalman_filter.Representation.initialize_approximate_diffuse">[docs]</a> <span class="k">def</span> <span class="nf">initialize_approximate_diffuse</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">variance</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> <span class="sd">"""</span> <span class="sd"> Initialize the statespace model with approximate diffuse values.</span> <span class="sd"> Rather than following the exact diffuse treatment (which is developed</span> <span class="sd"> for the case that the variance becomes infinitely large), this assigns</span> <span class="sd"> an arbitrary large number for the variance.</span> <span class="sd"> Parameters</span> <span class="sd"> ----------</span> <span class="sd"> variance : float, optional</span> <span class="sd"> The variance for approximating diffuse initial conditions. Default</span> <span class="sd"> is 1e6.</span> <span class="sd"> """</span> <span class="k">if</span> <span class="n">variance</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> <span class="n">variance</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">initial_variance</span> <span class="bp">self</span><span class="o">.</span><span class="n">initialize</span><span class="p">(</span><span class="s1">'approximate_diffuse'</span><span class="p">,</span> <span class="n">approximate_diffuse_variance</span><span class="o">=</span><span class="n">variance</span><span class="p">)</span></div> <div class="viewcode-block" id="Representation.initialize_stationary"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.Representation.initialize_stationary.html#statsmodels.tsa.statespace.kalman_filter.Representation.initialize_stationary">[docs]</a> <span class="k">def</span> <span class="nf">initialize_stationary</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <span class="sd">"""</span> <span class="sd"> Initialize the statespace model as stationary.</span> <span class="sd"> """</span> <span class="bp">self</span><span class="o">.</span><span class="n">initialize</span><span class="p">(</span><span class="s1">'stationary'</span><span class="p">)</span></div> <div class="viewcode-block" id="Representation.initialize_diffuse"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.Representation.initialize_diffuse.html#statsmodels.tsa.statespace.kalman_filter.Representation.initialize_diffuse">[docs]</a> <span class="k">def</span> <span class="nf">initialize_diffuse</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <span class="sd">"""</span> <span class="sd"> Initialize the statespace model as stationary.</span> <span class="sd"> """</span> <span class="bp">self</span><span class="o">.</span><span class="n">initialize</span><span class="p">(</span><span class="s1">'diffuse'</span><span class="p">)</span></div> <span class="k">def</span> <span class="nf">_initialize_representation</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> <span class="k">if</span> <span class="n">prefix</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> <span class="n">prefix</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">prefix</span> <span class="n">dtype</span> <span class="o">=</span> <span class="n">tools</span><span class="o">.</span><span class="n">prefix_dtype_map</span><span class="p">[</span><span class="n">prefix</span><span class="p">]</span> <span class="c1"># If the dtype-specific representation matrices do not exist, create</span> <span class="c1"># them</span> <span class="k">if</span> <span class="n">prefix</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">:</span> <span class="c1"># Copy the statespace representation matrices</span> <span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> <span class="k">for</span> <span class="n">matrix</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span> <span class="k">if</span> <span class="n">matrix</span> <span class="o">==</span> <span class="s1">'obs'</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="n">matrix</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span> <span class="bp">self</span><span class="o">.</span><span class="n">obs</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="n">dtype</span><span class="p">)</span> <span class="p">)</span> <span class="k">else</span><span class="p">:</span> <span class="c1"># Note: this always makes a copy</span> <span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="n">matrix</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s1">'_'</span> <span class="o">+</span> <span class="n">matrix</span><span class="p">)</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="n">dtype</span><span class="p">)</span> <span class="p">)</span> <span class="c1"># If they do exist, update them</span> <span class="k">else</span><span class="p">:</span> <span class="k">for</span> <span class="n">matrix</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span> <span class="n">existing</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="n">matrix</span><span class="p">]</span> <span class="k">if</span> <span class="n">matrix</span> <span class="o">==</span> <span class="s1">'obs'</span><span class="p">:</span> <span class="c1"># existing[:] = self.obs.astype(dtype)</span> <span class="k">pass</span> <span class="k">else</span><span class="p">:</span> <span class="n">new</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s1">'_'</span> <span class="o">+</span> <span class="n">matrix</span><span class="p">)</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="n">dtype</span><span class="p">)</span> <span class="k">if</span> <span class="n">existing</span><span class="o">.</span><span class="n">shape</span> <span class="o">==</span> <span class="n">new</span><span class="o">.</span><span class="n">shape</span><span class="p">:</span> <span class="n">existing</span><span class="p">[:]</span> <span class="o">=</span> <span class="n">new</span><span class="p">[:]</span> <span class="k">else</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="n">matrix</span><span class="p">]</span> <span class="o">=</span> <span class="n">new</span> <span class="c1"># Determine if we need to (re-)create the _statespace models</span> <span class="c1"># (if time-varying matrices changed)</span> <span class="k">if</span> <span class="n">prefix</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">:</span> <span class="n">ss</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">[</span><span class="n">prefix</span><span class="p">]</span> <span class="n">create</span> <span class="o">=</span> <span class="p">(</span> <span class="ow">not</span> <span class="n">ss</span><span class="o">.</span><span class="n">obs</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">endog</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">ss</span><span class="o">.</span><span class="n">design</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">design</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">ss</span><span class="o">.</span><span class="n">obs_intercept</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">obs_intercept</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">ss</span><span class="o">.</span><span class="n">obs_cov</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">obs_cov</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">ss</span><span class="o">.</span><span class="n">transition</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">transition</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="ow">or</span> <span class="ow">not</span> <span class="p">(</span><span class="n">ss</span><span class="o">.</span><span class="n">state_intercept</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">state_intercept</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">ss</span><span class="o">.</span><span class="n">selection</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">selection</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">ss</span><span class="o">.</span><span class="n">state_cov</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">state_cov</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="p">)</span> <span class="k">else</span><span class="p">:</span> <span class="n">create</span> <span class="o">=</span> <span class="kc">True</span> <span class="c1"># (re-)create if necessary</span> <span class="k">if</span> <span class="n">create</span><span class="p">:</span> <span class="k">if</span> <span class="n">prefix</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">:</span> <span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">[</span><span class="n">prefix</span><span class="p">]</span> <span class="c1"># Setup the base statespace object</span> <span class="bp">cls</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">prefix_statespace_map</span><span class="p">[</span><span class="n">prefix</span><span class="p">]</span> <span class="bp">self</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">[</span><span class="n">prefix</span><span class="p">]</span> <span class="o">=</span> <span class="bp">cls</span><span class="p">(</span> <span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="s1">'obs'</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="s1">'design'</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="s1">'obs_intercept'</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="s1">'obs_cov'</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="s1">'transition'</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="s1">'state_intercept'</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="s1">'selection'</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">_representations</span><span class="p">[</span><span class="n">prefix</span><span class="p">][</span><span class="s1">'state_cov'</span><span class="p">]</span> <span class="p">)</span> <span class="k">return</span> <span class="n">prefix</span><span class="p">,</span> <span class="n">dtype</span><span class="p">,</span> <span class="n">create</span> <span class="k">def</span> <span class="nf">_initialize_state</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">complex_step</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> <span class="c1"># TODO once the transition to using the Initialization objects is</span> <span class="c1"># complete, this should be moved entirely to the _{{prefix}}Statespace</span> <span class="c1"># object.</span> <span class="k">if</span> <span class="n">prefix</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> <span class="n">prefix</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">prefix</span> <span class="c1"># (Re-)initialize the statespace model</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">initialization</span><span class="p">,</span> <span class="n">Initialization</span><span class="p">):</span> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">initialization</span><span class="o">.</span><span class="n">initialized</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s1">'Initialization is incomplete.'</span><span class="p">)</span> <span class="bp">self</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">[</span><span class="n">prefix</span><span class="p">]</span><span class="o">.</span><span class="n">initialize</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">initialization</span><span class="p">,</span> <span class="n">complex_step</span><span class="o">=</span><span class="n">complex_step</span><span class="p">)</span> <span class="k">else</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s1">'Statespace model not initialized.'</span><span class="p">)</span></div> <div class="viewcode-block" id="FrozenRepresentation"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.FrozenRepresentation.html#statsmodels.tsa.statespace.kalman_filter.FrozenRepresentation">[docs]</a><span class="k">class</span> <span class="nc">FrozenRepresentation</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span> <span class="sd">"""</span> <span class="sd"> Frozen Statespace Model</span> <span class="sd"> Takes a snapshot of a Statespace model.</span> <span class="sd"> Parameters</span> <span class="sd"> ----------</span> <span class="sd"> model : Representation</span> <span class="sd"> A Statespace representation</span> <span class="sd"> Attributes</span> <span class="sd"> ----------</span> <span class="sd"> nobs : int</span> <span class="sd"> Number of observations.</span> <span class="sd"> k_endog : int</span> <span class="sd"> The dimension of the observation series.</span> <span class="sd"> k_states : int</span> <span class="sd"> The dimension of the unobserved state process.</span> <span class="sd"> k_posdef : int</span> <span class="sd"> The dimension of a guaranteed positive definite</span> <span class="sd"> covariance matrix describing the shocks in the</span> <span class="sd"> measurement equation.</span> <span class="sd"> dtype : dtype</span> <span class="sd"> Datatype of representation matrices</span> <span class="sd"> prefix : str</span> <span class="sd"> BLAS prefix of representation matrices</span> <span class="sd"> shapes : dictionary of name:tuple</span> <span class="sd"> A dictionary recording the shapes of each of</span> <span class="sd"> the representation matrices as tuples.</span> <span class="sd"> endog : ndarray</span> <span class="sd"> The observation vector.</span> <span class="sd"> design : ndarray</span> <span class="sd"> The design matrix, :math:`Z`.</span> <span class="sd"> obs_intercept : ndarray</span> <span class="sd"> The intercept for the observation equation, :math:`d`.</span> <span class="sd"> obs_cov : ndarray</span> <span class="sd"> The covariance matrix for the observation equation :math:`H`.</span> <span class="sd"> transition : ndarray</span> <span class="sd"> The transition matrix, :math:`T`.</span> <span class="sd"> state_intercept : ndarray</span> <span class="sd"> The intercept for the transition equation, :math:`c`.</span> <span class="sd"> selection : ndarray</span> <span class="sd"> The selection matrix, :math:`R`.</span> <span class="sd"> state_cov : ndarray</span> <span class="sd"> The covariance matrix for the state equation :math:`Q`.</span> <span class="sd"> missing : array of bool</span> <span class="sd"> An array of the same size as `endog`, filled</span> <span class="sd"> with boolean values that are True if the</span> <span class="sd"> corresponding entry in `endog` is NaN and False</span> <span class="sd"> otherwise.</span> <span class="sd"> nmissing : array of int</span> <span class="sd"> An array of size `nobs`, where the ith entry</span> <span class="sd"> is the number (between 0 and `k_endog`) of NaNs in</span> <span class="sd"> the ith row of the `endog` array.</span> <span class="sd"> time_invariant : bool</span> <span class="sd"> Whether or not the representation matrices are time-invariant</span> <span class="sd"> initialization : Initialization object</span> <span class="sd"> Kalman filter initialization method.</span> <span class="sd"> initial_state : array_like</span> <span class="sd"> The state vector used to initialize the Kalamn filter.</span> <span class="sd"> initial_state_cov : array_like</span> <span class="sd"> The state covariance matrix used to initialize the Kalamn filter.</span> <span class="sd"> """</span> <span class="n">_model_attributes</span> <span class="o">=</span> <span class="p">[</span> <span class="s1">'model'</span><span class="p">,</span> <span class="s1">'prefix'</span><span class="p">,</span> <span class="s1">'dtype'</span><span class="p">,</span> <span class="s1">'nobs'</span><span class="p">,</span> <span class="s1">'k_endog'</span><span class="p">,</span> <span class="s1">'k_states'</span><span class="p">,</span> <span class="s1">'k_posdef'</span><span class="p">,</span> <span class="s1">'time_invariant'</span><span class="p">,</span> <span class="s1">'endog'</span><span class="p">,</span> <span class="s1">'design'</span><span class="p">,</span> <span class="s1">'obs_intercept'</span><span class="p">,</span> <span class="s1">'obs_cov'</span><span class="p">,</span> <span class="s1">'transition'</span><span class="p">,</span> <span class="s1">'state_intercept'</span><span class="p">,</span> <span class="s1">'selection'</span><span class="p">,</span> <span class="s1">'state_cov'</span><span class="p">,</span> <span class="s1">'missing'</span><span class="p">,</span> <span class="s1">'nmissing'</span><span class="p">,</span> <span class="s1">'shapes'</span><span class="p">,</span> <span class="s1">'initialization'</span><span class="p">,</span> <span class="s1">'initial_state'</span><span class="p">,</span> <span class="s1">'initial_state_cov'</span><span class="p">,</span> <span class="s1">'initial_variance'</span> <span class="p">]</span> <span class="n">_attributes</span> <span class="o">=</span> <span class="n">_model_attributes</span> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">model</span><span class="p">):</span> <span class="c1"># Initialize all attributes to None</span> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_attributes</span><span class="p">:</span> <span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> <span class="c1"># Update the representation attributes</span> <span class="bp">self</span><span class="o">.</span><span class="n">update_representation</span><span class="p">(</span><span class="n">model</span><span class="p">)</span> <div class="viewcode-block" id="FrozenRepresentation.update_representation"><a class="viewcode-back" href="../../../../generated/statsmodels.tsa.statespace.representation.FrozenRepresentation.update_representation.html#statsmodels.tsa.statespace.kalman_filter.FrozenRepresentation.update_representation">[docs]</a> <span class="k">def</span> <span class="nf">update_representation</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">model</span><span class="p">):</span> <span class="sd">"""Update model Representation"""</span> <span class="c1"># Model</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="n">model</span> <span class="c1"># Data type</span> <span class="bp">self</span><span class="o">.</span><span class="n">prefix</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">prefix</span> <span class="bp">self</span><span class="o">.</span><span class="n">dtype</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">dtype</span> <span class="c1"># Copy the model dimensions</span> <span class="bp">self</span><span class="o">.</span><span class="n">nobs</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">nobs</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_endog</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">k_endog</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_states</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">k_states</span> <span class="bp">self</span><span class="o">.</span><span class="n">k_posdef</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">k_posdef</span> <span class="bp">self</span><span class="o">.</span><span class="n">time_invariant</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">time_invariant</span> <span class="c1"># Save the state space representation at the time</span> <span class="bp">self</span><span class="o">.</span><span class="n">endog</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">endog</span> <span class="bp">self</span><span class="o">.</span><span class="n">design</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">_design</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> <span class="bp">self</span><span class="o">.</span><span class="n">obs_intercept</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">_obs_intercept</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> <span class="bp">self</span><span class="o">.</span><span class="n">obs_cov</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">_obs_cov</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> <span class="bp">self</span><span class="o">.</span><span class="n">transition</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">_transition</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> <span class="bp">self</span><span class="o">.</span><span class="n">state_intercept</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">_state_intercept</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> <span class="bp">self</span><span class="o">.</span><span class="n">selection</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">_selection</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> <span class="bp">self</span><span class="o">.</span><span class="n">state_cov</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">_state_cov</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> <span class="bp">self</span><span class="o">.</span><span class="n">missing</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">prefix</span><span class="p">]</span><span class="o">.</span><span class="n">missing</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="bp">self</span><span class="o">.</span><span class="n">nmissing</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">prefix</span><span class="p">]</span><span class="o">.</span><span class="n">nmissing</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="c1"># Save the final shapes of the matrices</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">shapes</span><span class="p">)</span> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span> <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s1">'obs'</span><span class="p">:</span> <span class="k">continue</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span><span class="o">.</span><span class="n">shape</span> <span class="bp">self</span><span class="o">.</span><span class="n">shapes</span><span class="p">[</span><span class="s1">'obs'</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">endog</span><span class="o">.</span><span class="n">shape</span> <span class="c1"># Save the state space initialization</span> <span class="bp">self</span><span class="o">.</span><span class="n">initialization</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">initialization</span> <span class="k">if</span> <span class="n">model</span><span class="o">.</span><span class="n">initialization</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> <span class="n">model</span><span class="o">.</span><span class="n">_initialize_state</span><span class="p">()</span> <span class="bp">self</span><span class="o">.</span><span class="n">initial_state</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span> <span class="n">model</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">prefix</span><span class="p">]</span><span class="o">.</span><span class="n">initial_state</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="bp">self</span><span class="o">.</span><span class="n">initial_state_cov</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span> <span class="n">model</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">prefix</span><span class="p">]</span><span class="o">.</span><span class="n">initial_state_cov</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="bp">self</span><span class="o">.</span><span class="n">initial_diffuse_state_cov</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span> <span class="n">model</span><span class="o">.</span><span class="n">_statespaces</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">prefix</span><span class="p">]</span><span class="o">.</span><span class="n">initial_diffuse_state_cov</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span></div></div> </pre></div> </article> </div> </div> </main> </div> <footer class="md-footer"> <div class="md-footer-nav"> <nav class="md-footer-nav__inner md-grid"> </a> </nav> </div> <div class="md-footer-meta md-typeset"> <div class="md-footer-meta__inner md-grid"> <div class="md-footer-copyright"> <div class="md-footer-copyright__highlight"> &#169; Copyright 2009-2019, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers. </div> Last updated on Oct 06, 2021. <br/> Created using <a href="http://www.sphinx-doc.org/">Sphinx</a> 4.0.3. and <a href="https://github.com/bashtage/sphinx-material/">Material for Sphinx</a> </div> </div> </div> </footer> <script src="../../../../_static/javascripts/application.js"></script> <script>app.initialize({version: "1.0.4", url: {base: ".."}})</script> </body> </html>
statsmodels/statsmodels.github.io
v0.13.0/_modules/statsmodels/tsa/statespace/representation.html
HTML
bsd-3-clause
160,191
# thingy.js a super aewesome buzzword framework
aewens/thingy.js
README.md
Markdown
bsd-3-clause
48
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_18) on Thu Jan 06 21:19:32 CET 2011 --> <TITLE> Uses of Package util </TITLE> <META NAME="date" CONTENT="2011-01-06"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Package util"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../index.html?util/package-use.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="package-use.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>Uses of Package<br>util</B></H2> </CENTER> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Packages that use <A HREF="../util/package-summary.html">util</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#util"><B>util</B></A></TD> <TD>contains some helper classes used by this framework&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <A NAME="util"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Classes in <A HREF="../util/package-summary.html">util</A> used by <A HREF="../util/package-summary.html">util</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../util/class-use/PackedArray.html#util"><B>PackedArray</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This is the implementation of a simple packing algorithm, to reduce the size of an integer array with a fixed number of positive elements and where the highest value is known.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../util/class-use/SortedQueue.html#util"><B>SortedQueue</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;An unbounded sorted queue able to update its elements.</TD> </TR> </TABLE> &nbsp; <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../index.html?util/package-use.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="package-use.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>
Eden-06/Search
doc/util/package-use.html
HTML
bsd-3-clause
6,694
module Scheme.DataType ( module Scheme.DataType.Misc, EvalError, ScmError, TryError, Expr(..), ScmCode(..), ScmFile, Var(..), Return(..), ReturnE, Name, AFunc, WAFunc, RFunc, Proc, Synt, Scm, runScm, ScmEnv, ScmStates, ScmRef, MetaInfo(..), Config(..), setConfig, setMSP, MetaData(..), setTryHeap, setStackTrace, GEnv, LEnv, MLEnv, StackTrace(..), Trace, TraceR, initStackTrace, setTraceHeap, setTraceRHeap, setTraceLength, Try(..), initTry, setDepthLimit, setLoopCount, setBinary, setCapturedDisplays, DepthLimit(..), ) where import Config import Scheme.DataType.Error (ScmError) import Scheme.DataType.Error.Eval (EvalError) import Scheme.DataType.Error.Try (TryError) import Scheme.DataType.Misc import DeepControl.Applicative import DeepControl.Monad import DeepControl.MonadTrans import DeepControl.Monad.RWS import DeepControl.Monad.Except import MonadX.Monad.Reference import qualified Data.Map as M import Data.List (intersperse) type Name = String ---------------------------------------------------------------------------------------------------------------- -- Scm ---------------------------------------------------------------------------------------------------------------- type Scm a = (ExceptT ScmError (ReferenceT Var (RWST ScmEnv () ScmStates IO))) a runScm :: Scm a -> ScmRef -- Reference -> ScmEnv -- Reader -> ScmStates -- State -> IO ((Either ScmError a, ScmRef), ScmStates, ()) runScm scm ref env states = scm >- runExceptT >- (unReferenceT >-> (|>ref)) >- (runRWST >-> (|>env) >-> (|>states)) type ScmStates = (GEnv, MetaData) -- State type ScmEnv = (MLEnv, MetaInfo) -- Reader type ScmRef = RefEnv Var -- Reference -- -- Env -- type GEnv = M.Map Name Expr -- Global Environment type LEnv = Ref Var{-Vm-} -- Local Environment type MLEnv = Maybe LEnv -- -- Variable for RefEnv -- data Var = Ve Expr | Vm (M.Map Name Expr{-REF-}) -- for LEnv deriving (Eq) instance Show Var where show (Ve e) = show e show (Vm map) = show map -------------------------------------------------- -- Eval -------------------------------------------------- -- TODO Functor data Return a = RETURN a | VOID deriving (Show, Eq) type ReturnE = Return Expr -------------------------------------------------- -- Expr -------------------------------------------------- -- Scheme Expression data Expr = NIL | INT !Integer | REAL !Double | SYM !String MSP | STR !String | CELL !Expr !Expr MSP -- | AFUNC Name AFunc -- actual function: +, -, *, /, etc. | WAFUNC Name WAFunc -- weekly actual function: length, append, etc. | RFUNC Name RFunc -- referencial function: car, cdr, cons, set!, set-car!, set-cdr!, etc. | PROC Name Proc -- procedure: display, newline, etc. | SYNT Name Synt -- syntax: quote, if, define, etc. | CLOS Expr MLEnv -- closure: λ | CLOSM Expr MLEnv -- macro-closure -- for set!, set-car!, set-cdr!, car and cdr; reference manipulation | REF (Ref Var{-Ve-}) -- for lazy evaluation | THUNK (Expr, ScmEnv) instance Show Expr where show NIL = "()" show (INT x) = show x show (REAL x) = show x show (SYM x _) = x show (STR x) = show x show (CELL (SYM "quote" _) (CELL expr NIL _) _) = "'" ++ show expr show (CELL (SYM "quasiquote" _) (CELL expr NIL _) _) = "`" ++ show expr show (CELL (SYM "unquote" _) (CELL expr NIL _) _) = "," ++ show expr show (CELL (SYM "unquote-splicing" _) (CELL expr NIL _) _) = ",@" ++ show expr show c@(CELL a d _) = "(" ++ showCELL c ++ ")" where showCELL NIL = "" showCELL (CELL a d _) = show a ++ case d of NIL -> "" c@(CELL _ _ _) -> " " ++ showCELL c e -> " . " ++ show e show (AFUNC x _) = "<" ++ x ++ ">" show (WAFUNC x _) = "<" ++ x ++ ">" show (RFUNC x _) = "<" ++ x ++ ">" show (SYNT x _) = "<" ++ x ++ ">" show (PROC x _) = "<" ++ x ++ ">" show (CLOS (CELL args seq _) mlenv) = "(\\"++ show args ++" -> "++ showExprSeq seq ++")" where showExprSeq :: Expr -> String showExprSeq NIL = "" showExprSeq (CELL s NIL _) = show s showExprSeq (CELL s1 s2 _) = show s1 ++" >> "++ showExprSeq s2 showExprSeq e = show e show (CLOSM (CELL args seq _) mlenv) = "(#"++ show args ++" -> "++ showExprSeq seq ++")" where showExprSeq :: Expr -> String showExprSeq NIL = "" showExprSeq (CELL s NIL _) = show s showExprSeq (CELL s1 s2 _) = show s1 ++" >> "++ showExprSeq s2 showExprSeq e = show e show (THUNK (e, _)) = "[" ++ show e ++ "]" show (REF ref) = "_" type AFunc = Expr -> Scm Expr -- actual function type WAFunc = Expr -> Scm Expr -- weekly actual function type RFunc = Expr -> Scm Expr -- referencial function type Proc = Expr -> Scm ReturnE -- procedure type Synt = Expr -> Scm ReturnE -- syntax instance Eq Expr where NIL == NIL = True INT x == INT y = x == y REAL x == REAL y = x == y SYM x _ == SYM y _ = x == y STR x == STR y = x == y CELL l r _ == CELL l' r' _ = (l,r) == (l',r') CLOS x a == CLOS y b = (x,a) == (y,b) CLOSM x a == CLOSM y b = (x,a) == (y,b) AFUNC x a == AFUNC y b = x == y WAFUNC x a == WAFUNC y b = x == y RFUNC x a == RFUNC y b = x == y SYNT x a == SYNT y b = x == y PROC x a == PROC y b = x == y REF x == REF y = x == y THUNK x == THUNK y = x == y _ == _ = False -------------------------------------------------- -- SCode, SFile, SFiles -------------------------------------------------- data ScmCode = EXPR Expr | COMMENT String | LINEBREAK | EOF instance Show ScmCode where show (EXPR x) = show x show (COMMENT s) = s show LINEBREAK = "" type ScmFile = [ScmCode] ---------------------------------------------------------------------------------------------------------------- -- RWS ---------------------------------------------------------------------------------------------------------------- -- -- MetaInfo -- data MetaInfo = MetaInfo { config :: Config , msp :: MSP } deriving (Show, Eq) setConfig :: Config -> MetaInfo -> MetaInfo setConfig x (MetaInfo _ b) = MetaInfo x b setMSP :: MSP -> MetaInfo -> MetaInfo setMSP x (MetaInfo a _) = MetaInfo a x -- -- MetaData -- data MetaData = MetaData { tryHeap :: [Try] , stackTrace :: StackTrace } deriving (Show) setTryHeap :: [Try] -> MetaData -> MetaData setTryHeap x (MetaData _ b) = MetaData x b setStackTrace :: StackTrace -> MetaData -> MetaData setStackTrace x (MetaData a _) = MetaData a x data StackTrace = StackTrace { traceHeap :: [Trace] , traceRHeap :: [TraceR] -- trace rusult , traceLength :: Int } deriving (Show) type Trace = (String, MSP, Maybe String) type TraceR = Trace initStackTrace :: StackTrace initStackTrace = StackTrace [] [] 10 setTraceHeap :: [Trace] -> StackTrace -> StackTrace setTraceHeap x (StackTrace _ b c) = StackTrace x b c setTraceRHeap :: [TraceR] -> StackTrace -> StackTrace setTraceRHeap x (StackTrace a _ c) = StackTrace a x c setTraceLength :: Int -> StackTrace -> StackTrace setTraceLength x (StackTrace a b _) = StackTrace a b x -- TODO: ChaitinTry data Try = Try { depthLimit :: DepthLimit , loopCount :: Int , binary :: Expr , capturedDisplays :: [Expr] } deriving (Show) data DepthLimit = NOTIMELIMIT | DEPTHLIMIT Int deriving (Show, Eq) instance Ord DepthLimit where compare NOTIMELIMIT NOTIMELIMIT = EQ compare NOTIMELIMIT (DEPTHLIMIT _) = GT compare (DEPTHLIMIT _) NOTIMELIMIT = LT compare (DEPTHLIMIT n) (DEPTHLIMIT n') = compare n n' initTry :: Try initTry = Try NOTIMELIMIT 0 NIL [] setDepthLimit :: DepthLimit -> Try -> Try setDepthLimit dl (Try _ lc bn cd) = Try dl lc bn cd setLoopCount :: Int -> Try -> Try setLoopCount lc (Try dl _ bn cd) = Try dl lc bn cd setBinary :: Expr -> Try -> Try setBinary bn (Try dl lc _ cd) = Try dl lc bn cd setCapturedDisplays :: [Expr] -> Try -> Try setCapturedDisplays cd (Try dl lc bn _) = Try dl lc bn cd ---------------------------------------------------------------------------------------------------------------- -- Misc ----------------------------------------------------------------------------------------------------------------
ocean0yohsuke/Scheme
src/Scheme/DataType.hs
Haskell
bsd-3-clause
9,162
from unittest import TestCase from django.core.management import call_command class SendAiPicsStatsTestCase(TestCase): def test_run_command(self): call_command('send_ai_pics_stats')
KlubJagiellonski/pola-backend
pola/tests/commands/test_send_ai_pics_stats.py
Python
bsd-3-clause
197
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE194_Unexpected_Sign_Extension__fgets_malloc_03.c Label Definition File: CWE194_Unexpected_Sign_Extension.label.xml Template File: sources-sink-03.tmpl.c */ /* * @description * CWE: 194 Unexpected Sign Extension * BadSource: fgets Read data from the console using fgets() * GoodSource: Positive integer * Sink: malloc * BadSink : Allocate memory using malloc() with the size of data * Flow Variant: 03 Control flow: if(5==5) and if(5!=5) * * */ #include "std_testcase.h" /* Must be at least 8 for atoi() to work properly */ #define CHAR_ARRAY_SIZE 8 #ifndef OMITBAD void CWE194_Unexpected_Sign_Extension__fgets_malloc_03_bad() { short data; /* Initialize data */ data = 0; if(5==5) { { char inputBuffer[CHAR_ARRAY_SIZE] = ""; /* FLAW: Use a value input from the console using fgets() */ if (fgets(inputBuffer, CHAR_ARRAY_SIZE, stdin) != NULL) { /* Convert to short */ data = (short)atoi(inputBuffer); } else { printLine("fgets() failed."); } } } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); if (dataBuffer == NULL) {exit(-1);} /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B1() - use goodsource and badsink by changing the 5==5 to 5!=5 */ static void goodG2B1() { short data; /* Initialize data */ data = 0; if(5!=5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Use a positive integer less than &InitialDataSize&*/ data = 100-1; } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); if (dataBuffer == NULL) {exit(-1);} /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */ static void goodG2B2() { short data; /* Initialize data */ data = 0; if(5==5) { /* FIX: Use a positive integer less than &InitialDataSize&*/ data = 100-1; } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); if (dataBuffer == NULL) {exit(-1);} /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } } void CWE194_Unexpected_Sign_Extension__fgets_malloc_03_good() { goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE194_Unexpected_Sign_Extension__fgets_malloc_03_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE194_Unexpected_Sign_Extension__fgets_malloc_03_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
JianpingZeng/xcc
xcc/test/juliet/testcases/CWE194_Unexpected_Sign_Extension/s01/CWE194_Unexpected_Sign_Extension__fgets_malloc_03.c
C
bsd-3-clause
4,693
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "ash/system/settings/tray_settings.h" #include "ash/shell.h" #include "ash/system/power/power_status_view.h" #include "ash/system/tray/system_tray_delegate.h" #include "ash/system/tray/tray_constants.h" #include "ash/system/tray/tray_views.h" #include "base/logging.h" #include "base/utf_string_conversions.h" #include "grit/ash_resources.h" #include "grit/ash_strings.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/image/image.h" #include "ui/views/controls/image_view.h" #include "ui/views/controls/label.h" #include "ui/views/layout/box_layout.h" #include "ui/views/layout/fill_layout.h" #include "ui/views/view.h" namespace ash { namespace internal { namespace tray { class SettingsDefaultView : public ash::internal::ActionableView { public: explicit SettingsDefaultView(user::LoginStatus status) : login_status_(status), label_(NULL), power_status_view_(NULL) { SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, ash::kTrayPopupPaddingHorizontal, 0, ash::kTrayPopupPaddingBetweenItems)); bool power_view_right_align = false; if (login_status_ != user::LOGGED_IN_NONE && login_status_ != user::LOGGED_IN_LOCKED) { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); views::ImageView* icon = new ash::internal::FixedSizedImageView(0, ash::kTrayPopupItemHeight); icon->SetImage( rb.GetImageNamed(IDR_AURA_UBER_TRAY_SETTINGS).ToImageSkia()); AddChildView(icon); string16 text = rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_SETTINGS); label_ = new views::Label(text); AddChildView(label_); SetAccessibleName(text); power_view_right_align = true; } PowerSupplyStatus power_status = ash::Shell::GetInstance()->tray_delegate()->GetPowerSupplyStatus(); if (power_status.battery_is_present) { power_status_view_ = new ash::internal::PowerStatusView( ash::internal::PowerStatusView::VIEW_DEFAULT, power_view_right_align); AddChildView(power_status_view_); UpdatePowerStatus(power_status); } } virtual ~SettingsDefaultView() {} void UpdatePowerStatus(const PowerSupplyStatus& status) { if (power_status_view_) power_status_view_->UpdatePowerStatus(status); } // Overridden from ash::internal::ActionableView. virtual bool PerformAction(const ui::Event& event) OVERRIDE { if (login_status_ == user::LOGGED_IN_NONE || login_status_ == user::LOGGED_IN_LOCKED) return false; ash::Shell::GetInstance()->tray_delegate()->ShowSettings(); return true; } // Overridden from views::View. virtual void Layout() OVERRIDE { views::View::Layout(); if (label_ && power_status_view_) { // Let the box-layout do the layout first. Then move power_status_view_ // to right align if it is created. gfx::Size size = power_status_view_->GetPreferredSize(); gfx::Rect bounds(size); bounds.set_x(width() - size.width() - ash::kTrayPopupPaddingBetweenItems); bounds.set_y((height() - size.height()) / 2); power_status_view_->SetBoundsRect(bounds); } } // Overridden from views::View. virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE { views::View::ChildPreferredSizeChanged(child); Layout(); } private: user::LoginStatus login_status_; views::Label* label_; ash::internal::PowerStatusView* power_status_view_; DISALLOW_COPY_AND_ASSIGN(SettingsDefaultView); }; } // namespace tray TraySettings::TraySettings(SystemTray* system_tray) : SystemTrayItem(system_tray), default_view_(NULL) { } TraySettings::~TraySettings() {} views::View* TraySettings::CreateTrayView(user::LoginStatus status) { return NULL; } views::View* TraySettings::CreateDefaultView(user::LoginStatus status) { if ((status == user::LOGGED_IN_NONE || status == user::LOGGED_IN_LOCKED) && (!ash::Shell::GetInstance()->tray_delegate()-> GetPowerSupplyStatus().battery_is_present)) return NULL; CHECK(default_view_ == NULL); default_view_ = new tray::SettingsDefaultView(status); return default_view_; } views::View* TraySettings::CreateDetailedView(user::LoginStatus status) { NOTIMPLEMENTED(); return NULL; } void TraySettings::DestroyTrayView() { } void TraySettings::DestroyDefaultView() { default_view_ = NULL; } void TraySettings::DestroyDetailedView() { } void TraySettings::UpdateAfterLoginStatusChange(user::LoginStatus status) { } // Overridden from PowerStatusObserver. void TraySettings::OnPowerStatusChanged(const PowerSupplyStatus& status) { if (default_view_) default_view_->UpdatePowerStatus(status); } } // namespace internal } // namespace ash
leighpauls/k2cro4
ash/system/settings/tray_settings.cc
C++
bsd-3-clause
5,055
var Turtle = function () { this.d = 0; this.x = 0; this.y = 0; this.rounding = false; this.invert = false; } Turtle.prototype.setX = function (val) { this.x = val; return this; } Turtle.prototype.setY = function (val) { this.y = val; return this; } Turtle.prototype.setDegree = function (deg) { this.d = deg; return this; } Turtle.prototype.setInvert = function (bool) { this.invert = bool; return this; } Turtle.prototype.setRounding = function (bool) { this.rounding = bool; return this; } Turtle.prototype.rt = function (degrees) { if (this.invert) { this.d += degrees; } else { this.d -= degrees; this.d += 360; // to ensure that the number is positive } this.d %= 360; return this; } Turtle.prototype.lt = function (degrees) { if (this.invert) { this.d -= degrees; this.d += 360; // to ensure that the number is positive } else { this.d += degrees; } this.d %= 360; return this; } Turtle.prototype.adj = function (degrees, hyp) { var adj = Math.cos(degrees * Math.PI / 180) * hyp; if (this.rounding) { return Math.round(adj); } else { return adj; } } Turtle.prototype.opp = function (degrees, hyp) { var opp = Math.sin(degrees * Math.PI / 180) * hyp; if (this.rounding) { return Math.round(opp); } else { return opp; } } Turtle.prototype.fd = function (magnitude) { if (this.d < 90) { // x == adjacent this.x += this.adj(this.d, magnitude); // y == opposite this.y += this.opp(this.d, magnitude); } else if (this.d < 180) { // x == -opposite this.x -= this.opp(this.d - 90, magnitude); // y == adjacent this.y += this.adj(this.d - 90, magnitude); } else if (this.d < 270) { // x == -adjacent this.x -= this.adj(this.d - 180, magnitude); // y == -opposite this.y -= this.opp(this.d - 180, magnitude); } else if (this.d < 360) { // x == opposite this.x += this.opp(this.d - 270, magnitude); // y == -adjacent this.y -= this.adj(this.d - 270, magnitude); } return this; } Turtle.prototype.bk = function (magnitude) { if (this.d < 90) { // x -= adjacent this.x -= this.adj(this.d, magnitude); // y -= opposite this.y -= this.opp(this.d, magnitude); } else if (this.d < 180) { // x == +opposite this.x += this.opp(this.d - 90, magnitude); // y == -adjacent this.y -= this.adj(this.d - 90, magnitude); } else if (this.d < 270) { // x == opposite this.x += this.adj(this.d - 180, magnitude); // y == adjacent this.y += this.opp(this.d - 180, magnitude); } else if (this.d < 360) { // x == -opposite this.x -= this.opp(this.d - 270, magnitude); // y == adjacent this.y += this.adj(this.d - 270, magnitude); } return this; }
gief/turtlejs
src/turtle.js
JavaScript
bsd-3-clause
3,007
# Copyright (c) 2012 ARM Limited # All rights reserved. # # The license below extends only to copyright in the software and shall # not be construed as granting a license to any other intellectual # property including but not limited to intellectual property relating # to a hardware implementation of the functionality of the software # licensed hereunder. You may use the software subject to the license # terms below provided that you ensure that this notice is replicated # unmodified and in its entirety in all distributions of the software, # modified or unmodified, in source code or in binary form. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer; # redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution; # neither the name of the copyright holders nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # Authors: Andreas Sandberg from m5.objects import * from arm_generic import * import switcheroo root = LinuxArmFSSwitcheroo( mem_class=DDR3_1600_x64, cpu_classes=(AtomicSimpleCPU, AtomicSimpleCPU) ).create_root() # Setup a custom test method that uses the switcheroo tester that # switches between CPU models. run_test = switcheroo.run_test
prodromou87/gem5
tests/configs/realview-switcheroo-atomic.py
Python
bsd-3-clause
2,428
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Code Coverage for /var/www/html/Album/vendor/zendframework/zendframework/library/Zend/Loader/StandardAutoloader.php</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/bootstrap-responsive.min.css" rel="stylesheet"> <link href="css/style.css" rel="stylesheet"> <!--[if lt IE 9]> <script src="js/html5shiv.js"></script> <![endif]--> </head> <body> <header> <div class="container"> <div class="row"> <div class="span12"> <ul class="breadcrumb"> <li><a href="index.html">/var/www/html/Album</a> <span class="divider">/</span></li> <li><a href="vendor.html">vendor</a> <span class="divider">/</span></li> <li><a href="vendor_zendframework.html">zendframework</a> <span class="divider">/</span></li> <li><a href="vendor_zendframework_zendframework.html">zendframework</a> <span class="divider">/</span></li> <li><a href="vendor_zendframework_zendframework_library.html">library</a> <span class="divider">/</span></li> <li><a href="vendor_zendframework_zendframework_library_Zend.html">Zend</a> <span class="divider">/</span></li> <li><a href="vendor_zendframework_zendframework_library_Zend_Loader.html">Loader</a> <span class="divider">/</span></li> <li class="active">StandardAutoloader.php</li> </ul> </div> </div> </div> </header> <div class="container"> <table class="table table-bordered"> <thead> <tr> <td>&nbsp;</td> <td colspan="10"><div align="center"><strong>Code Coverage</strong></div></td> </tr> <tr> <td>&nbsp;</td> <td colspan="3"><div align="center"><strong>Classes and Traits</strong></div></td> <td colspan="4"><div align="center"><strong>Functions and Methods</strong></div></td> <td colspan="3"><div align="center"><strong>Lines</strong></div></td> </tr> </thead> <tbody> <tr> <td class="danger">Total</td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 0.00%;"></div> </div> </td> <td class="danger small"><div align="right">0.00%</div></td> <td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 15.38%;"></div> </div> </td> <td class="danger small"><div align="right">15.38%</div></td> <td class="danger small"><div align="right">2&nbsp;/&nbsp;13</div></td> <td class="danger small"><abbr title="Change Risk Anti-Patterns (CRAP) Index">CRAP</abbr></td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 20.59%;"></div> </div> </td> <td class="danger small"><div align="right">20.59%</div></td> <td class="danger small"><div align="right">21&nbsp;/&nbsp;102</div></td> </tr> <tr> <td class="danger">StandardAutoloader</td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 0.00%;"></div> </div> </td> <td class="danger small"><div align="right">0.00%</div></td> <td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 15.38%;"></div> </div> </td> <td class="danger small"><div align="right">15.38%</div></td> <td class="danger small"><div align="right">2&nbsp;/&nbsp;13</div></td> <td class="danger small">1201.82</td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 20.59%;"></div> </div> </td> <td class="danger small"><div align="right">20.59%</div></td> <td class="danger small"><div align="right">21&nbsp;/&nbsp;102</div></td> </tr> <tr> <td class="danger" colspan="4">&nbsp;<a href="#51">__construct($options = null)</a></td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 0.00%;"></div> </div> </td> <td class="danger small"><div align="right">0.00%</div></td> <td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td> <td class="danger small">6</td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 0.00%;"></div> </div> </td> <td class="danger small"><div align="right">0.00%</div></td> <td class="danger small"><div align="right">0&nbsp;/&nbsp;4</div></td> </tr> <tr> <td class="danger" colspan="4">&nbsp;<a href="#80">setOptions($options)</a></td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 0.00%;"></div> </div> </td> <td class="danger small"><div align="right">0.00%</div></td> <td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td> <td class="danger small">182</td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 0.00%;"></div> </div> </td> <td class="danger small"><div align="right">0.00%</div></td> <td class="danger small"><div align="right">0&nbsp;/&nbsp;26</div></td> </tr> <tr> <td class="danger" colspan="4">&nbsp;<a href="#120">setFallbackAutoloader($flag)</a></td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 0.00%;"></div> </div> </td> <td class="danger small"><div align="right">0.00%</div></td> <td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td> <td class="danger small">2</td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 0.00%;"></div> </div> </td> <td class="danger small"><div align="right">0.00%</div></td> <td class="danger small"><div align="right">0&nbsp;/&nbsp;2</div></td> </tr> <tr> <td class="success" colspan="4">&nbsp;<a href="#131">isFallbackAutoloader()</a></td> <td class="success big"> <div class="progress progress-success" style="width: 100px;"> <div class="bar" style="width: 100.00%;"></div> </div> </td> <td class="success small"><div align="right">100.00%</div></td> <td class="success small"><div align="right">1&nbsp;/&nbsp;1</div></td> <td class="success small">1</td> <td class="success big"> <div class="progress progress-success" style="width: 100px;"> <div class="bar" style="width: 100.00%;"></div> </div> </td> <td class="success small"><div align="right">100.00%</div></td> <td class="success small"><div align="right">1&nbsp;/&nbsp;1</div></td> </tr> <tr> <td class="danger" colspan="4">&nbsp;<a href="#143">registerNamespace($namespace, $directory)</a></td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 0.00%;"></div> </div> </td> <td class="danger small"><div align="right">0.00%</div></td> <td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td> <td class="danger small">2</td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 0.00%;"></div> </div> </td> <td class="danger small"><div align="right">0.00%</div></td> <td class="danger small"><div align="right">0&nbsp;/&nbsp;3</div></td> </tr> <tr> <td class="danger" colspan="4">&nbsp;<a href="#157">registerNamespaces($namespaces)</a></td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 0.00%;"></div> </div> </td> <td class="danger small"><div align="right">0.00%</div></td> <td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td> <td class="danger small">20</td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 0.00%;"></div> </div> </td> <td class="danger small"><div align="right">0.00%</div></td> <td class="danger small"><div align="right">0&nbsp;/&nbsp;7</div></td> </tr> <tr> <td class="danger" colspan="4">&nbsp;<a href="#177">registerPrefix($prefix, $directory)</a></td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 0.00%;"></div> </div> </td> <td class="danger small"><div align="right">0.00%</div></td> <td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td> <td class="danger small">2</td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 0.00%;"></div> </div> </td> <td class="danger small"><div align="right">0.00%</div></td> <td class="danger small"><div align="right">0&nbsp;/&nbsp;3</div></td> </tr> <tr> <td class="danger" colspan="4">&nbsp;<a href="#191">registerPrefixes($prefixes)</a></td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 0.00%;"></div> </div> </td> <td class="danger small"><div align="right">0.00%</div></td> <td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td> <td class="danger small">20</td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 0.00%;"></div> </div> </td> <td class="danger small"><div align="right">0.00%</div></td> <td class="danger small"><div align="right">0&nbsp;/&nbsp;7</div></td> </tr> <tr> <td class="danger" colspan="4">&nbsp;<a href="#210">autoload($class)</a></td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 0.00%;"></div> </div> </td> <td class="danger small"><div align="right">0.00%</div></td> <td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td> <td class="danger small">35.00</td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 25.00%;"></div> </div> </td> <td class="danger small"><div align="right">25.00%</div></td> <td class="danger small"><div align="right">4&nbsp;/&nbsp;16</div></td> </tr> <tr> <td class="danger" colspan="4">&nbsp;<a href="#240">register()</a></td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 0.00%;"></div> </div> </td> <td class="danger small"><div align="right">0.00%</div></td> <td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td> <td class="danger small">2</td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 0.00%;"></div> </div> </td> <td class="danger small"><div align="right">0.00%</div></td> <td class="danger small"><div align="right">0&nbsp;/&nbsp;2</div></td> </tr> <tr> <td class="success" colspan="4">&nbsp;<a href="#252">transformClassNameToFilename($class, $directory)</a></td> <td class="success big"> <div class="progress progress-success" style="width: 100px;"> <div class="bar" style="width: 100.00%;"></div> </div> </td> <td class="success small"><div align="right">100.00%</div></td> <td class="success small"><div align="right">1&nbsp;/&nbsp;1</div></td> <td class="success small">3</td> <td class="success big"> <div class="progress progress-success" style="width: 100px;"> <div class="bar" style="width: 100.00%;"></div> </div> </td> <td class="success small"><div align="right">100.00%</div></td> <td class="success small"><div align="right">7&nbsp;/&nbsp;7</div></td> </tr> <tr> <td class="danger" colspan="4">&nbsp;<a href="#276">loadClass($class, $type)</a></td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 0.00%;"></div> </div> </td> <td class="danger small"><div align="right">0.00%</div></td> <td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td> <td class="danger small">13.12</td> <td class="warning big"> <div class="progress progress-warning" style="width: 100px;"> <div class="bar" style="width: 50.00%;"></div> </div> </td> <td class="warning small"><div align="right">50.00%</div></td> <td class="warning small"><div align="right">9&nbsp;/&nbsp;18</div></td> </tr> <tr> <td class="danger" colspan="4">&nbsp;<a href="#317">normalizeDirectory($directory)</a></td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 0.00%;"></div> </div> </td> <td class="danger small"><div align="right">0.00%</div></td> <td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td> <td class="danger small">6</td> <td class="danger big"> <div class="progress progress-danger" style="width: 100px;"> <div class="bar" style="width: 0.00%;"></div> </div> </td> <td class="danger small"><div align="right">0.00%</div></td> <td class="danger small"><div align="right">0&nbsp;/&nbsp;6</div></td> </tr> </tbody> </table> <table class="table table-borderless table-condensed"> <tbody> <tr><td><div align="right"><a name="1"></a><a href="#1">1</a></div></td><td class="codeLine">&lt;?php</td></tr> <tr><td><div align="right"><a name="2"></a><a href="#2">2</a></div></td><td class="codeLine">/**</td></tr> <tr><td><div align="right"><a name="3"></a><a href="#3">3</a></div></td><td class="codeLine"> * Zend Framework (http://framework.zend.com/)</td></tr> <tr><td><div align="right"><a name="4"></a><a href="#4">4</a></div></td><td class="codeLine"> *</td></tr> <tr><td><div align="right"><a name="5"></a><a href="#5">5</a></div></td><td class="codeLine"> * @link http://github.com/zendframework/zf2 for the canonical source repository</td></tr> <tr><td><div align="right"><a name="6"></a><a href="#6">6</a></div></td><td class="codeLine"> * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)</td></tr> <tr><td><div align="right"><a name="7"></a><a href="#7">7</a></div></td><td class="codeLine"> * @license http://framework.zend.com/license/new-bsd New BSD License</td></tr> <tr><td><div align="right"><a name="8"></a><a href="#8">8</a></div></td><td class="codeLine"> */</td></tr> <tr><td><div align="right"><a name="9"></a><a href="#9">9</a></div></td><td class="codeLine"></td></tr> <tr><td><div align="right"><a name="10"></a><a href="#10">10</a></div></td><td class="codeLine">namespace Zend\Loader;</td></tr> <tr><td><div align="right"><a name="11"></a><a href="#11">11</a></div></td><td class="codeLine"></td></tr> <tr><td><div align="right"><a name="12"></a><a href="#12">12</a></div></td><td class="codeLine">// Grab SplAutoloader interface</td></tr> <tr><td><div align="right"><a name="13"></a><a href="#13">13</a></div></td><td class="codeLine">require_once __DIR__ . '/SplAutoloader.php';</td></tr> <tr><td><div align="right"><a name="14"></a><a href="#14">14</a></div></td><td class="codeLine"></td></tr> <tr><td><div align="right"><a name="15"></a><a href="#15">15</a></div></td><td class="codeLine">/**</td></tr> <tr><td><div align="right"><a name="16"></a><a href="#16">16</a></div></td><td class="codeLine"> * PSR-0 compliant autoloader</td></tr> <tr><td><div align="right"><a name="17"></a><a href="#17">17</a></div></td><td class="codeLine"> *</td></tr> <tr><td><div align="right"><a name="18"></a><a href="#18">18</a></div></td><td class="codeLine"> * Allows autoloading both namespaced and vendor-prefixed classes. Class</td></tr> <tr><td><div align="right"><a name="19"></a><a href="#19">19</a></div></td><td class="codeLine"> * lookups are performed on the filesystem. If a class file for the referenced</td></tr> <tr><td><div align="right"><a name="20"></a><a href="#20">20</a></div></td><td class="codeLine"> * class is not found, a PHP warning will be raised by include().</td></tr> <tr><td><div align="right"><a name="21"></a><a href="#21">21</a></div></td><td class="codeLine"> */</td></tr> <tr><td><div align="right"><a name="22"></a><a href="#22">22</a></div></td><td class="codeLine">class StandardAutoloader implements SplAutoloader</td></tr> <tr><td><div align="right"><a name="23"></a><a href="#23">23</a></div></td><td class="codeLine">{</td></tr> <tr><td><div align="right"><a name="24"></a><a href="#24">24</a></div></td><td class="codeLine"> const NS_SEPARATOR = '\\';</td></tr> <tr><td><div align="right"><a name="25"></a><a href="#25">25</a></div></td><td class="codeLine"> const PREFIX_SEPARATOR = '_';</td></tr> <tr><td><div align="right"><a name="26"></a><a href="#26">26</a></div></td><td class="codeLine"> const LOAD_NS = 'namespaces';</td></tr> <tr><td><div align="right"><a name="27"></a><a href="#27">27</a></div></td><td class="codeLine"> const LOAD_PREFIX = 'prefixes';</td></tr> <tr><td><div align="right"><a name="28"></a><a href="#28">28</a></div></td><td class="codeLine"> const ACT_AS_FALLBACK = 'fallback_autoloader';</td></tr> <tr><td><div align="right"><a name="29"></a><a href="#29">29</a></div></td><td class="codeLine"> const AUTOREGISTER_ZF = 'autoregister_zf';</td></tr> <tr><td><div align="right"><a name="30"></a><a href="#30">30</a></div></td><td class="codeLine"></td></tr> <tr><td><div align="right"><a name="31"></a><a href="#31">31</a></div></td><td class="codeLine"> /**</td></tr> <tr><td><div align="right"><a name="32"></a><a href="#32">32</a></div></td><td class="codeLine"> * @var array Namespace/directory pairs to search; ZF library added by default</td></tr> <tr><td><div align="right"><a name="33"></a><a href="#33">33</a></div></td><td class="codeLine"> */</td></tr> <tr><td><div align="right"><a name="34"></a><a href="#34">34</a></div></td><td class="codeLine"> protected $namespaces = array();</td></tr> <tr><td><div align="right"><a name="35"></a><a href="#35">35</a></div></td><td class="codeLine"></td></tr> <tr><td><div align="right"><a name="36"></a><a href="#36">36</a></div></td><td class="codeLine"> /**</td></tr> <tr><td><div align="right"><a name="37"></a><a href="#37">37</a></div></td><td class="codeLine"> * @var array Prefix/directory pairs to search</td></tr> <tr><td><div align="right"><a name="38"></a><a href="#38">38</a></div></td><td class="codeLine"> */</td></tr> <tr><td><div align="right"><a name="39"></a><a href="#39">39</a></div></td><td class="codeLine"> protected $prefixes = array();</td></tr> <tr><td><div align="right"><a name="40"></a><a href="#40">40</a></div></td><td class="codeLine"></td></tr> <tr><td><div align="right"><a name="41"></a><a href="#41">41</a></div></td><td class="codeLine"> /**</td></tr> <tr><td><div align="right"><a name="42"></a><a href="#42">42</a></div></td><td class="codeLine"> * @var bool Whether or not the autoloader should also act as a fallback autoloader</td></tr> <tr><td><div align="right"><a name="43"></a><a href="#43">43</a></div></td><td class="codeLine"> */</td></tr> <tr><td><div align="right"><a name="44"></a><a href="#44">44</a></div></td><td class="codeLine"> protected $fallbackAutoloaderFlag = false;</td></tr> <tr><td><div align="right"><a name="45"></a><a href="#45">45</a></div></td><td class="codeLine"></td></tr> <tr><td><div align="right"><a name="46"></a><a href="#46">46</a></div></td><td class="codeLine"> /**</td></tr> <tr><td><div align="right"><a name="47"></a><a href="#47">47</a></div></td><td class="codeLine"> * Constructor</td></tr> <tr><td><div align="right"><a name="48"></a><a href="#48">48</a></div></td><td class="codeLine"> *</td></tr> <tr><td><div align="right"><a name="49"></a><a href="#49">49</a></div></td><td class="codeLine"> * @param null|array|\Traversable $options</td></tr> <tr><td><div align="right"><a name="50"></a><a href="#50">50</a></div></td><td class="codeLine"> */</td></tr> <tr><td><div align="right"><a name="51"></a><a href="#51">51</a></div></td><td class="codeLine"> public function __construct($options = null)</td></tr> <tr><td><div align="right"><a name="52"></a><a href="#52">52</a></div></td><td class="codeLine"> {</td></tr> <tr class="danger"><td><div align="right"><a name="53"></a><a href="#53">53</a></div></td><td class="codeLine"> if (null !== $options) {</td></tr> <tr class="danger"><td><div align="right"><a name="54"></a><a href="#54">54</a></div></td><td class="codeLine"> $this-&gt;setOptions($options);</td></tr> <tr class="danger"><td><div align="right"><a name="55"></a><a href="#55">55</a></div></td><td class="codeLine"> }</td></tr> <tr class="danger"><td><div align="right"><a name="56"></a><a href="#56">56</a></div></td><td class="codeLine"> }</td></tr> <tr><td><div align="right"><a name="57"></a><a href="#57">57</a></div></td><td class="codeLine"></td></tr> <tr><td><div align="right"><a name="58"></a><a href="#58">58</a></div></td><td class="codeLine"> /**</td></tr> <tr><td><div align="right"><a name="59"></a><a href="#59">59</a></div></td><td class="codeLine"> * Configure autoloader</td></tr> <tr><td><div align="right"><a name="60"></a><a href="#60">60</a></div></td><td class="codeLine"> *</td></tr> <tr><td><div align="right"><a name="61"></a><a href="#61">61</a></div></td><td class="codeLine"> * Allows specifying both &quot;namespace&quot; and &quot;prefix&quot; pairs, using the</td></tr> <tr><td><div align="right"><a name="62"></a><a href="#62">62</a></div></td><td class="codeLine"> * following structure:</td></tr> <tr><td><div align="right"><a name="63"></a><a href="#63">63</a></div></td><td class="codeLine"> * &lt;code&gt;</td></tr> <tr><td><div align="right"><a name="64"></a><a href="#64">64</a></div></td><td class="codeLine"> * array(</td></tr> <tr><td><div align="right"><a name="65"></a><a href="#65">65</a></div></td><td class="codeLine"> * 'namespaces' =&gt; array(</td></tr> <tr><td><div align="right"><a name="66"></a><a href="#66">66</a></div></td><td class="codeLine"> * 'Zend' =&gt; '/path/to/Zend/library',</td></tr> <tr><td><div align="right"><a name="67"></a><a href="#67">67</a></div></td><td class="codeLine"> * 'Doctrine' =&gt; '/path/to/Doctrine/library',</td></tr> <tr><td><div align="right"><a name="68"></a><a href="#68">68</a></div></td><td class="codeLine"> * ),</td></tr> <tr><td><div align="right"><a name="69"></a><a href="#69">69</a></div></td><td class="codeLine"> * 'prefixes' =&gt; array(</td></tr> <tr><td><div align="right"><a name="70"></a><a href="#70">70</a></div></td><td class="codeLine"> * 'Phly_' =&gt; '/path/to/Phly/library',</td></tr> <tr><td><div align="right"><a name="71"></a><a href="#71">71</a></div></td><td class="codeLine"> * ),</td></tr> <tr><td><div align="right"><a name="72"></a><a href="#72">72</a></div></td><td class="codeLine"> * 'fallback_autoloader' =&gt; true,</td></tr> <tr><td><div align="right"><a name="73"></a><a href="#73">73</a></div></td><td class="codeLine"> * )</td></tr> <tr><td><div align="right"><a name="74"></a><a href="#74">74</a></div></td><td class="codeLine"> * &lt;/code&gt;</td></tr> <tr><td><div align="right"><a name="75"></a><a href="#75">75</a></div></td><td class="codeLine"> *</td></tr> <tr><td><div align="right"><a name="76"></a><a href="#76">76</a></div></td><td class="codeLine"> * @param array|\Traversable $options</td></tr> <tr><td><div align="right"><a name="77"></a><a href="#77">77</a></div></td><td class="codeLine"> * @throws Exception\InvalidArgumentException</td></tr> <tr><td><div align="right"><a name="78"></a><a href="#78">78</a></div></td><td class="codeLine"> * @return StandardAutoloader</td></tr> <tr><td><div align="right"><a name="79"></a><a href="#79">79</a></div></td><td class="codeLine"> */</td></tr> <tr><td><div align="right"><a name="80"></a><a href="#80">80</a></div></td><td class="codeLine"> public function setOptions($options)</td></tr> <tr><td><div align="right"><a name="81"></a><a href="#81">81</a></div></td><td class="codeLine"> {</td></tr> <tr class="danger"><td><div align="right"><a name="82"></a><a href="#82">82</a></div></td><td class="codeLine"> if (!is_array($options) &amp;&amp; !($options instanceof \Traversable)) {</td></tr> <tr class="danger"><td><div align="right"><a name="83"></a><a href="#83">83</a></div></td><td class="codeLine"> require_once __DIR__ . '/Exception/InvalidArgumentException.php';</td></tr> <tr class="danger"><td><div align="right"><a name="84"></a><a href="#84">84</a></div></td><td class="codeLine"> throw new Exception\InvalidArgumentException('Options must be either an array or Traversable');</td></tr> <tr><td><div align="right"><a name="85"></a><a href="#85">85</a></div></td><td class="codeLine"> }</td></tr> <tr><td><div align="right"><a name="86"></a><a href="#86">86</a></div></td><td class="codeLine"></td></tr> <tr class="danger"><td><div align="right"><a name="87"></a><a href="#87">87</a></div></td><td class="codeLine"> foreach ($options as $type =&gt; $pairs) {</td></tr> <tr><td><div align="right"><a name="88"></a><a href="#88">88</a></div></td><td class="codeLine"> switch ($type) {</td></tr> <tr class="danger"><td><div align="right"><a name="89"></a><a href="#89">89</a></div></td><td class="codeLine"> case self::AUTOREGISTER_ZF:</td></tr> <tr class="danger"><td><div align="right"><a name="90"></a><a href="#90">90</a></div></td><td class="codeLine"> if ($pairs) {</td></tr> <tr class="danger"><td><div align="right"><a name="91"></a><a href="#91">91</a></div></td><td class="codeLine"> $this-&gt;registerNamespace('Zend', dirname(__DIR__));</td></tr> <tr class="danger"><td><div align="right"><a name="92"></a><a href="#92">92</a></div></td><td class="codeLine"> }</td></tr> <tr class="danger"><td><div align="right"><a name="93"></a><a href="#93">93</a></div></td><td class="codeLine"> break;</td></tr> <tr class="danger"><td><div align="right"><a name="94"></a><a href="#94">94</a></div></td><td class="codeLine"> case self::LOAD_NS:</td></tr> <tr class="danger"><td><div align="right"><a name="95"></a><a href="#95">95</a></div></td><td class="codeLine"> if (is_array($pairs) || $pairs instanceof \Traversable) {</td></tr> <tr class="danger"><td><div align="right"><a name="96"></a><a href="#96">96</a></div></td><td class="codeLine"> $this-&gt;registerNamespaces($pairs);</td></tr> <tr class="danger"><td><div align="right"><a name="97"></a><a href="#97">97</a></div></td><td class="codeLine"> }</td></tr> <tr class="danger"><td><div align="right"><a name="98"></a><a href="#98">98</a></div></td><td class="codeLine"> break;</td></tr> <tr class="danger"><td><div align="right"><a name="99"></a><a href="#99">99</a></div></td><td class="codeLine"> case self::LOAD_PREFIX:</td></tr> <tr class="danger"><td><div align="right"><a name="100"></a><a href="#100">100</a></div></td><td class="codeLine"> if (is_array($pairs) || $pairs instanceof \Traversable) {</td></tr> <tr class="danger"><td><div align="right"><a name="101"></a><a href="#101">101</a></div></td><td class="codeLine"> $this-&gt;registerPrefixes($pairs);</td></tr> <tr class="danger"><td><div align="right"><a name="102"></a><a href="#102">102</a></div></td><td class="codeLine"> }</td></tr> <tr class="danger"><td><div align="right"><a name="103"></a><a href="#103">103</a></div></td><td class="codeLine"> break;</td></tr> <tr class="danger"><td><div align="right"><a name="104"></a><a href="#104">104</a></div></td><td class="codeLine"> case self::ACT_AS_FALLBACK:</td></tr> <tr class="danger"><td><div align="right"><a name="105"></a><a href="#105">105</a></div></td><td class="codeLine"> $this-&gt;setFallbackAutoloader($pairs);</td></tr> <tr class="danger"><td><div align="right"><a name="106"></a><a href="#106">106</a></div></td><td class="codeLine"> break;</td></tr> <tr class="danger"><td><div align="right"><a name="107"></a><a href="#107">107</a></div></td><td class="codeLine"> default:</td></tr> <tr><td><div align="right"><a name="108"></a><a href="#108">108</a></div></td><td class="codeLine"> // ignore</td></tr> <tr class="danger"><td><div align="right"><a name="109"></a><a href="#109">109</a></div></td><td class="codeLine"> }</td></tr> <tr class="danger"><td><div align="right"><a name="110"></a><a href="#110">110</a></div></td><td class="codeLine"> }</td></tr> <tr class="danger"><td><div align="right"><a name="111"></a><a href="#111">111</a></div></td><td class="codeLine"> return $this;</td></tr> <tr><td><div align="right"><a name="112"></a><a href="#112">112</a></div></td><td class="codeLine"> }</td></tr> <tr><td><div align="right"><a name="113"></a><a href="#113">113</a></div></td><td class="codeLine"></td></tr> <tr><td><div align="right"><a name="114"></a><a href="#114">114</a></div></td><td class="codeLine"> /**</td></tr> <tr><td><div align="right"><a name="115"></a><a href="#115">115</a></div></td><td class="codeLine"> * Set flag indicating fallback autoloader status</td></tr> <tr><td><div align="right"><a name="116"></a><a href="#116">116</a></div></td><td class="codeLine"> *</td></tr> <tr><td><div align="right"><a name="117"></a><a href="#117">117</a></div></td><td class="codeLine"> * @param bool $flag</td></tr> <tr><td><div align="right"><a name="118"></a><a href="#118">118</a></div></td><td class="codeLine"> * @return StandardAutoloader</td></tr> <tr><td><div align="right"><a name="119"></a><a href="#119">119</a></div></td><td class="codeLine"> */</td></tr> <tr><td><div align="right"><a name="120"></a><a href="#120">120</a></div></td><td class="codeLine"> public function setFallbackAutoloader($flag)</td></tr> <tr><td><div align="right"><a name="121"></a><a href="#121">121</a></div></td><td class="codeLine"> {</td></tr> <tr class="danger"><td><div align="right"><a name="122"></a><a href="#122">122</a></div></td><td class="codeLine"> $this-&gt;fallbackAutoloaderFlag = (bool) $flag;</td></tr> <tr class="danger"><td><div align="right"><a name="123"></a><a href="#123">123</a></div></td><td class="codeLine"> return $this;</td></tr> <tr><td><div align="right"><a name="124"></a><a href="#124">124</a></div></td><td class="codeLine"> }</td></tr> <tr><td><div align="right"><a name="125"></a><a href="#125">125</a></div></td><td class="codeLine"></td></tr> <tr><td><div align="right"><a name="126"></a><a href="#126">126</a></div></td><td class="codeLine"> /**</td></tr> <tr><td><div align="right"><a name="127"></a><a href="#127">127</a></div></td><td class="codeLine"> * Is this autoloader acting as a fallback autoloader?</td></tr> <tr><td><div align="right"><a name="128"></a><a href="#128">128</a></div></td><td class="codeLine"> *</td></tr> <tr><td><div align="right"><a name="129"></a><a href="#129">129</a></div></td><td class="codeLine"> * @return bool</td></tr> <tr><td><div align="right"><a name="130"></a><a href="#130">130</a></div></td><td class="codeLine"> */</td></tr> <tr><td><div align="right"><a name="131"></a><a href="#131">131</a></div></td><td class="codeLine"> public function isFallbackAutoloader()</td></tr> <tr><td><div align="right"><a name="132"></a><a href="#132">132</a></div></td><td class="codeLine"> {</td></tr> <tr class="success popin" data-title="2 tests cover line 133" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable&lt;/li&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="133"></a><a href="#133">133</a></div></td><td class="codeLine"> return $this-&gt;fallbackAutoloaderFlag;</td></tr> <tr><td><div align="right"><a name="134"></a><a href="#134">134</a></div></td><td class="codeLine"> }</td></tr> <tr><td><div align="right"><a name="135"></a><a href="#135">135</a></div></td><td class="codeLine"></td></tr> <tr><td><div align="right"><a name="136"></a><a href="#136">136</a></div></td><td class="codeLine"> /**</td></tr> <tr><td><div align="right"><a name="137"></a><a href="#137">137</a></div></td><td class="codeLine"> * Register a namespace/directory pair</td></tr> <tr><td><div align="right"><a name="138"></a><a href="#138">138</a></div></td><td class="codeLine"> *</td></tr> <tr><td><div align="right"><a name="139"></a><a href="#139">139</a></div></td><td class="codeLine"> * @param string $namespace</td></tr> <tr><td><div align="right"><a name="140"></a><a href="#140">140</a></div></td><td class="codeLine"> * @param string $directory</td></tr> <tr><td><div align="right"><a name="141"></a><a href="#141">141</a></div></td><td class="codeLine"> * @return StandardAutoloader</td></tr> <tr><td><div align="right"><a name="142"></a><a href="#142">142</a></div></td><td class="codeLine"> */</td></tr> <tr><td><div align="right"><a name="143"></a><a href="#143">143</a></div></td><td class="codeLine"> public function registerNamespace($namespace, $directory)</td></tr> <tr><td><div align="right"><a name="144"></a><a href="#144">144</a></div></td><td class="codeLine"> {</td></tr> <tr class="danger"><td><div align="right"><a name="145"></a><a href="#145">145</a></div></td><td class="codeLine"> $namespace = rtrim($namespace, self::NS_SEPARATOR) . self::NS_SEPARATOR;</td></tr> <tr class="danger"><td><div align="right"><a name="146"></a><a href="#146">146</a></div></td><td class="codeLine"> $this-&gt;namespaces[$namespace] = $this-&gt;normalizeDirectory($directory);</td></tr> <tr class="danger"><td><div align="right"><a name="147"></a><a href="#147">147</a></div></td><td class="codeLine"> return $this;</td></tr> <tr><td><div align="right"><a name="148"></a><a href="#148">148</a></div></td><td class="codeLine"> }</td></tr> <tr><td><div align="right"><a name="149"></a><a href="#149">149</a></div></td><td class="codeLine"></td></tr> <tr><td><div align="right"><a name="150"></a><a href="#150">150</a></div></td><td class="codeLine"> /**</td></tr> <tr><td><div align="right"><a name="151"></a><a href="#151">151</a></div></td><td class="codeLine"> * Register many namespace/directory pairs at once</td></tr> <tr><td><div align="right"><a name="152"></a><a href="#152">152</a></div></td><td class="codeLine"> *</td></tr> <tr><td><div align="right"><a name="153"></a><a href="#153">153</a></div></td><td class="codeLine"> * @param array $namespaces</td></tr> <tr><td><div align="right"><a name="154"></a><a href="#154">154</a></div></td><td class="codeLine"> * @throws Exception\InvalidArgumentException</td></tr> <tr><td><div align="right"><a name="155"></a><a href="#155">155</a></div></td><td class="codeLine"> * @return StandardAutoloader</td></tr> <tr><td><div align="right"><a name="156"></a><a href="#156">156</a></div></td><td class="codeLine"> */</td></tr> <tr><td><div align="right"><a name="157"></a><a href="#157">157</a></div></td><td class="codeLine"> public function registerNamespaces($namespaces)</td></tr> <tr><td><div align="right"><a name="158"></a><a href="#158">158</a></div></td><td class="codeLine"> {</td></tr> <tr class="danger"><td><div align="right"><a name="159"></a><a href="#159">159</a></div></td><td class="codeLine"> if (!is_array($namespaces) &amp;&amp; !$namespaces instanceof \Traversable) {</td></tr> <tr class="danger"><td><div align="right"><a name="160"></a><a href="#160">160</a></div></td><td class="codeLine"> require_once __DIR__ . '/Exception/InvalidArgumentException.php';</td></tr> <tr class="danger"><td><div align="right"><a name="161"></a><a href="#161">161</a></div></td><td class="codeLine"> throw new Exception\InvalidArgumentException('Namespace pairs must be either an array or Traversable');</td></tr> <tr><td><div align="right"><a name="162"></a><a href="#162">162</a></div></td><td class="codeLine"> }</td></tr> <tr><td><div align="right"><a name="163"></a><a href="#163">163</a></div></td><td class="codeLine"></td></tr> <tr class="danger"><td><div align="right"><a name="164"></a><a href="#164">164</a></div></td><td class="codeLine"> foreach ($namespaces as $namespace =&gt; $directory) {</td></tr> <tr class="danger"><td><div align="right"><a name="165"></a><a href="#165">165</a></div></td><td class="codeLine"> $this-&gt;registerNamespace($namespace, $directory);</td></tr> <tr class="danger"><td><div align="right"><a name="166"></a><a href="#166">166</a></div></td><td class="codeLine"> }</td></tr> <tr class="danger"><td><div align="right"><a name="167"></a><a href="#167">167</a></div></td><td class="codeLine"> return $this;</td></tr> <tr><td><div align="right"><a name="168"></a><a href="#168">168</a></div></td><td class="codeLine"> }</td></tr> <tr><td><div align="right"><a name="169"></a><a href="#169">169</a></div></td><td class="codeLine"></td></tr> <tr><td><div align="right"><a name="170"></a><a href="#170">170</a></div></td><td class="codeLine"> /**</td></tr> <tr><td><div align="right"><a name="171"></a><a href="#171">171</a></div></td><td class="codeLine"> * Register a prefix/directory pair</td></tr> <tr><td><div align="right"><a name="172"></a><a href="#172">172</a></div></td><td class="codeLine"> *</td></tr> <tr><td><div align="right"><a name="173"></a><a href="#173">173</a></div></td><td class="codeLine"> * @param string $prefix</td></tr> <tr><td><div align="right"><a name="174"></a><a href="#174">174</a></div></td><td class="codeLine"> * @param string $directory</td></tr> <tr><td><div align="right"><a name="175"></a><a href="#175">175</a></div></td><td class="codeLine"> * @return StandardAutoloader</td></tr> <tr><td><div align="right"><a name="176"></a><a href="#176">176</a></div></td><td class="codeLine"> */</td></tr> <tr><td><div align="right"><a name="177"></a><a href="#177">177</a></div></td><td class="codeLine"> public function registerPrefix($prefix, $directory)</td></tr> <tr><td><div align="right"><a name="178"></a><a href="#178">178</a></div></td><td class="codeLine"> {</td></tr> <tr class="danger"><td><div align="right"><a name="179"></a><a href="#179">179</a></div></td><td class="codeLine"> $prefix = rtrim($prefix, self::PREFIX_SEPARATOR). self::PREFIX_SEPARATOR;</td></tr> <tr class="danger"><td><div align="right"><a name="180"></a><a href="#180">180</a></div></td><td class="codeLine"> $this-&gt;prefixes[$prefix] = $this-&gt;normalizeDirectory($directory);</td></tr> <tr class="danger"><td><div align="right"><a name="181"></a><a href="#181">181</a></div></td><td class="codeLine"> return $this;</td></tr> <tr><td><div align="right"><a name="182"></a><a href="#182">182</a></div></td><td class="codeLine"> }</td></tr> <tr><td><div align="right"><a name="183"></a><a href="#183">183</a></div></td><td class="codeLine"></td></tr> <tr><td><div align="right"><a name="184"></a><a href="#184">184</a></div></td><td class="codeLine"> /**</td></tr> <tr><td><div align="right"><a name="185"></a><a href="#185">185</a></div></td><td class="codeLine"> * Register many namespace/directory pairs at once</td></tr> <tr><td><div align="right"><a name="186"></a><a href="#186">186</a></div></td><td class="codeLine"> *</td></tr> <tr><td><div align="right"><a name="187"></a><a href="#187">187</a></div></td><td class="codeLine"> * @param array $prefixes</td></tr> <tr><td><div align="right"><a name="188"></a><a href="#188">188</a></div></td><td class="codeLine"> * @throws Exception\InvalidArgumentException</td></tr> <tr><td><div align="right"><a name="189"></a><a href="#189">189</a></div></td><td class="codeLine"> * @return StandardAutoloader</td></tr> <tr><td><div align="right"><a name="190"></a><a href="#190">190</a></div></td><td class="codeLine"> */</td></tr> <tr><td><div align="right"><a name="191"></a><a href="#191">191</a></div></td><td class="codeLine"> public function registerPrefixes($prefixes)</td></tr> <tr><td><div align="right"><a name="192"></a><a href="#192">192</a></div></td><td class="codeLine"> {</td></tr> <tr class="danger"><td><div align="right"><a name="193"></a><a href="#193">193</a></div></td><td class="codeLine"> if (!is_array($prefixes) &amp;&amp; !$prefixes instanceof \Traversable) {</td></tr> <tr class="danger"><td><div align="right"><a name="194"></a><a href="#194">194</a></div></td><td class="codeLine"> require_once __DIR__ . '/Exception/InvalidArgumentException.php';</td></tr> <tr class="danger"><td><div align="right"><a name="195"></a><a href="#195">195</a></div></td><td class="codeLine"> throw new Exception\InvalidArgumentException('Prefix pairs must be either an array or Traversable');</td></tr> <tr><td><div align="right"><a name="196"></a><a href="#196">196</a></div></td><td class="codeLine"> }</td></tr> <tr><td><div align="right"><a name="197"></a><a href="#197">197</a></div></td><td class="codeLine"></td></tr> <tr class="danger"><td><div align="right"><a name="198"></a><a href="#198">198</a></div></td><td class="codeLine"> foreach ($prefixes as $prefix =&gt; $directory) {</td></tr> <tr class="danger"><td><div align="right"><a name="199"></a><a href="#199">199</a></div></td><td class="codeLine"> $this-&gt;registerPrefix($prefix, $directory);</td></tr> <tr class="danger"><td><div align="right"><a name="200"></a><a href="#200">200</a></div></td><td class="codeLine"> }</td></tr> <tr class="danger"><td><div align="right"><a name="201"></a><a href="#201">201</a></div></td><td class="codeLine"> return $this;</td></tr> <tr><td><div align="right"><a name="202"></a><a href="#202">202</a></div></td><td class="codeLine"> }</td></tr> <tr><td><div align="right"><a name="203"></a><a href="#203">203</a></div></td><td class="codeLine"></td></tr> <tr><td><div align="right"><a name="204"></a><a href="#204">204</a></div></td><td class="codeLine"> /**</td></tr> <tr><td><div align="right"><a name="205"></a><a href="#205">205</a></div></td><td class="codeLine"> * Defined by Autoloadable; autoload a class</td></tr> <tr><td><div align="right"><a name="206"></a><a href="#206">206</a></div></td><td class="codeLine"> *</td></tr> <tr><td><div align="right"><a name="207"></a><a href="#207">207</a></div></td><td class="codeLine"> * @param string $class</td></tr> <tr><td><div align="right"><a name="208"></a><a href="#208">208</a></div></td><td class="codeLine"> * @return false|string</td></tr> <tr><td><div align="right"><a name="209"></a><a href="#209">209</a></div></td><td class="codeLine"> */</td></tr> <tr><td><div align="right"><a name="210"></a><a href="#210">210</a></div></td><td class="codeLine"> public function autoload($class)</td></tr> <tr><td><div align="right"><a name="211"></a><a href="#211">211</a></div></td><td class="codeLine"> {</td></tr> <tr class="success popin" data-title="2 tests cover line 212" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable&lt;/li&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="212"></a><a href="#212">212</a></div></td><td class="codeLine"> $isFallback = $this-&gt;isFallbackAutoloader();</td></tr> <tr class="success popin" data-title="2 tests cover line 213" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable&lt;/li&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="213"></a><a href="#213">213</a></div></td><td class="codeLine"> if (false !== strpos($class, self::NS_SEPARATOR)) {</td></tr> <tr class="success popin" data-title="2 tests cover line 214" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable&lt;/li&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="214"></a><a href="#214">214</a></div></td><td class="codeLine"> if ($this-&gt;loadClass($class, self::LOAD_NS)) {</td></tr> <tr class="success popin" data-title="2 tests cover line 215" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable&lt;/li&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="215"></a><a href="#215">215</a></div></td><td class="codeLine"> return $class;</td></tr> <tr class="danger"><td><div align="right"><a name="216"></a><a href="#216">216</a></div></td><td class="codeLine"> } elseif ($isFallback) {</td></tr> <tr class="danger"><td><div align="right"><a name="217"></a><a href="#217">217</a></div></td><td class="codeLine"> return $this-&gt;loadClass($class, self::ACT_AS_FALLBACK);</td></tr> <tr><td><div align="right"><a name="218"></a><a href="#218">218</a></div></td><td class="codeLine"> }</td></tr> <tr class="danger"><td><div align="right"><a name="219"></a><a href="#219">219</a></div></td><td class="codeLine"> return false;</td></tr> <tr><td><div align="right"><a name="220"></a><a href="#220">220</a></div></td><td class="codeLine"> }</td></tr> <tr class="danger"><td><div align="right"><a name="221"></a><a href="#221">221</a></div></td><td class="codeLine"> if (false !== strpos($class, self::PREFIX_SEPARATOR)) {</td></tr> <tr class="danger"><td><div align="right"><a name="222"></a><a href="#222">222</a></div></td><td class="codeLine"> if ($this-&gt;loadClass($class, self::LOAD_PREFIX)) {</td></tr> <tr class="danger"><td><div align="right"><a name="223"></a><a href="#223">223</a></div></td><td class="codeLine"> return $class;</td></tr> <tr class="danger"><td><div align="right"><a name="224"></a><a href="#224">224</a></div></td><td class="codeLine"> } elseif ($isFallback) {</td></tr> <tr class="danger"><td><div align="right"><a name="225"></a><a href="#225">225</a></div></td><td class="codeLine"> return $this-&gt;loadClass($class, self::ACT_AS_FALLBACK);</td></tr> <tr><td><div align="right"><a name="226"></a><a href="#226">226</a></div></td><td class="codeLine"> }</td></tr> <tr class="danger"><td><div align="right"><a name="227"></a><a href="#227">227</a></div></td><td class="codeLine"> return false;</td></tr> <tr><td><div align="right"><a name="228"></a><a href="#228">228</a></div></td><td class="codeLine"> }</td></tr> <tr class="danger"><td><div align="right"><a name="229"></a><a href="#229">229</a></div></td><td class="codeLine"> if ($isFallback) {</td></tr> <tr class="danger"><td><div align="right"><a name="230"></a><a href="#230">230</a></div></td><td class="codeLine"> return $this-&gt;loadClass($class, self::ACT_AS_FALLBACK);</td></tr> <tr><td><div align="right"><a name="231"></a><a href="#231">231</a></div></td><td class="codeLine"> }</td></tr> <tr class="danger"><td><div align="right"><a name="232"></a><a href="#232">232</a></div></td><td class="codeLine"> return false;</td></tr> <tr><td><div align="right"><a name="233"></a><a href="#233">233</a></div></td><td class="codeLine"> }</td></tr> <tr><td><div align="right"><a name="234"></a><a href="#234">234</a></div></td><td class="codeLine"></td></tr> <tr><td><div align="right"><a name="235"></a><a href="#235">235</a></div></td><td class="codeLine"> /**</td></tr> <tr><td><div align="right"><a name="236"></a><a href="#236">236</a></div></td><td class="codeLine"> * Register the autoloader with spl_autoload</td></tr> <tr><td><div align="right"><a name="237"></a><a href="#237">237</a></div></td><td class="codeLine"> *</td></tr> <tr><td><div align="right"><a name="238"></a><a href="#238">238</a></div></td><td class="codeLine"> * @return void</td></tr> <tr><td><div align="right"><a name="239"></a><a href="#239">239</a></div></td><td class="codeLine"> */</td></tr> <tr><td><div align="right"><a name="240"></a><a href="#240">240</a></div></td><td class="codeLine"> public function register()</td></tr> <tr><td><div align="right"><a name="241"></a><a href="#241">241</a></div></td><td class="codeLine"> {</td></tr> <tr class="danger"><td><div align="right"><a name="242"></a><a href="#242">242</a></div></td><td class="codeLine"> spl_autoload_register(array($this, 'autoload'));</td></tr> <tr class="danger"><td><div align="right"><a name="243"></a><a href="#243">243</a></div></td><td class="codeLine"> }</td></tr> <tr><td><div align="right"><a name="244"></a><a href="#244">244</a></div></td><td class="codeLine"></td></tr> <tr><td><div align="right"><a name="245"></a><a href="#245">245</a></div></td><td class="codeLine"> /**</td></tr> <tr><td><div align="right"><a name="246"></a><a href="#246">246</a></div></td><td class="codeLine"> * Transform the class name to a filename</td></tr> <tr><td><div align="right"><a name="247"></a><a href="#247">247</a></div></td><td class="codeLine"> *</td></tr> <tr><td><div align="right"><a name="248"></a><a href="#248">248</a></div></td><td class="codeLine"> * @param string $class</td></tr> <tr><td><div align="right"><a name="249"></a><a href="#249">249</a></div></td><td class="codeLine"> * @param string $directory</td></tr> <tr><td><div align="right"><a name="250"></a><a href="#250">250</a></div></td><td class="codeLine"> * @return string</td></tr> <tr><td><div align="right"><a name="251"></a><a href="#251">251</a></div></td><td class="codeLine"> */</td></tr> <tr><td><div align="right"><a name="252"></a><a href="#252">252</a></div></td><td class="codeLine"> protected function transformClassNameToFilename($class, $directory)</td></tr> <tr><td><div align="right"><a name="253"></a><a href="#253">253</a></div></td><td class="codeLine"> {</td></tr> <tr><td><div align="right"><a name="254"></a><a href="#254">254</a></div></td><td class="codeLine"> // $class may contain a namespace portion, in which case we need</td></tr> <tr><td><div align="right"><a name="255"></a><a href="#255">255</a></div></td><td class="codeLine"> // to preserve any underscores in that portion.</td></tr> <tr class="success popin" data-title="2 tests cover line 256" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable&lt;/li&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="256"></a><a href="#256">256</a></div></td><td class="codeLine"> $matches = array();</td></tr> <tr class="success popin" data-title="2 tests cover line 257" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable&lt;/li&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="257"></a><a href="#257">257</a></div></td><td class="codeLine"> preg_match('/(?P&lt;namespace&gt;.+\\\)?(?P&lt;class&gt;[^\\\]+$)/', $class, $matches);</td></tr> <tr><td><div align="right"><a name="258"></a><a href="#258">258</a></div></td><td class="codeLine"></td></tr> <tr class="success popin" data-title="2 tests cover line 259" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable&lt;/li&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="259"></a><a href="#259">259</a></div></td><td class="codeLine"> $class = (isset($matches['class'])) ? $matches['class'] : '';</td></tr> <tr class="success popin" data-title="2 tests cover line 260" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable&lt;/li&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="260"></a><a href="#260">260</a></div></td><td class="codeLine"> $namespace = (isset($matches['namespace'])) ? $matches['namespace'] : '';</td></tr> <tr><td><div align="right"><a name="261"></a><a href="#261">261</a></div></td><td class="codeLine"></td></tr> <tr><td><div align="right"><a name="262"></a><a href="#262">262</a></div></td><td class="codeLine"> return $directory</td></tr> <tr class="success popin" data-title="2 tests cover line 263" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable&lt;/li&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="263"></a><a href="#263">263</a></div></td><td class="codeLine"> . str_replace(self::NS_SEPARATOR, '/', $namespace)</td></tr> <tr class="success popin" data-title="2 tests cover line 264" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable&lt;/li&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="264"></a><a href="#264">264</a></div></td><td class="codeLine"> . str_replace(self::PREFIX_SEPARATOR, '/', $class)</td></tr> <tr class="success popin" data-title="2 tests cover line 265" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable&lt;/li&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="265"></a><a href="#265">265</a></div></td><td class="codeLine"> . '.php';</td></tr> <tr><td><div align="right"><a name="266"></a><a href="#266">266</a></div></td><td class="codeLine"> }</td></tr> <tr><td><div align="right"><a name="267"></a><a href="#267">267</a></div></td><td class="codeLine"></td></tr> <tr><td><div align="right"><a name="268"></a><a href="#268">268</a></div></td><td class="codeLine"> /**</td></tr> <tr><td><div align="right"><a name="269"></a><a href="#269">269</a></div></td><td class="codeLine"> * Load a class, based on its type (namespaced or prefixed)</td></tr> <tr><td><div align="right"><a name="270"></a><a href="#270">270</a></div></td><td class="codeLine"> *</td></tr> <tr><td><div align="right"><a name="271"></a><a href="#271">271</a></div></td><td class="codeLine"> * @param string $class</td></tr> <tr><td><div align="right"><a name="272"></a><a href="#272">272</a></div></td><td class="codeLine"> * @param string $type</td></tr> <tr><td><div align="right"><a name="273"></a><a href="#273">273</a></div></td><td class="codeLine"> * @return bool|string</td></tr> <tr><td><div align="right"><a name="274"></a><a href="#274">274</a></div></td><td class="codeLine"> * @throws Exception\InvalidArgumentException</td></tr> <tr><td><div align="right"><a name="275"></a><a href="#275">275</a></div></td><td class="codeLine"> */</td></tr> <tr><td><div align="right"><a name="276"></a><a href="#276">276</a></div></td><td class="codeLine"> protected function loadClass($class, $type)</td></tr> <tr><td><div align="right"><a name="277"></a><a href="#277">277</a></div></td><td class="codeLine"> {</td></tr> <tr class="success popin" data-title="2 tests cover line 278" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable&lt;/li&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="278"></a><a href="#278">278</a></div></td><td class="codeLine"> if (!in_array($type, array(self::LOAD_NS, self::LOAD_PREFIX, self::ACT_AS_FALLBACK))) {</td></tr> <tr class="danger"><td><div align="right"><a name="279"></a><a href="#279">279</a></div></td><td class="codeLine"> require_once __DIR__ . '/Exception/InvalidArgumentException.php';</td></tr> <tr class="danger"><td><div align="right"><a name="280"></a><a href="#280">280</a></div></td><td class="codeLine"> throw new Exception\InvalidArgumentException();</td></tr> <tr><td><div align="right"><a name="281"></a><a href="#281">281</a></div></td><td class="codeLine"> }</td></tr> <tr><td><div align="right"><a name="282"></a><a href="#282">282</a></div></td><td class="codeLine"></td></tr> <tr><td><div align="right"><a name="283"></a><a href="#283">283</a></div></td><td class="codeLine"> // Fallback autoloading</td></tr> <tr class="success popin" data-title="2 tests cover line 284" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable&lt;/li&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="284"></a><a href="#284">284</a></div></td><td class="codeLine"> if ($type === self::ACT_AS_FALLBACK) {</td></tr> <tr><td><div align="right"><a name="285"></a><a href="#285">285</a></div></td><td class="codeLine"> // create filename</td></tr> <tr class="danger"><td><div align="right"><a name="286"></a><a href="#286">286</a></div></td><td class="codeLine"> $filename = $this-&gt;transformClassNameToFilename($class, '');</td></tr> <tr class="danger"><td><div align="right"><a name="287"></a><a href="#287">287</a></div></td><td class="codeLine"> $resolvedName = stream_resolve_include_path($filename);</td></tr> <tr class="danger"><td><div align="right"><a name="288"></a><a href="#288">288</a></div></td><td class="codeLine"> if ($resolvedName !== false) {</td></tr> <tr class="danger"><td><div align="right"><a name="289"></a><a href="#289">289</a></div></td><td class="codeLine"> return include $resolvedName;</td></tr> <tr><td><div align="right"><a name="290"></a><a href="#290">290</a></div></td><td class="codeLine"> }</td></tr> <tr class="danger"><td><div align="right"><a name="291"></a><a href="#291">291</a></div></td><td class="codeLine"> return false;</td></tr> <tr><td><div align="right"><a name="292"></a><a href="#292">292</a></div></td><td class="codeLine"> }</td></tr> <tr><td><div align="right"><a name="293"></a><a href="#293">293</a></div></td><td class="codeLine"></td></tr> <tr><td><div align="right"><a name="294"></a><a href="#294">294</a></div></td><td class="codeLine"> // Namespace and/or prefix autoloading</td></tr> <tr class="success popin" data-title="2 tests cover line 295" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable&lt;/li&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="295"></a><a href="#295">295</a></div></td><td class="codeLine"> foreach ($this-&gt;$type as $leader =&gt; $path) {</td></tr> <tr class="success popin" data-title="2 tests cover line 296" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable&lt;/li&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="296"></a><a href="#296">296</a></div></td><td class="codeLine"> if (0 === strpos($class, $leader)) {</td></tr> <tr><td><div align="right"><a name="297"></a><a href="#297">297</a></div></td><td class="codeLine"> // Trim off leader (namespace or prefix)</td></tr> <tr class="success popin" data-title="2 tests cover line 298" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable&lt;/li&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="298"></a><a href="#298">298</a></div></td><td class="codeLine"> $trimmedClass = substr($class, strlen($leader));</td></tr> <tr><td><div align="right"><a name="299"></a><a href="#299">299</a></div></td><td class="codeLine"></td></tr> <tr><td><div align="right"><a name="300"></a><a href="#300">300</a></div></td><td class="codeLine"> // create filename</td></tr> <tr class="success popin" data-title="2 tests cover line 301" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable&lt;/li&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="301"></a><a href="#301">301</a></div></td><td class="codeLine"> $filename = $this-&gt;transformClassNameToFilename($trimmedClass, $path);</td></tr> <tr class="success popin" data-title="2 tests cover line 302" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable&lt;/li&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="302"></a><a href="#302">302</a></div></td><td class="codeLine"> if (file_exists($filename)) {</td></tr> <tr class="success popin" data-title="2 tests cover line 303" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable&lt;/li&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="303"></a><a href="#303">303</a></div></td><td class="codeLine"> return include $filename;</td></tr> <tr><td><div align="right"><a name="304"></a><a href="#304">304</a></div></td><td class="codeLine"> }</td></tr> <tr class="danger"><td><div align="right"><a name="305"></a><a href="#305">305</a></div></td><td class="codeLine"> return false;</td></tr> <tr><td><div align="right"><a name="306"></a><a href="#306">306</a></div></td><td class="codeLine"> }</td></tr> <tr class="success popin" data-title="2 tests cover line 307" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testGetAlbumTableReturnsAnInstanceOfAlbumTable&lt;/li&gt;&lt;li class=&quot;success&quot;&gt;AlbumRestTest\Controller\AlbumRestControllerTest::testCreateCanBeAccessed&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="307"></a><a href="#307">307</a></div></td><td class="codeLine"> }</td></tr> <tr class="danger"><td><div align="right"><a name="308"></a><a href="#308">308</a></div></td><td class="codeLine"> return false;</td></tr> <tr><td><div align="right"><a name="309"></a><a href="#309">309</a></div></td><td class="codeLine"> }</td></tr> <tr><td><div align="right"><a name="310"></a><a href="#310">310</a></div></td><td class="codeLine"></td></tr> <tr><td><div align="right"><a name="311"></a><a href="#311">311</a></div></td><td class="codeLine"> /**</td></tr> <tr><td><div align="right"><a name="312"></a><a href="#312">312</a></div></td><td class="codeLine"> * Normalize the directory to include a trailing directory separator</td></tr> <tr><td><div align="right"><a name="313"></a><a href="#313">313</a></div></td><td class="codeLine"> *</td></tr> <tr><td><div align="right"><a name="314"></a><a href="#314">314</a></div></td><td class="codeLine"> * @param string $directory</td></tr> <tr><td><div align="right"><a name="315"></a><a href="#315">315</a></div></td><td class="codeLine"> * @return string</td></tr> <tr><td><div align="right"><a name="316"></a><a href="#316">316</a></div></td><td class="codeLine"> */</td></tr> <tr><td><div align="right"><a name="317"></a><a href="#317">317</a></div></td><td class="codeLine"> protected function normalizeDirectory($directory)</td></tr> <tr><td><div align="right"><a name="318"></a><a href="#318">318</a></div></td><td class="codeLine"> {</td></tr> <tr class="danger"><td><div align="right"><a name="319"></a><a href="#319">319</a></div></td><td class="codeLine"> $last = $directory[strlen($directory) - 1];</td></tr> <tr class="danger"><td><div align="right"><a name="320"></a><a href="#320">320</a></div></td><td class="codeLine"> if (in_array($last, array('/', '\\'))) {</td></tr> <tr class="danger"><td><div align="right"><a name="321"></a><a href="#321">321</a></div></td><td class="codeLine"> $directory[strlen($directory) - 1] = DIRECTORY_SEPARATOR;</td></tr> <tr class="danger"><td><div align="right"><a name="322"></a><a href="#322">322</a></div></td><td class="codeLine"> return $directory;</td></tr> <tr><td><div align="right"><a name="323"></a><a href="#323">323</a></div></td><td class="codeLine"> }</td></tr> <tr class="danger"><td><div align="right"><a name="324"></a><a href="#324">324</a></div></td><td class="codeLine"> $directory .= DIRECTORY_SEPARATOR;</td></tr> <tr class="danger"><td><div align="right"><a name="325"></a><a href="#325">325</a></div></td><td class="codeLine"> return $directory;</td></tr> <tr><td><div align="right"><a name="326"></a><a href="#326">326</a></div></td><td class="codeLine"> }</td></tr> <tr><td><div align="right"><a name="327"></a><a href="#327">327</a></div></td><td class="codeLine">}</td></tr> </tbody> </table> <footer> <h4>Legend</h4> <p> <span class="success"><strong>Executed</strong></span> <span class="danger"><strong>Not Executed</strong></span> <span class="warning"><strong>Dead Code</strong></span> </p> <p> <small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 1.2.13</a> using <a href="http://www.php.net/" target="_top">PHP 5.6.0-1+deb.sury.org~trusty+1</a> and <a href="http://phpunit.de/">PHPUnit 3.7.28</a> at Wed Oct 8 12:51:47 AMT 2014.</small> </p> </footer> </div> <script src="js/jquery.min.js" type="text/javascript"></script> <script src="js/bootstrap.min.js" type="text/javascript"></script> <script type="text/javascript">$('.popin').popover({trigger: 'hover'});</script> </body> </html>
luizbrandao/ZF2-CRUD
module/AlbumRest/test/report/vendor_zendframework_zendframework_library_Zend_Loader_StandardAutoloader.php.html
HTML
bsd-3-clause
72,360
<@row> <@columns> <@box color='success'> <@boxHeader title='#i18n{portal.users.create_attribute.pageTitleAttributeImage}' /> <@boxBody> <@tform action='jsp/admin/user/attribute/DoCreateAttribute.jsp' method='post'> <@input type='hidden' name='token' value='${token}' /> <@input type='hidden' name='attribute_type_class_name' value='${attribute_type.className}' /> <@formGroup labelKey='#i18n{portal.users.create_attribute.labelTitle} *' labelFor='attr_title' helpKey='#i18n{portal.users.create_attribute.labelTitleComment}' mandatory=true> <@input type='text' name='title' id='attr_title' maxlength=255 /> </@formGroup> <@formGroup labelKey='#i18n{portal.users.create_attribute.labelHelpMessage}' labelFor='help_message' helpKey='#i18n{portal.users.create_attribute.labelHelpMessageComment}'> <@input type='textarea' name='help_message' id='help_message' cols=80 rows=5 /> </@formGroup> <@formGroup> <@checkBox name='is_shown_in_result_list' id='is_shown_in_result_list' labelKey='#i18n{portal.users.create_attribute.labelIsShownInResultList}' value='1' /> </@formGroup> <@formGroup> <@checkBox name='mandatory' id='mandatory' labelKey='#i18n{portal.users.create_attribute.labelMandatory}' value='1' /> </@formGroup> <@formGroup labelKey='#i18n{portal.users.create_attribute.labelWidth}' labelFor='width'> <@input type='text' name='width' id='width' value='50' /> </@formGroup> <@formGroup labelKey='#i18n{portal.users.create_attribute.labelHeight}' labelFor='height'> <@input type='text' name='height' id='height' value='50' /> </@formGroup> <@formGroup> <@button type='submit' name='save' value='save' buttonIcon='check' title='#i18n{portal.users.create_attribute.buttonValidate}' size='' /> <@button type='submit' name='apply' value='apply' buttonIcon='check' title='#i18n{portal.users.create_attribute.buttonApply}' size='' /> <@button type='submit' name='cancel' value='cancel' buttonIcon='times' title='#i18n{portal.admin.message.buttonCancel}' cancel=true size='' /> </@formGroup> </@tform> </@boxBody> </@box> </@columns> </@row>
rzara/lutece-core
webapp/WEB-INF/templates/admin/user/attribute/image/create_attribute_image.html
HTML
bsd-3-clause
2,238
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_ #define CHROME_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_ #include <memory> #include "base/compiler_specific.h" #include "base/macros.h" #include "build/chromeos_buildflags.h" #include "chrome/common/renderer_configuration.mojom.h" #include "components/content_settings/common/content_settings_manager.mojom.h" #include "components/content_settings/core/common/content_settings.h" #include "content/public/renderer/render_thread_observer.h" #include "mojo/public/cpp/bindings/associated_receiver_set.h" #include "mojo/public/cpp/bindings/pending_associated_receiver.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/receiver.h" #if BUILDFLAG(IS_CHROMEOS_ASH) #include "chrome/renderer/chromeos_delayed_callback_group.h" #endif // BUILDFLAG(IS_CHROMEOS_ASH) namespace blink { class WebResourceRequestSenderDelegate; } // namespace blink namespace visitedlink { class VisitedLinkReader; } // This class filters the incoming control messages (i.e. ones not destined for // a RenderView) for Chrome specific messages that the content layer doesn't // happen. If a few messages are related, they should probably have their own // observer. class ChromeRenderThreadObserver : public content::RenderThreadObserver, public chrome::mojom::RendererConfiguration { public: #if BUILDFLAG(IS_CHROMEOS_ASH) // A helper class to handle Mojo calls that need to be dispatched to the IO // thread instead of the main thread as is the norm. // This class is thread-safe. class ChromeOSListener : public chrome::mojom::ChromeOSListener, public base::RefCountedThreadSafe<ChromeOSListener> { public: static scoped_refptr<ChromeOSListener> Create( mojo::PendingReceiver<chrome::mojom::ChromeOSListener> chromeos_listener_receiver); ChromeOSListener(const ChromeOSListener&) = delete; ChromeOSListener& operator=(const ChromeOSListener&) = delete; // Is the merge session still running? bool IsMergeSessionRunning() const; // Run |callback| on the calling sequence when the merge session has // finished (or timed out). void RunWhenMergeSessionFinished(DelayedCallbackGroup::Callback callback); protected: // chrome::mojom::ChromeOSListener: void MergeSessionComplete() override; private: friend class base::RefCountedThreadSafe<ChromeOSListener>; ChromeOSListener(); ~ChromeOSListener() override; void BindOnIOThread(mojo::PendingReceiver<chrome::mojom::ChromeOSListener> chromeos_listener_receiver); scoped_refptr<DelayedCallbackGroup> session_merged_callbacks_; bool merge_session_running_ GUARDED_BY(lock_); mutable base::Lock lock_; mojo::Receiver<chrome::mojom::ChromeOSListener> receiver_{this}; }; #endif // BUILDFLAG(IS_CHROMEOS_ASH) ChromeRenderThreadObserver(); ChromeRenderThreadObserver(const ChromeRenderThreadObserver&) = delete; ChromeRenderThreadObserver& operator=(const ChromeRenderThreadObserver&) = delete; ~ChromeRenderThreadObserver() override; static bool is_incognito_process() { return is_incognito_process_; } // Return the dynamic parameters - those that may change while the // render process is running. static const chrome::mojom::DynamicParams& GetDynamicParams(); // Returns a pointer to the content setting rules owned by // |ChromeRenderThreadObserver|. const RendererContentSettingRules* content_setting_rules() const; visitedlink::VisitedLinkReader* visited_link_reader() { return visited_link_reader_.get(); } #if BUILDFLAG(IS_CHROMEOS_ASH) scoped_refptr<ChromeOSListener> chromeos_listener() const { return chromeos_listener_; } #endif // BUILDFLAG(IS_CHROMEOS_ASH) content_settings::mojom::ContentSettingsManager* content_settings_manager() { if (content_settings_manager_) return content_settings_manager_.get(); return nullptr; } private: // content::RenderThreadObserver: void RegisterMojoInterfaces( blink::AssociatedInterfaceRegistry* associated_interfaces) override; void UnregisterMojoInterfaces( blink::AssociatedInterfaceRegistry* associated_interfaces) override; // chrome::mojom::RendererConfiguration: void SetInitialConfiguration( bool is_incognito_process, mojo::PendingReceiver<chrome::mojom::ChromeOSListener> chromeos_listener_receiver, mojo::PendingRemote<content_settings::mojom::ContentSettingsManager> content_settings_manager) override; void SetConfiguration(chrome::mojom::DynamicParamsPtr params) override; void SetContentSettingRules( const RendererContentSettingRules& rules) override; void OnRendererConfigurationAssociatedRequest( mojo::PendingAssociatedReceiver<chrome::mojom::RendererConfiguration> receiver); static bool is_incognito_process_; std::unique_ptr<blink::WebResourceRequestSenderDelegate> resource_request_sender_delegate_; RendererContentSettingRules content_setting_rules_; mojo::Remote<content_settings::mojom::ContentSettingsManager> content_settings_manager_; std::unique_ptr<visitedlink::VisitedLinkReader> visited_link_reader_; mojo::AssociatedReceiverSet<chrome::mojom::RendererConfiguration> renderer_configuration_receivers_; #if BUILDFLAG(IS_CHROMEOS_ASH) // Only set if the Chrome OS merge session was running when the renderer // was started. scoped_refptr<ChromeOSListener> chromeos_listener_; #endif // BUILDFLAG(IS_CHROMEOS_ASH) }; #endif // CHROME_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_
nwjs/chromium.src
chrome/renderer/chrome_render_thread_observer.h
C
bsd-3-clause
5,862
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_alloca_memcpy_82_bad.cpp Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE805.label.xml Template File: sources-sink-82_bad.tmpl.cpp */ /* * @description * CWE: 121 Stack Based Buffer Overflow * BadSource: Set data pointer to the bad buffer * GoodSource: Set data pointer to the good buffer * Sinks: memcpy * BadSink : Copy twoIntsStruct array to data using memcpy * Flow Variant: 82 Data flow: data passed in a parameter to an virtual method called via a pointer * * */ #ifndef OMITBAD #include "std_testcase.h" #include "CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_alloca_memcpy_82.h" namespace CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_alloca_memcpy_82 { void CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_alloca_memcpy_82_bad::action(twoIntsStruct * data) { { twoIntsStruct source[100]; { size_t i; /* Initialize array */ for (i = 0; i < 100; i++) { source[i].intOne = 0; source[i].intTwo = 0; } } /* POTENTIAL FLAW: Possible buffer overflow if data < 100 */ memcpy(data, source, 100*sizeof(twoIntsStruct)); printStructLine(&data[0]); } } } #endif /* OMITBAD */
JianpingZeng/xcc
xcc/test/juliet/testcases/CWE121_Stack_Based_Buffer_Overflow/s04/CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_alloca_memcpy_82_bad.cpp
C++
bsd-3-clause
1,401
# -*- coding: utf-8 -*- """ Display a fortune-telling, swimming fish. Wanda has no use what-so-ever. It only takes up disk space and compilation time, and if loaded, it also takes up precious bar space, memory, and cpu cycles. Anybody found using it should be promptly sent for a psychiatric evaluation. Configuration parameters: cache_timeout: refresh interval for this module (default 0) format: display format for this module (default '{nomotion}[{fortune} ]{wanda}{motion}') fortune_timeout: refresh interval for fortune (default 60) Format placeholders: {fortune} one of many aphorisms or vague prophecies {wanda} name of one of the most commonly kept freshwater aquarium fish {motion} biologically propelled motion through a liquid medium {nomotion} opposite behavior of motion to prevent modules from shifting Optional: fortune-mod: the fortune cookie program from bsd games Examples: ``` # disable motions when not in use wanda_the_fish { format = '[\?if=fortune {nomotion}][{fortune} ]' format += '{wanda}[\?if=fortune {motion}]' } # no updates, no motions, yes fortunes, you click wanda_the_fish { format = '[{fortune} ]{wanda}' cache_timeout = -1 } # wanda moves, fortunes stays wanda_the_fish { format = '[{fortune} ]{nomotion}{wanda}{motion}' } # wanda is swimming too fast, slow down wanda wanda_the_fish { cache_timeout = 2 } ``` @author lasers SAMPLE OUTPUT [ {'full_text': 'innovate, v.: To annoy people.'}, {'full_text': ' <', 'color': '#ffa500'}, {'full_text': '\xba', 'color': '#add8e6'}, {'full_text': ',', 'color': '#ff8c00'}, {'full_text': '))', 'color': '#ffa500'}, {'full_text': '))>< ', 'color': '#ff8c00'}, ] idle [ {'full_text': ' <', 'color': '#ffa500'}, {'full_text': '\xba', 'color': '#add8e6'}, {'full_text': ',', 'color': '#ff8c00'}, {'full_text': '))', 'color': '#ffa500'}, {'full_text': '))>3', 'color': '#ff8c00'}, ] py3status [ {'full_text': 'py3status is so cool!'}, {'full_text': ' <', 'color': '#ffa500'}, {'full_text': '\xba', 'color': '#add8e6'}, {'full_text': ',', 'color': '#ff8c00'}, {'full_text': '))', 'color': '#ffa500'}, {'full_text': '))>< ', 'color': '#ff8c00'}, ] """ from time import time class Py3status: """ """ # available configuration parameters cache_timeout = 0 format = "{nomotion}[{fortune} ]{wanda}{motion}" fortune_timeout = 60 def post_config_hook(self): body = ( "[\?color=orange&show <" "[\?color=lightblue&show º]" "[\?color=darkorange&show ,]))" "[\?color=darkorange&show ))>%s]]" ) wanda = [body % fin for fin in ("<", ">", "<", "3")] self.wanda = [self.py3.safe_format(x) for x in wanda] self.wanda_length = len(self.wanda) self.index = 0 self.fortune_command = ["fortune", "-as"] self.fortune = self.py3.storage_get("fortune") or None self.toggled = self.py3.storage_get("toggled") or False self.motions = {"motion": " ", "nomotion": ""} # deal with {new,old} timeout between storage fortune_timeout = self.py3.storage_get("fortune_timeout") timeout = None if self.fortune_timeout != fortune_timeout: timeout = time() + self.fortune_timeout self.time = ( timeout or self.py3.storage_get("time") or (time() + self.fortune_timeout) ) def _set_fortune(self, state=None, new=False): if not self.fortune_command: return if new: try: fortune_data = self.py3.command_output(self.fortune_command) except self.py3.CommandError: self.fortune = "" self.fortune_command = None else: self.fortune = " ".join(fortune_data.split()) self.time = time() + self.fortune_timeout elif state is None: if self.toggled and time() >= self.time: self._set_fortune(new=True) else: self.toggled = state if state: self._set_fortune(new=True) else: self.fortune = None def _set_motion(self): for k in self.motions: self.motions[k] = "" if self.motions[k] else " " def _set_wanda(self): self.index += 1 if self.index >= self.wanda_length: self.index = 0 def wanda_the_fish(self): self._set_fortune() self._set_motion() self._set_wanda() return { "cached_until": self.py3.time_in(self.cache_timeout), "full_text": self.py3.safe_format( self.format, { "fortune": self.fortune, "motion": self.motions["motion"], "nomotion": self.motions["nomotion"], "wanda": self.wanda[self.index], }, ), } def kill(self): self.py3.storage_set("toggled", self.toggled) self.py3.storage_set("fortune", self.fortune) self.py3.storage_set("fortune_timeout", self.fortune_timeout) self.py3.storage_set("time", self.time) def on_click(self, event): if not self.fortune_command: return self._set_fortune(not self.toggled) if __name__ == "__main__": """ Run module in test mode. """ from py3status.module_test import module_test module_test(Py3status)
Andrwe/py3status
py3status/modules/wanda_the_fish.py
Python
bsd-3-clause
5,569
[简体中文](README_ZH.md) # rawbuf - Scalable & Efficient Serialization Library # ![rawbuf logo](res/logo.png) `rawbuf` is a powerful tool kit used in object serialization and deserialization with **full automation** feature, all new design based on [YAS](https://github.com/jobs-github/yas). The design of rawbuf: ![design](res/design.png) ## What is rawbuf ? ## `rawbuf` is inspired by [flatbuffers](https://github.com/google/flatbuffers) and [slothjson](https://github.com/jobs-github/slothjson). `flatbuffers` is efficient enough but not so stupid & succinct, while `slothjson` is stupid & succinct enough but not so efficient. That is what `rawbuf` needs to do. `rawbuf` uses flatbuffers-like protocol to describe data, and uses [YAS](https://github.com/jobs-github/yas) for automation. So it is faster than `slothjson` and easier than `flatbuffers`. Please refer to [slothjson](https://github.com/jobs-github/slothjson) for more details. ## Features ## * Efficient (4x faster than `slothjson`) * Succinct interface for people (everything can be done with just a single line of code) * Simple, powerful code generator with full automation (not need to implement serialize/deserialize interfaces manually) * Support optional field (easy to serialize/deserialize field optionally) * Flexible schema (support array, dict, nested object and **nested array & dict**) * Succinct design (no tricky C++ template technology, easy to understand), reusable, extensible (easy to support new types) * Cross-Platform (Windows & Linux & OS X) ## Usage ## Take C++ implement of rawbuf as an example. In the beginning, you need to add the following items to your project: * `rawbuf`: refer to `cpp/include/rawbuf.h` and `cpp/include/rawbuf.cpp`, the library of rawbuf **That's all the dependency**. Then, write a schema named `fxxx_gfw.json`: { "structs": [ { "type": "fxxx_gfw_t", "members": [ ["bool", "bool_val", "100"], ["int8_t", "int8_val"], ["int32_t", "int32_val"], ["uint64_t", "uint64_val"], ["double", "double_val", "101"], ["string", "str_val"], ["[int32_t]", "vec_val", "110"], ["{string}", "dict_val"] ] } ] } Run command line: python cpp/generator/rawbuf.py -f cpp/src/fxxx_gfw.json It will generate `fxxx_gfw.h` and `fxxx_gfw.cpp`, which you need to add to your project. Then you can code like this: rawbuf::fxxx_gfw_t obj_val; // set the value of "obj_val" ...... // output as instance of "rb_buf_t" rawbuf::rb_buf_t rb_val = rawbuf::rb_create_buf(rawbuf::rb_sizeof(obj_val)); bool rc = rawbuf::rb_encode(obj_val, rb_val); // use value of "rb_val" ...... rawbuf::rb_dispose_buf(rb_val); // do not forget! // output as file std::string path = "fxxx_gfw_t.bin"; bool rc = rawbuf::rb_dump(obj_val, path); If you don't want to serialize all fields, code like this: obj_val.skip_dict_val(); // call "skip_xxx" The same as deserialize: rawbuf::rb_buf_t rb_val = rawbuf::rb_create_buf(rawbuf::rb_sizeof(obj_val)); // set the value of "rb_val" ...... // load from "rb_val" rawbuf::fxxx_gfw_t obj_val; bool rc = rawbuf::rb_decode(rb_val, 0, obj_val); ...... rawbuf::rb_dispose_buf(rb_val); // do not forget! // load from file std::string path = "fxxx_gfw_t.bin"; rawbuf::fxxx_gfw_t obj_val; bool rc = rawbuf::rb_load(path, obj_val); After deserialized, if you need to know **whether a field is in binary buffer or not**, code like this: if (obj_val.rb_has_dict_val()) // call "rb_has_xxx()" { ...... } That's all about the usage, simple & stupid, isn't it ? ## Supported Programming Languages ## * C++ * C * Go I implement rawbuf using php & python, but not merge to master branch as the performance does not come up to expectation. Welcome contribution on other programming languages' implementation. * [php-alpha](https://github.com/jobs-github/rawbuf/tree/php-alpha) * [python-alpha](https://github.com/jobs-github/rawbuf/tree/python-alpha) * [php-beta](https://github.com/jobs-github/rawbuf/tree/php-beta) * [python-beta](https://github.com/jobs-github/rawbuf/tree/python-beta) Note: the performance of `beta` is better than `alpha`. ## Implement on YAS Extension ## Language | Implement YAS Extension --------------|------------------------- C++ | Yes C | No go | No php-alpha | Yes python-alpha | Yes php-beta | No python-beta | No ## Platforms ## Platform | Description ---------|---------------------------------------------------------- Linux | CentOS 6.x & Ubuntu 10.04 (kernel 2.6.32) GCC 4.4.7 Win32 | Windows 7, MSVC 10.0 OS X | Mac OS X EI Capitan, GCC 4.2.1, Apple LLVM version 7.3.0 ## Performance ## ## Details ## `rawbuf` and `slothjson` share the **same design, same schema**. The difference between them is the protocol (`text` vs `binary`) and performance. You can get all details from [here](https://github.com/jobs-github/slothjson) and [here](https://github.com/jobs-github/yas) ## Protocol ## ### scalar ### ![scalar](res/scalar.png) ### string ### ![string](res/string.png) ### object ### ![object](res/object.png) ### array ### ![array](res/array.png) ### dict ### ![dict](res/dict.png) ## License ## `rawbuf` is licensed under [New BSD License](https://opensource.org/licenses/BSD-3-Clause), a very flexible license to use. ## Author ## * chengzhuo (jobs, [email protected]) ## More ## - Yet Another Schema - [YAS](https://github.com/jobs-github/yas) - Object Serialization Artifact For Lazy Man - [slothjson](https://github.com/jobs-github/slothjson) - High-performance Distributed Storage - [huststore](https://github.com/Qihoo360/huststore)
jobs-github/rawbuf
README.md
Markdown
bsd-3-clause
5,997
/****************************************************************************/ /* */ /* Module: LegTrnaslationFuncs.h */ /* */ /* Description: This module provides compatibility support to allow */ /* QST 2.x applications run on QST 1.x firmware. */ /* */ /****************************************************************************/ /****************************************************************************/ /* */ /* Copyright (c) 2005-2009, Intel Corporation. All Rights Reserved. */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions are */ /* met: */ /* */ /* - Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* - Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in */ /* the documentation and/or other materials provided with the */ /* distribution. */ /* */ /* - Neither the name of Intel Corporation nor the names of its */ /* contributors may be used to endorse or promote products derived */ /* from this software without specific prior written permission. */ /* */ /* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ /* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, */ /* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND */ /* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL */ /* INTEL CORPORATION OR THE 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. */ /* */ /****************************************************************************/ #ifndef _LEG_TRANSLATION_FUNCS_H #define _LEG_TRANSLATION_FUNCS_H // Error platform independent error codes for using this module typedef enum { TRANSLATE_CMD_SUCCESS = 0, TRANSLATE_CMD_INVALID_PARAMETER, TRANSLATE_CMD_BAD_COMMAND, TRANSLATE_CMD_NOT_ENOUGH_MEMORY, TRANSLATE_CMD_FAILED_WITH_ERROR_SET } CMD_TRANSLATION_STATUS; // Function prototypes BOOL GetSubsystemInformation( void ); BOOL TranslationToLegacyRequired( void ); BOOL TranslationToNewRequired( void ); CMD_TRANSLATION_STATUS TranslateToLegacyCommand( IN void *pvCmdBuf, // Address of buffer contaiing command packet IN size_t tCmdSize, // Size of command packet OUT void *pvRspBuf, // Address of buffer for response packet IN size_t tRspSize // Expected size of response packet ); CMD_TRANSLATION_STATUS TranslateToNewCommand( IN void *pvCmdBuf, // Address of buffer contaiing command packet IN size_t tCmdSize, // Size of command packet OUT void *pvRspBuf, // Address of buffer for response packet IN size_t tRspSize // Expected size of response packet ); BOOL CommonCmdHandler( IN void *pvCmdBuf, // Address of buffer contaiing command packet IN size_t tCmdSize, // Size of command packet OUT void *pvRspBuf, // Address of buffer for response packet IN size_t tRspSize // Expected size of response packet ); #endif // ndef _LEG_TRANSLATION_FUNCS_H
gigaplex/Intel_QST_SDK
src/Libraries/Common/LegTranslationFuncs.h
C
bsd-3-clause
4,980
#ifndef APPS_SFDL_HW_V_INP_GEN_HW_H_ #define APPS_SFDL_HW_V_INP_GEN_HW_H_ #include <libv/libv.h> #include <common/utility.h> #include <apps_sfdl_gen/fannkuch_v_inp_gen.h> /* * Provides the ability for user-defined input creation */ class fannkuchVerifierInpGenHw : public InputCreator { public: fannkuchVerifierInpGenHw(Venezia* v); void create_input(mpq_t* input_q, int num_inputs); private: Venezia* v; fannkuchVerifierInpGen compiler_implementation; }; #endif // APPS_SFDL_HW_V_INP_GEN_HW_H_
srinathtv/pepper
pepper/apps_sfdl_hw/fannkuch_v_inp_gen_hw.h
C
bsd-3-clause
521
#!/bin/bash # # Run a shell command on all slave hosts. # # Environment Variables # # HADOOP_SLAVES File naming remote hosts. # Default is ${HADOOP_CONF_DIR}/slaves. # HADOOP_CONF_DIR Alternate conf dir. Default is ${HADOOP_HOME}/conf. # HADOOP_SLAVE_SLEEP Seconds to sleep between spawning remote commands. # HADOOP_SSH_OPTS Options passed to ssh when running remote commands. ## usage="Usage: slaves.sh [--config confdir] command..." # if no args specified, show usage if [ $# -le 0 ]; then echo $usage exit 1 fi bin=`dirname "$0"` bin=`cd "$bin"; pwd` . "$bin"/hadoop-config.sh # If the slaves file is specified in the command line, # then it takes precedence over the definition in # hadoop-env.sh. Save it here. HOSTLIST=$HADOOP_SLAVES if [ -f "${HADOOP_CONF_DIR}/hadoop-env.sh" ]; then . "${HADOOP_CONF_DIR}/hadoop-env.sh" fi if [ "$HOSTLIST" = "" ]; then if [ "$HADOOP_SLAVES" = "" ]; then export HOSTLIST="${HADOOP_CONF_DIR}/slaves" else export HOSTLIST="${HADOOP_SLAVES}" fi fi for slave in `cat "$HOSTLIST"`; do ssh $HADOOP_SSH_OPTS $slave $"${@// /\\ }" \ 2>&1 | sed "s/^/$slave: /" & if [ "$HADOOP_SLAVE_SLEEP" != "" ]; then sleep $HADOOP_SLAVE_SLEEP fi done wait
wangxin39/yuqing
bin/slaves.sh
Shell
bsd-3-clause
1,232
/** * (c) 2017 TIBCO Software Inc. All rights reserved. * * Except as specified below, this software is licensed pursuant to the Eclipse Public License v. 1.0. * The details can be found in the file LICENSE. * * The following proprietary files are included as a convenience, and may not be used except pursuant * to valid license to Composite Information Server or TIBCO(R) Data Virtualization Server: * csadmin-XXXX.jar, csarchive-XXXX.jar, csbase-XXXX.jar, csclient-XXXX.jar, cscommon-XXXX.jar, * csext-XXXX.jar, csjdbc-XXXX.jar, csserverutil-XXXX.jar, csserver-XXXX.jar, cswebapi-XXXX.jar, * and customproc-XXXX.jar (where -XXXX is an optional version number). Any included third party files * are licensed under the terms contained in their own accompanying LICENSE files, generally named .LICENSE.txt. * * This software is licensed AS-IS. Support for this software is not covered by standard maintenance agreements with TIBCO. * If you would like to obtain assistance with this software, such assistance may be obtained through a separate paid consulting * agreement with TIBCO. * */ package com.tibco.ps.deploytool.services; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.context.ApplicationContextException; import com.tibco.ps.common.CommonConstants; import com.tibco.ps.common.exception.CompositeException; import com.tibco.ps.common.util.CommonUtils; import com.tibco.ps.deploytool.dao.ServerDAO; import com.tibco.ps.deploytool.dao.wsapi.ServerWSDAOImpl; public class ServerManagerImpl implements ServerManager { private ServerDAO serverDAO = null; // Get the configuration property file set in the environment with a default of deploy.properties String propertyFile = CommonUtils.getFileOrSystemPropertyValue(CommonConstants.propertyFile, "CONFIG_PROPERTY_FILE"); private static Log logger = LogFactory.getLog(ServerManagerImpl.class); // @Override public void startServer(String serverId, String pathToServersXML) throws CompositeException { String prefix = "startServer"; // Extract variables for the serverId serverId = CommonUtils.extractVariable(prefix, serverId, propertyFile, true); if(logger.isDebugEnabled()){ logger.debug(" Entering ServerManagerImpl.start() with following params - serverId: " + serverId + ", pathToServersXML: " + pathToServersXML); } try { serverManagerAction(ServerDAO.action.START.name(), serverId, pathToServersXML); } catch (CompositeException e) { logger.error("Error while starting server: " , e); throw new ApplicationContextException(e.getMessage(), e); } } // @Override public void stopServer(String serverId, String pathToServersXML) throws CompositeException { String prefix = "stopServer"; // Extract variables for the serverId serverId = CommonUtils.extractVariable(prefix, serverId, propertyFile, true); if(logger.isDebugEnabled()){ logger.debug(" Entering ServerManagerImpl.start() with following params - serverId: " + serverId + ", pathToServersXML: " + pathToServersXML); } try { serverManagerAction(ServerDAO.action.STOP.name(), serverId, pathToServersXML); } catch (CompositeException e) { logger.error("Error while stopping server: " , e); throw new ApplicationContextException(e.getMessage(), e); } } // @Override public void restartServer(String serverId, String pathToServersXML) throws CompositeException { String prefix = "restartServer"; // Extract variables for the serverId serverId = CommonUtils.extractVariable(prefix, serverId, propertyFile, true); if(logger.isDebugEnabled()){ logger.debug(" Entering ServerManagerImpl.start() with following params - serverId: " + serverId + ", pathToServersXML: " + pathToServersXML); } try { serverManagerAction(ServerDAO.action.RESTART.name(), serverId, pathToServersXML); } catch (CompositeException e) { logger.error("Error while restarting server: " , e); throw new ApplicationContextException(e.getMessage(), e); } } private void serverManagerAction(String actionName, String serverId, String pathToServersXML) throws CompositeException { String prefix = "serverManagerAction"; String processedIds = null; // Extract variables for the serverId serverId = CommonUtils.extractVariable(prefix, serverId, propertyFile, true); // Set the Module Action Objective String s1 = (serverId == null) ? "no_serverId" : "Ids="+serverId; System.setProperty("MODULE_ACTION_OBJECTIVE", actionName+" : "+s1); // Validate whether the files exist or not if (!CommonUtils.fileExists(pathToServersXML)) { throw new CompositeException("File ["+pathToServersXML+"] does not exist."); } try { if(logger.isInfoEnabled()){ logger.info("processing action "+ actionName + " on server "+ serverId); } getServerDAO().takeServerManagerAction(actionName, serverId, pathToServersXML); } catch (CompositeException e) { logger.error("Error on server action (" + actionName + "): ", e); throw new ApplicationContextException(e.getMessage(), e); } } /** * @return serverDAO */ public ServerDAO getServerDAO() { if(this.serverDAO == null){ this.serverDAO = new ServerWSDAOImpl(); } return serverDAO; } /** * @param set serverDAO */ public void setServerDAO(ServerDAO serverDAO) { this.serverDAO = serverDAO; } }
cisco/PDTool
src/com/tibco/ps/deploytool/services/ServerManagerImpl.java
Java
bsd-3-clause
5,374
/*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> __FBSDID("$FreeBSD: releng/9.3/sys/net80211/ieee80211_ioctl.c 234753 2012-04-28 09:15:01Z dim $"); /* * IEEE 802.11 ioctl support (FreeBSD-specific) */ #include "opt_inet.h" #include "opt_ipx.h" #include "opt_wlan.h" #include <sys/endian.h> #include <sys/param.h> #include <sys/kernel.h> #include <sys/priv.h> #include <sys/socket.h> #include <sys/sockio.h> #include <sys/systm.h> #include <net/if.h> #include <net/if_dl.h> #include <net/if_media.h> #include <net/ethernet.h> #ifdef INET #include <netinet/in.h> #include <netinet/if_ether.h> #endif #ifdef IPX #include <netipx/ipx.h> #include <netipx/ipx_if.h> #endif #include <net80211/ieee80211_var.h> #include <net80211/ieee80211_ioctl.h> #include <net80211/ieee80211_regdomain.h> #include <net80211/ieee80211_input.h> #define IS_UP_AUTO(_vap) \ (IFNET_IS_UP_RUNNING((_vap)->iv_ifp) && \ (_vap)->iv_roaming == IEEE80211_ROAMING_AUTO) static const uint8_t zerobssid[IEEE80211_ADDR_LEN]; static struct ieee80211_channel *findchannel(struct ieee80211com *, int ieee, int mode); static int ieee80211_scanreq(struct ieee80211vap *, struct ieee80211_scan_req *); static __noinline int ieee80211_ioctl_getkey(struct ieee80211vap *vap, struct ieee80211req *ireq) { struct ieee80211com *ic = vap->iv_ic; struct ieee80211_node *ni; struct ieee80211req_key ik; struct ieee80211_key *wk; const struct ieee80211_cipher *cip; u_int kid; int error; if (ireq->i_len != sizeof(ik)) return EINVAL; error = copyin(ireq->i_data, &ik, sizeof(ik)); if (error) return error; kid = ik.ik_keyix; if (kid == IEEE80211_KEYIX_NONE) { ni = ieee80211_find_vap_node(&ic->ic_sta, vap, ik.ik_macaddr); if (ni == NULL) return ENOENT; wk = &ni->ni_ucastkey; } else { if (kid >= IEEE80211_WEP_NKID) return EINVAL; wk = &vap->iv_nw_keys[kid]; IEEE80211_ADDR_COPY(&ik.ik_macaddr, vap->iv_bss->ni_macaddr); ni = NULL; } cip = wk->wk_cipher; ik.ik_type = cip->ic_cipher; ik.ik_keylen = wk->wk_keylen; ik.ik_flags = wk->wk_flags & (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV); if (wk->wk_keyix == vap->iv_def_txkey) ik.ik_flags |= IEEE80211_KEY_DEFAULT; if (priv_check(curthread, PRIV_NET80211_GETKEY) == 0) { /* NB: only root can read key data */ ik.ik_keyrsc = wk->wk_keyrsc[IEEE80211_NONQOS_TID]; ik.ik_keytsc = wk->wk_keytsc; memcpy(ik.ik_keydata, wk->wk_key, wk->wk_keylen); if (cip->ic_cipher == IEEE80211_CIPHER_TKIP) { memcpy(ik.ik_keydata+wk->wk_keylen, wk->wk_key + IEEE80211_KEYBUF_SIZE, IEEE80211_MICBUF_SIZE); ik.ik_keylen += IEEE80211_MICBUF_SIZE; } } else { ik.ik_keyrsc = 0; ik.ik_keytsc = 0; memset(ik.ik_keydata, 0, sizeof(ik.ik_keydata)); } if (ni != NULL) ieee80211_free_node(ni); return copyout(&ik, ireq->i_data, sizeof(ik)); } static __noinline int ieee80211_ioctl_getchanlist(struct ieee80211vap *vap, struct ieee80211req *ireq) { struct ieee80211com *ic = vap->iv_ic; if (sizeof(ic->ic_chan_active) < ireq->i_len) ireq->i_len = sizeof(ic->ic_chan_active); return copyout(&ic->ic_chan_active, ireq->i_data, ireq->i_len); } static __noinline int ieee80211_ioctl_getchaninfo(struct ieee80211vap *vap, struct ieee80211req *ireq) { struct ieee80211com *ic = vap->iv_ic; uint32_t space; space = __offsetof(struct ieee80211req_chaninfo, ic_chans[ic->ic_nchans]); if (space > ireq->i_len) space = ireq->i_len; /* XXX assumes compatible layout */ return copyout(&ic->ic_nchans, ireq->i_data, space); } static __noinline int ieee80211_ioctl_getwpaie(struct ieee80211vap *vap, struct ieee80211req *ireq, int req) { struct ieee80211_node *ni; struct ieee80211req_wpaie2 wpaie; int error; if (ireq->i_len < IEEE80211_ADDR_LEN) return EINVAL; error = copyin(ireq->i_data, wpaie.wpa_macaddr, IEEE80211_ADDR_LEN); if (error != 0) return error; ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap, wpaie.wpa_macaddr); if (ni == NULL) return ENOENT; memset(wpaie.wpa_ie, 0, sizeof(wpaie.wpa_ie)); if (ni->ni_ies.wpa_ie != NULL) { int ielen = ni->ni_ies.wpa_ie[1] + 2; if (ielen > sizeof(wpaie.wpa_ie)) ielen = sizeof(wpaie.wpa_ie); memcpy(wpaie.wpa_ie, ni->ni_ies.wpa_ie, ielen); } if (req == IEEE80211_IOC_WPAIE2) { memset(wpaie.rsn_ie, 0, sizeof(wpaie.rsn_ie)); if (ni->ni_ies.rsn_ie != NULL) { int ielen = ni->ni_ies.rsn_ie[1] + 2; if (ielen > sizeof(wpaie.rsn_ie)) ielen = sizeof(wpaie.rsn_ie); memcpy(wpaie.rsn_ie, ni->ni_ies.rsn_ie, ielen); } if (ireq->i_len > sizeof(struct ieee80211req_wpaie2)) ireq->i_len = sizeof(struct ieee80211req_wpaie2); } else { /* compatibility op, may overwrite wpa ie */ /* XXX check ic_flags? */ if (ni->ni_ies.rsn_ie != NULL) { int ielen = ni->ni_ies.rsn_ie[1] + 2; if (ielen > sizeof(wpaie.wpa_ie)) ielen = sizeof(wpaie.wpa_ie); memcpy(wpaie.wpa_ie, ni->ni_ies.rsn_ie, ielen); } if (ireq->i_len > sizeof(struct ieee80211req_wpaie)) ireq->i_len = sizeof(struct ieee80211req_wpaie); } ieee80211_free_node(ni); return copyout(&wpaie, ireq->i_data, ireq->i_len); } static __noinline int ieee80211_ioctl_getstastats(struct ieee80211vap *vap, struct ieee80211req *ireq) { struct ieee80211_node *ni; uint8_t macaddr[IEEE80211_ADDR_LEN]; const size_t off = __offsetof(struct ieee80211req_sta_stats, is_stats); int error; if (ireq->i_len < off) return EINVAL; error = copyin(ireq->i_data, macaddr, IEEE80211_ADDR_LEN); if (error != 0) return error; ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap, macaddr); if (ni == NULL) return ENOENT; if (ireq->i_len > sizeof(struct ieee80211req_sta_stats)) ireq->i_len = sizeof(struct ieee80211req_sta_stats); /* NB: copy out only the statistics */ error = copyout(&ni->ni_stats, (uint8_t *) ireq->i_data + off, ireq->i_len - off); ieee80211_free_node(ni); return error; } struct scanreq { struct ieee80211req_scan_result *sr; size_t space; }; static size_t scan_space(const struct ieee80211_scan_entry *se, int *ielen) { size_t len; *ielen = se->se_ies.len; /* * NB: ie's can be no more than 255 bytes and the max 802.11 * packet is <3Kbytes so we are sure this doesn't overflow * 16-bits; if this is a concern we can drop the ie's. */ len = sizeof(struct ieee80211req_scan_result) + se->se_ssid[1] + se->se_meshid[1] + *ielen; return roundup(len, sizeof(uint32_t)); } static void get_scan_space(void *arg, const struct ieee80211_scan_entry *se) { struct scanreq *req = arg; int ielen; req->space += scan_space(se, &ielen); } static __noinline void get_scan_result(void *arg, const struct ieee80211_scan_entry *se) { struct scanreq *req = arg; struct ieee80211req_scan_result *sr; int ielen, len, nr, nxr; uint8_t *cp; len = scan_space(se, &ielen); if (len > req->space) return; sr = req->sr; KASSERT(len <= 65535 && ielen <= 65535, ("len %u ssid %u ie %u", len, se->se_ssid[1], ielen)); sr->isr_len = len; sr->isr_ie_off = sizeof(struct ieee80211req_scan_result); sr->isr_ie_len = ielen; sr->isr_freq = se->se_chan->ic_freq; sr->isr_flags = se->se_chan->ic_flags; sr->isr_rssi = se->se_rssi; sr->isr_noise = se->se_noise; sr->isr_intval = se->se_intval; sr->isr_capinfo = se->se_capinfo; sr->isr_erp = se->se_erp; IEEE80211_ADDR_COPY(sr->isr_bssid, se->se_bssid); nr = min(se->se_rates[1], IEEE80211_RATE_MAXSIZE); memcpy(sr->isr_rates, se->se_rates+2, nr); nxr = min(se->se_xrates[1], IEEE80211_RATE_MAXSIZE - nr); memcpy(sr->isr_rates+nr, se->se_xrates+2, nxr); sr->isr_nrates = nr + nxr; /* copy SSID */ sr->isr_ssid_len = se->se_ssid[1]; cp = ((uint8_t *)sr) + sr->isr_ie_off; memcpy(cp, se->se_ssid+2, sr->isr_ssid_len); /* copy mesh id */ cp += sr->isr_ssid_len; sr->isr_meshid_len = se->se_meshid[1]; memcpy(cp, se->se_meshid+2, sr->isr_meshid_len); cp += sr->isr_meshid_len; if (ielen) memcpy(cp, se->se_ies.data, ielen); req->space -= len; req->sr = (struct ieee80211req_scan_result *)(((uint8_t *)sr) + len); } static __noinline int ieee80211_ioctl_getscanresults(struct ieee80211vap *vap, struct ieee80211req *ireq) { struct scanreq req; int error; if (ireq->i_len < sizeof(struct scanreq)) return EFAULT; error = 0; req.space = 0; ieee80211_scan_iterate(vap, get_scan_space, &req); if (req.space > ireq->i_len) req.space = ireq->i_len; if (req.space > 0) { uint32_t space; void *p; space = req.space; /* XXX M_WAITOK after driver lock released */ p = malloc(space, M_TEMP, M_NOWAIT | M_ZERO); if (p == NULL) return ENOMEM; req.sr = p; ieee80211_scan_iterate(vap, get_scan_result, &req); ireq->i_len = space - req.space; error = copyout(p, ireq->i_data, ireq->i_len); free(p, M_TEMP); } else ireq->i_len = 0; return error; } struct stainforeq { struct ieee80211vap *vap; struct ieee80211req_sta_info *si; size_t space; }; static size_t sta_space(const struct ieee80211_node *ni, size_t *ielen) { *ielen = ni->ni_ies.len; return roundup(sizeof(struct ieee80211req_sta_info) + *ielen, sizeof(uint32_t)); } static void get_sta_space(void *arg, struct ieee80211_node *ni) { struct stainforeq *req = arg; size_t ielen; if (req->vap != ni->ni_vap) return; if (ni->ni_vap->iv_opmode == IEEE80211_M_HOSTAP && ni->ni_associd == 0) /* only associated stations */ return; req->space += sta_space(ni, &ielen); } static __noinline void get_sta_info(void *arg, struct ieee80211_node *ni) { struct stainforeq *req = arg; struct ieee80211vap *vap = ni->ni_vap; struct ieee80211req_sta_info *si; size_t ielen, len; uint8_t *cp; if (req->vap != ni->ni_vap) return; if (vap->iv_opmode == IEEE80211_M_HOSTAP && ni->ni_associd == 0) /* only associated stations */ return; if (ni->ni_chan == IEEE80211_CHAN_ANYC) /* XXX bogus entry */ return; len = sta_space(ni, &ielen); if (len > req->space) return; si = req->si; si->isi_len = len; si->isi_ie_off = sizeof(struct ieee80211req_sta_info); si->isi_ie_len = ielen; si->isi_freq = ni->ni_chan->ic_freq; si->isi_flags = ni->ni_chan->ic_flags; si->isi_state = ni->ni_flags; si->isi_authmode = ni->ni_authmode; vap->iv_ic->ic_node_getsignal(ni, &si->isi_rssi, &si->isi_noise); vap->iv_ic->ic_node_getmimoinfo(ni, &si->isi_mimo); si->isi_capinfo = ni->ni_capinfo; si->isi_erp = ni->ni_erp; IEEE80211_ADDR_COPY(si->isi_macaddr, ni->ni_macaddr); si->isi_nrates = ni->ni_rates.rs_nrates; if (si->isi_nrates > 15) si->isi_nrates = 15; memcpy(si->isi_rates, ni->ni_rates.rs_rates, si->isi_nrates); si->isi_txrate = ni->ni_txrate; if (si->isi_txrate & IEEE80211_RATE_MCS) { const struct ieee80211_mcs_rates *mcs = &ieee80211_htrates[ni->ni_txrate &~ IEEE80211_RATE_MCS]; if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)) { if (ni->ni_flags & IEEE80211_NODE_SGI40) si->isi_txmbps = mcs->ht40_rate_800ns; else si->isi_txmbps = mcs->ht40_rate_400ns; } else { if (ni->ni_flags & IEEE80211_NODE_SGI20) si->isi_txmbps = mcs->ht20_rate_800ns; else si->isi_txmbps = mcs->ht20_rate_400ns; } } else si->isi_txmbps = si->isi_txrate; si->isi_associd = ni->ni_associd; si->isi_txpower = ni->ni_txpower; si->isi_vlan = ni->ni_vlan; if (ni->ni_flags & IEEE80211_NODE_QOS) { memcpy(si->isi_txseqs, ni->ni_txseqs, sizeof(ni->ni_txseqs)); memcpy(si->isi_rxseqs, ni->ni_rxseqs, sizeof(ni->ni_rxseqs)); } else { si->isi_txseqs[0] = ni->ni_txseqs[IEEE80211_NONQOS_TID]; si->isi_rxseqs[0] = ni->ni_rxseqs[IEEE80211_NONQOS_TID]; } /* NB: leave all cases in case we relax ni_associd == 0 check */ if (ieee80211_node_is_authorized(ni)) si->isi_inact = vap->iv_inact_run; else if (ni->ni_associd != 0 || (vap->iv_opmode == IEEE80211_M_WDS && (vap->iv_flags_ext & IEEE80211_FEXT_WDSLEGACY))) si->isi_inact = vap->iv_inact_auth; else si->isi_inact = vap->iv_inact_init; si->isi_inact = (si->isi_inact - ni->ni_inact) * IEEE80211_INACT_WAIT; si->isi_localid = ni->ni_mllid; si->isi_peerid = ni->ni_mlpid; si->isi_peerstate = ni->ni_mlstate; if (ielen) { cp = ((uint8_t *)si) + si->isi_ie_off; memcpy(cp, ni->ni_ies.data, ielen); } req->si = (struct ieee80211req_sta_info *)(((uint8_t *)si) + len); req->space -= len; } static __noinline int getstainfo_common(struct ieee80211vap *vap, struct ieee80211req *ireq, struct ieee80211_node *ni, size_t off) { struct ieee80211com *ic = vap->iv_ic; struct stainforeq req; size_t space; void *p; int error; error = 0; req.space = 0; req.vap = vap; if (ni == NULL) ieee80211_iterate_nodes(&ic->ic_sta, get_sta_space, &req); else get_sta_space(&req, ni); if (req.space > ireq->i_len) req.space = ireq->i_len; if (req.space > 0) { space = req.space; /* XXX M_WAITOK after driver lock released */ p = malloc(space, M_TEMP, M_NOWAIT | M_ZERO); if (p == NULL) { error = ENOMEM; goto bad; } req.si = p; if (ni == NULL) ieee80211_iterate_nodes(&ic->ic_sta, get_sta_info, &req); else get_sta_info(&req, ni); ireq->i_len = space - req.space; error = copyout(p, (uint8_t *) ireq->i_data+off, ireq->i_len); free(p, M_TEMP); } else ireq->i_len = 0; bad: if (ni != NULL) ieee80211_free_node(ni); return error; } static __noinline int ieee80211_ioctl_getstainfo(struct ieee80211vap *vap, struct ieee80211req *ireq) { uint8_t macaddr[IEEE80211_ADDR_LEN]; const size_t off = __offsetof(struct ieee80211req_sta_req, info); struct ieee80211_node *ni; int error; if (ireq->i_len < sizeof(struct ieee80211req_sta_req)) return EFAULT; error = copyin(ireq->i_data, macaddr, IEEE80211_ADDR_LEN); if (error != 0) return error; if (IEEE80211_ADDR_EQ(macaddr, vap->iv_ifp->if_broadcastaddr)) { ni = NULL; } else { ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap, macaddr); if (ni == NULL) return ENOENT; } return getstainfo_common(vap, ireq, ni, off); } static __noinline int ieee80211_ioctl_getstatxpow(struct ieee80211vap *vap, struct ieee80211req *ireq) { struct ieee80211_node *ni; struct ieee80211req_sta_txpow txpow; int error; if (ireq->i_len != sizeof(txpow)) return EINVAL; error = copyin(ireq->i_data, &txpow, sizeof(txpow)); if (error != 0) return error; ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap, txpow.it_macaddr); if (ni == NULL) return ENOENT; txpow.it_txpow = ni->ni_txpower; error = copyout(&txpow, ireq->i_data, sizeof(txpow)); ieee80211_free_node(ni); return error; } static __noinline int ieee80211_ioctl_getwmeparam(struct ieee80211vap *vap, struct ieee80211req *ireq) { struct ieee80211com *ic = vap->iv_ic; struct ieee80211_wme_state *wme = &ic->ic_wme; struct wmeParams *wmep; int ac; if ((ic->ic_caps & IEEE80211_C_WME) == 0) return EINVAL; ac = (ireq->i_len & IEEE80211_WMEPARAM_VAL); if (ac >= WME_NUM_AC) ac = WME_AC_BE; if (ireq->i_len & IEEE80211_WMEPARAM_BSS) wmep = &wme->wme_wmeBssChanParams.cap_wmeParams[ac]; else wmep = &wme->wme_wmeChanParams.cap_wmeParams[ac]; switch (ireq->i_type) { case IEEE80211_IOC_WME_CWMIN: /* WME: CWmin */ ireq->i_val = wmep->wmep_logcwmin; break; case IEEE80211_IOC_WME_CWMAX: /* WME: CWmax */ ireq->i_val = wmep->wmep_logcwmax; break; case IEEE80211_IOC_WME_AIFS: /* WME: AIFS */ ireq->i_val = wmep->wmep_aifsn; break; case IEEE80211_IOC_WME_TXOPLIMIT: /* WME: txops limit */ ireq->i_val = wmep->wmep_txopLimit; break; case IEEE80211_IOC_WME_ACM: /* WME: ACM (bss only) */ wmep = &wme->wme_wmeBssChanParams.cap_wmeParams[ac]; ireq->i_val = wmep->wmep_acm; break; case IEEE80211_IOC_WME_ACKPOLICY: /* WME: ACK policy (!bss only)*/ wmep = &wme->wme_wmeChanParams.cap_wmeParams[ac]; ireq->i_val = !wmep->wmep_noackPolicy; break; } return 0; } static __noinline int ieee80211_ioctl_getmaccmd(struct ieee80211vap *vap, struct ieee80211req *ireq) { const struct ieee80211_aclator *acl = vap->iv_acl; return (acl == NULL ? EINVAL : acl->iac_getioctl(vap, ireq)); } static __noinline int ieee80211_ioctl_getcurchan(struct ieee80211vap *vap, struct ieee80211req *ireq) { struct ieee80211com *ic = vap->iv_ic; struct ieee80211_channel *c; if (ireq->i_len != sizeof(struct ieee80211_channel)) return EINVAL; /* * vap's may have different operating channels when HT is * in use. When in RUN state report the vap-specific channel. * Otherwise return curchan. */ if (vap->iv_state == IEEE80211_S_RUN) c = vap->iv_bss->ni_chan; else c = ic->ic_curchan; return copyout(c, ireq->i_data, sizeof(*c)); } static int getappie(const struct ieee80211_appie *aie, struct ieee80211req *ireq) { if (aie == NULL) return EINVAL; /* NB: truncate, caller can check length */ if (ireq->i_len > aie->ie_len) ireq->i_len = aie->ie_len; return copyout(aie->ie_data, ireq->i_data, ireq->i_len); } static int ieee80211_ioctl_getappie(struct ieee80211vap *vap, struct ieee80211req *ireq) { uint8_t fc0; fc0 = ireq->i_val & 0xff; if ((fc0 & IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_MGT) return EINVAL; /* NB: could check iv_opmode and reject but hardly worth the effort */ switch (fc0 & IEEE80211_FC0_SUBTYPE_MASK) { case IEEE80211_FC0_SUBTYPE_BEACON: return getappie(vap->iv_appie_beacon, ireq); case IEEE80211_FC0_SUBTYPE_PROBE_RESP: return getappie(vap->iv_appie_proberesp, ireq); case IEEE80211_FC0_SUBTYPE_ASSOC_RESP: return getappie(vap->iv_appie_assocresp, ireq); case IEEE80211_FC0_SUBTYPE_PROBE_REQ: return getappie(vap->iv_appie_probereq, ireq); case IEEE80211_FC0_SUBTYPE_ASSOC_REQ: return getappie(vap->iv_appie_assocreq, ireq); case IEEE80211_FC0_SUBTYPE_BEACON|IEEE80211_FC0_SUBTYPE_PROBE_RESP: return getappie(vap->iv_appie_wpa, ireq); } return EINVAL; } static __noinline int ieee80211_ioctl_getregdomain(struct ieee80211vap *vap, const struct ieee80211req *ireq) { struct ieee80211com *ic = vap->iv_ic; if (ireq->i_len != sizeof(ic->ic_regdomain)) return EINVAL; return copyout(&ic->ic_regdomain, ireq->i_data, sizeof(ic->ic_regdomain)); } static __noinline int ieee80211_ioctl_getroam(struct ieee80211vap *vap, const struct ieee80211req *ireq) { size_t len = ireq->i_len; /* NB: accept short requests for backwards compat */ if (len > sizeof(vap->iv_roamparms)) len = sizeof(vap->iv_roamparms); return copyout(vap->iv_roamparms, ireq->i_data, len); } static __noinline int ieee80211_ioctl_gettxparams(struct ieee80211vap *vap, const struct ieee80211req *ireq) { size_t len = ireq->i_len; /* NB: accept short requests for backwards compat */ if (len > sizeof(vap->iv_txparms)) len = sizeof(vap->iv_txparms); return copyout(vap->iv_txparms, ireq->i_data, len); } static __noinline int ieee80211_ioctl_getdevcaps(struct ieee80211com *ic, const struct ieee80211req *ireq) { struct ieee80211_devcaps_req *dc; struct ieee80211req_chaninfo *ci; int maxchans, error; maxchans = 1 + ((ireq->i_len - sizeof(struct ieee80211_devcaps_req)) / sizeof(struct ieee80211_channel)); /* NB: require 1 so we know ic_nchans is accessible */ if (maxchans < 1) return EINVAL; /* constrain max request size, 2K channels is ~24Kbytes */ if (maxchans > 2048) maxchans = 2048; dc = (struct ieee80211_devcaps_req *) malloc(IEEE80211_DEVCAPS_SIZE(maxchans), M_TEMP, M_NOWAIT | M_ZERO); if (dc == NULL) return ENOMEM; dc->dc_drivercaps = ic->ic_caps; dc->dc_cryptocaps = ic->ic_cryptocaps; dc->dc_htcaps = ic->ic_htcaps; ci = &dc->dc_chaninfo; ic->ic_getradiocaps(ic, maxchans, &ci->ic_nchans, ci->ic_chans); KASSERT(ci->ic_nchans <= maxchans, ("nchans %d maxchans %d", ci->ic_nchans, maxchans)); ieee80211_sort_channels(ci->ic_chans, ci->ic_nchans); error = copyout(dc, ireq->i_data, IEEE80211_DEVCAPS_SPACE(dc)); free(dc, M_TEMP); return error; } static __noinline int ieee80211_ioctl_getstavlan(struct ieee80211vap *vap, struct ieee80211req *ireq) { struct ieee80211_node *ni; struct ieee80211req_sta_vlan vlan; int error; if (ireq->i_len != sizeof(vlan)) return EINVAL; error = copyin(ireq->i_data, &vlan, sizeof(vlan)); if (error != 0) return error; if (!IEEE80211_ADDR_EQ(vlan.sv_macaddr, zerobssid)) { ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap, vlan.sv_macaddr); if (ni == NULL) return ENOENT; } else ni = ieee80211_ref_node(vap->iv_bss); vlan.sv_vlan = ni->ni_vlan; error = copyout(&vlan, ireq->i_data, sizeof(vlan)); ieee80211_free_node(ni); return error; } /* * Dummy ioctl get handler so the linker set is defined. */ static int dummy_ioctl_get(struct ieee80211vap *vap, struct ieee80211req *ireq) { return ENOSYS; } IEEE80211_IOCTL_GET(dummy, dummy_ioctl_get); static int ieee80211_ioctl_getdefault(struct ieee80211vap *vap, struct ieee80211req *ireq) { ieee80211_ioctl_getfunc * const *get; int error; SET_FOREACH(get, ieee80211_ioctl_getset) { error = (*get)(vap, ireq); if (error != ENOSYS) return error; } return EINVAL; } /* * When building the kernel with -O2 on the i386 architecture, gcc * seems to want to inline this function into ieee80211_ioctl() * (which is the only routine that calls it). When this happens, * ieee80211_ioctl() ends up consuming an additional 2K of stack * space. (Exactly why it needs so much is unclear.) The problem * is that it's possible for ieee80211_ioctl() to invoke other * routines (including driver init functions) which could then find * themselves perilously close to exhausting the stack. * * To avoid this, we deliberately prevent gcc from inlining this * routine. Another way to avoid this is to use less agressive * optimization when compiling this file (i.e. -O instead of -O2) * but special-casing the compilation of this one module in the * build system would be awkward. */ static __noinline int ieee80211_ioctl_get80211(struct ieee80211vap *vap, u_long cmd, struct ieee80211req *ireq) { #define MS(_v, _f) (((_v) & _f) >> _f##_S) struct ieee80211com *ic = vap->iv_ic; u_int kid, len; uint8_t tmpkey[IEEE80211_KEYBUF_SIZE]; char tmpssid[IEEE80211_NWID_LEN]; int error = 0; switch (ireq->i_type) { case IEEE80211_IOC_SSID: switch (vap->iv_state) { case IEEE80211_S_INIT: case IEEE80211_S_SCAN: ireq->i_len = vap->iv_des_ssid[0].len; memcpy(tmpssid, vap->iv_des_ssid[0].ssid, ireq->i_len); break; default: ireq->i_len = vap->iv_bss->ni_esslen; memcpy(tmpssid, vap->iv_bss->ni_essid, ireq->i_len); break; } error = copyout(tmpssid, ireq->i_data, ireq->i_len); break; case IEEE80211_IOC_NUMSSIDS: ireq->i_val = 1; break; case IEEE80211_IOC_WEP: if ((vap->iv_flags & IEEE80211_F_PRIVACY) == 0) ireq->i_val = IEEE80211_WEP_OFF; else if (vap->iv_flags & IEEE80211_F_DROPUNENC) ireq->i_val = IEEE80211_WEP_ON; else ireq->i_val = IEEE80211_WEP_MIXED; break; case IEEE80211_IOC_WEPKEY: kid = (u_int) ireq->i_val; if (kid >= IEEE80211_WEP_NKID) return EINVAL; len = (u_int) vap->iv_nw_keys[kid].wk_keylen; /* NB: only root can read WEP keys */ if (priv_check(curthread, PRIV_NET80211_GETKEY) == 0) { bcopy(vap->iv_nw_keys[kid].wk_key, tmpkey, len); } else { bzero(tmpkey, len); } ireq->i_len = len; error = copyout(tmpkey, ireq->i_data, len); break; case IEEE80211_IOC_NUMWEPKEYS: ireq->i_val = IEEE80211_WEP_NKID; break; case IEEE80211_IOC_WEPTXKEY: ireq->i_val = vap->iv_def_txkey; break; case IEEE80211_IOC_AUTHMODE: if (vap->iv_flags & IEEE80211_F_WPA) ireq->i_val = IEEE80211_AUTH_WPA; else ireq->i_val = vap->iv_bss->ni_authmode; break; case IEEE80211_IOC_CHANNEL: ireq->i_val = ieee80211_chan2ieee(ic, ic->ic_curchan); break; case IEEE80211_IOC_POWERSAVE: if (vap->iv_flags & IEEE80211_F_PMGTON) ireq->i_val = IEEE80211_POWERSAVE_ON; else ireq->i_val = IEEE80211_POWERSAVE_OFF; break; case IEEE80211_IOC_POWERSAVESLEEP: ireq->i_val = ic->ic_lintval; break; case IEEE80211_IOC_RTSTHRESHOLD: ireq->i_val = vap->iv_rtsthreshold; break; case IEEE80211_IOC_PROTMODE: ireq->i_val = ic->ic_protmode; break; case IEEE80211_IOC_TXPOWER: /* * Tx power limit is the min of max regulatory * power, any user-set limit, and the max the * radio can do. */ ireq->i_val = 2*ic->ic_curchan->ic_maxregpower; if (ireq->i_val > ic->ic_txpowlimit) ireq->i_val = ic->ic_txpowlimit; if (ireq->i_val > ic->ic_curchan->ic_maxpower) ireq->i_val = ic->ic_curchan->ic_maxpower; break; case IEEE80211_IOC_WPA: switch (vap->iv_flags & IEEE80211_F_WPA) { case IEEE80211_F_WPA1: ireq->i_val = 1; break; case IEEE80211_F_WPA2: ireq->i_val = 2; break; case IEEE80211_F_WPA1 | IEEE80211_F_WPA2: ireq->i_val = 3; break; default: ireq->i_val = 0; break; } break; case IEEE80211_IOC_CHANLIST: error = ieee80211_ioctl_getchanlist(vap, ireq); break; case IEEE80211_IOC_ROAMING: ireq->i_val = vap->iv_roaming; break; case IEEE80211_IOC_PRIVACY: ireq->i_val = (vap->iv_flags & IEEE80211_F_PRIVACY) != 0; break; case IEEE80211_IOC_DROPUNENCRYPTED: ireq->i_val = (vap->iv_flags & IEEE80211_F_DROPUNENC) != 0; break; case IEEE80211_IOC_COUNTERMEASURES: ireq->i_val = (vap->iv_flags & IEEE80211_F_COUNTERM) != 0; break; case IEEE80211_IOC_WME: ireq->i_val = (vap->iv_flags & IEEE80211_F_WME) != 0; break; case IEEE80211_IOC_HIDESSID: ireq->i_val = (vap->iv_flags & IEEE80211_F_HIDESSID) != 0; break; case IEEE80211_IOC_APBRIDGE: ireq->i_val = (vap->iv_flags & IEEE80211_F_NOBRIDGE) == 0; break; case IEEE80211_IOC_WPAKEY: error = ieee80211_ioctl_getkey(vap, ireq); break; case IEEE80211_IOC_CHANINFO: error = ieee80211_ioctl_getchaninfo(vap, ireq); break; case IEEE80211_IOC_BSSID: if (ireq->i_len != IEEE80211_ADDR_LEN) return EINVAL; if (vap->iv_state == IEEE80211_S_RUN) { error = copyout(vap->iv_opmode == IEEE80211_M_WDS ? vap->iv_bss->ni_macaddr : vap->iv_bss->ni_bssid, ireq->i_data, ireq->i_len); } else error = copyout(vap->iv_des_bssid, ireq->i_data, ireq->i_len); break; case IEEE80211_IOC_WPAIE: error = ieee80211_ioctl_getwpaie(vap, ireq, ireq->i_type); break; case IEEE80211_IOC_WPAIE2: error = ieee80211_ioctl_getwpaie(vap, ireq, ireq->i_type); break; case IEEE80211_IOC_SCAN_RESULTS: error = ieee80211_ioctl_getscanresults(vap, ireq); break; case IEEE80211_IOC_STA_STATS: error = ieee80211_ioctl_getstastats(vap, ireq); break; case IEEE80211_IOC_TXPOWMAX: ireq->i_val = vap->iv_bss->ni_txpower; break; case IEEE80211_IOC_STA_TXPOW: error = ieee80211_ioctl_getstatxpow(vap, ireq); break; case IEEE80211_IOC_STA_INFO: error = ieee80211_ioctl_getstainfo(vap, ireq); break; case IEEE80211_IOC_WME_CWMIN: /* WME: CWmin */ case IEEE80211_IOC_WME_CWMAX: /* WME: CWmax */ case IEEE80211_IOC_WME_AIFS: /* WME: AIFS */ case IEEE80211_IOC_WME_TXOPLIMIT: /* WME: txops limit */ case IEEE80211_IOC_WME_ACM: /* WME: ACM (bss only) */ case IEEE80211_IOC_WME_ACKPOLICY: /* WME: ACK policy (bss only) */ error = ieee80211_ioctl_getwmeparam(vap, ireq); break; case IEEE80211_IOC_DTIM_PERIOD: ireq->i_val = vap->iv_dtim_period; break; case IEEE80211_IOC_BEACON_INTERVAL: /* NB: get from ic_bss for station mode */ ireq->i_val = vap->iv_bss->ni_intval; break; case IEEE80211_IOC_PUREG: ireq->i_val = (vap->iv_flags & IEEE80211_F_PUREG) != 0; break; case IEEE80211_IOC_BGSCAN: ireq->i_val = (vap->iv_flags & IEEE80211_F_BGSCAN) != 0; break; case IEEE80211_IOC_BGSCAN_IDLE: ireq->i_val = vap->iv_bgscanidle*hz/1000; /* ms */ break; case IEEE80211_IOC_BGSCAN_INTERVAL: ireq->i_val = vap->iv_bgscanintvl/hz; /* seconds */ break; case IEEE80211_IOC_SCANVALID: ireq->i_val = vap->iv_scanvalid/hz; /* seconds */ break; case IEEE80211_IOC_FRAGTHRESHOLD: ireq->i_val = vap->iv_fragthreshold; break; case IEEE80211_IOC_MACCMD: error = ieee80211_ioctl_getmaccmd(vap, ireq); break; case IEEE80211_IOC_BURST: ireq->i_val = (vap->iv_flags & IEEE80211_F_BURST) != 0; break; case IEEE80211_IOC_BMISSTHRESHOLD: ireq->i_val = vap->iv_bmissthreshold; break; case IEEE80211_IOC_CURCHAN: error = ieee80211_ioctl_getcurchan(vap, ireq); break; case IEEE80211_IOC_SHORTGI: ireq->i_val = 0; if (vap->iv_flags_ht & IEEE80211_FHT_SHORTGI20) ireq->i_val |= IEEE80211_HTCAP_SHORTGI20; if (vap->iv_flags_ht & IEEE80211_FHT_SHORTGI40) ireq->i_val |= IEEE80211_HTCAP_SHORTGI40; break; case IEEE80211_IOC_AMPDU: ireq->i_val = 0; if (vap->iv_flags_ht & IEEE80211_FHT_AMPDU_TX) ireq->i_val |= 1; if (vap->iv_flags_ht & IEEE80211_FHT_AMPDU_RX) ireq->i_val |= 2; break; case IEEE80211_IOC_AMPDU_LIMIT: if (vap->iv_opmode == IEEE80211_M_HOSTAP) ireq->i_val = vap->iv_ampdu_rxmax; else if (vap->iv_state == IEEE80211_S_RUN) ireq->i_val = MS(vap->iv_bss->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU); else ireq->i_val = vap->iv_ampdu_limit; break; case IEEE80211_IOC_AMPDU_DENSITY: if (vap->iv_opmode == IEEE80211_M_STA && vap->iv_state == IEEE80211_S_RUN) ireq->i_val = MS(vap->iv_bss->ni_htparam, IEEE80211_HTCAP_MPDUDENSITY); else ireq->i_val = vap->iv_ampdu_density; break; case IEEE80211_IOC_AMSDU: ireq->i_val = 0; if (vap->iv_flags_ht & IEEE80211_FHT_AMSDU_TX) ireq->i_val |= 1; if (vap->iv_flags_ht & IEEE80211_FHT_AMSDU_RX) ireq->i_val |= 2; break; case IEEE80211_IOC_AMSDU_LIMIT: ireq->i_val = vap->iv_amsdu_limit; /* XXX truncation? */ break; case IEEE80211_IOC_PUREN: ireq->i_val = (vap->iv_flags_ht & IEEE80211_FHT_PUREN) != 0; break; case IEEE80211_IOC_DOTH: ireq->i_val = (vap->iv_flags & IEEE80211_F_DOTH) != 0; break; case IEEE80211_IOC_REGDOMAIN: error = ieee80211_ioctl_getregdomain(vap, ireq); break; case IEEE80211_IOC_ROAM: error = ieee80211_ioctl_getroam(vap, ireq); break; case IEEE80211_IOC_TXPARAMS: error = ieee80211_ioctl_gettxparams(vap, ireq); break; case IEEE80211_IOC_HTCOMPAT: ireq->i_val = (vap->iv_flags_ht & IEEE80211_FHT_HTCOMPAT) != 0; break; case IEEE80211_IOC_DWDS: ireq->i_val = (vap->iv_flags & IEEE80211_F_DWDS) != 0; break; case IEEE80211_IOC_INACTIVITY: ireq->i_val = (vap->iv_flags_ext & IEEE80211_FEXT_INACT) != 0; break; case IEEE80211_IOC_APPIE: error = ieee80211_ioctl_getappie(vap, ireq); break; case IEEE80211_IOC_WPS: ireq->i_val = (vap->iv_flags_ext & IEEE80211_FEXT_WPS) != 0; break; case IEEE80211_IOC_TSN: ireq->i_val = (vap->iv_flags_ext & IEEE80211_FEXT_TSN) != 0; break; case IEEE80211_IOC_DFS: ireq->i_val = (vap->iv_flags_ext & IEEE80211_FEXT_DFS) != 0; break; case IEEE80211_IOC_DOTD: ireq->i_val = (vap->iv_flags_ext & IEEE80211_FEXT_DOTD) != 0; break; case IEEE80211_IOC_DEVCAPS: error = ieee80211_ioctl_getdevcaps(ic, ireq); break; case IEEE80211_IOC_HTPROTMODE: ireq->i_val = ic->ic_htprotmode; break; case IEEE80211_IOC_HTCONF: if (vap->iv_flags_ht & IEEE80211_FHT_HT) { ireq->i_val = 1; if (vap->iv_flags_ht & IEEE80211_FHT_USEHT40) ireq->i_val |= 2; } else ireq->i_val = 0; break; case IEEE80211_IOC_STA_VLAN: error = ieee80211_ioctl_getstavlan(vap, ireq); break; case IEEE80211_IOC_SMPS: if (vap->iv_opmode == IEEE80211_M_STA && vap->iv_state == IEEE80211_S_RUN) { if (vap->iv_bss->ni_flags & IEEE80211_NODE_MIMO_RTS) ireq->i_val = IEEE80211_HTCAP_SMPS_DYNAMIC; else if (vap->iv_bss->ni_flags & IEEE80211_NODE_MIMO_PS) ireq->i_val = IEEE80211_HTCAP_SMPS_ENA; else ireq->i_val = IEEE80211_HTCAP_SMPS_OFF; } else ireq->i_val = vap->iv_htcaps & IEEE80211_HTCAP_SMPS; break; case IEEE80211_IOC_RIFS: if (vap->iv_opmode == IEEE80211_M_STA && vap->iv_state == IEEE80211_S_RUN) ireq->i_val = (vap->iv_bss->ni_flags & IEEE80211_NODE_RIFS) != 0; else ireq->i_val = (vap->iv_flags_ht & IEEE80211_FHT_RIFS) != 0; break; default: error = ieee80211_ioctl_getdefault(vap, ireq); break; } return error; #undef MS } static __noinline int ieee80211_ioctl_setkey(struct ieee80211vap *vap, struct ieee80211req *ireq) { struct ieee80211req_key ik; struct ieee80211_node *ni; struct ieee80211_key *wk; uint16_t kid; int error, i; if (ireq->i_len != sizeof(ik)) return EINVAL; error = copyin(ireq->i_data, &ik, sizeof(ik)); if (error) return error; /* NB: cipher support is verified by ieee80211_crypt_newkey */ /* NB: this also checks ik->ik_keylen > sizeof(wk->wk_key) */ if (ik.ik_keylen > sizeof(ik.ik_keydata)) return E2BIG; kid = ik.ik_keyix; if (kid == IEEE80211_KEYIX_NONE) { /* XXX unicast keys currently must be tx/rx */ if (ik.ik_flags != (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV)) return EINVAL; if (vap->iv_opmode == IEEE80211_M_STA) { ni = ieee80211_ref_node(vap->iv_bss); if (!IEEE80211_ADDR_EQ(ik.ik_macaddr, ni->ni_bssid)) { ieee80211_free_node(ni); return EADDRNOTAVAIL; } } else { ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap, ik.ik_macaddr); if (ni == NULL) return ENOENT; } wk = &ni->ni_ucastkey; } else { if (kid >= IEEE80211_WEP_NKID) return EINVAL; wk = &vap->iv_nw_keys[kid]; /* * Global slots start off w/o any assigned key index. * Force one here for consistency with IEEE80211_IOC_WEPKEY. */ if (wk->wk_keyix == IEEE80211_KEYIX_NONE) wk->wk_keyix = kid; ni = NULL; } error = 0; ieee80211_key_update_begin(vap); if (ieee80211_crypto_newkey(vap, ik.ik_type, ik.ik_flags, wk)) { wk->wk_keylen = ik.ik_keylen; /* NB: MIC presence is implied by cipher type */ if (wk->wk_keylen > IEEE80211_KEYBUF_SIZE) wk->wk_keylen = IEEE80211_KEYBUF_SIZE; for (i = 0; i < IEEE80211_TID_SIZE; i++) wk->wk_keyrsc[i] = ik.ik_keyrsc; wk->wk_keytsc = 0; /* new key, reset */ memset(wk->wk_key, 0, sizeof(wk->wk_key)); memcpy(wk->wk_key, ik.ik_keydata, ik.ik_keylen); IEEE80211_ADDR_COPY(wk->wk_macaddr, ni != NULL ? ni->ni_macaddr : ik.ik_macaddr); if (!ieee80211_crypto_setkey(vap, wk)) error = EIO; else if ((ik.ik_flags & IEEE80211_KEY_DEFAULT)) vap->iv_def_txkey = kid; } else error = ENXIO; ieee80211_key_update_end(vap); if (ni != NULL) ieee80211_free_node(ni); return error; } static __noinline int ieee80211_ioctl_delkey(struct ieee80211vap *vap, struct ieee80211req *ireq) { struct ieee80211req_del_key dk; int kid, error; if (ireq->i_len != sizeof(dk)) return EINVAL; error = copyin(ireq->i_data, &dk, sizeof(dk)); if (error) return error; kid = dk.idk_keyix; /* XXX uint8_t -> uint16_t */ if (dk.idk_keyix == (uint8_t) IEEE80211_KEYIX_NONE) { struct ieee80211_node *ni; if (vap->iv_opmode == IEEE80211_M_STA) { ni = ieee80211_ref_node(vap->iv_bss); if (!IEEE80211_ADDR_EQ(dk.idk_macaddr, ni->ni_bssid)) { ieee80211_free_node(ni); return EADDRNOTAVAIL; } } else { ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap, dk.idk_macaddr); if (ni == NULL) return ENOENT; } /* XXX error return */ ieee80211_node_delucastkey(ni); ieee80211_free_node(ni); } else { if (kid >= IEEE80211_WEP_NKID) return EINVAL; /* XXX error return */ ieee80211_crypto_delkey(vap, &vap->iv_nw_keys[kid]); } return 0; } struct mlmeop { struct ieee80211vap *vap; int op; int reason; }; static void mlmedebug(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN], int op, int reason) { #ifdef IEEE80211_DEBUG static const struct { int mask; const char *opstr; } ops[] = { { 0, "op#0" }, { IEEE80211_MSG_IOCTL | IEEE80211_MSG_STATE | IEEE80211_MSG_ASSOC, "assoc" }, { IEEE80211_MSG_IOCTL | IEEE80211_MSG_STATE | IEEE80211_MSG_ASSOC, "disassoc" }, { IEEE80211_MSG_IOCTL | IEEE80211_MSG_STATE | IEEE80211_MSG_AUTH, "deauth" }, { IEEE80211_MSG_IOCTL | IEEE80211_MSG_STATE | IEEE80211_MSG_AUTH, "authorize" }, { IEEE80211_MSG_IOCTL | IEEE80211_MSG_STATE | IEEE80211_MSG_AUTH, "unauthorize" }, }; if (op == IEEE80211_MLME_AUTH) { IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_IOCTL | IEEE80211_MSG_STATE | IEEE80211_MSG_AUTH, mac, "station authenticate %s via MLME (reason %d)", reason == IEEE80211_STATUS_SUCCESS ? "ACCEPT" : "REJECT", reason); } else if (!(IEEE80211_MLME_ASSOC <= op && op <= IEEE80211_MLME_AUTH)) { IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_ANY, mac, "unknown MLME request %d (reason %d)", op, reason); } else if (reason == IEEE80211_STATUS_SUCCESS) { IEEE80211_NOTE_MAC(vap, ops[op].mask, mac, "station %s via MLME", ops[op].opstr); } else { IEEE80211_NOTE_MAC(vap, ops[op].mask, mac, "station %s via MLME (reason %d)", ops[op].opstr, reason); } #endif /* IEEE80211_DEBUG */ } static void domlme(void *arg, struct ieee80211_node *ni) { struct mlmeop *mop = arg; struct ieee80211vap *vap = ni->ni_vap; if (vap != mop->vap) return; /* * NB: if ni_associd is zero then the node is already cleaned * up and we don't need to do this (we're safely holding a * reference but should otherwise not modify it's state). */ if (ni->ni_associd == 0) return; mlmedebug(vap, ni->ni_macaddr, mop->op, mop->reason); if (mop->op == IEEE80211_MLME_DEAUTH) { IEEE80211_SEND_MGMT(ni, IEEE80211_FC0_SUBTYPE_DEAUTH, mop->reason); } else { IEEE80211_SEND_MGMT(ni, IEEE80211_FC0_SUBTYPE_DISASSOC, mop->reason); } ieee80211_node_leave(ni); } static int setmlme_dropsta(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN], struct mlmeop *mlmeop) { struct ieee80211com *ic = vap->iv_ic; struct ieee80211_node_table *nt = &ic->ic_sta; struct ieee80211_node *ni; int error = 0; /* NB: the broadcast address means do 'em all */ if (!IEEE80211_ADDR_EQ(mac, ic->ic_ifp->if_broadcastaddr)) { IEEE80211_NODE_LOCK(nt); ni = ieee80211_find_node_locked(nt, mac); if (ni != NULL) { domlme(mlmeop, ni); ieee80211_free_node(ni); } else error = ENOENT; IEEE80211_NODE_UNLOCK(nt); } else { ieee80211_iterate_nodes(nt, domlme, mlmeop); } return error; } static __noinline int setmlme_common(struct ieee80211vap *vap, int op, const uint8_t mac[IEEE80211_ADDR_LEN], int reason) { struct ieee80211com *ic = vap->iv_ic; struct ieee80211_node_table *nt = &ic->ic_sta; struct ieee80211_node *ni; struct mlmeop mlmeop; int error; error = 0; switch (op) { case IEEE80211_MLME_DISASSOC: case IEEE80211_MLME_DEAUTH: switch (vap->iv_opmode) { case IEEE80211_M_STA: mlmedebug(vap, vap->iv_bss->ni_macaddr, op, reason); /* XXX not quite right */ ieee80211_new_state(vap, IEEE80211_S_INIT, reason); break; case IEEE80211_M_HOSTAP: mlmeop.vap = vap; mlmeop.op = op; mlmeop.reason = reason; error = setmlme_dropsta(vap, mac, &mlmeop); break; case IEEE80211_M_WDS: /* XXX user app should send raw frame? */ if (op != IEEE80211_MLME_DEAUTH) { error = EINVAL; break; } #if 0 /* XXX accept any address, simplifies user code */ if (!IEEE80211_ADDR_EQ(mac, vap->iv_bss->ni_macaddr)) { error = EINVAL; break; } #endif mlmedebug(vap, vap->iv_bss->ni_macaddr, op, reason); ni = ieee80211_ref_node(vap->iv_bss); IEEE80211_SEND_MGMT(ni, IEEE80211_FC0_SUBTYPE_DEAUTH, reason); ieee80211_free_node(ni); break; default: error = EINVAL; break; } break; case IEEE80211_MLME_AUTHORIZE: case IEEE80211_MLME_UNAUTHORIZE: if (vap->iv_opmode != IEEE80211_M_HOSTAP && vap->iv_opmode != IEEE80211_M_WDS) { error = EINVAL; break; } IEEE80211_NODE_LOCK(nt); ni = ieee80211_find_vap_node_locked(nt, vap, mac); if (ni != NULL) { mlmedebug(vap, mac, op, reason); if (op == IEEE80211_MLME_AUTHORIZE) ieee80211_node_authorize(ni); else ieee80211_node_unauthorize(ni); ieee80211_free_node(ni); } else error = ENOENT; IEEE80211_NODE_UNLOCK(nt); break; case IEEE80211_MLME_AUTH: if (vap->iv_opmode != IEEE80211_M_HOSTAP) { error = EINVAL; break; } IEEE80211_NODE_LOCK(nt); ni = ieee80211_find_vap_node_locked(nt, vap, mac); if (ni != NULL) { mlmedebug(vap, mac, op, reason); if (reason == IEEE80211_STATUS_SUCCESS) { IEEE80211_SEND_MGMT(ni, IEEE80211_FC0_SUBTYPE_AUTH, 2); /* * For shared key auth, just continue the * exchange. Otherwise when 802.1x is not in * use mark the port authorized at this point * so traffic can flow. */ if (ni->ni_authmode != IEEE80211_AUTH_8021X && ni->ni_challenge == NULL) ieee80211_node_authorize(ni); } else { vap->iv_stats.is_rx_acl++; ieee80211_send_error(ni, ni->ni_macaddr, IEEE80211_FC0_SUBTYPE_AUTH, 2|(reason<<16)); ieee80211_node_leave(ni); } ieee80211_free_node(ni); } else error = ENOENT; IEEE80211_NODE_UNLOCK(nt); break; default: error = EINVAL; break; } return error; } struct scanlookup { const uint8_t *mac; int esslen; const uint8_t *essid; const struct ieee80211_scan_entry *se; }; /* * Match mac address and any ssid. */ static void mlmelookup(void *arg, const struct ieee80211_scan_entry *se) { struct scanlookup *look = arg; if (!IEEE80211_ADDR_EQ(look->mac, se->se_macaddr)) return; if (look->esslen != 0) { if (se->se_ssid[1] != look->esslen) return; if (memcmp(look->essid, se->se_ssid+2, look->esslen)) return; } look->se = se; } static __noinline int setmlme_assoc_sta(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN], int ssid_len, const uint8_t ssid[IEEE80211_NWID_LEN]) { struct scanlookup lookup; KASSERT(vap->iv_opmode == IEEE80211_M_STA, ("expected opmode STA not %s", ieee80211_opmode_name[vap->iv_opmode])); /* NB: this is racey if roaming is !manual */ lookup.se = NULL; lookup.mac = mac; lookup.esslen = ssid_len; lookup.essid = ssid; ieee80211_scan_iterate(vap, mlmelookup, &lookup); if (lookup.se == NULL) return ENOENT; mlmedebug(vap, mac, IEEE80211_MLME_ASSOC, 0); if (!ieee80211_sta_join(vap, lookup.se->se_chan, lookup.se)) return EIO; /* XXX unique but could be better */ return 0; } static __noinline int setmlme_assoc_adhoc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN], int ssid_len, const uint8_t ssid[IEEE80211_NWID_LEN]) { struct ieee80211_scan_req sr; KASSERT(vap->iv_opmode == IEEE80211_M_IBSS || vap->iv_opmode == IEEE80211_M_AHDEMO, ("expected opmode IBSS or AHDEMO not %s", ieee80211_opmode_name[vap->iv_opmode])); if (ssid_len == 0) return EINVAL; /* NB: IEEE80211_IOC_SSID call missing for ap_scan=2. */ memset(vap->iv_des_ssid[0].ssid, 0, IEEE80211_NWID_LEN); vap->iv_des_ssid[0].len = ssid_len; memcpy(vap->iv_des_ssid[0].ssid, ssid, ssid_len); vap->iv_des_nssid = 1; memset(&sr, 0, sizeof(sr)); sr.sr_flags = IEEE80211_IOC_SCAN_ACTIVE | IEEE80211_IOC_SCAN_ONCE; sr.sr_duration = IEEE80211_IOC_SCAN_FOREVER; memcpy(sr.sr_ssid[0].ssid, ssid, ssid_len); sr.sr_ssid[0].len = ssid_len; sr.sr_nssid = 1; return ieee80211_scanreq(vap, &sr); } static __noinline int ieee80211_ioctl_setmlme(struct ieee80211vap *vap, struct ieee80211req *ireq) { struct ieee80211req_mlme mlme; int error; if (ireq->i_len != sizeof(mlme)) return EINVAL; error = copyin(ireq->i_data, &mlme, sizeof(mlme)); if (error) return error; if (vap->iv_opmode == IEEE80211_M_STA && mlme.im_op == IEEE80211_MLME_ASSOC) return setmlme_assoc_sta(vap, mlme.im_macaddr, vap->iv_des_ssid[0].len, vap->iv_des_ssid[0].ssid); else if (mlme.im_op == IEEE80211_MLME_ASSOC) return setmlme_assoc_adhoc(vap, mlme.im_macaddr, mlme.im_ssid_len, mlme.im_ssid); else return setmlme_common(vap, mlme.im_op, mlme.im_macaddr, mlme.im_reason); } static __noinline int ieee80211_ioctl_macmac(struct ieee80211vap *vap, struct ieee80211req *ireq) { uint8_t mac[IEEE80211_ADDR_LEN]; const struct ieee80211_aclator *acl = vap->iv_acl; int error; if (ireq->i_len != sizeof(mac)) return EINVAL; error = copyin(ireq->i_data, mac, ireq->i_len); if (error) return error; if (acl == NULL) { acl = ieee80211_aclator_get("mac"); if (acl == NULL || !acl->iac_attach(vap)) return EINVAL; vap->iv_acl = acl; } if (ireq->i_type == IEEE80211_IOC_ADDMAC) acl->iac_add(vap, mac); else acl->iac_remove(vap, mac); return 0; } static __noinline int ieee80211_ioctl_setmaccmd(struct ieee80211vap *vap, struct ieee80211req *ireq) { const struct ieee80211_aclator *acl = vap->iv_acl; switch (ireq->i_val) { case IEEE80211_MACCMD_POLICY_OPEN: case IEEE80211_MACCMD_POLICY_ALLOW: case IEEE80211_MACCMD_POLICY_DENY: case IEEE80211_MACCMD_POLICY_RADIUS: if (acl == NULL) { acl = ieee80211_aclator_get("mac"); if (acl == NULL || !acl->iac_attach(vap)) return EINVAL; vap->iv_acl = acl; } acl->iac_setpolicy(vap, ireq->i_val); break; case IEEE80211_MACCMD_FLUSH: if (acl != NULL) acl->iac_flush(vap); /* NB: silently ignore when not in use */ break; case IEEE80211_MACCMD_DETACH: if (acl != NULL) { vap->iv_acl = NULL; acl->iac_detach(vap); } break; default: if (acl == NULL) return EINVAL; else return acl->iac_setioctl(vap, ireq); } return 0; } static __noinline int ieee80211_ioctl_setchanlist(struct ieee80211vap *vap, struct ieee80211req *ireq) { struct ieee80211com *ic = vap->iv_ic; uint8_t *chanlist, *list; int i, nchan, maxchan, error; if (ireq->i_len > sizeof(ic->ic_chan_active)) ireq->i_len = sizeof(ic->ic_chan_active); list = malloc(ireq->i_len + IEEE80211_CHAN_BYTES, M_TEMP, M_NOWAIT | M_ZERO); if (list == NULL) return ENOMEM; error = copyin(ireq->i_data, list, ireq->i_len); if (error) { free(list, M_TEMP); return error; } nchan = 0; chanlist = list + ireq->i_len; /* NB: zero'd already */ maxchan = ireq->i_len * NBBY; for (i = 0; i < ic->ic_nchans; i++) { const struct ieee80211_channel *c = &ic->ic_channels[i]; /* * Calculate the intersection of the user list and the * available channels so users can do things like specify * 1-255 to get all available channels. */ if (c->ic_ieee < maxchan && isset(list, c->ic_ieee)) { setbit(chanlist, c->ic_ieee); nchan++; } } if (nchan == 0) { free(list, M_TEMP); return EINVAL; } if (ic->ic_bsschan != IEEE80211_CHAN_ANYC && /* XXX */ isclr(chanlist, ic->ic_bsschan->ic_ieee)) ic->ic_bsschan = IEEE80211_CHAN_ANYC; memcpy(ic->ic_chan_active, chanlist, IEEE80211_CHAN_BYTES); ieee80211_scan_flush(vap); free(list, M_TEMP); return ENETRESET; } static __noinline int ieee80211_ioctl_setstastats(struct ieee80211vap *vap, struct ieee80211req *ireq) { struct ieee80211_node *ni; uint8_t macaddr[IEEE80211_ADDR_LEN]; int error; /* * NB: we could copyin ieee80211req_sta_stats so apps * could make selective changes but that's overkill; * just clear all stats for now. */ if (ireq->i_len < IEEE80211_ADDR_LEN) return EINVAL; error = copyin(ireq->i_data, macaddr, IEEE80211_ADDR_LEN); if (error != 0) return error; ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap, macaddr); if (ni == NULL) return ENOENT; /* XXX require ni_vap == vap? */ memset(&ni->ni_stats, 0, sizeof(ni->ni_stats)); ieee80211_free_node(ni); return 0; } static __noinline int ieee80211_ioctl_setstatxpow(struct ieee80211vap *vap, struct ieee80211req *ireq) { struct ieee80211_node *ni; struct ieee80211req_sta_txpow txpow; int error; if (ireq->i_len != sizeof(txpow)) return EINVAL; error = copyin(ireq->i_data, &txpow, sizeof(txpow)); if (error != 0) return error; ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap, txpow.it_macaddr); if (ni == NULL) return ENOENT; ni->ni_txpower = txpow.it_txpow; ieee80211_free_node(ni); return error; } static __noinline int ieee80211_ioctl_setwmeparam(struct ieee80211vap *vap, struct ieee80211req *ireq) { struct ieee80211com *ic = vap->iv_ic; struct ieee80211_wme_state *wme = &ic->ic_wme; struct wmeParams *wmep, *chanp; int isbss, ac; if ((ic->ic_caps & IEEE80211_C_WME) == 0) return EOPNOTSUPP; isbss = (ireq->i_len & IEEE80211_WMEPARAM_BSS); ac = (ireq->i_len & IEEE80211_WMEPARAM_VAL); if (ac >= WME_NUM_AC) ac = WME_AC_BE; if (isbss) { chanp = &wme->wme_bssChanParams.cap_wmeParams[ac]; wmep = &wme->wme_wmeBssChanParams.cap_wmeParams[ac]; } else { chanp = &wme->wme_chanParams.cap_wmeParams[ac]; wmep = &wme->wme_wmeChanParams.cap_wmeParams[ac]; } switch (ireq->i_type) { case IEEE80211_IOC_WME_CWMIN: /* WME: CWmin */ if (isbss) { wmep->wmep_logcwmin = ireq->i_val; if ((wme->wme_flags & WME_F_AGGRMODE) == 0) chanp->wmep_logcwmin = ireq->i_val; } else { wmep->wmep_logcwmin = chanp->wmep_logcwmin = ireq->i_val; } break; case IEEE80211_IOC_WME_CWMAX: /* WME: CWmax */ if (isbss) { wmep->wmep_logcwmax = ireq->i_val; if ((wme->wme_flags & WME_F_AGGRMODE) == 0) chanp->wmep_logcwmax = ireq->i_val; } else { wmep->wmep_logcwmax = chanp->wmep_logcwmax = ireq->i_val; } break; case IEEE80211_IOC_WME_AIFS: /* WME: AIFS */ if (isbss) { wmep->wmep_aifsn = ireq->i_val; if ((wme->wme_flags & WME_F_AGGRMODE) == 0) chanp->wmep_aifsn = ireq->i_val; } else { wmep->wmep_aifsn = chanp->wmep_aifsn = ireq->i_val; } break; case IEEE80211_IOC_WME_TXOPLIMIT: /* WME: txops limit */ if (isbss) { wmep->wmep_txopLimit = ireq->i_val; if ((wme->wme_flags & WME_F_AGGRMODE) == 0) chanp->wmep_txopLimit = ireq->i_val; } else { wmep->wmep_txopLimit = chanp->wmep_txopLimit = ireq->i_val; } break; case IEEE80211_IOC_WME_ACM: /* WME: ACM (bss only) */ wmep->wmep_acm = ireq->i_val; if ((wme->wme_flags & WME_F_AGGRMODE) == 0) chanp->wmep_acm = ireq->i_val; break; case IEEE80211_IOC_WME_ACKPOLICY: /* WME: ACK policy (!bss only)*/ wmep->wmep_noackPolicy = chanp->wmep_noackPolicy = (ireq->i_val) == 0; break; } ieee80211_wme_updateparams(vap); return 0; } static int find11gchannel(struct ieee80211com *ic, int start, int freq) { const struct ieee80211_channel *c; int i; for (i = start+1; i < ic->ic_nchans; i++) { c = &ic->ic_channels[i]; if (c->ic_freq == freq && IEEE80211_IS_CHAN_ANYG(c)) return 1; } /* NB: should not be needed but in case things are mis-sorted */ for (i = 0; i < start; i++) { c = &ic->ic_channels[i]; if (c->ic_freq == freq && IEEE80211_IS_CHAN_ANYG(c)) return 1; } return 0; } static struct ieee80211_channel * findchannel(struct ieee80211com *ic, int ieee, int mode) { static const u_int chanflags[IEEE80211_MODE_MAX] = { [IEEE80211_MODE_AUTO] = 0, [IEEE80211_MODE_11A] = IEEE80211_CHAN_A, [IEEE80211_MODE_11B] = IEEE80211_CHAN_B, [IEEE80211_MODE_11G] = IEEE80211_CHAN_G, [IEEE80211_MODE_FH] = IEEE80211_CHAN_FHSS, [IEEE80211_MODE_TURBO_A] = IEEE80211_CHAN_108A, [IEEE80211_MODE_TURBO_G] = IEEE80211_CHAN_108G, [IEEE80211_MODE_STURBO_A] = IEEE80211_CHAN_STURBO, [IEEE80211_MODE_HALF] = IEEE80211_CHAN_HALF, [IEEE80211_MODE_QUARTER] = IEEE80211_CHAN_QUARTER, /* NB: handled specially below */ [IEEE80211_MODE_11NA] = IEEE80211_CHAN_A, [IEEE80211_MODE_11NG] = IEEE80211_CHAN_G, }; u_int modeflags; int i; modeflags = chanflags[mode]; for (i = 0; i < ic->ic_nchans; i++) { struct ieee80211_channel *c = &ic->ic_channels[i]; if (c->ic_ieee != ieee) continue; if (mode == IEEE80211_MODE_AUTO) { /* ignore turbo channels for autoselect */ if (IEEE80211_IS_CHAN_TURBO(c)) continue; /* * XXX special-case 11b/g channels so we * always select the g channel if both * are present. * XXX prefer HT to non-HT? */ if (!IEEE80211_IS_CHAN_B(c) || !find11gchannel(ic, i, c->ic_freq)) return c; } else { /* must check HT specially */ if ((mode == IEEE80211_MODE_11NA || mode == IEEE80211_MODE_11NG) && !IEEE80211_IS_CHAN_HT(c)) continue; if ((c->ic_flags & modeflags) == modeflags) return c; } } return NULL; } /* * Check the specified against any desired mode (aka netband). * This is only used (presently) when operating in hostap mode * to enforce consistency. */ static int check_mode_consistency(const struct ieee80211_channel *c, int mode) { KASSERT(c != IEEE80211_CHAN_ANYC, ("oops, no channel")); switch (mode) { case IEEE80211_MODE_11B: return (IEEE80211_IS_CHAN_B(c)); case IEEE80211_MODE_11G: return (IEEE80211_IS_CHAN_ANYG(c) && !IEEE80211_IS_CHAN_HT(c)); case IEEE80211_MODE_11A: return (IEEE80211_IS_CHAN_A(c) && !IEEE80211_IS_CHAN_HT(c)); case IEEE80211_MODE_STURBO_A: return (IEEE80211_IS_CHAN_STURBO(c)); case IEEE80211_MODE_11NA: return (IEEE80211_IS_CHAN_HTA(c)); case IEEE80211_MODE_11NG: return (IEEE80211_IS_CHAN_HTG(c)); } return 1; } /* * Common code to set the current channel. If the device * is up and running this may result in an immediate channel * change or a kick of the state machine. */ static int setcurchan(struct ieee80211vap *vap, struct ieee80211_channel *c) { struct ieee80211com *ic = vap->iv_ic; int error; if (c != IEEE80211_CHAN_ANYC) { if (IEEE80211_IS_CHAN_RADAR(c)) return EBUSY; /* XXX better code? */ if (vap->iv_opmode == IEEE80211_M_HOSTAP) { if (IEEE80211_IS_CHAN_NOHOSTAP(c)) return EINVAL; if (!check_mode_consistency(c, vap->iv_des_mode)) return EINVAL; } else if (vap->iv_opmode == IEEE80211_M_IBSS) { if (IEEE80211_IS_CHAN_NOADHOC(c)) return EINVAL; } if (vap->iv_state == IEEE80211_S_RUN && vap->iv_bss->ni_chan == c) return 0; /* NB: nothing to do */ } vap->iv_des_chan = c; error = 0; if (vap->iv_opmode == IEEE80211_M_MONITOR && vap->iv_des_chan != IEEE80211_CHAN_ANYC) { /* * Monitor mode can switch directly. */ if (IFNET_IS_UP_RUNNING(vap->iv_ifp)) { /* XXX need state machine for other vap's to follow */ ieee80211_setcurchan(ic, vap->iv_des_chan); vap->iv_bss->ni_chan = ic->ic_curchan; } else ic->ic_curchan = vap->iv_des_chan; ic->ic_rt = ieee80211_get_ratetable(ic->ic_curchan); } else { /* * Need to go through the state machine in case we * need to reassociate or the like. The state machine * will pickup the desired channel and avoid scanning. */ if (IS_UP_AUTO(vap)) ieee80211_new_state(vap, IEEE80211_S_SCAN, 0); else if (vap->iv_des_chan != IEEE80211_CHAN_ANYC) { /* * When not up+running and a real channel has * been specified fix the current channel so * there is immediate feedback; e.g. via ifconfig. */ ic->ic_curchan = vap->iv_des_chan; ic->ic_rt = ieee80211_get_ratetable(ic->ic_curchan); } } return error; } /* * Old api for setting the current channel; this is * deprecated because channel numbers are ambiguous. */ static __noinline int ieee80211_ioctl_setchannel(struct ieee80211vap *vap, const struct ieee80211req *ireq) { struct ieee80211com *ic = vap->iv_ic; struct ieee80211_channel *c; /* XXX 0xffff overflows 16-bit signed */ if (ireq->i_val == 0 || ireq->i_val == (int16_t) IEEE80211_CHAN_ANY) { c = IEEE80211_CHAN_ANYC; } else { struct ieee80211_channel *c2; c = findchannel(ic, ireq->i_val, vap->iv_des_mode); if (c == NULL) { c = findchannel(ic, ireq->i_val, IEEE80211_MODE_AUTO); if (c == NULL) return EINVAL; } /* * Fine tune channel selection based on desired mode: * if 11b is requested, find the 11b version of any * 11g channel returned, * if static turbo, find the turbo version of any * 11a channel return, * if 11na is requested, find the ht version of any * 11a channel returned, * if 11ng is requested, find the ht version of any * 11g channel returned, * otherwise we should be ok with what we've got. */ switch (vap->iv_des_mode) { case IEEE80211_MODE_11B: if (IEEE80211_IS_CHAN_ANYG(c)) { c2 = findchannel(ic, ireq->i_val, IEEE80211_MODE_11B); /* NB: should not happen, =>'s 11g w/o 11b */ if (c2 != NULL) c = c2; } break; case IEEE80211_MODE_TURBO_A: if (IEEE80211_IS_CHAN_A(c)) { c2 = findchannel(ic, ireq->i_val, IEEE80211_MODE_TURBO_A); if (c2 != NULL) c = c2; } break; case IEEE80211_MODE_11NA: if (IEEE80211_IS_CHAN_A(c)) { c2 = findchannel(ic, ireq->i_val, IEEE80211_MODE_11NA); if (c2 != NULL) c = c2; } break; case IEEE80211_MODE_11NG: if (IEEE80211_IS_CHAN_ANYG(c)) { c2 = findchannel(ic, ireq->i_val, IEEE80211_MODE_11NG); if (c2 != NULL) c = c2; } break; default: /* NB: no static turboG */ break; } } return setcurchan(vap, c); } /* * New/current api for setting the current channel; a complete * channel description is provide so there is no ambiguity in * identifying the channel. */ static __noinline int ieee80211_ioctl_setcurchan(struct ieee80211vap *vap, const struct ieee80211req *ireq) { struct ieee80211com *ic = vap->iv_ic; struct ieee80211_channel chan, *c; int error; if (ireq->i_len != sizeof(chan)) return EINVAL; error = copyin(ireq->i_data, &chan, sizeof(chan)); if (error != 0) return error; /* XXX 0xffff overflows 16-bit signed */ if (chan.ic_freq == 0 || chan.ic_freq == IEEE80211_CHAN_ANY) { c = IEEE80211_CHAN_ANYC; } else { c = ieee80211_find_channel(ic, chan.ic_freq, chan.ic_flags); if (c == NULL) return EINVAL; } return setcurchan(vap, c); } static __noinline int ieee80211_ioctl_setregdomain(struct ieee80211vap *vap, const struct ieee80211req *ireq) { struct ieee80211_regdomain_req *reg; int nchans, error; nchans = 1 + ((ireq->i_len - sizeof(struct ieee80211_regdomain_req)) / sizeof(struct ieee80211_channel)); if (!(1 <= nchans && nchans <= IEEE80211_CHAN_MAX)) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_IOCTL, "%s: bad # chans, i_len %d nchans %d\n", __func__, ireq->i_len, nchans); return EINVAL; } reg = (struct ieee80211_regdomain_req *) malloc(IEEE80211_REGDOMAIN_SIZE(nchans), M_TEMP, M_NOWAIT); if (reg == NULL) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_IOCTL, "%s: no memory, nchans %d\n", __func__, nchans); return ENOMEM; } error = copyin(ireq->i_data, reg, IEEE80211_REGDOMAIN_SIZE(nchans)); if (error == 0) { /* NB: validate inline channel count against storage size */ if (reg->chaninfo.ic_nchans != nchans) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_IOCTL, "%s: chan cnt mismatch, %d != %d\n", __func__, reg->chaninfo.ic_nchans, nchans); error = EINVAL; } else error = ieee80211_setregdomain(vap, reg); } free(reg, M_TEMP); return (error == 0 ? ENETRESET : error); } static int ieee80211_ioctl_setroam(struct ieee80211vap *vap, const struct ieee80211req *ireq) { if (ireq->i_len != sizeof(vap->iv_roamparms)) return EINVAL; /* XXX validate params */ /* XXX? ENETRESET to push to device? */ return copyin(ireq->i_data, vap->iv_roamparms, sizeof(vap->iv_roamparms)); } static int checkrate(const struct ieee80211_rateset *rs, int rate) { int i; if (rate == IEEE80211_FIXED_RATE_NONE) return 1; for (i = 0; i < rs->rs_nrates; i++) if ((rs->rs_rates[i] & IEEE80211_RATE_VAL) == rate) return 1; return 0; } static int checkmcs(int mcs) { if (mcs == IEEE80211_FIXED_RATE_NONE) return 1; if ((mcs & IEEE80211_RATE_MCS) == 0) /* MCS always have 0x80 set */ return 0; return (mcs & 0x7f) <= 15; /* XXX could search ht rate set */ } static __noinline int ieee80211_ioctl_settxparams(struct ieee80211vap *vap, const struct ieee80211req *ireq) { struct ieee80211com *ic = vap->iv_ic; struct ieee80211_txparams_req parms; /* XXX stack use? */ struct ieee80211_txparam *src, *dst; const struct ieee80211_rateset *rs; int error, mode, changed, is11n, nmodes; /* NB: accept short requests for backwards compat */ if (ireq->i_len > sizeof(parms)) return EINVAL; error = copyin(ireq->i_data, &parms, ireq->i_len); if (error != 0) return error; nmodes = ireq->i_len / sizeof(struct ieee80211_txparam); changed = 0; /* validate parameters and check if anything changed */ for (mode = IEEE80211_MODE_11A; mode < nmodes; mode++) { if (isclr(ic->ic_modecaps, mode)) continue; src = &parms.params[mode]; dst = &vap->iv_txparms[mode]; rs = &ic->ic_sup_rates[mode]; /* NB: 11n maps to legacy */ is11n = (mode == IEEE80211_MODE_11NA || mode == IEEE80211_MODE_11NG); if (src->ucastrate != dst->ucastrate) { if (!checkrate(rs, src->ucastrate) && (!is11n || !checkmcs(src->ucastrate))) return EINVAL; changed++; } if (src->mcastrate != dst->mcastrate) { if (!checkrate(rs, src->mcastrate) && (!is11n || !checkmcs(src->mcastrate))) return EINVAL; changed++; } if (src->mgmtrate != dst->mgmtrate) { if (!checkrate(rs, src->mgmtrate) && (!is11n || !checkmcs(src->mgmtrate))) return EINVAL; changed++; } if (src->maxretry != dst->maxretry) /* NB: no bounds */ changed++; } if (changed) { /* * Copy new parameters in place and notify the * driver so it can push state to the device. */ for (mode = IEEE80211_MODE_11A; mode < nmodes; mode++) { if (isset(ic->ic_modecaps, mode)) vap->iv_txparms[mode] = parms.params[mode]; } /* XXX could be more intelligent, e.g. don't reset if setting not being used */ return ENETRESET; } return 0; } /* * Application Information Element support. */ static int setappie(struct ieee80211_appie **aie, const struct ieee80211req *ireq) { struct ieee80211_appie *app = *aie; struct ieee80211_appie *napp; int error; if (ireq->i_len == 0) { /* delete any existing ie */ if (app != NULL) { *aie = NULL; /* XXX racey */ free(app, M_80211_NODE_IE); } return 0; } if (!(2 <= ireq->i_len && ireq->i_len <= IEEE80211_MAX_APPIE)) return EINVAL; /* * Allocate a new appie structure and copy in the user data. * When done swap in the new structure. Note that we do not * guard against users holding a ref to the old structure; * this must be handled outside this code. * * XXX bad bad bad */ napp = (struct ieee80211_appie *) malloc( sizeof(struct ieee80211_appie) + ireq->i_len, M_80211_NODE_IE, M_NOWAIT); if (napp == NULL) return ENOMEM; /* XXX holding ic lock */ error = copyin(ireq->i_data, napp->ie_data, ireq->i_len); if (error) { free(napp, M_80211_NODE_IE); return error; } napp->ie_len = ireq->i_len; *aie = napp; if (app != NULL) free(app, M_80211_NODE_IE); return 0; } static void setwparsnie(struct ieee80211vap *vap, uint8_t *ie, int space) { /* validate data is present as best we can */ if (space == 0 || 2+ie[1] > space) return; if (ie[0] == IEEE80211_ELEMID_VENDOR) vap->iv_wpa_ie = ie; else if (ie[0] == IEEE80211_ELEMID_RSN) vap->iv_rsn_ie = ie; } static __noinline int ieee80211_ioctl_setappie_locked(struct ieee80211vap *vap, const struct ieee80211req *ireq, int fc0) { int error; IEEE80211_LOCK_ASSERT(vap->iv_ic); switch (fc0 & IEEE80211_FC0_SUBTYPE_MASK) { case IEEE80211_FC0_SUBTYPE_BEACON: if (vap->iv_opmode != IEEE80211_M_HOSTAP && vap->iv_opmode != IEEE80211_M_IBSS) { error = EINVAL; break; } error = setappie(&vap->iv_appie_beacon, ireq); if (error == 0) ieee80211_beacon_notify(vap, IEEE80211_BEACON_APPIE); break; case IEEE80211_FC0_SUBTYPE_PROBE_RESP: error = setappie(&vap->iv_appie_proberesp, ireq); break; case IEEE80211_FC0_SUBTYPE_ASSOC_RESP: if (vap->iv_opmode == IEEE80211_M_HOSTAP) error = setappie(&vap->iv_appie_assocresp, ireq); else error = EINVAL; break; case IEEE80211_FC0_SUBTYPE_PROBE_REQ: error = setappie(&vap->iv_appie_probereq, ireq); break; case IEEE80211_FC0_SUBTYPE_ASSOC_REQ: if (vap->iv_opmode == IEEE80211_M_STA) error = setappie(&vap->iv_appie_assocreq, ireq); else error = EINVAL; break; case (IEEE80211_APPIE_WPA & IEEE80211_FC0_SUBTYPE_MASK): error = setappie(&vap->iv_appie_wpa, ireq); if (error == 0) { /* * Must split single blob of data into separate * WPA and RSN ie's because they go in different * locations in the mgt frames. * XXX use IEEE80211_IOC_WPA2 so user code does split */ vap->iv_wpa_ie = NULL; vap->iv_rsn_ie = NULL; if (vap->iv_appie_wpa != NULL) { struct ieee80211_appie *appie = vap->iv_appie_wpa; uint8_t *data = appie->ie_data; /* XXX ie length validate is painful, cheat */ setwparsnie(vap, data, appie->ie_len); setwparsnie(vap, data + 2 + data[1], appie->ie_len - (2 + data[1])); } if (vap->iv_opmode == IEEE80211_M_HOSTAP || vap->iv_opmode == IEEE80211_M_IBSS) { /* * Must rebuild beacon frame as the update * mechanism doesn't handle WPA/RSN ie's. * Could extend it but it doesn't normally * change; this is just to deal with hostapd * plumbing the ie after the interface is up. */ error = ENETRESET; } } break; default: error = EINVAL; break; } return error; } static __noinline int ieee80211_ioctl_setappie(struct ieee80211vap *vap, const struct ieee80211req *ireq) { struct ieee80211com *ic = vap->iv_ic; int error; uint8_t fc0; fc0 = ireq->i_val & 0xff; if ((fc0 & IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_MGT) return EINVAL; /* NB: could check iv_opmode and reject but hardly worth the effort */ IEEE80211_LOCK(ic); error = ieee80211_ioctl_setappie_locked(vap, ireq, fc0); IEEE80211_UNLOCK(ic); return error; } static __noinline int ieee80211_ioctl_chanswitch(struct ieee80211vap *vap, struct ieee80211req *ireq) { struct ieee80211com *ic = vap->iv_ic; struct ieee80211_chanswitch_req csr; struct ieee80211_channel *c; int error; if (ireq->i_len != sizeof(csr)) return EINVAL; error = copyin(ireq->i_data, &csr, sizeof(csr)); if (error != 0) return error; /* XXX adhoc mode not supported */ if (vap->iv_opmode != IEEE80211_M_HOSTAP || (vap->iv_flags & IEEE80211_F_DOTH) == 0) return EOPNOTSUPP; c = ieee80211_find_channel(ic, csr.csa_chan.ic_freq, csr.csa_chan.ic_flags); if (c == NULL) return ENOENT; IEEE80211_LOCK(ic); if ((ic->ic_flags & IEEE80211_F_CSAPENDING) == 0) ieee80211_csa_startswitch(ic, c, csr.csa_mode, csr.csa_count); else if (csr.csa_count == 0) ieee80211_csa_cancelswitch(ic); else error = EBUSY; IEEE80211_UNLOCK(ic); return error; } static int ieee80211_scanreq(struct ieee80211vap *vap, struct ieee80211_scan_req *sr) { #define IEEE80211_IOC_SCAN_FLAGS \ (IEEE80211_IOC_SCAN_NOPICK | IEEE80211_IOC_SCAN_ACTIVE | \ IEEE80211_IOC_SCAN_PICK1ST | IEEE80211_IOC_SCAN_BGSCAN | \ IEEE80211_IOC_SCAN_ONCE | IEEE80211_IOC_SCAN_NOBCAST | \ IEEE80211_IOC_SCAN_NOJOIN | IEEE80211_IOC_SCAN_FLUSH | \ IEEE80211_IOC_SCAN_CHECK) struct ieee80211com *ic = vap->iv_ic; int error, i; /* convert duration */ if (sr->sr_duration == IEEE80211_IOC_SCAN_FOREVER) sr->sr_duration = IEEE80211_SCAN_FOREVER; else { if (sr->sr_duration < IEEE80211_IOC_SCAN_DURATION_MIN || sr->sr_duration > IEEE80211_IOC_SCAN_DURATION_MAX) return EINVAL; sr->sr_duration = msecs_to_ticks(sr->sr_duration); if (sr->sr_duration < 1) sr->sr_duration = 1; } /* convert min/max channel dwell */ if (sr->sr_mindwell != 0) { sr->sr_mindwell = msecs_to_ticks(sr->sr_mindwell); if (sr->sr_mindwell < 1) sr->sr_mindwell = 1; } if (sr->sr_maxdwell != 0) { sr->sr_maxdwell = msecs_to_ticks(sr->sr_maxdwell); if (sr->sr_maxdwell < 1) sr->sr_maxdwell = 1; } /* NB: silently reduce ssid count to what is supported */ if (sr->sr_nssid > IEEE80211_SCAN_MAX_SSID) sr->sr_nssid = IEEE80211_SCAN_MAX_SSID; for (i = 0; i < sr->sr_nssid; i++) if (sr->sr_ssid[i].len > IEEE80211_NWID_LEN) return EINVAL; /* cleanse flags just in case, could reject if invalid flags */ sr->sr_flags &= IEEE80211_IOC_SCAN_FLAGS; /* * Add an implicit NOPICK if the vap is not marked UP. This * allows applications to scan without joining a bss (or picking * a channel and setting up a bss) and without forcing manual * roaming mode--you just need to mark the parent device UP. */ if ((vap->iv_ifp->if_flags & IFF_UP) == 0) sr->sr_flags |= IEEE80211_IOC_SCAN_NOPICK; IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, "%s: flags 0x%x%s duration 0x%x mindwell %u maxdwell %u nssid %d\n", __func__, sr->sr_flags, (vap->iv_ifp->if_flags & IFF_UP) == 0 ? " (!IFF_UP)" : "", sr->sr_duration, sr->sr_mindwell, sr->sr_maxdwell, sr->sr_nssid); /* * If we are in INIT state then the driver has never had a chance * to setup hardware state to do a scan; we must use the state * machine to get us up to the SCAN state but once we reach SCAN * state we then want to use the supplied params. Stash the * parameters in the vap and mark IEEE80211_FEXT_SCANREQ; the * state machines will recognize this and use the stashed params * to issue the scan request. * * Otherwise just invoke the scan machinery directly. */ IEEE80211_LOCK(ic); if (vap->iv_state == IEEE80211_S_INIT) { /* NB: clobbers previous settings */ vap->iv_scanreq_flags = sr->sr_flags; vap->iv_scanreq_duration = sr->sr_duration; vap->iv_scanreq_nssid = sr->sr_nssid; for (i = 0; i < sr->sr_nssid; i++) { vap->iv_scanreq_ssid[i].len = sr->sr_ssid[i].len; memcpy(vap->iv_scanreq_ssid[i].ssid, sr->sr_ssid[i].ssid, sr->sr_ssid[i].len); } vap->iv_flags_ext |= IEEE80211_FEXT_SCANREQ; IEEE80211_UNLOCK(ic); ieee80211_new_state(vap, IEEE80211_S_SCAN, 0); } else { vap->iv_flags_ext &= ~IEEE80211_FEXT_SCANREQ; IEEE80211_UNLOCK(ic); if (sr->sr_flags & IEEE80211_IOC_SCAN_CHECK) { error = ieee80211_check_scan(vap, sr->sr_flags, sr->sr_duration, sr->sr_mindwell, sr->sr_maxdwell, sr->sr_nssid, /* NB: cheat, we assume structures are compatible */ (const struct ieee80211_scan_ssid *) &sr->sr_ssid[0]); } else { error = ieee80211_start_scan(vap, sr->sr_flags, sr->sr_duration, sr->sr_mindwell, sr->sr_maxdwell, sr->sr_nssid, /* NB: cheat, we assume structures are compatible */ (const struct ieee80211_scan_ssid *) &sr->sr_ssid[0]); } if (error == 0) return EINPROGRESS; } return 0; #undef IEEE80211_IOC_SCAN_FLAGS } static __noinline int ieee80211_ioctl_scanreq(struct ieee80211vap *vap, struct ieee80211req *ireq) { struct ieee80211com *ic = vap->iv_ic; struct ieee80211_scan_req sr; /* XXX off stack? */ int error; /* NB: parent must be running */ if ((ic->ic_ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) return ENXIO; if (ireq->i_len != sizeof(sr)) return EINVAL; error = copyin(ireq->i_data, &sr, sizeof(sr)); if (error != 0) return error; return ieee80211_scanreq(vap, &sr); } static __noinline int ieee80211_ioctl_setstavlan(struct ieee80211vap *vap, struct ieee80211req *ireq) { struct ieee80211_node *ni; struct ieee80211req_sta_vlan vlan; int error; if (ireq->i_len != sizeof(vlan)) return EINVAL; error = copyin(ireq->i_data, &vlan, sizeof(vlan)); if (error != 0) return error; if (!IEEE80211_ADDR_EQ(vlan.sv_macaddr, zerobssid)) { ni = ieee80211_find_vap_node(&vap->iv_ic->ic_sta, vap, vlan.sv_macaddr); if (ni == NULL) return ENOENT; } else ni = ieee80211_ref_node(vap->iv_bss); ni->ni_vlan = vlan.sv_vlan; ieee80211_free_node(ni); return error; } static int isvap11g(const struct ieee80211vap *vap) { const struct ieee80211_node *bss = vap->iv_bss; return bss->ni_chan != IEEE80211_CHAN_ANYC && IEEE80211_IS_CHAN_ANYG(bss->ni_chan); } static int isvapht(const struct ieee80211vap *vap) { const struct ieee80211_node *bss = vap->iv_bss; return bss->ni_chan != IEEE80211_CHAN_ANYC && IEEE80211_IS_CHAN_HT(bss->ni_chan); } /* * Dummy ioctl set handler so the linker set is defined. */ static int dummy_ioctl_set(struct ieee80211vap *vap, struct ieee80211req *ireq) { return ENOSYS; } IEEE80211_IOCTL_SET(dummy, dummy_ioctl_set); static int ieee80211_ioctl_setdefault(struct ieee80211vap *vap, struct ieee80211req *ireq) { ieee80211_ioctl_setfunc * const *set; int error; SET_FOREACH(set, ieee80211_ioctl_setset) { error = (*set)(vap, ireq); if (error != ENOSYS) return error; } return EINVAL; } static __noinline int ieee80211_ioctl_set80211(struct ieee80211vap *vap, u_long cmd, struct ieee80211req *ireq) { struct ieee80211com *ic = vap->iv_ic; int error; const struct ieee80211_authenticator *auth; uint8_t tmpkey[IEEE80211_KEYBUF_SIZE]; char tmpssid[IEEE80211_NWID_LEN]; uint8_t tmpbssid[IEEE80211_ADDR_LEN]; struct ieee80211_key *k; u_int kid; uint32_t flags; error = 0; switch (ireq->i_type) { case IEEE80211_IOC_SSID: if (ireq->i_val != 0 || ireq->i_len > IEEE80211_NWID_LEN) return EINVAL; error = copyin(ireq->i_data, tmpssid, ireq->i_len); if (error) break; memset(vap->iv_des_ssid[0].ssid, 0, IEEE80211_NWID_LEN); vap->iv_des_ssid[0].len = ireq->i_len; memcpy(vap->iv_des_ssid[0].ssid, tmpssid, ireq->i_len); vap->iv_des_nssid = (ireq->i_len > 0); error = ENETRESET; break; case IEEE80211_IOC_WEP: switch (ireq->i_val) { case IEEE80211_WEP_OFF: vap->iv_flags &= ~IEEE80211_F_PRIVACY; vap->iv_flags &= ~IEEE80211_F_DROPUNENC; break; case IEEE80211_WEP_ON: vap->iv_flags |= IEEE80211_F_PRIVACY; vap->iv_flags |= IEEE80211_F_DROPUNENC; break; case IEEE80211_WEP_MIXED: vap->iv_flags |= IEEE80211_F_PRIVACY; vap->iv_flags &= ~IEEE80211_F_DROPUNENC; break; } error = ENETRESET; break; case IEEE80211_IOC_WEPKEY: kid = (u_int) ireq->i_val; if (kid >= IEEE80211_WEP_NKID) return EINVAL; k = &vap->iv_nw_keys[kid]; if (ireq->i_len == 0) { /* zero-len =>'s delete any existing key */ (void) ieee80211_crypto_delkey(vap, k); break; } if (ireq->i_len > sizeof(tmpkey)) return EINVAL; memset(tmpkey, 0, sizeof(tmpkey)); error = copyin(ireq->i_data, tmpkey, ireq->i_len); if (error) break; ieee80211_key_update_begin(vap); k->wk_keyix = kid; /* NB: force fixed key id */ if (ieee80211_crypto_newkey(vap, IEEE80211_CIPHER_WEP, IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV, k)) { k->wk_keylen = ireq->i_len; memcpy(k->wk_key, tmpkey, sizeof(tmpkey)); IEEE80211_ADDR_COPY(k->wk_macaddr, vap->iv_myaddr); if (!ieee80211_crypto_setkey(vap, k)) error = EINVAL; } else error = EINVAL; ieee80211_key_update_end(vap); break; case IEEE80211_IOC_WEPTXKEY: kid = (u_int) ireq->i_val; if (kid >= IEEE80211_WEP_NKID && (uint16_t) kid != IEEE80211_KEYIX_NONE) return EINVAL; vap->iv_def_txkey = kid; break; case IEEE80211_IOC_AUTHMODE: switch (ireq->i_val) { case IEEE80211_AUTH_WPA: case IEEE80211_AUTH_8021X: /* 802.1x */ case IEEE80211_AUTH_OPEN: /* open */ case IEEE80211_AUTH_SHARED: /* shared-key */ case IEEE80211_AUTH_AUTO: /* auto */ auth = ieee80211_authenticator_get(ireq->i_val); if (auth == NULL) return EINVAL; break; default: return EINVAL; } switch (ireq->i_val) { case IEEE80211_AUTH_WPA: /* WPA w/ 802.1x */ vap->iv_flags |= IEEE80211_F_PRIVACY; ireq->i_val = IEEE80211_AUTH_8021X; break; case IEEE80211_AUTH_OPEN: /* open */ vap->iv_flags &= ~(IEEE80211_F_WPA|IEEE80211_F_PRIVACY); break; case IEEE80211_AUTH_SHARED: /* shared-key */ case IEEE80211_AUTH_8021X: /* 802.1x */ vap->iv_flags &= ~IEEE80211_F_WPA; /* both require a key so mark the PRIVACY capability */ vap->iv_flags |= IEEE80211_F_PRIVACY; break; case IEEE80211_AUTH_AUTO: /* auto */ vap->iv_flags &= ~IEEE80211_F_WPA; /* XXX PRIVACY handling? */ /* XXX what's the right way to do this? */ break; } /* NB: authenticator attach/detach happens on state change */ vap->iv_bss->ni_authmode = ireq->i_val; /* XXX mixed/mode/usage? */ vap->iv_auth = auth; error = ENETRESET; break; case IEEE80211_IOC_CHANNEL: error = ieee80211_ioctl_setchannel(vap, ireq); break; case IEEE80211_IOC_POWERSAVE: switch (ireq->i_val) { case IEEE80211_POWERSAVE_OFF: if (vap->iv_flags & IEEE80211_F_PMGTON) { ieee80211_syncflag(vap, -IEEE80211_F_PMGTON); error = ERESTART; } break; case IEEE80211_POWERSAVE_ON: if ((vap->iv_caps & IEEE80211_C_PMGT) == 0) error = EOPNOTSUPP; else if ((vap->iv_flags & IEEE80211_F_PMGTON) == 0) { ieee80211_syncflag(vap, IEEE80211_F_PMGTON); error = ERESTART; } break; default: error = EINVAL; break; } break; case IEEE80211_IOC_POWERSAVESLEEP: if (ireq->i_val < 0) return EINVAL; ic->ic_lintval = ireq->i_val; error = ERESTART; break; case IEEE80211_IOC_RTSTHRESHOLD: if (!(IEEE80211_RTS_MIN <= ireq->i_val && ireq->i_val <= IEEE80211_RTS_MAX)) return EINVAL; vap->iv_rtsthreshold = ireq->i_val; error = ERESTART; break; case IEEE80211_IOC_PROTMODE: if (ireq->i_val > IEEE80211_PROT_RTSCTS) return EINVAL; ic->ic_protmode = (enum ieee80211_protmode)ireq->i_val; /* NB: if not operating in 11g this can wait */ if (ic->ic_bsschan != IEEE80211_CHAN_ANYC && IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan)) error = ERESTART; break; case IEEE80211_IOC_TXPOWER: if ((ic->ic_caps & IEEE80211_C_TXPMGT) == 0) return EOPNOTSUPP; if (!(IEEE80211_TXPOWER_MIN <= ireq->i_val && ireq->i_val <= IEEE80211_TXPOWER_MAX)) return EINVAL; ic->ic_txpowlimit = ireq->i_val; error = ERESTART; break; case IEEE80211_IOC_ROAMING: if (!(IEEE80211_ROAMING_DEVICE <= ireq->i_val && ireq->i_val <= IEEE80211_ROAMING_MANUAL)) return EINVAL; vap->iv_roaming = (enum ieee80211_roamingmode)ireq->i_val; /* XXXX reset? */ break; case IEEE80211_IOC_PRIVACY: if (ireq->i_val) { /* XXX check for key state? */ vap->iv_flags |= IEEE80211_F_PRIVACY; } else vap->iv_flags &= ~IEEE80211_F_PRIVACY; /* XXX ERESTART? */ break; case IEEE80211_IOC_DROPUNENCRYPTED: if (ireq->i_val) vap->iv_flags |= IEEE80211_F_DROPUNENC; else vap->iv_flags &= ~IEEE80211_F_DROPUNENC; /* XXX ERESTART? */ break; case IEEE80211_IOC_WPAKEY: error = ieee80211_ioctl_setkey(vap, ireq); break; case IEEE80211_IOC_DELKEY: error = ieee80211_ioctl_delkey(vap, ireq); break; case IEEE80211_IOC_MLME: error = ieee80211_ioctl_setmlme(vap, ireq); break; case IEEE80211_IOC_COUNTERMEASURES: if (ireq->i_val) { if ((vap->iv_flags & IEEE80211_F_WPA) == 0) return EOPNOTSUPP; vap->iv_flags |= IEEE80211_F_COUNTERM; } else vap->iv_flags &= ~IEEE80211_F_COUNTERM; /* XXX ERESTART? */ break; case IEEE80211_IOC_WPA: if (ireq->i_val > 3) return EINVAL; /* XXX verify ciphers available */ flags = vap->iv_flags & ~IEEE80211_F_WPA; switch (ireq->i_val) { case 1: if (!(vap->iv_caps & IEEE80211_C_WPA1)) return EOPNOTSUPP; flags |= IEEE80211_F_WPA1; break; case 2: if (!(vap->iv_caps & IEEE80211_C_WPA2)) return EOPNOTSUPP; flags |= IEEE80211_F_WPA2; break; case 3: if ((vap->iv_caps & IEEE80211_C_WPA) != IEEE80211_C_WPA) return EOPNOTSUPP; flags |= IEEE80211_F_WPA1 | IEEE80211_F_WPA2; break; default: /* Can't set any -> error */ return EOPNOTSUPP; } vap->iv_flags = flags; error = ERESTART; /* NB: can change beacon frame */ break; case IEEE80211_IOC_WME: if (ireq->i_val) { if ((vap->iv_caps & IEEE80211_C_WME) == 0) return EOPNOTSUPP; ieee80211_syncflag(vap, IEEE80211_F_WME); } else ieee80211_syncflag(vap, -IEEE80211_F_WME); error = ERESTART; /* NB: can change beacon frame */ break; case IEEE80211_IOC_HIDESSID: if (ireq->i_val) vap->iv_flags |= IEEE80211_F_HIDESSID; else vap->iv_flags &= ~IEEE80211_F_HIDESSID; error = ERESTART; /* XXX ENETRESET? */ break; case IEEE80211_IOC_APBRIDGE: if (ireq->i_val == 0) vap->iv_flags |= IEEE80211_F_NOBRIDGE; else vap->iv_flags &= ~IEEE80211_F_NOBRIDGE; break; case IEEE80211_IOC_BSSID: if (ireq->i_len != sizeof(tmpbssid)) return EINVAL; error = copyin(ireq->i_data, tmpbssid, ireq->i_len); if (error) break; IEEE80211_ADDR_COPY(vap->iv_des_bssid, tmpbssid); if (IEEE80211_ADDR_EQ(vap->iv_des_bssid, zerobssid)) vap->iv_flags &= ~IEEE80211_F_DESBSSID; else vap->iv_flags |= IEEE80211_F_DESBSSID; error = ENETRESET; break; case IEEE80211_IOC_CHANLIST: error = ieee80211_ioctl_setchanlist(vap, ireq); break; #define OLD_IEEE80211_IOC_SCAN_REQ 23 #ifdef OLD_IEEE80211_IOC_SCAN_REQ case OLD_IEEE80211_IOC_SCAN_REQ: IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, "%s: active scan request\n", __func__); /* * If we are in INIT state then the driver has never * had a chance to setup hardware state to do a scan; * use the state machine to get us up the SCAN state. * Otherwise just invoke the scan machinery to start * a one-time scan. */ if (vap->iv_state == IEEE80211_S_INIT) ieee80211_new_state(vap, IEEE80211_S_SCAN, 0); else (void) ieee80211_start_scan(vap, IEEE80211_SCAN_ACTIVE | IEEE80211_SCAN_NOPICK | IEEE80211_SCAN_ONCE, IEEE80211_SCAN_FOREVER, 0, 0, /* XXX use ioctl params */ vap->iv_des_nssid, vap->iv_des_ssid); break; #endif /* OLD_IEEE80211_IOC_SCAN_REQ */ case IEEE80211_IOC_SCAN_REQ: error = ieee80211_ioctl_scanreq(vap, ireq); break; case IEEE80211_IOC_SCAN_CANCEL: IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, "%s: cancel scan\n", __func__); ieee80211_cancel_scan(vap); break; case IEEE80211_IOC_HTCONF: if (ireq->i_val & 1) ieee80211_syncflag_ht(vap, IEEE80211_FHT_HT); else ieee80211_syncflag_ht(vap, -IEEE80211_FHT_HT); if (ireq->i_val & 2) ieee80211_syncflag_ht(vap, IEEE80211_FHT_USEHT40); else ieee80211_syncflag_ht(vap, -IEEE80211_FHT_USEHT40); error = ENETRESET; break; case IEEE80211_IOC_ADDMAC: case IEEE80211_IOC_DELMAC: error = ieee80211_ioctl_macmac(vap, ireq); break; case IEEE80211_IOC_MACCMD: error = ieee80211_ioctl_setmaccmd(vap, ireq); break; case IEEE80211_IOC_STA_STATS: error = ieee80211_ioctl_setstastats(vap, ireq); break; case IEEE80211_IOC_STA_TXPOW: error = ieee80211_ioctl_setstatxpow(vap, ireq); break; case IEEE80211_IOC_WME_CWMIN: /* WME: CWmin */ case IEEE80211_IOC_WME_CWMAX: /* WME: CWmax */ case IEEE80211_IOC_WME_AIFS: /* WME: AIFS */ case IEEE80211_IOC_WME_TXOPLIMIT: /* WME: txops limit */ case IEEE80211_IOC_WME_ACM: /* WME: ACM (bss only) */ case IEEE80211_IOC_WME_ACKPOLICY: /* WME: ACK policy (bss only) */ error = ieee80211_ioctl_setwmeparam(vap, ireq); break; case IEEE80211_IOC_DTIM_PERIOD: if (vap->iv_opmode != IEEE80211_M_HOSTAP && vap->iv_opmode != IEEE80211_M_MBSS && vap->iv_opmode != IEEE80211_M_IBSS) return EINVAL; if (IEEE80211_DTIM_MIN <= ireq->i_val && ireq->i_val <= IEEE80211_DTIM_MAX) { vap->iv_dtim_period = ireq->i_val; error = ENETRESET; /* requires restart */ } else error = EINVAL; break; case IEEE80211_IOC_BEACON_INTERVAL: if (vap->iv_opmode != IEEE80211_M_HOSTAP && vap->iv_opmode != IEEE80211_M_MBSS && vap->iv_opmode != IEEE80211_M_IBSS) return EINVAL; if (IEEE80211_BINTVAL_MIN <= ireq->i_val && ireq->i_val <= IEEE80211_BINTVAL_MAX) { ic->ic_bintval = ireq->i_val; error = ENETRESET; /* requires restart */ } else error = EINVAL; break; case IEEE80211_IOC_PUREG: if (ireq->i_val) vap->iv_flags |= IEEE80211_F_PUREG; else vap->iv_flags &= ~IEEE80211_F_PUREG; /* NB: reset only if we're operating on an 11g channel */ if (isvap11g(vap)) error = ENETRESET; break; case IEEE80211_IOC_BGSCAN: if (ireq->i_val) { if ((vap->iv_caps & IEEE80211_C_BGSCAN) == 0) return EOPNOTSUPP; vap->iv_flags |= IEEE80211_F_BGSCAN; } else vap->iv_flags &= ~IEEE80211_F_BGSCAN; break; case IEEE80211_IOC_BGSCAN_IDLE: if (ireq->i_val >= IEEE80211_BGSCAN_IDLE_MIN) vap->iv_bgscanidle = ireq->i_val*hz/1000; else error = EINVAL; break; case IEEE80211_IOC_BGSCAN_INTERVAL: if (ireq->i_val >= IEEE80211_BGSCAN_INTVAL_MIN) vap->iv_bgscanintvl = ireq->i_val*hz; else error = EINVAL; break; case IEEE80211_IOC_SCANVALID: if (ireq->i_val >= IEEE80211_SCAN_VALID_MIN) vap->iv_scanvalid = ireq->i_val*hz; else error = EINVAL; break; case IEEE80211_IOC_FRAGTHRESHOLD: if ((vap->iv_caps & IEEE80211_C_TXFRAG) == 0 && ireq->i_val != IEEE80211_FRAG_MAX) return EOPNOTSUPP; if (!(IEEE80211_FRAG_MIN <= ireq->i_val && ireq->i_val <= IEEE80211_FRAG_MAX)) return EINVAL; vap->iv_fragthreshold = ireq->i_val; error = ERESTART; break; case IEEE80211_IOC_BURST: if (ireq->i_val) { if ((vap->iv_caps & IEEE80211_C_BURST) == 0) return EOPNOTSUPP; ieee80211_syncflag(vap, IEEE80211_F_BURST); } else ieee80211_syncflag(vap, -IEEE80211_F_BURST); error = ERESTART; break; case IEEE80211_IOC_BMISSTHRESHOLD: if (!(IEEE80211_HWBMISS_MIN <= ireq->i_val && ireq->i_val <= IEEE80211_HWBMISS_MAX)) return EINVAL; vap->iv_bmissthreshold = ireq->i_val; error = ERESTART; break; case IEEE80211_IOC_CURCHAN: error = ieee80211_ioctl_setcurchan(vap, ireq); break; case IEEE80211_IOC_SHORTGI: if (ireq->i_val) { #define IEEE80211_HTCAP_SHORTGI \ (IEEE80211_HTCAP_SHORTGI20 | IEEE80211_HTCAP_SHORTGI40) if (((ireq->i_val ^ vap->iv_htcaps) & IEEE80211_HTCAP_SHORTGI) != 0) return EINVAL; if (ireq->i_val & IEEE80211_HTCAP_SHORTGI20) vap->iv_flags_ht |= IEEE80211_FHT_SHORTGI20; if (ireq->i_val & IEEE80211_HTCAP_SHORTGI40) vap->iv_flags_ht |= IEEE80211_FHT_SHORTGI40; #undef IEEE80211_HTCAP_SHORTGI } else vap->iv_flags_ht &= ~(IEEE80211_FHT_SHORTGI20 | IEEE80211_FHT_SHORTGI40); error = ERESTART; break; case IEEE80211_IOC_AMPDU: if (ireq->i_val && (vap->iv_htcaps & IEEE80211_HTC_AMPDU) == 0) return EINVAL; if (ireq->i_val & 1) vap->iv_flags_ht |= IEEE80211_FHT_AMPDU_TX; else vap->iv_flags_ht &= ~IEEE80211_FHT_AMPDU_TX; if (ireq->i_val & 2) vap->iv_flags_ht |= IEEE80211_FHT_AMPDU_RX; else vap->iv_flags_ht &= ~IEEE80211_FHT_AMPDU_RX; /* NB: reset only if we're operating on an 11n channel */ if (isvapht(vap)) error = ERESTART; break; case IEEE80211_IOC_AMPDU_LIMIT: if (!(IEEE80211_HTCAP_MAXRXAMPDU_8K <= ireq->i_val && ireq->i_val <= IEEE80211_HTCAP_MAXRXAMPDU_64K)) return EINVAL; if (vap->iv_opmode == IEEE80211_M_HOSTAP) vap->iv_ampdu_rxmax = ireq->i_val; else vap->iv_ampdu_limit = ireq->i_val; error = ERESTART; break; case IEEE80211_IOC_AMPDU_DENSITY: if (!(IEEE80211_HTCAP_MPDUDENSITY_NA <= ireq->i_val && ireq->i_val <= IEEE80211_HTCAP_MPDUDENSITY_16)) return EINVAL; vap->iv_ampdu_density = ireq->i_val; error = ERESTART; break; case IEEE80211_IOC_AMSDU: if (ireq->i_val && (vap->iv_htcaps & IEEE80211_HTC_AMSDU) == 0) return EINVAL; if (ireq->i_val & 1) vap->iv_flags_ht |= IEEE80211_FHT_AMSDU_TX; else vap->iv_flags_ht &= ~IEEE80211_FHT_AMSDU_TX; if (ireq->i_val & 2) vap->iv_flags_ht |= IEEE80211_FHT_AMSDU_RX; else vap->iv_flags_ht &= ~IEEE80211_FHT_AMSDU_RX; /* NB: reset only if we're operating on an 11n channel */ if (isvapht(vap)) error = ERESTART; break; case IEEE80211_IOC_AMSDU_LIMIT: /* XXX validate */ vap->iv_amsdu_limit = ireq->i_val; /* XXX truncation? */ break; case IEEE80211_IOC_PUREN: if (ireq->i_val) { if ((vap->iv_flags_ht & IEEE80211_FHT_HT) == 0) return EINVAL; vap->iv_flags_ht |= IEEE80211_FHT_PUREN; } else vap->iv_flags_ht &= ~IEEE80211_FHT_PUREN; /* NB: reset only if we're operating on an 11n channel */ if (isvapht(vap)) error = ERESTART; break; case IEEE80211_IOC_DOTH: if (ireq->i_val) { #if 0 /* XXX no capability */ if ((vap->iv_caps & IEEE80211_C_DOTH) == 0) return EOPNOTSUPP; #endif vap->iv_flags |= IEEE80211_F_DOTH; } else vap->iv_flags &= ~IEEE80211_F_DOTH; error = ENETRESET; break; case IEEE80211_IOC_REGDOMAIN: error = ieee80211_ioctl_setregdomain(vap, ireq); break; case IEEE80211_IOC_ROAM: error = ieee80211_ioctl_setroam(vap, ireq); break; case IEEE80211_IOC_TXPARAMS: error = ieee80211_ioctl_settxparams(vap, ireq); break; case IEEE80211_IOC_HTCOMPAT: if (ireq->i_val) { if ((vap->iv_flags_ht & IEEE80211_FHT_HT) == 0) return EOPNOTSUPP; vap->iv_flags_ht |= IEEE80211_FHT_HTCOMPAT; } else vap->iv_flags_ht &= ~IEEE80211_FHT_HTCOMPAT; /* NB: reset only if we're operating on an 11n channel */ if (isvapht(vap)) error = ERESTART; break; case IEEE80211_IOC_DWDS: if (ireq->i_val) { /* NB: DWDS only makes sense for WDS-capable devices */ if ((ic->ic_caps & IEEE80211_C_WDS) == 0) return EOPNOTSUPP; /* NB: DWDS is used only with ap+sta vaps */ if (vap->iv_opmode != IEEE80211_M_HOSTAP && vap->iv_opmode != IEEE80211_M_STA) return EINVAL; vap->iv_flags |= IEEE80211_F_DWDS; if (vap->iv_opmode == IEEE80211_M_STA) vap->iv_flags_ext |= IEEE80211_FEXT_4ADDR; } else { vap->iv_flags &= ~IEEE80211_F_DWDS; if (vap->iv_opmode == IEEE80211_M_STA) vap->iv_flags_ext &= ~IEEE80211_FEXT_4ADDR; } break; case IEEE80211_IOC_INACTIVITY: if (ireq->i_val) vap->iv_flags_ext |= IEEE80211_FEXT_INACT; else vap->iv_flags_ext &= ~IEEE80211_FEXT_INACT; break; case IEEE80211_IOC_APPIE: error = ieee80211_ioctl_setappie(vap, ireq); break; case IEEE80211_IOC_WPS: if (ireq->i_val) { if ((vap->iv_caps & IEEE80211_C_WPA) == 0) return EOPNOTSUPP; vap->iv_flags_ext |= IEEE80211_FEXT_WPS; } else vap->iv_flags_ext &= ~IEEE80211_FEXT_WPS; break; case IEEE80211_IOC_TSN: if (ireq->i_val) { if ((vap->iv_caps & IEEE80211_C_WPA) == 0) return EOPNOTSUPP; vap->iv_flags_ext |= IEEE80211_FEXT_TSN; } else vap->iv_flags_ext &= ~IEEE80211_FEXT_TSN; break; case IEEE80211_IOC_CHANSWITCH: error = ieee80211_ioctl_chanswitch(vap, ireq); break; case IEEE80211_IOC_DFS: if (ireq->i_val) { if ((vap->iv_caps & IEEE80211_C_DFS) == 0) return EOPNOTSUPP; /* NB: DFS requires 11h support */ if ((vap->iv_flags & IEEE80211_F_DOTH) == 0) return EINVAL; vap->iv_flags_ext |= IEEE80211_FEXT_DFS; } else vap->iv_flags_ext &= ~IEEE80211_FEXT_DFS; break; case IEEE80211_IOC_DOTD: if (ireq->i_val) vap->iv_flags_ext |= IEEE80211_FEXT_DOTD; else vap->iv_flags_ext &= ~IEEE80211_FEXT_DOTD; if (vap->iv_opmode == IEEE80211_M_STA) error = ENETRESET; break; case IEEE80211_IOC_HTPROTMODE: if (ireq->i_val > IEEE80211_PROT_RTSCTS) return EINVAL; ic->ic_htprotmode = ireq->i_val ? IEEE80211_PROT_RTSCTS : IEEE80211_PROT_NONE; /* NB: if not operating in 11n this can wait */ if (isvapht(vap)) error = ERESTART; break; case IEEE80211_IOC_STA_VLAN: error = ieee80211_ioctl_setstavlan(vap, ireq); break; case IEEE80211_IOC_SMPS: if ((ireq->i_val &~ IEEE80211_HTCAP_SMPS) != 0 || ireq->i_val == 0x0008) /* value of 2 is reserved */ return EINVAL; if (ireq->i_val != IEEE80211_HTCAP_SMPS_OFF && (vap->iv_htcaps & IEEE80211_HTC_SMPS) == 0) return EOPNOTSUPP; vap->iv_htcaps = (vap->iv_htcaps &~ IEEE80211_HTCAP_SMPS) | ireq->i_val; /* NB: if not operating in 11n this can wait */ if (isvapht(vap)) error = ERESTART; break; case IEEE80211_IOC_RIFS: if (ireq->i_val != 0) { if ((vap->iv_htcaps & IEEE80211_HTC_RIFS) == 0) return EOPNOTSUPP; vap->iv_flags_ht |= IEEE80211_FHT_RIFS; } else vap->iv_flags_ht &= ~IEEE80211_FHT_RIFS; /* NB: if not operating in 11n this can wait */ if (isvapht(vap)) error = ERESTART; break; default: error = ieee80211_ioctl_setdefault(vap, ireq); break; } /* * The convention is that ENETRESET means an operation * requires a complete re-initialization of the device (e.g. * changing something that affects the association state). * ERESTART means the request may be handled with only a * reload of the hardware state. We hand ERESTART requests * to the iv_reset callback so the driver can decide. If * a device does not fillin iv_reset then it defaults to one * that returns ENETRESET. Otherwise a driver may return * ENETRESET (in which case a full reset will be done) or * 0 to mean there's no need to do anything (e.g. when the * change has no effect on the driver/device). */ if (error == ERESTART) error = IFNET_IS_UP_RUNNING(vap->iv_ifp) ? vap->iv_reset(vap, ireq->i_type) : 0; if (error == ENETRESET) { /* XXX need to re-think AUTO handling */ if (IS_UP_AUTO(vap)) ieee80211_init(vap); error = 0; } return error; } /* * Rebuild the parent's multicast address list after an add/del * of a multicast address for a vap. We have no way to tell * what happened above to optimize the work so we purge the entire * list and rebuild from scratch. This is way expensive. * Note also the half-baked workaround for if_addmulti calling * back to the parent device; there's no way to insert mcast * entries quietly and/or cheaply. */ static void ieee80211_ioctl_updatemulti(struct ieee80211com *ic) { struct ifnet *parent = ic->ic_ifp; struct ieee80211vap *vap; void *ioctl; IEEE80211_LOCK(ic); if_delallmulti(parent); ioctl = parent->if_ioctl; /* XXX WAR if_allmulti */ parent->if_ioctl = NULL; TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { struct ifnet *ifp = vap->iv_ifp; struct ifmultiaddr *ifma; TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; (void) if_addmulti(parent, ifma->ifma_addr, NULL); } } parent->if_ioctl = ioctl; ieee80211_runtask(ic, &ic->ic_mcast_task); IEEE80211_UNLOCK(ic); } int ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct ieee80211vap *vap = ifp->if_softc; struct ieee80211com *ic = vap->iv_ic; int error = 0; struct ifreq *ifr; struct ifaddr *ifa; /* XXX */ switch (cmd) { case SIOCSIFFLAGS: IEEE80211_LOCK(ic); ieee80211_syncifflag_locked(ic, IFF_PROMISC); ieee80211_syncifflag_locked(ic, IFF_ALLMULTI); if (ifp->if_flags & IFF_UP) { /* * Bring ourself up unless we're already operational. * If we're the first vap and the parent is not up * then it will automatically be brought up as a * side-effect of bringing ourself up. */ if (vap->iv_state == IEEE80211_S_INIT) ieee80211_start_locked(vap); } else if (ifp->if_drv_flags & IFF_DRV_RUNNING) { /* * Stop ourself. If we are the last vap to be * marked down the parent will also be taken down. */ ieee80211_stop_locked(vap); } IEEE80211_UNLOCK(ic); /* Wait for parent ioctl handler if it was queued */ ieee80211_waitfor_parent(ic); break; case SIOCADDMULTI: case SIOCDELMULTI: ieee80211_ioctl_updatemulti(ic); break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: ifr = (struct ifreq *)data; error = ifmedia_ioctl(ifp, ifr, &vap->iv_media, cmd); break; case SIOCG80211: error = ieee80211_ioctl_get80211(vap, cmd, (struct ieee80211req *) data); break; case SIOCS80211: error = priv_check(curthread, PRIV_NET80211_MANAGE); if (error == 0) error = ieee80211_ioctl_set80211(vap, cmd, (struct ieee80211req *) data); break; case SIOCG80211STATS: ifr = (struct ifreq *)data; copyout(&vap->iv_stats, ifr->ifr_data, sizeof (vap->iv_stats)); break; case SIOCSIFMTU: ifr = (struct ifreq *)data; if (!(IEEE80211_MTU_MIN <= ifr->ifr_mtu && ifr->ifr_mtu <= IEEE80211_MTU_MAX)) error = EINVAL; else ifp->if_mtu = ifr->ifr_mtu; break; case SIOCSIFADDR: /* * XXX Handle this directly so we can supress if_init calls. * XXX This should be done in ether_ioctl but for the moment * XXX there are too many other parts of the system that * XXX set IFF_UP and so supress if_init being called when * XXX it should be. */ ifa = (struct ifaddr *) data; switch (ifa->ifa_addr->sa_family) { #ifdef INET case AF_INET: if ((ifp->if_flags & IFF_UP) == 0) { ifp->if_flags |= IFF_UP; ifp->if_init(ifp->if_softc); } arp_ifinit(ifp, ifa); break; #endif #ifdef IPX /* * XXX - This code is probably wrong, * but has been copied many times. */ case AF_IPX: { struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr); if (ipx_nullhost(*ina)) ina->x_host = *(union ipx_host *) IF_LLADDR(ifp); else bcopy((caddr_t) ina->x_host.c_host, (caddr_t) IF_LLADDR(ifp), ETHER_ADDR_LEN); /* fall thru... */ } #endif default: if ((ifp->if_flags & IFF_UP) == 0) { ifp->if_flags |= IFF_UP; ifp->if_init(ifp->if_softc); } break; } break; /* Pass NDIS ioctls up to the driver */ case SIOCGDRVSPEC: case SIOCSDRVSPEC: case SIOCGPRIVATE_0: { struct ifnet *parent = vap->iv_ic->ic_ifp; error = parent->if_ioctl(parent, cmd, data); break; } default: error = ether_ioctl(ifp, cmd, data); break; } return error; }
dcui/FreeBSD-9.3_kernel
sys/net80211/ieee80211_ioctl.c
C
bsd-3-clause
97,910
# -*- coding: utf-8 -*- # Generated by Django 1.11.16 on 2018-10-05 14:25 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [("elections", "0049_move_status")] operations = [ migrations.RemoveField(model_name="election", name="rejection_reason"), migrations.RemoveField(model_name="election", name="suggested_status"), migrations.RemoveField(model_name="election", name="suggestion_reason"), ]
DemocracyClub/EveryElection
every_election/apps/elections/migrations/0050_auto_20181005_1425.py
Python
bsd-3-clause
512