code
stringlengths
3
1.01M
repo_name
stringlengths
5
116
path
stringlengths
3
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
3
1.01M
#!/bin/sh # # Added in support of https://github.com/Unidata/netcdf-c/gh425 and # https://github.com/Unidata/netcdf-c/gh469 # # The output isn't validated, but the regression it is fixing fails on nccopy. # if test "x$srcdir" = x ; then srcdir=`pwd`; fi . ../test_common.sh # For a netCDF-3 build, test nccopy on netCDF files in this directory set -e echo "" INFILE=${TOPSRCDIR}/ncdump/ref_nccopy3_subset.nc OUTFILE=nccopy3_subset_out.nc echo "*** Testing netCDF-3 nccopy -v/-V flags on $IN" echo "*** One Dimensional Tests" echo "*** Testing nccopy -v" ${NCCOPY} -v lat ${INFILE} ${OUTFILE} echo "*** Testing nccopy -V" ${NCCOPY} -V lat ${INFILE} ${OUTFILE} echo "*** Two Dimensional Tests" echo "*** Testing nccopy -v" ${NCCOPY} -v lat_2D_rct ${INFILE} ${OUTFILE} echo "*** Testing nccopy -V" ${NCCOPY} -V lat_2D_rct ${INFILE} ${OUTFILE} echo "nccopy passed!" exit 0
Unidata/netcdf-c
ncdump/tst_nccopy3_subset.sh
Shell
bsd-3-clause
883
<!DOCTYPE html> <link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org"> <link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1295998"> <div id="outer" style="columns:2; column-fill:auto; height:50px;"> <div id="inner" style="columns:2; padding-top:51px; column-fill:auto; height:1px;"> <div style="position:absolute;"></div> </div> </div>
chromium/chromium
third_party/blink/web_tests/external/wpt/css/css-multicol/crashtests/nested-with-tall-padding-and-oof.html
HTML
bsd-3-clause
397
// Copyright (c) 2006-2008 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_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_LIST_H_ #define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_LIST_H_ #pragma once #include <vector> #include "base/basictypes.h" class AutomationProvider; // Stores a list of all AutomationProvider objects. class AutomationProviderList { public: AutomationProviderList(); ~AutomationProviderList(); typedef std::vector<AutomationProvider*> list_type; typedef list_type::iterator iterator; typedef list_type::const_iterator const_iterator; // Adds and removes automation providers from the global list. bool AddProvider(AutomationProvider* provider); bool RemoveProvider(AutomationProvider* provider); const_iterator begin() { return automation_providers_.begin(); } const_iterator end() { return automation_providers_.end(); } size_t size() { return automation_providers_.size(); } private: void OnLastProviderRemoved(); list_type automation_providers_; DISALLOW_COPY_AND_ASSIGN(AutomationProviderList); }; #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_LIST_H_
aYukiSekiguchi/ACCESS-Chromium
chrome/browser/automation/automation_provider_list.h
C
bsd-3-clause
1,260
/* * Copyright (c) 2013 Chun-Ying Huang * * This file is part of GamingAnywhere (GA). * * GA is free software; you can redistribute it and/or modify it * under the terms of the 3-clause BSD License as published by the * Free Software Foundation: http://directory.fsf.org/wiki/License:BSD_3Clause * * GA is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * You should have received a copy of the 3-clause BSD License along with GA; * if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef __SDL12_AUDIO_H__ #define __SDL12_AUDIO_H__ struct SDL12_AudioSpec { int freq; /**< DSP frequency -- samples per second */ uint16_t format; /**< Audio data format */ uint8_t channels; /**< Number of channels: 1 mono, 2 stereo */ uint8_t silence; /**< Audio buffer silence value (calculated) */ uint16_t samples; /**< Audio buffer size in samples (power of 2) */ uint16_t padding; /**< Necessary for some compile environments */ uint32_t size; /**< Audio buffer size in bytes (calculated) */ /** * This function is called when the audio device needs more data. * * @param[out] stream A pointer to the audio data buffer * @param[in] len The length of the audio buffer in bytes. * * Once the callback returns, the buffer will no longer be valid. * Stereo samples are stored in a LRLRLR ordering. */ void (*callback)(void *userdata, uint8_t *stream, int len); void *userdata; }; #define SDL12_AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */ #define SDL12_AUDIO_S8 0x8008 /**< Signed 8-bit samples */ #define SDL12_AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */ #define SDL12_AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */ #define SDL12_AUDIO_U16MSB 0x1010 /**< As above, but big-endian byte order */ #define SDL12_AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */ #define SDL12_AUDIO_U16 SDL12_AUDIO_U16LSB #define SDL12_AUDIO_S16 SDL12_AUDIO_S16LSB #endif
yunyu-Mr/gaminganywhere
ga/server/event-posix/sdl12-audio.h
C
bsd-3-clause
2,182
// 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 "media/filters/audio_renderer_algorithm.h" #include <algorithm> #include <cmath> #include "base/logging.h" #include "media/base/audio_bus.h" #include "media/base/limits.h" #include "media/filters/wsola_internals.h" namespace media { // Waveform Similarity Overlap-and-add (WSOLA). // // One WSOLA iteration // // 1) Extract |target_block_| as input frames at indices // [|target_block_index_|, |target_block_index_| + |ola_window_size_|). // Note that |target_block_| is the "natural" continuation of the output. // // 2) Extract |search_block_| as input frames at indices // [|search_block_index_|, // |search_block_index_| + |num_candidate_blocks_| + |ola_window_size_|). // // 3) Find a block within the |search_block_| that is most similar // to |target_block_|. Let |optimal_index| be the index of such block and // write it to |optimal_block_|. // // 4) Update: // |optimal_block_| = |transition_window_| * |target_block_| + // (1 - |transition_window_|) * |optimal_block_|. // // 5) Overlap-and-add |optimal_block_| to the |wsola_output_|. // // 6) Update: // |target_block_| = |optimal_index| + |ola_window_size_| / 2. // |output_index_| = |output_index_| + |ola_window_size_| / 2, // |search_block_center_offset_| = |output_index_| * |playback_rate|, and // |search_block_index_| = |search_block_center_offset_| - // |search_block_center_offset_|. // Max/min supported playback rates for fast/slow audio. Audio outside of these // ranges are muted. // Audio at these speeds would sound better under a frequency domain algorithm. static const double kMinPlaybackRate = 0.5; static const double kMaxPlaybackRate = 4.0; // Overlap-and-add window size in milliseconds. static const int kOlaWindowSizeMs = 20; // Size of search interval in milliseconds. The search interval is // [-delta delta] around |output_index_| * |playback_rate|. So the search // interval is 2 * delta. static const int kWsolaSearchIntervalMs = 30; // The maximum size in seconds for the |audio_buffer_|. Arbitrarily determined. static const int kMaxCapacityInSeconds = 3; // The starting size in frames for |audio_buffer_|. Previous usage maintained a // queue of 16 AudioBuffers, each of 512 frames. This worked well, so we // maintain this number of frames. static const int kStartingBufferSizeInFrames = 16 * 512; static_assert(kStartingBufferSizeInFrames < (kMaxCapacityInSeconds * limits::kMinSampleRate), "max capacity smaller than starting buffer size"); AudioRendererAlgorithm::AudioRendererAlgorithm() : channels_(0), samples_per_second_(0), muted_partial_frame_(0), capacity_(kStartingBufferSizeInFrames), output_time_(0.0), search_block_center_offset_(0), search_block_index_(0), num_candidate_blocks_(0), target_block_index_(0), ola_window_size_(0), ola_hop_size_(0), num_complete_frames_(0) { } AudioRendererAlgorithm::~AudioRendererAlgorithm() {} void AudioRendererAlgorithm::Initialize(const AudioParameters& params) { CHECK(params.IsValid()); channels_ = params.channels(); samples_per_second_ = params.sample_rate(); num_candidate_blocks_ = (kWsolaSearchIntervalMs * samples_per_second_) / 1000; ola_window_size_ = kOlaWindowSizeMs * samples_per_second_ / 1000; // Make sure window size in an even number. ola_window_size_ += ola_window_size_ & 1; ola_hop_size_ = ola_window_size_ / 2; // |num_candidate_blocks_| / 2 is the offset of the center of the search // block to the center of the first (left most) candidate block. The offset // of the center of a candidate block to its left most point is // |ola_window_size_| / 2 - 1. Note that |ola_window_size_| is even and in // our convention the center belongs to the left half, so we need to subtract // one frame to get the correct offset. // // Search Block // <-------------------------------------------> // // |ola_window_size_| / 2 - 1 // <---- // // |num_candidate_blocks_| / 2 // <---------------- // center // X----X----------------X---------------X-----X // <----------> <----------> // Candidate ... Candidate // 1, ... |num_candidate_blocks_| search_block_center_offset_ = num_candidate_blocks_ / 2 + (ola_window_size_ / 2 - 1); ola_window_.reset(new float[ola_window_size_]); internal::GetSymmetricHanningWindow(ola_window_size_, ola_window_.get()); transition_window_.reset(new float[ola_window_size_ * 2]); internal::GetSymmetricHanningWindow(2 * ola_window_size_, transition_window_.get()); wsola_output_ = AudioBus::Create(channels_, ola_window_size_ + ola_hop_size_); wsola_output_->Zero(); // Initialize for overlap-and-add of the first block. // Auxiliary containers. optimal_block_ = AudioBus::Create(channels_, ola_window_size_); search_block_ = AudioBus::Create( channels_, num_candidate_blocks_ + (ola_window_size_ - 1)); target_block_ = AudioBus::Create(channels_, ola_window_size_); } int AudioRendererAlgorithm::FillBuffer(AudioBus* dest, int dest_offset, int requested_frames, double playback_rate) { if (playback_rate == 0) return 0; DCHECK_EQ(channels_, dest->channels()); // Optimize the muted case to issue a single clear instead of performing // the full crossfade and clearing each crossfaded frame. if (playback_rate < kMinPlaybackRate || playback_rate > kMaxPlaybackRate) { int frames_to_render = std::min(static_cast<int>(audio_buffer_.frames() / playback_rate), requested_frames); // Compute accurate number of frames to actually skip in the source data. // Includes the leftover partial frame from last request. However, we can // only skip over complete frames, so a partial frame may remain for next // time. muted_partial_frame_ += frames_to_render * playback_rate; int seek_frames = static_cast<int>(muted_partial_frame_); dest->ZeroFramesPartial(dest_offset, frames_to_render); audio_buffer_.SeekFrames(seek_frames); // Determine the partial frame that remains to be skipped for next call. If // the user switches back to playing, it may be off time by this partial // frame, which would be undetectable. If they subsequently switch to // another playback rate that mutes, the code will attempt to line up the // frames again. muted_partial_frame_ -= seek_frames; return frames_to_render; } int slower_step = ceil(ola_window_size_ * playback_rate); int faster_step = ceil(ola_window_size_ / playback_rate); // Optimize the most common |playback_rate| ~= 1 case to use a single copy // instead of copying frame by frame. if (ola_window_size_ <= faster_step && slower_step >= ola_window_size_) { const int frames_to_copy = std::min(audio_buffer_.frames(), requested_frames); const int frames_read = audio_buffer_.ReadFrames(frames_to_copy, dest_offset, dest); DCHECK_EQ(frames_read, frames_to_copy); return frames_read; } int rendered_frames = 0; do { rendered_frames += WriteCompletedFramesTo(requested_frames - rendered_frames, dest_offset + rendered_frames, dest); } while (rendered_frames < requested_frames && RunOneWsolaIteration(playback_rate)); return rendered_frames; } void AudioRendererAlgorithm::FlushBuffers() { // Clear the queue of decoded packets (releasing the buffers). audio_buffer_.Clear(); output_time_ = 0.0; search_block_index_ = 0; target_block_index_ = 0; wsola_output_->Zero(); num_complete_frames_ = 0; // Reset |capacity_| so growth triggered by underflows doesn't penalize // seek time. capacity_ = kStartingBufferSizeInFrames; } void AudioRendererAlgorithm::EnqueueBuffer( const scoped_refptr<AudioBuffer>& buffer_in) { DCHECK(!buffer_in->end_of_stream()); audio_buffer_.Append(buffer_in); } bool AudioRendererAlgorithm::IsQueueFull() { return audio_buffer_.frames() >= capacity_; } void AudioRendererAlgorithm::IncreaseQueueCapacity() { int max_capacity = kMaxCapacityInSeconds * samples_per_second_; DCHECK_LE(capacity_, max_capacity); capacity_ = std::min(2 * capacity_, max_capacity); } bool AudioRendererAlgorithm::CanPerformWsola() const { const int search_block_size = num_candidate_blocks_ + (ola_window_size_ - 1); const int frames = audio_buffer_.frames(); return target_block_index_ + ola_window_size_ <= frames && search_block_index_ + search_block_size <= frames; } bool AudioRendererAlgorithm::RunOneWsolaIteration(double playback_rate) { if (!CanPerformWsola()) return false; GetOptimalBlock(); // Overlap-and-add. for (int k = 0; k < channels_; ++k) { const float* const ch_opt_frame = optimal_block_->channel(k); float* ch_output = wsola_output_->channel(k) + num_complete_frames_; for (int n = 0; n < ola_hop_size_; ++n) { ch_output[n] = ch_output[n] * ola_window_[ola_hop_size_ + n] + ch_opt_frame[n] * ola_window_[n]; } // Copy the second half to the output. memcpy(&ch_output[ola_hop_size_], &ch_opt_frame[ola_hop_size_], sizeof(*ch_opt_frame) * ola_hop_size_); } num_complete_frames_ += ola_hop_size_; UpdateOutputTime(playback_rate, ola_hop_size_); RemoveOldInputFrames(playback_rate); return true; } void AudioRendererAlgorithm::UpdateOutputTime(double playback_rate, double time_change) { output_time_ += time_change; // Center of the search region, in frames. const int search_block_center_index = static_cast<int>( output_time_ * playback_rate + 0.5); search_block_index_ = search_block_center_index - search_block_center_offset_; } void AudioRendererAlgorithm::RemoveOldInputFrames(double playback_rate) { const int earliest_used_index = std::min(target_block_index_, search_block_index_); if (earliest_used_index <= 0) return; // Nothing to remove. // Remove frames from input and adjust indices accordingly. audio_buffer_.SeekFrames(earliest_used_index); target_block_index_ -= earliest_used_index; // Adjust output index. double output_time_change = static_cast<double>(earliest_used_index) / playback_rate; CHECK_GE(output_time_, output_time_change); UpdateOutputTime(playback_rate, -output_time_change); } int AudioRendererAlgorithm::WriteCompletedFramesTo( int requested_frames, int dest_offset, AudioBus* dest) { int rendered_frames = std::min(num_complete_frames_, requested_frames); if (rendered_frames == 0) return 0; // There is nothing to read from |wsola_output_|, return. wsola_output_->CopyPartialFramesTo(0, rendered_frames, dest_offset, dest); // Remove the frames which are read. int frames_to_move = wsola_output_->frames() - rendered_frames; for (int k = 0; k < channels_; ++k) { float* ch = wsola_output_->channel(k); memmove(ch, &ch[rendered_frames], sizeof(*ch) * frames_to_move); } num_complete_frames_ -= rendered_frames; return rendered_frames; } bool AudioRendererAlgorithm::TargetIsWithinSearchRegion() const { const int search_block_size = num_candidate_blocks_ + (ola_window_size_ - 1); return target_block_index_ >= search_block_index_ && target_block_index_ + ola_window_size_ <= search_block_index_ + search_block_size; } void AudioRendererAlgorithm::GetOptimalBlock() { int optimal_index = 0; // An interval around last optimal block which is excluded from the search. // This is to reduce the buzzy sound. The number 160 is rather arbitrary and // derived heuristically. const int kExcludeIntervalLengthFrames = 160; if (TargetIsWithinSearchRegion()) { optimal_index = target_block_index_; PeekAudioWithZeroPrepend(optimal_index, optimal_block_.get()); } else { PeekAudioWithZeroPrepend(target_block_index_, target_block_.get()); PeekAudioWithZeroPrepend(search_block_index_, search_block_.get()); int last_optimal = target_block_index_ - ola_hop_size_ - search_block_index_; internal::Interval exclude_iterval = std::make_pair( last_optimal - kExcludeIntervalLengthFrames / 2, last_optimal + kExcludeIntervalLengthFrames / 2); // |optimal_index| is in frames and it is relative to the beginning of the // |search_block_|. optimal_index = internal::OptimalIndex( search_block_.get(), target_block_.get(), exclude_iterval); // Translate |index| w.r.t. the beginning of |audio_buffer_| and extract the // optimal block. optimal_index += search_block_index_; PeekAudioWithZeroPrepend(optimal_index, optimal_block_.get()); // Make a transition from target block to the optimal block if different. // Target block has the best continuation to the current output. // Optimal block is the most similar block to the target, however, it might // introduce some discontinuity when over-lap-added. Therefore, we combine // them for a smoother transition. The length of transition window is twice // as that of the optimal-block which makes it like a weighting function // where target-block has higher weight close to zero (weight of 1 at index // 0) and lower weight close the end. for (int k = 0; k < channels_; ++k) { float* ch_opt = optimal_block_->channel(k); const float* const ch_target = target_block_->channel(k); for (int n = 0; n < ola_window_size_; ++n) { ch_opt[n] = ch_opt[n] * transition_window_[n] + ch_target[n] * transition_window_[ola_window_size_ + n]; } } } // Next target is one hop ahead of the current optimal. target_block_index_ = optimal_index + ola_hop_size_; } void AudioRendererAlgorithm::PeekAudioWithZeroPrepend( int read_offset_frames, AudioBus* dest) { CHECK_LE(read_offset_frames + dest->frames(), audio_buffer_.frames()); int write_offset = 0; int num_frames_to_read = dest->frames(); if (read_offset_frames < 0) { int num_zero_frames_appended = std::min(-read_offset_frames, num_frames_to_read); read_offset_frames = 0; num_frames_to_read -= num_zero_frames_appended; write_offset = num_zero_frames_appended; dest->ZeroFrames(num_zero_frames_appended); } audio_buffer_.PeekFrames(num_frames_to_read, read_offset_frames, write_offset, dest); } } // namespace media
guorendong/iridium-browser-ubuntu
media/filters/audio_renderer_algorithm.cc
C++
bsd-3-clause
15,043
// Copyright 2015 The Crashpad Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "client/crashpad_client.h" #include <windows.h> #include <stdint.h> #include <string.h> #include "base/atomicops.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/scoped_generic.h" #include "base/strings/string16.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/synchronization/lock.h" #include "util/file/file_io.h" #include "util/win/command_line.h" #include "util/win/critical_section_with_debug_info.h" #include "util/win/get_function.h" #include "util/win/handle.h" #include "util/win/registration_protocol_win.h" #include "util/win/scoped_handle.h" namespace { // This handle is never closed. This is used to signal to the server that a dump // should be taken in the event of a crash. HANDLE g_signal_exception = INVALID_HANDLE_VALUE; // Where we store the exception information that the crash handler reads. crashpad::ExceptionInformation g_crash_exception_information; // These handles are never closed. g_signal_non_crash_dump is used to signal to // the server to take a dump (not due to an exception), and the server will // signal g_non_crash_dump_done when the dump is completed. HANDLE g_signal_non_crash_dump = INVALID_HANDLE_VALUE; HANDLE g_non_crash_dump_done = INVALID_HANDLE_VALUE; // Guards multiple simultaneous calls to DumpWithoutCrash(). This is leaked. base::Lock* g_non_crash_dump_lock; // Where we store a pointer to the context information when taking a non-crash // dump. crashpad::ExceptionInformation g_non_crash_exception_information; // A CRITICAL_SECTION initialized with // RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO to force it to be allocated with a // valid .DebugInfo field. The address of this critical section is given to the // handler. All critical sections with debug info are linked in a doubly-linked // list, so this allows the handler to capture all of them. CRITICAL_SECTION g_critical_section_with_debug_info; LONG WINAPI UnhandledExceptionHandler(EXCEPTION_POINTERS* exception_pointers) { // Tracks whether a thread has already entered UnhandledExceptionHandler. static base::subtle::AtomicWord have_crashed; // This is a per-process handler. While this handler is being invoked, other // threads are still executing as usual, so multiple threads could enter at // the same time. Because we're in a crashing state, we shouldn't be doing // anything that might cause allocations, call into kernel mode, etc. So, we // don't want to take a critical section here to avoid simultaneous access to // the global exception pointers in ExceptionInformation. Because the crash // handler will record all threads, it's fine to simply have the second and // subsequent entrants block here. They will soon be suspended by the crash // handler, and then the entire process will be terminated below. This means // that we won't save the exception pointers from the second and further // crashes, but contention here is very unlikely, and we'll still have a stack // that's blocked at this location. if (base::subtle::Barrier_AtomicIncrement(&have_crashed, 1) > 1) { SleepEx(INFINITE, false); } // Otherwise, we're the first thread, so record the exception pointer and // signal the crash handler. g_crash_exception_information.thread_id = GetCurrentThreadId(); g_crash_exception_information.exception_pointers = reinterpret_cast<crashpad::WinVMAddress>(exception_pointers); // Now signal the crash server, which will take a dump and then terminate us // when it's complete. SetEvent(g_signal_exception); // Time to wait for the handler to create a dump. const DWORD kMillisecondsUntilTerminate = 60 * 1000; // Sleep for a while to allow it to process us. Eventually, we terminate // ourselves in case the crash server is gone, so that we don't leave zombies // around. This would ideally never happen. Sleep(kMillisecondsUntilTerminate); LOG(ERROR) << "crash server did not respond, self-terminating"; const UINT kCrashExitCodeNoDump = 0xffff7001; TerminateProcess(GetCurrentProcess(), kCrashExitCodeNoDump); return EXCEPTION_CONTINUE_SEARCH; } std::wstring FormatArgumentString(const std::string& name, const std::wstring& value) { return std::wstring(L"--") + base::UTF8ToUTF16(name) + L"=" + value; } struct ScopedProcThreadAttributeListTraits { static PPROC_THREAD_ATTRIBUTE_LIST InvalidValue() { return nullptr; } static void Free(PPROC_THREAD_ATTRIBUTE_LIST proc_thread_attribute_list) { // This is able to use GET_FUNCTION_REQUIRED() instead of GET_FUNCTION() // because it will only be called if InitializeProcThreadAttributeList() and // UpdateProcThreadAttribute() are present. static const auto delete_proc_thread_attribute_list = GET_FUNCTION_REQUIRED(L"kernel32.dll", ::DeleteProcThreadAttributeList); delete_proc_thread_attribute_list(proc_thread_attribute_list); } }; using ScopedProcThreadAttributeList = base::ScopedGeneric<PPROC_THREAD_ATTRIBUTE_LIST, ScopedProcThreadAttributeListTraits>; bool IsInheritableHandle(HANDLE handle) { if (!handle || handle == INVALID_HANDLE_VALUE) return false; // File handles (FILE_TYPE_DISK) and pipe handles (FILE_TYPE_PIPE) are known // to be inheritable. Console handles (FILE_TYPE_CHAR) are not inheritable via // PROC_THREAD_ATTRIBUTE_HANDLE_LIST. See // https://crashpad.chromium.org/bug/77. DWORD handle_type = GetFileType(handle); return handle_type == FILE_TYPE_DISK || handle_type == FILE_TYPE_PIPE; } // Adds |handle| to |handle_list| if it appears valid, and is not already in // |handle_list|. // // Invalid handles (including INVALID_HANDLE_VALUE and null handles) cannot be // added to a PPROC_THREAD_ATTRIBUTE_LIST’s PROC_THREAD_ATTRIBUTE_HANDLE_LIST. // If INVALID_HANDLE_VALUE appears, CreateProcess() will fail with // ERROR_INVALID_PARAMETER. If a null handle appears, the child process will // silently not inherit any handles. // // Use this function to add handles with uncertain validities. void AddHandleToListIfValidAndInheritable(std::vector<HANDLE>* handle_list, HANDLE handle) { // There doesn't seem to be any documentation of this, but if there's a handle // duplicated in this list, CreateProcess() fails with // ERROR_INVALID_PARAMETER. if (IsInheritableHandle(handle) && std::find(handle_list->begin(), handle_list->end(), handle) == handle_list->end()) { handle_list->push_back(handle); } } } // namespace namespace crashpad { CrashpadClient::CrashpadClient() : ipc_pipe_() { } CrashpadClient::~CrashpadClient() { } bool CrashpadClient::StartHandler( const base::FilePath& handler, const base::FilePath& database, const std::string& url, const std::map<std::string, std::string>& annotations, const std::vector<std::string>& arguments, bool restartable) { DCHECK(ipc_pipe_.empty()); HANDLE pipe_read; HANDLE pipe_write; SECURITY_ATTRIBUTES security_attributes = {}; security_attributes.nLength = sizeof(security_attributes); security_attributes.bInheritHandle = TRUE; if (!CreatePipe(&pipe_read, &pipe_write, &security_attributes, 0)) { PLOG(ERROR) << "CreatePipe"; return false; } ScopedFileHandle pipe_read_owner(pipe_read); ScopedFileHandle pipe_write_owner(pipe_write); // The new process only needs the write side of the pipe. BOOL rv = SetHandleInformation(pipe_read, HANDLE_FLAG_INHERIT, 0); PLOG_IF(WARNING, !rv) << "SetHandleInformation"; std::wstring command_line; AppendCommandLineArgument(handler.value(), &command_line); for (const std::string& argument : arguments) { AppendCommandLineArgument(base::UTF8ToUTF16(argument), &command_line); } if (!database.value().empty()) { AppendCommandLineArgument(FormatArgumentString("database", database.value()), &command_line); } if (!url.empty()) { AppendCommandLineArgument(FormatArgumentString("url", base::UTF8ToUTF16(url)), &command_line); } for (const auto& kv : annotations) { AppendCommandLineArgument( FormatArgumentString("annotation", base::UTF8ToUTF16(kv.first + '=' + kv.second)), &command_line); } AppendCommandLineArgument( base::UTF8ToUTF16(base::StringPrintf("--handshake-handle=0x%x", HandleToInt(pipe_write))), &command_line); DWORD creation_flags; STARTUPINFOEX startup_info = {}; startup_info.StartupInfo.dwFlags = STARTF_USESTDHANDLES; startup_info.StartupInfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE); startup_info.StartupInfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); startup_info.StartupInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE); std::vector<HANDLE> handle_list; scoped_ptr<uint8_t[]> proc_thread_attribute_list_storage; ScopedProcThreadAttributeList proc_thread_attribute_list_owner; static const auto initialize_proc_thread_attribute_list = GET_FUNCTION(L"kernel32.dll", ::InitializeProcThreadAttributeList); static const auto update_proc_thread_attribute = initialize_proc_thread_attribute_list ? GET_FUNCTION(L"kernel32.dll", ::UpdateProcThreadAttribute) : nullptr; if (!initialize_proc_thread_attribute_list || !update_proc_thread_attribute) { // The OS doesn’t allow handle inheritance to be restricted, so the handler // will inherit every inheritable handle. creation_flags = 0; startup_info.StartupInfo.cb = sizeof(startup_info.StartupInfo); } else { // Restrict handle inheritance to just those needed in the handler. creation_flags = EXTENDED_STARTUPINFO_PRESENT; startup_info.StartupInfo.cb = sizeof(startup_info); SIZE_T size; rv = initialize_proc_thread_attribute_list(nullptr, 1, 0, &size); if (rv) { LOG(ERROR) << "InitializeProcThreadAttributeList (size) succeeded, " "expected failure"; return false; } else if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) { PLOG(ERROR) << "InitializeProcThreadAttributeList (size)"; return false; } proc_thread_attribute_list_storage.reset(new uint8_t[size]); startup_info.lpAttributeList = reinterpret_cast<PPROC_THREAD_ATTRIBUTE_LIST>( proc_thread_attribute_list_storage.get()); rv = initialize_proc_thread_attribute_list( startup_info.lpAttributeList, 1, 0, &size); if (!rv) { PLOG(ERROR) << "InitializeProcThreadAttributeList"; return false; } proc_thread_attribute_list_owner.reset(startup_info.lpAttributeList); handle_list.reserve(4); handle_list.push_back(pipe_write); AddHandleToListIfValidAndInheritable(&handle_list, startup_info.StartupInfo.hStdInput); AddHandleToListIfValidAndInheritable(&handle_list, startup_info.StartupInfo.hStdOutput); AddHandleToListIfValidAndInheritable(&handle_list, startup_info.StartupInfo.hStdError); rv = update_proc_thread_attribute( startup_info.lpAttributeList, 0, PROC_THREAD_ATTRIBUTE_HANDLE_LIST, &handle_list[0], handle_list.size() * sizeof(handle_list[0]), nullptr, nullptr); if (!rv) { PLOG(ERROR) << "UpdateProcThreadAttribute"; return false; } } PROCESS_INFORMATION process_info; rv = CreateProcess(handler.value().c_str(), &command_line[0], nullptr, nullptr, true, creation_flags, nullptr, nullptr, &startup_info.StartupInfo, &process_info); if (!rv) { PLOG(ERROR) << "CreateProcess"; return false; } rv = CloseHandle(process_info.hThread); PLOG_IF(WARNING, !rv) << "CloseHandle thread"; rv = CloseHandle(process_info.hProcess); PLOG_IF(WARNING, !rv) << "CloseHandle process"; pipe_write_owner.reset(); uint32_t ipc_pipe_length; if (!LoggingReadFile(pipe_read, &ipc_pipe_length, sizeof(ipc_pipe_length))) { return false; } ipc_pipe_.resize(ipc_pipe_length); if (ipc_pipe_length && !LoggingReadFile( pipe_read, &ipc_pipe_[0], ipc_pipe_length * sizeof(ipc_pipe_[0]))) { return false; } return true; } bool CrashpadClient::SetHandlerIPCPipe(const std::wstring& ipc_pipe) { DCHECK(ipc_pipe_.empty()); DCHECK(!ipc_pipe.empty()); ipc_pipe_ = ipc_pipe; return true; } std::wstring CrashpadClient::GetHandlerIPCPipe() const { DCHECK(!ipc_pipe_.empty()); return ipc_pipe_; } bool CrashpadClient::UseHandler() { DCHECK(!ipc_pipe_.empty()); DCHECK_EQ(g_signal_exception, INVALID_HANDLE_VALUE); DCHECK_EQ(g_signal_non_crash_dump, INVALID_HANDLE_VALUE); DCHECK_EQ(g_non_crash_dump_done, INVALID_HANDLE_VALUE); DCHECK(!g_critical_section_with_debug_info.DebugInfo); DCHECK(!g_non_crash_dump_lock); ClientToServerMessage message; memset(&message, 0, sizeof(message)); message.type = ClientToServerMessage::kRegister; message.registration.version = RegistrationRequest::kMessageVersion; message.registration.client_process_id = GetCurrentProcessId(); message.registration.crash_exception_information = reinterpret_cast<WinVMAddress>(&g_crash_exception_information); message.registration.non_crash_exception_information = reinterpret_cast<WinVMAddress>(&g_non_crash_exception_information); // We create this dummy CRITICAL_SECTION with the // RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO flag set to have an entry point // into the doubly-linked list of RTL_CRITICAL_SECTION_DEBUG objects. This // allows us to walk the list at crash time to gather data for !locks. A // debugger would instead inspect ntdll!RtlCriticalSectionList to get the head // of the list. But that is not an exported symbol, so on an arbitrary client // machine, we don't have a way of getting that pointer. if (InitializeCriticalSectionWithDebugInfoIfPossible( &g_critical_section_with_debug_info)) { message.registration.critical_section_address = reinterpret_cast<WinVMAddress>(&g_critical_section_with_debug_info); } ServerToClientMessage response = {}; if (!SendToCrashHandlerServer(ipc_pipe_, message, &response)) { return false; } // The server returns these already duplicated to be valid in this process. g_signal_exception = IntToHandle(response.registration.request_crash_dump_event); g_signal_non_crash_dump = IntToHandle(response.registration.request_non_crash_dump_event); g_non_crash_dump_done = IntToHandle(response.registration.non_crash_dump_completed_event); g_non_crash_dump_lock = new base::Lock(); // In theory we could store the previous handler but it is not clear what // use we have for it. SetUnhandledExceptionFilter(&UnhandledExceptionHandler); return true; } // static void CrashpadClient::DumpWithoutCrash(const CONTEXT& context) { if (g_signal_non_crash_dump == INVALID_HANDLE_VALUE || g_non_crash_dump_done == INVALID_HANDLE_VALUE) { LOG(ERROR) << "haven't called UseHandler()"; return; } // In the non-crashing case, we aren't concerned about avoiding calls into // Win32 APIs, so just use regular locking here in case of multiple threads // calling this function. If a crash occurs while we're in here, the worst // that can happen is that the server captures a partial dump for this path // because on the other thread gathering a crash dump, it TerminateProcess()d, // causing this one to abort. base::AutoLock lock(*g_non_crash_dump_lock); // Create a fake EXCEPTION_POINTERS to give the handler something to work // with. EXCEPTION_POINTERS exception_pointers = {}; // This is logically const, but EXCEPTION_POINTERS does not declare it as // const, so we have to cast that away from the argument. exception_pointers.ContextRecord = const_cast<CONTEXT*>(&context); // We include a fake exception and use a code of '0x517a7ed' (something like // "simulated") so that it's relatively obvious in windbg that it's not // actually an exception. Most values in // https://msdn.microsoft.com/en-us/library/windows/desktop/aa363082.aspx have // some of the top nibble set, so we make sure to pick a value that doesn't, // so as to be unlikely to conflict. const uint32_t kSimulatedExceptionCode = 0x517a7ed; EXCEPTION_RECORD record = {}; record.ExceptionCode = kSimulatedExceptionCode; #if defined(ARCH_CPU_64_BITS) record.ExceptionAddress = reinterpret_cast<void*>(context.Rip); #else record.ExceptionAddress = reinterpret_cast<void*>(context.Eip); #endif // ARCH_CPU_64_BITS exception_pointers.ExceptionRecord = &record; g_non_crash_exception_information.thread_id = GetCurrentThreadId(); g_non_crash_exception_information.exception_pointers = reinterpret_cast<crashpad::WinVMAddress>(&exception_pointers); bool set_event_result = !!SetEvent(g_signal_non_crash_dump); PLOG_IF(ERROR, !set_event_result) << "SetEvent"; DWORD wfso_result = WaitForSingleObject(g_non_crash_dump_done, INFINITE); PLOG_IF(ERROR, wfso_result != WAIT_OBJECT_0) << "WaitForSingleObject"; } // static void CrashpadClient::DumpAndCrash(EXCEPTION_POINTERS* exception_pointers) { UnhandledExceptionHandler(exception_pointers); } } // namespace crashpad
js0701/chromium-crosswalk
third_party/crashpad/crashpad/client/crashpad_client_win.cc
C++
bsd-3-clause
18,374
<!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.shadow.outside</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> <h1>2d.shadow.outside</h1> <p class="desc">Shadows of shapes outside the visible area can be offset onto the visible area</p> <script> var t = async_test("Shadows of shapes outside the visible area can be offset onto the visible area"); var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); t.step(function() { var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); ctx.fillStyle = '#f00'; ctx.fillRect(0, 0, 100, 50); ctx.shadowColor = '#0f0'; ctx.shadowOffsetX = 100; ctx.fillRect(-100, 0, 25, 50); ctx.shadowOffsetX = -100; ctx.fillRect(175, 0, 25, 50); ctx.shadowOffsetX = 0; ctx.shadowOffsetY = 100; ctx.fillRect(25, -100, 50, 25); ctx.shadowOffsetY = -100; ctx.fillRect(25, 125, 50, 25); _assertPixel(offscreenCanvas, 12,25, 0,255,0,255, "12,25", "0,255,0,255"); _assertPixel(offscreenCanvas, 87,25, 0,255,0,255, "87,25", "0,255,0,255"); _assertPixel(offscreenCanvas, 50,12, 0,255,0,255, "50,12", "0,255,0,255"); _assertPixel(offscreenCanvas, 50,37, 0,255,0,255, "50,37", "0,255,0,255"); t.done(); }); </script>
scheib/chromium
third_party/blink/web_tests/external/wpt/html/canvas/offscreen/shadows/2d.shadow.outside.html
HTML
bsd-3-clause
1,431
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_POWER_PROCESS_POWER_COLLECTOR_H_ #define CHROME_BROWSER_POWER_PROCESS_POWER_COLLECTOR_H_ #include <map> #include "base/macros.h" #include "base/memory/linked_ptr.h" #include "base/process/process_handle.h" #include "base/process/process_metrics.h" #include "base/timer/timer.h" #include "build/build_config.h" #include "components/power/origin_power_map_factory.h" #include "url/gurl.h" #if defined(OS_CHROMEOS) #include "chromeos/dbus/power_manager_client.h" #endif class Profile; namespace content { class RenderProcessHost; } #if defined(OS_CHROMEOS) namespace power_manager { class PowerSupplyProperties; } #endif // Manages regular updates of the profile power consumption. class ProcessPowerCollector #if defined(OS_CHROMEOS) : public chromeos::PowerManagerClient::Observer #endif { public: class PerProcessData { public: PerProcessData(scoped_ptr<base::ProcessMetrics> metrics, const GURL& origin, Profile* profile); PerProcessData(); ~PerProcessData(); base::ProcessMetrics* metrics() const { return metrics_.get(); } Profile* profile() const { return profile_; } GURL last_origin() const { return last_origin_; } int last_cpu_percent() const { return last_cpu_percent_; } bool seen_this_cycle() const { return seen_this_cycle_; } void set_last_cpu_percent(double new_cpu) { last_cpu_percent_ = new_cpu; } void set_seen_this_cycle(bool seen) { seen_this_cycle_ = seen; } private: // |metrics_| holds the ProcessMetrics information for the given process. scoped_ptr<base::ProcessMetrics> metrics_; // |profile| is the profile that is visiting the |last_origin_|. // It is not owned by PerProcessData. Profile* profile_; // |last_origin_| is the last origin visited by the process. GURL last_origin_; // |last_cpu_percent_| is the proportion of the CPU used since the last // query. double last_cpu_percent_; // |seen_this_cycle| represents if the process still exists in this cycle. // If it doesn't, we erase the PerProcessData. bool seen_this_cycle_; DISALLOW_COPY_AND_ASSIGN(PerProcessData); }; // A map from all process handles to a metric. typedef std::map<base::ProcessHandle, linked_ptr<PerProcessData> > ProcessMetricsMap; // A callback used to define mock CPU usage for testing. typedef base::Callback<double(base::ProcessHandle)> CpuUsageCallback; // On Chrome OS, can only be initialized after the DBusThreadManager has been // initialized. ProcessPowerCollector(); #if defined(OS_CHROMEOS) // On Chrome OS, can only be destroyed before DBusThreadManager is. ~ProcessPowerCollector() override; #else virtual ~ProcessPowerCollector(); #endif void set_cpu_usage_callback_for_testing(const CpuUsageCallback& callback) { cpu_usage_callback_ = callback; } ProcessMetricsMap* metrics_map_for_testing() { return &metrics_map_; } #if defined(OS_CHROMEOS) // PowerManagerClient::Observer implementation: void PowerChanged(const power_manager::PowerSupplyProperties& prop) override; #endif // Begin periodically updating the power consumption numbers by profile. void Initialize(); // Calls UpdatePowerConsumption() and returns the total CPU percent. double UpdatePowerConsumptionForTesting(); private: // Starts the timer for updating the power consumption. void StartTimer(); // Calls SynchronizerProcesses() and RecordCpuUsageByOrigin() to update the // |metrics_map_| and attribute power consumption. Invoked by |timer_| and as // a helper method for UpdatePowerConsumptionForTesting(). double UpdatePowerConsumption(); // Calls UpdatePowerConsumption(). Invoked by |timer_|. void HandleUpdateTimeout(); // Synchronizes the currently active processes to the |metrics_map_| and // returns the total amount of cpu usage in the cycle. double SynchronizeProcesses(); // Attributes the power usage to the profiles and origins using the // information from SynchronizeProcesses() given a total amount // of CPU used in this cycle, |total_cpu_percent|. void RecordCpuUsageByOrigin(double total_cpu_percent); // Adds the information from a given RenderProcessHost to the |metrics_map_| // for a given origin. Called by SynchronizeProcesses(). void UpdateProcessInMap(const content::RenderProcessHost* render_process, const GURL& origin); ProcessMetricsMap metrics_map_; base::RepeatingTimer timer_; // Callback to use to get CPU usage if set. CpuUsageCallback cpu_usage_callback_; // The factor to scale the CPU usage by. double scale_factor_; DISALLOW_COPY_AND_ASSIGN(ProcessPowerCollector); }; #endif // CHROME_BROWSER_POWER_PROCESS_POWER_COLLECTOR_H_
js0701/chromium-crosswalk
chrome/browser/power/process_power_collector.h
C
bsd-3-clause
4,960
// Copyright 2020 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_TRACING_PERFETTO_PLATFORM_H_ #define BASE_TRACING_PERFETTO_PLATFORM_H_ #include "third_party/perfetto/include/perfetto/tracing/platform.h" #include "base/base_export.h" #include "base/memory/scoped_refptr.h" #include "base/threading/thread_id_name_manager.h" #include "base/threading/thread_local_storage.h" namespace base { class DeferredSequencedTaskRunner; namespace tracing { class BASE_EXPORT PerfettoPlatform : public perfetto::Platform, ThreadIdNameManager::Observer { public: // Specifies the type of task runner used by Perfetto. // TODO(skyostil): Move all scenarios to use the default task runner to // avoid problems with unexpected re-entrancy and IPC deadlocks. enum class TaskRunnerType { // Use Perfetto's own task runner which runs tasks on a dedicated (internal) // thread. kBuiltin, // Use base::ThreadPool. kThreadPool, }; explicit PerfettoPlatform(TaskRunnerType = TaskRunnerType::kThreadPool); ~PerfettoPlatform() override; SequencedTaskRunner* task_runner() const; bool did_start_task_runner() const { return did_start_task_runner_; } void StartTaskRunner(scoped_refptr<SequencedTaskRunner>); // perfetto::Platform implementation: ThreadLocalObject* GetOrCreateThreadLocalObject() override; std::unique_ptr<perfetto::base::TaskRunner> CreateTaskRunner( const CreateTaskRunnerArgs&) override; std::string GetCurrentProcessName() override; // ThreadIdNameManager::Observer implementation. void OnThreadNameChanged(const char* name) override; private: const TaskRunnerType task_runner_type_; scoped_refptr<DeferredSequencedTaskRunner> deferred_task_runner_; bool did_start_task_runner_ = false; ThreadLocalStorage::Slot thread_local_object_; }; } // namespace tracing } // namespace base #endif // BASE_TRACING_PERFETTO_PLATFORM_H_
ric2b/Vivaldi-browser
chromium/base/tracing/perfetto_platform.h
C
bsd-3-clause
2,051
// RUN: %clang_cc1 -triple x86_64-pc-linux -emit-llvm %s -o - | FileCheck %s extern void foo_alias (void) __asm ("foo"); inline void foo (void) { return foo_alias (); } extern int abs_alias (int) __asm ("abs"); inline __attribute__ ((__always_inline__)) int abs (int x) { return abs_alias(x); } extern char *strrchr_foo (const char *__s, int __c) __asm ("strrchr"); extern inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__)) char * strrchr_foo (const char *__s, int __c) { return __builtin_strrchr (__s, __c); } extern inline void __attribute__((always_inline, __gnu_inline__)) prefetch(void) { __builtin_prefetch(0, 0, 1); } extern inline __attribute__((__always_inline__, __gnu_inline__)) void *memchr(void *__s, int __c, __SIZE_TYPE__ __n) { return __builtin_memchr(__s, __c, __n); } void f(void) { foo(); abs(0); strrchr_foo("", '.'); prefetch(); memchr("", '.', 0); } // CHECK-LABEL: define void @f() // CHECK: call void @foo() // CHECK: call i32 @abs(i32 0) // CHECK: call i8* @strrchr( // CHECK: call void @llvm.prefetch.p0i8( // CHECK: call i8* @memchr( // CHECK: ret void // CHECK: declare void @foo() // CHECK: declare i32 @abs(i32 // CHECK: declare i8* @strrchr(i8*, i32) // CHECK: declare i8* @memchr( // CHECK: declare void @llvm.prefetch.p0i8(
endlessm/chromium-browser
third_party/llvm/clang/test/CodeGen/pr9614.c
C
bsd-3-clause
1,310
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>TibiaAPI: Member List</title> <link href="tabs.css" rel="stylesheet" type="text/css"> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.9 --> <script type="text/javascript"> <!-- function changeDisplayState (e){ var num=this.id.replace(/[^[0-9]/g,''); var button=this.firstChild; var sectionDiv=document.getElementById('dynsection'+num); if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){ sectionDiv.style.display='block'; button.src='open.gif'; }else{ sectionDiv.style.display='none'; button.src='closed.gif'; } } function initDynSections(){ var divs=document.getElementsByTagName('div'); var sectionCounter=1; for(var i=0;i<divs.length-1;i++){ if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){ var header=divs[i]; var section=divs[i+1]; var button=header.firstChild; if (button!='IMG'){ divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild); button=document.createElement('img'); divs[i].insertBefore(button,divs[i].firstChild); } header.style.cursor='pointer'; header.onclick=changeDisplayState; header.id='dynheader'+sectionCounter; button.src='closed.gif'; section.id='dynsection'+sectionCounter; section.style.display='none'; section.style.marginLeft='14px'; sectionCounter++; } } } window.onload = initDynSections; --> </script> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main&nbsp;Page</span></a></li> <li><a href="namespaces.html"><span>Packages</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li> <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li> <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li> </ul> </div> </div> <div class="contents"> <h1>Tibia.Objects.ClientPathInfo Member List</h1>This is the complete list of members for <a class="el" href="struct_tibia_1_1_objects_1_1_client_path_info.html">Tibia.Objects.ClientPathInfo</a>, including all inherited members.<p><table> <tr class="memlist"><td><a class="el" href="struct_tibia_1_1_objects_1_1_client_path_info.html#4a1e325e8bcd6e305764070535b6b330">ClientPathInfo</a>(string path, string version)</td><td><a class="el" href="struct_tibia_1_1_objects_1_1_client_path_info.html">Tibia.Objects.ClientPathInfo</a></td><td></td></tr> <tr class="memlist"><td><a class="el" href="struct_tibia_1_1_objects_1_1_client_path_info.html#9b93a6829b99a434114c874c34777d91">Path</a></td><td><a class="el" href="struct_tibia_1_1_objects_1_1_client_path_info.html">Tibia.Objects.ClientPathInfo</a></td><td></td></tr> <tr class="memlist"><td><a class="el" href="struct_tibia_1_1_objects_1_1_client_path_info.html#a38b7bc7ea20319873a94c10a2e27515">ToString</a>()</td><td><a class="el" href="struct_tibia_1_1_objects_1_1_client_path_info.html">Tibia.Objects.ClientPathInfo</a></td><td></td></tr> <tr class="memlist"><td><a class="el" href="struct_tibia_1_1_objects_1_1_client_path_info.html#f5212a85fc1549cbc6316e2394c8a39f">Version</a></td><td><a class="el" href="struct_tibia_1_1_objects_1_1_client_path_info.html">Tibia.Objects.ClientPathInfo</a></td><td></td></tr> </table></div> <hr size="1"><address style="text-align: right;"><small>Generated on Tue Jul 7 18:50:10 2009 for TibiaAPI by&nbsp; <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address> </body> </html>
gareox/tibiaapi
documentation/struct_tibia_1_1_objects_1_1_client_path_info-members.html
HTML
mit
3,963
/* * Copyright (C) 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package org.holoeverywhere.widget.datetimepicker; import android.annotation.TargetApi; import android.content.Context; import android.graphics.Rect; import android.os.Build; import android.os.Bundle; import android.support.v4.view.AccessibilityDelegateCompat; import android.support.v4.view.ViewCompat; import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat; import android.support.v4.view.accessibility.AccessibilityNodeProviderCompat; import android.support.v4.view.accessibility.AccessibilityRecordCompat; import android.text.TextUtils; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import com.nineoldandroids.view.ViewHelper; import java.util.LinkedList; import java.util.List; public abstract class TouchExplorationHelper<T> extends AccessibilityNodeProviderCompat { /** * Virtual node identifier value for invalid nodes. */ public static final int INVALID_ID = Integer.MIN_VALUE; private final Rect mTempScreenRect = new Rect(); private final Rect mTempParentRect = new Rect(); private final Rect mTempVisibleRect = new Rect(); private final int[] mTempGlobalRect = new int[2]; private final AccessibilityManager mManager; private final AccessibilityDelegateCompat mDelegate = new AccessibilityDelegateCompat() { @Override public void onInitializeAccessibilityEvent(View view, AccessibilityEvent event) { super.onInitializeAccessibilityEvent(view, event); event.setClassName(view.getClass().getName()); } @Override public void onInitializeAccessibilityNodeInfo(View view, AccessibilityNodeInfoCompat info) { super.onInitializeAccessibilityNodeInfo(view, info); info.setClassName(view.getClass().getName()); } @Override public AccessibilityNodeProviderCompat getAccessibilityNodeProvider(View host) { return TouchExplorationHelper.this; } }; private View mParentView; private int mFocusedItemId = INVALID_ID; private T mCurrentItem = null; private Object mOnHoverListener; /** * Constructs a new touch exploration helper. * * @param context The parent context. */ public TouchExplorationHelper(Context context, View parentView) { mManager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE); mParentView = parentView; } /** * @return The current accessibility focused item, or {@code null} if no * item is focused. */ public T getFocusedItem() { return getItemForId(mFocusedItemId); } /** * Requests accessibility focus be placed on the specified item. * * @param item The item to place focus on. */ public void setFocusedItem(T item) { final int itemId = getIdForItem(item); if (itemId == INVALID_ID) { return; } performAction(itemId, AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS, null); } /** * Clears the current accessibility focused item. */ public void clearFocusedItem() { final int itemId = mFocusedItemId; if (itemId == INVALID_ID) { return; } performAction(itemId, AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS, null); } /** * Invalidates cached information about the parent view. * <p> * You <b>must</b> call this method after adding or removing items from the * parent view. * </p> */ public void invalidateParent() { mParentView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } /** * Invalidates cached information for a particular item. * <p> * You <b>must</b> call this method when any of the properties set in * {@link #populateNodeForItem(Object, AccessibilityNodeInfoCompat)} have * changed. * </p> * * @param item */ public void invalidateItem(T item) { sendEventForItem(item, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } /** * Populates an event of the specified type with information about an item * and attempts to send it up through the view hierarchy. * * @param item The item for which to send an event. * @param eventType The type of event to send. * @return {@code true} if the event was sent successfully. */ @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) public boolean sendEventForItem(T item, int eventType) { if (!mManager.isEnabled() || Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) { return false; } final AccessibilityEvent event = getEventForItem(item, eventType); final ViewGroup group = (ViewGroup) mParentView.getParent(); return group.requestSendAccessibilityEvent(mParentView, event); } @Override public AccessibilityNodeInfoCompat createAccessibilityNodeInfo(int virtualViewId) { if (virtualViewId == View.NO_ID) { return getNodeForParent(); } final T item = getItemForId(virtualViewId); if (item == null) { return null; } final AccessibilityNodeInfoCompat node = AccessibilityNodeInfoCompat.obtain(); populateNodeForItemInternal(item, node); return node; } @Override public boolean performAction(int virtualViewId, int action, Bundle arguments) { if (virtualViewId == View.NO_ID) { return ViewCompat.performAccessibilityAction(mParentView, action, arguments); } final T item = getItemForId(virtualViewId); if (item == null) { return false; } boolean handled = false; switch (action) { case AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS: if (mFocusedItemId != virtualViewId) { mFocusedItemId = virtualViewId; sendEventForItem(item, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED); handled = true; } break; case AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS: if (mFocusedItemId == virtualViewId) { mFocusedItemId = INVALID_ID; sendEventForItem(item, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); handled = true; } break; } handled |= performActionForItem(item, action, arguments); return handled; } @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) public View.OnHoverListener getOnHoverListener() { if (mOnHoverListener == null) { mOnHoverListener = new View.OnHoverListener() { @Override public boolean onHover(View view, MotionEvent event) { if (!mManager.isTouchExplorationEnabled()) { return false; } switch (event.getAction()) { case MotionEvent.ACTION_HOVER_ENTER: case MotionEvent.ACTION_HOVER_MOVE: final T item = getItemAt(event.getX(), event.getY()); setCurrentItem(item); return true; case MotionEvent.ACTION_HOVER_EXIT: setCurrentItem(null); return true; } return false; } }; } return (View.OnHoverListener) mOnHoverListener; } private void setCurrentItem(T item) { if (mCurrentItem == item) { return; } if (mCurrentItem != null) { sendEventForItem(mCurrentItem, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); } mCurrentItem = item; if (mCurrentItem != null) { sendEventForItem(mCurrentItem, AccessibilityEvent.TYPE_VIEW_HOVER_ENTER); } } private AccessibilityEvent getEventForItem(T item, int eventType) { final AccessibilityEvent event = AccessibilityEvent.obtain(eventType); final AccessibilityRecordCompat record = new AccessibilityRecordCompat(event); final int virtualDescendantId = getIdForItem(item); // Ensure the client has good defaults. event.setEnabled(true); // Allow the client to populate the event. populateEventForItem(item, event); if (event.getText().isEmpty() && TextUtils.isEmpty(event.getContentDescription())) { throw new RuntimeException( "You must add text or a content description in populateEventForItem()"); } // Don't allow the client to override these properties. event.setClassName(item.getClass().getName()); event.setPackageName(mParentView.getContext().getPackageName()); record.setSource(mParentView, virtualDescendantId); return event; } private AccessibilityNodeInfoCompat getNodeForParent() { final AccessibilityNodeInfoCompat info = AccessibilityNodeInfoCompat.obtain(mParentView); ViewCompat.onInitializeAccessibilityNodeInfo(mParentView, info); final LinkedList<T> items = new LinkedList<T>(); getVisibleItems(items); for (T item : items) { final int virtualDescendantId = getIdForItem(item); info.addChild(mParentView, virtualDescendantId); } return info; } private AccessibilityNodeInfoCompat populateNodeForItemInternal( T item, AccessibilityNodeInfoCompat node) { final int virtualDescendantId = getIdForItem(item); // Ensure the client has good defaults. node.setEnabled(true); // Allow the client to populate the node. populateNodeForItem(item, node); if (TextUtils.isEmpty(node.getText()) && TextUtils.isEmpty(node.getContentDescription())) { throw new RuntimeException( "You must add text or a content description in populateNodeForItem()"); } // Don't allow the client to override these properties. node.setPackageName(mParentView.getContext().getPackageName()); node.setClassName(item.getClass().getName()); node.setParent(mParentView); node.setSource(mParentView, virtualDescendantId); if (mFocusedItemId == virtualDescendantId) { node.addAction(AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS); } else { node.addAction(AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS); } node.getBoundsInParent(mTempParentRect); if (mTempParentRect.isEmpty()) { throw new RuntimeException("You must set parent bounds in populateNodeForItem()"); } // Set the visibility based on the parent bound. if (intersectVisibleToUser(mTempParentRect)) { node.setVisibleToUser(true); node.setBoundsInParent(mTempParentRect); } // Calculate screen-relative bound. mParentView.getLocationOnScreen(mTempGlobalRect); final int offsetX = mTempGlobalRect[0]; final int offsetY = mTempGlobalRect[1]; mTempScreenRect.set(mTempParentRect); mTempScreenRect.offset(offsetX, offsetY); node.setBoundsInScreen(mTempScreenRect); return node; } /** * Computes whether the specified {@link Rect} intersects with the visible * portion of its parent {@link View}. Modifies {@code localRect} to * contain only the visible portion. * * @param localRect A rectangle in local (parent) coordinates. * @return Whether the specified {@link Rect} is visible on the screen. */ private boolean intersectVisibleToUser(Rect localRect) { // Missing or empty bounds mean this view is not visible. if ((localRect == null) || localRect.isEmpty()) { return false; } // Attached to invisible window means this view is not visible. if (mParentView.getWindowVisibility() != View.VISIBLE) { return false; } // An invisible predecessor or one with alpha zero means // that this view is not visible to the user. Object current = this; while (current instanceof View) { final View view = (View) current; // We have attach info so this view is attached and there is no // need to check whether we reach to ViewRootImpl on the way up. if ((ViewHelper.getAlpha(view) <= 0) || (view.getVisibility() != View.VISIBLE)) { return false; } current = view.getParent(); } // If no portion of the parent is visible, this view is not visible. if (!mParentView.getLocalVisibleRect(mTempVisibleRect)) { return false; } // Check if the view intersects the visible portion of the parent. return localRect.intersect(mTempVisibleRect); } public AccessibilityDelegateCompat getAccessibilityDelegate() { return mDelegate; } /** * Performs an accessibility action on the specified item. See * {@link AccessibilityNodeInfoCompat#performAction(int, Bundle)}. * <p> * The helper class automatically handles focus management resulting from * {@link AccessibilityNodeInfoCompat#ACTION_ACCESSIBILITY_FOCUS} and * {@link AccessibilityNodeInfoCompat#ACTION_CLEAR_ACCESSIBILITY_FOCUS}, so * typically a developer only needs to handle actions added manually in the * {{@link #populateNodeForItem(Object, AccessibilityNodeInfoCompat)} * method. * </p> * * @param item The item on which to perform the action. * @param action The accessibility action to perform. * @param arguments Arguments for the action, or optionally {@code null}. * @return {@code true} if the action was performed successfully. */ protected abstract boolean performActionForItem(T item, int action, Bundle arguments); /** * Populates an event with information about the specified item. * <p> * At a minimum, a developer must populate the event text by doing one of * the following: * <ul> * <li>appending text to {@link AccessibilityEvent#getText()}</li> * <li>populating a description with * {@link AccessibilityEvent#setContentDescription(CharSequence)}</li> * </ul> * </p> * * @param item The item for which to populate the event. * @param event The event to populate. */ protected abstract void populateEventForItem(T item, AccessibilityEvent event); /** * Populates a node with information about the specified item. * <p/> * At a minimum, a developer must: * <ul> * <li>populate the event text using * {@link AccessibilityNodeInfoCompat#setText(CharSequence)} or * {@link AccessibilityNodeInfoCompat#setContentDescription(CharSequence)} * </li> * <li>set the item's parent-relative bounds using * {@link AccessibilityNodeInfoCompat#setBoundsInParent(Rect)} * </ul> * * @param item The item for which to populate the node. * @param node The node to populate. */ protected abstract void populateNodeForItem(T item, AccessibilityNodeInfoCompat node); /** * Populates a list with the parent view's visible items. * <p> * The result of this method is cached until the developer calls * {@link #invalidateParent()}. * </p> * * @param items The list to populate with visible items. */ protected abstract void getVisibleItems(List<T> items); /** * Returns the item under the specified parent-relative coordinates. * * @param x The parent-relative x coordinate. * @param y The parent-relative y coordinate. * @return The item under coordinates (x,y). */ protected abstract T getItemAt(float x, float y); /** * Returns the unique identifier for an item. If the specified item does not * exist, returns {@link #INVALID_ID}. * <p> * This result of this method must be consistent with * {@link #getItemForId(int)}. * </p> * * @param item The item whose identifier to return. * @return A unique identifier, or {@link #INVALID_ID}. */ protected abstract int getIdForItem(T item); /** * Returns the item for a unique identifier. If the specified item does not * exist, returns {@code null}. * * @param id The identifier for the item to return. * @return An item, or {@code null}. */ protected abstract T getItemForId(int id); }
RomzesRover/HoloEverywhere
library/src/org/holoeverywhere/widget/datetimepicker/TouchExplorationHelper.java
Java
mit
17,677
<?php namespace Oro\Bundle\MigrationBundle\Tests\Unit\Event; use Oro\Bundle\MigrationBundle\Event\MigrationEvent; class MigrationEventTest extends \PHPUnit_Framework_TestCase { /** * @var MigrationEvent */ protected $migrationEvent; protected $connection; protected function setUp() { $this->connection = $this->getMockBuilder('Doctrine\DBAL\Connection') ->disableOriginalConstructor() ->getMock(); $this->migrationEvent = new MigrationEvent($this->connection); } public function testMigrationData() { $middleMigration = $this->getMockForAbstractClass('Oro\Bundle\MigrationBundle\Migration\Migration'); $this->migrationEvent->addMigration($middleMigration); $firstMigration = $this->getMockForAbstractClass('Oro\Bundle\MigrationBundle\Migration\Migration'); $this->migrationEvent->addMigration($firstMigration, true); $lastMigration = $this->getMockForAbstractClass('Oro\Bundle\MigrationBundle\Migration\Migration'); $this->migrationEvent->addMigration($lastMigration); $migrations = $this->migrationEvent->getMigrations(); $this->assertEquals(3, count($migrations)); $this->assertEquals($firstMigration, $migrations[0]); $this->assertEquals($middleMigration, $migrations[1]); $this->assertEquals($lastMigration, $migrations[2]); } public function testGetData() { $sql = 'select * from test_table'; $params = []; $types = []; $this->connection->expects($this->once()) ->method('fetchAll') ->with($sql, $params, $types) ->will($this->returnValue([])); $this->migrationEvent->getData($sql, $params, $types); } }
MarkThink/OROCRM
vendor/oro/platform/src/Oro/Bundle/MigrationBundle/Tests/Unit/Event/MigrationEventTest.php
PHP
mit
1,781
// Copyright (c) 2015 GitHub, Inc. // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. #include "atom/browser/api/frame_subscriber.h" #include "atom/common/node_includes.h" #include "base/bind.h" #include "media/base/video_frame.h" #include "media/base/yuv_convert.h" namespace atom { namespace api { FrameSubscriber::FrameSubscriber(v8::Isolate* isolate, const gfx::Size& size, const FrameCaptureCallback& callback) : isolate_(isolate), size_(size), callback_(callback) { } bool FrameSubscriber::ShouldCaptureFrame( const gfx::Rect& damage_rect, base::TimeTicks present_time, scoped_refptr<media::VideoFrame>* storage, DeliverFrameCallback* callback) { *storage = media::VideoFrame::CreateFrame( media::PIXEL_FORMAT_YV12, size_, gfx::Rect(size_), size_, base::TimeDelta()); *callback = base::Bind(&FrameSubscriber::OnFrameDelivered, base::Unretained(this), *storage); return true; } void FrameSubscriber::OnFrameDelivered( scoped_refptr<media::VideoFrame> frame, base::TimeTicks, bool result) { if (!result) return; v8::Locker locker(isolate_); v8::HandleScope handle_scope(isolate_); gfx::Rect rect = frame->visible_rect(); size_t rgb_arr_size = rect.width() * rect.height() * 4; v8::MaybeLocal<v8::Object> buffer = node::Buffer::New(isolate_, rgb_arr_size); if (buffer.IsEmpty()) return; // Convert a frame of YUV to 32 bit ARGB. media::ConvertYUVToRGB32(frame->data(media::VideoFrame::kYPlane), frame->data(media::VideoFrame::kUPlane), frame->data(media::VideoFrame::kVPlane), reinterpret_cast<uint8*>( node::Buffer::Data(buffer.ToLocalChecked())), rect.width(), rect.height(), frame->stride(media::VideoFrame::kYPlane), frame->stride(media::VideoFrame::kUVPlane), rect.width() * 4, media::YV12); callback_.Run(buffer.ToLocalChecked()); } } // namespace api } // namespace atom
ankitaggarwal011/electron
atom/browser/api/frame_subscriber.cc
C++
mit
2,252
<p>This is about</p>
nolazybits/ui-router-addons
sample_app/app/js/main/templates/about.tpl.html
HTML
mit
20
/** @module ember @submodule ember-htmlbars */ import isEnabled from 'ember-metal/features'; import { keyword } from 'htmlbars-runtime/hooks'; import closureAction from 'ember-routing-htmlbars/keywords/closure-action'; /** The `{{action}}` helper provides a useful shortcut for registering an HTML element within a template for a single DOM event and forwarding that interaction to the template's controller or specified `target` option. If the controller does not implement the specified action, the event is sent to the current route, and it bubbles up the route hierarchy from there. For more advanced event handling see [Ember.Component](/api/classes/Ember.Component.html) ### Use Given the following application Handlebars template on the page ```handlebars <div {{action 'anActionName'}}> click me </div> ``` And application code ```javascript App.ApplicationController = Ember.Controller.extend({ actions: { anActionName: function() { } } }); ``` Will result in the following rendered HTML ```html <div class="ember-view"> <div data-ember-action="1"> click me </div> </div> ``` Clicking "click me" will trigger the `anActionName` action of the `App.ApplicationController`. In this case, no additional parameters will be passed. If you provide additional parameters to the helper: ```handlebars <button {{action 'edit' post}}>Edit</button> ``` Those parameters will be passed along as arguments to the JavaScript function implementing the action. ### Event Propagation Events triggered through the action helper will automatically have `.preventDefault()` called on them. You do not need to do so in your event handlers. If you need to allow event propagation (to handle file inputs for example) you can supply the `preventDefault=false` option to the `{{action}}` helper: ```handlebars <div {{action "sayHello" preventDefault=false}}> <input type="file" /> <input type="checkbox" /> </div> ``` To disable bubbling, pass `bubbles=false` to the helper: ```handlebars <button {{action 'edit' post bubbles=false}}>Edit</button> ``` If you need the default handler to trigger you should either register your own event handler, or use event methods on your view class. See [Ember.View](/api/classes/Ember.View.html) 'Responding to Browser Events' for more information. ### Specifying DOM event type By default the `{{action}}` helper registers for DOM `click` events. You can supply an `on` option to the helper to specify a different DOM event name: ```handlebars <div {{action "anActionName" on="doubleClick"}}> click me </div> ``` See `Ember.View` 'Responding to Browser Events' for a list of acceptable DOM event names. ### Specifying whitelisted modifier keys By default the `{{action}}` helper will ignore click event with pressed modifier keys. You can supply an `allowedKeys` option to specify which keys should not be ignored. ```handlebars <div {{action "anActionName" allowedKeys="alt"}}> click me </div> ``` This way the `{{action}}` will fire when clicking with the alt key pressed down. Alternatively, supply "any" to the `allowedKeys` option to accept any combination of modifier keys. ```handlebars <div {{action "anActionName" allowedKeys="any"}}> click me with any key pressed </div> ``` ### Specifying a Target There are several possible target objects for `{{action}}` helpers: In a typical Ember application, where templates are managed through use of the `{{outlet}}` helper, actions will bubble to the current controller, then to the current route, and then up the route hierarchy. Alternatively, a `target` option can be provided to the helper to change which object will receive the method call. This option must be a path to an object, accessible in the current context: ```handlebars {{! the application template }} <div {{action "anActionName" target=view}}> click me </div> ``` ```javascript App.ApplicationView = Ember.View.extend({ actions: { anActionName: function() {} } }); ``` ### Additional Parameters You may specify additional parameters to the `{{action}}` helper. These parameters are passed along as the arguments to the JavaScript function implementing the action. ```handlebars {{#each people as |person|}} <div {{action "edit" person}}> click me </div> {{/each}} ``` Clicking "click me" will trigger the `edit` method on the current controller with the value of `person` as a parameter. @method action @for Ember.Handlebars.helpers @public */ export default function(morph, env, scope, params, hash, template, inverse, visitor) { if (isEnabled('ember-routing-htmlbars-improved-actions')) { if (morph) { keyword('@element_action', morph, env, scope, params, hash, template, inverse, visitor); return true; } return closureAction(morph, env, scope, params, hash, template, inverse, visitor); } else { keyword('@element_action', morph, env, scope, params, hash, template, inverse, visitor); return true; } }
XrXr/ember.js
packages/ember-routing-htmlbars/lib/keywords/action.js
JavaScript
mit
5,218
/* * WYMeditor : what you see is What You Mean web-based editor * Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/ * Dual licensed under the MIT (MIT-license.txt) * and GPL (GPL-license.txt) licenses. * * For further information visit: * http://www.wymeditor.org/ * * File Name: * jquery.wymeditor.fullscreen.js * Fullscreen plugin for WYMeditor * * File Authors: * Luis Santos (luis.santos a-t openquest dotpt) * Jonatan Lundin (jonatan.lundin a-t gmail dotcom) * Gerd Riesselmann (gerd a-t gyro-php dot org) : Fixed issue with new skin layout * Philipp Cordes (pc a-t irgendware dotnet) */ //Extend WYMeditor WYMeditor.editor.prototype.fullscreen = function() { var wym = this, $box = jQuery(this._box), $iframe = jQuery(this._iframe), $overlay = null, $window = jQuery(window), editorMargin = 15; // Margin from window (without padding) //construct the button's html var html = '' + "<li class='wym_tools_fullscreen'>" + "<a name='Fullscreen' href='#' " + "title='Fullscreen' " + "style='background-image: url(" + wym._options.basePath + "plugins/fullscreen/icon_fullscreen.gif)'>" + "Fullscreen" + "</a>" + "</li>"; //add the button to the tools box $box.find(wym._options.toolsSelector + wym._options.toolsListSelector) .append(html); function resize () { // Calculate margins var uiHeight = $box.outerHeight(true) - $iframe.outerHeight(true); var editorPadding = $box.outerWidth() - $box.width(); // Calculate heights var screenHeight = $window.height(); var iframeHeight = (screenHeight - uiHeight - (editorMargin * 2)) + 'px'; // Calculate witdths var screenWidth = $window.width(); var boxWidth = (screenWidth - editorPadding - (editorMargin * 2)) + 'px'; $box.css('width', boxWidth); $iframe.css('height', iframeHeight); $overlay.css({ 'height': screenHeight + 'px', 'width': screenWidth + 'px' }); } //handle click event $box.find('li.wym_tools_fullscreen a').click(function() { if ($box.css('position') != 'fixed') { // Store previous inline styles $box.data('wym-inline-css', $box.attr('style')); $iframe.data('wym-inline-css', $iframe.attr('style')); // Create overlay $overlay = jQuery('<div id="wym-fullscreen-overlay"></div>') .appendTo('body').css({ 'position': 'fixed', 'background-color': 'rgb(0, 0, 0)', 'opacity': '0.75', 'z-index': '98', 'top': '0px', 'left': '0px' }); // Possition the editor $box.css({ 'position': 'fixed', 'z-index': '99', 'top': editorMargin + 'px', 'left': editorMargin + 'px' }); // Bind event listeners $window.bind('resize', resize); $box.find('li.wym_tools_html a').bind('click', resize); // Force resize resize(); } else { // Unbind event listeners $window.unbind('resize', resize); $box.find('li.wym_tools_html a').unbind('click', resize); // Remove inline styles $box.css({ 'position': 'static', 'z-index': '', 'width': '', 'top': '', 'left': '' }); $iframe.css('height', ''); // Remove overlay $overlay.remove(); $overlay = null; // Retore previous inline styles $box.attr('style', $box.data('wym-inline-css')); $iframe.attr('style', $iframe.data('wym-inline-css')); } return false; }); };
samuelcole/wymeditor
src/wymeditor/plugins/fullscreen/jquery.wymeditor.fullscreen.js
JavaScript
mit
4,141
/** ****************************************************************************** * @file stm32f30x_rcc.c * @author MCD Application Team * @version V1.2.2 * @date 27-February-2015 * @brief This file provides firmware functions to manage the following * functionalities of the Reset and clock control (RCC) peripheral: * + Internal/external clocks, PLL, CSS and MCO configuration * + System, AHB and APB busses clocks configuration * + Peripheral clocks configuration * + Interrupts and flags management * @verbatim =============================================================================== ##### RCC specific features ##### =============================================================================== [..] After reset the device is running from HSI (8 MHz) with Flash 0 WS, all peripherals are off except internal SRAM, Flash and SWD. (+) There is no prescaler on High speed (AHB) and Low speed (APB) busses; all peripherals mapped on these busses are running at HSI speed. (+) The clock for all peripherals is switched off, except the SRAM and FLASH. (+) All GPIOs are in input floating state, except the SWD pins which are assigned to be used for debug purpose. [..] Once the device starts from reset, the user application has to: (+) Configure the clock source to be used to drive the System clock (if the application needs higher frequency/performance). (+) Configure the System clock frequency and Flash settings. (+) Configure the AHB and APB busses prescalers. (+) Enable the clock for the peripheral(s) to be used. (+) Configure the clock source(s) for peripherals which clocks are not derived from the System clock (ADC, TIM, I2C, USART, RTC and IWDG). @endverbatim ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2> * * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); * You may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.st.com/software_license_agreement_liberty_v2 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "stm32f30x_rcc.h" /** @addtogroup STM32F30x_StdPeriph_Driver * @{ */ /** @defgroup RCC * @brief RCC driver modules * @{ */ /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* ------------ RCC registers bit address in the alias region ----------- */ #define RCC_OFFSET (RCC_BASE - PERIPH_BASE) /* --- CR Register ---*/ /* Alias word address of HSION bit */ #define CR_OFFSET (RCC_OFFSET + 0x00) #define HSION_BitNumber 0x00 #define CR_HSION_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (HSION_BitNumber * 4)) /* Alias word address of PLLON bit */ #define PLLON_BitNumber 0x18 #define CR_PLLON_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (PLLON_BitNumber * 4)) /* Alias word address of CSSON bit */ #define CSSON_BitNumber 0x13 #define CR_CSSON_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (CSSON_BitNumber * 4)) /* --- CFGR Register ---*/ /* Alias word address of USBPRE bit */ #define CFGR_OFFSET (RCC_OFFSET + 0x04) #define USBPRE_BitNumber 0x16 #define CFGR_USBPRE_BB (PERIPH_BB_BASE + (CFGR_OFFSET * 32) + (USBPRE_BitNumber * 4)) /* Alias word address of I2SSRC bit */ #define I2SSRC_BitNumber 0x17 #define CFGR_I2SSRC_BB (PERIPH_BB_BASE + (CFGR_OFFSET * 32) + (I2SSRC_BitNumber * 4)) /* --- BDCR Register ---*/ /* Alias word address of RTCEN bit */ #define BDCR_OFFSET (RCC_OFFSET + 0x20) #define RTCEN_BitNumber 0x0F #define BDCR_RTCEN_BB (PERIPH_BB_BASE + (BDCR_OFFSET * 32) + (RTCEN_BitNumber * 4)) /* Alias word address of BDRST bit */ #define BDRST_BitNumber 0x10 #define BDCR_BDRST_BB (PERIPH_BB_BASE + (BDCR_OFFSET * 32) + (BDRST_BitNumber * 4)) /* --- CSR Register ---*/ /* Alias word address of LSION bit */ #define CSR_OFFSET (RCC_OFFSET + 0x24) #define LSION_BitNumber 0x00 #define CSR_LSION_BB (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (LSION_BitNumber * 4)) /* ---------------------- RCC registers bit mask ------------------------ */ /* RCC Flag Mask */ #define FLAG_MASK ((uint8_t)0x1F) /* CFGR register byte 3 (Bits[31:23]) base address */ #define CFGR_BYTE3_ADDRESS ((uint32_t)0x40021007) /* CIR register byte 2 (Bits[15:8]) base address */ #define CIR_BYTE2_ADDRESS ((uint32_t)0x40021009) /* CIR register byte 3 (Bits[23:16]) base address */ #define CIR_BYTE3_ADDRESS ((uint32_t)0x4002100A) /* CR register byte 2 (Bits[23:16]) base address */ #define CR_BYTE2_ADDRESS ((uint32_t)0x40021002) /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ static __I uint8_t APBAHBPrescTable[16] = {0, 0, 0, 0, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 9}; static __I uint16_t ADCPrescTable[16] = {1, 2, 4, 6, 8, 10, 12, 16, 32, 64, 128, 256, 0, 0, 0, 0 }; /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /** @defgroup RCC_Private_Functions * @{ */ /** @defgroup RCC_Group1 Internal and external clocks, PLL, CSS and MCO configuration functions * @brief Internal and external clocks, PLL, CSS and MCO configuration functions * @verbatim =============================================================================== ##### Internal-external clocks, PLL, CSS and MCO configuration functions ##### =============================================================================== [..] This section provides functions allowing to configure the internal/external clocks, PLL, CSS and MCO. (#) HSI (high-speed internal), 8 MHz factory-trimmed RC used directly or through the PLL as System clock source. The HSI clock can be used also to clock the USART and I2C peripherals. (#) LSI (low-speed internal), 40 KHz low consumption RC used as IWDG and/or RTC clock source. (#) HSE (high-speed external), 4 to 32 MHz crystal oscillator used directly or through the PLL as System clock source. Can be used also as RTC clock source. (#) LSE (low-speed external), 32 KHz oscillator used as RTC clock source. LSE can be used also to clock the USART peripherals. (#) PLL (clocked by HSI or HSE), for System clock. (#) CSS (Clock security system), once enabled and if a HSE clock failure occurs (HSE used directly or through PLL as System clock source), the System clock is automatically switched to HSI and an interrupt is generated if enabled. The interrupt is linked to the Cortex-M4 NMI (Non-Maskable Interrupt) exception vector. (#) MCO (microcontroller clock output), used to output SYSCLK, HSI, HSE, LSI, LSE, PLL clock on PA8 pin. @endverbatim * @{ */ /** * @brief Resets the RCC clock configuration to the default reset state. * @note The default reset state of the clock configuration is given below: * - HSI ON and used as system clock source * - HSE, PLL and PLLI2S OFF * - AHB, APB1 and APB2 prescaler set to 1. * - CSS and MCO OFF * - All interrupts disabled * @note However, This function doesn't modify the configuration of the * - Peripheral clocks * - LSI, LSE and RTC clocks * @param None * @retval None */ void RCC_DeInit(void) { /* Set HSION bit */ RCC->CR |= (uint32_t)0x00000001; /* Reset SW[1:0], HPRE[3:0], PPRE[2:0] and MCOSEL[2:0] bits */ RCC->CFGR &= (uint32_t)0xF8FFC000; /* Reset HSEON, CSSON and PLLON bits */ RCC->CR &= (uint32_t)0xFEF6FFFF; /* Reset HSEBYP bit */ RCC->CR &= (uint32_t)0xFFFBFFFF; /* Reset PLLSRC, PLLXTPRE, PLLMUL and USBPRE bits */ RCC->CFGR &= (uint32_t)0xFF80FFFF; /* Reset PREDIV1[3:0] and ADCPRE[13:4] bits */ RCC->CFGR2 &= (uint32_t)0xFFFFC000; /* Reset USARTSW[1:0], I2CSW and TIMSW bits */ RCC->CFGR3 &= (uint32_t)0xF00ECCC; /* Disable all interrupts */ RCC->CIR = 0x00000000; } /** * @brief Configures the External High Speed oscillator (HSE). * @note After enabling the HSE (RCC_HSE_ON or RCC_HSE_Bypass), the application * software should wait on HSERDY flag to be set indicating that HSE clock * is stable and can be used to clock the PLL and/or system clock. * @note HSE state can not be changed if it is used directly or through the * PLL as system clock. In this case, you have to select another source * of the system clock then change the HSE state (ex. disable it). * @note The HSE is stopped by hardware when entering STOP and STANDBY modes. * @note This function resets the CSSON bit, so if the Clock security system(CSS) * was previously enabled you have to enable it again after calling this * function. * @param RCC_HSE: specifies the new state of the HSE. * This parameter can be one of the following values: * @arg RCC_HSE_OFF: turn OFF the HSE oscillator, HSERDY flag goes low after * 6 HSE oscillator clock cycles. * @arg RCC_HSE_ON: turn ON the HSE oscillator * @arg RCC_HSE_Bypass: HSE oscillator bypassed with external clock * @retval None */ void RCC_HSEConfig(uint8_t RCC_HSE) { /* Check the parameters */ assert_param(IS_RCC_HSE(RCC_HSE)); /* Reset HSEON and HSEBYP bits before configuring the HSE ------------------*/ *(__IO uint8_t *) CR_BYTE2_ADDRESS = RCC_HSE_OFF; /* Set the new HSE configuration -------------------------------------------*/ *(__IO uint8_t *) CR_BYTE2_ADDRESS = RCC_HSE; } /** * @brief Waits for HSE start-up. * @note This function waits on HSERDY flag to be set and return SUCCESS if * this flag is set, otherwise returns ERROR if the timeout is reached * and this flag is not set. The timeout value is defined by the constant * HSE_STARTUP_TIMEOUT in stm32f30x.h file. You can tailor it depending * on the HSE crystal used in your application. * @param None * @retval An ErrorStatus enumeration value: * - SUCCESS: HSE oscillator is stable and ready to use * - ERROR: HSE oscillator not yet ready */ ErrorStatus RCC_WaitForHSEStartUp(void) { __IO uint32_t StartUpCounter = 0; ErrorStatus status = ERROR; FlagStatus HSEStatus = RESET; /* Wait till HSE is ready and if timeout is reached exit */ do { HSEStatus = RCC_GetFlagStatus(RCC_FLAG_HSERDY); StartUpCounter++; } while((StartUpCounter != HSE_STARTUP_TIMEOUT) && (HSEStatus == RESET)); if (RCC_GetFlagStatus(RCC_FLAG_HSERDY) != RESET) { status = SUCCESS; } else { status = ERROR; } return (status); } /** * @brief Adjusts the Internal High Speed oscillator (HSI) calibration value. * @note The calibration is used to compensate for the variations in voltage * and temperature that influence the frequency of the internal HSI RC. * Refer to the Application Note AN3300 for more details on how to * calibrate the HSI. * @param HSICalibrationValue: specifies the HSI calibration trimming value. * This parameter must be a number between 0 and 0x1F. * @retval None */ void RCC_AdjustHSICalibrationValue(uint8_t HSICalibrationValue) { uint32_t tmpreg = 0; /* Check the parameters */ assert_param(IS_RCC_HSI_CALIBRATION_VALUE(HSICalibrationValue)); tmpreg = RCC->CR; /* Clear HSITRIM[4:0] bits */ tmpreg &= ~RCC_CR_HSITRIM; /* Set the HSITRIM[4:0] bits according to HSICalibrationValue value */ tmpreg |= (uint32_t)HSICalibrationValue << 3; /* Store the new value */ RCC->CR = tmpreg; } /** * @brief Enables or disables the Internal High Speed oscillator (HSI). * @note After enabling the HSI, the application software should wait on * HSIRDY flag to be set indicating that HSI clock is stable and can * be used to clock the PLL and/or system clock. * @note HSI can not be stopped if it is used directly or through the PLL * as system clock. In this case, you have to select another source * of the system clock then stop the HSI. * @note The HSI is stopped by hardware when entering STOP and STANDBY modes. * @note When the HSI is stopped, HSIRDY flag goes low after 6 HSI oscillator * clock cycles. * @param NewState: new state of the HSI. * This parameter can be: ENABLE or DISABLE. * @retval None */ void RCC_HSICmd(FunctionalState NewState) { /* Check the parameters */ assert_param(IS_FUNCTIONAL_STATE(NewState)); *(__IO uint32_t *) CR_HSION_BB = (uint32_t)NewState; } /** * @brief Configures the External Low Speed oscillator (LSE). * @note As the LSE is in the Backup domain and write access is denied to this * domain after reset, you have to enable write access using * PWR_BackupAccessCmd(ENABLE) function before to configure the LSE * (to be done once after reset). * @note Care must be taken when using this function to configure LSE mode * as it clears systematically the LSEON bit before any new configuration. * @note After enabling the LSE (RCC_LSE_ON or RCC_LSE_Bypass), the application * software should wait on LSERDY flag to be set indicating that LSE clock * is stable and can be used to clock the RTC. * @param RCC_LSE: specifies the new state of the LSE. * This parameter can be one of the following values: * @arg RCC_LSE_OFF: turn OFF the LSE oscillator, LSERDY flag goes low after * 6 LSE oscillator clock cycles. * @arg RCC_LSE_ON: turn ON the LSE oscillator * @arg RCC_LSE_Bypass: LSE oscillator bypassed with external clock * @retval None */ void RCC_LSEConfig(uint32_t RCC_LSE) { /* Check the parameters */ assert_param(IS_RCC_LSE(RCC_LSE)); /* Reset LSEON and LSEBYP bits before configuring the LSE ------------------*/ /* Reset LSEON bit */ RCC->BDCR &= ~(RCC_BDCR_LSEON); /* Reset LSEBYP bit */ RCC->BDCR &= ~(RCC_BDCR_LSEBYP); /* Configure LSE */ RCC->BDCR |= RCC_LSE; } /** * @brief Configures the External Low Speed oscillator (LSE) drive capability. * @param RCC_LSEDrive: specifies the new state of the LSE drive capability. * This parameter can be one of the following values: * @arg RCC_LSEDrive_Low: LSE oscillator low drive capability. * @arg RCC_LSEDrive_MediumLow: LSE oscillator medium low drive capability. * @arg RCC_LSEDrive_MediumHigh: LSE oscillator medium high drive capability. * @arg RCC_LSEDrive_High: LSE oscillator high drive capability. * @retval None */ void RCC_LSEDriveConfig(uint32_t RCC_LSEDrive) { /* Check the parameters */ assert_param(IS_RCC_LSE_DRIVE(RCC_LSEDrive)); /* Clear LSEDRV[1:0] bits */ RCC->BDCR &= ~(RCC_BDCR_LSEDRV); /* Set the LSE Drive */ RCC->BDCR |= RCC_LSEDrive; } /** * @brief Enables or disables the Internal Low Speed oscillator (LSI). * @note After enabling the LSI, the application software should wait on * LSIRDY flag to be set indicating that LSI clock is stable and can * be used to clock the IWDG and/or the RTC. * @note LSI can not be disabled if the IWDG is running. * @note When the LSI is stopped, LSIRDY flag goes low after 6 LSI oscillator * clock cycles. * @param NewState: new state of the LSI. * This parameter can be: ENABLE or DISABLE. * @retval None */ void RCC_LSICmd(FunctionalState NewState) { /* Check the parameters */ assert_param(IS_FUNCTIONAL_STATE(NewState)); *(__IO uint32_t *) CSR_LSION_BB = (uint32_t)NewState; } /** * @brief Configures the PLL clock source and multiplication factor. * @note This function must be used only when the PLL is disabled. * @note The minimum input clock frequency for PLL is 2 MHz (when using HSE as * PLL source). * @param RCC_PLLSource: specifies the PLL entry clock source. * This parameter can be one of the following values: * @arg RCC_PLLSource_HSI: HSI oscillator clockselected as PLL clock entry * @arg RCC_PLLSource_HSI_Div2: HSI oscillator clock divided by 2 selected as * PLL clock entry * @arg RCC_PLLSource_PREDIV1: PREDIV1 clock selected as PLL clock source * @param RCC_PLLMul: specifies the PLL multiplication factor, which drive the PLLVCO clock * This parameter can be RCC_PLLMul_x where x:[2,16] * * @retval None */ void RCC_PLLConfig(uint32_t RCC_PLLSource, uint32_t RCC_PLLMul) { /* Check the parameters */ assert_param(IS_RCC_PLL_SOURCE(RCC_PLLSource)); assert_param(IS_RCC_PLL_MUL(RCC_PLLMul)); /* Clear PLL Source [16] and Multiplier [21:18] bits */ RCC->CFGR &= ~(RCC_CFGR_PLLMULL | RCC_CFGR_PLLSRC); /* Set the PLL Source and Multiplier */ RCC->CFGR |= (uint32_t)(RCC_PLLSource | RCC_PLLMul); } /** * @brief Enables or disables the PLL. * @note After enabling the PLL, the application software should wait on * PLLRDY flag to be set indicating that PLL clock is stable and can * be used as system clock source. * @note The PLL can not be disabled if it is used as system clock source * @note The PLL is disabled by hardware when entering STOP and STANDBY modes. * @param NewState: new state of the PLL. * This parameter can be: ENABLE or DISABLE. * @retval None */ void RCC_PLLCmd(FunctionalState NewState) { /* Check the parameters */ assert_param(IS_FUNCTIONAL_STATE(NewState)); *(__IO uint32_t *) CR_PLLON_BB = (uint32_t)NewState; } /** * @brief Configures the PREDIV1 division factor. * @note This function must be used only when the PLL is disabled. * @param RCC_PREDIV1_Div: specifies the PREDIV1 clock division factor. * This parameter can be RCC_PREDIV1_Divx where x:[1,16] * @retval None */ void RCC_PREDIV1Config(uint32_t RCC_PREDIV1_Div) { uint32_t tmpreg = 0; /* Check the parameters */ assert_param(IS_RCC_PREDIV1(RCC_PREDIV1_Div)); tmpreg = RCC->CFGR2; /* Clear PREDIV1[3:0] bits */ tmpreg &= ~(RCC_CFGR2_PREDIV1); /* Set the PREDIV1 division factor */ tmpreg |= RCC_PREDIV1_Div; /* Store the new value */ RCC->CFGR2 = tmpreg; } /** * @brief Enables or disables the Clock Security System. * @note If a failure is detected on the HSE oscillator clock, this oscillator * is automatically disabled and an interrupt is generated to inform the * software about the failure (Clock Security System Interrupt, CSSI), * allowing the MCU to perform rescue operations. The CSSI is linked to * the Cortex-M4 NMI (Non-Maskable Interrupt) exception vector. * @param NewState: new state of the Clock Security System. * This parameter can be: ENABLE or DISABLE. * @retval None */ void RCC_ClockSecuritySystemCmd(FunctionalState NewState) { /* Check the parameters */ assert_param(IS_FUNCTIONAL_STATE(NewState)); *(__IO uint32_t *) CR_CSSON_BB = (uint32_t)NewState; } #ifdef STM32F303xC /** * @brief Selects the clock source to output on MCO pin (PA8). * @note PA8 should be configured in alternate function mode. * @param RCC_MCOSource: specifies the clock source to output. * This parameter can be one of the following values: * @arg RCC_MCOSource_NoClock: No clock selected. * @arg RCC_MCOSource_LSI: LSI oscillator clock selected. * @arg RCC_MCOSource_LSE: LSE oscillator clock selected. * @arg RCC_MCOSource_SYSCLK: System clock selected. * @arg RCC_MCOSource_HSI: HSI oscillator clock selected. * @arg RCC_MCOSource_HSE: HSE oscillator clock selected. * @arg RCC_MCOSource_PLLCLK_Div2: PLL clock divided by 2 selected. * @retval None */ void RCC_MCOConfig(uint8_t RCC_MCOSource) { uint32_t tmpreg = 0; /* Check the parameters */ assert_param(IS_RCC_MCO_SOURCE(RCC_MCOSource)); /* Get CFGR value */ tmpreg = RCC->CFGR; /* Clear MCO[3:0] bits */ tmpreg &= ~(RCC_CFGR_MCO | RCC_CFGR_PLLNODIV); /* Set the RCC_MCOSource */ tmpreg |= RCC_MCOSource<<24; /* Store the new value */ RCC->CFGR = tmpreg; } #else /** * @brief Selects the clock source to output on MCO pin (PA8) and the corresponding * prescsaler. * @note PA8 should be configured in alternate function mode. * @param RCC_MCOSource: specifies the clock source to output. * This parameter can be one of the following values: * @arg RCC_MCOSource_NoClock: No clock selected. * @arg RCC_MCOSource_LSI: LSI oscillator clock selected. * @arg RCC_MCOSource_LSE: LSE oscillator clock selected. * @arg RCC_MCOSource_SYSCLK: System clock selected. * @arg RCC_MCOSource_HSI: HSI oscillator clock selected. * @arg RCC_MCOSource_HSE: HSE oscillator clock selected. * @arg RCC_MCOSource_PLLCLK_Div2: PLL clock divided by 2 selected. * @arg RCC_MCOSource_PLLCLK: PLL clock selected. * @param RCC_MCOPrescaler: specifies the prescaler on MCO pin. * This parameter can be one of the following values: * @arg RCC_MCOPrescaler_1: MCO clock is divided by 1. * @arg RCC_MCOPrescaler_2: MCO clock is divided by 2. * @arg RCC_MCOPrescaler_4: MCO clock is divided by 4. * @arg RCC_MCOPrescaler_8: MCO clock is divided by 8. * @arg RCC_MCOPrescaler_16: MCO clock is divided by 16. * @arg RCC_MCOPrescaler_32: MCO clock is divided by 32. * @arg RCC_MCOPrescaler_64: MCO clock is divided by 64. * @arg RCC_MCOPrescaler_128: MCO clock is divided by 128. * @retval None */ void RCC_MCOConfig(uint8_t RCC_MCOSource, uint32_t RCC_MCOPrescaler) { uint32_t tmpreg = 0; /* Check the parameters */ assert_param(IS_RCC_MCO_SOURCE(RCC_MCOSource)); assert_param(IS_RCC_MCO_PRESCALER(RCC_MCOPrescaler)); /* Get CFGR value */ tmpreg = RCC->CFGR; /* Clear MCOPRE[2:0] bits */ tmpreg &= ~(RCC_CFGR_MCO_PRE | RCC_CFGR_MCO | RCC_CFGR_PLLNODIV); /* Set the RCC_MCOSource and RCC_MCOPrescaler */ tmpreg |= (RCC_MCOPrescaler | RCC_MCOSource<<24); /* Store the new value */ RCC->CFGR = tmpreg; } #endif /* STM32F303xC */ /** * @} */ /** @defgroup RCC_Group2 System AHB, APB1 and APB2 busses clocks configuration functions * @brief System, AHB and APB busses clocks configuration functions * @verbatim =============================================================================== ##### System, AHB, APB1 and APB2 busses clocks configuration functions ##### =============================================================================== [..] This section provide functions allowing to configure the System, AHB, APB1 and APB2 busses clocks. (#) Several clock sources can be used to drive the System clock (SYSCLK): HSI, HSE and PLL. The AHB clock (HCLK) is derived from System clock through configurable prescaler and used to clock the CPU, memory and peripherals mapped on AHB bus (DMA and GPIO). APB1 (PCLK1) and APB2 (PCLK2) clocks are derived from AHB clock through configurable prescalers and used to clock the peripherals mapped on these busses. You can use "RCC_GetClocksFreq()" function to retrieve the frequencies of these clocks. (#) The maximum frequency of the SYSCLK, HCLK, PCLK1 and PCLK2 is 72 MHz. Depending on the maximum frequency, the FLASH wait states (WS) should be adapted accordingly: +---------------------------------+ | Wait states | HCLK clock | | (Latency) | frequency (MHz) | |-------------- |-----------------| |0WS(1CPU cycle)| 0 < HCLK <= 24 | |---------------|-----------------| |1WS(2CPU cycle)|24 < HCLK <=48 | |---------------|-----------------| |2WS(3CPU cycle)|48 < HCLK <= 72 | +---------------------------------+ (#) After reset, the System clock source is the HSI (8 MHz) with 0 WS and prefetch is disabled. [..] (@) All the peripheral clocks are derived from the System clock (SYSCLK) except: (+@) The FLASH program/erase clock which is always HSI 8MHz clock. (+@) The USB 48 MHz clock which is derived from the PLL VCO clock. (+@) The USART clock which can be derived as well from HSI 8MHz, LSI or LSE. (+@) The I2C clock which can be derived as well from HSI 8MHz clock. (+@) The ADC clock which is derived from PLL output. (+@) The RTC clock which is derived from the LSE, LSI or 1 MHz HSE_RTC (HSE divided by a programmable prescaler). The System clock (SYSCLK) frequency must be higher or equal to the RTC clock frequency. (+@) IWDG clock which is always the LSI clock. [..] It is recommended to use the following software sequences to tune the number of wait states needed to access the Flash memory with the CPU frequency (HCLK). (+) Increasing the CPU frequency (++) Program the Flash Prefetch buffer, using "FLASH_PrefetchBufferCmd(ENABLE)" function (++) Check that Flash Prefetch buffer activation is taken into account by reading FLASH_ACR using the FLASH_GetPrefetchBufferStatus() function (++) Program Flash WS to 1 or 2, using "FLASH_SetLatency()" function (++) Check that the new number of WS is taken into account by reading FLASH_ACR (++) Modify the CPU clock source, using "RCC_SYSCLKConfig()" function (++) If needed, modify the CPU clock prescaler by using "RCC_HCLKConfig()" function (++) Check that the new CPU clock source is taken into account by reading the clock source status, using "RCC_GetSYSCLKSource()" function (+) Decreasing the CPU frequency (++) Modify the CPU clock source, using "RCC_SYSCLKConfig()" function (++) If needed, modify the CPU clock prescaler by using "RCC_HCLKConfig()" function (++) Check that the new CPU clock source is taken into account by reading the clock source status, using "RCC_GetSYSCLKSource()" function (++) Program the new number of WS, using "FLASH_SetLatency()" function (++) Check that the new number of WS is taken into account by reading FLASH_ACR (++) Disable the Flash Prefetch buffer using "FLASH_PrefetchBufferCmd(DISABLE)" function (++) Check that Flash Prefetch buffer deactivation is taken into account by reading FLASH_ACR using the FLASH_GetPrefetchBufferStatus() function. @endverbatim * @{ */ /** * @brief Configures the system clock (SYSCLK). * @note The HSI is used (enabled by hardware) as system clock source after * startup from Reset, wake-up from STOP and STANDBY mode, or in case * of failure of the HSE used directly or indirectly as system clock * (if the Clock Security System CSS is enabled). * @note A switch from one clock source to another occurs only if the target * clock source is ready (clock stable after startup delay or PLL locked). * If a clock source which is not yet ready is selected, the switch will * occur when the clock source will be ready. * You can use RCC_GetSYSCLKSource() function to know which clock is * currently used as system clock source. * @param RCC_SYSCLKSource: specifies the clock source used as system clock source * This parameter can be one of the following values: * @arg RCC_SYSCLKSource_HSI: HSI selected as system clock source * @arg RCC_SYSCLKSource_HSE: HSE selected as system clock source * @arg RCC_SYSCLKSource_PLLCLK: PLL selected as system clock source * @retval None */ void RCC_SYSCLKConfig(uint32_t RCC_SYSCLKSource) { uint32_t tmpreg = 0; /* Check the parameters */ assert_param(IS_RCC_SYSCLK_SOURCE(RCC_SYSCLKSource)); tmpreg = RCC->CFGR; /* Clear SW[1:0] bits */ tmpreg &= ~RCC_CFGR_SW; /* Set SW[1:0] bits according to RCC_SYSCLKSource value */ tmpreg |= RCC_SYSCLKSource; /* Store the new value */ RCC->CFGR = tmpreg; } /** * @brief Returns the clock source used as system clock. * @param None * @retval The clock source used as system clock. The returned value can be one * of the following values: * - 0x00: HSI used as system clock * - 0x04: HSE used as system clock * - 0x08: PLL used as system clock */ uint8_t RCC_GetSYSCLKSource(void) { return ((uint8_t)(RCC->CFGR & RCC_CFGR_SWS)); } /** * @brief Configures the AHB clock (HCLK). * @note Depending on the device voltage range, the software has to set correctly * these bits to ensure that the system frequency does not exceed the * maximum allowed frequency (for more details refer to section above * "CPU, AHB and APB busses clocks configuration functions"). * @param RCC_SYSCLK: defines the AHB clock divider. This clock is derived from * the system clock (SYSCLK). * This parameter can be one of the following values: * @arg RCC_SYSCLK_Div1: AHB clock = SYSCLK * @arg RCC_SYSCLK_Div2: AHB clock = SYSCLK/2 * @arg RCC_SYSCLK_Div4: AHB clock = SYSCLK/4 * @arg RCC_SYSCLK_Div8: AHB clock = SYSCLK/8 * @arg RCC_SYSCLK_Div16: AHB clock = SYSCLK/16 * @arg RCC_SYSCLK_Div64: AHB clock = SYSCLK/64 * @arg RCC_SYSCLK_Div128: AHB clock = SYSCLK/128 * @arg RCC_SYSCLK_Div256: AHB clock = SYSCLK/256 * @arg RCC_SYSCLK_Div512: AHB clock = SYSCLK/512 * @retval None */ void RCC_HCLKConfig(uint32_t RCC_SYSCLK) { uint32_t tmpreg = 0; /* Check the parameters */ assert_param(IS_RCC_HCLK(RCC_SYSCLK)); tmpreg = RCC->CFGR; /* Clear HPRE[3:0] bits */ tmpreg &= ~RCC_CFGR_HPRE; /* Set HPRE[3:0] bits according to RCC_SYSCLK value */ tmpreg |= RCC_SYSCLK; /* Store the new value */ RCC->CFGR = tmpreg; } /** * @brief Configures the Low Speed APB clock (PCLK1). * @param RCC_HCLK: defines the APB1 clock divider. This clock is derived from * the AHB clock (HCLK). * This parameter can be one of the following values: * @arg RCC_HCLK_Div1: APB1 clock = HCLK * @arg RCC_HCLK_Div2: APB1 clock = HCLK/2 * @arg RCC_HCLK_Div4: APB1 clock = HCLK/4 * @arg RCC_HCLK_Div8: APB1 clock = HCLK/8 * @arg RCC_HCLK_Div16: APB1 clock = HCLK/16 * @retval None */ void RCC_PCLK1Config(uint32_t RCC_HCLK) { uint32_t tmpreg = 0; /* Check the parameters */ assert_param(IS_RCC_PCLK(RCC_HCLK)); tmpreg = RCC->CFGR; /* Clear PPRE1[2:0] bits */ tmpreg &= ~RCC_CFGR_PPRE1; /* Set PPRE1[2:0] bits according to RCC_HCLK value */ tmpreg |= RCC_HCLK; /* Store the new value */ RCC->CFGR = tmpreg; } /** * @brief Configures the High Speed APB clock (PCLK2). * @param RCC_HCLK: defines the APB2 clock divider. This clock is derived from * the AHB clock (HCLK). * This parameter can be one of the following values: * @arg RCC_HCLK_Div1: APB2 clock = HCLK * @arg RCC_HCLK_Div2: APB2 clock = HCLK/2 * @arg RCC_HCLK_Div4: APB2 clock = HCLK/4 * @arg RCC_HCLK_Div8: APB2 clock = HCLK/8 * @arg RCC_HCLK_Div16: APB2 clock = HCLK/16 * @retval None */ void RCC_PCLK2Config(uint32_t RCC_HCLK) { uint32_t tmpreg = 0; /* Check the parameters */ assert_param(IS_RCC_PCLK(RCC_HCLK)); tmpreg = RCC->CFGR; /* Clear PPRE2[2:0] bits */ tmpreg &= ~RCC_CFGR_PPRE2; /* Set PPRE2[2:0] bits according to RCC_HCLK value */ tmpreg |= RCC_HCLK << 3; /* Store the new value */ RCC->CFGR = tmpreg; } /** * @brief Returns the frequencies of the System, AHB, APB2 and APB1 busses clocks. * * @note This function returns the frequencies of : * System, AHB, APB2 and APB1 busses clocks, ADC1/2/3/4 clocks, * USART1/2/3/4/5 clocks, I2C1/2 clocks and TIM1/8 Clocks. * * @note The frequency returned by this function is not the real frequency * in the chip. It is calculated based on the predefined constant and * the source selected by RCC_SYSCLKConfig(). * * @note If SYSCLK source is HSI, function returns constant HSI_VALUE(*) * * @note If SYSCLK source is HSE, function returns constant HSE_VALUE(**) * * @note If SYSCLK source is PLL, function returns constant HSE_VALUE(**) * or HSI_VALUE(*) multiplied by the PLL factors. * * @note (*) HSI_VALUE is a constant defined in stm32f30x.h file (default value * 8 MHz) but the real value may vary depending on the variations * in voltage and temperature, refer to RCC_AdjustHSICalibrationValue(). * * @note (**) HSE_VALUE is a constant defined in stm32f30x.h file (default value * 8 MHz), user has to ensure that HSE_VALUE is same as the real * frequency of the crystal used. Otherwise, this function may * return wrong result. * * @note The result of this function could be not correct when using fractional * value for HSE crystal. * * @param RCC_Clocks: pointer to a RCC_ClocksTypeDef structure which will hold * the clocks frequencies. * * @note This function can be used by the user application to compute the * baudrate for the communication peripherals or configure other parameters. * @note Each time SYSCLK, HCLK, PCLK1 and/or PCLK2 clock changes, this function * must be called to update the structure's field. Otherwise, any * configuration based on this function will be incorrect. * * @retval None */ void RCC_GetClocksFreq(RCC_ClocksTypeDef* RCC_Clocks) { uint32_t tmp = 0, pllmull = 0, pllsource = 0, prediv1factor = 0, presc = 0, pllclk = 0; uint32_t apb2presc = 0, ahbpresc = 0; /* Get SYSCLK source -------------------------------------------------------*/ tmp = RCC->CFGR & RCC_CFGR_SWS; switch (tmp) { case 0x00: /* HSI used as system clock */ RCC_Clocks->SYSCLK_Frequency = HSI_VALUE; break; case 0x04: /* HSE used as system clock */ RCC_Clocks->SYSCLK_Frequency = HSE_VALUE; break; case 0x08: /* PLL used as system clock */ /* Get PLL clock source and multiplication factor ----------------------*/ pllmull = RCC->CFGR & RCC_CFGR_PLLMULL; pllsource = RCC->CFGR & RCC_CFGR_PLLSRC; pllmull = ( pllmull >> 18) + 2; if (pllsource == 0x00) { /* HSI oscillator clock divided by 2 selected as PLL clock entry */ pllclk = (HSI_VALUE >> 1) * pllmull; } else { prediv1factor = (RCC->CFGR2 & RCC_CFGR2_PREDIV1) + 1; /* HSE oscillator clock selected as PREDIV1 clock entry */ pllclk = (HSE_VALUE / prediv1factor) * pllmull; } RCC_Clocks->SYSCLK_Frequency = pllclk; break; default: /* HSI used as system clock */ RCC_Clocks->SYSCLK_Frequency = HSI_VALUE; break; } /* Compute HCLK, PCLK clocks frequencies -----------------------------------*/ /* Get HCLK prescaler */ tmp = RCC->CFGR & RCC_CFGR_HPRE; tmp = tmp >> 4; ahbpresc = APBAHBPrescTable[tmp]; /* HCLK clock frequency */ RCC_Clocks->HCLK_Frequency = RCC_Clocks->SYSCLK_Frequency >> ahbpresc; /* Get PCLK1 prescaler */ tmp = RCC->CFGR & RCC_CFGR_PPRE1; tmp = tmp >> 8; presc = APBAHBPrescTable[tmp]; /* PCLK1 clock frequency */ RCC_Clocks->PCLK1_Frequency = RCC_Clocks->HCLK_Frequency >> presc; /* Get PCLK2 prescaler */ tmp = RCC->CFGR & RCC_CFGR_PPRE2; tmp = tmp >> 11; apb2presc = APBAHBPrescTable[tmp]; /* PCLK2 clock frequency */ RCC_Clocks->PCLK2_Frequency = RCC_Clocks->HCLK_Frequency >> apb2presc; /* Get ADC12CLK prescaler */ tmp = RCC->CFGR2 & RCC_CFGR2_ADCPRE12; tmp = tmp >> 4; presc = ADCPrescTable[tmp & 0x0F]; if (((tmp & 0x10) != 0) && (presc != 0)) { /* ADC12CLK clock frequency is derived from PLL clock */ RCC_Clocks->ADC12CLK_Frequency = pllclk / presc; } else { /* ADC12CLK clock frequency is AHB clock */ RCC_Clocks->ADC12CLK_Frequency = RCC_Clocks->SYSCLK_Frequency; } /* Get ADC34CLK prescaler */ tmp = RCC->CFGR2 & RCC_CFGR2_ADCPRE34; tmp = tmp >> 9; presc = ADCPrescTable[tmp & 0x0F]; if (((tmp & 0x10) != 0) && (presc != 0)) { /* ADC34CLK clock frequency is derived from PLL clock */ RCC_Clocks->ADC34CLK_Frequency = pllclk / presc; } else { /* ADC34CLK clock frequency is AHB clock */ RCC_Clocks->ADC34CLK_Frequency = RCC_Clocks->SYSCLK_Frequency; } /* I2C1CLK clock frequency */ if((RCC->CFGR3 & RCC_CFGR3_I2C1SW) != RCC_CFGR3_I2C1SW) { /* I2C1 Clock is HSI Osc. */ RCC_Clocks->I2C1CLK_Frequency = HSI_VALUE; } else { /* I2C1 Clock is System Clock */ RCC_Clocks->I2C1CLK_Frequency = RCC_Clocks->SYSCLK_Frequency; } /* I2C2CLK clock frequency */ if((RCC->CFGR3 & RCC_CFGR3_I2C2SW) != RCC_CFGR3_I2C2SW) { /* I2C2 Clock is HSI Osc. */ RCC_Clocks->I2C2CLK_Frequency = HSI_VALUE; } else { /* I2C2 Clock is System Clock */ RCC_Clocks->I2C2CLK_Frequency = RCC_Clocks->SYSCLK_Frequency; } /* I2C3CLK clock frequency */ if((RCC->CFGR3 & RCC_CFGR3_I2C3SW) != RCC_CFGR3_I2C3SW) { /* I2C3 Clock is HSI Osc. */ RCC_Clocks->I2C3CLK_Frequency = HSI_VALUE; } else { /* I2C3 Clock is System Clock */ RCC_Clocks->I2C3CLK_Frequency = RCC_Clocks->SYSCLK_Frequency; } /* TIM1CLK clock frequency */ if(((RCC->CFGR3 & RCC_CFGR3_TIM1SW) == RCC_CFGR3_TIM1SW)&& (RCC_Clocks->SYSCLK_Frequency == pllclk) \ && (apb2presc == ahbpresc)) { /* TIM1 Clock is 2 * pllclk */ RCC_Clocks->TIM1CLK_Frequency = pllclk * 2; } else { /* TIM1 Clock is APB2 clock. */ RCC_Clocks->TIM1CLK_Frequency = RCC_Clocks->PCLK2_Frequency; } #ifdef STM32F303xE uint32_t apb1presc = 0; apb1presc = APBAHBPrescTable[tmp]; /* TIM2CLK clock frequency */ if(((RCC->CFGR3 & RCC_CFGR3_TIM2SW) == RCC_CFGR3_TIM2SW)&& (RCC_Clocks->SYSCLK_Frequency == pllclk) \ && (apb1presc == ahbpresc)) { /* TIM2 Clock is pllclk */ RCC_Clocks->TIM2CLK_Frequency = pllclk * 2 ; } else { /* TIM2 Clock is APB2 clock. */ RCC_Clocks->TIM2CLK_Frequency = RCC_Clocks->PCLK1_Frequency; } /* TIM3CLK clock frequency */ if(((RCC->CFGR3 & RCC_CFGR3_TIM3SW) == RCC_CFGR3_TIM3SW)&& (RCC_Clocks->SYSCLK_Frequency == pllclk) \ && (apb1presc == ahbpresc)) { /* TIM3 Clock is pllclk */ RCC_Clocks->TIM3CLK_Frequency = pllclk * 2; } else { /* TIM3 Clock is APB2 clock. */ RCC_Clocks->TIM3CLK_Frequency = RCC_Clocks->PCLK1_Frequency; } #endif /* STM32F303xE */ /* TIM1CLK clock frequency */ if(((RCC->CFGR3 & RCC_CFGR3_HRTIM1SW) == RCC_CFGR3_HRTIM1SW)&& (RCC_Clocks->SYSCLK_Frequency == pllclk) \ && (apb2presc == ahbpresc)) { /* HRTIM1 Clock is 2 * pllclk */ RCC_Clocks->HRTIM1CLK_Frequency = pllclk * 2; } else { /* HRTIM1 Clock is APB2 clock. */ RCC_Clocks->HRTIM1CLK_Frequency = RCC_Clocks->PCLK2_Frequency; } /* TIM8CLK clock frequency */ if(((RCC->CFGR3 & RCC_CFGR3_TIM8SW) == RCC_CFGR3_TIM8SW)&& (RCC_Clocks->SYSCLK_Frequency == pllclk) \ && (apb2presc == ahbpresc)) { /* TIM8 Clock is 2 * pllclk */ RCC_Clocks->TIM8CLK_Frequency = pllclk * 2; } else { /* TIM8 Clock is APB2 clock. */ RCC_Clocks->TIM8CLK_Frequency = RCC_Clocks->PCLK2_Frequency; } /* TIM15CLK clock frequency */ if(((RCC->CFGR3 & RCC_CFGR3_TIM15SW) == RCC_CFGR3_TIM15SW)&& (RCC_Clocks->SYSCLK_Frequency == pllclk) \ && (apb2presc == ahbpresc)) { /* TIM15 Clock is 2 * pllclk */ RCC_Clocks->TIM15CLK_Frequency = pllclk * 2; } else { /* TIM15 Clock is APB2 clock. */ RCC_Clocks->TIM15CLK_Frequency = RCC_Clocks->PCLK2_Frequency; } /* TIM16CLK clock frequency */ if(((RCC->CFGR3 & RCC_CFGR3_TIM16SW) == RCC_CFGR3_TIM16SW)&& (RCC_Clocks->SYSCLK_Frequency == pllclk) \ && (apb2presc == ahbpresc)) { /* TIM16 Clock is 2 * pllclk */ RCC_Clocks->TIM16CLK_Frequency = pllclk * 2; } else { /* TIM16 Clock is APB2 clock. */ RCC_Clocks->TIM16CLK_Frequency = RCC_Clocks->PCLK2_Frequency; } /* TIM17CLK clock frequency */ if(((RCC->CFGR3 & RCC_CFGR3_TIM17SW) == RCC_CFGR3_TIM17SW)&& (RCC_Clocks->SYSCLK_Frequency == pllclk) \ && (apb2presc == ahbpresc)) { /* TIM17 Clock is 2 * pllclk */ RCC_Clocks->TIM17CLK_Frequency = pllclk * 2; } else { /* TIM17 Clock is APB2 clock. */ RCC_Clocks->TIM16CLK_Frequency = RCC_Clocks->PCLK2_Frequency; } /* TIM20CLK clock frequency */ if(((RCC->CFGR3 & RCC_CFGR3_TIM20SW) == RCC_CFGR3_TIM20SW)&& (RCC_Clocks->SYSCLK_Frequency == pllclk) \ && (apb2presc == ahbpresc)) { /* TIM20 Clock is 2 * pllclk */ RCC_Clocks->TIM20CLK_Frequency = pllclk * 2; } else { /* TIM20 Clock is APB2 clock. */ RCC_Clocks->TIM20CLK_Frequency = RCC_Clocks->PCLK2_Frequency; } /* USART1CLK clock frequency */ if((RCC->CFGR3 & RCC_CFGR3_USART1SW) == 0x0) { #if defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F301x8) || defined(STM32F302x8) /* USART1 Clock is PCLK1 instead of PCLK2 (limitation described in the STM32F302/01/34 x4/x6/x8 respective erratasheets) */ RCC_Clocks->USART1CLK_Frequency = RCC_Clocks->PCLK1_Frequency; #else /* USART Clock is PCLK2 */ RCC_Clocks->USART1CLK_Frequency = RCC_Clocks->PCLK2_Frequency; #endif } else if((RCC->CFGR3 & RCC_CFGR3_USART1SW) == RCC_CFGR3_USART1SW_0) { /* USART Clock is System Clock */ RCC_Clocks->USART1CLK_Frequency = RCC_Clocks->SYSCLK_Frequency; } else if((RCC->CFGR3 & RCC_CFGR3_USART1SW) == RCC_CFGR3_USART1SW_1) { /* USART Clock is LSE Osc. */ RCC_Clocks->USART1CLK_Frequency = LSE_VALUE; } else if((RCC->CFGR3 & RCC_CFGR3_USART1SW) == RCC_CFGR3_USART1SW) { /* USART Clock is HSI Osc. */ RCC_Clocks->USART1CLK_Frequency = HSI_VALUE; } /* USART2CLK clock frequency */ if((RCC->CFGR3 & RCC_CFGR3_USART2SW) == 0x0) { /* USART Clock is PCLK */ RCC_Clocks->USART2CLK_Frequency = RCC_Clocks->PCLK1_Frequency; } else if((RCC->CFGR3 & RCC_CFGR3_USART2SW) == RCC_CFGR3_USART2SW_0) { /* USART Clock is System Clock */ RCC_Clocks->USART2CLK_Frequency = RCC_Clocks->SYSCLK_Frequency; } else if((RCC->CFGR3 & RCC_CFGR3_USART2SW) == RCC_CFGR3_USART2SW_1) { /* USART Clock is LSE Osc. */ RCC_Clocks->USART2CLK_Frequency = LSE_VALUE; } else if((RCC->CFGR3 & RCC_CFGR3_USART2SW) == RCC_CFGR3_USART2SW) { /* USART Clock is HSI Osc. */ RCC_Clocks->USART2CLK_Frequency = HSI_VALUE; } /* USART3CLK clock frequency */ if((RCC->CFGR3 & RCC_CFGR3_USART3SW) == 0x0) { /* USART Clock is PCLK */ RCC_Clocks->USART3CLK_Frequency = RCC_Clocks->PCLK1_Frequency; } else if((RCC->CFGR3 & RCC_CFGR3_USART3SW) == RCC_CFGR3_USART3SW_0) { /* USART Clock is System Clock */ RCC_Clocks->USART3CLK_Frequency = RCC_Clocks->SYSCLK_Frequency; } else if((RCC->CFGR3 & RCC_CFGR3_USART3SW) == RCC_CFGR3_USART3SW_1) { /* USART Clock is LSE Osc. */ RCC_Clocks->USART3CLK_Frequency = LSE_VALUE; } else if((RCC->CFGR3 & RCC_CFGR3_USART3SW) == RCC_CFGR3_USART3SW) { /* USART Clock is HSI Osc. */ RCC_Clocks->USART3CLK_Frequency = HSI_VALUE; } /* UART4CLK clock frequency */ if((RCC->CFGR3 & RCC_CFGR3_UART4SW) == 0x0) { /* USART Clock is PCLK */ RCC_Clocks->UART4CLK_Frequency = RCC_Clocks->PCLK1_Frequency; } else if((RCC->CFGR3 & RCC_CFGR3_UART4SW) == RCC_CFGR3_UART4SW_0) { /* USART Clock is System Clock */ RCC_Clocks->UART4CLK_Frequency = RCC_Clocks->SYSCLK_Frequency; } else if((RCC->CFGR3 & RCC_CFGR3_UART4SW) == RCC_CFGR3_UART4SW_1) { /* USART Clock is LSE Osc. */ RCC_Clocks->UART4CLK_Frequency = LSE_VALUE; } else if((RCC->CFGR3 & RCC_CFGR3_UART4SW) == RCC_CFGR3_UART4SW) { /* USART Clock is HSI Osc. */ RCC_Clocks->UART4CLK_Frequency = HSI_VALUE; } /* UART5CLK clock frequency */ if((RCC->CFGR3 & RCC_CFGR3_UART5SW) == 0x0) { /* USART Clock is PCLK */ RCC_Clocks->UART5CLK_Frequency = RCC_Clocks->PCLK1_Frequency; } else if((RCC->CFGR3 & RCC_CFGR3_UART5SW) == RCC_CFGR3_UART5SW_0) { /* USART Clock is System Clock */ RCC_Clocks->UART5CLK_Frequency = RCC_Clocks->SYSCLK_Frequency; } else if((RCC->CFGR3 & RCC_CFGR3_UART5SW) == RCC_CFGR3_UART5SW_1) { /* USART Clock is LSE Osc. */ RCC_Clocks->UART5CLK_Frequency = LSE_VALUE; } else if((RCC->CFGR3 & RCC_CFGR3_UART5SW) == RCC_CFGR3_UART5SW) { /* USART Clock is HSI Osc. */ RCC_Clocks->UART5CLK_Frequency = HSI_VALUE; } } /** * @} */ /** @defgroup RCC_Group3 Peripheral clocks configuration functions * @brief Peripheral clocks configuration functions * @verbatim =============================================================================== ##### Peripheral clocks configuration functions ##### =============================================================================== [..] This section provide functions allowing to configure the Peripheral clocks. (#) The RTC clock which is derived from the LSE, LSI or HSE_Div32 (HSE divided by 32). (#) After restart from Reset or wakeup from STANDBY, all peripherals are off except internal SRAM, Flash and SWD. Before to start using a peripheral you have to enable its interface clock. You can do this using RCC_AHBPeriphClockCmd(), RCC_APB2PeriphClockCmd() and RCC_APB1PeriphClockCmd() functions. (#) To reset the peripherals configuration (to the default state after device reset) you can use RCC_AHBPeriphResetCmd(), RCC_APB2PeriphResetCmd() and RCC_APB1PeriphResetCmd() functions. @endverbatim * @{ */ /** * @brief Configures the ADC clock (ADCCLK). * @param RCC_PLLCLK: defines the ADC clock divider. This clock is derived from * the PLL Clock. * This parameter can be one of the following values: * @arg RCC_ADC12PLLCLK_OFF: ADC12 clock disabled * @arg RCC_ADC12PLLCLK_Div1: ADC12 clock = PLLCLK/1 * @arg RCC_ADC12PLLCLK_Div2: ADC12 clock = PLLCLK/2 * @arg RCC_ADC12PLLCLK_Div4: ADC12 clock = PLLCLK/4 * @arg RCC_ADC12PLLCLK_Div6: ADC12 clock = PLLCLK/6 * @arg RCC_ADC12PLLCLK_Div8: ADC12 clock = PLLCLK/8 * @arg RCC_ADC12PLLCLK_Div10: ADC12 clock = PLLCLK/10 * @arg RCC_ADC12PLLCLK_Div12: ADC12 clock = PLLCLK/12 * @arg RCC_ADC12PLLCLK_Div16: ADC12 clock = PLLCLK/16 * @arg RCC_ADC12PLLCLK_Div32: ADC12 clock = PLLCLK/32 * @arg RCC_ADC12PLLCLK_Div64: ADC12 clock = PLLCLK/64 * @arg RCC_ADC12PLLCLK_Div128: ADC12 clock = PLLCLK/128 * @arg RCC_ADC12PLLCLK_Div256: ADC12 clock = PLLCLK/256 * @arg RCC_ADC34PLLCLK_OFF: ADC34 clock disabled * @arg RCC_ADC34PLLCLK_Div1: ADC34 clock = PLLCLK/1 * @arg RCC_ADC34PLLCLK_Div2: ADC34 clock = PLLCLK/2 * @arg RCC_ADC34PLLCLK_Div4: ADC34 clock = PLLCLK/4 * @arg RCC_ADC34PLLCLK_Div6: ADC34 clock = PLLCLK/6 * @arg RCC_ADC34PLLCLK_Div8: ADC34 clock = PLLCLK/8 * @arg RCC_ADC34PLLCLK_Div10: ADC34 clock = PLLCLK/10 * @arg RCC_ADC34PLLCLK_Div12: ADC34 clock = PLLCLK/12 * @arg RCC_ADC34PLLCLK_Div16: ADC34 clock = PLLCLK/16 * @arg RCC_ADC34PLLCLK_Div32: ADC34 clock = PLLCLK/32 * @arg RCC_ADC34PLLCLK_Div64: ADC34 clock = PLLCLK/64 * @arg RCC_ADC34PLLCLK_Div128: ADC34 clock = PLLCLK/128 * @arg RCC_ADC34PLLCLK_Div256: ADC34 clock = PLLCLK/256 * @retval None */ void RCC_ADCCLKConfig(uint32_t RCC_PLLCLK) { uint32_t tmp = 0; /* Check the parameters */ assert_param(IS_RCC_ADCCLK(RCC_PLLCLK)); tmp = (RCC_PLLCLK >> 28); /* Clears ADCPRE34 bits */ if (tmp != 0) { RCC->CFGR2 &= ~RCC_CFGR2_ADCPRE34; } /* Clears ADCPRE12 bits */ else { RCC->CFGR2 &= ~RCC_CFGR2_ADCPRE12; } /* Set ADCPRE bits according to RCC_PLLCLK value */ RCC->CFGR2 |= RCC_PLLCLK; } /** * @brief Configures the I2C clock (I2CCLK). * @param RCC_I2CCLK: defines the I2C clock source. This clock is derived * from the HSI or System clock. * This parameter can be one of the following values: * @arg RCC_I2CxCLK_HSI: I2Cx clock = HSI * @arg RCC_I2CxCLK_SYSCLK: I2Cx clock = System Clock * (x can be 1 or 2 or 3). * @retval None */ void RCC_I2CCLKConfig(uint32_t RCC_I2CCLK) { uint32_t tmp = 0; /* Check the parameters */ assert_param(IS_RCC_I2CCLK(RCC_I2CCLK)); tmp = (RCC_I2CCLK >> 28); /* Clear I2CSW bit */ switch (tmp) { case 0x00: RCC->CFGR3 &= ~RCC_CFGR3_I2C1SW; break; case 0x01: RCC->CFGR3 &= ~RCC_CFGR3_I2C2SW; break; case 0x02: RCC->CFGR3 &= ~RCC_CFGR3_I2C3SW; break; default: break; } /* Set I2CSW bits according to RCC_I2CCLK value */ RCC->CFGR3 |= RCC_I2CCLK; } /** * @brief Configures the TIMx clock sources(TIMCLK). * @note For STM32F303xC devices, TIMx can be clocked from the PLL running at 144 MHz * when the system clock source is the PLL and HCLK & PCLK2 clocks are not divided in respect to SYSCLK. * For the devices STM32F334x8, STM32F302x8 and STM32F303xE, TIMx can be clocked from the PLL running at * 144 MHz when the system clock source is the PLL and AHB or APB2 subsystem clocks are not divided by * more than 2 cumulatively. * @note If one of the previous conditions is missed, the TIM clock source * configuration is lost and calling again this function becomes mandatory. * @param RCC_TIMCLK: defines the TIMx clock source. * This parameter can be one of the following values: * @arg RCC_TIMxCLK_PCLK: TIMx clock = APB clock (doubled frequency when prescaled) * @arg RCC_TIMxCLK_PLLCLK: TIMx clock = PLL output (running up to 144 MHz) * (x can be 1, 8, 15, 16, 17, 20, 2, 3,4). * @note For STM32F303xC devices, TIM1 and TIM8 can be clocked at 144MHz. * For STM32F303xE devices, TIM1/8/20/2/3/4/15/16/17 can be clocked at 144MHz. * For STM32F334x8 devices , only TIM1 can be clocked at 144MHz. * For STM32F302x8 devices, TIM1/15/16/17 can be clocked at 144MHz * @retval None */ void RCC_TIMCLKConfig(uint32_t RCC_TIMCLK) { uint32_t tmp = 0; /* Check the parameters */ assert_param(IS_RCC_TIMCLK(RCC_TIMCLK)); tmp = (RCC_TIMCLK >> 28); /* Clear TIMSW bit */ switch (tmp) { case 0x00: RCC->CFGR3 &= ~RCC_CFGR3_TIM1SW; break; case 0x01: RCC->CFGR3 &= ~RCC_CFGR3_TIM8SW; break; case 0x02: RCC->CFGR3 &= ~RCC_CFGR3_TIM15SW; break; case 0x03: RCC->CFGR3 &= ~RCC_CFGR3_TIM16SW; break; case 0x04: RCC->CFGR3 &= ~RCC_CFGR3_TIM17SW; break; case 0x05: RCC->CFGR3 &= ~RCC_CFGR3_TIM20SW; case 0x06: RCC->CFGR3 &= ~RCC_CFGR3_TIM2SW; case 0x07: RCC->CFGR3 &= ~RCC_CFGR3_TIM3SW; break; default: break; } /* Set I2CSW bits according to RCC_TIMCLK value */ RCC->CFGR3 |= RCC_TIMCLK; } /** * @brief Configures the HRTIM1 clock sources(HRTIM1CLK). * @note The configuration of the HRTIM1 clock source is only possible when the * SYSCLK = PLL and HCLK and PCLK2 clocks are not divided in respect to SYSCLK * @note If one of the previous conditions is missed, the TIM clock source * configuration is lost and calling again this function becomes mandatory. * @param RCC_HRTIMCLK: defines the TIMx clock source. * This parameter can be one of the following values: * @arg RCC_HRTIM1CLK_HCLK: TIMx clock = APB high speed clock (doubled frequency * when prescaled) * @arg RCC_HRTIM1CLK_PLLCLK: TIMx clock = PLL output (running up to 144 MHz) * (x can be 1 or 8). * @retval None */ void RCC_HRTIM1CLKConfig(uint32_t RCC_HRTIMCLK) { /* Check the parameters */ assert_param(IS_RCC_HRTIMCLK(RCC_HRTIMCLK)); /* Clear HRTIMSW bit */ RCC->CFGR3 &= ~RCC_CFGR3_HRTIM1SW; /* Set HRTIMSW bits according to RCC_HRTIMCLK value */ RCC->CFGR3 |= RCC_HRTIMCLK; } /** * @brief Configures the USART clock (USARTCLK). * @param RCC_USARTCLK: defines the USART clock source. This clock is derived * from the HSI or System clock. * This parameter can be one of the following values: * @arg RCC_USARTxCLK_PCLK: USART clock = APB Clock (PCLK) * @arg RCC_USARTxCLK_SYSCLK: USART clock = System Clock * @arg RCC_USARTxCLK_LSE: USART clock = LSE Clock * @arg RCC_USARTxCLK_HSI: USART clock = HSI Clock * (x can be 1, 2, 3, 4 or 5). * @retval None */ void RCC_USARTCLKConfig(uint32_t RCC_USARTCLK) { uint32_t tmp = 0; /* Check the parameters */ assert_param(IS_RCC_USARTCLK(RCC_USARTCLK)); tmp = (RCC_USARTCLK >> 28); /* Clear USARTSW[1:0] bit */ switch (tmp) { case 0x01: /* clear USART1SW */ RCC->CFGR3 &= ~RCC_CFGR3_USART1SW; break; case 0x02: /* clear USART2SW */ RCC->CFGR3 &= ~RCC_CFGR3_USART2SW; break; case 0x03: /* clear USART3SW */ RCC->CFGR3 &= ~RCC_CFGR3_USART3SW; break; case 0x04: /* clear UART4SW */ RCC->CFGR3 &= ~RCC_CFGR3_UART4SW; break; case 0x05: /* clear UART5SW */ RCC->CFGR3 &= ~RCC_CFGR3_UART5SW; break; default: break; } /* Set USARTSW bits according to RCC_USARTCLK value */ RCC->CFGR3 |= RCC_USARTCLK; } /** * @brief Configures the USB clock (USBCLK). * @param RCC_USBCLKSource: specifies the USB clock source. This clock is * derived from the PLL output. * This parameter can be one of the following values: * @arg RCC_USBCLKSource_PLLCLK_1Div5: PLL clock divided by 1,5 selected as USB * clock source * @arg RCC_USBCLKSource_PLLCLK_Div1: PLL clock selected as USB clock source * @retval None */ void RCC_USBCLKConfig(uint32_t RCC_USBCLKSource) { /* Check the parameters */ assert_param(IS_RCC_USBCLK_SOURCE(RCC_USBCLKSource)); *(__IO uint32_t *) CFGR_USBPRE_BB = RCC_USBCLKSource; } /** * @brief Configures the RTC clock (RTCCLK). * @note As the RTC clock configuration bits are in the Backup domain and write * access is denied to this domain after reset, you have to enable write * access using PWR_BackupAccessCmd(ENABLE) function before to configure * the RTC clock source (to be done once after reset). * @note Once the RTC clock is configured it can't be changed unless the RTC * is reset using RCC_BackupResetCmd function, or by a Power On Reset (POR) * * @param RCC_RTCCLKSource: specifies the RTC clock source. * This parameter can be one of the following values: * @arg RCC_RTCCLKSource_LSE: LSE selected as RTC clock * @arg RCC_RTCCLKSource_LSI: LSI selected as RTC clock * @arg RCC_RTCCLKSource_HSE_Div32: HSE divided by 32 selected as RTC clock * * @note If the LSE or LSI is used as RTC clock source, the RTC continues to * work in STOP and STANDBY modes, and can be used as wakeup source. * However, when the HSE clock is used as RTC clock source, the RTC * cannot be used in STOP and STANDBY modes. * @note The maximum input clock frequency for RTC is 2MHz (when using HSE as * RTC clock source). * @retval None */ void RCC_RTCCLKConfig(uint32_t RCC_RTCCLKSource) { /* Check the parameters */ assert_param(IS_RCC_RTCCLK_SOURCE(RCC_RTCCLKSource)); /* Select the RTC clock source */ RCC->BDCR |= RCC_RTCCLKSource; } /** * @brief Configures the I2S clock source (I2SCLK). * @note This function must be called before enabling the SPI2 and SPI3 clocks. * @param RCC_I2SCLKSource: specifies the I2S clock source. * This parameter can be one of the following values: * @arg RCC_I2S2CLKSource_SYSCLK: SYSCLK clock used as I2S clock source * @arg RCC_I2S2CLKSource_Ext: External clock mapped on the I2S_CKIN pin * used as I2S clock source * @retval None */ void RCC_I2SCLKConfig(uint32_t RCC_I2SCLKSource) { /* Check the parameters */ assert_param(IS_RCC_I2SCLK_SOURCE(RCC_I2SCLKSource)); *(__IO uint32_t *) CFGR_I2SSRC_BB = RCC_I2SCLKSource; } /** * @brief Enables or disables the RTC clock. * @note This function must be used only after the RTC clock source was selected * using the RCC_RTCCLKConfig function. * @param NewState: new state of the RTC clock. * This parameter can be: ENABLE or DISABLE. * @retval None */ void RCC_RTCCLKCmd(FunctionalState NewState) { /* Check the parameters */ assert_param(IS_FUNCTIONAL_STATE(NewState)); *(__IO uint32_t *) BDCR_RTCEN_BB = (uint32_t)NewState; } /** * @brief Forces or releases the Backup domain reset. * @note This function resets the RTC peripheral (including the backup registers) * and the RTC clock source selection in RCC_BDCR register. * @param NewState: new state of the Backup domain reset. * This parameter can be: ENABLE or DISABLE. * @retval None */ void RCC_BackupResetCmd(FunctionalState NewState) { /* Check the parameters */ assert_param(IS_FUNCTIONAL_STATE(NewState)); *(__IO uint32_t *) BDCR_BDRST_BB = (uint32_t)NewState; } /** * @brief Enables or disables the AHB peripheral clock. * @note After reset, the peripheral clock (used for registers read/write access) * is disabled and the application software has to enable this clock before * using it. * @param RCC_AHBPeriph: specifies the AHB peripheral to gates its clock. * This parameter can be any combination of the following values: * @arg RCC_AHBPeriph_GPIOA * @arg RCC_AHBPeriph_GPIOB * @arg RCC_AHBPeriph_GPIOC * @arg RCC_AHBPeriph_GPIOD * @arg RCC_AHBPeriph_GPIOE * @arg RCC_AHBPeriph_GPIOF * @arg RCC_AHBPeriph_GPIOG * @arg RCC_AHBPeriph_GPIOH * @arg RCC_AHBPeriph_TS * @arg RCC_AHBPeriph_CRC * @arg RCC_AHBPeriph_FMC * @arg RCC_AHBPeriph_FLITF (has effect only when the Flash memory is in power down mode) * @arg RCC_AHBPeriph_SRAM * @arg RCC_AHBPeriph_DMA2 * @arg RCC_AHBPeriph_DMA1 * @arg RCC_AHBPeriph_ADC34 * @arg RCC_AHBPeriph_ADC12 * @param NewState: new state of the specified peripheral clock. * This parameter can be: ENABLE or DISABLE. * @retval None */ void RCC_AHBPeriphClockCmd(uint32_t RCC_AHBPeriph, FunctionalState NewState) { /* Check the parameters */ assert_param(IS_RCC_AHB_PERIPH(RCC_AHBPeriph)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { RCC->AHBENR |= RCC_AHBPeriph; } else { RCC->AHBENR &= ~RCC_AHBPeriph; } } /** * @brief Enables or disables the High Speed APB (APB2) peripheral clock. * @note After reset, the peripheral clock (used for registers read/write access) * is disabled and the application software has to enable this clock before * using it. * @param RCC_APB2Periph: specifies the APB2 peripheral to gates its clock. * This parameter can be any combination of the following values: * @arg RCC_APB2Periph_SYSCFG * @arg RCC_APB2Periph_SPI1 * @arg RCC_APB2Periph_USART1 * @arg RCC_APB2Periph_SPI4 * @arg RCC_APB2Periph_TIM15 * @arg RCC_APB2Periph_TIM16 * @arg RCC_APB2Periph_TIM17 * @arg RCC_APB2Periph_TIM1 * @arg RCC_APB2Periph_TIM8 * @arg RCC_APB2Periph_HRTIM1 * @arg RCC_APB2Periph_TIM20 * @param NewState: new state of the specified peripheral clock. * This parameter can be: ENABLE or DISABLE. * @retval None */ void RCC_APB2PeriphClockCmd(uint32_t RCC_APB2Periph, FunctionalState NewState) { /* Check the parameters */ assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { RCC->APB2ENR |= RCC_APB2Periph; } else { RCC->APB2ENR &= ~RCC_APB2Periph; } } /** * @brief Enables or disables the Low Speed APB (APB1) peripheral clock. * @note After reset, the peripheral clock (used for registers read/write access) * is disabled and the application software has to enable this clock before * using it. * @param RCC_APB1Periph: specifies the APB1 peripheral to gates its clock. * This parameter can be any combination of the following values: * @arg RCC_APB1Periph_TIM2 * @arg RCC_APB1Periph_TIM3 * @arg RCC_APB1Periph_TIM4 * @arg RCC_APB1Periph_TIM6 * @arg RCC_APB1Periph_TIM7 * @arg RCC_APB1Periph_WWDG * @arg RCC_APB1Periph_SPI2 * @arg RCC_APB1Periph_SPI3 * @arg RCC_APB1Periph_USART2 * @arg RCC_APB1Periph_USART3 * @arg RCC_APB1Periph_UART4 * @arg RCC_APB1Periph_UART5 * @arg RCC_APB1Periph_I2C1 * @arg RCC_APB1Periph_I2C2 * @arg RCC_APB1Periph_USB * @arg RCC_APB1Periph_CAN1 * @arg RCC_APB1Periph_PWR * @arg RCC_APB1Periph_DAC1 * @arg RCC_APB1Periph_DAC2 * @arg RCC_APB1Periph_I2C3 * @param NewState: new state of the specified peripheral clock. * This parameter can be: ENABLE or DISABLE. * @retval None */ void RCC_APB1PeriphClockCmd(uint32_t RCC_APB1Periph, FunctionalState NewState) { /* Check the parameters */ assert_param(IS_RCC_APB1_PERIPH(RCC_APB1Periph)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { RCC->APB1ENR |= RCC_APB1Periph; } else { RCC->APB1ENR &= ~RCC_APB1Periph; } } /** * @brief Forces or releases AHB peripheral reset. * @param RCC_AHBPeriph: specifies the AHB peripheral to reset. * This parameter can be any combination of the following values: * @arg RCC_AHBPeriph_FMC * @arg RCC_AHBPeriph_GPIOH * @arg RCC_AHBPeriph_GPIOA * @arg RCC_AHBPeriph_GPIOB * @arg RCC_AHBPeriph_GPIOC * @arg RCC_AHBPeriph_GPIOD * @arg RCC_AHBPeriph_GPIOE * @arg RCC_AHBPeriph_GPIOF * @arg RCC_AHBPeriph_GPIOG * @arg RCC_AHBPeriph_TS * @arg RCC_AHBPeriph_ADC34 * @arg RCC_AHBPeriph_ADC12 * @param NewState: new state of the specified peripheral reset. * This parameter can be: ENABLE or DISABLE. * @retval None */ void RCC_AHBPeriphResetCmd(uint32_t RCC_AHBPeriph, FunctionalState NewState) { /* Check the parameters */ assert_param(IS_RCC_AHB_RST_PERIPH(RCC_AHBPeriph)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { RCC->AHBRSTR |= RCC_AHBPeriph; } else { RCC->AHBRSTR &= ~RCC_AHBPeriph; } } /** * @brief Forces or releases High Speed APB (APB2) peripheral reset. * @param RCC_APB2Periph: specifies the APB2 peripheral to reset. * This parameter can be any combination of the following values: * @arg RCC_APB2Periph_SYSCFG * @arg RCC_APB2Periph_SPI1 * @arg RCC_APB2Periph_USART1 * @arg RCC_APB2Periph_SPI4 * @arg RCC_APB2Periph_TIM15 * @arg RCC_APB2Periph_TIM16 * @arg RCC_APB2Periph_TIM17 * @arg RCC_APB2Periph_TIM1 * @arg RCC_APB2Periph_TIM8 * @arg RCC_APB2Periph_TIM20 * @arg RCC_APB2Periph_HRTIM1 * @param NewState: new state of the specified peripheral reset. * This parameter can be: ENABLE or DISABLE. * @retval None */ void RCC_APB2PeriphResetCmd(uint32_t RCC_APB2Periph, FunctionalState NewState) { /* Check the parameters */ assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { RCC->APB2RSTR |= RCC_APB2Periph; } else { RCC->APB2RSTR &= ~RCC_APB2Periph; } } /** * @brief Forces or releases Low Speed APB (APB1) peripheral reset. * @param RCC_APB1Periph: specifies the APB1 peripheral to reset. * This parameter can be any combination of the following values: * @arg RCC_APB1Periph_TIM2 * @arg RCC_APB1Periph_TIM3 * @arg RCC_APB1Periph_TIM4 * @arg RCC_APB1Periph_TIM6 * @arg RCC_APB1Periph_TIM7 * @arg RCC_APB1Periph_WWDG * @arg RCC_APB1Periph_SPI2 * @arg RCC_APB1Periph_SPI3 * @arg RCC_APB1Periph_USART2 * @arg RCC_APB1Periph_USART3 * @arg RCC_APB1Periph_UART4 * @arg RCC_APB1Periph_UART5 * @arg RCC_APB1Periph_I2C1 * @arg RCC_APB1Periph_I2C2 * @arg RCC_APB1Periph_I2C3 * @arg RCC_APB1Periph_USB * @arg RCC_APB1Periph_CAN1 * @arg RCC_APB1Periph_PWR * @arg RCC_APB1Periph_DAC * @param NewState: new state of the specified peripheral clock. * This parameter can be: ENABLE or DISABLE. * @retval None */ void RCC_APB1PeriphResetCmd(uint32_t RCC_APB1Periph, FunctionalState NewState) { /* Check the parameters */ assert_param(IS_RCC_APB1_PERIPH(RCC_APB1Periph)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { RCC->APB1RSTR |= RCC_APB1Periph; } else { RCC->APB1RSTR &= ~RCC_APB1Periph; } } /** * @} */ /** @defgroup RCC_Group4 Interrupts and flags management functions * @brief Interrupts and flags management functions * @verbatim =============================================================================== ##### Interrupts and flags management functions ##### =============================================================================== @endverbatim * @{ */ /** * @brief Enables or disables the specified RCC interrupts. * @note The CSS interrupt doesn't have an enable bit; once the CSS is enabled * and if the HSE clock fails, the CSS interrupt occurs and an NMI is * automatically generated. The NMI will be executed indefinitely, and * since NMI has higher priority than any other IRQ (and main program) * the application will be stacked in the NMI ISR unless the CSS interrupt * pending bit is cleared. * @param RCC_IT: specifies the RCC interrupt sources to be enabled or disabled. * This parameter can be any combination of the following values: * @arg RCC_IT_LSIRDY: LSI ready interrupt * @arg RCC_IT_LSERDY: LSE ready interrupt * @arg RCC_IT_HSIRDY: HSI ready interrupt * @arg RCC_IT_HSERDY: HSE ready interrupt * @arg RCC_IT_PLLRDY: PLL ready interrupt * @param NewState: new state of the specified RCC interrupts. * This parameter can be: ENABLE or DISABLE. * @retval None */ void RCC_ITConfig(uint8_t RCC_IT, FunctionalState NewState) { /* Check the parameters */ assert_param(IS_RCC_IT(RCC_IT)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Perform Byte access to RCC_CIR[13:8] bits to enable the selected interrupts */ *(__IO uint8_t *) CIR_BYTE2_ADDRESS |= RCC_IT; } else { /* Perform Byte access to RCC_CIR[13:8] bits to disable the selected interrupts */ *(__IO uint8_t *) CIR_BYTE2_ADDRESS &= (uint8_t)~RCC_IT; } } /** * @brief Checks whether the specified RCC flag is set or not. * @param RCC_FLAG: specifies the flag to check. * This parameter can be one of the following values: * @arg RCC_FLAG_HSIRDY: HSI oscillator clock ready * @arg RCC_FLAG_HSERDY: HSE oscillator clock ready * @arg RCC_FLAG_PLLRDY: PLL clock ready * @arg RCC_FLAG_MCOF: MCO Flag * @arg RCC_FLAG_LSERDY: LSE oscillator clock ready * @arg RCC_FLAG_LSIRDY: LSI oscillator clock ready * @arg RCC_FLAG_OBLRST: Option Byte Loader (OBL) reset * @arg RCC_FLAG_PINRST: Pin reset * @arg RCC_FLAG_PORRST: POR/PDR reset * @arg RCC_FLAG_SFTRST: Software reset * @arg RCC_FLAG_IWDGRST: Independent Watchdog reset * @arg RCC_FLAG_WWDGRST: Window Watchdog reset * @arg RCC_FLAG_LPWRRST: Low Power reset * @retval The new state of RCC_FLAG (SET or RESET). */ FlagStatus RCC_GetFlagStatus(uint8_t RCC_FLAG) { uint32_t tmp = 0; uint32_t statusreg = 0; FlagStatus bitstatus = RESET; /* Check the parameters */ assert_param(IS_RCC_FLAG(RCC_FLAG)); /* Get the RCC register index */ tmp = RCC_FLAG >> 5; if (tmp == 0) /* The flag to check is in CR register */ { statusreg = RCC->CR; } else if (tmp == 1) /* The flag to check is in BDCR register */ { statusreg = RCC->BDCR; } else if (tmp == 4) /* The flag to check is in CFGR register */ { statusreg = RCC->CFGR; } else /* The flag to check is in CSR register */ { statusreg = RCC->CSR; } /* Get the flag position */ tmp = RCC_FLAG & FLAG_MASK; if ((statusreg & ((uint32_t)1 << tmp)) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } /* Return the flag status */ return bitstatus; } /** * @brief Clears the RCC reset flags. * The reset flags are: RCC_FLAG_OBLRST, RCC_FLAG_PINRST, RCC_FLAG_PORRST, * RCC_FLAG_SFTRST, RCC_FLAG_IWDGRST, RCC_FLAG_WWDGRST, RCC_FLAG_LPWRRST. * @param None * @retval None */ void RCC_ClearFlag(void) { /* Set RMVF bit to clear the reset flags */ RCC->CSR |= RCC_CSR_RMVF; } /** * @brief Checks whether the specified RCC interrupt has occurred or not. * @param RCC_IT: specifies the RCC interrupt source to check. * This parameter can be one of the following values: * @arg RCC_IT_LSIRDY: LSI ready interrupt * @arg RCC_IT_LSERDY: LSE ready interrupt * @arg RCC_IT_HSIRDY: HSI ready interrupt * @arg RCC_IT_HSERDY: HSE ready interrupt * @arg RCC_IT_PLLRDY: PLL ready interrupt * @arg RCC_IT_CSS: Clock Security System interrupt * @retval The new state of RCC_IT (SET or RESET). */ ITStatus RCC_GetITStatus(uint8_t RCC_IT) { ITStatus bitstatus = RESET; /* Check the parameters */ assert_param(IS_RCC_GET_IT(RCC_IT)); /* Check the status of the specified RCC interrupt */ if ((RCC->CIR & RCC_IT) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } /* Return the RCC_IT status */ return bitstatus; } /** * @brief Clears the RCC's interrupt pending bits. * @param RCC_IT: specifies the interrupt pending bit to clear. * This parameter can be any combination of the following values: * @arg RCC_IT_LSIRDY: LSI ready interrupt * @arg RCC_IT_LSERDY: LSE ready interrupt * @arg RCC_IT_HSIRDY: HSI ready interrupt * @arg RCC_IT_HSERDY: HSE ready interrupt * @arg RCC_IT_PLLRDY: PLL ready interrupt * @arg RCC_IT_CSS: Clock Security System interrupt * @retval None */ void RCC_ClearITPendingBit(uint8_t RCC_IT) { /* Check the parameters */ assert_param(IS_RCC_CLEAR_IT(RCC_IT)); /* Perform Byte access to RCC_CIR[23:16] bits to clear the selected interrupt pending bits */ *(__IO uint8_t *) CIR_BYTE3_ADDRESS = RCC_IT; } /** * @} */ /** * @} */ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
bitmarker/STM32F3_IAR_Template
stm32f3/simple/Libraries/STM32F30x_StdPeriph_Driver/src/stm32f30x_rcc.c
C
mit
73,915
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Globalization; namespace System.Numerics { /// <summary> /// A structure encapsulating a four-dimensional vector (x,y,z,w), /// which is used to efficiently rotate an object about the (x,y,z) vector by the angle theta, where w = cos(theta/2). /// </summary> public struct Quaternion : IEquatable<Quaternion> { private const float SlerpEpsilon = 1e-6f; /// <summary> /// Specifies the X-value of the vector component of the Quaternion. /// </summary> public float X; /// <summary> /// Specifies the Y-value of the vector component of the Quaternion. /// </summary> public float Y; /// <summary> /// Specifies the Z-value of the vector component of the Quaternion. /// </summary> public float Z; /// <summary> /// Specifies the rotation component of the Quaternion. /// </summary> public float W; /// <summary> /// Returns a Quaternion representing no rotation. /// </summary> public static Quaternion Identity { get { return new Quaternion(0, 0, 0, 1); } } /// <summary> /// Returns whether the Quaternion is the identity Quaternion. /// </summary> public readonly bool IsIdentity { get { return X == 0f && Y == 0f && Z == 0f && W == 1f; } } /// <summary> /// Constructs a Quaternion from the given components. /// </summary> /// <param name="x">The X component of the Quaternion.</param> /// <param name="y">The Y component of the Quaternion.</param> /// <param name="z">The Z component of the Quaternion.</param> /// <param name="w">The W component of the Quaternion.</param> public Quaternion(float x, float y, float z, float w) { this.X = x; this.Y = y; this.Z = z; this.W = w; } /// <summary> /// Constructs a Quaternion from the given vector and rotation parts. /// </summary> /// <param name="vectorPart">The vector part of the Quaternion.</param> /// <param name="scalarPart">The rotation part of the Quaternion.</param> public Quaternion(Vector3 vectorPart, float scalarPart) { X = vectorPart.X; Y = vectorPart.Y; Z = vectorPart.Z; W = scalarPart; } /// <summary> /// Calculates the length of the Quaternion. /// </summary> /// <returns>The computed length of the Quaternion.</returns> public readonly float Length() { float ls = X * X + Y * Y + Z * Z + W * W; return MathF.Sqrt(ls); } /// <summary> /// Calculates the length squared of the Quaternion. This operation is cheaper than Length(). /// </summary> /// <returns>The length squared of the Quaternion.</returns> public readonly float LengthSquared() { return X * X + Y * Y + Z * Z + W * W; } /// <summary> /// Divides each component of the Quaternion by the length of the Quaternion. /// </summary> /// <param name="value">The source Quaternion.</param> /// <returns>The normalized Quaternion.</returns> public static Quaternion Normalize(Quaternion value) { Quaternion ans; float ls = value.X * value.X + value.Y * value.Y + value.Z * value.Z + value.W * value.W; float invNorm = 1.0f / MathF.Sqrt(ls); ans.X = value.X * invNorm; ans.Y = value.Y * invNorm; ans.Z = value.Z * invNorm; ans.W = value.W * invNorm; return ans; } /// <summary> /// Creates the conjugate of a specified Quaternion. /// </summary> /// <param name="value">The Quaternion of which to return the conjugate.</param> /// <returns>A new Quaternion that is the conjugate of the specified one.</returns> public static Quaternion Conjugate(Quaternion value) { Quaternion ans; ans.X = -value.X; ans.Y = -value.Y; ans.Z = -value.Z; ans.W = value.W; return ans; } /// <summary> /// Returns the inverse of a Quaternion. /// </summary> /// <param name="value">The source Quaternion.</param> /// <returns>The inverted Quaternion.</returns> public static Quaternion Inverse(Quaternion value) { // -1 ( a -v ) // q = ( ------------- ------------- ) // ( a^2 + |v|^2 , a^2 + |v|^2 ) Quaternion ans; float ls = value.X * value.X + value.Y * value.Y + value.Z * value.Z + value.W * value.W; float invNorm = 1.0f / ls; ans.X = -value.X * invNorm; ans.Y = -value.Y * invNorm; ans.Z = -value.Z * invNorm; ans.W = value.W * invNorm; return ans; } /// <summary> /// Creates a Quaternion from a normalized vector axis and an angle to rotate about the vector. /// </summary> /// <param name="axis">The unit vector to rotate around. /// This vector must be normalized before calling this function or the resulting Quaternion will be incorrect.</param> /// <param name="angle">The angle, in radians, to rotate around the vector.</param> /// <returns>The created Quaternion.</returns> public static Quaternion CreateFromAxisAngle(Vector3 axis, float angle) { Quaternion ans; float halfAngle = angle * 0.5f; float s = MathF.Sin(halfAngle); float c = MathF.Cos(halfAngle); ans.X = axis.X * s; ans.Y = axis.Y * s; ans.Z = axis.Z * s; ans.W = c; return ans; } /// <summary> /// Creates a new Quaternion from the given yaw, pitch, and roll, in radians. /// </summary> /// <param name="yaw">The yaw angle, in radians, around the Y-axis.</param> /// <param name="pitch">The pitch angle, in radians, around the X-axis.</param> /// <param name="roll">The roll angle, in radians, around the Z-axis.</param> /// <returns></returns> public static Quaternion CreateFromYawPitchRoll(float yaw, float pitch, float roll) { // Roll first, about axis the object is facing, then // pitch upward, then yaw to face into the new heading float sr, cr, sp, cp, sy, cy; float halfRoll = roll * 0.5f; sr = MathF.Sin(halfRoll); cr = MathF.Cos(halfRoll); float halfPitch = pitch * 0.5f; sp = MathF.Sin(halfPitch); cp = MathF.Cos(halfPitch); float halfYaw = yaw * 0.5f; sy = MathF.Sin(halfYaw); cy = MathF.Cos(halfYaw); Quaternion result; result.X = cy * sp * cr + sy * cp * sr; result.Y = sy * cp * cr - cy * sp * sr; result.Z = cy * cp * sr - sy * sp * cr; result.W = cy * cp * cr + sy * sp * sr; return result; } /// <summary> /// Creates a Quaternion from the given rotation matrix. /// </summary> /// <param name="matrix">The rotation matrix.</param> /// <returns>The created Quaternion.</returns> public static Quaternion CreateFromRotationMatrix(Matrix4x4 matrix) { float trace = matrix.M11 + matrix.M22 + matrix.M33; Quaternion q = new Quaternion(); if (trace > 0.0f) { float s = MathF.Sqrt(trace + 1.0f); q.W = s * 0.5f; s = 0.5f / s; q.X = (matrix.M23 - matrix.M32) * s; q.Y = (matrix.M31 - matrix.M13) * s; q.Z = (matrix.M12 - matrix.M21) * s; } else { if (matrix.M11 >= matrix.M22 && matrix.M11 >= matrix.M33) { float s = MathF.Sqrt(1.0f + matrix.M11 - matrix.M22 - matrix.M33); float invS = 0.5f / s; q.X = 0.5f * s; q.Y = (matrix.M12 + matrix.M21) * invS; q.Z = (matrix.M13 + matrix.M31) * invS; q.W = (matrix.M23 - matrix.M32) * invS; } else if (matrix.M22 > matrix.M33) { float s = MathF.Sqrt(1.0f + matrix.M22 - matrix.M11 - matrix.M33); float invS = 0.5f / s; q.X = (matrix.M21 + matrix.M12) * invS; q.Y = 0.5f * s; q.Z = (matrix.M32 + matrix.M23) * invS; q.W = (matrix.M31 - matrix.M13) * invS; } else { float s = MathF.Sqrt(1.0f + matrix.M33 - matrix.M11 - matrix.M22); float invS = 0.5f / s; q.X = (matrix.M31 + matrix.M13) * invS; q.Y = (matrix.M32 + matrix.M23) * invS; q.Z = 0.5f * s; q.W = (matrix.M12 - matrix.M21) * invS; } } return q; } /// <summary> /// Calculates the dot product of two Quaternions. /// </summary> /// <param name="quaternion1">The first source Quaternion.</param> /// <param name="quaternion2">The second source Quaternion.</param> /// <returns>The dot product of the Quaternions.</returns> public static float Dot(Quaternion quaternion1, Quaternion quaternion2) { return quaternion1.X * quaternion2.X + quaternion1.Y * quaternion2.Y + quaternion1.Z * quaternion2.Z + quaternion1.W * quaternion2.W; } /// <summary> /// Interpolates between two quaternions, using spherical linear interpolation. /// </summary> /// <param name="quaternion1">The first source Quaternion.</param> /// <param name="quaternion2">The second source Quaternion.</param> /// <param name="amount">The relative weight of the second source Quaternion in the interpolation.</param> /// <returns>The interpolated Quaternion.</returns> public static Quaternion Slerp(Quaternion quaternion1, Quaternion quaternion2, float amount) { float t = amount; float cosOmega = quaternion1.X * quaternion2.X + quaternion1.Y * quaternion2.Y + quaternion1.Z * quaternion2.Z + quaternion1.W * quaternion2.W; bool flip = false; if (cosOmega < 0.0f) { flip = true; cosOmega = -cosOmega; } float s1, s2; if (cosOmega > (1.0f - SlerpEpsilon)) { // Too close, do straight linear interpolation. s1 = 1.0f - t; s2 = (flip) ? -t : t; } else { float omega = MathF.Acos(cosOmega); float invSinOmega = 1 / MathF.Sin(omega); s1 = MathF.Sin((1.0f - t) * omega) * invSinOmega; s2 = (flip) ? -MathF.Sin(t * omega) * invSinOmega : MathF.Sin(t * omega) * invSinOmega; } Quaternion ans; ans.X = s1 * quaternion1.X + s2 * quaternion2.X; ans.Y = s1 * quaternion1.Y + s2 * quaternion2.Y; ans.Z = s1 * quaternion1.Z + s2 * quaternion2.Z; ans.W = s1 * quaternion1.W + s2 * quaternion2.W; return ans; } /// <summary> /// Linearly interpolates between two quaternions. /// </summary> /// <param name="quaternion1">The first source Quaternion.</param> /// <param name="quaternion2">The second source Quaternion.</param> /// <param name="amount">The relative weight of the second source Quaternion in the interpolation.</param> /// <returns>The interpolated Quaternion.</returns> public static Quaternion Lerp(Quaternion quaternion1, Quaternion quaternion2, float amount) { float t = amount; float t1 = 1.0f - t; Quaternion r = new Quaternion(); float dot = quaternion1.X * quaternion2.X + quaternion1.Y * quaternion2.Y + quaternion1.Z * quaternion2.Z + quaternion1.W * quaternion2.W; if (dot >= 0.0f) { r.X = t1 * quaternion1.X + t * quaternion2.X; r.Y = t1 * quaternion1.Y + t * quaternion2.Y; r.Z = t1 * quaternion1.Z + t * quaternion2.Z; r.W = t1 * quaternion1.W + t * quaternion2.W; } else { r.X = t1 * quaternion1.X - t * quaternion2.X; r.Y = t1 * quaternion1.Y - t * quaternion2.Y; r.Z = t1 * quaternion1.Z - t * quaternion2.Z; r.W = t1 * quaternion1.W - t * quaternion2.W; } // Normalize it. float ls = r.X * r.X + r.Y * r.Y + r.Z * r.Z + r.W * r.W; float invNorm = 1.0f / MathF.Sqrt(ls); r.X *= invNorm; r.Y *= invNorm; r.Z *= invNorm; r.W *= invNorm; return r; } /// <summary> /// Concatenates two Quaternions; the result represents the value1 rotation followed by the value2 rotation. /// </summary> /// <param name="value1">The first Quaternion rotation in the series.</param> /// <param name="value2">The second Quaternion rotation in the series.</param> /// <returns>A new Quaternion representing the concatenation of the value1 rotation followed by the value2 rotation.</returns> public static Quaternion Concatenate(Quaternion value1, Quaternion value2) { Quaternion ans; // Concatenate rotation is actually q2 * q1 instead of q1 * q2. // So that's why value2 goes q1 and value1 goes q2. float q1x = value2.X; float q1y = value2.Y; float q1z = value2.Z; float q1w = value2.W; float q2x = value1.X; float q2y = value1.Y; float q2z = value1.Z; float q2w = value1.W; // cross(av, bv) float cx = q1y * q2z - q1z * q2y; float cy = q1z * q2x - q1x * q2z; float cz = q1x * q2y - q1y * q2x; float dot = q1x * q2x + q1y * q2y + q1z * q2z; ans.X = q1x * q2w + q2x * q1w + cx; ans.Y = q1y * q2w + q2y * q1w + cy; ans.Z = q1z * q2w + q2z * q1w + cz; ans.W = q1w * q2w - dot; return ans; } /// <summary> /// Flips the sign of each component of the quaternion. /// </summary> /// <param name="value">The source Quaternion.</param> /// <returns>The negated Quaternion.</returns> public static Quaternion Negate(Quaternion value) { Quaternion ans; ans.X = -value.X; ans.Y = -value.Y; ans.Z = -value.Z; ans.W = -value.W; return ans; } /// <summary> /// Adds two Quaternions element-by-element. /// </summary> /// <param name="value1">The first source Quaternion.</param> /// <param name="value2">The second source Quaternion.</param> /// <returns>The result of adding the Quaternions.</returns> public static Quaternion Add(Quaternion value1, Quaternion value2) { Quaternion ans; ans.X = value1.X + value2.X; ans.Y = value1.Y + value2.Y; ans.Z = value1.Z + value2.Z; ans.W = value1.W + value2.W; return ans; } /// <summary> /// Subtracts one Quaternion from another. /// </summary> /// <param name="value1">The first source Quaternion.</param> /// <param name="value2">The second Quaternion, to be subtracted from the first.</param> /// <returns>The result of the subtraction.</returns> public static Quaternion Subtract(Quaternion value1, Quaternion value2) { Quaternion ans; ans.X = value1.X - value2.X; ans.Y = value1.Y - value2.Y; ans.Z = value1.Z - value2.Z; ans.W = value1.W - value2.W; return ans; } /// <summary> /// Multiplies two Quaternions together. /// </summary> /// <param name="value1">The Quaternion on the left side of the multiplication.</param> /// <param name="value2">The Quaternion on the right side of the multiplication.</param> /// <returns>The result of the multiplication.</returns> public static Quaternion Multiply(Quaternion value1, Quaternion value2) { Quaternion ans; float q1x = value1.X; float q1y = value1.Y; float q1z = value1.Z; float q1w = value1.W; float q2x = value2.X; float q2y = value2.Y; float q2z = value2.Z; float q2w = value2.W; // cross(av, bv) float cx = q1y * q2z - q1z * q2y; float cy = q1z * q2x - q1x * q2z; float cz = q1x * q2y - q1y * q2x; float dot = q1x * q2x + q1y * q2y + q1z * q2z; ans.X = q1x * q2w + q2x * q1w + cx; ans.Y = q1y * q2w + q2y * q1w + cy; ans.Z = q1z * q2w + q2z * q1w + cz; ans.W = q1w * q2w - dot; return ans; } /// <summary> /// Multiplies a Quaternion by a scalar value. /// </summary> /// <param name="value1">The source Quaternion.</param> /// <param name="value2">The scalar value.</param> /// <returns>The result of the multiplication.</returns> public static Quaternion Multiply(Quaternion value1, float value2) { Quaternion ans; ans.X = value1.X * value2; ans.Y = value1.Y * value2; ans.Z = value1.Z * value2; ans.W = value1.W * value2; return ans; } /// <summary> /// Divides a Quaternion by another Quaternion. /// </summary> /// <param name="value1">The source Quaternion.</param> /// <param name="value2">The divisor.</param> /// <returns>The result of the division.</returns> public static Quaternion Divide(Quaternion value1, Quaternion value2) { Quaternion ans; float q1x = value1.X; float q1y = value1.Y; float q1z = value1.Z; float q1w = value1.W; //------------------------------------- // Inverse part. float ls = value2.X * value2.X + value2.Y * value2.Y + value2.Z * value2.Z + value2.W * value2.W; float invNorm = 1.0f / ls; float q2x = -value2.X * invNorm; float q2y = -value2.Y * invNorm; float q2z = -value2.Z * invNorm; float q2w = value2.W * invNorm; //------------------------------------- // Multiply part. // cross(av, bv) float cx = q1y * q2z - q1z * q2y; float cy = q1z * q2x - q1x * q2z; float cz = q1x * q2y - q1y * q2x; float dot = q1x * q2x + q1y * q2y + q1z * q2z; ans.X = q1x * q2w + q2x * q1w + cx; ans.Y = q1y * q2w + q2y * q1w + cy; ans.Z = q1z * q2w + q2z * q1w + cz; ans.W = q1w * q2w - dot; return ans; } /// <summary> /// Flips the sign of each component of the quaternion. /// </summary> /// <param name="value">The source Quaternion.</param> /// <returns>The negated Quaternion.</returns> public static Quaternion operator -(Quaternion value) { Quaternion ans; ans.X = -value.X; ans.Y = -value.Y; ans.Z = -value.Z; ans.W = -value.W; return ans; } /// <summary> /// Adds two Quaternions element-by-element. /// </summary> /// <param name="value1">The first source Quaternion.</param> /// <param name="value2">The second source Quaternion.</param> /// <returns>The result of adding the Quaternions.</returns> public static Quaternion operator +(Quaternion value1, Quaternion value2) { Quaternion ans; ans.X = value1.X + value2.X; ans.Y = value1.Y + value2.Y; ans.Z = value1.Z + value2.Z; ans.W = value1.W + value2.W; return ans; } /// <summary> /// Subtracts one Quaternion from another. /// </summary> /// <param name="value1">The first source Quaternion.</param> /// <param name="value2">The second Quaternion, to be subtracted from the first.</param> /// <returns>The result of the subtraction.</returns> public static Quaternion operator -(Quaternion value1, Quaternion value2) { Quaternion ans; ans.X = value1.X - value2.X; ans.Y = value1.Y - value2.Y; ans.Z = value1.Z - value2.Z; ans.W = value1.W - value2.W; return ans; } /// <summary> /// Multiplies two Quaternions together. /// </summary> /// <param name="value1">The Quaternion on the left side of the multiplication.</param> /// <param name="value2">The Quaternion on the right side of the multiplication.</param> /// <returns>The result of the multiplication.</returns> public static Quaternion operator *(Quaternion value1, Quaternion value2) { Quaternion ans; float q1x = value1.X; float q1y = value1.Y; float q1z = value1.Z; float q1w = value1.W; float q2x = value2.X; float q2y = value2.Y; float q2z = value2.Z; float q2w = value2.W; // cross(av, bv) float cx = q1y * q2z - q1z * q2y; float cy = q1z * q2x - q1x * q2z; float cz = q1x * q2y - q1y * q2x; float dot = q1x * q2x + q1y * q2y + q1z * q2z; ans.X = q1x * q2w + q2x * q1w + cx; ans.Y = q1y * q2w + q2y * q1w + cy; ans.Z = q1z * q2w + q2z * q1w + cz; ans.W = q1w * q2w - dot; return ans; } /// <summary> /// Multiplies a Quaternion by a scalar value. /// </summary> /// <param name="value1">The source Quaternion.</param> /// <param name="value2">The scalar value.</param> /// <returns>The result of the multiplication.</returns> public static Quaternion operator *(Quaternion value1, float value2) { Quaternion ans; ans.X = value1.X * value2; ans.Y = value1.Y * value2; ans.Z = value1.Z * value2; ans.W = value1.W * value2; return ans; } /// <summary> /// Divides a Quaternion by another Quaternion. /// </summary> /// <param name="value1">The source Quaternion.</param> /// <param name="value2">The divisor.</param> /// <returns>The result of the division.</returns> public static Quaternion operator /(Quaternion value1, Quaternion value2) { Quaternion ans; float q1x = value1.X; float q1y = value1.Y; float q1z = value1.Z; float q1w = value1.W; //------------------------------------- // Inverse part. float ls = value2.X * value2.X + value2.Y * value2.Y + value2.Z * value2.Z + value2.W * value2.W; float invNorm = 1.0f / ls; float q2x = -value2.X * invNorm; float q2y = -value2.Y * invNorm; float q2z = -value2.Z * invNorm; float q2w = value2.W * invNorm; //------------------------------------- // Multiply part. // cross(av, bv) float cx = q1y * q2z - q1z * q2y; float cy = q1z * q2x - q1x * q2z; float cz = q1x * q2y - q1y * q2x; float dot = q1x * q2x + q1y * q2y + q1z * q2z; ans.X = q1x * q2w + q2x * q1w + cx; ans.Y = q1y * q2w + q2y * q1w + cy; ans.Z = q1z * q2w + q2z * q1w + cz; ans.W = q1w * q2w - dot; return ans; } /// <summary> /// Returns a boolean indicating whether the two given Quaternions are equal. /// </summary> /// <param name="value1">The first Quaternion to compare.</param> /// <param name="value2">The second Quaternion to compare.</param> /// <returns>True if the Quaternions are equal; False otherwise.</returns> public static bool operator ==(Quaternion value1, Quaternion value2) { return (value1.X == value2.X && value1.Y == value2.Y && value1.Z == value2.Z && value1.W == value2.W); } /// <summary> /// Returns a boolean indicating whether the two given Quaternions are not equal. /// </summary> /// <param name="value1">The first Quaternion to compare.</param> /// <param name="value2">The second Quaternion to compare.</param> /// <returns>True if the Quaternions are not equal; False if they are equal.</returns> public static bool operator !=(Quaternion value1, Quaternion value2) { return (value1.X != value2.X || value1.Y != value2.Y || value1.Z != value2.Z || value1.W != value2.W); } /// <summary> /// Returns a boolean indicating whether the given Quaternion is equal to this Quaternion instance. /// </summary> /// <param name="other">The Quaternion to compare this instance to.</param> /// <returns>True if the other Quaternion is equal to this instance; False otherwise.</returns> public readonly bool Equals(Quaternion other) { return (X == other.X && Y == other.Y && Z == other.Z && W == other.W); } /// <summary> /// Returns a boolean indicating whether the given Object is equal to this Quaternion instance. /// </summary> /// <param name="obj">The Object to compare against.</param> /// <returns>True if the Object is equal to this Quaternion; False otherwise.</returns> public override readonly bool Equals(object? obj) { if (obj is Quaternion) { return Equals((Quaternion)obj); } return false; } /// <summary> /// Returns a String representing this Quaternion instance. /// </summary> /// <returns>The string representation.</returns> public override readonly string ToString() { return string.Format(CultureInfo.CurrentCulture, "{{X:{0} Y:{1} Z:{2} W:{3}}}", X, Y, Z, W); } /// <summary> /// Returns the hash code for this instance. /// </summary> /// <returns>The hash code.</returns> public override readonly int GetHashCode() { return unchecked(X.GetHashCode() + Y.GetHashCode() + Z.GetHashCode() + W.GetHashCode()); } } }
BrennanConroy/corefx
src/System.Numerics.Vectors/src/System/Numerics/Quaternion.cs
C#
mit
28,547
define("ace/snippets/plain_text",["require","exports","module"], function(require, exports, module) { "use strict"; exports.snippetText = ""; exports.scope = "plain_text"; }); (function() { window.require(["ace/snippets/plain_text"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; } }); })();
NPellet/jsGraph
web/site/js/ace-builds/src/snippets/plain_text.js
JavaScript
mit
515
# # This file is part of pyasn1 software. # # Copyright (c) 2005-2017, Ilya Etingof <etingof@gmail.com> # License: http://pyasn1.sf.net/license.html # from pyasn1.type import univ from pyasn1.codec.cer import decoder __all__ = ['decode'] class BitStringDecoder(decoder.BitStringDecoder): supportConstructedForm = False class OctetStringDecoder(decoder.OctetStringDecoder): supportConstructedForm = False # TODO: prohibit non-canonical encoding RealDecoder = decoder.RealDecoder tagMap = decoder.tagMap.copy() tagMap.update( {univ.BitString.tagSet: BitStringDecoder(), univ.OctetString.tagSet: OctetStringDecoder(), univ.Real.tagSet: RealDecoder()} ) typeMap = decoder.typeMap.copy() # Put in non-ambiguous types for faster codec lookup for typeDecoder in tagMap.values(): if typeDecoder.protoComponent is not None: typeId = typeDecoder.protoComponent.__class__.typeId if typeId is not None and typeId not in typeMap: typeMap[typeId] = typeDecoder class Decoder(decoder.Decoder): supportIndefLength = False #: Turns DER octet stream into an ASN.1 object. #: #: Takes DER octetstream and decode it into an ASN.1 object #: (e.g. :py:class:`~pyasn1.type.base.PyAsn1Item` derivative) which #: may be a scalar or an arbitrary nested structure. #: #: Parameters #: ---------- #: substrate: :py:class:`bytes` (Python 3) or :py:class:`str` (Python 2) #: DER octetstream #: #: asn1Spec: any pyasn1 type object e.g. :py:class:`~pyasn1.type.base.PyAsn1Item` derivative #: A pyasn1 type object to act as a template guiding the decoder. Depending on the ASN.1 structure #: being decoded, *asn1Spec* may or may not be required. Most common reason for #: it to require is that ASN.1 structure is encoded in *IMPLICIT* tagging mode. #: #: Returns #: ------- #: : :py:class:`tuple` #: A tuple of pyasn1 object recovered from DER substrate (:py:class:`~pyasn1.type.base.PyAsn1Item` derivative) #: and the unprocessed trailing portion of the *substrate* (may be empty) #: #: Raises #: ------ #: : :py:class:`pyasn1.error.PyAsn1Error` #: On decoding errors decode = Decoder(tagMap, typeMap)
saurabhbajaj207/CarpeDiem
venv/Lib/site-packages/pyasn1/codec/der/decoder.py
Python
mit
2,169
<?php namespace Symfony\Component\Workflow\Tests; use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\Workflow\Definition; use Symfony\Component\Workflow\Event\Event; use Symfony\Component\Workflow\Event\GuardEvent; use Symfony\Component\Workflow\Marking; use Symfony\Component\Workflow\MarkingStore\MarkingStoreInterface; use Symfony\Component\Workflow\MarkingStore\MultipleStateMarkingStore; use Symfony\Component\Workflow\Transition; use Symfony\Component\Workflow\Workflow; class WorkflowTest extends TestCase { use WorkflowBuilderTrait; /** * @expectedException \Symfony\Component\Workflow\Exception\LogicException * @expectedExceptionMessage The value returned by the MarkingStore is not an instance of "Symfony\Component\Workflow\Marking" for workflow "unnamed". */ public function testGetMarkingWithInvalidStoreReturn() { $subject = new \stdClass(); $subject->marking = null; $workflow = new Workflow(new Definition(array(), array()), $this->getMockBuilder(MarkingStoreInterface::class)->getMock()); $workflow->getMarking($subject); } /** * @expectedException \Symfony\Component\Workflow\Exception\LogicException * @expectedExceptionMessage The Marking is empty and there is no initial place for workflow "unnamed". */ public function testGetMarkingWithEmptyDefinition() { $subject = new \stdClass(); $subject->marking = null; $workflow = new Workflow(new Definition(array(), array()), new MultipleStateMarkingStore()); $workflow->getMarking($subject); } /** * @expectedException \Symfony\Component\Workflow\Exception\LogicException * @expectedExceptionMessage Place "nope" is not valid for workflow "unnamed". */ public function testGetMarkingWithImpossiblePlace() { $subject = new \stdClass(); $subject->marking = array('nope' => 1); $workflow = new Workflow(new Definition(array(), array()), new MultipleStateMarkingStore()); $workflow->getMarking($subject); } public function testGetMarkingWithEmptyInitialMarking() { $definition = $this->createComplexWorkflowDefinition(); $subject = new \stdClass(); $subject->marking = null; $workflow = new Workflow($definition, new MultipleStateMarkingStore()); $marking = $workflow->getMarking($subject); $this->assertInstanceOf(Marking::class, $marking); $this->assertTrue($marking->has('a')); $this->assertSame(array('a' => 1), $subject->marking); } public function testGetMarkingWithExistingMarking() { $definition = $this->createComplexWorkflowDefinition(); $subject = new \stdClass(); $subject->marking = null; $subject->marking = array('b' => 1, 'c' => 1); $workflow = new Workflow($definition, new MultipleStateMarkingStore()); $marking = $workflow->getMarking($subject); $this->assertInstanceOf(Marking::class, $marking); $this->assertTrue($marking->has('b')); $this->assertTrue($marking->has('c')); } public function testCanWithUnexistingTransition() { $definition = $this->createComplexWorkflowDefinition(); $subject = new \stdClass(); $subject->marking = null; $workflow = new Workflow($definition, new MultipleStateMarkingStore()); $this->assertFalse($workflow->can($subject, 'foobar')); } public function testCan() { $definition = $this->createComplexWorkflowDefinition(); $subject = new \stdClass(); $subject->marking = null; $workflow = new Workflow($definition, new MultipleStateMarkingStore()); $this->assertTrue($workflow->can($subject, 't1')); $this->assertFalse($workflow->can($subject, 't2')); $subject->marking = array('b' => 1); $this->assertFalse($workflow->can($subject, 't1')); // In a workflow net, all "from" places should contain a token to enable // the transition. $this->assertFalse($workflow->can($subject, 't2')); $subject->marking = array('b' => 1, 'c' => 1); $this->assertFalse($workflow->can($subject, 't1')); $this->assertTrue($workflow->can($subject, 't2')); $subject->marking = array('f' => 1); $this->assertFalse($workflow->can($subject, 't5')); $this->assertTrue($workflow->can($subject, 't6')); } public function testCanWithGuard() { $definition = $this->createComplexWorkflowDefinition(); $subject = new \stdClass(); $subject->marking = null; $eventDispatcher = new EventDispatcher(); $eventDispatcher->addListener('workflow.workflow_name.guard.t1', function (GuardEvent $event) { $event->setBlocked(true); }); $workflow = new Workflow($definition, new MultipleStateMarkingStore(), $eventDispatcher, 'workflow_name'); $this->assertFalse($workflow->can($subject, 't1')); } /** * @expectedException \Symfony\Component\Workflow\Exception\LogicException * @expectedExceptionMessage Unable to apply transition "t2" for workflow "unnamed". */ public function testApplyWithImpossibleTransition() { $definition = $this->createComplexWorkflowDefinition(); $subject = new \stdClass(); $subject->marking = null; $workflow = new Workflow($definition, new MultipleStateMarkingStore()); $workflow->apply($subject, 't2'); } public function testCanWithSameNameTransition() { $definition = $this->createWorkflowWithSameNameTransition(); $workflow = new Workflow($definition, new MultipleStateMarkingStore()); $subject = new \stdClass(); $subject->marking = null; $this->assertTrue($workflow->can($subject, 'a_to_bc')); $this->assertFalse($workflow->can($subject, 'b_to_c')); $this->assertFalse($workflow->can($subject, 'to_a')); $subject->marking = array('b' => 1); $this->assertFalse($workflow->can($subject, 'a_to_bc')); $this->assertTrue($workflow->can($subject, 'b_to_c')); $this->assertTrue($workflow->can($subject, 'to_a')); } public function testApply() { $definition = $this->createComplexWorkflowDefinition(); $subject = new \stdClass(); $subject->marking = null; $workflow = new Workflow($definition, new MultipleStateMarkingStore()); $marking = $workflow->apply($subject, 't1'); $this->assertInstanceOf(Marking::class, $marking); $this->assertFalse($marking->has('a')); $this->assertTrue($marking->has('b')); $this->assertTrue($marking->has('c')); } public function testApplyWithSameNameTransition() { $subject = new \stdClass(); $subject->marking = null; $definition = $this->createWorkflowWithSameNameTransition(); $workflow = new Workflow($definition, new MultipleStateMarkingStore()); $marking = $workflow->apply($subject, 'a_to_bc'); $this->assertFalse($marking->has('a')); $this->assertTrue($marking->has('b')); $this->assertTrue($marking->has('c')); $marking = $workflow->apply($subject, 'to_a'); $this->assertTrue($marking->has('a')); $this->assertFalse($marking->has('b')); $this->assertFalse($marking->has('c')); $marking = $workflow->apply($subject, 'a_to_bc'); $marking = $workflow->apply($subject, 'b_to_c'); $this->assertFalse($marking->has('a')); $this->assertFalse($marking->has('b')); $this->assertTrue($marking->has('c')); $marking = $workflow->apply($subject, 'to_a'); $this->assertTrue($marking->has('a')); $this->assertFalse($marking->has('b')); $this->assertFalse($marking->has('c')); } public function testApplyWithSameNameTransition2() { $subject = new \stdClass(); $subject->marking = array('a' => 1, 'b' => 1); $places = range('a', 'd'); $transitions = array(); $transitions[] = new Transition('t', 'a', 'c'); $transitions[] = new Transition('t', 'b', 'd'); $definition = new Definition($places, $transitions); $workflow = new Workflow($definition, new MultipleStateMarkingStore()); $marking = $workflow->apply($subject, 't'); $this->assertFalse($marking->has('a')); $this->assertFalse($marking->has('b')); $this->assertTrue($marking->has('c')); $this->assertTrue($marking->has('d')); } public function testApplyWithEventDispatcher() { $definition = $this->createComplexWorkflowDefinition(); $subject = new \stdClass(); $subject->marking = null; $eventDispatcher = new EventDispatcherMock(); $workflow = new Workflow($definition, new MultipleStateMarkingStore(), $eventDispatcher, 'workflow_name'); $eventNameExpected = array( 'workflow.guard', 'workflow.workflow_name.guard', 'workflow.workflow_name.guard.t1', 'workflow.leave', 'workflow.workflow_name.leave', 'workflow.workflow_name.leave.a', 'workflow.transition', 'workflow.workflow_name.transition', 'workflow.workflow_name.transition.t1', 'workflow.enter', 'workflow.workflow_name.enter', 'workflow.workflow_name.enter.b', 'workflow.workflow_name.enter.c', 'workflow.entered', 'workflow.workflow_name.entered', 'workflow.workflow_name.entered.b', 'workflow.workflow_name.entered.c', // Following events are fired because of announce() method 'workflow.guard', 'workflow.workflow_name.guard', 'workflow.workflow_name.guard.t2', 'workflow.workflow_name.announce.t2', ); $marking = $workflow->apply($subject, 't1'); $this->assertSame($eventNameExpected, $eventDispatcher->dispatchedEvents); } public function testMarkingStateOnApplyWithEventDispatcher() { $definition = new Definition(range('a', 'f'), array(new Transition('t', range('a', 'c'), range('d', 'f')))); $subject = new \stdClass(); $subject->marking = array('a' => 1, 'b' => 1, 'c' => 1); $dispatcher = new EventDispatcher(); $workflow = new Workflow($definition, new MultipleStateMarkingStore(), $dispatcher, 'test'); $assertInitialState = function (Event $event) { $this->assertEquals(new Marking(array('a' => 1, 'b' => 1, 'c' => 1)), $event->getMarking()); }; $assertTransitionState = function (Event $event) { $this->assertEquals(new Marking(array()), $event->getMarking()); }; $dispatcher->addListener('workflow.leave', $assertInitialState); $dispatcher->addListener('workflow.test.leave', $assertInitialState); $dispatcher->addListener('workflow.test.leave.a', $assertInitialState); $dispatcher->addListener('workflow.test.leave.b', $assertInitialState); $dispatcher->addListener('workflow.test.leave.c', $assertInitialState); $dispatcher->addListener('workflow.transition', $assertTransitionState); $dispatcher->addListener('workflow.test.transition', $assertTransitionState); $dispatcher->addListener('workflow.test.transition.t', $assertTransitionState); $dispatcher->addListener('workflow.enter', $assertTransitionState); $dispatcher->addListener('workflow.test.enter', $assertTransitionState); $dispatcher->addListener('workflow.test.enter.d', $assertTransitionState); $dispatcher->addListener('workflow.test.enter.e', $assertTransitionState); $dispatcher->addListener('workflow.test.enter.f', $assertTransitionState); $workflow->apply($subject, 't'); } public function testGetEnabledTransitions() { $definition = $this->createComplexWorkflowDefinition(); $subject = new \stdClass(); $subject->marking = null; $eventDispatcher = new EventDispatcher(); $eventDispatcher->addListener('workflow.workflow_name.guard.t1', function (GuardEvent $event) { $event->setBlocked(true); }); $workflow = new Workflow($definition, new MultipleStateMarkingStore(), $eventDispatcher, 'workflow_name'); $this->assertEmpty($workflow->getEnabledTransitions($subject)); $subject->marking = array('d' => 1); $transitions = $workflow->getEnabledTransitions($subject); $this->assertCount(2, $transitions); $this->assertSame('t3', $transitions[0]->getName()); $this->assertSame('t4', $transitions[1]->getName()); $subject->marking = array('c' => 1, 'e' => 1); $transitions = $workflow->getEnabledTransitions($subject); $this->assertCount(1, $transitions); $this->assertSame('t5', $transitions[0]->getName()); } public function testGetEnabledTransitionsWithSameNameTransition() { $definition = $this->createWorkflowWithSameNameTransition(); $subject = new \stdClass(); $subject->marking = null; $workflow = new Workflow($definition, new MultipleStateMarkingStore()); $transitions = $workflow->getEnabledTransitions($subject); $this->assertCount(1, $transitions); $this->assertSame('a_to_bc', $transitions[0]->getName()); $subject->marking = array('b' => 1, 'c' => 1); $transitions = $workflow->getEnabledTransitions($subject); $this->assertCount(3, $transitions); $this->assertSame('b_to_c', $transitions[0]->getName()); $this->assertSame('to_a', $transitions[1]->getName()); $this->assertSame('to_a', $transitions[2]->getName()); } } class EventDispatcherMock implements \Symfony\Component\EventDispatcher\EventDispatcherInterface { public $dispatchedEvents = array(); public function dispatch($eventName, \Symfony\Component\EventDispatcher\Event $event = null) { $this->dispatchedEvents[] = $eventName; } public function addListener($eventName, $listener, $priority = 0) { } public function addSubscriber(\Symfony\Component\EventDispatcher\EventSubscriberInterface $subscriber) { } public function removeListener($eventName, $listener) { } public function removeSubscriber(\Symfony\Component\EventDispatcher\EventSubscriberInterface $subscriber) { } public function getListeners($eventName = null) { } public function getListenerPriority($eventName, $listener) { } public function hasListeners($eventName = null) { } }
dionisrbfx/test-task
vendor/symfony/symfony/src/Symfony/Component/Workflow/Tests/WorkflowTest.php
PHP
mit
14,912
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // // This file was autogenerated by a tool. // Do not modify it. // namespace Microsoft.Azure.Batch { using Models = Microsoft.Azure.Batch.Protocol.Models; using System; using System.Collections.Generic; using System.Linq; /// <summary> /// The execution information for a job schedule. /// </summary> public partial class JobScheduleExecutionInformation : IPropertyMetadata { private readonly DateTime? endTime; private readonly DateTime? nextRunTime; private readonly RecentJob recentJob; #region Constructors internal JobScheduleExecutionInformation(Models.JobScheduleExecutionInformation protocolObject) { this.endTime = protocolObject.EndTime; this.nextRunTime = protocolObject.NextRunTime; this.recentJob = UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.RecentJob, o => new RecentJob(o).Freeze()); } #endregion Constructors #region JobScheduleExecutionInformation /// <summary> /// Gets the completion time of the job schedule. This property is only returned for completed job schedules. /// </summary> public DateTime? EndTime { get { return this.endTime; } } /// <summary> /// Gets the time at which the next job will be scheduled under this job schedule. This property is only returned /// for active job schedules. /// </summary> public DateTime? NextRunTime { get { return this.nextRunTime; } } /// <summary> /// Gets the information about the most recent job under the job schedule. Note that this element is only returned /// if the job schedule contains at least one job under it. /// </summary> public RecentJob RecentJob { get { return this.recentJob; } } #endregion // JobScheduleExecutionInformation #region IPropertyMetadata bool IModifiable.HasBeenModified { //This class is compile time readonly so it cannot have been modified get { return false; } } bool IReadOnly.IsReadOnly { get { return true; } set { // This class is compile time readonly already } } #endregion // IPropertyMetadata } }
JasonYang-MSFT/azure-sdk-for-net
src/SDKs/Batch/dataPlane/Client/Src/Azure.Batch/Generated/JobScheduleExecutionInformation.cs
C#
mit
2,757
module Fastlane module Actions class SetChangelogAction < Action def self.run(params) require 'spaceship' UI.message("Login to iTunes Connect (#{params[:username]})") Spaceship::Tunes.login(params[:username]) Spaceship::Tunes.select_team UI.message("Login successful") app = Spaceship::Application.find(params[:app_identifier]) || Spaceship::Application.find(params[:app_identifier], mac: true) UI.user_error!("Couldn't find app with identifier #{params[:app_identifier]}") if app.nil? version_number = params[:version] unless version_number # Automatically fetch the latest version UI.message("Fetching the latest version for this app") if app.edit_version and app.edit_version.version version_number = app.edit_version.version else UI.message("You have to specify a new version number: ") version_number = STDIN.gets.strip end end UI.message("Going to update version #{version_number}") changelog = params[:changelog] unless changelog path = default_changelog_path UI.message("Looking for changelog in '#{path}'...") if File.exist? path changelog = File.read(path) else UI.error("Couldn't find changelog.txt") UI.message("Please enter the changelog here:") changelog = STDIN.gets end end UI.important("Going to update the changelog to:\n\n#{changelog}\n\n") if (v = app.edit_version) if v.version != version_number # Version is already there, make sure it matches the one we want to create UI.message("Changing existing version number from '#{v.version}' to '#{version_number}'") v.version = version_number v.save! else UI.message("Updating changelog for existing version #{v.version}") end else UI.message("Creating the new version: #{version_number}") app.create_version!(version_number) app = Spaceship::Application.find(params[:app_identifier]) # Replace with .reload method once available v = app.edit_version end v.release_notes.languages.each do |lang| v.release_notes[lang] = changelog end UI.message("Uploading changes to iTunes Connect...") v.save! UI.success("👼 Successfully pushed the new changelog to #{v.url}") end def self.default_changelog_path File.join(FastlaneCore::FastlaneFolder.path.to_s, 'changelog.txt') end ##################################################### # @!group Documentation ##################################################### def self.description "Set the changelog for all languages on iTunes Connect" end def self.details [ "This is useful if you have only one changelog for all languages.", "You can store the changelog in `#{default_changelog_path}` and it will automatically get loaded from there. This integration is useful if you support e.g. 10 languages and want to use the same \"What's new\"-text for all languages." ].join("\n") end def self.available_options user = CredentialsManager::AppfileConfig.try_fetch_value(:itunes_connect_id) user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id) [ FastlaneCore::ConfigItem.new(key: :app_identifier, short_option: "-a", env_name: "FASTLANE_APP_IDENTIFIER", description: "The bundle identifier of your app", default_value: CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)), FastlaneCore::ConfigItem.new(key: :username, short_option: "-u", env_name: "FASTLANE_USERNAME", description: "Your Apple ID Username", default_value: user), FastlaneCore::ConfigItem.new(key: :version, env_name: "FL_SET_CHANGELOG_VERSION", description: "The version number to create/update", optional: true), FastlaneCore::ConfigItem.new(key: :changelog, env_name: "FL_SET_CHANGELOG_CHANGELOG", description: "Changelog text that should be uploaded to iTunes Connect", optional: true), FastlaneCore::ConfigItem.new(key: :team_id, short_option: "-k", env_name: "FL_SET_CHANGELOG_TEAM_ID", description: "The ID of your iTunes Connect team if you're in multiple teams", optional: true, is_string: false, # as we also allow integers, which we convert to strings anyway default_value: CredentialsManager::AppfileConfig.try_fetch_value(:itc_team_id), verify_block: proc do |value| ENV["FASTLANE_ITC_TEAM_ID"] = value.to_s end), FastlaneCore::ConfigItem.new(key: :team_name, short_option: "-e", env_name: "FL_SET_CHANGELOG_TEAM_NAME", description: "The name of your iTunes Connect team if you're in multiple teams", optional: true, default_value: CredentialsManager::AppfileConfig.try_fetch_value(:itc_team_name), verify_block: proc do |value| ENV["FASTLANE_ITC_TEAM_NAME"] = value.to_s end) ] end def self.authors ["KrauseFx"] end def self.is_supported?(platform) [:ios, :mac].include? platform end def self.example_code [ 'set_changelog(app_identifier: "com.krausefx.app", version: "1.0", changelog: "All Languages")' ] end def self.category :beta end end end end
powtac/fastlane
fastlane/lib/fastlane/actions/set_changelog.rb
Ruby
mit
6,720
<html><!-- Created using the cpp_pretty_printer from the dlib C++ library. See http://dlib.net for updates. --><head><title>dlib C++ Library - scoped_ptr.h</title></head><body bgcolor='white'><pre> <font color='#009900'>// Copyright (C) 2007 Davis E. King (davis@dlib.net) </font><font color='#009900'>// License: Boost Software License See LICENSE.txt for the full license. </font><font color='#0000FF'>#ifndef</font> DLIB_SCOPED_PTr_ <font color='#0000FF'>#define</font> DLIB_SCOPED_PTr_ <font color='#0000FF'>#include</font> <font color='#5555FF'>&lt;</font>algorithm<font color='#5555FF'>&gt;</font> <font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../noncopyable.h.html'>../noncopyable.h</a>" <font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../algs.h.html'>../algs.h</a>" <font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='scoped_ptr_abstract.h.html'>scoped_ptr_abstract.h</a>" <font color='#0000FF'>namespace</font> dlib <b>{</b> <font color='#009900'>// ---------------------------------------------------------------------------------------- </font> <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font> <font color='#0000FF'>struct</font> <b><a name='default_deleter'></a>default_deleter</b> <b>{</b> <font color='#0000FF'><u>void</u></font> <b><a name='operator'></a>operator</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font face='Lucida Console'>(</font>T<font color='#5555FF'>*</font> item<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>delete</font> item; <b>}</b> <b>}</b>; <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font> <font color='#0000FF'>struct</font> <b><a name='default_deleter'></a>default_deleter</b><font color='#5555FF'>&lt;</font>T[]<font color='#5555FF'>&gt;</font> <b>{</b> <font color='#0000FF'><u>void</u></font> <b><a name='operator'></a>operator</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font face='Lucida Console'>(</font>T<font color='#5555FF'>*</font> item<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>delete</font> [] item; <b>}</b> <b>}</b>; <font color='#009900'>// ---------------------------------------------------------------------------------------- </font> <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font> <font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> deleter <font color='#5555FF'>=</font> default_deleter<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font> <font color='#5555FF'>&gt;</font> <font color='#0000FF'>class</font> <b><a name='scoped_ptr'></a>scoped_ptr</b> : noncopyable <b>{</b> <font color='#009900'>/*! CONVENTION - get() == ptr !*/</font> <font color='#0000FF'>public</font>: <font color='#0000FF'>typedef</font> T element_type; <font color='#0000FF'>typedef</font> deleter deleter_type; <font color='#0000FF'>explicit</font> <b><a name='scoped_ptr'></a>scoped_ptr</b> <font face='Lucida Console'>(</font> T<font color='#5555FF'>*</font> p <font color='#5555FF'>=</font> <font color='#979000'>0</font> <font face='Lucida Console'>)</font> : ptr<font face='Lucida Console'>(</font>p<font face='Lucida Console'>)</font> <b>{</b> <b>}</b> ~<b><a name='scoped_ptr'></a>scoped_ptr</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <b>{</b> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>ptr<font face='Lucida Console'>)</font> <b>{</b> deleter del; <font color='#BB00BB'>del</font><font face='Lucida Console'>(</font>ptr<font face='Lucida Console'>)</font>; <b>}</b> <b>}</b> <font color='#0000FF'><u>void</u></font> <b><a name='reset'></a>reset</b> <font face='Lucida Console'>(</font> T<font color='#5555FF'>*</font> p <font color='#5555FF'>=</font> <font color='#979000'>0</font> <font face='Lucida Console'>)</font> <b>{</b> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>ptr<font face='Lucida Console'>)</font> <b>{</b> deleter del; <font color='#BB00BB'>del</font><font face='Lucida Console'>(</font>ptr<font face='Lucida Console'>)</font>; <b>}</b> ptr <font color='#5555FF'>=</font> p; <b>}</b> T<font color='#5555FF'>&amp;</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>*</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#BB00BB'>DLIB_ASSERT</font><font face='Lucida Console'>(</font><font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>0</font>, "<font color='#CC0000'>\tscoped_ptr::operator*()</font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\tget() can't be null if you are going to dereference it</font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\tthis: </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> <font color='#0000FF'>this</font> <font face='Lucida Console'>)</font>; <font color='#0000FF'>return</font> <font color='#5555FF'>*</font>ptr; <b>}</b> T<font color='#5555FF'>*</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>-</font><font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#BB00BB'>DLIB_ASSERT</font><font face='Lucida Console'>(</font><font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>0</font>, "<font color='#CC0000'>\tscoped_ptr::operator*()</font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\tget() can't be null</font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\tthis: </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> <font color='#0000FF'>this</font> <font face='Lucida Console'>)</font>; <font color='#0000FF'>return</font> ptr; <b>}</b> T<font color='#5555FF'>*</font> <b><a name='get'></a>get</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> ptr; <b>}</b> <b><a name='operator'></a>operator</b> <font color='#0000FF'><u>bool</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> <font face='Lucida Console'>(</font>ptr <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>; <b>}</b> <font color='#0000FF'><u>void</u></font> <b><a name='swap'></a>swap</b><font face='Lucida Console'>(</font> scoped_ptr<font color='#5555FF'>&amp;</font> b <font face='Lucida Console'>)</font> <b>{</b> std::<font color='#BB00BB'>swap</font><font face='Lucida Console'>(</font>ptr,b.ptr<font face='Lucida Console'>)</font>; <b>}</b> <font color='#0000FF'>private</font>: T<font color='#5555FF'>*</font> ptr; <b>}</b>; <font color='#009900'>// ---------------------------------------------------------------------------------------- </font> <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font> <font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> deleter <font color='#5555FF'>&gt;</font> <font color='#0000FF'>class</font> <b><a name='scoped_ptr'></a>scoped_ptr</b><font color='#5555FF'>&lt;</font>T[],deleter<font color='#5555FF'>&gt;</font> : noncopyable <b>{</b> <font color='#009900'>/*! CONVENTION - get() == ptr !*/</font> <font color='#0000FF'>public</font>: <font color='#0000FF'>typedef</font> T element_type; <font color='#0000FF'>explicit</font> <b><a name='scoped_ptr'></a>scoped_ptr</b> <font face='Lucida Console'>(</font> T<font color='#5555FF'>*</font> p <font color='#5555FF'>=</font> <font color='#979000'>0</font> <font face='Lucida Console'>)</font> : ptr<font face='Lucida Console'>(</font>p<font face='Lucida Console'>)</font> <b>{</b> <b>}</b> ~<b><a name='scoped_ptr'></a>scoped_ptr</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <b>{</b> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>ptr<font face='Lucida Console'>)</font> <b>{</b> deleter del; <font color='#BB00BB'>del</font><font face='Lucida Console'>(</font>ptr<font face='Lucida Console'>)</font>; <b>}</b> <b>}</b> <font color='#0000FF'><u>void</u></font> <b><a name='reset'></a>reset</b> <font face='Lucida Console'>(</font> T<font color='#5555FF'>*</font> p <font color='#5555FF'>=</font> <font color='#979000'>0</font> <font face='Lucida Console'>)</font> <b>{</b> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>ptr<font face='Lucida Console'>)</font> <b>{</b> deleter del; <font color='#BB00BB'>del</font><font face='Lucida Console'>(</font>ptr<font face='Lucida Console'>)</font>; <b>}</b> ptr <font color='#5555FF'>=</font> p; <b>}</b> T<font color='#5555FF'>&amp;</font> <b><a name='operator'></a>operator</b>[] <font face='Lucida Console'>(</font> <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> idx <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#BB00BB'>DLIB_ASSERT</font><font face='Lucida Console'>(</font><font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>0</font>, "<font color='#CC0000'>\tscoped_ptr::operator[]()</font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\tget() can't be null if you are going to dereference it</font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\tthis: </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> <font color='#0000FF'>this</font> <font face='Lucida Console'>)</font>; <font color='#0000FF'>return</font> ptr[idx]; <b>}</b> T<font color='#5555FF'>*</font> <b><a name='get'></a>get</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> ptr; <b>}</b> <b><a name='operator'></a>operator</b> <font color='#0000FF'><u>bool</u></font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> <font face='Lucida Console'>(</font>ptr <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>; <b>}</b> <font color='#0000FF'><u>void</u></font> <b><a name='swap'></a>swap</b><font face='Lucida Console'>(</font> scoped_ptr<font color='#5555FF'>&amp;</font> b <font face='Lucida Console'>)</font> <b>{</b> std::<font color='#BB00BB'>swap</font><font face='Lucida Console'>(</font>ptr,b.ptr<font face='Lucida Console'>)</font>; <b>}</b> <font color='#0000FF'>private</font>: T<font color='#5555FF'>*</font> ptr; <b>}</b>; <font color='#009900'>// ---------------------------------------------------------------------------------------- </font> <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font> <font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> deleter <font color='#5555FF'>&gt;</font> <font color='#0000FF'><u>void</u></font> <b><a name='swap'></a>swap</b><font face='Lucida Console'>(</font> scoped_ptr<font color='#5555FF'>&lt;</font>T,deleter<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> a, scoped_ptr<font color='#5555FF'>&lt;</font>T,deleter<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> b <font face='Lucida Console'>)</font> <b>{</b> a.<font color='#BB00BB'>swap</font><font face='Lucida Console'>(</font>b<font face='Lucida Console'>)</font>; <b>}</b> <font color='#009900'>// ---------------------------------------------------------------------------------------- </font> <b>}</b> <font color='#0000FF'>#endif</font> <font color='#009900'>// DLIB_SCOPED_PTr_ </font> </pre></body></html>
eldilibra/mudsling
include/dlib-18.9/docs/dlib/smart_pointers/scoped_ptr.h.html
HTML
mit
14,284
/* * Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt) * * This source code is licensed under the MIT-style license found in the * license.txt file in the root directory of this source tree. * * * Header file redirection to keep source compatibility with RakNet 4.082. */ #include "../include/slikenet/SendToThread.h"
lcs2/carpg
external/SLikeNet/Source/slikenet/SendToThread.h
C
mit
336
package net.sf.jabref.gui.renderer; import java.awt.Color; import java.awt.Component; import javax.swing.Icon; import javax.swing.JLabel; import javax.swing.JTable; import javax.swing.table.DefaultTableCellRenderer; /** * Renderer for table cells, which supports both Icons, JLabels and plain text. */ public class GeneralRenderer extends DefaultTableCellRenderer { private final Color rendererBackground; private Color selBackground; public GeneralRenderer(Color c) { super(); this.rendererBackground = c; setBackground(c); } /** * Renderer with specified foreground and background colors, and default selected * background color. * @param c Foreground color * @param fg Background color */ public GeneralRenderer(Color c, Color fg) { this(c); setForeground(fg); } /** * Renderer with specified foreground, background and selected background colors * @param c Foreground color * @param fg Unselected background color * @param sel Selected background color */ public GeneralRenderer(Color c, Color fg, Color sel) { this(c, fg); this.selBackground = sel; } @Override public Component getTableCellRendererComponent(JTable table, Object o, boolean isSelected, boolean hasFocus, int row, int column) { if (selBackground == null) { return super.getTableCellRendererComponent(table, o, isSelected, hasFocus, row, column); } else { Component c = super.getTableCellRendererComponent(table, o, isSelected, hasFocus, row, column); if (isSelected) { c.setBackground(selBackground); } else { c.setBackground(rendererBackground); } return c; } } @Override public void firePropertyChange(String propertyName, Object old, Object newV) { // disable super.firePropertyChange } /* For enabling the renderer to handle icons. */ @Override protected void setValue(Object value) { if (value instanceof Icon) { setIcon((Icon) value); setText(null); } else if (value instanceof JLabel) { JLabel lab = (JLabel) value; setIcon(lab.getIcon()); setToolTipText(lab.getToolTipText()); if (lab.getIcon() != null) { setText(null); } } else { // this is plain text setIcon(null); setToolTipText(null); if (value == null) { setText(null); } else { setText(value.toString()); } } } }
Mr-DLib/jabref
src/main/java/net/sf/jabref/gui/renderer/GeneralRenderer.java
Java
mit
2,732
<?php defined('C5_EXECUTE') or die("Access Denied."); class DashboardFilesController extends Controller { public function view() { $this->redirect('/dashboard/files/search'); } } ?>
homer6/concrete5
concrete/controllers/dashboard/files/controller.php
PHP
mit
191
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. #include <iostream> #include <memory> #include <vector> #include <v8.h> #include <node.h> #include "db/_wrapper.h" #include "rocksdb/db.h" #include "rocksdb/options.h" #include "rocksdb/slice.h" namespace { void printWithBackSlashes(std::string str) { for (std::string::size_type i = 0; i < str.size(); i++) { if (str[i] == '\\' || str[i] == '"') { std::cout << "\\"; } std::cout << str[i]; } } bool has_key_for_array(Local<Object> obj, std::string key) { return obj->Has(String::NewSymbol(key.c_str())) && obj->Get(String::NewSymbol(key.c_str()))->IsArray(); } } using namespace v8; Persistent<Function> DBWrapper::constructor; DBWrapper::DBWrapper() { options_.IncreaseParallelism(); options_.OptimizeLevelStyleCompaction(); options_.disable_auto_compactions = true; options_.create_if_missing = true; } DBWrapper::~DBWrapper() { delete db_; } bool DBWrapper::HasFamilyNamed(std::string& name, DBWrapper* db) { return db->columnFamilies_.find(name) != db->columnFamilies_.end(); } void DBWrapper::Init(Handle<Object> exports) { Local<FunctionTemplate> tpl = FunctionTemplate::New(New); tpl->SetClassName(String::NewSymbol("DBWrapper")); tpl->InstanceTemplate()->SetInternalFieldCount(8); tpl->PrototypeTemplate()->Set(String::NewSymbol("open"), FunctionTemplate::New(Open)->GetFunction()); tpl->PrototypeTemplate()->Set(String::NewSymbol("get"), FunctionTemplate::New(Get)->GetFunction()); tpl->PrototypeTemplate()->Set(String::NewSymbol("put"), FunctionTemplate::New(Put)->GetFunction()); tpl->PrototypeTemplate()->Set(String::NewSymbol("delete"), FunctionTemplate::New(Delete)->GetFunction()); tpl->PrototypeTemplate()->Set(String::NewSymbol("dump"), FunctionTemplate::New(Dump)->GetFunction()); tpl->PrototypeTemplate()->Set(String::NewSymbol("createColumnFamily"), FunctionTemplate::New(CreateColumnFamily)->GetFunction()); tpl->PrototypeTemplate()->Set(String::NewSymbol("writeBatch"), FunctionTemplate::New(WriteBatch)->GetFunction()); tpl->PrototypeTemplate()->Set(String::NewSymbol("compactRange"), FunctionTemplate::New(CompactRange)->GetFunction()); constructor = Persistent<Function>::New(tpl->GetFunction()); exports->Set(String::NewSymbol("DBWrapper"), constructor); } Handle<Value> DBWrapper::Open(const Arguments& args) { HandleScope scope; DBWrapper* db_wrapper = ObjectWrap::Unwrap<DBWrapper>(args.This()); if (!(args[0]->IsString() && (args[1]->IsUndefined() || args[1]->IsArray()))) { return scope.Close(Boolean::New(false)); } std::string db_file = *v8::String::Utf8Value(args[0]->ToString()); std::vector<std::string> cfs = {ROCKSDB_NAMESPACE::kDefaultColumnFamilyName}; if (!args[1]->IsUndefined()) { Handle<Array> array = Handle<Array>::Cast(args[1]); for (uint i = 0; i < array->Length(); i++) { if (!array->Get(i)->IsString()) { return scope.Close(Boolean::New(false)); } cfs.push_back(*v8::String::Utf8Value(array->Get(i)->ToString())); } } if (cfs.size() == 1) { db_wrapper->status_ = ROCKSDB_NAMESPACE::DB::Open( db_wrapper->options_, db_file, &db_wrapper->db_); return scope.Close(Boolean::New(db_wrapper->status_.ok())); } std::vector<ROCKSDB_NAMESPACE::ColumnFamilyDescriptor> families; for (std::vector<int>::size_type i = 0; i < cfs.size(); i++) { families.push_back(ROCKSDB_NAMESPACE::ColumnFamilyDescriptor( cfs[i], ROCKSDB_NAMESPACE::ColumnFamilyOptions())); } std::vector<ROCKSDB_NAMESPACE::ColumnFamilyHandle*> handles; db_wrapper->status_ = ROCKSDB_NAMESPACE::DB::Open( db_wrapper->options_, db_file, families, &handles, &db_wrapper->db_); if (!db_wrapper->status_.ok()) { return scope.Close(Boolean::New(db_wrapper->status_.ok())); } for (std::vector<int>::size_type i = 0; i < handles.size(); i++) { db_wrapper->columnFamilies_[cfs[i]] = handles[i]; } return scope.Close(Boolean::New(true)); } Handle<Value> DBWrapper::New(const Arguments& args) { HandleScope scope; Handle<Value> to_return; if (args.IsConstructCall()) { DBWrapper* db_wrapper = new DBWrapper(); db_wrapper->Wrap(args.This()); return args.This(); } const int argc = 0; Local<Value> argv[0] = {}; return scope.Close(constructor->NewInstance(argc, argv)); } Handle<Value> DBWrapper::Get(const Arguments& args) { HandleScope scope; if (!(args[0]->IsString() && (args[1]->IsUndefined() || args[1]->IsString()))) { return scope.Close(Null()); } DBWrapper* db_wrapper = ObjectWrap::Unwrap<DBWrapper>(args.This()); std::string key = *v8::String::Utf8Value(args[0]->ToString()); std::string cf = *v8::String::Utf8Value(args[1]->ToString()); std::string value; if (args[1]->IsUndefined()) { db_wrapper->status_ = db_wrapper->db_->Get(ROCKSDB_NAMESPACE::ReadOptions(), key, &value); } else if (db_wrapper->HasFamilyNamed(cf, db_wrapper)) { db_wrapper->status_ = db_wrapper->db_->Get(ROCKSDB_NAMESPACE::ReadOptions(), db_wrapper->columnFamilies_[cf], key, &value); } else { return scope.Close(Null()); } Handle<Value> v = db_wrapper->status_.ok() ? String::NewSymbol(value.c_str()) : Null(); return scope.Close(v); } Handle<Value> DBWrapper::Put(const Arguments& args) { HandleScope scope; if (!(args[0]->IsString() && args[1]->IsString() && (args[2]->IsUndefined() || args[2]->IsString()))) { return scope.Close(Boolean::New(false)); } DBWrapper* db_wrapper = ObjectWrap::Unwrap<DBWrapper>(args.This()); std::string key = *v8::String::Utf8Value(args[0]->ToString()); std::string value = *v8::String::Utf8Value(args[1]->ToString()); std::string cf = *v8::String::Utf8Value(args[2]->ToString()); if (args[2]->IsUndefined()) { db_wrapper->status_ = db_wrapper->db_->Put(ROCKSDB_NAMESPACE::WriteOptions(), key, value); } else if (db_wrapper->HasFamilyNamed(cf, db_wrapper)) { db_wrapper->status_ = db_wrapper->db_->Put(ROCKSDB_NAMESPACE::WriteOptions(), db_wrapper->columnFamilies_[cf], key, value); } else { return scope.Close(Boolean::New(false)); } return scope.Close(Boolean::New(db_wrapper->status_.ok())); } Handle<Value> DBWrapper::Delete(const Arguments& args) { HandleScope scope; if (!args[0]->IsString()) { return scope.Close(Boolean::New(false)); } DBWrapper* db_wrapper = ObjectWrap::Unwrap<DBWrapper>(args.This()); std::string arg0 = *v8::String::Utf8Value(args[0]->ToString()); std::string arg1 = *v8::String::Utf8Value(args[1]->ToString()); if (args[1]->IsUndefined()) { db_wrapper->status_ = db_wrapper->db_->Delete(ROCKSDB_NAMESPACE::WriteOptions(), arg0); } else { if (!db_wrapper->HasFamilyNamed(arg1, db_wrapper)) { return scope.Close(Boolean::New(false)); } db_wrapper->status_ = db_wrapper->db_->Delete(ROCKSDB_NAMESPACE::WriteOptions(), db_wrapper->columnFamilies_[arg1], arg0); } return scope.Close(Boolean::New(db_wrapper->status_.ok())); } Handle<Value> DBWrapper::Dump(const Arguments& args) { HandleScope scope; std::unique_ptr<ROCKSDB_NAMESPACE::Iterator> iterator; DBWrapper* db_wrapper = ObjectWrap::Unwrap<DBWrapper>(args.This()); std::string arg0 = *v8::String::Utf8Value(args[0]->ToString()); if (args[0]->IsUndefined()) { iterator.reset( db_wrapper->db_->NewIterator(ROCKSDB_NAMESPACE::ReadOptions())); } else { if (!db_wrapper->HasFamilyNamed(arg0, db_wrapper)) { return scope.Close(Boolean::New(false)); } iterator.reset(db_wrapper->db_->NewIterator( ROCKSDB_NAMESPACE::ReadOptions(), db_wrapper->columnFamilies_[arg0])); } iterator->SeekToFirst(); while (iterator->Valid()) { std::cout << "\""; printWithBackSlashes(iterator->key().ToString()); std::cout << "\" => \""; printWithBackSlashes(iterator->value().ToString()); std::cout << "\"\n"; iterator->Next(); } return scope.Close(Boolean::New(true)); } Handle<Value> DBWrapper::CreateColumnFamily(const Arguments& args) { HandleScope scope; if (!args[0]->IsString()) { return scope.Close(Boolean::New(false)); } DBWrapper* db_wrapper = ObjectWrap::Unwrap<DBWrapper>(args.This()); std::string cf_name = *v8::String::Utf8Value(args[0]->ToString()); if (db_wrapper->HasFamilyNamed(cf_name, db_wrapper)) { return scope.Close(Boolean::New(false)); } ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf; db_wrapper->status_ = db_wrapper->db_->CreateColumnFamily( ROCKSDB_NAMESPACE::ColumnFamilyOptions(), cf_name, &cf); if (!db_wrapper->status_.ok()) { return scope.Close(Boolean::New(false)); } db_wrapper->columnFamilies_[cf_name] = cf; return scope.Close(Boolean::New(true)); } bool DBWrapper::AddToBatch(ROCKSDB_NAMESPACE::WriteBatch& batch, bool del, Handle<Array> array) { Handle<Array> put_pair; for (uint i = 0; i < array->Length(); i++) { if (del) { if (!array->Get(i)->IsString()) { return false; } batch.Delete(*v8::String::Utf8Value(array->Get(i)->ToString())); continue; } if (!array->Get(i)->IsArray()) { return false; } put_pair = Handle<Array>::Cast(array->Get(i)); if (!put_pair->Get(0)->IsString() || !put_pair->Get(1)->IsString()) { return false; } batch.Put( *v8::String::Utf8Value(put_pair->Get(0)->ToString()), *v8::String::Utf8Value(put_pair->Get(1)->ToString())); } return true; } bool DBWrapper::AddToBatch(ROCKSDB_NAMESPACE::WriteBatch& batch, bool del, Handle<Array> array, DBWrapper* db_wrapper, std::string cf) { Handle<Array> put_pair; for (uint i = 0; i < array->Length(); i++) { if (del) { if (!array->Get(i)->IsString()) { return false; } batch.Delete( db_wrapper->columnFamilies_[cf], *v8::String::Utf8Value(array->Get(i)->ToString())); continue; } if (!array->Get(i)->IsArray()) { return false; } put_pair = Handle<Array>::Cast(array->Get(i)); if (!put_pair->Get(0)->IsString() || !put_pair->Get(1)->IsString()) { return false; } batch.Put( db_wrapper->columnFamilies_[cf], *v8::String::Utf8Value(put_pair->Get(0)->ToString()), *v8::String::Utf8Value(put_pair->Get(1)->ToString())); } return true; } Handle<Value> DBWrapper::WriteBatch(const Arguments& args) { HandleScope scope; if (!args[0]->IsArray()) { return scope.Close(Boolean::New(false)); } DBWrapper* db_wrapper = ObjectWrap::Unwrap<DBWrapper>(args.This()); Handle<Array> sub_batches = Handle<Array>::Cast(args[0]); Local<Object> sub_batch; ROCKSDB_NAMESPACE::WriteBatch batch; bool well_formed; for (uint i = 0; i < sub_batches->Length(); i++) { if (!sub_batches->Get(i)->IsObject()) { return scope.Close(Boolean::New(false)); } sub_batch = sub_batches->Get(i)->ToObject(); if (sub_batch->Has(String::NewSymbol("column_family"))) { if (!has_key_for_array(sub_batch, "put") && !has_key_for_array(sub_batch, "delete")) { return scope.Close(Boolean::New(false)); } well_formed = db_wrapper->AddToBatch( batch, false, Handle<Array>::Cast(sub_batch->Get(String::NewSymbol("put"))), db_wrapper, *v8::String::Utf8Value(sub_batch->Get( String::NewSymbol("column_family")))); well_formed = db_wrapper->AddToBatch( batch, true, Handle<Array>::Cast(sub_batch->Get(String::NewSymbol("delete"))), db_wrapper, *v8::String::Utf8Value(sub_batch->Get( String::NewSymbol("column_family")))); } else { well_formed = db_wrapper->AddToBatch( batch, false, Handle<Array>::Cast(sub_batch->Get(String::NewSymbol("put")))); well_formed = db_wrapper->AddToBatch( batch, true, Handle<Array>::Cast(sub_batch->Get(String::NewSymbol("delete")))); if (!well_formed) { return scope.Close(Boolean::New(false)); } } } db_wrapper->status_ = db_wrapper->db_->Write(ROCKSDB_NAMESPACE::WriteOptions(), &batch); return scope.Close(Boolean::New(db_wrapper->status_.ok())); } Handle<Value> DBWrapper::CompactRangeDefault(const Arguments& args) { HandleScope scope; DBWrapper* db_wrapper = ObjectWrap::Unwrap<DBWrapper>(args.This()); ROCKSDB_NAMESPACE::Slice begin = *v8::String::Utf8Value(args[0]->ToString()); ROCKSDB_NAMESPACE::Slice end = *v8::String::Utf8Value(args[1]->ToString()); db_wrapper->status_ = db_wrapper->db_->CompactRange(&end, &begin); return scope.Close(Boolean::New(db_wrapper->status_.ok())); } Handle<Value> DBWrapper::CompactColumnFamily(const Arguments& args) { HandleScope scope; DBWrapper* db_wrapper = ObjectWrap::Unwrap<DBWrapper>(args.This()); ROCKSDB_NAMESPACE::Slice begin = *v8::String::Utf8Value(args[0]->ToString()); ROCKSDB_NAMESPACE::Slice end = *v8::String::Utf8Value(args[1]->ToString()); std::string cf = *v8::String::Utf8Value(args[2]->ToString()); db_wrapper->status_ = db_wrapper->db_->CompactRange( db_wrapper->columnFamilies_[cf], &begin, &end); return scope.Close(Boolean::New(db_wrapper->status_.ok())); } Handle<Value> DBWrapper::CompactOptions(const Arguments& args) { HandleScope scope; if (!args[2]->IsObject()) { return scope.Close(Boolean::New(false)); } DBWrapper* db_wrapper = ObjectWrap::Unwrap<DBWrapper>(args.This()); ROCKSDB_NAMESPACE::Slice begin = *v8::String::Utf8Value(args[0]->ToString()); ROCKSDB_NAMESPACE::Slice end = *v8::String::Utf8Value(args[1]->ToString()); Local<Object> options = args[2]->ToObject(); int target_level = -1, target_path_id = 0; if (options->Has(String::NewSymbol("target_level")) && options->Get(String::NewSymbol("target_level"))->IsInt32()) { target_level = (int)(options->Get( String::NewSymbol("target_level"))->ToInt32()->Value()); if (options->Has(String::NewSymbol("target_path_id")) || options->Get(String::NewSymbol("target_path_id"))->IsInt32()) { target_path_id = (int)(options->Get( String::NewSymbol("target_path_id"))->ToInt32()->Value()); } } db_wrapper->status_ = db_wrapper->db_->CompactRange( &begin, &end, true, target_level, target_path_id ); return scope.Close(Boolean::New(db_wrapper->status_.ok())); } Handle<Value> DBWrapper::CompactAll(const Arguments& args) { HandleScope scope; if (!args[2]->IsObject() || !args[3]->IsString()) { return scope.Close(Boolean::New(false)); } DBWrapper* db_wrapper = ObjectWrap::Unwrap<DBWrapper>(args.This()); ROCKSDB_NAMESPACE::Slice begin = *v8::String::Utf8Value(args[0]->ToString()); ROCKSDB_NAMESPACE::Slice end = *v8::String::Utf8Value(args[1]->ToString()); Local<Object> options = args[2]->ToObject(); std::string cf = *v8::String::Utf8Value(args[3]->ToString()); int target_level = -1, target_path_id = 0; if (options->Has(String::NewSymbol("target_level")) && options->Get(String::NewSymbol("target_level"))->IsInt32()) { target_level = (int)(options->Get( String::NewSymbol("target_level"))->ToInt32()->Value()); if (options->Has(String::NewSymbol("target_path_id")) || options->Get(String::NewSymbol("target_path_id"))->IsInt32()) { target_path_id = (int)(options->Get( String::NewSymbol("target_path_id"))->ToInt32()->Value()); } } db_wrapper->status_ = db_wrapper->db_->CompactRange( db_wrapper->columnFamilies_[cf], &begin, &end, true, target_level, target_path_id); return scope.Close(Boolean::New(db_wrapper->status_.ok())); } Handle<Value> DBWrapper::CompactRange(const Arguments& args) { HandleScope scope; if (!args[0]->IsString() || !args[1]->IsString()) { return scope.Close(Boolean::New(false)); } switch(args.Length()) { case 2: return CompactRangeDefault(args); case 3: return args[2]->IsString() ? CompactColumnFamily(args) : CompactOptions(args); default: return CompactAll(args); } } Handle<Value> DBWrapper::Close(const Arguments& args) { HandleScope scope; delete ObjectWrap::Unwrap<DBWrapper>(args.This()); return scope.Close(Null()); }
TeamSPoon/logicmoo_workspace
packs_lib/rocksdb/rocksdb/tools/rdb/db_wrapper.cc
C++
mit
16,625
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Helper; use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Command\Command; class HelperSetTest extends \PHPUnit_Framework_TestCase { public function testConstructor() { $mock_helper = $this->getGenericMockHelper('fake_helper'); $helperset = new HelperSet(array('fake_helper_alias' => $mock_helper)); $this->assertEquals($mock_helper, $helperset->get('fake_helper_alias'), '__construct sets given helper to helpers'); $this->assertTrue($helperset->has('fake_helper_alias'), '__construct sets helper alias for given helper'); } public function testSet() { $helperset = new HelperSet(); $helperset->set($this->getGenericMockHelper('fake_helper', $helperset)); $this->assertTrue($helperset->has('fake_helper'), '->set() adds helper to helpers'); $helperset = new HelperSet(); $helperset->set($this->getGenericMockHelper('fake_helper_01', $helperset)); $helperset->set($this->getGenericMockHelper('fake_helper_02', $helperset)); $this->assertTrue($helperset->has('fake_helper_01'), '->set() will set multiple helpers on consecutive calls'); $this->assertTrue($helperset->has('fake_helper_02'), '->set() will set multiple helpers on consecutive calls'); $helperset = new HelperSet(); $helperset->set($this->getGenericMockHelper('fake_helper', $helperset), 'fake_helper_alias'); $this->assertTrue($helperset->has('fake_helper'), '->set() adds helper alias when set'); $this->assertTrue($helperset->has('fake_helper_alias'), '->set() adds helper alias when set'); } public function testHas() { $helperset = new HelperSet(array('fake_helper_alias' => $this->getGenericMockHelper('fake_helper'))); $this->assertTrue($helperset->has('fake_helper'), '->has() finds set helper'); $this->assertTrue($helperset->has('fake_helper_alias'), '->has() finds set helper by alias'); } public function testGet() { $helper_01 = $this->getGenericMockHelper('fake_helper_01'); $helper_02 = $this->getGenericMockHelper('fake_helper_02'); $helperset = new HelperSet(array('fake_helper_01_alias' => $helper_01, 'fake_helper_02_alias' => $helper_02)); $this->assertEquals($helper_01, $helperset->get('fake_helper_01'), '->get() returns correct helper by name'); $this->assertEquals($helper_01, $helperset->get('fake_helper_01_alias'), '->get() returns correct helper by alias'); $this->assertEquals($helper_02, $helperset->get('fake_helper_02'), '->get() returns correct helper by name'); $this->assertEquals($helper_02, $helperset->get('fake_helper_02_alias'), '->get() returns correct helper by alias'); $helperset = new HelperSet(); try { $helperset->get('foo'); $this->fail('->get() throws \InvalidArgumentException when helper not found'); } catch (\Exception $e) { $this->assertInstanceOf('\InvalidArgumentException', $e, '->get() throws \InvalidArgumentException when helper not found'); $this->assertContains('The helper "foo" is not defined.', $e->getMessage(), '->get() throws \InvalidArgumentException when helper not found'); } } public function testSetCommand() { $cmd_01 = new Command('foo'); $cmd_02 = new Command('bar'); $helperset = new HelperSet(); $helperset->setCommand($cmd_01); $this->assertEquals($cmd_01, $helperset->getCommand(), '->setCommand() stores given command'); $helperset = new HelperSet(); $helperset->setCommand($cmd_01); $helperset->setCommand($cmd_02); $this->assertEquals($cmd_02, $helperset->getCommand(), '->setCommand() overwrites stored command with consecutive calls'); } public function testGetCommand() { $cmd = new Command('foo'); $helperset = new HelperSet(); $helperset->setCommand($cmd); $this->assertEquals($cmd, $helperset->getCommand(), '->getCommand() retrieves stored command'); } /** * Create a generic mock for the helper interface. Optionally check for a call to setHelperSet with a specific * helperset instance. * * @param string $name * @param HelperSet $helperset allows a mock to verify a particular helperset set is being added to the Helper */ private function getGenericMockHelper($name, HelperSet $helperset = null) { $mock_helper = $this->getMock('\Symfony\Component\Console\Helper\HelperInterface'); $mock_helper->expects($this->any()) ->method('getName') ->will($this->returnValue($name)); if ($helperset) { $mock_helper->expects($this->any()) ->method('setHelperSet') ->with($this->equalTo($helperset)); } return $mock_helper; } }
bijen/nform
vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php
PHP
mit
5,217
# Copyright (c) 2010-2013 Michael Dvorkin # # Awesome Print is freely distributable under the terms of MIT license. # See LICENSE file or http://www.opensource.org/licenses/mit-license.php #------------------------------------------------------------------------------ module AwesomePrint module ActiveRecord def self.included(base) base.send :alias_method, :cast_without_active_record, :cast base.send :alias_method, :cast, :cast_with_active_record end # Add ActiveRecord class names to the dispatcher pipeline. #------------------------------------------------------------------------------ def cast_with_active_record(object, type) cast = cast_without_active_record(object, type) return cast if !defined?(::ActiveRecord) if object.is_a?(::ActiveRecord::Base) cast = :active_record_instance elsif object.is_a?(Class) && object.ancestors.include?(::ActiveRecord::Base) cast = :active_record_class elsif type == :activerecord_relation || object.class.ancestors.include?(::ActiveRecord::Relation) cast = :array end cast end private # Format ActiveRecord instance object. # # NOTE: by default only instance attributes (i.e. columns) are shown. To format # ActiveRecord instance as regular object showing its instance variables and # accessors use :raw => true option: # # ap record, :raw => true # #------------------------------------------------------------------------------ def awesome_active_record_instance(object) return object.inspect if !defined?(::ActiveSupport::OrderedHash) return awesome_object(object) if @options[:raw] data = object.class.column_names.inject(::ActiveSupport::OrderedHash.new) do |hash, name| if object.has_attribute?(name) || object.new_record? value = object.respond_to?(name) ? object.send(name) : object.read_attribute(name) hash[name.to_sym] = value end hash end "#{object} " << awesome_hash(data) end # Format ActiveRecord class object. #------------------------------------------------------------------------------ def awesome_active_record_class(object) return object.inspect if !defined?(::ActiveSupport::OrderedHash) || !object.respond_to?(:columns) || object.to_s == "ActiveRecord::Base" return awesome_class(object) if object.respond_to?(:abstract_class?) && object.abstract_class? data = object.columns.inject(::ActiveSupport::OrderedHash.new) do |hash, c| hash[c.name.to_sym] = c.type hash end "class #{object} < #{object.superclass} " << awesome_hash(data) end end end AwesomePrint::Formatter.send(:include, AwesomePrint::ActiveRecord)
mnishiguchi/moving_estimator
vendor/cache/ruby/2.2.0/gems/awesome_print-1.6.1/lib/awesome_print/ext/active_record.rb
Ruby
mit
2,780
/* * This file is part of Sponge, licensed under the MIT License (MIT). * * Copyright (c) SpongePowered <https://www.spongepowered.org> * Copyright (c) contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package org.spongepowered.common.mixin.api.event.cause.damage; import net.minecraft.entity.Entity; import org.spongepowered.api.event.cause.entity.damage.source.DamageSource; import org.spongepowered.api.event.cause.entity.damage.source.EntityDamageSource; import org.spongepowered.api.event.cause.entity.damage.source.common.AbstractDamageSource; import org.spongepowered.api.event.cause.entity.damage.source.common.AbstractEntityDamageSource; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.common.event.damage.SpongeCommonDamageSource; import org.spongepowered.common.event.damage.SpongeCommonEntityDamageSource; /* * @author gabizou * * This is absolutely required for the abstract damage sources to have the correct * strings at runtime, this is the ultimate combination of the superclass class * transformer to force {@link AbstractDamageSource} extend {@link SpongeCommonDamageSource} * but still retain the sanity of the proper "damage type" for mods and native * Minecraft damage source. */ @Mixin(AbstractEntityDamageSource.class) public abstract class MixinAbstractEntityDamageSource implements EntityDamageSource { @Inject(method = "<init>", at = @At("RETURN")) public void onConstruct(CallbackInfo callbackInfo) { ((SpongeCommonEntityDamageSource) (Object) this).setDamageType(getType().getId()); ((SpongeCommonEntityDamageSource) (Object) this).setEntitySource((Entity) getSource()); if (isAbsolute()) { ((SpongeCommonEntityDamageSource) (Object) this).setDamageIsAbsolute(); } if (isBypassingArmor()) { ((SpongeCommonEntityDamageSource) (Object) this).setDamageBypassesArmor(); } if (isExplosive()) { ((SpongeCommonEntityDamageSource) (Object) this).setExplosion(); } if (isMagic()) { ((SpongeCommonEntityDamageSource) (Object) this).setMagicDamage(); } if (isScaledByDifficulty()) { ((SpongeCommonEntityDamageSource) (Object) this).setDifficultyScaled(); } if (doesAffectCreative()) { ((SpongeCommonEntityDamageSource) (Object) this).canHarmInCreative(); } } }
ryantheleach/SpongeCommon
src/main/java/org/spongepowered/common/mixin/api/event/cause/damage/MixinAbstractEntityDamageSource.java
Java
mit
3,622
/** * Copyright (c) 2014-2017 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html */ package org.eclipse.smarthome.transform.regex.internal; /** * @author Thomas.Eichstaedt-Engelen */ public abstract class AbstractTransformationServiceTest { protected String source = "<?xml version=\"1.0\"?><xml_api_reply version=\"1\"><weather module_id=\"0\"" + " tab_id=\"0\" mobile_row=\"0\" mobile_zipped=\"1\" row=\"0\" section=\"0\" ><forecast_information>" + "<city data=\"Krefeld, North Rhine-Westphalia\"/><postal_code data=\"Krefeld Germany\"/>" + "<latitude_e6 data=\"\"/><longitude_e6 data=\"\"/><forecast_date data=\"2011-03-01\"/>" + "<current_date_time data=\"2011-03-01 15:20:00 +0000\"/><unit_system data=\"SI\"/></forecast_information>" + "<current_conditions><condition data=\"Meistens bew�lkt\"/><temp_f data=\"46\"/><temp_c data=\"8\"/>" + "<humidity data=\"Feuchtigkeit: 66 %\"/><icon data=\"/ig/images/weather/mostly_cloudy.gif\"/>" + "<wind_condition data=\"Wind: N mit 26 km/h\"/></current_conditions><forecast_conditions><day_of_week data=\"Di.\"/>" + "<low data=\"-1\"/><high data=\"6\"/><icon data=\"/ig/images/weather/sunny.gif\"/><condition data=\"Klar\"/>" + "</forecast_conditions><forecast_conditions><day_of_week data=\"Mi.\"/><low data=\"-1\"/><high data=\"8\"/>" + "<icon data=\"/ig/images/weather/sunny.gif\"/><condition data=\"Klar\"/></forecast_conditions><forecast_conditions>" + "<day_of_week data=\"Do.\"/><low data=\"-1\"/><high data=\"8\"/><icon data=\"/ig/images/weather/sunny.gif\"/>" + "<condition data=\"Klar\"/></forecast_conditions><forecast_conditions><day_of_week data=\"Fr.\"/><low data=\"0\"/>" + "<high data=\"8\"/><icon data=\"/ig/images/weather/sunny.gif\"/><condition data=\"Klar\"/></forecast_conditions>" + "</weather></xml_api_reply>"; }
AchimHentschel/smarthome
extensions/transform/org.eclipse.smarthome.transform.regex.test/src/test/java/org/eclipse/smarthome/transform/regex/internal/AbstractTransformationServiceTest.java
Java
epl-1.0
2,197
/** * Copyright (c) 2014-2016 by the respective copyright holders. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html */ package org.openhab.binding.samsungtv.internal.service; import org.eclipse.smarthome.core.library.types.DecimalType; import org.eclipse.smarthome.core.library.types.IncreaseDecreaseType; import org.eclipse.smarthome.core.library.types.OnOffType; import org.eclipse.smarthome.core.library.types.OpenClosedType; import org.eclipse.smarthome.core.library.types.PercentType; import org.eclipse.smarthome.core.library.types.UpDownType; import org.eclipse.smarthome.core.types.Command; /** * The {@link DataConverters} provides utils for converting openhab commands to * Samsung TV specific values. * * @author Pauli Anttila - Initial contribution */ public class DataConverters { /** * Convert openhab command to int. * * @param command * @param min * @param max * @param currentValue * @return */ public static int convertCommandToIntValue(Command command, int min, int max, int currentValue) { if (command instanceof IncreaseDecreaseType || command instanceof DecimalType || command instanceof PercentType) { int value; if (command instanceof IncreaseDecreaseType && command == IncreaseDecreaseType.INCREASE) { value = Math.min(max, currentValue + 1); } else if (command instanceof IncreaseDecreaseType && command == IncreaseDecreaseType.DECREASE) { value = Math.max(min, currentValue - 1); } else if (command instanceof DecimalType) { value = ((DecimalType) command).intValue(); } else { throw new NumberFormatException("Command '" + command + "' not supported"); } return value; } else { throw new NumberFormatException("Command '" + command + "' not supported"); } } /** * Convert openhab command to boolean. * * @param command * @return */ public static boolean convertCommandToBooleanValue(Command command) { if (command instanceof OnOffType || command instanceof OpenClosedType || command instanceof UpDownType) { boolean newValue; if (command.equals(OnOffType.ON) || command.equals(UpDownType.UP) || command.equals(OpenClosedType.OPEN)) { newValue = true; } else if (command.equals(OnOffType.OFF) || command.equals(UpDownType.DOWN) || command.equals(OpenClosedType.CLOSED)) { newValue = false; } else { throw new NumberFormatException("Command '" + command + "' not supported"); } return newValue; } else { throw new NumberFormatException("Command '" + command + "' not supported for channel"); } } }
steand/openhab2-addons
addons/binding/org.openhab.binding.samsungtv/src/main/java/org/openhab/binding/samsungtv/internal/service/DataConverters.java
Java
epl-1.0
3,110
/* Declarations for System V style searching functions. Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _SEARCH_H #define _SEARCH_H 1 #include <sys/cdefs.h> #define __need_size_t #define __need_NULL #include <stddef.h> __BEGIN_DECLS #if defined(__USE_SVID) || defined(__USE_XOPEN_EXTENDED) /* Prototype structure for a linked-list data structure. This is the type used by the `insque' and `remque' functions. */ struct qelem { struct qelem *q_forw; struct qelem *q_back; char q_data[1]; }; /* Insert ELEM into a doubly-linked list, after PREV. */ extern void insque __P ((void *__elem, void *__prev)); /* Unlink ELEM from the doubly-linked list that it is in. */ extern void remque __P ((void *__elem)); #endif /* For use with hsearch(3). */ #ifndef __COMPAR_FN_T #define __COMPAR_FN_T typedef int (*__compar_fn_t) __P ((__const __ptr_t, __const __ptr_t)); #endif /* Action which shall be performed in the call the hsearch. */ typedef enum { FIND, ENTER } ACTION; typedef struct entry { char *key; char *data; } ENTRY; /* Opaque type for internal use. */ struct _ENTRY; /* Data type for reentrant functions. */ struct hsearch_data { struct _ENTRY *table; unsigned int size; unsigned int filled; }; /* Family of hash table handling functions. The functions also have reentrant counterparts ending with _r. */ extern ENTRY *hsearch __P ((ENTRY __item, ACTION __action)); extern int hcreate __P ((size_t __nel)); extern void hdestroy __P ((void)); extern int hsearch_r __P ((ENTRY __item, ACTION __action, ENTRY **__retval, struct hsearch_data *__htab)); extern int hcreate_r __P ((size_t __nel, struct hsearch_data *htab)); extern void hdestroy_r __P ((struct hsearch_data *htab)); /* The tsearch routines are very interesting. They make many assumptions about the compiler. It assumes that the first field in node must be the "key" field, which points to the datum. Everything depends on that. */ /* For tsearch */ typedef enum { preorder, postorder, endorder, leaf } VISIT; extern void *tsearch __P ((__const void * __key, void **__rootp, __compar_fn_t compar)); extern void *__tsearch __P ((__const void * __key, void **__rootp, __compar_fn_t compar)); extern void *tfind __P ((__const void * __key, __const void ** __rootp, __compar_fn_t compar)); extern void *__tfind __P ((__const void * __key, __const void ** __rootp, __compar_fn_t compar)); extern void *tdelete __P ((__const void * __key, void ** __rootp, __compar_fn_t compar)); extern void *__tdelete __P ((__const void * __key, void ** __rootp, __compar_fn_t compar)); #ifndef __ACTION_FN_T #define __ACTION_FN_T typedef void (*__action_fn_t) __P ((__const void *__nodep, __const VISIT __value, __const int __level)); #endif extern void twalk __P ((__const void * __root, __action_fn_t action)); extern void __twalk __P ((__const void * __root, __action_fn_t action)); /* Perform linear search for KEY by comparing by COMPAR in an array [BASE,BASE+NMEMB*SIZE). */ extern void * lfind __P ((__const void *__key, __const void *__base, size_t *__nmemb, size_t __size, __compar_fn_t __compar)); /* Perform linear search for KEY by comparing by COMPAR function in array [BASE,BASE+NMEMB*SIZE) and insert entry if not found. */ extern void * lsearch __P ((__const void *__key, void *__base, size_t *__nmemb, size_t __size, __compar_fn_t __compar)); __END_DECLS #endif /* search.h */
ysleu/RTL8685
uClinux-dist/lib/libc/include/search.h
C
gpl-2.0
4,395
/* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ #ifndef PSP_TIMER_H #define PSP_TIMER_H class PspTimer { public: typedef void (* CallbackFunc)(void); PspTimer() : _callback(0), _interval(0), _threadId(-1), _init(false) {} void stop() { _init = false; } bool start(); ~PspTimer() { stop(); } void setCallback(CallbackFunc cb) { _callback = cb; } void setIntervalMs(uint32 interval) { _interval = interval * 1000; } static int thread(SceSize, void *__this); // static thread to use as bridge void timerThread(); private: CallbackFunc _callback; // pointer to timer callback uint32 _interval; int _threadId; bool _init; }; #endif // PSP_TIMER_H
MaddTheSane/scummvm
backends/timer/psp/timer.h
C
gpl-2.0
1,555
/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm */ /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function. License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing the derived work. RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. These notices must be retained in any copies of any part of this documentation and/or software. */ #include <cyg/athttpd/md5.h> /* Constants for MD5Transform routine. */ #define S11 7 #define S12 12 #define S13 17 #define S14 22 #define S21 5 #define S22 9 #define S23 14 #define S24 20 #define S31 4 #define S32 11 #define S33 16 #define S34 23 #define S41 6 #define S42 10 #define S43 15 #define S44 21 static void MD5Transform (UINT4 [4], unsigned char [64]); static void Encode(unsigned char *, UINT4 *, unsigned int); static void Decode(UINT4 *, unsigned char *, unsigned int); static void MD5_memcpy(POINTER, POINTER, unsigned int); static void MD5_memset(POINTER, int, unsigned int); static unsigned char PADDING[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* F, G, H and I are basic MD5 functions. */ #define F(x, y, z) (((x) & (y)) | ((~x) & (z))) #define G(x, y, z) (((x) & (z)) | ((y) & (~z))) #define H(x, y, z) ((x) ^ (y) ^ (z)) #define I(x, y, z) ((y) ^ ((x) | (~z))) /* ROTATE_LEFT rotates x left n bits. */ #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) /* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. Rotation is separate from addition to prevent recomputation. */ #define FF(a, b, c, d, x, s, ac) { \ (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define GG(a, b, c, d, x, s, ac) { \ (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define HH(a, b, c, d, x, s, ac) { \ (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define II(a, b, c, d, x, s, ac) { \ (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } /* MD5 initialization. Begins an MD5 operation, writing a new context. */ void MD5Init (context) MD5_CTX *context; /* context */ { context->count[0] = context->count[1] = 0; /* Load magic initialization constants. */ context->state[0] = 0x67452301; context->state[1] = 0xefcdab89; context->state[2] = 0x98badcfe; context->state[3] = 0x10325476; } /* MD5 block update operation. Continues an MD5 message-digest operation, processing another message block, and updating the context. */ void MD5Update (context, input, inputLen) MD5_CTX *context; /* context */ unsigned char *input; /* input block */ unsigned int inputLen; /* length of input block */ { unsigned int i, index, partLen; /* Compute number of bytes mod 64 */ index = (unsigned int)((context->count[0] >> 3) & 0x3F); /* Update number of bits */ if ((context->count[0] += ((UINT4)inputLen << 3)) < ((UINT4)inputLen << 3)) context->count[1]++; context->count[1] += ((UINT4)inputLen >> 29); partLen = 64 - index; /* Transform as many times as possible. */ if (inputLen >= partLen) { MD5_memcpy ((POINTER)&context->buffer[index], (POINTER)input, partLen); MD5Transform (context->state, context->buffer); for (i = partLen; i + 63 < inputLen; i += 64) MD5Transform (context->state, &input[i]); index = 0; } else i = 0; /* Buffer remaining input */ MD5_memcpy ((POINTER)&context->buffer[index], (POINTER)&input[i], inputLen-i); } /* MD5 finalization. Ends an MD5 message-digest operation, writing the the message digest and zeroizing the context. */ void MD5Final (digest, context) unsigned char digest[16]; /* message digest */ MD5_CTX *context; /* context */ { unsigned char bits[8]; unsigned int index, padLen; /* Save number of bits */ Encode (bits, context->count, 8); /* Pad out to 56 mod 64. */ index = (unsigned int)((context->count[0] >> 3) & 0x3f); padLen = (index < 56) ? (56 - index) : (120 - index); MD5Update (context, PADDING, padLen); /* Append length (before padding) */ MD5Update (context, bits, 8); /* Store state in digest */ Encode (digest, context->state, 16); /* Zeroize sensitive information. */ MD5_memset ((POINTER)context, 0, sizeof (*context)); } /* MD5 basic transformation. Transforms state based on block. */ static void MD5Transform (state, block) UINT4 state[4]; unsigned char block[64]; { UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; Decode (x, block, 64); /* Round 1 */ FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ /* Round 2 */ GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ /* Round 3 */ HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ /* Round 4 */ II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ state[0] += a; state[1] += b; state[2] += c; state[3] += d; /* Zeroize sensitive information. */ MD5_memset ((POINTER)x, 0, sizeof (x)); } /* Encodes input (UINT4) into output (unsigned char). Assumes len is a multiple of 4. */ static void Encode (output, input, len) unsigned char *output; UINT4 *input; unsigned int len; { unsigned int i, j; for (i = 0, j = 0; j < len; i++, j += 4) { output[j] = (unsigned char)(input[i] & 0xff); output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); } } /* Decodes input (unsigned char) into output (UINT4). Assumes len is a multiple of 4. */ static void Decode (output, input, len) UINT4 *output; unsigned char *input; unsigned int len; { unsigned int i, j; for (i = 0, j = 0; j < len; i++, j += 4) output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); } /* Note: Replace "for loop" with standard memcpy if possible. */ static void MD5_memcpy (output, input, len) POINTER output; POINTER input; unsigned int len; { unsigned int i; for (i = 0; i < len; i++) output[i] = input[i]; } /* Note: Replace "for loop" with standard memset if possible. */ static void MD5_memset (output, value, len) POINTER output; int value; unsigned int len; { unsigned int i; for (i = 0; i < len; i++) ((char *)output)[i] = (char)value; }
reille/proj_ecos
src/ecos/packages/net/athttpd/current/src/md5c.c
C
gpl-2.0
10,682
#ifndef CYGONCE_LIBM_ASIN_H #define CYGONCE_LIBM_ASIN_H //=========================================================================== // // asin.h // // Test vectors for testing of asin() math library function // //=========================================================================== // ####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- // This file is part of eCos, the Embedded Configurable Operating System. // Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. // // eCos is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free // Software Foundation; either version 2 or (at your option) any later // version. // // eCos is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License // for more details. // // You should have received a copy of the GNU General Public License // along with eCos; if not, write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // // As a special exception, if other files instantiate templates or use // macros or inline functions from this file, or you compile this file // and link it with other works to produce a work based on this file, // this file does not by itself cause the resulting work to be covered by // the GNU General Public License. However the source code for this file // must still be made available in accordance with section (3) of the GNU // General Public License v2. // // This exception does not invalidate any other reasons why a work based // on this file might be covered by the GNU General Public License. // ------------------------------------------- // ####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // // Author(s): jlarmour // Contributors: jlarmour // Date: 1998-02-13 // Purpose: // Description: // Usage: #include "vectors/asin.h" // //####DESCRIPTIONEND#### // //=========================================================================== // CONFIGURATION #include <pkgconf/libm.h> // Configuration header // INCLUDES #include <cyg/infra/cyg_type.h> // Common type definitions and support #include "vectors/vector_support.h"// extra support for math tests #define ASIN_TOLERANCE 1.0E-04 static const Cyg_libm_test_double_vec_t asin_vec[] = { // AUTOMATICALLY GENERATED VECTORS START { 1, 604042796u, 2506787616u, 3214772338u, 2077734866u, 604042796u, 2506787616u, 0, ASIN_TOLERANCE, 0}, { 2, 182169888u, 3065862417u, 1106988572u, 4273582707u, 182169888u, 3065862417u, 0, ASIN_TOLERANCE, 0}, { 3, 2664755801u, 1226547830u, 1071032732u, 3857964939u, 2664755801u, 1226547830u, 0, ASIN_TOLERANCE, 0}, { 4, 94291757u, 4010703484u, 1081727025u, 4287567452u, 94291757u, 4010703484u, 0, ASIN_TOLERANCE, 0}, { 5, 118911615u, 2977931045u, 1104283808u, 3843658091u, 118911615u, 2977931045u, 0, ASIN_TOLERANCE, 0}, { 6, 2656608405u, 3088088668u, 1073408149u, 2318866154u, 2656608405u, 3088088668u, 0, ASIN_TOLERANCE, 0}, { 7, 263730613u, 2451317798u, 3210911814u, 1038562750u, 263730613u, 2451317798u, 0, ASIN_TOLERANCE, 0}, { 8, 580821368u, 2221564313u, 1059115557u, 977275158u, 580821368u, 2221564313u, 0, ASIN_TOLERANCE, 0}, { 9, 399687375u, 97950278u, 3204919842u, 1605286142u, 399687375u, 97950278u, 0, ASIN_TOLERANCE, 0}, { 10, 460757591u, 4233776869u, 1087533966u, 1919858904u, 460757591u, 4233776869u, 0, ASIN_TOLERANCE, 0}, { 11, 2870376804u, 1472965721u, 3230691143u, 2574511435u, 2870376804u, 1472965721u, 0, ASIN_TOLERANCE, 0}, { 12, 2882092039u, 1204637550u, 3213143089u, 2421516003u, 2882092039u, 1204637550u, 0, ASIN_TOLERANCE, 0}, { 13, 3037750340u, 3337705339u, 3238331976u, 3183442542u, 3037750340u, 3337705339u, 0, ASIN_TOLERANCE, 0}, { 14, 2949649050u, 1086075996u, 1067714579u, 3477152375u, 2949649050u, 1086075996u, 0, ASIN_TOLERANCE, 0}, { 15, 535591366u, 247024800u, 1040265469u, 3354345619u, 535591366u, 247024800u, 0, ASIN_TOLERANCE, 0}, { 16, 63178737u, 2781269805u, 3188799281u, 3391715197u, 63178737u, 2781269805u, 0, ASIN_TOLERANCE, 0}, { 17, 768313194u, 865544864u, 3230216062u, 1200273272u, 768313194u, 865544864u, 0, ASIN_TOLERANCE, 0}, { 18, 591877388u, 3157038143u, 3249401130u, 314151656u, 591877388u, 3157038143u, 0, ASIN_TOLERANCE, 0}, { 19, 3219509280u, 1564829925u, 1065671376u, 3088950051u, 3219652657u, 2483715739u, 0, ASIN_TOLERANCE, 0}, { 20, 141374533u, 3933975298u, 1065991760u, 2304772640u, 141374533u, 3933975298u, 0, ASIN_TOLERANCE, 0}, { 21, 2396283075u, 1799495751u, 1094899225u, 1827380665u, 2396283075u, 1799495751u, 0, ASIN_TOLERANCE, 0}, { 22, 2598153594u, 1112370977u, 1061103890u, 196988907u, 2598153594u, 1112370977u, 0, ASIN_TOLERANCE, 0}, { 23, 1040851532u, 490122851u, 3216810265u, 576637874u, 1040851532u, 490122851u, 0, ASIN_TOLERANCE, 0}, { 24, 849190915u, 1390621543u, 1055043150u, 915412872u, 849190915u, 1390621543u, 0, ASIN_TOLERANCE, 0}, { 25, 488493877u, 2591320551u, 1070339013u, 1237443094u, 488493877u, 2591320551u, 0, ASIN_TOLERANCE, 0}, { 26, 3077582663u, 3936235618u, 1099376266u, 1904940295u, 3077582663u, 3936235618u, 0, ASIN_TOLERANCE, 0}, { 27, 71827124u, 222155510u, 1044902177u, 252085215u, 71827124u, 222155510u, 0, ASIN_TOLERANCE, 0}, { 28, 2583183683u, 4139068910u, 3215004552u, 4245048106u, 2583183683u, 4139068910u, 0, ASIN_TOLERANCE, 0}, { 29, 32118299u, 168794155u, 1090475726u, 3160414606u, 32118299u, 168794155u, 0, ASIN_TOLERANCE, 0}, { 30, 975557826u, 4157503437u, 1104600163u, 1792103377u, 975557826u, 4157503437u, 0, ASIN_TOLERANCE, 0}, { 31, 137283993u, 1382645956u, 3240285101u, 4024164216u, 137283993u, 1382645956u, 0, ASIN_TOLERANCE, 0}, { 32, 118046910u, 3480120317u, 1100404348u, 478417819u, 118046910u, 3480120317u, 0, ASIN_TOLERANCE, 0}, { 33, 2828521286u, 2549311006u, 1055917530u, 3778440054u, 2828521286u, 2549311006u, 0, ASIN_TOLERANCE, 0}, { 34, 2530903114u, 1593784258u, 1069213493u, 1951351053u, 2530903114u, 1593784258u, 0, ASIN_TOLERANCE, 0}, { 35, 3103251986u, 631744430u, 3206072611u, 1047143174u, 3103251986u, 631744430u, 0, ASIN_TOLERANCE, 0}, { 36, 722650436u, 1584726864u, 3215417793u, 624695933u, 722650436u, 1584726864u, 0, ASIN_TOLERANCE, 0}, { 37, 2434300838u, 705725219u, 3217662205u, 1967294577u, 2434300838u, 705725219u, 0, ASIN_TOLERANCE, 0}, { 38, 664091785u, 2952818482u, 3239402263u, 1848641259u, 664091785u, 2952818482u, 0, ASIN_TOLERANCE, 0}, { 39, 642185311u, 1370937055u, 1055482637u, 2410810400u, 642185311u, 1370937055u, 0, ASIN_TOLERANCE, 0}, { 40, 889092079u, 1330047076u, 1093469262u, 1857263512u, 889092079u, 1330047076u, 0, ASIN_TOLERANCE, 0}, { 41, 2562391789u, 1246486570u, 1067165665u, 743938884u, 2562391789u, 1246486570u, 0, ASIN_TOLERANCE, 0}, { 42, 1013509315u, 3107531809u, 1058433800u, 958446936u, 1013509315u, 3107531809u, 0, ASIN_TOLERANCE, 0}, { 43, 2379321348u, 1698195744u, 3234826710u, 1808768063u, 2379321348u, 1698195744u, 0, ASIN_TOLERANCE, 0}, { 44, 223594865u, 2594747457u, 1045397427u, 3927603841u, 223594865u, 2594747457u, 0, ASIN_TOLERANCE, 0}, { 45, 2251329048u, 348093397u, 1064733299u, 1710279345u, 2251329048u, 348093397u, 0, ASIN_TOLERANCE, 0}, { 46, 3162272236u, 3528946000u, 1045927362u, 1602290403u, 3162272236u, 3528946000u, 0, ASIN_TOLERANCE, 0}, { 47, 2415703348u, 398813542u, 1052866292u, 1436851684u, 2415703348u, 398813542u, 0, ASIN_TOLERANCE, 0}, { 48, 1033199706u, 3319748577u, 3227196113u, 3607301229u, 1033199706u, 3319748577u, 0, ASIN_TOLERANCE, 0}, { 49, 23891811u, 2548745907u, 1105253912u, 370162110u, 23891811u, 2548745907u, 0, ASIN_TOLERANCE, 0}, { 50, 764517244u, 4204294028u, 3192923960u, 2626702805u, 764517244u, 4204294028u, 0, ASIN_TOLERANCE, 0}, { 51, 173888262u, 390319448u, 1104422077u, 120202647u, 173888262u, 390319448u, 0, ASIN_TOLERANCE, 0}, { 52, 2730779741u, 2815627218u, 1099019491u, 731750493u, 2730779741u, 2815627218u, 0, ASIN_TOLERANCE, 0}, { 53, 864070021u, 3900661840u, 3200970392u, 2907096477u, 864070021u, 3900661840u, 0, ASIN_TOLERANCE, 0}, { 54, 842667049u, 4269246624u, 3222902057u, 2762779203u, 842667049u, 4269246624u, 0, ASIN_TOLERANCE, 0}, { 55, 2347188326u, 184131949u, 3225314008u, 2237882876u, 2347188326u, 184131949u, 0, ASIN_TOLERANCE, 0}, { 56, 2323813472u, 4276663739u, 3254076585u, 4265258845u, 2323813472u, 4276663739u, 0, ASIN_TOLERANCE, 0}, { 57, 560407162u, 1656691045u, 3252113914u, 4132573504u, 560407162u, 1656691045u, 0, ASIN_TOLERANCE, 0}, { 58, 271448936u, 1052817888u, 1061186300u, 352861436u, 271448936u, 1052817888u, 0, ASIN_TOLERANCE, 0}, { 59, 2742827957u, 636068836u, 1093702210u, 4149510462u, 2742827957u, 636068836u, 0, ASIN_TOLERANCE, 0}, { 60, 3110435514u, 1869774195u, 1056841761u, 2029664212u, 3110435514u, 1869774195u, 0, ASIN_TOLERANCE, 0}, { 61, 2782135403u, 481356510u, 1098012633u, 1760061418u, 2782135403u, 481356510u, 0, ASIN_TOLERANCE, 0}, { 62, 2210852465u, 2918398424u, 1066749948u, 3643952367u, 2210852465u, 2918398424u, 0, ASIN_TOLERANCE, 0}, { 63, 2255864064u, 3722025458u, 3192516074u, 1732245037u, 2255864064u, 3722025458u, 0, ASIN_TOLERANCE, 0}, { 64, 984980019u, 1533536108u, 3226159655u, 3412938290u, 984980019u, 1533536108u, 0, ASIN_TOLERANCE, 0}, { 65, 2302294008u, 3539403428u, 1044896671u, 2743023547u, 2302294008u, 3539403428u, 0, ASIN_TOLERANCE, 0}, { 66, 2437282418u, 965485575u, 1074677964u, 2239092099u, 2437282418u, 965485575u, 0, ASIN_TOLERANCE, 0}, { 67, 3161462367u, 479602785u, 3245398415u, 1570702137u, 3161462367u, 479602785u, 0, ASIN_TOLERANCE, 0}, { 68, 454239397u, 3987656554u, 3201134469u, 2639458165u, 454239397u, 3987656554u, 0, ASIN_TOLERANCE, 0}, { 69, 270690192u, 902270460u, 3200236493u, 2060263082u, 270690192u, 902270460u, 0, ASIN_TOLERANCE, 0}, { 70, 3101979469u, 119561873u, 1067242459u, 4238218095u, 3101979469u, 119561873u, 0, ASIN_TOLERANCE, 0}, { 71, 342005410u, 1489535917u, 1052674720u, 3229843554u, 342005410u, 1489535917u, 0, ASIN_TOLERANCE, 0}, { 72, 2431479818u, 1372780257u, 1087299442u, 2877794600u, 2431479818u, 1372780257u, 0, ASIN_TOLERANCE, 0}, { 73, 749807578u, 547642046u, 1068507828u, 2261901967u, 749807578u, 547642046u, 0, ASIN_TOLERANCE, 0}, { 74, 2886390034u, 2655610998u, 1063417350u, 3897975437u, 2886390034u, 2655610998u, 0, ASIN_TOLERANCE, 0}, { 75, 250812866u, 3444039742u, 3204905205u, 72985499u, 250812866u, 3444039742u, 0, ASIN_TOLERANCE, 0}, { 76, 2855285209u, 685471642u, 1052893000u, 3994091533u, 2855285209u, 685471642u, 0, ASIN_TOLERANCE, 0}, { 77, 438792265u, 3273039144u, 3234242951u, 2105125638u, 438792265u, 3273039144u, 0, ASIN_TOLERANCE, 0}, { 78, 2645727074u, 1149591862u, 1079300031u, 2852890893u, 2645727074u, 1149591862u, 0, ASIN_TOLERANCE, 0}, { 79, 2752966212u, 964007987u, 1089046728u, 3863233156u, 2752966212u, 964007987u, 0, ASIN_TOLERANCE, 0}, { 80, 512535166u, 27186676u, 1092292231u, 131338606u, 512535166u, 27186676u, 0, ASIN_TOLERANCE, 0}, { 81, 670177097u, 2614232599u, 3216359929u, 1186945904u, 670177097u, 2614232599u, 0, ASIN_TOLERANCE, 0}, { 82, 3154698801u, 1896750851u, 3253696392u, 920368431u, 3154698801u, 1896750851u, 0, ASIN_TOLERANCE, 0}, { 83, 2442691738u, 29704081u, 3253306050u, 1477489465u, 2442691738u, 29704081u, 0, ASIN_TOLERANCE, 0}, { 84, 2226625355u, 1908380994u, 1041152721u, 3015183476u, 2226625355u, 1908380994u, 0, ASIN_TOLERANCE, 0}, { 85, 681844560u, 470785250u, 3211309660u, 1296080311u, 681844560u, 470785250u, 0, ASIN_TOLERANCE, 0}, { 86, 3173267991u, 3766553196u, 1063117318u, 3703961407u, 3173267991u, 3766553196u, 0, ASIN_TOLERANCE, 0}, { 87, 2455017061u, 4149594176u, 1090202405u, 3293225914u, 2455017061u, 4149594176u, 0, ASIN_TOLERANCE, 0}, { 88, 313616459u, 77747397u, 3224848375u, 1095737976u, 313616459u, 77747397u, 0, ASIN_TOLERANCE, 0}, { 89, 3083383675u, 594138985u, 3217133121u, 1435082240u, 3083383675u, 594138985u, 0, ASIN_TOLERANCE, 0}, { 90, 2240663447u, 1803548147u, 3240157452u, 4122845725u, 2240663447u, 1803548147u, 0, ASIN_TOLERANCE, 0}, { 91, 692524862u, 311336721u, 1045850005u, 536548906u, 692524862u, 311336721u, 0, ASIN_TOLERANCE, 0}, { 92, 39331613u, 1667857221u, 1062792545u, 2329662186u, 39331613u, 1667857221u, 0, ASIN_TOLERANCE, 0}, { 93, 2957138228u, 1918705224u, 1059647808u, 2861487662u, 2957138228u, 1918705224u, 0, ASIN_TOLERANCE, 0}, { 94, 3070750532u, 3709104626u, 3220237199u, 997732637u, 3070750532u, 3709104626u, 0, ASIN_TOLERANCE, 0}, { 95, 2444448896u, 1774627130u, 3192826790u, 2597228841u, 2444448896u, 1774627130u, 0, ASIN_TOLERANCE, 0}, { 96, 702397604u, 2705552003u, 1041691115u, 3314033947u, 702397604u, 2705552003u, 0, ASIN_TOLERANCE, 0}, { 97, 2530979608u, 820086279u, 1085001393u, 3341643348u, 2530979608u, 820086279u, 0, ASIN_TOLERANCE, 0}, { 98, 481329467u, 3136820894u, 1093140313u, 4023285864u, 481329467u, 3136820894u, 0, ASIN_TOLERANCE, 0}, { 99, 2613158354u, 443835590u, 3197412883u, 166402802u, 2613158354u, 443835590u, 0, ASIN_TOLERANCE, 0}, { 100, 2939403391u, 3572369260u, 3225005050u, 1183942370u, 2939403391u, 3572369260u, 0, ASIN_TOLERANCE, 0}, { 101, 456836645u, 2446986142u, 1100226690u, 3561788365u, 456836645u, 2446986142u, 0, ASIN_TOLERANCE, 0}, { 102, 995574146u, 279968558u, 1056612692u, 605059609u, 995574146u, 279968558u, 0, ASIN_TOLERANCE, 0}, { 103, 2720425755u, 1360758659u, 1045149981u, 3634982365u, 2720425755u, 1360758659u, 0, ASIN_TOLERANCE, 0}, { 104, 219648965u, 4068690904u, 3212392076u, 3185930294u, 219648965u, 4068690904u, 0, ASIN_TOLERANCE, 0}, { 105, 245268713u, 1440185463u, 1067865294u, 2959231845u, 245268713u, 1440185463u, 0, ASIN_TOLERANCE, 0}, { 106, 3124081158u, 3352139409u, 3211602972u, 64439686u, 3124081158u, 3352139409u, 0, ASIN_TOLERANCE, 0}, { 107, 2799322658u, 1508169460u, 3213875925u, 3893561170u, 2799322658u, 1508169460u, 0, ASIN_TOLERANCE, 0}, { 108, 2966132661u, 146763905u, 1061635587u, 1173102190u, 2966132661u, 146763905u, 0, ASIN_TOLERANCE, 0}, { 109, 2950948333u, 2882725208u, 1046547680u, 3137609802u, 2950948333u, 2882725208u, 0, ASIN_TOLERANCE, 0}, { 110, 281607514u, 2987408195u, 1104831334u, 2360906919u, 281607514u, 2987408195u, 0, ASIN_TOLERANCE, 0}, { 111, 583237163u, 2272922429u, 3230247604u, 3220743043u, 583237163u, 2272922429u, 0, ASIN_TOLERANCE, 0}, { 112, 2279259017u, 486798710u, 1051847313u, 1164056378u, 2279259017u, 486798710u, 0, ASIN_TOLERANCE, 0}, { 113, 2707413568u, 14851197u, 3194383659u, 2622433447u, 2707413568u, 14851197u, 0, ASIN_TOLERANCE, 0}, { 114, 2729877535u, 1346176789u, 1059030682u, 1585821890u, 2729877535u, 1346176789u, 0, ASIN_TOLERANCE, 0}, { 115, 925396515u, 1008663444u, 3253626162u, 1058337847u, 925396515u, 1008663444u, 0, ASIN_TOLERANCE, 0}, { 116, 2213579028u, 3506658319u, 3219431539u, 543446309u, 2213579028u, 3506658319u, 0, ASIN_TOLERANCE, 0}, { 117, 3163196851u, 3413687955u, 1072253426u, 343404215u, 3163196851u, 3413687955u, 0, ASIN_TOLERANCE, 0}, { 118, 334409439u, 4266232536u, 3240608065u, 4109813813u, 334409439u, 4266232536u, 0, ASIN_TOLERANCE, 0}, { 119, 3177753519u, 1144242316u, 1071012025u, 2790944540u, 3177753519u, 1144242316u, 0, ASIN_TOLERANCE, 0}, { 120, 2754858880u, 265926617u, 1095794063u, 1345870736u, 2754858880u, 265926617u, 0, ASIN_TOLERANCE, 0}, { 121, 49590943u, 3193385121u, 1097323612u, 2009367488u, 49590943u, 3193385121u, 0, ASIN_TOLERANCE, 0}, { 122, 2389359641u, 1233370553u, 1064565351u, 322637795u, 2389359641u, 1233370553u, 0, ASIN_TOLERANCE, 0}, { 123, 954404777u, 3410634251u, 3243916607u, 4042570547u, 954404777u, 3410634251u, 0, ASIN_TOLERANCE, 0}, { 124, 2849680709u, 2524001714u, 1072116817u, 3983083207u, 2849680709u, 2524001714u, 0, ASIN_TOLERANCE, 0}, { 125, 959555327u, 3501343645u, 3237287213u, 1887353658u, 959555327u, 3501343645u, 0, ASIN_TOLERANCE, 0}, { 126, 2934409098u, 689800034u, 3246333414u, 2135700283u, 2934409098u, 689800034u, 0, ASIN_TOLERANCE, 0}, { 127, 263792941u, 4171919805u, 3238308636u, 3129081398u, 263792941u, 4171919805u, 0, ASIN_TOLERANCE, 0}, { 128, 926728083u, 1550999328u, 3219525990u, 2031663879u, 926728083u, 1550999328u, 0, ASIN_TOLERANCE, 0}, { 129, 2989628620u, 949669377u, 3226383614u, 3948448651u, 2989628620u, 949669377u, 0, ASIN_TOLERANCE, 0}, { 130, 2243494997u, 4293630712u, 1060526636u, 438407499u, 2243494997u, 4293630712u, 0, ASIN_TOLERANCE, 0}, { 131, 2756107420u, 1535381711u, 1054391309u, 4072415576u, 2756107420u, 1535381711u, 0, ASIN_TOLERANCE, 0}, { 132, 3025827769u, 1347758084u, 3238820771u, 1059069486u, 3025827769u, 1347758084u, 0, ASIN_TOLERANCE, 0}, { 133, 3294258u, 3498512759u, 1092903052u, 2047817298u, 3294258u, 3498512759u, 0, ASIN_TOLERANCE, 0}, { 134, 2919775476u, 1226560794u, 1069263873u, 685537815u, 2919775476u, 1226560794u, 0, ASIN_TOLERANCE, 0}, { 135, 982026620u, 4000990876u, 1076297936u, 3803689997u, 982026620u, 4000990876u, 0, ASIN_TOLERANCE, 0}, { 136, 499108416u, 2263729518u, 3254424928u, 3450332551u, 499108416u, 2263729518u, 0, ASIN_TOLERANCE, 0}, { 137, 347296393u, 1637536851u, 3238793417u, 747232103u, 347296393u, 1637536851u, 0, ASIN_TOLERANCE, 0}, { 138, 34763760u, 902498990u, 3205956257u, 245434170u, 34763760u, 902498990u, 0, ASIN_TOLERANCE, 0}, { 139, 3201690145u, 1482770161u, 3244873095u, 2292235133u, 3201690145u, 1482798226u, 0, ASIN_TOLERANCE, 0}, { 140, 2990655242u, 36045768u, 1071182448u, 3868790688u, 2990655242u, 36045768u, 0, ASIN_TOLERANCE, 0}, { 141, 3083340050u, 1885951730u, 3207806174u, 2553919637u, 3083340050u, 1885951730u, 0, ASIN_TOLERANCE, 0}, { 142, 2693238911u, 4059459408u, 1055146851u, 2731735627u, 2693238911u, 4059459408u, 0, ASIN_TOLERANCE, 0}, { 143, 2290935302u, 3819720014u, 3203031655u, 4218515595u, 2290935302u, 3819720014u, 0, ASIN_TOLERANCE, 0}, { 144, 2348280948u, 3038411370u, 3236511256u, 2472176453u, 2348280948u, 3038411370u, 0, ASIN_TOLERANCE, 0}, { 145, 2880785553u, 182132862u, 3252592387u, 1793714415u, 2880785553u, 182132862u, 0, ASIN_TOLERANCE, 0}, { 146, 2799656331u, 4227997622u, 1087681073u, 3265812129u, 2799656331u, 4227997622u, 0, ASIN_TOLERANCE, 0}, { 147, 801513493u, 1010183244u, 1091844280u, 675001864u, 801513493u, 1010183244u, 0, ASIN_TOLERANCE, 0}, { 148, 318478599u, 4193366103u, 1056610361u, 3831235255u, 318478599u, 4193366103u, 0, ASIN_TOLERANCE, 0}, { 149, 2378498000u, 465836562u, 3189131504u, 1330642846u, 2378498000u, 465836562u, 0, ASIN_TOLERANCE, 0}, { 150, 43741656u, 1192547728u, 1080448013u, 2251835756u, 43741656u, 1192547728u, 0, ASIN_TOLERANCE, 0}, { 151, 172875845u, 2123384287u, 3198090050u, 2528390848u, 172875845u, 2123384287u, 0, ASIN_TOLERANCE, 0}, { 152, 911443207u, 3964517760u, 3252496130u, 1755935266u, 911443207u, 3964517760u, 0, ASIN_TOLERANCE, 0}, { 153, 844811578u, 2753105123u, 3223721534u, 3995725873u, 844811578u, 2753105123u, 0, ASIN_TOLERANCE, 0}, { 154, 151452687u, 777231627u, 1042074674u, 36182517u, 151452687u, 777231627u, 0, ASIN_TOLERANCE, 0}, { 155, 3158956730u, 3937520057u, 3230206414u, 1507556284u, 3158956730u, 3937520057u, 0, ASIN_TOLERANCE, 0}, { 156, 910363913u, 1910829179u, 1052726418u, 90890556u, 910363913u, 1910829179u, 0, ASIN_TOLERANCE, 0}, { 157, 3107838682u, 1962827704u, 1080960105u, 1706263669u, 3107838682u, 1962827704u, 0, ASIN_TOLERANCE, 0}, { 158, 2177675826u, 3863498922u, 1084020789u, 2439263794u, 2177675826u, 3863498922u, 0, ASIN_TOLERANCE, 0}, { 159, 2909835385u, 2329801749u, 1098707350u, 2852802137u, 2909835385u, 2329801749u, 0, ASIN_TOLERANCE, 0}, { 160, 2979393160u, 3548991905u, 3213586763u, 3269946829u, 2979393160u, 3548991905u, 0, ASIN_TOLERANCE, 0}, { 161, 790744031u, 2009174302u, 1097495331u, 312449728u, 790744031u, 2009174302u, 0, ASIN_TOLERANCE, 0}, { 162, 2160628293u, 648730712u, 3246307879u, 4265764460u, 2160628293u, 648730712u, 0, ASIN_TOLERANCE, 0}, { 163, 1000831562u, 366653268u, 1051541874u, 1478215551u, 1000831562u, 366653268u, 0, ASIN_TOLERANCE, 0}, { 164, 2470023790u, 2605647918u, 1042539011u, 969681033u, 2470023790u, 2605647918u, 0, ASIN_TOLERANCE, 0}, { 165, 2322196276u, 1909222641u, 1092825252u, 3029685419u, 2322196276u, 1909222641u, 0, ASIN_TOLERANCE, 0}, { 166, 3159166635u, 1128432313u, 3200082887u, 2582838060u, 3159166635u, 1128432313u, 0, ASIN_TOLERANCE, 0}, { 167, 2525309230u, 546560372u, 1070003814u, 2343707656u, 2525309230u, 546560372u, 0, ASIN_TOLERANCE, 0}, { 168, 849110626u, 309618405u, 3246395018u, 3002005209u, 849110626u, 309618405u, 0, ASIN_TOLERANCE, 0}, { 169, 2706804529u, 3151760818u, 3196548461u, 1969485838u, 2706804529u, 3151760818u, 0, ASIN_TOLERANCE, 0}, { 170, 639469972u, 3667631361u, 3196181592u, 3743448274u, 639469972u, 3667631361u, 0, ASIN_TOLERANCE, 0}, { 171, 2658009958u, 3097521578u, 3216630070u, 1141349287u, 2658009958u, 3097521578u, 0, ASIN_TOLERANCE, 0}, { 172, 918158805u, 3403438584u, 3208257181u, 2221276438u, 918158805u, 3403438584u, 0, ASIN_TOLERANCE, 0}, { 173, 2401852086u, 1683102397u, 3250341256u, 108768173u, 2401852086u, 1683102397u, 0, ASIN_TOLERANCE, 0}, { 174, 2343899229u, 564813835u, 1064153550u, 3058531228u, 2343899229u, 564813835u, 0, ASIN_TOLERANCE, 0}, { 175, 2813220880u, 131949913u, 1090262840u, 2146798879u, 2813220880u, 131949913u, 0, ASIN_TOLERANCE, 0}, { 176, 2465897203u, 1934391255u, 3188783235u, 1341236714u, 2465897203u, 1934391255u, 0, ASIN_TOLERANCE, 0}, { 177, 1070130951u, 418478585u, 3248733961u, 5029000u, 1070141425u, 3058489590u, 0, ASIN_TOLERANCE, 0}, { 178, 453997460u, 2676092597u, 1105486693u, 1833595891u, 453997460u, 2676092597u, 0, ASIN_TOLERANCE, 0}, { 179, 522042376u, 1030769844u, 1071155175u, 2766628533u, 522042376u, 1030769844u, 0, ASIN_TOLERANCE, 0}, { 180, 2635141434u, 1153943376u, 3209762784u, 953839852u, 2635141434u, 1153943376u, 0, ASIN_TOLERANCE, 0}, { 181, 1029467775u, 143071571u, 1050966579u, 2318822594u, 1029467775u, 143071571u, 0, ASIN_TOLERANCE, 0}, { 182, 287910954u, 1347533411u, 3242337825u, 3256720041u, 287910954u, 1347533411u, 0, ASIN_TOLERANCE, 0}, { 183, 444067826u, 1840809642u, 1105293543u, 639604076u, 444067826u, 1840809642u, 0, ASIN_TOLERANCE, 0}, { 184, 37282545u, 113530717u, 3194758036u, 699784099u, 37282545u, 113530717u, 0, ASIN_TOLERANCE, 0}, { 185, 435549826u, 2950098243u, 1061587493u, 3565445501u, 435549826u, 2950098243u, 0, ASIN_TOLERANCE, 0}, { 186, 2385974507u, 2103316697u, 1076082218u, 4043789060u, 2385974507u, 2103316697u, 0, ASIN_TOLERANCE, 0}, { 187, 811546601u, 1521715421u, 3251785075u, 651105558u, 811546601u, 1521715421u, 0, ASIN_TOLERANCE, 0}, { 188, 491306771u, 2545467538u, 3213898932u, 3889824094u, 491306771u, 2545467538u, 0, ASIN_TOLERANCE, 0}, { 189, 503065027u, 4133138143u, 3246676260u, 2160225215u, 503065027u, 4133138143u, 0, ASIN_TOLERANCE, 0}, { 190, 994621531u, 836655570u, 3245194924u, 2865254908u, 994621531u, 836655570u, 0, ASIN_TOLERANCE, 0}, { 191, 2309344440u, 1678396836u, 3226762726u, 424413376u, 2309344440u, 1678396836u, 0, ASIN_TOLERANCE, 0}, { 192, 2164934365u, 2155776900u, 3222643433u, 2889736031u, 2164934365u, 2155776900u, 0, ASIN_TOLERANCE, 0}, { 193, 3003862757u, 33676353u, 1090754016u, 4128530794u, 3003862757u, 33676353u, 0, ASIN_TOLERANCE, 0}, { 194, 2386204171u, 3176672093u, 1052578754u, 2282864811u, 2386204171u, 3176672093u, 0, ASIN_TOLERANCE, 0}, { 195, 446288958u, 2747259961u, 1103923331u, 1909074501u, 446288958u, 2747259961u, 0, ASIN_TOLERANCE, 0}, { 196, 3119895314u, 482497137u, 3223384022u, 3259766501u, 3119895314u, 482497137u, 0, ASIN_TOLERANCE, 0}, { 197, 2460401984u, 1710626079u, 3222593534u, 834878686u, 2460401984u, 1710626079u, 0, ASIN_TOLERANCE, 0}, { 198, 3041977808u, 4271421721u, 1047020885u, 1742757458u, 3041977808u, 4271421721u, 0, ASIN_TOLERANCE, 0}, { 199, 2215391645u, 1265459564u, 1080678447u, 685348463u, 2215391645u, 1265459564u, 0, ASIN_TOLERANCE, 0}, { 200, 2688170568u, 4066044320u, 1054128905u, 376413109u, 2688170568u, 4066044320u, 0, ASIN_TOLERANCE, 0}, { 201, 716821218u, 3237497681u, 3242751645u, 260260645u, 716821218u, 3237497681u, 0, ASIN_TOLERANCE, 0}, { 202, 2385659123u, 2882820086u, 1085407846u, 2301658312u, 2385659123u, 2882820086u, 0, ASIN_TOLERANCE, 0}, { 203, 420514989u, 3656359254u, 3203021744u, 2817965308u, 420514989u, 3656359254u, 0, ASIN_TOLERANCE, 0}, { 204, 2841879402u, 2859722465u, 3197490752u, 3892072777u, 2841879402u, 2859722465u, 0, ASIN_TOLERANCE, 0}, { 205, 2665431021u, 2538156443u, 3215734057u, 831239754u, 2665431021u, 2538156443u, 0, ASIN_TOLERANCE, 0}, { 206, 953028035u, 3071308141u, 3231671892u, 30345936u, 953028035u, 3071308141u, 0, ASIN_TOLERANCE, 0}, { 207, 2210978501u, 3595439756u, 3214985609u, 739408315u, 2210978501u, 3595439756u, 0, ASIN_TOLERANCE, 0}, { 208, 3029757061u, 3298589427u, 3196131526u, 2084665197u, 3029757061u, 3298589427u, 0, ASIN_TOLERANCE, 0}, { 209, 2823345962u, 3955601456u, 1076543910u, 3304852042u, 2823345962u, 3955601456u, 0, ASIN_TOLERANCE, 0}, { 210, 640515933u, 2419975459u, 1073769087u, 1988016581u, 640515933u, 2419975459u, 0, ASIN_TOLERANCE, 0}, { 211, 2453833475u, 2659973204u, 3216007439u, 2731594173u, 2453833475u, 2659973204u, 0, ASIN_TOLERANCE, 0}, { 212, 697318369u, 3938264868u, 1062532020u, 2975148216u, 697318369u, 3938264868u, 0, ASIN_TOLERANCE, 0}, { 213, 225366869u, 453215326u, 3200044385u, 467903731u, 225366869u, 453215326u, 0, ASIN_TOLERANCE, 0}, { 214, 499614828u, 372130653u, 3235313361u, 3772501596u, 499614828u, 372130653u, 0, ASIN_TOLERANCE, 0}, { 215, 2298173054u, 2406734491u, 1099766912u, 3221574013u, 2298173054u, 2406734491u, 0, ASIN_TOLERANCE, 0}, { 216, 211434314u, 2841672781u, 3228298587u, 2623399873u, 211434314u, 2841672781u, 0, ASIN_TOLERANCE, 0}, { 217, 2562278951u, 2034292219u, 3248774822u, 699680428u, 2562278951u, 2034292219u, 0, ASIN_TOLERANCE, 0}, { 218, 1030621435u, 1386943632u, 1088782030u, 3724905992u, 1030621435u, 1386943632u, 0, ASIN_TOLERANCE, 0}, { 219, 217306301u, 1495300013u, 3240548807u, 1518804038u, 217306301u, 1495300013u, 0, ASIN_TOLERANCE, 0}, { 220, 362076244u, 3050489517u, 1049468975u, 2940604216u, 362076244u, 3050489517u, 0, ASIN_TOLERANCE, 0}, { 221, 516072020u, 387594449u, 3238538261u, 3010872301u, 516072020u, 387594449u, 0, ASIN_TOLERANCE, 0}, { 222, 2417270868u, 1683571756u, 1098214271u, 3243467912u, 2417270868u, 1683571756u, 0, ASIN_TOLERANCE, 0}, { 223, 2453871840u, 547789874u, 1074621795u, 671680995u, 2453871840u, 547789874u, 0, ASIN_TOLERANCE, 0}, { 224, 819681449u, 2315535361u, 1076278343u, 3851723081u, 819681449u, 2315535361u, 0, ASIN_TOLERANCE, 0}, { 225, 925396663u, 2690952636u, 3195785827u, 1648844317u, 925396663u, 2690952636u, 0, ASIN_TOLERANCE, 0}, { 226, 835916575u, 2105507379u, 1060210356u, 2061848524u, 835916575u, 2105507379u, 0, ASIN_TOLERANCE, 0}, { 227, 2882329693u, 1771437899u, 1102743884u, 4195142780u, 2882329693u, 1771437899u, 0, ASIN_TOLERANCE, 0}, { 228, 547945591u, 1310074754u, 1072476006u, 1313198415u, 547945591u, 1310074754u, 0, ASIN_TOLERANCE, 0}, { 229, 979656894u, 3914592621u, 3228159980u, 2457917034u, 979656894u, 3914592621u, 0, ASIN_TOLERANCE, 0}, { 230, 2718226491u, 2240965174u, 3236288087u, 3605857252u, 2718226491u, 2240965174u, 0, ASIN_TOLERANCE, 0}, { 231, 41761399u, 196714912u, 1054040628u, 3084755276u, 41761399u, 196714912u, 0, ASIN_TOLERANCE, 0}, { 232, 2665587864u, 2058851477u, 1052873711u, 1233598120u, 2665587864u, 2058851477u, 0, ASIN_TOLERANCE, 0}, { 233, 101299669u, 1909994277u, 3220384775u, 2863812374u, 101299669u, 1909994277u, 0, ASIN_TOLERANCE, 0}, { 234, 532015965u, 3697551156u, 1083211400u, 2869735287u, 532015965u, 3697551156u, 0, ASIN_TOLERANCE, 0}, { 235, 2830857894u, 2697221770u, 1092525956u, 2160271449u, 2830857894u, 2697221770u, 0, ASIN_TOLERANCE, 0}, { 236, 230734239u, 2762796844u, 1059257507u, 3160137573u, 230734239u, 2762796844u, 0, ASIN_TOLERANCE, 0}, { 237, 247044829u, 1758968847u, 1101109420u, 3270770898u, 247044829u, 1758968847u, 0, ASIN_TOLERANCE, 0}, { 238, 73012604u, 4005141897u, 3216213297u, 4129052985u, 73012604u, 4005141897u, 0, ASIN_TOLERANCE, 0}, { 239, 2970233606u, 137758261u, 1060349030u, 3082136857u, 2970233606u, 137758261u, 0, ASIN_TOLERANCE, 0}, { 240, 1068792039u, 2371653203u, 3211892131u, 3951914469u, 1068793473u, 3098305686u, 0, ASIN_TOLERANCE, 0}, { 241, 3109437504u, 3213595557u, 1043958672u, 2986160931u, 3109437504u, 3213595557u, 0, ASIN_TOLERANCE, 0}, { 242, 575927156u, 2540046258u, 3208370548u, 2048583911u, 575927156u, 2540046258u, 0, ASIN_TOLERANCE, 0}, { 243, 546830286u, 2264504930u, 3228769528u, 1854181735u, 546830286u, 2264504930u, 0, ASIN_TOLERANCE, 0}, { 244, 2183016286u, 3809768956u, 1054933586u, 595351688u, 2183016286u, 3809768956u, 0, ASIN_TOLERANCE, 0}, { 245, 723947614u, 3071069520u, 3207129696u, 3120974660u, 723947614u, 3071069520u, 0, ASIN_TOLERANCE, 0}, { 246, 945283056u, 1952618732u, 3236532520u, 1540955277u, 945283056u, 1952618732u, 0, ASIN_TOLERANCE, 0}, { 247, 747620529u, 1438803217u, 1049266525u, 957676449u, 747620529u, 1438803217u, 0, ASIN_TOLERANCE, 0}, { 248, 92767291u, 4222295662u, 1076131984u, 2183319069u, 92767291u, 4222295662u, 0, ASIN_TOLERANCE, 0}, { 249, 334611718u, 3887074118u, 3191649564u, 3233378721u, 334611718u, 3887074118u, 0, ASIN_TOLERANCE, 0}, { 250, 771768198u, 2099099488u, 3222430705u, 2071674991u, 771768198u, 2099099488u, 0, ASIN_TOLERANCE, 0}, { 251, 2409204087u, 2295269094u, 3196265320u, 3987032629u, 2409204087u, 2295269094u, 0, ASIN_TOLERANCE, 0}, { 252, 2377503648u, 4200095882u, 1086809994u, 1339996745u, 2377503648u, 4200095882u, 0, ASIN_TOLERANCE, 0}, { 253, 797809565u, 2431996507u, 1102017594u, 242934189u, 797809565u, 2431996507u, 0, ASIN_TOLERANCE, 0}, { 254, 2312749311u, 2330084417u, 1043172813u, 4043102110u, 2312749311u, 2330084417u, 0, ASIN_TOLERANCE, 0}, { 255, 988771849u, 1106978707u, 1082509751u, 2520765777u, 988771849u, 1106978707u, 0, ASIN_TOLERANCE, 0}, { 256, 864960887u, 3192168224u, 1066340820u, 3603945646u, 864960887u, 3192168224u, 0, ASIN_TOLERANCE, 0}, { 257, 2589695756u, 1952396835u, 3199434577u, 3703639356u, 2589695756u, 1952396835u, 0, ASIN_TOLERANCE, 0}, { 258, 320682810u, 1198219673u, 3230438668u, 2418060633u, 320682810u, 1198219673u, 0, ASIN_TOLERANCE, 0}, { 259, 551093026u, 2638353760u, 1093840413u, 1751560711u, 551093026u, 2638353760u, 0, ASIN_TOLERANCE, 0}, { 260, 540797521u, 180987057u, 1085420898u, 530063370u, 540797521u, 180987057u, 0, ASIN_TOLERANCE, 0}, { 261, 2760303516u, 3179145654u, 1048020008u, 3061407249u, 2760303516u, 3179145654u, 0, ASIN_TOLERANCE, 0}, { 262, 162525363u, 1884787302u, 1068713554u, 1737020797u, 162525363u, 1884787302u, 0, ASIN_TOLERANCE, 0}, { 263, 214216231u, 3459566012u, 3251200938u, 4126298722u, 214216231u, 3459566012u, 0, ASIN_TOLERANCE, 0}, { 264, 2764328342u, 1036370112u, 3235918644u, 3898933279u, 2764328342u, 1036370112u, 0, ASIN_TOLERANCE, 0}, { 265, 653867113u, 3276084832u, 3189072211u, 1864601262u, 653867113u, 3276084832u, 0, ASIN_TOLERANCE, 0}, { 266, 298324788u, 263075055u, 1100754245u, 1667825741u, 298324788u, 263075055u, 0, ASIN_TOLERANCE, 0}, { 267, 3015536039u, 2387220960u, 3253010819u, 3505575323u, 3015536039u, 2387220960u, 0, ASIN_TOLERANCE, 0}, { 268, 642739166u, 3154304623u, 1063475914u, 3150741666u, 642739166u, 3154304623u, 0, ASIN_TOLERANCE, 0}, { 269, 332025563u, 4200269406u, 3194288972u, 3577694711u, 332025563u, 4200269406u, 0, ASIN_TOLERANCE, 0}, { 270, 2339885777u, 2064011737u, 1089860833u, 3657008595u, 2339885777u, 2064011737u, 0, ASIN_TOLERANCE, 0}, { 271, 842190281u, 210665237u, 3197168874u, 510714829u, 842190281u, 210665237u, 0, ASIN_TOLERANCE, 0}, { 272, 728283504u, 1589701259u, 3251310843u, 17001602u, 728283504u, 1589701259u, 0, ASIN_TOLERANCE, 0}, { 273, 975043445u, 2928317152u, 3246958541u, 122162205u, 975043445u, 2928317152u, 0, ASIN_TOLERANCE, 0}, { 274, 3101610657u, 1288582346u, 1071556960u, 4177188454u, 3101610657u, 1288582346u, 0, ASIN_TOLERANCE, 0}, { 275, 151289169u, 3962848462u, 3243017171u, 3661038757u, 151289169u, 3962848462u, 0, ASIN_TOLERANCE, 0}, { 276, 2755192415u, 2162985241u, 3226640955u, 1639319068u, 2755192415u, 2162985241u, 0, ASIN_TOLERANCE, 0}, { 277, 2942384609u, 1996676305u, 1099130747u, 3840380763u, 2942384609u, 1996676305u, 0, ASIN_TOLERANCE, 0}, { 278, 134315769u, 550040067u, 3241901241u, 3372594924u, 134315769u, 550040067u, 0, ASIN_TOLERANCE, 0}, { 279, 3137373248u, 3164451169u, 1076627605u, 317246751u, 3137373248u, 3164451169u, 0, ASIN_TOLERANCE, 0}, { 280, 2423768299u, 784217153u, 1066058157u, 1225003160u, 2423768299u, 784217153u, 0, ASIN_TOLERANCE, 0}, { 281, 2378706924u, 1715871558u, 1101460352u, 3401958038u, 2378706924u, 1715871558u, 0, ASIN_TOLERANCE, 0}, { 282, 363631767u, 4086269531u, 1102279679u, 2517481591u, 363631767u, 4086269531u, 0, ASIN_TOLERANCE, 0}, { 283, 2329360168u, 2624677381u, 1085107111u, 1970804718u, 2329360168u, 2624677381u, 0, ASIN_TOLERANCE, 0}, { 284, 1010793546u, 3379532114u, 3249898830u, 3723025783u, 1010793546u, 3379532114u, 0, ASIN_TOLERANCE, 0}, { 285, 999588552u, 2651435439u, 3229039621u, 1030985387u, 999588552u, 2651435439u, 0, ASIN_TOLERANCE, 0}, { 286, 3145033808u, 1199535056u, 1077836259u, 3604666660u, 3145033808u, 1199535056u, 0, ASIN_TOLERANCE, 0}, { 287, 2548507371u, 3115209742u, 3237451386u, 3863935859u, 2548507371u, 3115209742u, 0, ASIN_TOLERANCE, 0}, { 288, 2398143146u, 4209496277u, 3199416183u, 1216202995u, 2398143146u, 4209496277u, 0, ASIN_TOLERANCE, 0}, { 289, 614398964u, 2544695332u, 3210577461u, 596332114u, 614398964u, 2544695332u, 0, ASIN_TOLERANCE, 0}, { 290, 514278395u, 1338323803u, 1041925718u, 99526924u, 514278395u, 1338323803u, 0, ASIN_TOLERANCE, 0}, { 291, 856573491u, 3149653097u, 1103058665u, 2483495776u, 856573491u, 3149653097u, 0, ASIN_TOLERANCE, 0}, { 292, 2339743312u, 280536835u, 1044395245u, 3715707641u, 2339743312u, 280536835u, 0, ASIN_TOLERANCE, 0}, { 293, 128894757u, 3670016377u, 1050809029u, 3775007802u, 128894757u, 3670016377u, 0, ASIN_TOLERANCE, 0}, { 294, 3109073100u, 3526859225u, 3222673081u, 4030462447u, 3109073100u, 3526859225u, 0, ASIN_TOLERANCE, 0}, { 295, 640779949u, 1602527268u, 3242467576u, 2018361566u, 640779949u, 1602527268u, 0, ASIN_TOLERANCE, 0}, { 296, 957271688u, 3985805054u, 1088518381u, 1679321540u, 957271688u, 3985805054u, 0, ASIN_TOLERANCE, 0}, { 297, 2801498828u, 1663896708u, 3248819198u, 4229852270u, 2801498828u, 1663896708u, 0, ASIN_TOLERANCE, 0}, { 298, 467728155u, 2346627527u, 3239438934u, 2290493820u, 467728155u, 2346627527u, 0, ASIN_TOLERANCE, 0}, { 299, 2208629720u, 2296736794u, 3207683799u, 1456667044u, 2208629720u, 2296736794u, 0, ASIN_TOLERANCE, 0}, { 300, 2958022504u, 4132454009u, 1106540396u, 4243490703u, 2958022504u, 4132454009u, 0, ASIN_TOLERANCE, 0}, { 301, 235395447u, 1359445676u, 3190130903u, 1569883678u, 235395447u, 1359445676u, 0, ASIN_TOLERANCE, 0}, { 302, 277859320u, 333214083u, 1076552006u, 1385185236u, 277859320u, 333214083u, 0, ASIN_TOLERANCE, 0}, { 303, 2942645471u, 950097945u, 1041232546u, 3621700966u, 2942645471u, 950097945u, 0, ASIN_TOLERANCE, 0}, { 304, 370898672u, 149336372u, 3191764868u, 2940199511u, 370898672u, 149336372u, 0, ASIN_TOLERANCE, 0}, { 305, 2384610875u, 2875684421u, 3249377056u, 4253432396u, 2384610875u, 2875684421u, 0, ASIN_TOLERANCE, 0}, { 306, 837504978u, 2081484836u, 3199314748u, 2264912911u, 837504978u, 2081484836u, 0, ASIN_TOLERANCE, 0}, { 307, 632882934u, 3967859615u, 3229710481u, 2667348142u, 632882934u, 3967859615u, 0, ASIN_TOLERANCE, 0}, { 308, 2181979516u, 3630082248u, 3227364534u, 4156569147u, 2181979516u, 3630082248u, 0, ASIN_TOLERANCE, 0}, { 309, 946956756u, 2993509124u, 1091331299u, 4018898246u, 946956756u, 2993509124u, 0, ASIN_TOLERANCE, 0}, { 310, 338207615u, 1642285349u, 3208379731u, 1196091123u, 338207615u, 1642285349u, 0, ASIN_TOLERANCE, 0}, { 311, 4693283u, 3356597889u, 1040231079u, 2420753479u, 4693283u, 3356597889u, 0, ASIN_TOLERANCE, 0}, { 312, 2762118529u, 977967943u, 3228887283u, 807395730u, 2762118529u, 977967943u, 0, ASIN_TOLERANCE, 0}, { 313, 2919435607u, 2730725979u, 3207120390u, 3867917386u, 2919435607u, 2730725979u, 0, ASIN_TOLERANCE, 0}, { 314, 999294480u, 3504746045u, 1075794770u, 665882260u, 999294480u, 3504746045u, 0, ASIN_TOLERANCE, 0}, { 315, 2269075155u, 3385464702u, 1049896268u, 2757059958u, 2269075155u, 3385464702u, 0, ASIN_TOLERANCE, 0}, { 316, 536095951u, 1299923384u, 1101872081u, 2574386817u, 536095951u, 1299923384u, 0, ASIN_TOLERANCE, 0}, { 317, 2675071145u, 3171042375u, 1078533152u, 2312086600u, 2675071145u, 3171042375u, 0, ASIN_TOLERANCE, 0}, { 318, 2360735442u, 4236561530u, 1068042271u, 256515531u, 2360735442u, 4236561530u, 0, ASIN_TOLERANCE, 0}, { 319, 2609926553u, 4152554926u, 1100304772u, 3545562886u, 2609926553u, 4152554926u, 0, ASIN_TOLERANCE, 0}, { 320, 2403546570u, 350924105u, 1040286251u, 1468770658u, 2403546570u, 350924105u, 0, ASIN_TOLERANCE, 0}, { 321, 544551146u, 3000822699u, 3232925779u, 2540988650u, 544551146u, 3000822699u, 0, ASIN_TOLERANCE, 0}, { 322, 2780107631u, 2928199244u, 3245167989u, 44275991u, 2780107631u, 2928199244u, 0, ASIN_TOLERANCE, 0}, { 323, 2165210001u, 1174874204u, 1057110584u, 848081004u, 2165210001u, 1174874204u, 0, ASIN_TOLERANCE, 0}, { 324, 2354568060u, 1412948540u, 3239110676u, 3215002775u, 2354568060u, 1412948540u, 0, ASIN_TOLERANCE, 0}, { 325, 863277892u, 2701562677u, 1065879622u, 2897481417u, 863277892u, 2701562677u, 0, ASIN_TOLERANCE, 0}, { 326, 199312991u, 2980401690u, 3216742908u, 2549609731u, 199312991u, 2980401690u, 0, ASIN_TOLERANCE, 0}, { 327, 2827983212u, 585456984u, 3201746087u, 638714580u, 2827983212u, 585456984u, 0, ASIN_TOLERANCE, 0}, { 328, 575008531u, 4260896505u, 1089137884u, 4274648992u, 575008531u, 4260896505u, 0, ASIN_TOLERANCE, 0}, { 329, 2728904219u, 4055046173u, 3198391736u, 3482894513u, 2728904219u, 4055046173u, 0, ASIN_TOLERANCE, 0}, { 330, 341009704u, 2493198836u, 3198094528u, 2484800635u, 341009704u, 2493198836u, 0, ASIN_TOLERANCE, 0}, { 331, 3153287889u, 599921010u, 1103847606u, 1674254897u, 3153287889u, 599921010u, 0, ASIN_TOLERANCE, 0}, { 332, 104926329u, 217148561u, 1097066495u, 3536010689u, 104926329u, 217148561u, 0, ASIN_TOLERANCE, 0}, { 333, 933395812u, 1605519917u, 3225218243u, 2732577078u, 933395812u, 1605519917u, 0, ASIN_TOLERANCE, 0}, { 334, 573219110u, 417261654u, 3246267157u, 3401343872u, 573219110u, 417261654u, 0, ASIN_TOLERANCE, 0}, { 335, 1039272770u, 2150330697u, 1080405602u, 3197535445u, 1039272770u, 2150330697u, 0, ASIN_TOLERANCE, 0}, { 336, 1065739247u, 2334624779u, 1070288136u, 147709079u, 1065739274u, 3700895036u, 0, ASIN_TOLERANCE, 0}, { 337, 3178645135u, 665848401u, 3235013045u, 2195099382u, 3178645135u, 665848401u, 0, ASIN_TOLERANCE, 0}, { 338, 364316788u, 238721142u, 3238780023u, 2612316049u, 364316788u, 238721142u, 0, ASIN_TOLERANCE, 0}, { 339, 2974180417u, 328119069u, 3231550903u, 696220816u, 2974180417u, 328119069u, 0, ASIN_TOLERANCE, 0}, { 340, 649641437u, 2886210843u, 1055433962u, 3331415058u, 649641437u, 2886210843u, 0, ASIN_TOLERANCE, 0}, { 341, 335135121u, 2420250111u, 3214614526u, 510850312u, 335135121u, 2420250111u, 0, ASIN_TOLERANCE, 0}, { 342, 2216193203u, 1658541647u, 1071956366u, 53496813u, 2216193203u, 1658541647u, 0, ASIN_TOLERANCE, 0}, { 343, 2567194005u, 3872563165u, 1098494887u, 2790313039u, 2567194005u, 3872563165u, 0, ASIN_TOLERANCE, 0}, { 344, 3219733872u, 3859621368u, 3205775949u, 4015749711u, 3219985579u, 1133459795u, 0, ASIN_TOLERANCE, 0}, { 345, 311334852u, 1732769560u, 1052132915u, 2774541952u, 311334852u, 1732769560u, 0, ASIN_TOLERANCE, 0}, { 346, 317917675u, 1689088021u, 1066883290u, 3270546122u, 317917675u, 1689088021u, 0, ASIN_TOLERANCE, 0}, { 347, 491335395u, 1959705843u, 1106618962u, 4198868105u, 491335395u, 1959705843u, 0, ASIN_TOLERANCE, 0}, { 348, 124503353u, 3906315805u, 3235289682u, 1109820549u, 124503353u, 3906315805u, 0, ASIN_TOLERANCE, 0}, { 349, 3036818075u, 3370448446u, 1063890856u, 4022784584u, 3036818075u, 3370448446u, 0, ASIN_TOLERANCE, 0}, { 350, 323334929u, 3264056381u, 1104622566u, 3697934821u, 323334929u, 3264056381u, 0, ASIN_TOLERANCE, 0}, { 351, 82666680u, 2912871781u, 3242116859u, 1560571600u, 82666680u, 2912871781u, 0, ASIN_TOLERANCE, 0}, { 352, 2776916990u, 3103325650u, 3237224234u, 3681651958u, 2776916990u, 3103325650u, 0, ASIN_TOLERANCE, 0}, { 353, 333678608u, 3330581237u, 1086856468u, 3110345659u, 333678608u, 3330581237u, 0, ASIN_TOLERANCE, 0}, { 354, 2487169180u, 2478706589u, 1099546513u, 4177071445u, 2487169180u, 2478706589u, 0, ASIN_TOLERANCE, 0}, { 355, 3183204741u, 3514067221u, 3247338343u, 585148435u, 3183204741u, 3514067221u, 0, ASIN_TOLERANCE, 0}, { 356, 2811486197u, 3689342853u, 3208758774u, 200507809u, 2811486197u, 3689342853u, 0, ASIN_TOLERANCE, 0}, { 357, 3116462959u, 1049872171u, 3210445232u, 1453705582u, 3116462959u, 1049872171u, 0, ASIN_TOLERANCE, 0}, { 358, 3129943472u, 1932668626u, 1098808013u, 1044068983u, 3129943472u, 1932668626u, 0, ASIN_TOLERANCE, 0}, { 359, 2295964401u, 4093388677u, 3210795947u, 1617393713u, 2295964401u, 4093388677u, 0, ASIN_TOLERANCE, 0}, { 360, 2293016564u, 778812087u, 3246232571u, 731905539u, 2293016564u, 778812087u, 0, ASIN_TOLERANCE, 0}, { 361, 2907822649u, 4050829759u, 1086605180u, 1863848117u, 2907822649u, 4050829759u, 0, ASIN_TOLERANCE, 0}, { 362, 6647363u, 718161191u, 1071063889u, 2637291484u, 6647363u, 718161191u, 0, ASIN_TOLERANCE, 0}, { 363, 224521970u, 1909842364u, 1102747575u, 3614304657u, 224521970u, 1909842364u, 0, ASIN_TOLERANCE, 0}, { 364, 761500166u, 895493977u, 3236485375u, 1701194116u, 761500166u, 895493977u, 0, ASIN_TOLERANCE, 0}, { 365, 2171563276u, 1493115846u, 3233339987u, 296022762u, 2171563276u, 1493115846u, 0, ASIN_TOLERANCE, 0}, { 366, 2783624899u, 4099447408u, 3187790416u, 3564720305u, 2783624899u, 4099447408u, 0, ASIN_TOLERANCE, 0}, { 367, 848425142u, 2404172709u, 3219922640u, 2284484846u, 848425142u, 2404172709u, 0, ASIN_TOLERANCE, 0}, { 368, 2654315895u, 3240896015u, 3208621510u, 1226668421u, 2654315895u, 3240896015u, 0, ASIN_TOLERANCE, 0}, { 369, 2488218361u, 4127752456u, 3200753143u, 2161953369u, 2488218361u, 4127752456u, 0, ASIN_TOLERANCE, 0}, { 370, 489605006u, 1168774591u, 3191311819u, 2375467787u, 489605006u, 1168774591u, 0, ASIN_TOLERANCE, 0}, { 371, 347845914u, 2883145553u, 3234998320u, 3286468014u, 347845914u, 2883145553u, 0, ASIN_TOLERANCE, 0}, { 372, 2588007471u, 3007671464u, 1102234703u, 1209628408u, 2588007471u, 3007671464u, 0, ASIN_TOLERANCE, 0}, { 373, 127334109u, 571692916u, 3243349276u, 1910625797u, 127334109u, 571692916u, 0, ASIN_TOLERANCE, 0}, { 374, 524138712u, 2510184860u, 1089525631u, 2209639467u, 524138712u, 2510184860u, 0, ASIN_TOLERANCE, 0}, { 375, 2615466346u, 1945605229u, 3227105252u, 3777119615u, 2615466346u, 1945605229u, 0, ASIN_TOLERANCE, 0}, { 376, 398493829u, 215226593u, 3235434773u, 224271737u, 398493829u, 215226593u, 0, ASIN_TOLERANCE, 0}, { 377, 2242993828u, 2134662911u, 1080232319u, 1056746021u, 2242993828u, 2134662911u, 0, ASIN_TOLERANCE, 0}, { 378, 2923358085u, 1099524039u, 1085032107u, 3905384073u, 2923358085u, 1099524039u, 0, ASIN_TOLERANCE, 0}, { 379, 842579915u, 985866260u, 3225437419u, 3120783698u, 842579915u, 985866260u, 0, ASIN_TOLERANCE, 0}, { 380, 2589795066u, 1700432859u, 3230345428u, 3505263023u, 2589795066u, 1700432859u, 0, ASIN_TOLERANCE, 0}, { 381, 2297683903u, 953966053u, 1090810641u, 151959421u, 2297683903u, 953966053u, 0, ASIN_TOLERANCE, 0}, { 382, 2887420078u, 1520016810u, 1096148013u, 1974161688u, 2887420078u, 1520016810u, 0, ASIN_TOLERANCE, 0}, { 383, 2738297064u, 1577726432u, 1080717542u, 3407236142u, 2738297064u, 1577726432u, 0, ASIN_TOLERANCE, 0}, { 384, 3154840433u, 358621181u, 3214344145u, 3735144364u, 3154840433u, 358621181u, 0, ASIN_TOLERANCE, 0}, { 385, 2521491907u, 4023613376u, 1095386964u, 959640601u, 2521491907u, 4023613376u, 0, ASIN_TOLERANCE, 0}, { 386, 2369008919u, 4136915018u, 1042238319u, 1264360404u, 2369008919u, 4136915018u, 0, ASIN_TOLERANCE, 0}, { 387, 2906418341u, 3543839161u, 1093859356u, 2852227162u, 2906418341u, 3543839161u, 0, ASIN_TOLERANCE, 0}, { 388, 2218509603u, 2154399659u, 3218171985u, 2610173674u, 2218509603u, 2154399659u, 0, ASIN_TOLERANCE, 0}, { 389, 165687034u, 2502718011u, 1105407582u, 4037997673u, 165687034u, 2502718011u, 0, ASIN_TOLERANCE, 0}, { 390, 3034344010u, 2429891750u, 3220651893u, 3433646170u, 3034344010u, 2429891750u, 0, ASIN_TOLERANCE, 0}, { 391, 397029567u, 1233242847u, 3233842223u, 1978947905u, 397029567u, 1233242847u, 0, ASIN_TOLERANCE, 0}, { 392, 32753845u, 3055512924u, 1085895689u, 2569766862u, 32753845u, 3055512924u, 0, ASIN_TOLERANCE, 0}, { 393, 498004465u, 3103627383u, 1075642950u, 676014010u, 498004465u, 3103627383u, 0, ASIN_TOLERANCE, 0}, { 394, 2622487710u, 3587249671u, 1050343198u, 2034180320u, 2622487710u, 3587249671u, 0, ASIN_TOLERANCE, 0}, { 395, 2559467693u, 1175750283u, 3228052153u, 441772035u, 2559467693u, 1175750283u, 0, ASIN_TOLERANCE, 0}, { 396, 639279177u, 1096886368u, 1067186387u, 4256284279u, 639279177u, 1096886368u, 0, ASIN_TOLERANCE, 0}, { 397, 208471934u, 2746455711u, 3243186220u, 383175406u, 208471934u, 2746455711u, 0, ASIN_TOLERANCE, 0}, { 398, 2829822244u, 1056466374u, 3247450556u, 3263564076u, 2829822244u, 1056466374u, 0, ASIN_TOLERANCE, 0}, { 399, 2468230336u, 1734210936u, 3195265560u, 514072505u, 2468230336u, 1734210936u, 0, ASIN_TOLERANCE, 0}, { 400, 758811245u, 1728341051u, 1092832248u, 3823410158u, 758811245u, 1728341051u, 0, ASIN_TOLERANCE, 0}, { 401, 2347191449u, 1235712656u, 3219475794u, 3622129011u, 2347191449u, 1235712656u, 0, ASIN_TOLERANCE, 0}, { 402, 79742765u, 1575194991u, 3197615492u, 3446988115u, 79742765u, 1575194991u, 0, ASIN_TOLERANCE, 0}, { 403, 2161423950u, 2362441752u, 1088255327u, 270039934u, 2161423950u, 2362441752u, 0, ASIN_TOLERANCE, 0}, { 404, 3010727959u, 3063626339u, 1105039555u, 1845818221u, 3010727959u, 3063626339u, 0, ASIN_TOLERANCE, 0}, { 405, 192788472u, 3718151518u, 3240183167u, 3113149567u, 192788472u, 3718151518u, 0, ASIN_TOLERANCE, 0}, { 406, 313112913u, 3686096237u, 3199484638u, 191185038u, 313112913u, 3686096237u, 0, ASIN_TOLERANCE, 0}, { 407, 195422631u, 3680158556u, 1105637038u, 349436087u, 195422631u, 3680158556u, 0, ASIN_TOLERANCE, 0}, { 408, 2844026099u, 150975354u, 1100107824u, 729077351u, 2844026099u, 150975354u, 0, ASIN_TOLERANCE, 0}, { 409, 3016106050u, 2974566906u, 1091481543u, 195479384u, 3016106050u, 2974566906u, 0, ASIN_TOLERANCE, 0}, { 410, 2820952232u, 953930448u, 3232752339u, 1009878771u, 2820952232u, 953930448u, 0, ASIN_TOLERANCE, 0}, { 411, 179600265u, 3369386607u, 1057414346u, 1319431804u, 179600265u, 3369386607u, 0, ASIN_TOLERANCE, 0}, { 412, 586131522u, 3279403983u, 3223631624u, 3404608264u, 586131522u, 3279403983u, 0, ASIN_TOLERANCE, 0}, { 413, 937427869u, 559918757u, 1105263000u, 1026957442u, 937427869u, 559918757u, 0, ASIN_TOLERANCE, 0}, { 414, 128542208u, 2658716822u, 1104708872u, 996387212u, 128542208u, 2658716822u, 0, ASIN_TOLERANCE, 0}, { 415, 2731512332u, 3244026687u, 1047704829u, 2987820261u, 2731512332u, 3244026687u, 0, ASIN_TOLERANCE, 0}, { 416, 829571115u, 1205633467u, 3212336151u, 731560768u, 829571115u, 1205633467u, 0, ASIN_TOLERANCE, 0}, { 417, 2850353849u, 3269211356u, 3233229218u, 2632041754u, 2850353849u, 3269211356u, 0, ASIN_TOLERANCE, 0}, { 418, 1070113635u, 1007200508u, 1086406456u, 1484610595u, 1070123776u, 907090054u, 0, ASIN_TOLERANCE, 0}, { 419, 968866968u, 3805991624u, 1101562011u, 3292762908u, 968866968u, 3805991624u, 0, ASIN_TOLERANCE, 0}, { 420, 2437809818u, 3314105762u, 3211254740u, 3489200637u, 2437809818u, 3314105762u, 0, ASIN_TOLERANCE, 0}, { 421, 2571363594u, 3198252706u, 3200980182u, 558779875u, 2571363594u, 3198252706u, 0, ASIN_TOLERANCE, 0}, { 422, 2377866012u, 2338464653u, 1083319346u, 4167405697u, 2377866012u, 2338464653u, 0, ASIN_TOLERANCE, 0}, { 423, 2919015115u, 2320792999u, 3245310028u, 2734025087u, 2919015115u, 2320792999u, 0, ASIN_TOLERANCE, 0}, { 424, 2318992495u, 832495279u, 3189857572u, 919851193u, 2318992495u, 832495279u, 0, ASIN_TOLERANCE, 0}, { 425, 3116721767u, 594640291u, 1077503330u, 976536412u, 3116721767u, 594640291u, 0, ASIN_TOLERANCE, 0}, { 426, 3139145310u, 79400523u, 3241084263u, 3353474633u, 3139145310u, 79400523u, 0, ASIN_TOLERANCE, 0}, { 427, 3132785785u, 1078965987u, 3233772596u, 3496966466u, 3132785785u, 1078965987u, 0, ASIN_TOLERANCE, 0}, { 428, 892587941u, 4243435186u, 1078663150u, 2446827483u, 892587941u, 4243435186u, 0, ASIN_TOLERANCE, 0}, { 429, 644490711u, 699817447u, 1081268534u, 2111588814u, 644490711u, 699817447u, 0, ASIN_TOLERANCE, 0}, { 430, 536635513u, 177265199u, 3233855943u, 965677531u, 536635513u, 177265199u, 0, ASIN_TOLERANCE, 0}, { 431, 624474831u, 3957229084u, 1065403841u, 3870961932u, 624474831u, 3957229084u, 0, ASIN_TOLERANCE, 0}, { 432, 2495519163u, 2768873929u, 3212244708u, 4127917680u, 2495519163u, 2768873929u, 0, ASIN_TOLERANCE, 0}, { 433, 445621604u, 3639227340u, 1068863190u, 4192848976u, 445621604u, 3639227340u, 0, ASIN_TOLERANCE, 0}, { 434, 2543806408u, 2824651320u, 1092946600u, 2150743372u, 2543806408u, 2824651320u, 0, ASIN_TOLERANCE, 0}, { 435, 417715333u, 1542109195u, 3223841580u, 2386809036u, 417715333u, 1542109195u, 0, ASIN_TOLERANCE, 0}, { 436, 192029360u, 1374810628u, 3218415587u, 1623455911u, 192029360u, 1374810628u, 0, ASIN_TOLERANCE, 0}, { 437, 733790955u, 226433601u, 1048463914u, 2667067819u, 733790955u, 226433601u, 0, ASIN_TOLERANCE, 0}, { 438, 768579443u, 1339325351u, 1074062507u, 701901582u, 768579443u, 1339325351u, 0, ASIN_TOLERANCE, 0}, { 439, 2920705365u, 3631553324u, 1068350633u, 1231934926u, 2920705365u, 3631553324u, 0, ASIN_TOLERANCE, 0}, { 440, 2933708324u, 603977748u, 1098802865u, 1502493757u, 2933708324u, 603977748u, 0, ASIN_TOLERANCE, 0}, { 441, 852954796u, 4255242031u, 1076182326u, 2417637015u, 852954796u, 4255242031u, 0, ASIN_TOLERANCE, 0}, { 442, 3089857028u, 3270297477u, 1057486942u, 2885336275u, 3089857028u, 3270297477u, 0, ASIN_TOLERANCE, 0}, { 443, 2809553007u, 1162164397u, 3250508564u, 2047944882u, 2809553007u, 1162164397u, 0, ASIN_TOLERANCE, 0}, { 444, 2875372587u, 129658419u, 3243244851u, 817360375u, 2875372587u, 129658419u, 0, ASIN_TOLERANCE, 0}, { 445, 286421081u, 4166988101u, 3246796270u, 1780823036u, 286421081u, 4166988101u, 0, ASIN_TOLERANCE, 0}, { 446, 668574270u, 418009120u, 1081026514u, 909013508u, 668574270u, 418009120u, 0, ASIN_TOLERANCE, 0}, { 447, 3082072506u, 4186670845u, 1073362089u, 2619129420u, 3082072506u, 4186670845u, 0, ASIN_TOLERANCE, 0}, { 448, 795252317u, 1348987467u, 3217165795u, 4162017137u, 795252317u, 1348987467u, 0, ASIN_TOLERANCE, 0}, { 449, 2946795826u, 2808968027u, 1057864611u, 275397670u, 2946795826u, 2808968027u, 0, ASIN_TOLERANCE, 0}, { 450, 513174607u, 240711581u, 3188571226u, 991292615u, 513174607u, 240711581u, 0, ASIN_TOLERANCE, 0}, { 451, 2439023326u, 1881121353u, 1082366688u, 3029043132u, 2439023326u, 1881121353u, 0, ASIN_TOLERANCE, 0}, { 452, 192508083u, 4250650421u, 3246612558u, 2498768625u, 192508083u, 4250650421u, 0, ASIN_TOLERANCE, 0}, { 453, 3180747941u, 2999983605u, 1096654323u, 2577373394u, 3180747941u, 2999983605u, 0, ASIN_TOLERANCE, 0}, { 454, 868314815u, 1300140379u, 3213491585u, 55226854u, 868314815u, 1300140379u, 0, ASIN_TOLERANCE, 0}, { 455, 49966445u, 13489454u, 3217461344u, 1447224005u, 49966445u, 13489454u, 0, ASIN_TOLERANCE, 0}, { 456, 2210271568u, 180789028u, 3221481024u, 2263184048u, 2210271568u, 180789028u, 0, ASIN_TOLERANCE, 0}, { 457, 2397088667u, 426293588u, 3239818611u, 1789635787u, 2397088667u, 426293588u, 0, ASIN_TOLERANCE, 0}, { 458, 302342406u, 1048286093u, 3227133745u, 2920139253u, 302342406u, 1048286093u, 0, ASIN_TOLERANCE, 0}, { 459, 540854981u, 287184966u, 1093076159u, 1371882685u, 540854981u, 287184966u, 0, ASIN_TOLERANCE, 0}, { 460, 770805810u, 2474797470u, 1065280366u, 1506889536u, 770805810u, 2474797470u, 0, ASIN_TOLERANCE, 0}, { 461, 2555731452u, 345487446u, 1053421486u, 1197157341u, 2555731452u, 345487446u, 0, ASIN_TOLERANCE, 0}, { 462, 2628226629u, 515700445u, 3214016873u, 2783826669u, 2628226629u, 515700445u, 0, ASIN_TOLERANCE, 0}, { 463, 467959892u, 1025779807u, 3217947229u, 937205825u, 467959892u, 1025779807u, 0, ASIN_TOLERANCE, 0}, { 464, 3185898801u, 503864881u, 1076822915u, 2345033570u, 3185898801u, 503864881u, 0, ASIN_TOLERANCE, 0}, { 465, 393896468u, 596014050u, 3250464728u, 3171536734u, 393896468u, 596014050u, 0, ASIN_TOLERANCE, 0}, { 466, 2267420964u, 3948135817u, 3235208235u, 557360557u, 2267420964u, 3948135817u, 0, ASIN_TOLERANCE, 0}, { 467, 2954074298u, 110029735u, 1081878271u, 658156641u, 2954074298u, 110029735u, 0, ASIN_TOLERANCE, 0}, { 468, 566438875u, 2733782773u, 1068148429u, 2141208212u, 566438875u, 2733782773u, 0, ASIN_TOLERANCE, 0}, { 469, 2666943954u, 790308557u, 1107048971u, 563615979u, 2666943954u, 790308557u, 0, ASIN_TOLERANCE, 0}, { 470, 2405996540u, 2566307075u, 1083723970u, 1428203311u, 2405996540u, 2566307075u, 0, ASIN_TOLERANCE, 0}, { 471, 2270749356u, 3880424699u, 3236471057u, 2886278126u, 2270749356u, 3880424699u, 0, ASIN_TOLERANCE, 0}, { 472, 524758414u, 2701977458u, 1043006318u, 4263191658u, 524758414u, 2701977458u, 0, ASIN_TOLERANCE, 0}, { 473, 2942114697u, 1360096867u, 3234511235u, 722957892u, 2942114697u, 1360096867u, 0, ASIN_TOLERANCE, 0}, { 474, 3154505042u, 1993420044u, 1095357710u, 2156133394u, 3154505042u, 1993420044u, 0, ASIN_TOLERANCE, 0}, { 475, 2461372509u, 3917014693u, 3239137997u, 3218865041u, 2461372509u, 3917014693u, 0, ASIN_TOLERANCE, 0}, { 476, 2423614376u, 3840388050u, 1044708748u, 3339981792u, 2423614376u, 3840388050u, 0, ASIN_TOLERANCE, 0}, { 477, 68664930u, 2548196869u, 1075650752u, 2503792874u, 68664930u, 2548196869u, 0, ASIN_TOLERANCE, 0}, { 478, 27003265u, 3589631476u, 3235077884u, 2445744426u, 27003265u, 3589631476u, 0, ASIN_TOLERANCE, 0}, { 479, 520248228u, 203410210u, 1058974455u, 4258595472u, 520248228u, 203410210u, 0, ASIN_TOLERANCE, 0}, { 480, 191352353u, 3053913996u, 1043884546u, 2757616601u, 191352353u, 3053913996u, 0, ASIN_TOLERANCE, 0}, { 481, 2602287836u, 1038998189u, 3205430458u, 3695555540u, 2602287836u, 1038998189u, 0, ASIN_TOLERANCE, 0}, { 482, 2449136794u, 4118722076u, 1042468417u, 3583005947u, 2449136794u, 4118722076u, 0, ASIN_TOLERANCE, 0}, { 483, 2166884388u, 1539535238u, 3246934215u, 508708967u, 2166884388u, 1539535238u, 0, ASIN_TOLERANCE, 0}, { 484, 2298893886u, 1355147861u, 3251354609u, 4133432965u, 2298893886u, 1355147861u, 0, ASIN_TOLERANCE, 0}, { 485, 826309703u, 1630207738u, 3189562989u, 2643371954u, 826309703u, 1630207738u, 0, ASIN_TOLERANCE, 0}, { 486, 1044987158u, 3806259293u, 3242741783u, 15657985u, 1044987158u, 3806259293u, 0, ASIN_TOLERANCE, 0}, { 487, 497456897u, 151607638u, 3227697753u, 467630898u, 497456897u, 151607638u, 0, ASIN_TOLERANCE, 0}, { 488, 3017637501u, 1016107066u, 1077142954u, 2195497000u, 3017637501u, 1016107066u, 0, ASIN_TOLERANCE, 0}, { 489, 2893082164u, 605010161u, 1050995677u, 3081653542u, 2893082164u, 605010161u, 0, ASIN_TOLERANCE, 0}, { 490, 469011148u, 4071435209u, 3207925259u, 1894382776u, 469011148u, 4071435209u, 0, ASIN_TOLERANCE, 0}, { 491, 2531356920u, 1522707251u, 3218735666u, 1578075186u, 2531356920u, 1522707251u, 0, ASIN_TOLERANCE, 0}, { 492, 431642664u, 1500392608u, 3190947192u, 3634607405u, 431642664u, 1500392608u, 0, ASIN_TOLERANCE, 0}, { 493, 2582144456u, 3646244007u, 3197852749u, 3808681655u, 2582144456u, 3646244007u, 0, ASIN_TOLERANCE, 0}, { 494, 233126338u, 1821773119u, 1094752155u, 1757234723u, 233126338u, 1821773119u, 0, ASIN_TOLERANCE, 0}, { 495, 2765502023u, 3794954283u, 3238755664u, 1209121339u, 2765502023u, 3794954283u, 0, ASIN_TOLERANCE, 0}, { 496, 2342622984u, 1775878726u, 1096028209u, 221183908u, 2342622984u, 1775878726u, 0, ASIN_TOLERANCE, 0}, { 497, 231520693u, 615054313u, 1105995987u, 1405024657u, 231520693u, 615054313u, 0, ASIN_TOLERANCE, 0}, { 498, 2401381272u, 2784860416u, 1074009275u, 787419698u, 2401381272u, 2784860416u, 0, ASIN_TOLERANCE, 0}, { 499, 943699878u, 2079960298u, 1074123223u, 2100091620u, 943699878u, 2079960298u, 0, ASIN_TOLERANCE, 0}, { 500, 592542034u, 311050208u, 3211234312u, 806358659u, 592542034u, 311050208u, 0, ASIN_TOLERANCE, 0}, { 501, 554939259u, 898080849u, 1106754706u, 2510882902u, 554939259u, 898080849u, 0, ASIN_TOLERANCE, 0}, { 502, 2949198761u, 2015533813u, 1089275809u, 298982001u, 2949198761u, 2015533813u, 0, ASIN_TOLERANCE, 0}, { 503, 989540066u, 914741728u, 1092886795u, 464054401u, 989540066u, 914741728u, 0, ASIN_TOLERANCE, 0}, { 504, 2304253208u, 3863739765u, 3214711653u, 3915767823u, 2304253208u, 3863739765u, 0, ASIN_TOLERANCE, 0}, { 505, 958251880u, 3239739200u, 1104805370u, 2971054003u, 958251880u, 3239739200u, 0, ASIN_TOLERANCE, 0}, { 506, 2670649374u, 2491104644u, 3198242303u, 2559304728u, 2670649374u, 2491104644u, 0, ASIN_TOLERANCE, 0}, { 507, 939123286u, 684435317u, 1055177809u, 2787628393u, 939123286u, 684435317u, 0, ASIN_TOLERANCE, 0}, { 508, 2541359251u, 1636085321u, 1069717586u, 4235233108u, 2541359251u, 1636085321u, 0, ASIN_TOLERANCE, 0}, { 509, 1044593898u, 202708387u, 3196003256u, 482423661u, 1044593898u, 202708387u, 0, ASIN_TOLERANCE, 0}, { 510, 139626925u, 2518164801u, 3206911657u, 1250530357u, 139626925u, 2518164801u, 0, ASIN_TOLERANCE, 0}, { 511, 2850784019u, 3737313137u, 1045922781u, 3136078996u, 2850784019u, 3737313137u, 0, ASIN_TOLERANCE, 0}, { 512, 2263385372u, 2650572904u, 3215945256u, 2341430700u, 2263385372u, 2650572904u, 0, ASIN_TOLERANCE, 0}, { 513, 2703884311u, 4279456618u, 1045375126u, 3817511514u, 2703884311u, 4279456618u, 0, ASIN_TOLERANCE, 0}, { 514, 2332933790u, 1898920133u, 3238856617u, 3322385778u, 2332933790u, 1898920133u, 0, ASIN_TOLERANCE, 0}, { 515, 628125129u, 769863378u, 3205646293u, 3033900668u, 628125129u, 769863378u, 0, ASIN_TOLERANCE, 0}, { 516, 3150112853u, 2363605017u, 1057042323u, 3607277737u, 3150112853u, 2363605017u, 0, ASIN_TOLERANCE, 0}, { 517, 453059902u, 2102433536u, 1073687186u, 1772007848u, 453059902u, 2102433536u, 0, ASIN_TOLERANCE, 0}, { 518, 3088101403u, 1756195518u, 3225902960u, 1222779056u, 3088101403u, 1756195518u, 0, ASIN_TOLERANCE, 0}, { 519, 936228020u, 1142293403u, 3242693386u, 741039297u, 936228020u, 1142293403u, 0, ASIN_TOLERANCE, 0}, { 520, 1034983355u, 2830408439u, 1041913758u, 3306391490u, 1034983355u, 2830408439u, 0, ASIN_TOLERANCE, 0}, { 521, 2352979086u, 2205233857u, 1075419064u, 4008575827u, 2352979086u, 2205233857u, 0, ASIN_TOLERANCE, 0}, { 522, 445518797u, 2566866389u, 1094655457u, 4036587454u, 445518797u, 2566866389u, 0, ASIN_TOLERANCE, 0}, { 523, 311145393u, 1824828952u, 3243078353u, 4292530873u, 311145393u, 1824828952u, 0, ASIN_TOLERANCE, 0}, { 524, 2553824191u, 4155068217u, 3207589361u, 3447729183u, 2553824191u, 4155068217u, 0, ASIN_TOLERANCE, 0}, { 525, 2798856384u, 2756570858u, 1076273685u, 3333057399u, 2798856384u, 2756570858u, 0, ASIN_TOLERANCE, 0}, { 526, 2550428645u, 1207089191u, 1092166391u, 1769908602u, 2550428645u, 1207089191u, 0, ASIN_TOLERANCE, 0}, { 527, 554295846u, 859290299u, 1041428225u, 1286082196u, 554295846u, 859290299u, 0, ASIN_TOLERANCE, 0}, { 528, 246159230u, 2207831048u, 1106576697u, 1339163028u, 246159230u, 2207831048u, 0, ASIN_TOLERANCE, 0}, { 529, 2239899566u, 1165991857u, 3203879091u, 4174125604u, 2239899566u, 1165991857u, 0, ASIN_TOLERANCE, 0}, { 530, 182461702u, 2169701868u, 3241819561u, 4227279451u, 182461702u, 2169701868u, 0, ASIN_TOLERANCE, 0}, { 531, 2888196098u, 2123622490u, 1052662593u, 2279271809u, 2888196098u, 2123622490u, 0, ASIN_TOLERANCE, 0}, { 532, 702835388u, 695374285u, 1047701002u, 522745399u, 702835388u, 695374285u, 0, ASIN_TOLERANCE, 0}, { 533, 280094216u, 1510677208u, 1076782817u, 1111322288u, 280094216u, 1510677208u, 0, ASIN_TOLERANCE, 0}, { 534, 179077993u, 2623205988u, 1103171923u, 4172761053u, 179077993u, 2623205988u, 0, ASIN_TOLERANCE, 0}, { 535, 2177736938u, 4217535562u, 1105411820u, 178360855u, 2177736938u, 4217535562u, 0, ASIN_TOLERANCE, 0}, { 536, 682463458u, 3302529767u, 3204908280u, 3960051056u, 682463458u, 3302529767u, 0, ASIN_TOLERANCE, 0}, { 537, 398729522u, 3128926115u, 3230393394u, 689920399u, 398729522u, 3128926115u, 0, ASIN_TOLERANCE, 0}, { 538, 2611898873u, 2975884353u, 1080874032u, 706326922u, 2611898873u, 2975884353u, 0, ASIN_TOLERANCE, 0}, { 539, 893776139u, 198291836u, 1095644375u, 1686271744u, 893776139u, 198291836u, 0, ASIN_TOLERANCE, 0}, { 540, 2380685920u, 3678973777u, 3196054178u, 2497695971u, 2380685920u, 3678973777u, 0, ASIN_TOLERANCE, 0}, { 541, 2240996065u, 3714083293u, 3243953714u, 2851269113u, 2240996065u, 3714083293u, 0, ASIN_TOLERANCE, 0}, { 542, 7542429u, 2117586075u, 1087270529u, 1032855763u, 7542429u, 2117586075u, 0, ASIN_TOLERANCE, 0}, { 543, 2223653732u, 3495001046u, 1086693149u, 4162905644u, 2223653732u, 3495001046u, 0, ASIN_TOLERANCE, 0}, { 544, 2567370325u, 2825204949u, 3197807718u, 3067810875u, 2567370325u, 2825204949u, 0, ASIN_TOLERANCE, 0}, { 545, 2595670946u, 3719019697u, 1095625346u, 658578931u, 2595670946u, 3719019697u, 0, ASIN_TOLERANCE, 0}, { 546, 387363057u, 2429869396u, 3239113006u, 3188949762u, 387363057u, 2429869396u, 0, ASIN_TOLERANCE, 0}, { 547, 396063874u, 322135328u, 3248332291u, 1527590526u, 396063874u, 322135328u, 0, ASIN_TOLERANCE, 0}, { 548, 2461424020u, 2823164069u, 3201760069u, 602345917u, 2461424020u, 2823164069u, 0, ASIN_TOLERANCE, 0}, { 549, 654769735u, 720378027u, 1076110022u, 259686655u, 654769735u, 720378027u, 0, ASIN_TOLERANCE, 0}, { 550, 2360883068u, 625961575u, 1060816217u, 2476435835u, 2360883068u, 625961575u, 0, ASIN_TOLERANCE, 0}, { 551, 788830837u, 606139429u, 3232916885u, 3326100828u, 788830837u, 606139429u, 0, ASIN_TOLERANCE, 0}, { 552, 3212982376u, 2141060868u, 1067726443u, 252856858u, 3212982392u, 1078759082u, 0, ASIN_TOLERANCE, 0}, { 553, 3127084040u, 474202816u, 1089644854u, 1764399210u, 3127084040u, 474202816u, 0, ASIN_TOLERANCE, 0}, { 554, 1019198392u, 2947116437u, 1041572001u, 3959708969u, 1019198392u, 2947116437u, 0, ASIN_TOLERANCE, 0}, { 555, 3213251752u, 4230614930u, 1056210276u, 3150822221u, 3213251781u, 4230967581u, 0, ASIN_TOLERANCE, 0}, { 556, 696157297u, 3263173528u, 1080112083u, 1228319033u, 696157297u, 3263173528u, 0, ASIN_TOLERANCE, 0}, { 557, 124362722u, 500312015u, 1063102682u, 2095470952u, 124362722u, 500312015u, 0, ASIN_TOLERANCE, 0}, { 558, 2571317678u, 989529088u, 1056203473u, 3527737002u, 2571317678u, 989529088u, 0, ASIN_TOLERANCE, 0}, { 559, 2250338535u, 1703579132u, 3224570219u, 634351649u, 2250338535u, 1703579132u, 0, ASIN_TOLERANCE, 0}, { 560, 2855421441u, 66133u, 3240749422u, 3515147331u, 2855421441u, 66133u, 0, ASIN_TOLERANCE, 0}, { 561, 2627889255u, 2627336059u, 1089793281u, 1944911728u, 2627889255u, 2627336059u, 0, ASIN_TOLERANCE, 0}, { 562, 759942356u, 2319970119u, 3249679385u, 445677602u, 759942356u, 2319970119u, 0, ASIN_TOLERANCE, 0}, { 563, 2547610355u, 3313890389u, 1096842854u, 754196284u, 2547610355u, 3313890389u, 0, ASIN_TOLERANCE, 0}, { 564, 2871033704u, 1726998596u, 3210485282u, 4166556675u, 2871033704u, 1726998596u, 0, ASIN_TOLERANCE, 0}, { 565, 501872914u, 486863841u, 3218994498u, 2509132460u, 501872914u, 486863841u, 0, ASIN_TOLERANCE, 0}, { 566, 1002164234u, 2205707903u, 1085826634u, 3041478081u, 1002164234u, 2205707903u, 0, ASIN_TOLERANCE, 0}, { 567, 525633549u, 4009409345u, 1040942443u, 2147611409u, 525633549u, 4009409345u, 0, ASIN_TOLERANCE, 0}, { 568, 2251207280u, 2036870072u, 1084696514u, 3107506430u, 2251207280u, 2036870072u, 0, ASIN_TOLERANCE, 0}, { 569, 756690877u, 690866455u, 3226560542u, 2431563109u, 756690877u, 690866455u, 0, ASIN_TOLERANCE, 0}, { 570, 998557361u, 3129862588u, 3198582472u, 2304023232u, 998557361u, 3129862588u, 0, ASIN_TOLERANCE, 0}, { 571, 2906016865u, 3579751536u, 3209420505u, 975391569u, 2906016865u, 3579751536u, 0, ASIN_TOLERANCE, 0}, { 572, 2560287784u, 546279008u, 1081489128u, 2489420520u, 2560287784u, 546279008u, 0, ASIN_TOLERANCE, 0}, { 573, 31598644u, 3355765111u, 3194253290u, 994990765u, 31598644u, 3355765111u, 0, ASIN_TOLERANCE, 0}, { 574, 2828168124u, 1040855381u, 1043794244u, 3259056345u, 2828168124u, 1040855381u, 0, ASIN_TOLERANCE, 0}, { 575, 2926398160u, 3002823940u, 1089005277u, 3148403594u, 2926398160u, 3002823940u, 0, ASIN_TOLERANCE, 0}, { 576, 860472364u, 4135775260u, 1062496213u, 1421204191u, 860472364u, 4135775260u, 0, ASIN_TOLERANCE, 0}, { 577, 2375372972u, 1772673503u, 1068413298u, 3250253780u, 2375372972u, 1772673503u, 0, ASIN_TOLERANCE, 0}, { 578, 2382680286u, 1058735200u, 3198812726u, 2912456147u, 2382680286u, 1058735200u, 0, ASIN_TOLERANCE, 0}, { 579, 207257772u, 3116809444u, 3228961207u, 1489607764u, 207257772u, 3116809444u, 0, ASIN_TOLERANCE, 0}, { 580, 3161255502u, 3193356522u, 1098081503u, 3349879051u, 3161255502u, 3193356522u, 0, ASIN_TOLERANCE, 0}, { 581, 2263814703u, 3863515794u, 3224248078u, 811645039u, 2263814703u, 3863515794u, 0, ASIN_TOLERANCE, 0}, { 582, 2558000392u, 257027843u, 3188376713u, 3688710472u, 2558000392u, 257027843u, 0, ASIN_TOLERANCE, 0}, { 583, 1047583344u, 1618589681u, 3252953815u, 1796441468u, 1047583344u, 1618589684u, 0, ASIN_TOLERANCE, 0}, { 584, 963715447u, 2772711004u, 1068817762u, 1417472413u, 963715447u, 2772711004u, 0, ASIN_TOLERANCE, 0}, { 585, 2899022012u, 3229431619u, 1048945392u, 2667359336u, 2899022012u, 3229431619u, 0, ASIN_TOLERANCE, 0}, { 586, 39332833u, 3031365654u, 3254047221u, 3088152449u, 39332833u, 3031365654u, 0, ASIN_TOLERANCE, 0}, { 587, 2400099045u, 1889351944u, 1105391374u, 3778764776u, 2400099045u, 1889351944u, 0, ASIN_TOLERANCE, 0}, { 588, 2853164987u, 2277852166u, 3203738947u, 1874699830u, 2853164987u, 2277852166u, 0, ASIN_TOLERANCE, 0}, { 589, 2730925178u, 341842475u, 1075005257u, 146768835u, 2730925178u, 341842475u, 0, ASIN_TOLERANCE, 0}, { 590, 2308700527u, 2872887668u, 1084601028u, 2879218577u, 2308700527u, 2872887668u, 0, ASIN_TOLERANCE, 0}, { 591, 2587566446u, 1935797167u, 1071669036u, 2712989912u, 2587566446u, 1935797167u, 0, ASIN_TOLERANCE, 0}, { 592, 253790896u, 1441615044u, 1092569414u, 3235243477u, 253790896u, 1441615044u, 0, ASIN_TOLERANCE, 0}, { 593, 2246162369u, 3221475559u, 1076923264u, 1614189331u, 2246162369u, 3221475559u, 0, ASIN_TOLERANCE, 0}, { 594, 883591469u, 1521698692u, 1063187098u, 2905773788u, 883591469u, 1521698692u, 0, ASIN_TOLERANCE, 0}, { 595, 578813437u, 1875339612u, 1097776841u, 3512997257u, 578813437u, 1875339612u, 0, ASIN_TOLERANCE, 0}, { 596, 313284539u, 1310991474u, 1042232933u, 315006632u, 313284539u, 1310991474u, 0, ASIN_TOLERANCE, 0}, { 597, 2187872770u, 400944269u, 1084139528u, 1113187101u, 2187872770u, 400944269u, 0, ASIN_TOLERANCE, 0}, { 598, 2196755783u, 4228884820u, 1086244087u, 4239134992u, 2196755783u, 4228884820u, 0, ASIN_TOLERANCE, 0}, { 599, 625667119u, 3885190346u, 1076394312u, 1081883031u, 625667119u, 3885190346u, 0, ASIN_TOLERANCE, 0}, { 600, 102978620u, 1185360438u, 1047721048u, 3255616886u, 102978620u, 1185360438u, 0, ASIN_TOLERANCE, 0}, { 601, 253870868u, 3242646057u, 3206743917u, 2797651324u, 253870868u, 3242646057u, 0, ASIN_TOLERANCE, 0}, { 602, 2741016991u, 2374818327u, 3200069106u, 409774909u, 2741016991u, 2374818327u, 0, ASIN_TOLERANCE, 0}, { 603, 541948600u, 129626762u, 3222418776u, 3265842151u, 541948600u, 129626762u, 0, ASIN_TOLERANCE, 0}, { 604, 409023275u, 2563211098u, 3195891786u, 3312029907u, 409023275u, 2563211098u, 0, ASIN_TOLERANCE, 0}, { 605, 590108432u, 2326742435u, 1061528026u, 3658027611u, 590108432u, 2326742435u, 0, ASIN_TOLERANCE, 0}, { 606, 47946496u, 4130434851u, 1086613209u, 1406937614u, 47946496u, 4130434851u, 0, ASIN_TOLERANCE, 0}, { 607, 2203282384u, 694337229u, 1098392210u, 673996985u, 2203282384u, 694337229u, 0, ASIN_TOLERANCE, 0}, { 608, 383120483u, 2165782899u, 3201118320u, 755437166u, 383120483u, 2165782899u, 0, ASIN_TOLERANCE, 0}, { 609, 2738514249u, 1631447464u, 1073129346u, 1109813769u, 2738514249u, 1631447464u, 0, ASIN_TOLERANCE, 0}, { 610, 996195808u, 1404490212u, 3191965790u, 388374829u, 996195808u, 1404490212u, 0, ASIN_TOLERANCE, 0}, { 611, 621407424u, 1187403069u, 3249235911u, 2333348025u, 621407424u, 1187403069u, 0, ASIN_TOLERANCE, 0}, { 612, 2238876819u, 3949359805u, 3217090542u, 278931643u, 2238876819u, 3949359805u, 0, ASIN_TOLERANCE, 0}, { 613, 122205568u, 3433131795u, 3216075884u, 1048643019u, 122205568u, 3433131795u, 0, ASIN_TOLERANCE, 0}, { 614, 378630966u, 2161249988u, 1080050285u, 1886767872u, 378630966u, 2161249988u, 0, ASIN_TOLERANCE, 0}, { 615, 2469519430u, 56508471u, 1101093005u, 3134765996u, 2469519430u, 56508471u, 0, ASIN_TOLERANCE, 0}, { 616, 2160574759u, 390814486u, 3252597757u, 4155481783u, 2160574759u, 390814486u, 0, ASIN_TOLERANCE, 0}, { 617, 244834788u, 2634623473u, 1106605935u, 3462407026u, 244834788u, 2634623473u, 0, ASIN_TOLERANCE, 0}, { 618, 3068667858u, 1081553801u, 3212510682u, 3597193645u, 3068667858u, 1081553801u, 0, ASIN_TOLERANCE, 0}, { 619, 2681145113u, 2712139310u, 1067397110u, 3991830201u, 2681145113u, 2712139310u, 0, ASIN_TOLERANCE, 0}, { 620, 2469611210u, 1021245839u, 1043439185u, 1476242017u, 2469611210u, 1021245839u, 0, ASIN_TOLERANCE, 0}, { 621, 605118806u, 3027425274u, 1057959382u, 1693579371u, 605118806u, 3027425274u, 0, ASIN_TOLERANCE, 0}, { 622, 723258643u, 890268116u, 3208358957u, 2499328701u, 723258643u, 890268116u, 0, ASIN_TOLERANCE, 0}, { 623, 3012075542u, 2762939960u, 1094140192u, 1946947338u, 3012075542u, 2762939960u, 0, ASIN_TOLERANCE, 0}, { 624, 2624504981u, 2848774892u, 1043728239u, 1868742480u, 2624504981u, 2848774892u, 0, ASIN_TOLERANCE, 0}, { 625, 631395565u, 2118639219u, 3208384560u, 392586300u, 631395565u, 2118639219u, 0, ASIN_TOLERANCE, 0}, { 626, 3100564519u, 3212404590u, 3227625019u, 2217276325u, 3100564519u, 3212404590u, 0, ASIN_TOLERANCE, 0}, { 627, 2726525578u, 3155371392u, 1098886483u, 418306480u, 2726525578u, 3155371392u, 0, ASIN_TOLERANCE, 0}, { 628, 404732165u, 2073105109u, 3222252812u, 4126276047u, 404732165u, 2073105109u, 0, ASIN_TOLERANCE, 0}, { 629, 666104043u, 3942715706u, 3225850891u, 2149087853u, 666104043u, 3942715706u, 0, ASIN_TOLERANCE, 0}, { 630, 691861022u, 2516919494u, 1054814504u, 3292931762u, 691861022u, 2516919494u, 0, ASIN_TOLERANCE, 0}, { 631, 158110000u, 1551415022u, 3207905213u, 640268289u, 158110000u, 1551415022u, 0, ASIN_TOLERANCE, 0}, { 632, 3017186687u, 576149615u, 1089986684u, 1988363455u, 3017186687u, 576149615u, 0, ASIN_TOLERANCE, 0}, { 633, 2189052396u, 3827250147u, 1092018604u, 3082769758u, 2189052396u, 3827250147u, 0, ASIN_TOLERANCE, 0}, { 634, 2963530013u, 2640124381u, 3224863391u, 3684597672u, 2963530013u, 2640124381u, 0, ASIN_TOLERANCE, 0}, { 635, 2674433095u, 3504206450u, 3208001954u, 1486636350u, 2674433095u, 3504206450u, 0, ASIN_TOLERANCE, 0}, { 636, 172271302u, 3087550224u, 1050189716u, 1104066383u, 172271302u, 3087550224u, 0, ASIN_TOLERANCE, 0}, { 637, 2937291508u, 3152457596u, 3248116497u, 1671039260u, 2937291508u, 3152457596u, 0, ASIN_TOLERANCE, 0}, { 638, 743510680u, 3745833360u, 1104273854u, 220649566u, 743510680u, 3745833360u, 0, ASIN_TOLERANCE, 0}, { 639, 455612679u, 3044998553u, 3244012440u, 3016971473u, 455612679u, 3044998553u, 0, ASIN_TOLERANCE, 0}, { 640, 2707727413u, 3615317113u, 1060844794u, 880769846u, 2707727413u, 3615317113u, 0, ASIN_TOLERANCE, 0}, { 641, 91972307u, 663715669u, 1063876456u, 1939925527u, 91972307u, 663715669u, 0, ASIN_TOLERANCE, 0}, { 642, 1031258381u, 3544355485u, 1082114513u, 2610512411u, 1031258381u, 3544355485u, 0, ASIN_TOLERANCE, 0}, { 643, 3062260532u, 4072884955u, 1076396408u, 1001273000u, 3062260532u, 4072884955u, 0, ASIN_TOLERANCE, 0}, { 644, 169240433u, 1808609104u, 3232187528u, 3260138616u, 169240433u, 1808609104u, 0, ASIN_TOLERANCE, 0}, { 645, 982018300u, 1018873491u, 3222306114u, 3725685935u, 982018300u, 1018873491u, 0, ASIN_TOLERANCE, 0}, { 646, 601770903u, 200987283u, 1044223733u, 3512285706u, 601770903u, 200987283u, 0, ASIN_TOLERANCE, 0}, { 647, 2542854589u, 4073670723u, 1077133533u, 2092229545u, 2542854589u, 4073670723u, 0, ASIN_TOLERANCE, 0}, { 648, 2434772723u, 1045739827u, 1099698978u, 2401260358u, 2434772723u, 1045739827u, 0, ASIN_TOLERANCE, 0}, { 649, 513980741u, 4127547980u, 1041823582u, 96012619u, 513980741u, 4127547980u, 0, ASIN_TOLERANCE, 0}, { 650, 2244412580u, 685986273u, 3236054528u, 743504842u, 2244412580u, 685986273u, 0, ASIN_TOLERANCE, 0}, { 651, 3152410687u, 3762173332u, 3229804761u, 4257281451u, 3152410687u, 3762173332u, 0, ASIN_TOLERANCE, 0}, { 652, 2398221552u, 883225705u, 1052657715u, 3748197546u, 2398221552u, 883225705u, 0, ASIN_TOLERANCE, 0}, { 653, 2914372880u, 1745689276u, 3189483003u, 3144701638u, 2914372880u, 1745689276u, 0, ASIN_TOLERANCE, 0}, { 654, 584466975u, 1188703132u, 3241765574u, 2567092606u, 584466975u, 1188703132u, 0, ASIN_TOLERANCE, 0}, { 655, 3142928545u, 1507281554u, 1093182670u, 3093165197u, 3142928545u, 1507281554u, 0, ASIN_TOLERANCE, 0}, { 656, 525538133u, 2853215019u, 1102960933u, 4219424176u, 525538133u, 2853215019u, 0, ASIN_TOLERANCE, 0}, { 657, 743378254u, 3350157882u, 3218026125u, 3380902958u, 743378254u, 3350157882u, 0, ASIN_TOLERANCE, 0}, { 658, 2920865644u, 3965656635u, 1041729367u, 1488955390u, 2920865644u, 3965656635u, 0, ASIN_TOLERANCE, 0}, { 659, 76342162u, 4066317764u, 3250193636u, 3709306303u, 76342162u, 4066317764u, 0, ASIN_TOLERANCE, 0}, { 660, 778187300u, 3648159195u, 1060671775u, 4137599200u, 778187300u, 3648159195u, 0, ASIN_TOLERANCE, 0}, { 661, 298140314u, 1730811304u, 3218425255u, 3228251203u, 298140314u, 1730811304u, 0, ASIN_TOLERANCE, 0}, { 662, 548008019u, 1112642402u, 1046926075u, 2339033206u, 548008019u, 1112642402u, 0, ASIN_TOLERANCE, 0}, { 663, 373953465u, 3920135590u, 1068578082u, 3455242298u, 373953465u, 3920135590u, 0, ASIN_TOLERANCE, 0}, { 664, 466000998u, 171021716u, 1104170032u, 643991456u, 466000998u, 171021716u, 0, ASIN_TOLERANCE, 0}, { 665, 2888399469u, 2072550721u, 3230599505u, 973021091u, 2888399469u, 2072550721u, 0, ASIN_TOLERANCE, 0}, { 666, 50905317u, 2724027649u, 1085564300u, 4142466137u, 50905317u, 2724027649u, 0, ASIN_TOLERANCE, 0}, { 667, 143727064u, 2551822580u, 3246069024u, 1987298072u, 143727064u, 2551822580u, 0, ASIN_TOLERANCE, 0}, { 668, 890335217u, 3397840241u, 3222713245u, 1041924997u, 890335217u, 3397840241u, 0, ASIN_TOLERANCE, 0}, { 669, 2679007644u, 1492572480u, 1050371810u, 2325437597u, 2679007644u, 1492572480u, 0, ASIN_TOLERANCE, 0}, { 670, 114124970u, 2135762681u, 3203689878u, 3625230590u, 114124970u, 2135762681u, 0, ASIN_TOLERANCE, 0}, { 671, 2580021722u, 3462823473u, 1042304476u, 902729486u, 2580021722u, 3462823473u, 0, ASIN_TOLERANCE, 0}, { 672, 2558456833u, 652173352u, 1093628675u, 363109783u, 2558456833u, 652173352u, 0, ASIN_TOLERANCE, 0}, { 673, 2931846653u, 3131010476u, 3195084967u, 2163853087u, 2931846653u, 3131010476u, 0, ASIN_TOLERANCE, 0}, { 674, 2860857242u, 2962422808u, 3191806742u, 291534500u, 2860857242u, 2962422808u, 0, ASIN_TOLERANCE, 0}, { 675, 3180910087u, 148717545u, 3227570855u, 1176638793u, 3180910087u, 148717545u, 0, ASIN_TOLERANCE, 0}, { 676, 846507519u, 592218494u, 3236967859u, 3643659929u, 846507519u, 592218494u, 0, ASIN_TOLERANCE, 0}, { 677, 799992724u, 3637018510u, 1096065187u, 2759677467u, 799992724u, 3637018510u, 0, ASIN_TOLERANCE, 0}, { 678, 2669496048u, 1394154169u, 3225515010u, 2895919661u, 2669496048u, 1394154169u, 0, ASIN_TOLERANCE, 0}, { 679, 2888699650u, 2576460670u, 3195138207u, 278693366u, 2888699650u, 2576460670u, 0, ASIN_TOLERANCE, 0}, { 680, 2397030301u, 3525993125u, 1046206559u, 960482701u, 2397030301u, 3525993125u, 0, ASIN_TOLERANCE, 0}, { 681, 566728356u, 3623493345u, 3245957327u, 2358092842u, 566728356u, 3623493345u, 0, ASIN_TOLERANCE, 0}, { 682, 2920406944u, 1470157513u, 1068598730u, 2360266862u, 2920406944u, 1470157513u, 0, ASIN_TOLERANCE, 0}, { 683, 287105933u, 2673272949u, 3190126532u, 3307152371u, 287105933u, 2673272949u, 0, ASIN_TOLERANCE, 0}, { 684, 2190509100u, 3554040933u, 3243091661u, 1074231128u, 2190509100u, 3554040933u, 0, ASIN_TOLERANCE, 0}, { 685, 2949859096u, 506000682u, 1099596445u, 3719284608u, 2949859096u, 506000682u, 0, ASIN_TOLERANCE, 0}, { 686, 143293603u, 1500851201u, 1079029789u, 395506977u, 143293603u, 1500851201u, 0, ASIN_TOLERANCE, 0}, { 687, 2216398316u, 2396922893u, 3215773801u, 3631674284u, 2216398316u, 2396922893u, 0, ASIN_TOLERANCE, 0}, { 688, 94791165u, 265423085u, 1064366729u, 2757995135u, 94791165u, 265423085u, 0, ASIN_TOLERANCE, 0}, { 689, 2260683291u, 3335726874u, 3204388695u, 1913160810u, 2260683291u, 3335726874u, 0, ASIN_TOLERANCE, 0}, { 690, 985593981u, 177525642u, 1089544219u, 1163479070u, 985593981u, 177525642u, 0, ASIN_TOLERANCE, 0}, { 691, 1059251204u, 1356562406u, 3218720719u, 3954981400u, 1059251204u, 1374970644u, 0, ASIN_TOLERANCE, 0}, { 692, 199560954u, 2411049585u, 3200282058u, 4212977532u, 199560954u, 2411049585u, 0, ASIN_TOLERANCE, 0}, { 693, 3115392997u, 1969400668u, 1082838033u, 792484989u, 3115392997u, 1969400668u, 0, ASIN_TOLERANCE, 0}, { 694, 413791550u, 3185069889u, 1102744820u, 1679200952u, 413791550u, 3185069889u, 0, ASIN_TOLERANCE, 0}, { 695, 816641623u, 2092563199u, 1077400892u, 3625477257u, 816641623u, 2092563199u, 0, ASIN_TOLERANCE, 0}, { 696, 990732070u, 3645477920u, 3233940628u, 730323504u, 990732070u, 3645477920u, 0, ASIN_TOLERANCE, 0}, { 697, 2640158643u, 1955024619u, 3229376333u, 3062236193u, 2640158643u, 1955024619u, 0, ASIN_TOLERANCE, 0}, { 698, 748924276u, 673553144u, 3222681322u, 3821101717u, 748924276u, 673553144u, 0, ASIN_TOLERANCE, 0}, { 699, 872312580u, 2833907590u, 1087265939u, 2570284543u, 872312580u, 2833907590u, 0, ASIN_TOLERANCE, 0}, { 700, 531712086u, 2911302424u, 1088378861u, 3400401866u, 531712086u, 2911302424u, 0, ASIN_TOLERANCE, 0}, { 701, 541730201u, 552676385u, 1048022712u, 1642148205u, 541730201u, 552676385u, 0, ASIN_TOLERANCE, 0}, { 702, 323876482u, 3259465719u, 1063427827u, 4168942284u, 323876482u, 3259465719u, 0, ASIN_TOLERANCE, 0}, { 703, 2757624524u, 757177023u, 3224829944u, 54374532u, 2757624524u, 757177023u, 0, ASIN_TOLERANCE, 0}, { 704, 25847614u, 3253287925u, 3239197056u, 3859570507u, 25847614u, 3253287925u, 0, ASIN_TOLERANCE, 0}, { 705, 2460961478u, 3154974007u, 1089011136u, 3913013165u, 2460961478u, 3154974007u, 0, ASIN_TOLERANCE, 0}, { 706, 311234957u, 2785357403u, 1103967007u, 2809598610u, 311234957u, 2785357403u, 0, ASIN_TOLERANCE, 0}, { 707, 484603275u, 3644503084u, 1071705136u, 2739219317u, 484603275u, 3644503084u, 0, ASIN_TOLERANCE, 0}, { 708, 2578002590u, 3518663743u, 1085926548u, 3708967464u, 2578002590u, 3518663743u, 0, ASIN_TOLERANCE, 0}, { 709, 3007242152u, 731479478u, 1076236288u, 2805941787u, 3007242152u, 731479478u, 0, ASIN_TOLERANCE, 0}, { 710, 2619048947u, 779131141u, 3197589176u, 237706897u, 2619048947u, 779131141u, 0, ASIN_TOLERANCE, 0}, { 711, 2641650858u, 2888131473u, 3245067887u, 2007039966u, 2641650858u, 2888131473u, 0, ASIN_TOLERANCE, 0}, { 712, 878934658u, 2219795442u, 1097959451u, 920385234u, 878934658u, 2219795442u, 0, ASIN_TOLERANCE, 0}, { 713, 970070259u, 1786246284u, 3210593296u, 3141517655u, 970070259u, 1786246284u, 0, ASIN_TOLERANCE, 0}, { 714, 28474706u, 1268866168u, 1056332378u, 3807437549u, 28474706u, 1268866168u, 0, ASIN_TOLERANCE, 0}, { 715, 593283356u, 2441697849u, 1095257734u, 352511160u, 593283356u, 2441697849u, 0, ASIN_TOLERANCE, 0}, { 716, 537273837u, 3291810518u, 1078085447u, 381074875u, 537273837u, 3291810518u, 0, ASIN_TOLERANCE, 0}, { 717, 466362499u, 387817055u, 3243585398u, 409681933u, 466362499u, 387817055u, 0, ASIN_TOLERANCE, 0}, { 718, 337512666u, 139599181u, 1104463616u, 3501253426u, 337512666u, 139599181u, 0, ASIN_TOLERANCE, 0}, { 719, 152302801u, 1804177501u, 1107025740u, 30866148u, 152302801u, 1804177501u, 0, ASIN_TOLERANCE, 0}, { 720, 2982215560u, 793748989u, 1082924614u, 1001569450u, 2982215560u, 793748989u, 0, ASIN_TOLERANCE, 0}, { 721, 3089760601u, 959143764u, 1058620462u, 2685722619u, 3089760601u, 959143764u, 0, ASIN_TOLERANCE, 0}, { 722, 2594786226u, 1587148467u, 1069298743u, 2465926195u, 2594786226u, 1587148467u, 0, ASIN_TOLERANCE, 0}, { 723, 932092665u, 2374376082u, 1041131964u, 1275798358u, 932092665u, 2374376082u, 0, ASIN_TOLERANCE, 0}, { 724, 3064898943u, 732591095u, 1105513168u, 188500721u, 3064898943u, 732591095u, 0, ASIN_TOLERANCE, 0}, { 725, 833576046u, 2203077164u, 1086779764u, 2814822707u, 833576046u, 2203077164u, 0, ASIN_TOLERANCE, 0}, { 726, 414881598u, 3478844638u, 1064472491u, 3289144186u, 414881598u, 3478844638u, 0, ASIN_TOLERANCE, 0}, { 727, 964227992u, 2435698269u, 3249016304u, 440309030u, 964227992u, 2435698269u, 0, ASIN_TOLERANCE, 0}, { 728, 2567296069u, 3788040806u, 3187722224u, 3342255097u, 2567296069u, 3788040806u, 0, ASIN_TOLERANCE, 0}, { 729, 723295838u, 2455751020u, 1103514973u, 3245053142u, 723295838u, 2455751020u, 0, ASIN_TOLERANCE, 0}, { 730, 844693850u, 4056651767u, 3239516201u, 4169582895u, 844693850u, 4056651767u, 0, ASIN_TOLERANCE, 0}, { 731, 550385160u, 2093642662u, 1100623425u, 792491672u, 550385160u, 2093642662u, 0, ASIN_TOLERANCE, 0}, { 732, 2816313046u, 83889365u, 1087600688u, 1006331335u, 2816313046u, 83889365u, 0, ASIN_TOLERANCE, 0}, { 733, 2572367713u, 1140517802u, 3243890765u, 4090711271u, 2572367713u, 1140517802u, 0, ASIN_TOLERANCE, 0}, { 734, 666576601u, 2418701513u, 3216964687u, 1555649649u, 666576601u, 2418701513u, 0, ASIN_TOLERANCE, 0}, { 735, 2251046969u, 1215163489u, 1051353113u, 3503287900u, 2251046969u, 1215163489u, 0, ASIN_TOLERANCE, 0}, { 736, 3159618610u, 641457589u, 1051716814u, 4121125128u, 3159618610u, 641457589u, 0, ASIN_TOLERANCE, 0}, { 737, 401932052u, 321857207u, 3250350790u, 1246006125u, 401932052u, 321857207u, 0, ASIN_TOLERANCE, 0}, { 738, 2953696013u, 120564990u, 1097266968u, 300149226u, 2953696013u, 120564990u, 0, ASIN_TOLERANCE, 0}, { 739, 2254220803u, 3244980052u, 1076924215u, 847775621u, 2254220803u, 3244980052u, 0, ASIN_TOLERANCE, 0}, { 740, 2771951028u, 112839452u, 3212858842u, 1569943525u, 2771951028u, 112839452u, 0, ASIN_TOLERANCE, 0}, { 741, 2165404842u, 2934678057u, 3212657738u, 3091042797u, 2165404842u, 2934678057u, 0, ASIN_TOLERANCE, 0}, { 742, 2704093164u, 547060795u, 1079752403u, 4043827022u, 2704093164u, 547060795u, 0, ASIN_TOLERANCE, 0}, { 743, 244578012u, 1790462845u, 1067969586u, 2345441039u, 244578012u, 1790462845u, 0, ASIN_TOLERANCE, 0}, { 744, 2182959566u, 2353653565u, 1049624664u, 882286568u, 2182959566u, 2353653565u, 0, ASIN_TOLERANCE, 0}, { 745, 462586144u, 1186302263u, 1078662178u, 2626148789u, 462586144u, 1186302263u, 0, ASIN_TOLERANCE, 0}, { 746, 279527707u, 4121656076u, 3224287260u, 1299277508u, 279527707u, 4121656076u, 0, ASIN_TOLERANCE, 0}, { 747, 470047975u, 2010385858u, 3233120941u, 4186702461u, 470047975u, 2010385858u, 0, ASIN_TOLERANCE, 0}, { 748, 2221693080u, 1323708810u, 3211281520u, 1640799315u, 2221693080u, 1323708810u, 0, ASIN_TOLERANCE, 0}, { 749, 3124323904u, 3503897938u, 3210262651u, 258643165u, 3124323904u, 3503897938u, 0, ASIN_TOLERANCE, 0}, { 750, 2619485313u, 2959074653u, 1058897059u, 4239182527u, 2619485313u, 2959074653u, 0, ASIN_TOLERANCE, 0}, { 751, 302551175u, 153547307u, 1099812861u, 3156123094u, 302551175u, 153547307u, 0, ASIN_TOLERANCE, 0}, { 752, 420210788u, 3996883503u, 1071341265u, 72657681u, 420210788u, 3996883503u, 0, ASIN_TOLERANCE, 0}, { 753, 158488136u, 1698212750u, 1068334402u, 160302703u, 158488136u, 1698212750u, 0, ASIN_TOLERANCE, 0}, { 754, 289138234u, 2257686389u, 1051856116u, 430357614u, 289138234u, 2257686389u, 0, ASIN_TOLERANCE, 0}, { 755, 2795510903u, 395145384u, 1046317717u, 1912800227u, 2795510903u, 395145384u, 0, ASIN_TOLERANCE, 0}, { 756, 935515004u, 674021561u, 3222496667u, 743247292u, 935515004u, 674021561u, 0, ASIN_TOLERANCE, 0}, { 757, 2822969173u, 1075007837u, 3222487779u, 639284837u, 2822969173u, 1075007837u, 0, ASIN_TOLERANCE, 0}, { 758, 924678051u, 3492386324u, 3251519349u, 1241408247u, 924678051u, 3492386324u, 0, ASIN_TOLERANCE, 0}, { 759, 2881777125u, 3998363272u, 3228147294u, 365769855u, 2881777125u, 3998363272u, 0, ASIN_TOLERANCE, 0}, { 760, 2662939411u, 4030509561u, 1066028735u, 1163947030u, 2662939411u, 4030509561u, 0, ASIN_TOLERANCE, 0}, { 761, 564717585u, 1914428658u, 3214617694u, 4147847493u, 564717585u, 1914428658u, 0, ASIN_TOLERANCE, 0}, { 762, 993107584u, 2889684117u, 1042972779u, 1225674604u, 993107584u, 2889684117u, 0, ASIN_TOLERANCE, 0}, { 763, 750290683u, 273406410u, 3206108502u, 145234164u, 750290683u, 273406410u, 0, ASIN_TOLERANCE, 0}, { 764, 3157290800u, 912384201u, 3237262916u, 3366320623u, 3157290800u, 912384201u, 0, ASIN_TOLERANCE, 0}, { 765, 3022814103u, 349339167u, 3197347448u, 3262060258u, 3022814103u, 349339167u, 0, ASIN_TOLERANCE, 0}, { 766, 393652178u, 2097272974u, 1064845294u, 1630215394u, 393652178u, 2097272974u, 0, ASIN_TOLERANCE, 0}, { 767, 2250994257u, 3355589350u, 3243019072u, 2316123825u, 2250994257u, 3355589350u, 0, ASIN_TOLERANCE, 0}, { 768, 307759713u, 1457407347u, 1101422760u, 4120356538u, 307759713u, 1457407347u, 0, ASIN_TOLERANCE, 0}, { 769, 2168158322u, 3228185359u, 3198251445u, 3743078041u, 2168158322u, 3228185359u, 0, ASIN_TOLERANCE, 0}, { 770, 880898735u, 1289357713u, 3230160936u, 2794962547u, 880898735u, 1289357713u, 0, ASIN_TOLERANCE, 0}, { 771, 903112316u, 1699456459u, 1083794396u, 4195811825u, 903112316u, 1699456459u, 0, ASIN_TOLERANCE, 0}, { 772, 129746399u, 1949114369u, 1084908557u, 1325384361u, 129746399u, 1949114369u, 0, ASIN_TOLERANCE, 0}, { 773, 709313868u, 3979168763u, 1049036668u, 2542947959u, 709313868u, 3979168763u, 0, ASIN_TOLERANCE, 0}, { 774, 776361251u, 676749439u, 3192662415u, 4013712036u, 776361251u, 676749439u, 0, ASIN_TOLERANCE, 0}, { 775, 255079628u, 3701636708u, 1042322101u, 3983171212u, 255079628u, 3701636708u, 0, ASIN_TOLERANCE, 0}, { 776, 2885977639u, 3830039616u, 3239465315u, 175489420u, 2885977639u, 3830039616u, 0, ASIN_TOLERANCE, 0}, { 777, 2871663155u, 2897269792u, 3230650366u, 3102389747u, 2871663155u, 2897269792u, 0, ASIN_TOLERANCE, 0}, { 778, 515647990u, 582170006u, 1068093936u, 3324264433u, 515647990u, 582170006u, 0, ASIN_TOLERANCE, 0}, { 779, 870187117u, 3574970337u, 1061955111u, 637826033u, 870187117u, 3574970337u, 0, ASIN_TOLERANCE, 0}, { 780, 2474474250u, 1733806710u, 3216760526u, 3188307974u, 2474474250u, 1733806710u, 0, ASIN_TOLERANCE, 0}, { 781, 25157138u, 2296028823u, 1096788400u, 1413568905u, 25157138u, 2296028823u, 0, ASIN_TOLERANCE, 0}, { 782, 967771954u, 1627289946u, 1046506286u, 1860326351u, 967771954u, 1627289946u, 0, ASIN_TOLERANCE, 0}, { 783, 876029804u, 1139086265u, 3242570406u, 3276908361u, 876029804u, 1139086265u, 0, ASIN_TOLERANCE, 0}, { 784, 444923881u, 3323762166u, 3206918506u, 946766885u, 444923881u, 3323762166u, 0, ASIN_TOLERANCE, 0}, { 785, 2438959626u, 188768962u, 1088324147u, 4105901663u, 2438959626u, 188768962u, 0, ASIN_TOLERANCE, 0}, { 786, 2731858209u, 460037366u, 3227174677u, 2159793181u, 2731858209u, 460037366u, 0, ASIN_TOLERANCE, 0}, { 787, 647960579u, 2589781051u, 3243737020u, 107237481u, 647960579u, 2589781051u, 0, ASIN_TOLERANCE, 0}, { 788, 342985206u, 3519881651u, 1057272132u, 2685921459u, 342985206u, 3519881651u, 0, ASIN_TOLERANCE, 0}, { 789, 620434247u, 1169160155u, 3206674485u, 3139856281u, 620434247u, 1169160155u, 0, ASIN_TOLERANCE, 0}, { 790, 1000422649u, 1898254525u, 3196770014u, 2458988443u, 1000422649u, 1898254525u, 0, ASIN_TOLERANCE, 0}, { 791, 756268268u, 2023065054u, 1050415907u, 4070768353u, 756268268u, 2023065054u, 0, ASIN_TOLERANCE, 0}, { 792, 284716157u, 3336260906u, 3237972475u, 3524355405u, 284716157u, 3336260906u, 0, ASIN_TOLERANCE, 0}, { 793, 2520138858u, 3298979042u, 3250099033u, 1003322861u, 2520138858u, 3298979042u, 0, ASIN_TOLERANCE, 0}, { 794, 780415343u, 1629423892u, 1061722650u, 2396420130u, 780415343u, 1629423892u, 0, ASIN_TOLERANCE, 0}, { 795, 2512306741u, 1945417606u, 3192839521u, 1585136212u, 2512306741u, 1945417606u, 0, ASIN_TOLERANCE, 0}, { 796, 2649414854u, 1527139640u, 1076681917u, 4150904895u, 2649414854u, 1527139640u, 0, ASIN_TOLERANCE, 0}, { 797, 315452952u, 267572666u, 1088475235u, 1517640973u, 315452952u, 267572666u, 0, ASIN_TOLERANCE, 0}, { 798, 948438656u, 1100855041u, 3229298529u, 2451533501u, 948438656u, 1100855041u, 0, ASIN_TOLERANCE, 0}, { 799, 2280476280u, 853088805u, 1050931318u, 3551516956u, 2280476280u, 853088805u, 0, ASIN_TOLERANCE, 0}, { 800, 927051214u, 1317953425u, 3217154900u, 431061758u, 927051214u, 1317953425u, 0, ASIN_TOLERANCE, 0}, { 801, 803065499u, 2317271661u, 1070436470u, 4014139535u, 803065499u, 2317271661u, 0, ASIN_TOLERANCE, 0}, { 802, 2766450812u, 3959292396u, 3249638947u, 906232948u, 2766450812u, 3959292396u, 0, ASIN_TOLERANCE, 0}, { 803, 475259033u, 1939780068u, 3253991906u, 906880052u, 475259033u, 1939780068u, 0, ASIN_TOLERANCE, 0}, { 804, 174037547u, 4170524292u, 3237763507u, 4075099457u, 174037547u, 4170524292u, 0, ASIN_TOLERANCE, 0}, { 805, 3111709674u, 3520923293u, 1067530616u, 2252399455u, 3111709674u, 3520923293u, 0, ASIN_TOLERANCE, 0}, { 806, 705974097u, 1097415680u, 1055600706u, 2690540698u, 705974097u, 1097415680u, 0, ASIN_TOLERANCE, 0}, { 807, 465450487u, 3086226264u, 3213898048u, 3220232067u, 465450487u, 3086226264u, 0, ASIN_TOLERANCE, 0}, { 808, 2906752413u, 2955360278u, 1051258339u, 557182478u, 2906752413u, 2955360278u, 0, ASIN_TOLERANCE, 0}, { 809, 2407140190u, 186287752u, 1104388811u, 1727111982u, 2407140190u, 186287752u, 0, ASIN_TOLERANCE, 0}, { 810, 3170043637u, 4057007843u, 1076281145u, 2008293104u, 3170043637u, 4057007843u, 0, ASIN_TOLERANCE, 0}, { 811, 3198834469u, 2741338484u, 3252544447u, 1207037505u, 3198834469u, 2741339245u, 0, ASIN_TOLERANCE, 0}, { 812, 625923799u, 102938901u, 3218894213u, 3620282197u, 625923799u, 102938901u, 0, ASIN_TOLERANCE, 0}, { 813, 2527426501u, 763746284u, 1060949875u, 80236875u, 2527426501u, 763746284u, 0, ASIN_TOLERANCE, 0}, { 814, 3055119358u, 1117970157u, 1084109014u, 939675744u, 3055119358u, 1117970157u, 0, ASIN_TOLERANCE, 0}, { 815, 1002709241u, 3478694019u, 1105453279u, 2493398454u, 1002709241u, 3478694019u, 0, ASIN_TOLERANCE, 0}, { 816, 278925941u, 2014323735u, 1096417600u, 1077078168u, 278925941u, 2014323735u, 0, ASIN_TOLERANCE, 0}, { 817, 22160783u, 1569149351u, 1091835152u, 3751608506u, 22160783u, 1569149351u, 0, ASIN_TOLERANCE, 0}, { 818, 2855839310u, 930375071u, 1084274438u, 1096450032u, 2855839310u, 930375071u, 0, ASIN_TOLERANCE, 0}, { 819, 949603377u, 4197396799u, 3220768028u, 3419252837u, 949603377u, 4197396799u, 0, ASIN_TOLERANCE, 0}, { 820, 2427096043u, 2553375912u, 3237078043u, 1357572894u, 2427096043u, 2553375912u, 0, ASIN_TOLERANCE, 0}, { 821, 2946808178u, 703318468u, 3198897773u, 3216391250u, 2946808178u, 703318468u, 0, ASIN_TOLERANCE, 0}, { 822, 682409255u, 3167959965u, 1069972300u, 4099039274u, 682409255u, 3167959965u, 0, ASIN_TOLERANCE, 0}, { 823, 551957760u, 1199490036u, 1047137152u, 2723130471u, 551957760u, 1199490036u, 0, ASIN_TOLERANCE, 0}, { 824, 2635855937u, 933683213u, 3243757155u, 1468458131u, 2635855937u, 933683213u, 0, ASIN_TOLERANCE, 0}, { 825, 954259401u, 763829445u, 3190480801u, 1772616584u, 954259401u, 763829445u, 0, ASIN_TOLERANCE, 0}, { 826, 1017324786u, 3416067384u, 1056206159u, 172017902u, 1017324786u, 3416067384u, 0, ASIN_TOLERANCE, 0}, { 827, 2553315334u, 2799176222u, 1099022088u, 1324575553u, 2553315334u, 2799176222u, 0, ASIN_TOLERANCE, 0}, { 828, 54501096u, 2237472662u, 3202361378u, 1770080863u, 54501096u, 2237472662u, 0, ASIN_TOLERANCE, 0}, { 829, 697886575u, 1509098263u, 3227321831u, 3313535397u, 697886575u, 1509098263u, 0, ASIN_TOLERANCE, 0}, { 830, 2834201307u, 1157206501u, 3201667023u, 2771836065u, 2834201307u, 1157206501u, 0, ASIN_TOLERANCE, 0}, { 831, 2845352423u, 841047693u, 3220229941u, 3851041620u, 2845352423u, 841047693u, 0, ASIN_TOLERANCE, 0}, { 832, 2559038255u, 1637635007u, 1096670395u, 363436727u, 2559038255u, 1637635007u, 0, ASIN_TOLERANCE, 0}, { 833, 895812927u, 544867276u, 3250055151u, 2005291812u, 895812927u, 544867276u, 0, ASIN_TOLERANCE, 0}, { 834, 613660095u, 1577788839u, 3213516258u, 3678234583u, 613660095u, 1577788839u, 0, ASIN_TOLERANCE, 0}, { 835, 2787880976u, 3005922702u, 1060624530u, 3900344258u, 2787880976u, 3005922702u, 0, ASIN_TOLERANCE, 0}, { 836, 369490497u, 4206745890u, 3212325607u, 3363748875u, 369490497u, 4206745890u, 0, ASIN_TOLERANCE, 0}, { 837, 547531448u, 2586849496u, 3195881612u, 1817038482u, 547531448u, 2586849496u, 0, ASIN_TOLERANCE, 0}, { 838, 2947779739u, 3675119568u, 3217354316u, 1280515099u, 2947779739u, 3675119568u, 0, ASIN_TOLERANCE, 0}, { 839, 2360207944u, 3785128270u, 3206980957u, 986337114u, 2360207944u, 3785128270u, 0, ASIN_TOLERANCE, 0}, { 840, 30415045u, 1959045465u, 3205100821u, 2165602568u, 30415045u, 1959045465u, 0, ASIN_TOLERANCE, 0}, { 841, 2874345345u, 4164694429u, 3228096442u, 1919088329u, 2874345345u, 4164694429u, 0, ASIN_TOLERANCE, 0}, { 842, 430207315u, 1381882442u, 3215734246u, 2587666792u, 430207315u, 1381882442u, 0, ASIN_TOLERANCE, 0}, { 843, 721933456u, 3295845115u, 1099763106u, 4189733918u, 721933456u, 3295845115u, 0, ASIN_TOLERANCE, 0}, { 844, 1020902692u, 528513718u, 3241318094u, 2446416887u, 1020902692u, 528513718u, 0, ASIN_TOLERANCE, 0}, { 845, 23459988u, 2336116589u, 1065985897u, 3314083915u, 23459988u, 2336116589u, 0, ASIN_TOLERANCE, 0}, { 846, 666699893u, 3946191348u, 3195771050u, 906783975u, 666699893u, 3946191348u, 0, ASIN_TOLERANCE, 0}, { 847, 2277669009u, 1307551746u, 3210796216u, 988905760u, 2277669009u, 1307551746u, 0, ASIN_TOLERANCE, 0}, { 848, 659686858u, 3690487540u, 1056058539u, 3252665112u, 659686858u, 3690487540u, 0, ASIN_TOLERANCE, 0}, { 849, 42479044u, 1832665932u, 1055271260u, 2605540156u, 42479044u, 1832665932u, 0, ASIN_TOLERANCE, 0}, { 850, 158726331u, 4095344603u, 3215114657u, 3444794506u, 158726331u, 4095344603u, 0, ASIN_TOLERANCE, 0}, { 851, 2383875900u, 1287837711u, 3242597773u, 4213798139u, 2383875900u, 1287837711u, 0, ASIN_TOLERANCE, 0}, { 852, 3153341967u, 2816125725u, 1059414555u, 1477859711u, 3153341967u, 2816125725u, 0, ASIN_TOLERANCE, 0}, { 853, 935772631u, 714564399u, 3193282956u, 2533012202u, 935772631u, 714564399u, 0, ASIN_TOLERANCE, 0}, { 854, 626995971u, 3592268374u, 1058283383u, 2901729097u, 626995971u, 3592268374u, 0, ASIN_TOLERANCE, 0}, { 855, 793386186u, 3559004137u, 1068514800u, 3160920849u, 793386186u, 3559004137u, 0, ASIN_TOLERANCE, 0}, { 856, 292955800u, 691190239u, 3222935981u, 1615104840u, 292955800u, 691190239u, 0, ASIN_TOLERANCE, 0}, { 857, 239139675u, 2475984769u, 1103239897u, 703637359u, 239139675u, 2475984769u, 0, ASIN_TOLERANCE, 0}, { 858, 710643921u, 441140946u, 3190536898u, 3492228424u, 710643921u, 441140946u, 0, ASIN_TOLERANCE, 0}, { 859, 161483935u, 3877369975u, 3202400099u, 3215202168u, 161483935u, 3877369975u, 0, ASIN_TOLERANCE, 0}, { 860, 2961770699u, 1491180815u, 3239294185u, 1154272588u, 2961770699u, 1491180815u, 0, ASIN_TOLERANCE, 0}, { 861, 3205774388u, 3583450204u, 1087671320u, 674510731u, 3205774388u, 3589106472u, 0, ASIN_TOLERANCE, 0}, { 862, 2732840881u, 3456820098u, 1089546472u, 2907918480u, 2732840881u, 3456820098u, 0, ASIN_TOLERANCE, 0}, { 863, 685577817u, 81928569u, 1075278180u, 1990416786u, 685577817u, 81928569u, 0, ASIN_TOLERANCE, 0}, { 864, 1038142999u, 1400620994u, 3225378967u, 1180415269u, 1038142999u, 1400620994u, 0, ASIN_TOLERANCE, 0}, { 865, 821776812u, 2762887697u, 3211549123u, 335890509u, 821776812u, 2762887697u, 0, ASIN_TOLERANCE, 0}, { 866, 3188234303u, 1362922028u, 3190091315u, 3628762502u, 3188234303u, 1362922028u, 0, ASIN_TOLERANCE, 0}, { 867, 721900432u, 3813492886u, 3202458179u, 1901070055u, 721900432u, 3813492886u, 0, ASIN_TOLERANCE, 0}, { 868, 2869411161u, 242471816u, 1098704131u, 1526904338u, 2869411161u, 242471816u, 0, ASIN_TOLERANCE, 0}, { 869, 1027232266u, 671155008u, 1093002146u, 4241764136u, 1027232266u, 671155008u, 0, ASIN_TOLERANCE, 0}, { 870, 2277521859u, 4097248738u, 1056810493u, 578681886u, 2277521859u, 4097248738u, 0, ASIN_TOLERANCE, 0}, { 871, 277897075u, 2743813242u, 1048038468u, 2228686199u, 277897075u, 2743813242u, 0, ASIN_TOLERANCE, 0}, { 872, 2669729433u, 777624847u, 3204357191u, 721009894u, 2669729433u, 777624847u, 0, ASIN_TOLERANCE, 0}, { 873, 900729335u, 724757172u, 1074804044u, 1443361721u, 900729335u, 724757172u, 0, ASIN_TOLERANCE, 0}, { 874, 2794978652u, 1829019782u, 1092425225u, 921360204u, 2794978652u, 1829019782u, 0, ASIN_TOLERANCE, 0}, { 875, 1055573469u, 599714409u, 3252379270u, 4008804686u, 1055573469u, 599919108u, 0, ASIN_TOLERANCE, 0}, { 876, 2335315701u, 1009458928u, 1083845809u, 4245287698u, 2335315701u, 1009458928u, 0, ASIN_TOLERANCE, 0}, { 877, 407962355u, 1393652229u, 3198335362u, 477976573u, 407962355u, 1393652229u, 0, ASIN_TOLERANCE, 0}, { 878, 119992u, 617334033u, 3226883256u, 1392617441u, 119992u, 617334033u, 0, ASIN_TOLERANCE, 0}, { 879, 2526781811u, 3189972160u, 1058939729u, 1442809487u, 2526781811u, 3189972160u, 0, ASIN_TOLERANCE, 0}, { 880, 2785887182u, 1497507448u, 3207820115u, 1605709634u, 2785887182u, 1497507448u, 0, ASIN_TOLERANCE, 0}, { 881, 400505812u, 1497124553u, 1056018407u, 1916183627u, 400505812u, 1497124553u, 0, ASIN_TOLERANCE, 0}, { 882, 379250418u, 187810760u, 1045258725u, 2282203450u, 379250418u, 187810760u, 0, ASIN_TOLERANCE, 0}, { 883, 619840292u, 3486351235u, 3238811394u, 4182495542u, 619840292u, 3486351235u, 0, ASIN_TOLERANCE, 0}, { 884, 2587166700u, 1845445426u, 1101440582u, 1926724082u, 2587166700u, 1845445426u, 0, ASIN_TOLERANCE, 0}, { 885, 2208479151u, 3630948001u, 3210436304u, 3757166747u, 2208479151u, 3630948001u, 0, ASIN_TOLERANCE, 0}, { 886, 156467129u, 2426945694u, 1100551290u, 691736139u, 156467129u, 2426945694u, 0, ASIN_TOLERANCE, 0}, { 887, 3176502800u, 648364171u, 1041433075u, 4184885944u, 3176502800u, 648364171u, 0, ASIN_TOLERANCE, 0}, { 888, 1000987303u, 4288583860u, 1088664697u, 2475611219u, 1000987303u, 4288583860u, 0, ASIN_TOLERANCE, 0}, { 889, 1063779408u, 1032586628u, 1093050016u, 1335820726u, 1063779410u, 2088980724u, 0, ASIN_TOLERANCE, 0}, { 890, 2203998268u, 1808427032u, 1080779860u, 3408316613u, 2203998268u, 1808427032u, 0, ASIN_TOLERANCE, 0}, { 891, 2973050448u, 377900895u, 3246382680u, 3547565419u, 2973050448u, 377900895u, 0, ASIN_TOLERANCE, 0}, { 892, 2189796743u, 2323627716u, 1059972652u, 2094048557u, 2189796743u, 2323627716u, 0, ASIN_TOLERANCE, 0}, { 893, 3196853156u, 698816446u, 3234028118u, 1825626029u, 3196853156u, 698816504u, 0, ASIN_TOLERANCE, 0}, { 894, 3053056428u, 4246800079u, 3198693322u, 1124410156u, 3053056428u, 4246800079u, 0, ASIN_TOLERANCE, 0}, { 895, 418318520u, 2453135589u, 1055899444u, 314708747u, 418318520u, 2453135589u, 0, ASIN_TOLERANCE, 0}, { 896, 2903016736u, 3296787864u, 1068197912u, 3000361169u, 2903016736u, 3296787864u, 0, ASIN_TOLERANCE, 0}, { 897, 3078102424u, 2237367418u, 1089582486u, 4042266354u, 3078102424u, 2237367418u, 0, ASIN_TOLERANCE, 0}, { 898, 3141633458u, 3484406269u, 3222793392u, 1868977643u, 3141633458u, 3484406269u, 0, ASIN_TOLERANCE, 0}, { 899, 551079618u, 3353193428u, 1046058481u, 1204175477u, 551079618u, 3353193428u, 0, ASIN_TOLERANCE, 0}, { 900, 372140985u, 2936300483u, 3219636923u, 3841711417u, 372140985u, 2936300483u, 0, ASIN_TOLERANCE, 0}, { 901, 673975119u, 1967394048u, 1058351548u, 460961975u, 673975119u, 1967394048u, 0, ASIN_TOLERANCE, 0}, { 902, 186542430u, 2037284927u, 3201399531u, 2969937827u, 186542430u, 2037284927u, 0, ASIN_TOLERANCE, 0}, { 903, 605316943u, 4193097538u, 3187909191u, 3039418420u, 605316943u, 4193097538u, 0, ASIN_TOLERANCE, 0}, { 904, 560007813u, 3490045229u, 1095745195u, 4291149159u, 560007813u, 3490045229u, 0, ASIN_TOLERANCE, 0}, { 905, 2719344253u, 2428281947u, 3244840847u, 1401325941u, 2719344253u, 2428281947u, 0, ASIN_TOLERANCE, 0}, { 906, 3086950621u, 2958762056u, 1053682542u, 1079751324u, 3086950621u, 2958762056u, 0, ASIN_TOLERANCE, 0}, { 907, 2586448231u, 4153073282u, 3242138780u, 2976596113u, 2586448231u, 4153073282u, 0, ASIN_TOLERANCE, 0}, { 908, 2225350223u, 3033242648u, 3218615502u, 4046734098u, 2225350223u, 3033242648u, 0, ASIN_TOLERANCE, 0}, { 909, 144835976u, 3784918863u, 3247369913u, 2134568674u, 144835976u, 3784918863u, 0, ASIN_TOLERANCE, 0}, { 910, 1037093430u, 2677404300u, 1085544968u, 741961444u, 1037093430u, 2677404300u, 0, ASIN_TOLERANCE, 0}, { 911, 3191671070u, 3184472282u, 1092761713u, 2878921656u, 3191671070u, 3184472282u, 0, ASIN_TOLERANCE, 0}, { 912, 2174282657u, 3434230759u, 3221702019u, 3917984952u, 2174282657u, 3434230759u, 0, ASIN_TOLERANCE, 0}, { 913, 2545165920u, 2576188896u, 3242449625u, 1091446541u, 2545165920u, 2576188896u, 0, ASIN_TOLERANCE, 0}, { 914, 331286912u, 1182911629u, 3252138078u, 370659473u, 331286912u, 1182911629u, 0, ASIN_TOLERANCE, 0}, { 915, 2176330507u, 1444733769u, 1073172315u, 1980291498u, 2176330507u, 1444733769u, 0, ASIN_TOLERANCE, 0}, { 916, 2678247043u, 2360783610u, 3208952465u, 1231254630u, 2678247043u, 2360783610u, 0, ASIN_TOLERANCE, 0}, { 917, 2305545884u, 3838689849u, 1072879962u, 256746588u, 2305545884u, 3838689849u, 0, ASIN_TOLERANCE, 0}, { 918, 2902784540u, 3667306355u, 3251214292u, 749864809u, 2902784540u, 3667306355u, 0, ASIN_TOLERANCE, 0}, { 919, 2604503669u, 507891905u, 1053625983u, 2704533753u, 2604503669u, 507891905u, 0, ASIN_TOLERANCE, 0}, { 920, 1030839861u, 3584765547u, 3245124397u, 2257447093u, 1030839861u, 3584765547u, 0, ASIN_TOLERANCE, 0}, { 921, 3066547476u, 3315149772u, 1066493112u, 1016007949u, 3066547476u, 3315149772u, 0, ASIN_TOLERANCE, 0}, { 922, 449363956u, 825363580u, 3232843486u, 209798625u, 449363956u, 825363580u, 0, ASIN_TOLERANCE, 0}, { 923, 835609236u, 3268577204u, 1096097376u, 1911303780u, 835609236u, 3268577204u, 0, ASIN_TOLERANCE, 0}, { 924, 2498038993u, 1753975943u, 1042812372u, 3813343580u, 2498038993u, 1753975943u, 0, ASIN_TOLERANCE, 0}, { 925, 2711382061u, 729612230u, 3214799337u, 998858159u, 2711382061u, 729612230u, 0, ASIN_TOLERANCE, 0}, { 926, 362629194u, 436029885u, 1040410334u, 1429955158u, 362629194u, 436029885u, 0, ASIN_TOLERANCE, 0}, { 927, 535596587u, 3221540113u, 1098769124u, 1388898057u, 535596587u, 3221540113u, 0, ASIN_TOLERANCE, 0}, { 928, 3182989542u, 324306108u, 3236216574u, 3657300235u, 3182989542u, 324306108u, 0, ASIN_TOLERANCE, 0}, { 929, 2615512563u, 583339032u, 1059119779u, 2312064517u, 2615512563u, 583339032u, 0, ASIN_TOLERANCE, 0}, { 930, 1018901539u, 1094068533u, 3243006833u, 3107499181u, 1018901539u, 1094068533u, 0, ASIN_TOLERANCE, 0}, { 931, 621064893u, 2330095236u, 1045494806u, 3166363539u, 621064893u, 2330095236u, 0, ASIN_TOLERANCE, 0}, { 932, 848850921u, 2922855425u, 1055270013u, 3382352474u, 848850921u, 2922855425u, 0, ASIN_TOLERANCE, 0}, { 933, 2636544164u, 2042479846u, 1052493506u, 1108839173u, 2636544164u, 2042479846u, 0, ASIN_TOLERANCE, 0}, { 934, 14409368u, 3796172167u, 1093571065u, 169360454u, 14409368u, 3796172167u, 0, ASIN_TOLERANCE, 0}, { 935, 792852082u, 1860101737u, 1103906352u, 1684270183u, 792852082u, 1860101737u, 0, ASIN_TOLERANCE, 0}, { 936, 857946959u, 1478693394u, 1081338739u, 2709296315u, 857946959u, 1478693394u, 0, ASIN_TOLERANCE, 0}, { 937, 148167699u, 2960729928u, 1099267383u, 1713640531u, 148167699u, 2960729928u, 0, ASIN_TOLERANCE, 0}, { 938, 385577172u, 3119726590u, 1073506160u, 3652712370u, 385577172u, 3119726590u, 0, ASIN_TOLERANCE, 0}, { 939, 2345316997u, 2223927344u, 1087592708u, 1855918127u, 2345316997u, 2223927344u, 0, ASIN_TOLERANCE, 0}, { 940, 283564999u, 1025757067u, 1082898254u, 4130586757u, 283564999u, 1025757067u, 0, ASIN_TOLERANCE, 0}, { 941, 248963649u, 1732390968u, 3252871699u, 2342842299u, 248963649u, 1732390968u, 0, ASIN_TOLERANCE, 0}, { 942, 968306674u, 284897931u, 3252953804u, 1924892993u, 968306674u, 284897931u, 0, ASIN_TOLERANCE, 0}, { 943, 2792404953u, 3037915642u, 3201314702u, 236884699u, 2792404953u, 3037915642u, 0, ASIN_TOLERANCE, 0}, { 944, 2786424109u, 2193269825u, 1080777124u, 2443415975u, 2786424109u, 2193269825u, 0, ASIN_TOLERANCE, 0}, { 945, 519195528u, 875427160u, 3254060908u, 2005185235u, 519195528u, 875427160u, 0, ASIN_TOLERANCE, 0}, { 946, 2834778379u, 1185249950u, 3192573802u, 43728140u, 2834778379u, 1185249950u, 0, ASIN_TOLERANCE, 0}, { 947, 941414883u, 1968452001u, 3208083074u, 2872106033u, 941414883u, 1968452001u, 0, ASIN_TOLERANCE, 0}, { 948, 1058483372u, 1955688296u, 1041438818u, 4288876237u, 1058483372u, 1964184798u, 0, ASIN_TOLERANCE, 0}, { 949, 260098041u, 1687624754u, 1047766046u, 3073412424u, 260098041u, 1687624754u, 0, ASIN_TOLERANCE, 0}, { 950, 3060253014u, 1209878394u, 1095484022u, 291364597u, 3060253014u, 1209878394u, 0, ASIN_TOLERANCE, 0}, { 951, 468175369u, 3483008135u, 1104326057u, 3143994227u, 468175369u, 3483008135u, 0, ASIN_TOLERANCE, 0}, { 952, 2417131043u, 3223340235u, 1090336173u, 1399132887u, 2417131043u, 3223340235u, 0, ASIN_TOLERANCE, 0}, { 953, 783617139u, 4188530565u, 1049645776u, 3448942728u, 783617139u, 4188530565u, 0, ASIN_TOLERANCE, 0}, { 954, 660957346u, 1627557770u, 1058246656u, 2945931719u, 660957346u, 1627557770u, 0, ASIN_TOLERANCE, 0}, { 955, 1018601337u, 3373123648u, 3197792793u, 672208537u, 1018601337u, 3373123648u, 0, ASIN_TOLERANCE, 0}, { 956, 408015225u, 3778617114u, 1062846388u, 1358342023u, 408015225u, 3778617114u, 0, ASIN_TOLERANCE, 0}, { 957, 410316381u, 2900182547u, 3199310787u, 414812664u, 410316381u, 2900182547u, 0, ASIN_TOLERANCE, 0}, { 958, 633591966u, 2464347659u, 3205131467u, 3988778663u, 633591966u, 2464347659u, 0, ASIN_TOLERANCE, 0}, { 959, 229808805u, 3135249601u, 1100087621u, 4100875262u, 229808805u, 3135249601u, 0, ASIN_TOLERANCE, 0}, { 960, 793399715u, 2358359525u, 1045184735u, 1183252266u, 793399715u, 2358359525u, 0, ASIN_TOLERANCE, 0}, { 961, 971564307u, 1400352853u, 3240053853u, 734055542u, 971564307u, 1400352853u, 0, ASIN_TOLERANCE, 0}, { 962, 348066411u, 1753967678u, 3224978909u, 1995531974u, 348066411u, 1753967678u, 0, ASIN_TOLERANCE, 0}, { 963, 2638555255u, 1500031970u, 3233676488u, 4052958340u, 2638555255u, 1500031970u, 0, ASIN_TOLERANCE, 0}, { 964, 536164755u, 1866935720u, 3200756597u, 3746696244u, 536164755u, 1866935720u, 0, ASIN_TOLERANCE, 0}, { 965, 91363664u, 2978288684u, 1106515721u, 564707827u, 91363664u, 2978288684u, 0, ASIN_TOLERANCE, 0}, { 966, 447397583u, 1517077030u, 1044934689u, 4156529635u, 447397583u, 1517077030u, 0, ASIN_TOLERANCE, 0}, { 967, 884390674u, 1427263585u, 3247549500u, 559009887u, 884390674u, 1427263585u, 0, ASIN_TOLERANCE, 0}, { 968, 709965825u, 427386166u, 3224310223u, 2897984604u, 709965825u, 427386166u, 0, ASIN_TOLERANCE, 0}, { 969, 748422445u, 984833499u, 1086168339u, 3414464869u, 748422445u, 984833499u, 0, ASIN_TOLERANCE, 0}, { 970, 3037316018u, 1275655663u, 1051250192u, 1788042252u, 3037316018u, 1275655663u, 0, ASIN_TOLERANCE, 0}, { 971, 647298401u, 1752811522u, 1054424401u, 3069200833u, 647298401u, 1752811522u, 0, ASIN_TOLERANCE, 0}, { 972, 336691782u, 4159629802u, 3227935989u, 905739373u, 336691782u, 4159629802u, 0, ASIN_TOLERANCE, 0}, { 973, 840207318u, 3449457931u, 1053675501u, 651755324u, 840207318u, 3449457931u, 0, ASIN_TOLERANCE, 0}, { 974, 588654397u, 824950980u, 1063835328u, 2970166564u, 588654397u, 824950980u, 0, ASIN_TOLERANCE, 0}, { 975, 1002643220u, 3980858800u, 1097889355u, 860102770u, 1002643220u, 3980858800u, 0, ASIN_TOLERANCE, 0}, { 976, 2925126437u, 3352952738u, 1087086428u, 1202852913u, 2925126437u, 3352952738u, 0, ASIN_TOLERANCE, 0}, { 977, 3153295755u, 3493096285u, 3210665381u, 1226230602u, 3153295755u, 3493096285u, 0, ASIN_TOLERANCE, 0}, { 978, 2861370199u, 2237153875u, 1063605905u, 2592496943u, 2861370199u, 2237153875u, 0, ASIN_TOLERANCE, 0}, { 979, 812704965u, 1204681469u, 1084151922u, 928193012u, 812704965u, 1204681469u, 0, ASIN_TOLERANCE, 0}, { 980, 717902981u, 1892558657u, 3188880850u, 472712482u, 717902981u, 1892558657u, 0, ASIN_TOLERANCE, 0}, { 981, 206133394u, 1107589453u, 3240016549u, 2840254081u, 206133394u, 1107589453u, 0, ASIN_TOLERANCE, 0}, { 982, 645145771u, 1760994629u, 3217094564u, 2931138356u, 645145771u, 1760994629u, 0, ASIN_TOLERANCE, 0}, { 983, 2682176516u, 3313118532u, 1095060283u, 1256408484u, 2682176516u, 3313118532u, 0, ASIN_TOLERANCE, 0}, { 984, 958852249u, 2822240883u, 3191644368u, 1759139386u, 958852249u, 2822240883u, 0, ASIN_TOLERANCE, 0}, { 985, 3064303449u, 3148616726u, 3216643810u, 4033784566u, 3064303449u, 3148616726u, 0, ASIN_TOLERANCE, 0}, { 986, 2672549129u, 50508488u, 3234572856u, 2196737134u, 2672549129u, 50508488u, 0, ASIN_TOLERANCE, 0}, { 987, 199760205u, 1739301489u, 1047113374u, 2964036605u, 199760205u, 1739301489u, 0, ASIN_TOLERANCE, 0}, { 988, 2742280838u, 32766355u, 1078278376u, 684801414u, 2742280838u, 32766355u, 0, ASIN_TOLERANCE, 0}, { 989, 860036812u, 2725458084u, 3197542874u, 3768641510u, 860036812u, 2725458084u, 0, ASIN_TOLERANCE, 0}, { 990, 602166919u, 2877639205u, 3248394899u, 2733580401u, 602166919u, 2877639205u, 0, ASIN_TOLERANCE, 0}, { 991, 217158246u, 3237117913u, 1086314718u, 1194088701u, 217158246u, 3237117913u, 0, ASIN_TOLERANCE, 0}, { 992, 507701220u, 2969027390u, 3254737744u, 2845466153u, 507701220u, 2969027390u, 0, ASIN_TOLERANCE, 0}, { 993, 39202927u, 1308825168u, 3231339694u, 1185199746u, 39202927u, 1308825168u, 0, ASIN_TOLERANCE, 0}, { 994, 2538930797u, 3429306274u, 3236439133u, 3100989857u, 2538930797u, 3429306274u, 0, ASIN_TOLERANCE, 0}, { 995, 2251277391u, 4179597430u, 1060231463u, 2735521684u, 2251277391u, 4179597430u, 0, ASIN_TOLERANCE, 0}, { 996, 863742433u, 1926531024u, 1040565159u, 1724549325u, 863742433u, 1926531024u, 0, ASIN_TOLERANCE, 0}, { 997, 344684868u, 1215071411u, 1068384117u, 483238293u, 344684868u, 1215071411u, 0, ASIN_TOLERANCE, 0}, { 998, 317818997u, 197061949u, 1043473339u, 249253513u, 317818997u, 197061949u, 0, ASIN_TOLERANCE, 0}, { 999, 2250299688u, 1410107326u, 3198269248u, 2880209598u, 2250299688u, 1410107326u, 0, ASIN_TOLERANCE, 0}, // AUTOMATICALLY GENERATED VECTORS STOP }; #endif // CYGONCE_LIBM_ASIN_H multiple inclusion protection // EOF asin.h
reille/proj_ecos
src/ecos/packages/language/c/libm/current/tests/vectors/asin.h
C
gpl-2.0
109,164
<?php /** * ARC2 RDF/JSON Serializer * * @author Benjamin Nowack <bnowack@semsol.com> * @license W3C Software License and GPL * @homepage <https://github.com/semsol/arc2> * @package ARC2 */ ARC2::inc('RDFSerializer'); class ARC2_RDFJSONSerializer extends ARC2_RDFSerializer { function __construct($a, &$caller) { parent::__construct($a, $caller); } function __init() { parent::__init(); $this->content_header = 'application/json'; } /* */ function getTerm($v, $term = 's') { if (!is_array($v)) { if (preg_match('/^\_\:/', $v)) { return ($term == 'o') ? $this->getTerm(array('value' => $v, 'type' => 'bnode'), 'o') : '"' . $v . '"'; } return ($term == 'o') ? $this->getTerm(array('value' => $v, 'type' => 'uri'), 'o') : '"' . $v . '"'; } if (!isset($v['type']) || ($v['type'] != 'literal')) { if ($term != 'o') { return $this->getTerm($v['value'], $term); } if (preg_match('/^\_\:/', $v['value'])) { return '{ "value" : "' . $this->jsonEscape($v['value']) . '", "type" : "bnode" }'; } return '{ "value" : "' . $this->jsonEscape($v['value']) . '", "type" : "uri" }'; } /* literal */ $r = '{ "value" : "' . $this->jsonEscape($v['value']) . '", "type" : "literal"'; $suffix = isset($v['datatype']) ? ', "datatype" : "' . $v['datatype'] . '"' : ''; $suffix = isset($v['lang']) ? ', "lang" : "' . $v['lang'] . '"' : $suffix; $r .= $suffix . ' }'; return $r; } function jsonEscape($v) { if (function_exists('json_encode')) { return preg_replace('/^"(.*)"$/', '\\1', str_replace("\/","/",json_encode($v))); } $from = array("\\", "\r", "\t", "\n", '"', "\b", "\f"); $to = array('\\\\', '\r', '\t', '\n', '\"', '\b', '\f'); return str_replace($from, $to, $v); } function getSerializedIndex($index, $raw = 0) { $r = ''; $nl = "\n"; foreach ($index as $s => $ps) { $r .= $r ? ',' . $nl . $nl : ''; $r .= ' ' . $this->getTerm($s). ' : {'; $first_p = 1; foreach ($ps as $p => $os) { $r .= $first_p ? $nl : ',' . $nl; $r .= ' ' . $this->getTerm($p). ' : ['; $first_o = 1; if (!is_array($os)) {/* single literal o */ $os = array(array('value' => $os, 'type' => 'literal')); } foreach ($os as $o) { $r .= $first_o ? $nl : ',' . $nl; $r .= ' ' . $this->getTerm($o, 'o'); $first_o = 0; } $first_p = 0; $r .= $nl . ' ]'; } $r .= $nl . ' }'; } $r .= $r ? ' ' : ''; return '{' . $nl . $r . $nl . '}'; } /* */ }
avatarr8/apeoplesguide7
sites/all/libraries/ARC2/arc/serializers/ARC2_RDFJSONSerializer.php
PHP
gpl-2.0
2,678
#include <stdio.h> #include <unistd.h> /* * Wrap the kernel time call so that it also * returns a time_t (longlong). The kernel ABI * doesn't deal in 64bit return values. */ int stime(const time_t *t) { __ktime_t tmp; tmp.time = *t; #if defined(NO_64BIT) tmp.pad = 0; #endif return _stime(&tmp, 0); }
NoSuchProcess/FUZIX
Library/libs/stime.c
C
gpl-2.0
314
/*************************************************************************** qgsmesh3dsymbol.cpp ------------------- Date : January 2019 Copyright : (C) 2019 by Peter Petrik Email : zilolv at gmail dot com *************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "qgsmesh3dsymbol.h" #include "qgs3dutils.h" QgsAbstract3DSymbol *QgsMesh3DSymbol::clone() const { return new QgsMesh3DSymbol( *this ); } void QgsMesh3DSymbol::writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const { Q_UNUSED( context ) QDomDocument doc = elem.ownerDocument(); QDomElement elemDataProperties = doc.createElement( QStringLiteral( "data" ) ); elemDataProperties.setAttribute( QStringLiteral( "alt-clamping" ), Qgs3DUtils::altClampingToString( mAltClamping ) ); elemDataProperties.setAttribute( QStringLiteral( "height" ), mHeight ); elemDataProperties.setAttribute( QStringLiteral( "add-back-faces" ), mAddBackFaces ? QStringLiteral( "1" ) : QStringLiteral( "0" ) ); elem.appendChild( elemDataProperties ); QDomElement elemMaterial = doc.createElement( QStringLiteral( "material" ) ); mMaterial.writeXml( elemMaterial ); elem.appendChild( elemMaterial ); QDomElement elemDDP = doc.createElement( QStringLiteral( "data-defined-properties" ) ); mDataDefinedProperties.writeXml( elemDDP, propertyDefinitions() ); elem.appendChild( elemDDP ); } void QgsMesh3DSymbol::readXml( const QDomElement &elem, const QgsReadWriteContext &context ) { Q_UNUSED( context ) QDomElement elemDataProperties = elem.firstChildElement( QStringLiteral( "data" ) ); mAltClamping = Qgs3DUtils::altClampingFromString( elemDataProperties.attribute( QStringLiteral( "alt-clamping" ) ) ); mHeight = elemDataProperties.attribute( QStringLiteral( "height" ) ).toFloat(); mAddBackFaces = elemDataProperties.attribute( QStringLiteral( "add-back-faces" ) ).toInt(); QDomElement elemMaterial = elem.firstChildElement( QStringLiteral( "material" ) ); mMaterial.readXml( elemMaterial ); QDomElement elemDDP = elem.firstChildElement( QStringLiteral( "data-defined-properties" ) ); if ( !elemDDP.isNull() ) mDataDefinedProperties.readXml( elemDDP, propertyDefinitions() ); }
mhugo/QGIS
src/3d/symbols/qgsmesh3dsymbol.cpp
C++
gpl-2.0
2,812
<?php /* +--------------------------------------------------------------------+ | CiviCRM version 4.4 | +--------------------------------------------------------------------+ | Copyright CiviCRM LLC (c) 2004-2013 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | | CiviCRM is free software; you can copy, modify, and distribute it | | under the terms of the GNU Affero General Public License | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | | | CiviCRM is distributed in the hope that it will be useful, but | | WITHOUT ANY WARRANTY; without even the implied warranty of | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | See the GNU Affero General Public License for more details. | | | | You should have received a copy of the GNU Affero General Public | | License and the CiviCRM Licensing Exception along | | with this program; if not, contact CiviCRM LLC | | at info[AT]civicrm[DOT]org. If you have questions about the | | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ */ class CRM_Event_Import_Field { /**#@+ * @access protected * @var string */ /** * name of the field */ public $_name; /** * title of the field to be used in display */ public $_title; /** * type of field * @var enum */ public $_type; /** * regexp to match the CSV header of this column/field * @var string */ public $_headerPattern; /** * regexp to match the pattern of data from various column/fields * @var string */ public $_dataPattern; /** * value of this field * @var object */ public $_value; function __construct($name, $title, $type = CRM_Utils_Type::T_INT, $headerPattern = '//', $dataPattern = '//') { $this->_name = $name; $this->_title = $title; $this->_type = $type; $this->_headerPattern = $headerPattern; $this->_dataPattern = $dataPattern; $this->_value = NULL; } function resetValue() { $this->_value = NULL; } /** * the value is in string format. convert the value to the type of this field * and set the field value with the appropriate type */ function setValue($value) { $this->_value = $value; } function validate() { if (CRM_Utils_System::isNull($this->_value)) { return TRUE; } switch ($this->_name) { case 'contact_id': // note: we validate extistence of the contact in API, upon // insert (it would be too costlty to do a db call here) return CRM_Utils_Rule::integer($this->_value); case 'register_date': return CRM_Utils_Rule::date($this->_value); /* case 'event_id': static $events = null; if (!$events) { $events = CRM_Event_PseudoConstant::event(); } if (in_array($this->_value, $events)) { return true; } else { return false; } break; */ default: break; } // check whether that's a valid custom field id // and if so, check the contents' validity if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($this->_name)) { static $customFields = NULL; if (!$customFields) { $customFields = CRM_Core_BAO_CustomField::getFields('Participant'); } if (!array_key_exists($customFieldID, $customFields)) { return FALSE; } return CRM_Core_BAO_CustomValue::typecheck($customFields[$customFieldID]['data_type'], $this->_value); } return TRUE; } }
lizmestres/bf
sites/all/modules/civicrm/CRM/Event/Import/Field.php
PHP
gpl-2.0
4,202
# SPDX-License-Identifier: GPL-2.0 # Copyright (c) 2015 Stephen Warren # Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. import pytest import u_boot_utils @pytest.mark.buildconfigspec('cmd_memory') def test_md(u_boot_console): """Test that md reads memory as expected, and that memory can be modified using the mw command.""" ram_base = u_boot_utils.find_ram_base(u_boot_console) addr = '%08x' % ram_base val = 'a5f09876' expected_response = addr + ': ' + val u_boot_console.run_command('mw ' + addr + ' 0 10') response = u_boot_console.run_command('md ' + addr + ' 10') assert(not (expected_response in response)) u_boot_console.run_command('mw ' + addr + ' ' + val) response = u_boot_console.run_command('md ' + addr + ' 10') assert(expected_response in response) @pytest.mark.buildconfigspec('cmd_memory') def test_md_repeat(u_boot_console): """Test command repeat (via executing an empty command) operates correctly for "md"; the command must repeat and dump an incrementing address.""" ram_base = u_boot_utils.find_ram_base(u_boot_console) addr_base = '%08x' % ram_base words = 0x10 addr_repeat = '%08x' % (ram_base + (words * 4)) u_boot_console.run_command('md %s %x' % (addr_base, words)) response = u_boot_console.run_command('') expected_response = addr_repeat + ': ' assert(expected_response in response)
Digilent/u-boot-digilent
test/py/tests/test_md.py
Python
gpl-2.0
1,426
<?php class INBOUND_InvalidArgumentException extends BaseInvalidArgumentException { public static function fileNotExists($fileName) { return new static(sprintf('File "%s" does not exist', $fileName)); } }
sugarday/urol
wp-content/plugins/leads/shared/tracking/sources/Snowplow/RefererParser/Exception/INBOUND_InvalidArgumentException.php
PHP
gpl-2.0
226
/* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* extensible hash TODO try to get rid of dummy nodes ? for non-unique hash, count only _distinct_ values (but how to do it in lf_hash_delete ?) */ #include <my_global.h> #include <m_string.h> #include <my_sys.h> #include <mysys_priv.h> #include <my_bit.h> #include <lf.h> LF_REQUIRE_PINS(3) /* An element of the list */ typedef struct { intptr volatile link; /* a pointer to the next element in a listand a flag */ uint32 hashnr; /* reversed hash number, for sorting */ const uchar *key; size_t keylen; /* data is stored here, directly after the keylen. thus the pointer to data is (void*)(slist_element_ptr+1) */ } LF_SLIST; const int LF_HASH_OVERHEAD= sizeof(LF_SLIST); /* a structure to pass the context (pointers two the three successive elements in a list) from my_lfind to linsert/ldelete */ typedef struct { intptr volatile *prev; LF_SLIST *curr, *next; } CURSOR; /* the last bit in LF_SLIST::link is a "deleted" flag. the helper macros below convert it to a pure pointer or a pure flag */ #define PTR(V) (LF_SLIST *)((V) & (~(intptr)1)) #define DELETED(V) ((V) & 1) /* DESCRIPTION Search for hashnr/key/keylen in the list starting from 'head' and position the cursor. The list is ORDER BY hashnr, key RETURN 0 - not found 1 - found NOTE cursor is positioned in either case pins[0..2] are used, they are NOT removed on return */ static int my_lfind(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, const uchar *key, size_t keylen, CURSOR *cursor, LF_PINS *pins) { uint32 cur_hashnr; const uchar *cur_key; size_t cur_keylen; intptr link; retry: cursor->prev= (intptr *)head; do { /* PTR() isn't necessary below, head is a dummy node */ cursor->curr= (LF_SLIST *)(*cursor->prev); lf_pin(pins, 1, cursor->curr); } while (*cursor->prev != (intptr)cursor->curr && LF_BACKOFF); for (;;) { if (unlikely(!cursor->curr)) return 0; /* end of the list */ do { /* QQ: XXX or goto retry ? */ link= cursor->curr->link; cursor->next= PTR(link); lf_pin(pins, 0, cursor->next); } while (link != cursor->curr->link && LF_BACKOFF); cur_hashnr= cursor->curr->hashnr; cur_key= cursor->curr->key; cur_keylen= cursor->curr->keylen; if (*cursor->prev != (intptr)cursor->curr) { (void)LF_BACKOFF; goto retry; } if (!DELETED(link)) { if (cur_hashnr >= hashnr) { int r= 1; if (cur_hashnr > hashnr || (r= my_strnncoll(cs, (uchar*) cur_key, cur_keylen, (uchar*) key, keylen)) >= 0) return !r; } cursor->prev= &(cursor->curr->link); lf_pin(pins, 2, cursor->curr); } else { /* we found a deleted node - be nice, help the other thread and remove this deleted node */ if (my_atomic_casptr((void **)cursor->prev, (void **)&cursor->curr, cursor->next)) lf_pinbox_free(pins, cursor->curr); else { (void)LF_BACKOFF; goto retry; } } cursor->curr= cursor->next; lf_pin(pins, 1, cursor->curr); } } /** Search for list element satisfying condition specified by match function and position cursor on it. @param head Head of the list to search in. @param first_hashnr Hash value to start search from. @param last_hashnr Hash value to stop search after. @param match Match function. @param cursor Cursor to be position. @param pins LF_PINS for the calling thread to be used during search for pinning result. @retval 0 - not found @retval 1 - found */ static int my_lfind_match(LF_SLIST * volatile *head, uint32 first_hashnr, uint32 last_hashnr, lf_hash_match_func *match, CURSOR *cursor, LF_PINS *pins) { uint32 cur_hashnr; intptr link; retry: cursor->prev= (intptr *)head; do { /* PTR() isn't necessary below, head is a dummy node */ cursor->curr= (LF_SLIST *)(*cursor->prev); lf_pin(pins, 1, cursor->curr); } while (*cursor->prev != (intptr)cursor->curr && LF_BACKOFF); for (;;) { if (unlikely(!cursor->curr)) return 0; /* end of the list */ do { /* QQ: XXX or goto retry ? */ link= cursor->curr->link; cursor->next= PTR(link); lf_pin(pins, 0, cursor->next); } while (link != cursor->curr->link && LF_BACKOFF); cur_hashnr= cursor->curr->hashnr; if (*cursor->prev != (intptr)cursor->curr) { (void)LF_BACKOFF; goto retry; } if (!DELETED(link)) { if (cur_hashnr >= first_hashnr) { if (cur_hashnr > last_hashnr) return 0; if (cur_hashnr & 1) { /* Normal node. Check if element matches condition. */ if ((*match)((uchar *)(cursor->curr + 1))) return 1; } else { /* Dummy node. Nothing to check here. Still thanks to the fact that dummy nodes are never deleted we can save it as a safe place to restart iteration if ever needed. */ head= (LF_SLIST * volatile *)&(cursor->curr->link); } } cursor->prev= &(cursor->curr->link); lf_pin(pins, 2, cursor->curr); } else { /* we found a deleted node - be nice, help the other thread and remove this deleted node */ if (my_atomic_casptr((void **)cursor->prev, (void **)&cursor->curr, cursor->next)) lf_pinbox_free(pins, cursor->curr); else { (void)LF_BACKOFF; goto retry; } } cursor->curr= cursor->next; lf_pin(pins, 1, cursor->curr); } } /* DESCRIPTION insert a 'node' in the list that starts from 'head' in the correct position (as found by my_lfind) RETURN 0 - inserted not 0 - a pointer to a duplicate (not pinned and thus unusable) NOTE it uses pins[0..2], on return all pins are removed. if there're nodes with the same key value, a new node is added before them. */ static LF_SLIST *linsert(LF_SLIST * volatile *head, CHARSET_INFO *cs, LF_SLIST *node, LF_PINS *pins, uint flags) { CURSOR cursor; int res; for (;;) { if (my_lfind(head, cs, node->hashnr, node->key, node->keylen, &cursor, pins) && (flags & LF_HASH_UNIQUE)) { res= 0; /* duplicate found */ break; } else { node->link= (intptr)cursor.curr; DBUG_ASSERT(node->link != (intptr)node); /* no circular references */ DBUG_ASSERT(cursor.prev != &node->link); /* no circular references */ if (my_atomic_casptr((void **)cursor.prev, (void **)&cursor.curr, node)) { res= 1; /* inserted ok */ break; } } } lf_unpin(pins, 0); lf_unpin(pins, 1); lf_unpin(pins, 2); /* Note that cursor.curr is not pinned here and the pointer is unreliable, the object may dissapear anytime. But if it points to a dummy node, the pointer is safe, because dummy nodes are never freed - initialize_bucket() uses this fact. */ return res ? 0 : cursor.curr; } /* DESCRIPTION deletes a node as identified by hashnr/keey/keylen from the list that starts from 'head' RETURN 0 - ok 1 - not found NOTE it uses pins[0..2], on return all pins are removed. */ static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, const uchar *key, uint keylen, LF_PINS *pins) { CURSOR cursor; int res; for (;;) { if (!my_lfind(head, cs, hashnr, key, keylen, &cursor, pins)) { res= 1; /* not found */ break; } else { /* mark the node deleted */ if (my_atomic_casptr((void **)&(cursor.curr->link), (void **)&cursor.next, (void *)(((intptr)cursor.next) | 1))) { /* and remove it from the list */ if (my_atomic_casptr((void **)cursor.prev, (void **)&cursor.curr, cursor.next)) lf_pinbox_free(pins, cursor.curr); else { /* somebody already "helped" us and removed the node ? Let's check if we need to help that someone too! (to ensure the number of "set DELETED flag" actions is equal to the number of "remove from the list" actions) */ my_lfind(head, cs, hashnr, key, keylen, &cursor, pins); } res= 0; break; } } } lf_unpin(pins, 0); lf_unpin(pins, 1); lf_unpin(pins, 2); return res; } /* DESCRIPTION searches for a node as identified by hashnr/keey/keylen in the list that starts from 'head' RETURN 0 - not found node - found NOTE it uses pins[0..2], on return the pin[2] keeps the node found all other pins are removed. */ static LF_SLIST *my_lsearch(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, const uchar *key, uint keylen, LF_PINS *pins) { CURSOR cursor; int res= my_lfind(head, cs, hashnr, key, keylen, &cursor, pins); if (res) lf_pin(pins, 2, cursor.curr); lf_unpin(pins, 0); lf_unpin(pins, 1); return res ? cursor.curr : 0; } static inline const uchar* hash_key(const LF_HASH *hash, const uchar *record, size_t *length) { if (hash->get_key) return (*hash->get_key)(record, length, 0); *length= hash->key_length; return record + hash->key_offset; } /* Compute the hash key value from the raw key. @note, that the hash value is limited to 2^31, because we need one bit to distinguish between normal and dummy nodes. */ static inline uint calc_hash(LF_HASH *hash, const uchar *key, size_t keylen) { return (hash->hash_function(hash, key, keylen)) & INT_MAX32; } #define MAX_LOAD 1.0 /* average number of elements in a bucket */ static int initialize_bucket(LF_HASH *, LF_SLIST * volatile*, uint, LF_PINS *); /** Adaptor function which allows to use hash function from character set with LF_HASH. */ static uint cset_hash_sort_adapter(const LF_HASH *hash, const uchar *key, size_t length) { ulong nr1=1, nr2=4; hash->charset->coll->hash_sort(hash->charset, key, length, &nr1, &nr2); return (uint)nr1; } /* Initializes lf_hash, the arguments are compatible with hash_init @note element_size sets both the size of allocated memory block for lf_alloc and a size of memcpy'ed block size in lf_hash_insert. Typically they are the same, indeed. But LF_HASH::element_size can be decreased after lf_hash_init, and then lf_alloc will allocate larger block that lf_hash_insert will copy over. It is desireable if part of the element is expensive to initialize - for example if there is a mutex or DYNAMIC_ARRAY. In this case they should be initialize in the LF_ALLOCATOR::constructor, and lf_hash_insert should not overwrite them. See wt_init() for example. As an alternative to using the above trick with decreasing LF_HASH::element_size one can provide an "initialize" hook that will finish initialization of object provided by LF_ALLOCATOR and set element key from object passed as parameter to lf_hash_insert instead of doing simple memcpy. */ void lf_hash_init2(LF_HASH *hash, uint element_size, uint flags, uint key_offset, uint key_length, my_hash_get_key get_key, CHARSET_INFO *charset, lf_hash_func *hash_function, lf_allocator_func *ctor, lf_allocator_func *dtor, lf_hash_init_func *init) { lf_alloc_init2(&hash->alloc, sizeof(LF_SLIST)+element_size, offsetof(LF_SLIST, key), ctor, dtor); lf_dynarray_init(&hash->array, sizeof(LF_SLIST *)); hash->size= 1; hash->count= 0; hash->element_size= element_size; hash->flags= flags; hash->charset= charset ? charset : &my_charset_bin; hash->key_offset= key_offset; hash->key_length= key_length; hash->get_key= get_key; hash->hash_function= hash_function ? hash_function : cset_hash_sort_adapter; hash->initialize= init; DBUG_ASSERT(get_key ? !key_offset && !key_length : key_length); } void lf_hash_destroy(LF_HASH *hash) { LF_SLIST *el, **head= (LF_SLIST **)lf_dynarray_value(&hash->array, 0); if (unlikely(!head)) return; el= *head; while (el) { intptr next= el->link; if (el->hashnr & 1) lf_alloc_direct_free(&hash->alloc, el); /* normal node */ else my_free(el); /* dummy node */ el= (LF_SLIST *)next; } lf_alloc_destroy(&hash->alloc); lf_dynarray_destroy(&hash->array); } /* DESCRIPTION inserts a new element to a hash. it will have a _copy_ of data, not a pointer to it. RETURN 0 - inserted 1 - didn't (unique key conflict) -1 - out of memory NOTE see linsert() for pin usage notes */ int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data) { int csize, bucket, hashnr; LF_SLIST *node, * volatile *el; node= (LF_SLIST *)lf_alloc_new(pins); if (unlikely(!node)) return -1; if (hash->initialize) (*hash->initialize)((uchar*)(node + 1), (const uchar*)data); else memcpy(node+1, data, hash->element_size); node->key= hash_key(hash, (uchar *)(node+1), &node->keylen); hashnr= calc_hash(hash, node->key, node->keylen); bucket= hashnr % hash->size; el= lf_dynarray_lvalue(&hash->array, bucket); if (unlikely(!el)) return -1; if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins))) return -1; node->hashnr= my_reverse_bits(hashnr) | 1; /* normal node */ if (linsert(el, hash->charset, node, pins, hash->flags)) { lf_pinbox_free(pins, node); return 1; } csize= hash->size; if ((my_atomic_add32(&hash->count, 1)+1.0) / csize > MAX_LOAD) my_atomic_cas32(&hash->size, &csize, csize*2); return 0; } /* DESCRIPTION deletes an element with the given key from the hash (if a hash is not unique and there're many elements with this key - the "first" matching element is deleted) RETURN 0 - deleted 1 - didn't (not found) -1 - out of memory NOTE see ldelete() for pin usage notes */ int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen) { LF_SLIST * volatile *el; uint bucket, hashnr= calc_hash(hash, (uchar *)key, keylen); bucket= hashnr % hash->size; el= lf_dynarray_lvalue(&hash->array, bucket); if (unlikely(!el)) return -1; /* note that we still need to initialize_bucket here, we cannot return "node not found", because an old bucket of that node may've been split and the node was assigned to a new bucket that was never accessed before and thus is not initialized. */ if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins))) return -1; if (ldelete(el, hash->charset, my_reverse_bits(hashnr) | 1, (uchar *)key, keylen, pins)) { return 1; } my_atomic_add32(&hash->count, -1); return 0; } /** Find hash element corresponding to the key. @param hash The hash to search element in. @param pins Pins for the calling thread which were earlier obtained from this hash using lf_hash_get_pins(). @param key Key @param keylen Key length @retval A pointer to an element with the given key (if a hash is not unique and there're many elements with this key - the "first" matching element). @retval NULL - if nothing is found @retval MY_ERRPTR - if OOM @note Uses pins[0..2]. On return pins[0..1] are removed and pins[2] is used to pin object found. It is also not removed in case when object is not found/error occurs but pin value is undefined in this case. So calling lf_hash_unpin() is mandatory after call to this function in case of both success and failure. @sa my_lsearch(). */ void *lf_hash_search(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen) { LF_SLIST * volatile *el, *found; uint bucket, hashnr= calc_hash(hash, (uchar *)key, keylen); bucket= hashnr % hash->size; el= lf_dynarray_lvalue(&hash->array, bucket); if (unlikely(!el)) return MY_ERRPTR; if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins))) return MY_ERRPTR; found= my_lsearch(el, hash->charset, my_reverse_bits(hashnr) | 1, (uchar *)key, keylen, pins); return found ? found+1 : 0; } /** Find random hash element which satisfies condition specified by match function. @param hash Hash to search element in. @param pin Pins for calling thread to be used during search and for pinning its result. @param match Pointer to match function. This function takes pointer to object stored in hash as parameter and returns 0 if object doesn't satisfy its condition (and non-0 value if it does). @param rand_val Random value to be used for selecting hash bucket from which search in sort-ordered list needs to be started. @retval A pointer to a random element matching condition. @retval NULL - if nothing is found @retval MY_ERRPTR - OOM. @note This function follows the same pinning protocol as lf_hash_search(), i.e. uses pins[0..2]. On return pins[0..1] are removed and pins[2] is used to pin object found. It is also not removed in case when object is not found/error occurs but its value is undefined in this case. So calling lf_hash_unpin() is mandatory after call to this function in case of both success and failure. */ void *lf_hash_random_match(LF_HASH *hash, LF_PINS *pins, lf_hash_match_func *match, uint rand_val) { /* Convert random value to valid hash value. */ uint hashnr= (rand_val & INT_MAX32); uint bucket; uint32 rev_hashnr; LF_SLIST * volatile *el; CURSOR cursor; int res; bucket= hashnr % hash->size; rev_hashnr= my_reverse_bits(hashnr); el= lf_dynarray_lvalue(&hash->array, bucket); if (unlikely(!el)) return MY_ERRPTR; /* Bucket might be totally empty if it has not been accessed since last time LF_HASH::size has been increased. In this case we initialize it by inserting dummy node for this bucket to the correct position in split-ordered list. This should help future lf_hash_* calls trying to access the same bucket. */ if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins))) return MY_ERRPTR; /* To avoid bias towards the first matching element in the bucket, we start looking for elements with inversed hash value greater or equal than inversed value of our random hash. */ res= my_lfind_match(el, rev_hashnr | 1, UINT_MAX32, match, &cursor, pins); if (! res && hashnr != 0) { /* We have not found matching element - probably we were too close to the tail of our split-ordered list. To avoid bias against elements at the head of the list we restart our search from its head. Unless we were already searching from it. To avoid going through elements at which we have already looked twice we stop once we reach element from which we have begun our first search. */ el= lf_dynarray_lvalue(&hash->array, 0); if (unlikely(!el)) return MY_ERRPTR; res= my_lfind_match(el, 1, rev_hashnr, match, &cursor, pins); } if (res) lf_pin(pins, 2, cursor.curr); lf_unpin(pins, 0); lf_unpin(pins, 1); return res ? cursor.curr + 1 : 0; } static const uchar *dummy_key= (uchar*)""; /* RETURN 0 - ok -1 - out of memory */ static int initialize_bucket(LF_HASH *hash, LF_SLIST * volatile *node, uint bucket, LF_PINS *pins) { uint parent= my_clear_highest_bit(bucket); LF_SLIST *dummy= (LF_SLIST *)my_malloc(key_memory_lf_slist, sizeof(LF_SLIST), MYF(MY_WME)); LF_SLIST **tmp= 0, *cur; LF_SLIST * volatile *el= lf_dynarray_lvalue(&hash->array, parent); if (unlikely(!el || !dummy)) return -1; if (*el == NULL && bucket && unlikely(initialize_bucket(hash, el, parent, pins))) return -1; dummy->hashnr= my_reverse_bits(bucket) | 0; /* dummy node */ dummy->key= dummy_key; dummy->keylen= 0; if ((cur= linsert(el, hash->charset, dummy, pins, LF_HASH_UNIQUE))) { my_free(dummy); dummy= cur; } my_atomic_casptr((void **)node, (void **)&tmp, dummy); /* note that if the CAS above failed (after linsert() succeeded), it would mean that some other thread has executed linsert() for the same dummy node, its linsert() failed, it picked up our dummy node (in "dummy= cur") and executed the same CAS as above. Which means that even if CAS above failed we don't need to retry, and we should not free(dummy) - there's no memory leak here */ return 0; }
ltangvald/mysql
mysys/lf_hash.c
C
gpl-2.0
22,119
<div id="preview"> <div id="preview-header"> <div id="preview-logo"><img src="../../../themes/beta/logo.png" alt="Site Logo" /></div> <div id="preview-site-name"><a>Site Title - Beta</a></div> <div id="preview-site-slogan">An awesome site slogan about the stuff we do...</div> </div> <div id="preview-horizontal-grad"> <div id="preview-main-menu"> <ul id="preview-main-menu-links"> <li><a>Home</a></li> <li><a class="active">Menu Item 1</a></li> <li><a>Menu Item 2</a></li> </ul> <div id="preview-secondary-menu"> <ul id="preview-secondary-menu-links"> <li><a class="active">Sub Item 1</a></li> <li><a>Sub Item 2</a></li> <li><a>Sub Item 3</a></li> </ul> </div> </div> <div id="preview-main" class="clearfix"> <div id="preview-sidebar"> <div id="preview-block" class="preview-block"> <h2>Etiam est risus</h2> <div class="preview-content"> Maecenas id porttitor Ut enim ad minim veniam, quis nostrudfelis. Laboris nisi ut aliquip ex ea. </div> </div> </div> <div id="preview-content"> <h1 id="preview-page-title">Lorem ipsum dolor</h1> <div id="preview-node"> <div class="preview-content"> Sit amet, <a>consectetur adipisicing elit</a>, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud <a>exercitation ullamco</a> laboris nisi ut aliquip ex ea commodo consequat. Maecenas id porttitor Ut enim ad minim veniam, quis nostr udfelis. </div> </div> </div> </div> </div> <div id="preview-footer-wrapper"> <div id="preview-footer-columns" class="clearfix"> <div class="preview-footer-column"> <div class="preview-block"> <h2>Etiam est risus</h2> <div class="content"> Maecenas id porttitor Ut enim ad minim veniam, quis nostrudfelis. Laboris nisi ut aliquip ex ea. </div> </div> </div> <div class="preview-footer-column"> <div class="preview-block preview-block-menu"> <h2>Erisus dolor</h2> <div class="preview-content"> <ul> <li><a>Donec placerat</a></li> <li><a>Nullam nibh dolor</a></li> <li><a>Blandit sed</a></li> <li><a>Fermentum id</a></li> </ul> </div> </div> </div> </div> </div> </div>
lueimg/f4k16
sites/default/themes/toronto/color/preview.html
HTML
gpl-2.0
2,610
/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** *** To edit the content of this header, modify the corresponding *** source file (e.g. under external/kernel-headers/original/) then *** run bionic/libc/kernel/tools/update_all.py *** *** Any manual change here will be lost the next time this script will *** be run. You've been warned! *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_STATE_H #define _IPT_STATE_H #include <linux/netfilter/xt_state.h> #define IPT_STATE_BIT XT_STATE_BIT /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define IPT_STATE_INVALID XT_STATE_INVALID #define IPT_STATE_UNTRACKED XT_STATE_UNTRACKED #define ipt_state_info xt_state_info #endif /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
infraredbg/Lenovo_A820_kernel_kk
bionic/libc/kernel/common/linux/netfilter_ipv4/ipt_state.h
C
gpl-2.0
1,374
<?php namespace libphonenumber; class CountryCodeToRegionCodeMapForTesting { public static $countryCodeToRegionCodeMap = array( 1 => array('US', 'BS'), 39 => array('IT'), 44 => array('GB'), 48 => array('PL'), 49 => array('DE'), 52 => array('MX'), 54 => array('AR'), 55 => array('BR'), 61 => array('AU'), 64 => array('NZ'), 65 => array('SG'), 81 => array('JP'), 82 => array('KR'), 91 => array('IN'), 244 => array('AO'), 262 => array('RE', 'YT'), 376 => array('AD'), 800 => array('001'), ); }
gowriabhaya/ghnV2
sites/all/libraries/libphonenumber-for-php/CountryCodeToRegionCodeMapForTesting.php
PHP
gpl-2.0
532
/* * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package nsk.jvmti.unit.MethodBind; import java.io.PrintStream; public class JvmtiTest { final static int JCK_STATUS_BASE = 95; final static int THREADS_LIMIT = 200; final static String NAME_PREFIX = "JvmtiTest-"; static int fail_id = 0; static { try { System.loadLibrary("MethodBind"); } catch (UnsatisfiedLinkError ule) { System.err.println("Could not load MethodBind library"); System.err.println("java.library.path:" + System.getProperty("java.library.path")); throw ule; } } native static int GetResult(); native static void CreateRawMonitor(int i); native static void RawMonitorEnter(int i); native static void RawMonitorExit(int i); native static void RawMonitorWait(int i); native static void GetStackTrace(TestThread t); native static int GetFrameCount(TestThread t); static volatile int thrCount = 0; public static void main(String args[]) { args = nsk.share.jvmti.JVMTITest.commonInit(args); // produce JCK-like exit status. System.exit(run(args, System.out) + JCK_STATUS_BASE); } public static int run(String args[], PrintStream out) { CreateRawMonitor(0); CreateRawMonitor(4); TestThread t[] = new TestThread[THREADS_LIMIT]; RawMonitorEnter(4); for (int i=0; i < THREADS_LIMIT; i++) { t[i] = new TestThread(NAME_PREFIX + thrCount); t[i].start(); } for (int i=0; i < THREADS_LIMIT-1; i++) { GetStackTrace(t[i]); GetFrameCount(t[i]); } RawMonitorExit(4); try { for (int i=0; i < THREADS_LIMIT; i++) { t[i].join(); } } catch (InterruptedException e) { throw new Error("Unexpected: " + e); } return GetResult() + fail_id; } static class TestThread extends Thread { static int counter=0; int ind; public TestThread(String name) { super(name); } public void run() { thrCount++; foo(0); } public void foo(int i) { i++; if ( i < 10 ) { foo(i); } else { RawMonitorEnter(4); RawMonitorExit(4); } } } }
md-5/jdk10
test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/MethodBind/JvmtiTest.java
Java
gpl-2.0
3,467
/* * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package nsk.jdwp.ThreadReference.Status; import nsk.share.*; import nsk.share.jpda.*; import nsk.share.jdwp.*; import java.io.*; /** * This class represents debuggee part in the test. */ public class status001a { // name for the tested thread public static final String THREAD_NAME = "TestedThreadName"; public static final String FIELD_NAME = "thread"; // notification object to notify debuggee that thread started private static Object threadStarted = new Object(); // lock object to prevent thread from exit private static Object threadLock = new Object(); // scaffold objects private static volatile ArgumentHandler argumentHandler = null; private static volatile Log log = null; public static void main(String args[]) { status001a _status001a = new status001a(); System.exit(status001.JCK_STATUS_BASE + _status001a.runIt(args, System.err)); } public int runIt(String args[], PrintStream out) { //make log for debugee messages argumentHandler = new ArgumentHandler(args); log = new Log(out, argumentHandler); // make communication pipe to debugger log.display("Creating pipe"); IOPipe pipe = argumentHandler.createDebugeeIOPipe(log); // lock the object to prevent thread from exit synchronized (threadLock) { // load tested class and create tested thread log.display("Creating object of tested class"); TestedClass.thread = new TestedClass(THREAD_NAME); // start the thread and wait for notification from it synchronized (threadStarted) { TestedClass.thread.start(); try { threadStarted.wait(); // send debugger signal READY log.display("Sending signal to debugger: " + status001.READY); pipe.println(status001.READY); } catch (InterruptedException e) { log.complain("Interruption while waiting for thread started: " + e); pipe.println(status001.ERROR); } } // wait for signal QUIT from debugeer log.display("Waiting for signal from debugger: " + status001.QUIT); String signal = pipe.readln(); log.display("Received signal from debugger: " + signal); // check received signal if (signal == null || !signal.equals(status001.QUIT)) { log.complain("Unexpected communication signal from debugee: " + signal + " (expected: " + status001.QUIT + ")"); log.display("Debugee FAILED"); return status001.FAILED; } // allow started thread to exit } // exit debugee log.display("Debugee PASSED"); return status001.PASSED; } // tested thread class public static class TestedClass extends Thread { // field with the tested Thread value public static volatile TestedClass thread = null; TestedClass(String name) { super(name); } public void run() { log.display("Tested thread started"); // notify debuggee that thread really started synchronized (threadStarted) { threadStarted.notifyAll(); } // wait for lock object released synchronized (threadLock) { log.display("Tested thread finished"); } } } }
md-5/jdk10
test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Status/status001a.java
Java
gpl-2.0
4,657
include(FindPkgConfig OPTIONAL) # This is a hack to deal with Ubuntu's mess. # Ubuntu's version of glew is 1.8, but they have patched in most of glew 1.9. # So Ubuntu's version works for dolphin. macro(test_glew) set(CMAKE_REQUIRED_INCLUDES ${GLEW_INCLUDE_DIRS}) set(CMAKE_REQUIRED_LIBRARIES GLEW) check_cxx_source_runs(" #include <GL/glew.h> int main() { #ifdef GLEW_ARB_buffer_storage return 0; #else return 1; #endif }" GLEW_HAS_1_10_METHODS) endmacro() if(PKG_CONFIG_FOUND AND NOT ${var}_FOUND) pkg_search_module(GLEW glew>=1.8) endif() if(GLEW_FOUND) test_glew() if (GLEW_HAS_1_10_METHODS) include_directories(${GLEW_INCLUDE_DIRS}) message("GLEW found") endif() endif()
skidau/dolphin
CMakeTests/FindGLEW.cmake
CMake
gpl-2.0
700
<?php /* Implementation of the get-php-details verb. Written by Chris Jean for iThemes.com Version 1.1.0 Version History 1.0.0 - 2013-11-14 - Chris Jean Initial version 1.1.0 - 2014-01-20 - Chris Jean Added $status_element_name and $show_in_status_by_default. */ class Ithemes_Sync_Verb_Get_PHP_Details extends Ithemes_Sync_Verb { public static $name = 'get-php-details'; public static $description = 'Retrieve details about the PHP configuration that is handling requests.'; public static $status_element_name = 'php'; public static $show_in_status_by_default = true; private $default_arguments = array(); public function run( $arguments ) { $arguments = Ithemes_Sync_Functions::merge_defaults( $arguments, $this->default_arguments ); return Ithemes_Sync_Functions::get_php_details( $arguments ); } }
annmcdermott/mcrrcsenecagre
wp-content/plugins/ithemes-sync/verbs/get-php-details.php
PHP
gpl-2.0
832
/* * perm.h - header for at(1) * Copyright (C) 1994 Thomas Koenig * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ int check_permission();
rhuitl/uClinux
user/at/perm.h
C
gpl-2.0
813
# -*- coding: utf-8 -*- import sys import json import binascii import xbmc from lib.yd_private_libs import util, servicecontrol, jsonqueue sys.path.insert(0, util.MODULE_PATH) import YDStreamExtractor # noqa E402 import threading # noqa E402 class Service(xbmc.Monitor): def __init__(self): self.downloadCount = 0 self.controller = servicecontrol.ServiceControl() self.start() def onNotification(self, sender, method, data): if not sender == 'script.module.youtube.dl': return self.processCommand(method.split('.', 1)[-1], self.controller.processCommandData(data)) # Remove the "Other." prefix def processCommand(self, command, args): if command == 'DOWNLOAD_STOP': YDStreamExtractor._cancelDownload() def getNextQueuedDownload(self): try: dataHEX = jsonqueue.XBMCJsonRAFifoQueue(util.QUEUE_FILE).pop() if not dataHEX: return None dataJSON = binascii.unhexlify(dataHEX) self.downloadCount += 1 util.LOG('Loading from queue. #{0} this session'.format(self.downloadCount)) return json.loads(dataJSON) except: import traceback traceback.print_exc() return None def start(self): if self.controller.status == 'ACTIVE': return try: self.controller.status = 'ACTIVE' self._start() finally: self.controller.status = '' def _start(self): util.LOG('DOWNLOAD SERVICE: START') info = self.getNextQueuedDownload() while info and not xbmc.abortRequested: t = threading.Thread(target=YDStreamExtractor._handleDownload, args=( info['data'],), kwargs={'path': info['path'], 'duration': info['duration'], 'bg': True}) t.start() while t.isAlive() and not xbmc.abortRequested: xbmc.sleep(100) info = self.getNextQueuedDownload() util.LOG('DOWNLOAD SERVICE: FINISHED') Service()
mrquim/mrquimrepo
script.module.youtube.dl/service.py
Python
gpl-2.0
2,091
----------------------------------------- -- ID: 5984 -- Item: Branch of Gnatbane -- Food Effect: 10 Mins, All Races ----------------------------------------- -- Poison 10HP / 3Tic ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,600,5984); if (target:hasStatusEffect(EFFECT_POISON) == false) then target:addStatusEffect(EFFECT_POISON,10,3,600); else target:messageBasic(423); end end;
UnknownX7/darkstar
scripts/globals/items/branch_of_gnatbane.lua
Lua
gpl-3.0
937
/* -*- c++ -*- */ /* * Copyright 2002 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef _QA_FILTER_H_ #define _QA_FILTER_H_ #include <cppunit/TestSuite.h> //! collect all the tests for the gr directory class qa_filter { public: //! return suite of tests for all of gr directory static CppUnit::TestSuite *suite (); }; #endif /* _QA_FILTER_H_ */
trnewman/VT-USRP-daughterboard-drivers
gnuradio-core/src/lib/filter/qa_filter.h
C
gpl-3.0
1,101
/* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ /** * Provides base implementation of StarCalc XML conversion to and from different * {@literal "Device"} {@code Document} formats. */ package org.openoffice.xmerge.converter.xml.sxc;
sbbic/core
xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/package-info.java
Java
gpl-3.0
1,005
/* aacgm.h ======= Author: R.J.Barnes */ /* LICENSE AND DISCLAIMER Copyright (c) 2012 The Johns Hopkins University/Applied Physics Laboratory This file is part of the Radar Software Toolkit (RST). RST is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. RST is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with RST. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _AACGM_H #define _AACGM_H int AACGMLoadCoefFP(FILE *fp); int AACGMLoadCoef(char *fname); int AACGMInit(int year); int AACGMConvert(double in_lat,double in_lon,double height, double *out_lat,double *out_lon,double *r, int flag); #endif
garimamalhotra/davitpy
models/aacgm/aacgm.h
C
gpl-3.0
1,103
/* * Register map access API internal header * * Copyright 2011 Wolfson Microelectronics plc * * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef _REGMAP_INTERNAL_H #define _REGMAP_INTERNAL_H #include <linux/regmap.h> #include <linux/fs.h> #include <linux/list.h> #include <linux/wait.h> struct regmap; struct regcache_ops; struct regmap_debugfs_off_cache { struct list_head list; off_t min; off_t max; unsigned int base_reg; unsigned int max_reg; }; struct regmap_format { size_t buf_size; size_t reg_bytes; size_t pad_bytes; size_t val_bytes; void (*format_write)(struct regmap *map, unsigned int reg, unsigned int val); void (*format_reg)(void *buf, unsigned int reg, unsigned int shift); void (*format_val)(void *buf, unsigned int val, unsigned int shift); unsigned int (*parse_val)(const void *buf); void (*parse_inplace)(void *buf); }; struct regmap_async { struct list_head list; struct regmap *map; void *work_buf; }; struct regmap { struct mutex mutex; spinlock_t spinlock; unsigned long spinlock_flags; regmap_lock lock; regmap_unlock unlock; void *lock_arg; /* This is passed to lock/unlock functions */ struct device *dev; /* Device we do I/O on */ void *work_buf; /* Scratch buffer used to format I/O */ struct regmap_format format; /* Buffer format */ const struct regmap_bus *bus; void *bus_context; const char *name; bool async; spinlock_t async_lock; wait_queue_head_t async_waitq; struct list_head async_list; struct list_head async_free; int async_ret; #ifdef CONFIG_DEBUG_FS struct dentry *debugfs; const char *debugfs_name; unsigned int debugfs_reg_len; unsigned int debugfs_val_len; unsigned int debugfs_tot_len; struct list_head debugfs_off_cache; struct mutex cache_lock; #endif unsigned int max_register; bool (*writeable_reg)(struct device *dev, unsigned int reg); bool (*readable_reg)(struct device *dev, unsigned int reg); bool (*volatile_reg)(struct device *dev, unsigned int reg); bool (*precious_reg)(struct device *dev, unsigned int reg); const struct regmap_access_table *wr_table; const struct regmap_access_table *rd_table; const struct regmap_access_table *volatile_table; const struct regmap_access_table *precious_table; int (*reg_read)(void *context, unsigned int reg, unsigned int *val); int (*reg_write)(void *context, unsigned int reg, unsigned int val); bool defer_caching; u8 read_flag_mask; u8 write_flag_mask; /* number of bits to (left) shift the reg value when formatting*/ int reg_shift; int reg_stride; /* regcache specific members */ const struct regcache_ops *cache_ops; enum regcache_type cache_type; /* number of bytes in reg_defaults_raw */ unsigned int cache_size_raw; /* number of bytes per word in reg_defaults_raw */ unsigned int cache_word_size; /* number of entries in reg_defaults */ unsigned int num_reg_defaults; /* number of entries in reg_defaults_raw */ unsigned int num_reg_defaults_raw; /* if set, only the cache is modified not the HW */ u32 cache_only; /* if set, only the HW is modified not the cache */ u32 cache_bypass; /* if set, remember to free reg_defaults_raw */ bool cache_free; struct reg_default *reg_defaults; const void *reg_defaults_raw; void *cache; /* if set, the cache contains newer data than the HW */ u32 cache_dirty; /* if set, the HW registers are known to match map->reg_defaults */ bool no_sync_defaults; struct reg_default *patch; int patch_regs; /* if set, converts bulk rw to single rw */ bool use_single_rw; struct rb_root range_tree; void *selector_work_buf; /* Scratch buffer used for selector */ }; struct regcache_ops { const char *name; enum regcache_type type; int (*init)(struct regmap *map); int (*exit)(struct regmap *map); int (*read)(struct regmap *map, unsigned int reg, unsigned int *value); int (*write)(struct regmap *map, unsigned int reg, unsigned int value); int (*sync)(struct regmap *map, unsigned int min, unsigned int max); int (*drop)(struct regmap *map, unsigned int min, unsigned int max); }; bool regmap_writeable(struct regmap *map, unsigned int reg); bool regmap_readable(struct regmap *map, unsigned int reg); bool regmap_volatile(struct regmap *map, unsigned int reg); bool regmap_precious(struct regmap *map, unsigned int reg); int _regmap_write(struct regmap *map, unsigned int reg, unsigned int val); struct regmap_range_node { struct rb_node node; const char *name; struct regmap *map; unsigned int range_min; unsigned int range_max; unsigned int selector_reg; unsigned int selector_mask; int selector_shift; unsigned int window_start; unsigned int window_len; }; struct regmap_field { struct regmap *regmap; unsigned int mask; /* lsb */ unsigned int shift; unsigned int reg; unsigned int id_size; unsigned int id_offset; }; #ifdef CONFIG_DEBUG_FS extern void regmap_debugfs_initcall(void); extern void regmap_debugfs_init(struct regmap *map, const char *name); extern void regmap_debugfs_exit(struct regmap *map); #else static inline void regmap_debugfs_initcall(void) { } static inline void regmap_debugfs_init(struct regmap *map, const char *name) { } static inline void regmap_debugfs_exit(struct regmap *map) { } #endif /* regcache core declarations */ int regcache_init(struct regmap *map, const struct regmap_config *config); void regcache_exit(struct regmap *map); int regcache_read(struct regmap *map, unsigned int reg, unsigned int *value); int regcache_write(struct regmap *map, unsigned int reg, unsigned int value); int regcache_sync(struct regmap *map); int regcache_sync_block(struct regmap *map, void *block, unsigned long *cache_present, unsigned int block_base, unsigned int start, unsigned int end); static inline const void *regcache_get_val_addr(struct regmap *map, const void *base, unsigned int idx) { return base + (map->cache_word_size * idx); } unsigned int regcache_get_val(struct regmap *map, const void *base, unsigned int idx); bool regcache_set_val(struct regmap *map, void *base, unsigned int idx, unsigned int val); int regcache_lookup_reg(struct regmap *map, unsigned int reg); int _regmap_raw_write(struct regmap *map, unsigned int reg, const void *val, size_t val_len); void regmap_async_complete_cb(struct regmap_async *async, int ret); extern struct regcache_ops regcache_rbtree_ops; extern struct regcache_ops regcache_lzo_ops; extern struct regcache_ops regcache_flat_ops; #endif
sdphome/UHF_Reader
linux-3.14.52/drivers/base/regmap/internal.h
C
gpl-3.0
6,699
/* If you use ICU in your program, then compile with -DHAVE_ICU -licui18n. If * you don't use ICU, then this will use the Google implementation from Chrome. * This has been modified from the original version to let you choose. */ // Copyright 2008, 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: // // * 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 Google Inc. 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. // Copied from strings/stringpiece.h with modifications // // A string-like object that points to a sized piece of memory. // // Functions or methods may use const StringPiece& parameters to accept either // a "const char*" or a "string" value that will be implicitly converted to // a StringPiece. The implicit conversion means that it is often appropriate // to include this .h file in other files rather than forward-declaring // StringPiece as would be appropriate for most other Google classes. // // Systematic usage of StringPiece is encouraged as it will reduce unnecessary // conversions from "const char*" to "string" and back again. // #ifndef BASE_STRING_PIECE_H__ #define BASE_STRING_PIECE_H__ #include "util/have.hh" #include <cstring> #include <iosfwd> #include <ostream> #ifdef HAVE_ICU #include <unicode/stringpiece.h> #include <unicode/uversion.h> // Old versions of ICU don't define operator== and operator!=. #if (U_ICU_VERSION_MAJOR_NUM < 4) || ((U_ICU_VERSION_MAJOR_NUM == 4) && (U_ICU_VERSION_MINOR_NUM < 4)) #warning You are using an old version of ICU. Consider upgrading to ICU >= 4.6. inline bool operator==(const StringPiece& x, const StringPiece& y) { if (x.size() != y.size()) return false; return std::memcmp(x.data(), y.data(), x.size()) == 0; } inline bool operator!=(const StringPiece& x, const StringPiece& y) { return !(x == y); } #endif // old version of ICU U_NAMESPACE_BEGIN #else #include <algorithm> #include <cstddef> #include <string> #include <string.h> #ifdef WIN32 #undef max #undef min #endif class StringPiece { public: typedef size_t size_type; private: const char* ptr_; size_type length_; public: // We provide non-explicit singleton constructors so users can pass // in a "const char*" or a "string" wherever a "StringPiece" is // expected. StringPiece() : ptr_(NULL), length_(0) { } StringPiece(const char* str) : ptr_(str), length_((str == NULL) ? 0 : strlen(str)) { } StringPiece(const std::string& str) : ptr_(str.data()), length_(str.size()) { } StringPiece(const char* offset, size_type len) : ptr_(offset), length_(len) { } // data() may return a pointer to a buffer with embedded NULs, and the // returned buffer may or may not be null terminated. Therefore it is // typically a mistake to pass data() to a routine that expects a NUL // terminated string. const char* data() const { return ptr_; } size_type size() const { return length_; } size_type length() const { return length_; } bool empty() const { return length_ == 0; } void clear() { ptr_ = NULL; length_ = 0; } void set(const char* data, size_type len) { ptr_ = data; length_ = len; } void set(const char* str) { ptr_ = str; length_ = str ? strlen(str) : 0; } void set(const void* data, size_type len) { ptr_ = reinterpret_cast<const char*>(data); length_ = len; } char operator[](size_type i) const { return ptr_[i]; } void remove_prefix(size_type n) { ptr_ += n; length_ -= n; } void remove_suffix(size_type n) { length_ -= n; } int compare(const StringPiece& x) const { int r = wordmemcmp(ptr_, x.ptr_, std::min(length_, x.length_)); if (r == 0) { if (length_ < x.length_) r = -1; else if (length_ > x.length_) r = +1; } return r; } std::string as_string() const { // std::string doesn't like to take a NULL pointer even with a 0 size. return std::string(!empty() ? data() : "", size()); } void CopyToString(std::string* target) const; void AppendToString(std::string* target) const; // Does "this" start with "x" bool starts_with(const StringPiece& x) const { return ((length_ >= x.length_) && (wordmemcmp(ptr_, x.ptr_, x.length_) == 0)); } // Does "this" end with "x" bool ends_with(const StringPiece& x) const { return ((length_ >= x.length_) && (wordmemcmp(ptr_ + (length_-x.length_), x.ptr_, x.length_) == 0)); } // standard STL container boilerplate typedef char value_type; typedef const char* pointer; typedef const char& reference; typedef const char& const_reference; typedef ptrdiff_t difference_type; static const size_type npos; typedef const char* const_iterator; typedef const char* iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; typedef std::reverse_iterator<iterator> reverse_iterator; iterator begin() const { return ptr_; } iterator end() const { return ptr_ + length_; } const_reverse_iterator rbegin() const { return const_reverse_iterator(ptr_ + length_); } const_reverse_iterator rend() const { return const_reverse_iterator(ptr_); } size_type max_size() const { return length_; } size_type capacity() const { return length_; } size_type copy(char* buf, size_type n, size_type pos = 0) const; size_type find(const StringPiece& s, size_type pos = 0) const; size_type find(char c, size_type pos = 0) const; size_type rfind(const StringPiece& s, size_type pos = npos) const; size_type rfind(char c, size_type pos = npos) const; size_type find_first_of(const StringPiece& s, size_type pos = 0) const; size_type find_first_of(char c, size_type pos = 0) const { return find(c, pos); } size_type find_first_not_of(const StringPiece& s, size_type pos = 0) const; size_type find_first_not_of(char c, size_type pos = 0) const; size_type find_last_of(const StringPiece& s, size_type pos = npos) const; size_type find_last_of(char c, size_type pos = npos) const { return rfind(c, pos); } size_type find_last_not_of(const StringPiece& s, size_type pos = npos) const; size_type find_last_not_of(char c, size_type pos = npos) const; StringPiece substr(size_type pos, size_type n = npos) const; static int wordmemcmp(const char* p, const char* p2, size_type N) { return memcmp(p, p2, N); } }; inline bool operator==(const StringPiece& x, const StringPiece& y) { if (x.size() != y.size()) return false; return std::memcmp(x.data(), y.data(), x.size()) == 0; } inline bool operator!=(const StringPiece& x, const StringPiece& y) { return !(x == y); } #endif // HAVE_ICU undefined inline bool operator<(const StringPiece& x, const StringPiece& y) { const int r = std::memcmp(x.data(), y.data(), std::min(x.size(), y.size())); return ((r < 0) || ((r == 0) && (x.size() < y.size()))); } inline bool operator>(const StringPiece& x, const StringPiece& y) { return y < x; } inline bool operator<=(const StringPiece& x, const StringPiece& y) { return !(x > y); } inline bool operator>=(const StringPiece& x, const StringPiece& y) { return !(x < y); } // allow StringPiece to be logged (needed for unit testing). inline std::ostream& operator<<(std::ostream& o, const StringPiece& piece) { return o.write(piece.data(), static_cast<std::streamsize>(piece.size())); } #ifdef HAVE_ICU U_NAMESPACE_END using U_NAMESPACE_QUALIFIER StringPiece; #endif #endif // BASE_STRING_PIECE_H__
vchahun/kenlm
util/string_piece.hh
C++
gpl-3.0
8,829
define(["dojo/_base/declare", "dojox/app/ViewBase", "dijit/form/Button"], function(declare, ViewBase, Button){ return declare([Button, ViewBase], { postscript: function(){ // we want to avoid kickin the Dijit lifecycle at ctor time so that definition has been mixed into the // widget when it is instanciated. This is only really needed if you need the definition }, _startup: function(){ this.create(); this.inherited(arguments); } }); } );
avz-cmf/zaboy-middleware
www/js/dojox/app/tests/customApp/WidgetView2.js
JavaScript
gpl-3.0
475
/* * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> * Copyright (c) 2015-2017 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "tests.h" #include <asm/unistd.h> #ifdef __NR_sendfile64 # include <assert.h> # include <errno.h> # include <fcntl.h> # include <stdio.h> # include <stdint.h> # include <stdlib.h> # include <unistd.h> # include <sys/socket.h> int main(void) { (void) close(0); if (open("/dev/zero", O_RDONLY) != 0) perror_msg_and_skip("open: %s", "/dev/zero"); int sv[2]; if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv)) perror_msg_and_skip("socketpair"); const unsigned int page_size = get_page_size(); assert(syscall(__NR_sendfile64, 0, 1, NULL, page_size) == -1); if (EBADF != errno) perror_msg_and_skip("sendfile64"); printf("sendfile64(0, 1, NULL, %u) = -1 EBADF (%m)\n", page_size); unsigned int file_size = 0; socklen_t optlen = sizeof(file_size); if (getsockopt(sv[1], SOL_SOCKET, SO_SNDBUF, &file_size, &optlen)) perror_msg_and_fail("getsockopt"); if (file_size < 1024) error_msg_and_skip("SO_SNDBUF too small: %u", file_size); file_size /= 4; if (file_size / 16 > page_size) file_size = page_size * 16; const unsigned int blen = file_size / 3; const unsigned int alen = file_size - blen; static const char fname[] = "sendfile64-tmpfile"; int reg_in = open(fname, O_RDWR | O_CREAT | O_TRUNC, 0600); if (reg_in < 0) perror_msg_and_fail("open: %s", fname); if (unlink(fname)) perror_msg_and_fail("unlink: %s", fname); if (ftruncate(reg_in, file_size)) perror_msg_and_fail("ftruncate: %s", fname); TAIL_ALLOC_OBJECT_CONST_PTR(uint64_t, p_off); void *p = p_off + 1; *p_off = 0; assert(syscall(__NR_sendfile64, 0, 1, p, page_size) == -1); printf("sendfile64(0, 1, %p, %u) = -1 EFAULT (%m)\n", p, page_size); assert(syscall(__NR_sendfile64, sv[1], reg_in, NULL, alen) == (long) alen); printf("sendfile64(%d, %d, NULL, %u) = %u\n", sv[1], reg_in, alen, alen); assert(syscall(__NR_sendfile64, sv[1], reg_in, p_off, alen) == (long) alen); printf("sendfile64(%d, %d, [0] => [%u], %u) = %u\n", sv[1], reg_in, alen, alen, alen); assert(syscall(__NR_sendfile64, sv[1], reg_in, p_off, file_size + 1) == (long) blen); printf("sendfile64(%d, %d, [%u] => [%u], %u) = %u\n", sv[1], reg_in, alen, file_size, file_size + 1, blen); *p_off = 0xcafef00dfacefeedULL; assert(syscall(__NR_sendfile64, sv[1], reg_in, p_off, 1) == -1); printf("sendfile64(%d, %d, [14627392582579060461], 1)" " = -1 EINVAL (%m)\n", sv[1], reg_in); *p_off = 0xfacefeed; assert(syscall(__NR_sendfile64, sv[1], reg_in, p_off, 1) == 0); printf("sendfile64(%d, %d, [4207869677], 1) = 0\n", sv[1], reg_in); puts("+++ exited with 0 +++"); return 0; } #else SKIP_MAIN_UNDEFINED("__NR_sendfile64") #endif
mgood7123/UPM
Sources/strace/tests/sendfile64.c
C
gpl-3.0
4,220
/* ** Ext.ux.upload.LogPanel.js for Ext.ux.upload ** ** Made by Gary van Woerkens ** Contact <gary@chewam.com> ** ** Started on Fri Jun 4 19:01:47 2010 Gary van Woerkens ** Last update Mon Jun 21 13:48:39 2010 Gary van Woerkens */ Ext.ns('Ext.ux.upload'); /** * @class Ext.ux.upload.LogPanel * @extends Ext.Panel * * @author Gary van Woerkens * @version 1.0 */ Ext.ux.upload.LogPanel = Ext.extend(Ext.Panel, { autoScroll:true ,cls:"x-upload-logpanel-toolbar" /** * @cfg {Ext.Template} progressTpl * The {@link Ext.Template template} used to display file {@link Ext.ProgressBar progress} messages. */ ,progressTpl:new Ext.Template( '<div ext:qtip="{msg}" class="x-progress-text-{type}">{text}</div>' ) /** * @cfg {String} lang * The language to display log panel messages (default to "en"). */ ,lang:"en" /** * @cfg {Object} langs * Available languages to load on init with {@link Ext.ux.upload.LogPanel#lang lang}. * <code><pre> ,langs:{ en:{ emptyListButtonTooltip:"Empty list" ,progressStatus:"Loading..." ,uploadComplete:"Upload complete" ,uploadingStatus:'Uploading {[count > 1 ? "files" : "file"]}' } ,fr:{ emptyListButtonTooltip:"vider la liste des téléchargements" ,progressStatus:"Chargement..." ,uploadComplete:"Envoi terminé " ,uploadingStatus:'Envoi {[count > 1 ? "des fichiers" : "du fichier"]}' } } * </code></pre> */ ,langs:{ en:{ emptyListButtonTooltip:"Empty list" ,progressStatus:"Loading..." ,uploadComplete:"Upload complete" ,uploadingStatus:'Uploading {[values.count > 1 ? "files" : "file"]}' } ,fr:{ emptyListButtonTooltip:"Vider la liste des téléchargements" ,progressStatus:"Chargement..." ,uploadComplete:"Envoi terminé " ,uploadingStatus:'Envoi {[values.count > 1 ? "des fichiers" : "du fichier"]}' } } /** * Array of Files in queue. * @type {Array} * @property queue */ ,initComponent:function() { this.queue = []; this.bodyStyle = "border:1px solid #99BBE8;background-color:#FFFFFF"; this.lang = this.langs[this.lang] || this.langs["en"]; this.uploadingStatus = new Ext.XTemplate(this.lang.uploadingStatus); this.bbar = new Ext.ux.StatusBar({ height:27 // ,style:"border:1px solid #99BBE8;" ,items:[{ iconCls:"icon-eraser" ,tooltip:this.lang.emptyListButtonTooltip ,scope:this ,handler:this.cleanLogPanel }] }); Ext.ux.upload.LogPanel.superclass.initComponent.call(this); this.on({added:this.bindContainer}); } /** * */ ,bindContainer:function(logpanel, ctn, index) { Ext.apply(ctn, { addProgress:this.addProgress.createDelegate(this) ,updateProgress:this.updateProgress.createDelegate(this) ,setStatus:this.setStatus.createDelegate(this) }); } /** * Removes all {@link Ext.ProgressBar progress} bars. */ ,cleanLogPanel:function() { this.removeAll(); } /** * Returns the {@link Ext.ux.StatusBar} where logs are displayed. * @return {Ext.ux.StatusBar} */ ,getStatusBar:function() { return this.getBottomToolbar(); } /** * Adds a {@link Ext.ProgressBar} to log panel. * @param {Object} file */ ,addProgress:function(file) { if (this.getProgress(file.id) === false) { var p = new Ext.ProgressBar({ text:this.progressTpl.apply({type:"loading", text:file.name}) ,isUploading:true ,style:"border-width:0 0 1px 0" // ,height:30 }); this.insert(0, p); this.doLayout(); this.queue.push({ id:file.id ,p:p }); } } /** * Updates a {@link Ext.ProgressBar progress} bar already added to log panel. * @param {Object} config The progress config */ ,updateProgress:function(config) { var toolbar = this.getStatusBar(), p = this.getProgress(config.file.id); p.updateProgress(config.progress, this.progressTpl.apply({ type:config.type ,text:config.file.name ,msg:config.msg })); if (config.type === "loading") { count = this.queue.length - this.getUploadingCount() + 1, msg = this.uploadingStatus.apply({count:this.queue.length}); } else if (config.type === "success" || config.type === "error") { config.type = "info"; p.isUploading = false; var count = this.queue.length - this.getUploadingCount(), msg = this.lang.uploadComplete; } this.setStatus(config.type, msg+" ("+count + "/" + this.queue.length+")"); } /** * Set global upload status. * Logs are displayed in the {@link Ext.ux.StatusBar bottom toolbar}. * @param {String} type Type of log can be "loading", "success" or "error" * @param {String} msg Message to log. */ ,setStatus:function(type, msg) { this.getStatusBar().setStatus({ text:msg ,iconCls:"x-status-"+type }); } /** * Returns the count of files in the {@link Ext.ux.upload.LogPanel#queue queue} * which are not uploaded yet. * @return {Number} */ ,getUploadingCount:function() { var count = 0; Ext.each(this.queue, function(item) { if (item.p.isUploading) count++; }); return count; } /** * Returns the {@link Ext.ProgressBar progress} bar from id. * @param {String} id The progress id */ ,getProgress:function(id) { var index = Ext.each(this.queue, function(item, index) { return !(item.id === id); }); return Ext.isDefined(index) ? this.queue[index].p : false; } }); Ext.reg('uploadlogspanel', Ext.ux.upload.LogPanel);
mbarto/mapstore
mapcomposer/app/static/externals/mapmanager/src/Ext.ux/Ext.ux.filebrowser/js/Ext.ux.upload/js/Ext.ux.upload.LogPanel.js
JavaScript
gpl-3.0
5,605
// Copyright (c) 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 "chrome/browser/extensions/api/identity/gaia_web_auth_flow.h" #include <vector> #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "content/public/test/test_browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" namespace extensions { class FakeWebAuthFlow : public WebAuthFlow { public: explicit FakeWebAuthFlow(WebAuthFlow::Delegate* delegate) : WebAuthFlow(delegate, NULL, GURL(), WebAuthFlow::INTERACTIVE) {} void Start() override {} }; class TestGaiaWebAuthFlow : public GaiaWebAuthFlow { public: TestGaiaWebAuthFlow(GaiaWebAuthFlow::Delegate* delegate, const ExtensionTokenKey* token_key, const std::string oauth2_client_id, GoogleServiceAuthError::State ubertoken_error_state) : GaiaWebAuthFlow(delegate, NULL, token_key, oauth2_client_id, "en-us"), ubertoken_error_(ubertoken_error_state) {} void Start() override { if (ubertoken_error_.state() == GoogleServiceAuthError::NONE) OnUbertokenSuccess("fake_ubertoken"); else OnUbertokenFailure(ubertoken_error_); } private: std::unique_ptr<WebAuthFlow> CreateWebAuthFlow(GURL url) override { return std::unique_ptr<WebAuthFlow>(new FakeWebAuthFlow(this)); } GoogleServiceAuthError ubertoken_error_; }; class MockGaiaWebAuthFlowDelegate : public GaiaWebAuthFlow::Delegate { public: MOCK_METHOD3(OnGaiaFlowFailure, void(GaiaWebAuthFlow::Failure failure, GoogleServiceAuthError service_error, const std::string& oauth_error)); MOCK_METHOD2(OnGaiaFlowCompleted, void(const std::string& access_token, const std::string& expiration)); }; class IdentityGaiaWebAuthFlowTest : public testing::Test { public: IdentityGaiaWebAuthFlowTest() : ubertoken_error_state_(GoogleServiceAuthError::NONE), fake_ui_thread_(content::BrowserThread::UI, &message_loop_) {} virtual void TearDown() { testing::Test::TearDown(); base::RunLoop loop; loop.RunUntilIdle(); // Run tasks so FakeWebAuthFlows get deleted. } std::unique_ptr<TestGaiaWebAuthFlow> CreateTestFlow() { ExtensionTokenKey token_key( "extension_id", "account_id", std::set<std::string>()); return std::unique_ptr<TestGaiaWebAuthFlow>(new TestGaiaWebAuthFlow( &delegate_, &token_key, "fake.client.id", ubertoken_error_state_)); } std::string GetFinalTitle(const std::string& fragment) { return std::string("Loading id.client.fake:/extension_id#") + fragment; } GoogleServiceAuthError GetNoneServiceError() { return GoogleServiceAuthError(GoogleServiceAuthError::NONE); } void set_ubertoken_error( GoogleServiceAuthError::State ubertoken_error_state) { ubertoken_error_state_ = ubertoken_error_state; } protected: testing::StrictMock<MockGaiaWebAuthFlowDelegate> delegate_; GoogleServiceAuthError::State ubertoken_error_state_; base::MessageLoop message_loop_; content::TestBrowserThread fake_ui_thread_; }; TEST_F(IdentityGaiaWebAuthFlowTest, OAuthError) { std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow(); flow->Start(); EXPECT_CALL(delegate_, OnGaiaFlowFailure( GaiaWebAuthFlow::OAUTH_ERROR, GoogleServiceAuthError(GoogleServiceAuthError::NONE), "access_denied")); flow->OnAuthFlowTitleChange(GetFinalTitle("error=access_denied")); } TEST_F(IdentityGaiaWebAuthFlowTest, Token) { std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow(); flow->Start(); EXPECT_CALL(delegate_, OnGaiaFlowCompleted("fake_access_token", "")); flow->OnAuthFlowTitleChange(GetFinalTitle("access_token=fake_access_token")); } TEST_F(IdentityGaiaWebAuthFlowTest, TokenAndExpiration) { std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow(); flow->Start(); EXPECT_CALL(delegate_, OnGaiaFlowCompleted("fake_access_token", "3600")); flow->OnAuthFlowTitleChange( GetFinalTitle("access_token=fake_access_token&expires_in=3600")); } TEST_F(IdentityGaiaWebAuthFlowTest, ExtraFragmentParametersSuccess) { std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow(); flow->Start(); EXPECT_CALL(delegate_, OnGaiaFlowCompleted("fake_access_token", "3600")); flow->OnAuthFlowTitleChange(GetFinalTitle("chaff1=stuff&" "expires_in=3600&" "chaff2=and&" "nonerror=fake_error&" "chaff3=nonsense&" "access_token=fake_access_token&" "chaff4=")); } TEST_F(IdentityGaiaWebAuthFlowTest, ExtraFragmentParametersError) { std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow(); flow->Start(); EXPECT_CALL(delegate_, OnGaiaFlowFailure( GaiaWebAuthFlow::OAUTH_ERROR, GoogleServiceAuthError(GoogleServiceAuthError::NONE), "fake_error")); flow->OnAuthFlowTitleChange(GetFinalTitle("chaff1=stuff&" "expires_in=3600&" "chaff2=and&" "error=fake_error&" "chaff3=nonsense&" "access_token=fake_access_token&" "chaff4=")); } TEST_F(IdentityGaiaWebAuthFlowTest, TitleSpam) { std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow(); flow->Start(); flow->OnAuthFlowTitleChange( "Loading https://extension_id.chromiumapp.org/#error=non_final_title"); flow->OnAuthFlowTitleChange("I'm feeling entitled."); flow->OnAuthFlowTitleChange(""); flow->OnAuthFlowTitleChange( "Loading id.client.fake:/bad_extension_id#error=non_final_title"); flow->OnAuthFlowTitleChange( "Loading bad.id.client.fake:/extension_id#error=non_final_title"); EXPECT_CALL(delegate_, OnGaiaFlowCompleted("fake_access_token", "")); flow->OnAuthFlowTitleChange(GetFinalTitle("access_token=fake_access_token")); } TEST_F(IdentityGaiaWebAuthFlowTest, EmptyFragment) { std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow(); flow->Start(); EXPECT_CALL( delegate_, OnGaiaFlowFailure( GaiaWebAuthFlow::INVALID_REDIRECT, GoogleServiceAuthError(GoogleServiceAuthError::NONE), "")); flow->OnAuthFlowTitleChange(GetFinalTitle("")); } TEST_F(IdentityGaiaWebAuthFlowTest, JunkFragment) { std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow(); flow->Start(); EXPECT_CALL( delegate_, OnGaiaFlowFailure( GaiaWebAuthFlow::INVALID_REDIRECT, GoogleServiceAuthError(GoogleServiceAuthError::NONE), "")); flow->OnAuthFlowTitleChange(GetFinalTitle("thisisjustabunchofjunk")); } TEST_F(IdentityGaiaWebAuthFlowTest, NoFragment) { std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow(); flow->Start(); // This won't be recognized as an interesting title. flow->OnAuthFlowTitleChange("Loading id.client.fake:/extension_id"); } TEST_F(IdentityGaiaWebAuthFlowTest, Host) { std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow(); flow->Start(); // These won't be recognized as interesting titles. flow->OnAuthFlowTitleChange( "Loading id.client.fake://extension_id#access_token=fake_access_token"); flow->OnAuthFlowTitleChange( "Loading id.client.fake://extension_id/#access_token=fake_access_token"); flow->OnAuthFlowTitleChange( "Loading " "id.client.fake://host/extension_id/#access_token=fake_access_token"); } TEST_F(IdentityGaiaWebAuthFlowTest, UbertokenFailure) { set_ubertoken_error(GoogleServiceAuthError::CONNECTION_FAILED); std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow(); EXPECT_CALL( delegate_, OnGaiaFlowFailure( GaiaWebAuthFlow::SERVICE_AUTH_ERROR, GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED), "")); flow->Start(); } TEST_F(IdentityGaiaWebAuthFlowTest, AuthFlowFailure) { std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow(); flow->Start(); EXPECT_CALL( delegate_, OnGaiaFlowFailure( GaiaWebAuthFlow::WINDOW_CLOSED, GoogleServiceAuthError(GoogleServiceAuthError::NONE), "")); flow->OnAuthFlowFailure(WebAuthFlow::WINDOW_CLOSED); } } // namespace extensions
geminy/aidear
oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/chrome/browser/extensions/api/identity/gaia_web_auth_flow_unittest.cc
C++
gpl-3.0
8,853
/* * jcmaster.h * * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1997, Thomas G. Lane. * mozjpeg Modifications: * Copyright (C) 2014, Mozilla Corporation. * For conditions of distribution and use, see the accompanying README file. * * This file contains the master control structures for the JPEG compressor. */ /* Private state */ typedef enum { main_pass, /* input data, also do first output step */ huff_opt_pass, /* Huffman code optimization pass */ output_pass, /* data output pass */ trellis_pass /* trellis quantization pass */ } c_pass_type; typedef struct { struct jpeg_comp_master pub; /* public fields */ c_pass_type pass_type; /* the type of the current pass */ int pass_number; /* # of passes completed */ int total_passes; /* total # of passes needed */ int scan_number; /* current index in scan_info[] */ /* fields for scan optimisation */ int pass_number_scan_opt_base; /* pass number where scan optimization begins */ unsigned char * scan_buffer[64]; /* buffer for a given scan */ unsigned long scan_size[64]; /* size for a given scan */ int actual_Al[64]; /* actual value of Al used for a scan */ unsigned long best_cost; /* bit count for best frequency split */ int best_freq_split_idx_luma; /* index for best frequency split (luma) */ int best_freq_split_idx_chroma; /* index for best frequency split (chroma) */ int best_Al_luma; /* best value for Al found in scan search (luma) */ int best_Al_chroma; /* best value for Al found in scan search (luma) */ boolean interleave_chroma_dc; /* indicate whether to interleave chroma DC scans */ struct jpeg_destination_mgr * saved_dest; /* saved value of cinfo->dest */ } my_comp_master; typedef my_comp_master * my_master_ptr;
cedewey/sol
wp-content/themes/gulp-dev/node_modules/mozjpeg/f47f5773-89ce-4b83-810e-48145ecc3389/jcmaster.h
C
gpl-3.0
1,903
/** * This Source Code Form is subject to the terms of the Mozilla Public License, * v. 2.0. If a copy of the MPL was not distributed with this file, You can * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. * * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS * graphic logo is a trademark of OpenMRS Inc. */ package org.openmrs; import org.openmrs.api.context.Context; import org.simpleframework.xml.Root; import org.springframework.util.StringUtils; import java.util.Locale; /** * ConceptStopWord is the real world term used to filter the words for indexing * from search phrase. Common words like 'and', 'if' are examples of this. It's * specific to locale. * * @since 1.8 */ @Root public class ConceptStopWord extends BaseOpenmrsObject implements java.io.Serializable { private static final long serialVersionUID = 3671020002642184656L; // Fields private Integer conceptStopWordId; private String value; private Locale locale; // Constructors /** * default constructor */ public ConceptStopWord() { } /** * Convenience constructor to create a ConceptStopWord object with default * locale English * * @param value */ public ConceptStopWord(String value) { this(value, Context.getLocale()); } /** * Convenience constructor to create a ConceptStopWord object with value and * locale * * @param value * @param local */ public ConceptStopWord(String value, Locale locale) { setValue(value); setLocale(locale); } public String getValue() { return value; } public void setValue(String value) { if (StringUtils.hasText(value)) { this.value = value.toUpperCase(); } } public Locale getLocale() { return locale; } public void setLocale(Locale locale) { this.locale = locale == null ? Context.getLocale() : locale; } public Integer getConceptStopWordId() { return conceptStopWordId; } public void setConceptStopWordId(Integer conceptStopWordId) { this.conceptStopWordId = conceptStopWordId; } public Integer getId() { return getConceptStopWordId(); } public void setId(Integer id) { setConceptStopWordId(id); } /** * @see Object#toString() */ @Override public String toString() { return "ConceptStopWord: " + this.value + ", Locale: " + locale; } }
milankarunarathne/openmrs-core
api/src/main/java/org/openmrs/ConceptStopWord.java
Java
mpl-2.0
2,428
<?php /** * @copyright Copyright (c) 2016, ownCloud, Inc. * * @author Joas Schilling <coding@schilljs.com> * @author Morris Jobke <hey@morrisjobke.de> * * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License, version 3, * along with this program. If not, see <http://www.gnu.org/licenses/> * */ namespace OC\Preview; //.psd class Photoshop extends Bitmap { /** * {@inheritDoc} */ public function getMimeType() { return '/application\/x-photoshop/'; } }
jbicha/server
lib/private/Preview/Photoshop.php
PHP
agpl-3.0
969
<html> <head> <link href="../../../Objects/sofa_white.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="contenu"> <center><h3>Creation of a Pendulum (2/8)</h3></center> <div id="orangeText">Description</div> <p>In the previous scene, no solver was present, so no simulation was done. In this step, we will add an <strong>ODE solver</strong> in the Root node of the simulation. We provide several ODE solvers, with different integration schemes. Take a look at our tutorials on Solvers later.</p> <div id="orangeText">Key points</div> <p>We will use the classic explicit euler solver <strong>EulerSolver</strong> to update particle positions and velocities at each time step. In SOFA, a solver acts on all the object placed below in the hierarchy. </p> <p><div id="tutorialAction">In the Modeler's <strong>Filter</strong> textbox, type "Euler". Click and drag the EulerSolver component over the <strong>root</strong> node. Press the <strong>Run in SOFA</strong> button. Press <strong>Animate</strong>.</div></p> <br><div id="orangeText">Results</div> <p> This time, when you animate the scene, the particule falls along the direction of the gravity.<br> The gravity is specified in the root node of the simulation. We use a default value of (0, 0, -9.81).</p> <p><div id="tutorialAction">In the Modeler scene graph, double click the root node.</div></p> <p>This opens the components for this node, and allows you to edit them. We won't make any changes for now.</p> <p><div id="tutorialAction"> Press <strong>OK</strong> to return to the Modeler window. </div></p> <p>Changing the gravity on child nodes of the simulation will not do anything as at each time step the gravity, and other parameters, (time, dt...) is overwritten using the value specified in the root node.<br> The component Gravity lets you specify a particular gravity for a node and all its children.</p> <p><div id="tutorialAction"> To see an example of this, type "Gravity" into the <strong>Filter</strong> textbox in the Modeler. Click on the <strong>Gravity</strong> component. In the top right section of the window, a description of the component will appear, with links to examples. Click on the links to open the example scene in the Modeler. When you are done, close the <strong>Gravity.scn</strong> tab to return to the tutorial scene. </div> </p> <br><center><h3><a href="0_Pendulum.scn">Previous</a> ____________ <a href="2_Pendulum.scn">Next</a></center></h3> </div> </body> </html>
FabienPean/sofa
examples/Tutorials/StepByStep/Pendulum/1_Pendulum.html
HTML
lgpl-2.1
2,735
/* * Webasyst CUSTOM theme family * * Shop-Script app CSS * (requires linking base custom.css file from the Site app) * * @link http://www.webasyst.com/ * @author Webasyst LLC * @copyright 2013 Webasyst LLC * @package Webasyst */ /* Misc layout and elements */ .sidebar { padding-top: 44px; } .sidebar.left300px { width: 270px; float: left; } .content.left300px { margin-left: 300px; } .sidebar.right300px { width: 270px; float: right; } .content.right300px { margin-right: 300px; } .sidebar p { line-height: 1.3em; } .breadcrumbs { padding: 5px 0 20px; } div.cart { background: #ceb; box-shadow: 0 -2px 9px -5px rgba(0,0,0,0.3); width: 240px; padding: 15px 15px 15px; } div.cart.fixed { overflow: hidden; position: fixed; top: 70px; z-index: 1312; box-shadow: 0 -2px 10px -5px rgba(0, 0, 0, 0.7) !important; } div.cart.fixed a { } .search { padding: 10px 0 20px; } .search input { font-size: 16px; width: 80%; } .currency-toggle { position: absolute; right: 165px; padding-top: 55px; } /* pulled-out currency selector */ .bonus { background: #ceb; padding: 2px 4px 1px; } .plugin { margin-bottom: 20px; } /* shipping and payment plugins ouput */ /* Homepage */ .promo { padding: 0; overflow: hidden; background: #fff; border-top: 1px solid #ccc; border-bottom: 1px solid #ccc; } .promo a { display: block; height: 500px; position: relative; } .promo a .image { position: absolute; right: 0; left: 0; top: 0; bottom: 0; } .promo a .image .corner.right { right: 30px; } .promo a .image .corner.top { top: 30px; } .promo a .image img { width: 100%; top: -30%; position: absolute; } .promo a .info { position: absolute; top: 10px; left: 30px; max-width: 60%; } .promo a .info h2 { font-size: 3em; font-weight: bold; color: #000; line-height: 1.5em; margin-bottom: 0; text-shadow: 0 0 9px #fff; } .promo a .info p { color: #555; font-size: 1.3em; text-shadow: 0 0 3px #fff; } .promo .bx-wrapper { margin: 0 auto; } .promo .bx-wrapper .bx-viewport { border: none; box-shadow: none; left: 0; } .promo .bx-wrapper .bx-pager, .promo .bx-wrapper .bx-controls-auto { bottom: 20px; } .promo .bx-wrapper .bx-controls-direction a { display: none; opacity: 0.7; } .promo:hover .bx-wrapper .bx-controls-direction a { display: block; } /* Category */ .sub-categories { margin-bottom: 20px; } .filters { background: #eed; width: 240px; padding: 15px; float: right; } .filters input[type="text"] { font-size: 0.9em; width: 50px; text-align: right; } /* Product info and lists */ .tags a { color: green; } .tags.cloud { text-align: center; font-size: 0.9em; padding-top: 20px; margin-top: 30px; border-top: 1px solid #ccc; } ul.skus { padding-left: 0; } ul.skus li { list-style: none; } .stocks { margin-top: 10px; margin-bottom: 15px; font-size: 0.9em; } .stocks .stock-critical { color: #e00; } .stocks .stock-low { color: #a80; } .stocks .stock-high { color: #0a0; } .stocks .stock-none { color: #aaa; } .stocks .icon16 { margin-top: 0.05em; } ul.menu-h.sorting { margin-left: 0; } ul.menu-h.sorting li { padding-right: 5px; } i.sort-desc { height: 0; width: 0; border: 4px solid transparent; border-bottom-color: #000; margin-bottom: 0.2em; display: inline-block; display: block\9; float: left\9; } i.sort-asc { height: 0; width: 0; border: 4px solid transparent; border-top-color: #000; margin-top: 0; display: inline-block; display: block\9; float: left\9; } .price { color: #a00; font-weight: bold; } .compare-at-price { text-decoration: line-through; color: #c66; margin: 0 3px; } .out-of-stock { color: #a77; } .disabled { color: #777; } .description { margin-bottom: 20px; } .error { color: #a33; } .rating i.icon16 { margin-right: 0.13em; } h1 .rating i.icon16 { margin-top: 0.37em; } table.compare { width: 100%; } table.compare td { text-align: center; line-height: 1em; padding: 10px 2px; } table.compare th { text-align: left; } table.compare td img { display: block; margin: 0 auto 10px; } ul.thumbs { padding: 0; margin: 0; } ul.thumbs li { display:inline-block; vertical-align:top; padding: 0; margin: 0 30px 40px 0px; position: relative; display: block\9; float: left\9; /* IE8- hack */ } ul.thumbs img { margin-bottom: 2px; display: block; } ul.thumbs img.overhanging { position: absolute; left: -20px; } ul.thumbs i.icon16.overhanging { position: absolute; left: -20px; margin: 0; top: 2px; } ul.thumbs i.icon10.overhanging { position: absolute; margin-left: -17px; margin-right: 7px; } ul.thumbs input { margin: 0 3px 0 0 /* for correct checkbox display */; } ul.thumbs.li50px li { width: 50px; } /* fixed li width options */ ul.thumbs.li100px li { width: 100px; } ul.thumbs.li150px li { width: 150px; } ul.thumbs.li200px li { width: 200px; } ul.thumbs.li250px li { width: 250px; } ul.thumbs.li300px li { width: 300px; } ul.thumbs.li350px li { width: 350px; } ul.thumbs li a { font-weight: bold; } ul.thumbs li p { margin-bottom: 0; } ul.thumbs li.selected { /* nothing! */ } ul.thumbs li.selected img { border: 4px solid #FDDA3B; margin: -4px -2px -2px -4px; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } ul.thumbs li.highlighted { background: inherit; } ul.thumbs li.highlighted img { -moz-box-shadow: 0px 0px 10px #fe2; -webkit-box-shadow: 0px 0px 10px #fe2; box-shadow: 0px 0px 10px #fe2; } table.table { margin-top: 25px; margin-left: -10px; width: 100%; border-spacing:0; border-collapse:collapse; } table.table th { padding-left: 7px; padding-right: 7px; } table.table td { padding: 15px 7px; border-bottom: 1px solid #ddd; } table.table td.min-width { width: 1%; } table.table td p { margin: 0; } table.table td input.numerical { width: 50px; margin-right: 5px; text-align: right; } table.table tr.no-border td { border: none; } table.table tr.thin td { padding-top: 13px; padding-bottom: 0; } table.table tr.service td { padding-top: 5px; padding-bottom: 5px; padding-left: 25px; font-size: 0.8em; color: #555; } .related table.table { margin-top: 10px; } .related table.table td { padding: 10px 7px 15px; border: none; } .related h3 input { font-size: 14px; } .image { position: relative; display: inline-block; max-width: 100%; display: block\9; /* IE8- hack */ } .image img { max-width: 100%; height: auto; } .image .corner { position: absolute; z-index:10; font-size: 0.8em; color: #fff; font-weight: bold; } .image .corner.top { top:-5px; } .image .corner.bottom { bottom:-5px; } .image .corner.left { left:-8px; } .image .corner.right { right:-8px; } .gallery .image { float: left\9; /* IE8 */ } .badge { display: table; background: #fff; border-radius: 50%; border: 4px double rgba(0,0,0,0.3); width: 100px; height: 100px; transform: rotate(-13deg); -webkit-transform: rotate(-13deg); -moz-transform: rotate(-13deg); -o-transform: rotate(-13deg); box-shadow: 0 3px 10px rgba(0,0,0,0.3); color: #000; font-weight: bold; font-style: italic; font-size: 1.6em; padding: 11px 13px 15px; } .badge span { display: table-cell; vertical-align: middle; text-align: center; line-height: 1.2em; } .badge.new { background: #ff4; color: #000; } .badge.bestseller { background: #74ff30; color: #030; } .badge.low-price { background: #ffc2e3; color: #300; } ul.thumbs .badge { font-size: 1.05em; width: 70px; height: 70px; padding: 2px; } ul.thumbs .badge span { width: 68px; margin-top: 28px; overflow: hidden; } table.table { margin: 20px 0; } table.table .image { margin-right: 10px; width: 48px; } table.table .badge { font-size: 0.8em; width: 24px; height: 24px; padding: 3px 3px 4px; border: 0; } table.table .badge span { display: block; width: 20px; overflow: hidden; padding-top: 6px; padding-left: 3px; } table.cart td { vertical-align: top; padding: 20px 7px 25px; } table.cart td input.qty { max-width: 50px; text-align: right; } table.cart td.total { font-size: 1.3em; } .services { margin-bottom: 20px; } .add2cart { margin-bottom: 20px; } .aux { padding: 15px; font-size: 0.9em; } table.features td { padding: 1px 0 4px; } table.features td.name { min-width: 145px; color: #777; vertical-align: top; } /* Checkout */ .checkout { margin: 30px 100px 100px; } .checkout ul.checkout-navigation { margin-bottom: 30px; text-align: center; } .checkout ul.checkout-navigation li.upcoming a { text-decoration: none; color: #aaa !important; cursor: default; } .checkout ul.checkout-options { padding-left: 25px; } .checkout ul.checkout-options li { list-style: none; position: relative; margin-bottom: 30px; width: 80%; clear: both; } .checkout ul.checkout-options li h3 { margin-bottom: 0.1em; } .checkout ul.checkout-options li h3 label { display: inline-block; margin-right: 10px; } .checkout ul.checkout-options li .rate { float: right; text-align: center; min-width: 250px; } .checkout ul.checkout-options li p { width: 70%; } .checkout ul.checkout-options li input[type="radio"] { position: absolute; top: 7px; left: -25px; } .checkout .checkout-result { margin: 100px auto 200px; text-align: center; } .checkout .checkout-result h1 { font-size: 4em; margin-bottom: 50px; } .checkout .checkout-result.error h1 { color: red; } .checkout .checkout-result .wa-form { margin: 10px auto 20px; width: 400px; float: none; } .checkout .checkout-result .back { margin-top: 50px; } .checkout .checkout-step { } .checkout .comment { width: 100%; height: 100px; margin-bottom: 20px; } .checkout blockquote img { margin-right: 20px; float: left; } .checkout blockquote p { color: #000; margin-bottom: 0; } /* Product reviews */ .write-review { margin: 30px 0 40px; } .review { margin-bottom: 30px; } .review .summary { font-size: 0.9em; color: #777; } .review .summary h6 { color: #000; font-size: 1.1em; } .review .summary a.username { color: #777; } .review .summary a.username:hover { color: red; } .review .summary a { display: inline; padding: 0; } .review .summary .date { color:#aaa; } .review p { margin-top: 5px; margin-bottom: 5px; line-height: 1.3em; } .review .actions a { padding: 0 !important; } .reviews { margin-bottom: 20px; } .reviews ul { margin-left: 0; } .reviews ul li ul { padding-left: 25px; } .reviews ul li ul li .review h6 { color: #555; } .reviews ul li .review-form { padding: 10px 30px; } .reviews ul li .review-form textarea { min-height: 100px; } .reviews ul.menu-h.auth-type { padding: 0 0 40px; margin-left: -5px; } .reviews ul.menu-h.auth-type li { padding-right: 10px; } .reviews ul.menu-h.auth-type li a { padding: 5px 6px; } .reviews ul.menu-h.auth-type li a img { top: 0; } .reviews textarea { height: 100px; min-height: 100px; width: 75%; margin-top: 0; } .review-form { padding: 0; margin-bottom: 30px; } .review-form h4 { margin: 0 0 20px; font-weight: normal; } .review-form-fields p { margin: 0 0 10px; } .review-form-fields p.review-field a { display: inline; padding: 0; } .review-form-fields label { width: 160px; display: block; clear: left; float: left; margin: 0 10px 0 0; color: #aaa;} .review-form-fields input[type="text"] { width: 20em;} .review-form textarea { min-width: 70%; min-height: 160px; } .review-form .review-submit { padding:0 0 20px 170px;} .review-form .userpic { width: 20px; height: 20px; float: left; margin-right: 5px; } .review-form ul.menu-h.auth-type li a img { float: left; margin-right: 3px; position: relative; top: 2px; } .review-form ul.menu-h.auth-type { padding-bottom: 20px; } .review-form label { width: 160px; display: block; clear: left; float: left; margin: 0 10px 0 0; color: #AAA; } .reviews span.rate { line-height: 1.3em; display: block; margin: 0.5em 0; } .reviews span.rate a { text-decoration: none !important; } .reviews span.rate .icon10 { background-repeat: no-repeat; background-image: url(../../../../wa-content/img/icon10.png); height: 10px; width: 10px; display: inline-block; text-indent: -9999px; } .reviews span.rate .icon10.star { background-position: -60px -40px; } .reviews span.rate .icon10.star-empty { background-position: -80px -40px; } input.error, textarea.error { border: 2px solid red; } .errormsg { color: red; margin-left: 170px; display: block; } /* Customer account */ .order-status { padding: 2px 5px; color: #fff; } h1 .order-status { font-size: 0.75em; margin-left: 10px; } /* Shop-Script icons */ .icon16.star, .icon16.star-full { background-image: url("img/icons.png"); background-position:-16px 0; } .icon16.star-half { background-image: url("img/icons.png"); background-position:-32px 0; } .icon16.star-empty { background-image: url("img/icons.png"); background-position:-48px 0; } .icon16.star-hover { background-image: url("img/icons.png"); background-position:-64px 0; } .icon10.star, .icon10.star-full { background-image: url("img/icons.png"); background-position:0 -16px; } .icon10.star-half { background-image: url("img/icons.png"); background-position:-10px -16px; } .icon10.star-empty { background-image: url("img/icons.png"); background-position:-20px -16px; } .icon16.remove { background-image: url("img/icons.png"); background-position:-96px 0; } .icon16.saved { background-image: url("img/icons.png"); background-position:-112px 0; } .icon16.stock-red { background-image: url("img/icons.png"); background-position:-128px 0; } .icon16.stock-yellow { background-image: url("img/icons.png"); background-position:-144px 0; } .icon16.stock-green { background-image: url("img/icons.png"); background-position:-160px 0; } .icon16.stock-transparent { background-image: url("img/icons.png"); background-position:-176px 0; }
dmitriyzhdankin/fonaricmarket
wa-data/public/shop/themes/old/custom.shop.css
CSS
lgpl-3.0
13,594
# Change Log All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. <a name="1.2.1"></a> ## [1.2.1](https://github.com/developit/mitt/compare/v1.1.3...v1.2.1) (2019-10-21) <a name="1.1.3"></a> ## [1.1.3](https://github.com/developit/mitt/compare/v1.1.2...v1.1.3) (2017-12-07) <a name="1.1.2"></a> ## [1.1.2](https://github.com/developit/mitt/compare/v1.1.1...v1.1.2) (2017-04-17) ### Bug Fixes * **builds:** point `jsnext:main` to the ESM build instead of src, which contains things like Flowtype annotations that are not stripped by most build tools ([0cad092](https://github.com/developit/mitt/commit/0cad092)) <a name="1.1.1"></a> ## [1.1.1](https://github.com/developit/mitt/compare/1.1.0...1.1.1) (2017-04-15)
BigBoss424/portfolio
v8/development/node_modules/mitt/CHANGELOG.md
Markdown
apache-2.0
849
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import 'rxjs/add/operator/map'; import 'rxjs/add/operator/toPromise'; import { forkJoin } from 'rxjs/observable/forkJoin'; import { fromPromise } from 'rxjs/observable/fromPromise'; export function resolve(resolver, state) { return resolveNode(resolver, state._root).map(_ => state); } function resolveNode(resolver, node) { if (node.children.length === 0) { return fromPromise(resolveComponent(resolver, node.value).then(factory => { node.value._resolvedComponentFactory = factory; return node.value; })); } else { const c = node.children.map(c => resolveNode(resolver, c).toPromise()); return forkJoin(c).map(_ => resolveComponent(resolver, node.value).then(factory => { node.value._resolvedComponentFactory = factory; return node.value; })); } } function resolveComponent(resolver, snapshot) { if (snapshot.component && snapshot._routeConfig && typeof snapshot.component === 'string') { return resolver.resolveComponent(snapshot.component); } else { return Promise.resolve(null); } } //# sourceMappingURL=resolve.js.map
oleksandr-minakov/northshore
ui/node_modules/@angular/router/esm/src/resolve.js
JavaScript
apache-2.0
1,365
/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ package org.elasticsearch.index; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.common.UUIDs; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.xcontent.ToXContent; import org.elasticsearch.xcontent.XContentBuilder; import org.elasticsearch.xcontent.XContentParser; import org.elasticsearch.xcontent.json.JsonXContent; import java.io.IOException; import static org.apache.lucene.util.TestUtil.randomSimpleString; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.not; public class IndexTests extends ESTestCase { public void testToString() { assertEquals("[name/uuid]", new Index("name", "uuid").toString()); assertEquals("[name]", new Index("name", ClusterState.UNKNOWN_UUID).toString()); Index random = new Index( randomSimpleString(random(), 1, 100), usually() ? UUIDs.randomBase64UUID(random()) : ClusterState.UNKNOWN_UUID ); assertThat(random.toString(), containsString(random.getName())); if (ClusterState.UNKNOWN_UUID.equals(random.getUUID())) { assertThat(random.toString(), not(containsString(random.getUUID()))); } else { assertThat(random.toString(), containsString(random.getUUID())); } } public void testXContent() throws IOException { final String name = randomAlphaOfLengthBetween(4, 15); final String uuid = UUIDs.randomBase64UUID(); final Index original = new Index(name, uuid); final XContentBuilder builder = JsonXContent.contentBuilder(); original.toXContent(builder, ToXContent.EMPTY_PARAMS); try (XContentParser parser = createParser(JsonXContent.jsonXContent, BytesReference.bytes(builder))) { parser.nextToken(); // the beginning of the parser assertThat(Index.fromXContent(parser), equalTo(original)); } } public void testEquals() { Index index1 = new Index("a", "a"); Index index2 = new Index("a", "a"); Index index3 = new Index("a", "b"); Index index4 = new Index("b", "a"); String s = "Some random other object"; assertEquals(index1, index1); assertEquals(index1, index2); assertNotEquals(index1, null); assertNotEquals(index1, s); assertNotEquals(index1, index3); assertNotEquals(index1, index4); } }
GlenRSmith/elasticsearch
server/src/test/java/org/elasticsearch/index/IndexTests.java
Java
apache-2.0
2,875
/* @flow */ // These util functions are split into its own file because Rollup cannot drop // makeMap() due to potential side effects, so these variables end up // bloating the web builds. import { makeMap, noop } from 'shared/util' export const isReservedTag = makeMap( 'template,script,style,element,content,slot,link,meta,svg,view,' + 'a,div,img,image,text,span,input,switch,textarea,spinner,select,' + 'slider,slider-neighbor,indicator,canvas,' + 'list,cell,header,loading,loading-indicator,refresh,scrollable,scroller,' + 'video,web,embed,tabbar,tabheader,datepicker,timepicker,marquee,countdown', true ) // Elements that you can, intentionally, leave open (and which close themselves) // more flexible than web export const canBeLeftOpenTag = makeMap( 'web,spinner,switch,video,textarea,canvas,' + 'indicator,marquee,countdown', true ) export const isRuntimeComponent = makeMap( 'richtext,transition,transition-group', true ) export const isUnaryTag = makeMap( 'embed,img,image,input,link,meta', true ) export function mustUseProp (): boolean { return false } export function getTagNamespace (): void { } export function isUnknownElement (): boolean { return false } export function query (el: string | Element, document: Object) { // document is injected by weex factory wrapper const placeholder = document.createComment('root') placeholder.hasAttribute = placeholder.removeAttribute = noop // hack for patch document.documentElement.appendChild(placeholder) return placeholder }
BigBoss424/portfolio
v6/node_modules/vue/src/platforms/weex/util/element.js
JavaScript
apache-2.0
1,538
package org.apache.solr.spelling.suggest; /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ public interface SuggesterParams { public static final String SUGGEST_PREFIX = "suggest."; /** * The name of the dictionary to be used for giving the suggestion for a * request. The value for this parameter is configured in solrconfig.xml */ public static final String SUGGEST_DICT = SUGGEST_PREFIX + "dictionary"; /** * The count of suggestions to return for each query term not in the index and/or dictionary. * <p/> * If this parameter is absent in the request then only one suggestion is * returned. If it is more than one then a maximum of given suggestions are * returned for each token in the query. */ public static final String SUGGEST_COUNT = SUGGEST_PREFIX + "count"; /** * Use the value for this parameter as the query to spell check. * <p/> * This parameter is <b>optional</b>. If absent, then the q parameter is * used. */ public static final String SUGGEST_Q = SUGGEST_PREFIX + "q"; /** * Whether to build the index or not. Optional and false by default. */ public static final String SUGGEST_BUILD = SUGGEST_PREFIX + "build"; /** * Whether to build the index or not for all suggesters in the component. * Optional and false by default. * This parameter does not need any suggest dictionary names to be specified */ public static final String SUGGEST_BUILD_ALL = SUGGEST_PREFIX + "buildAll"; /** * Whether to reload the index. Optional and false by default. */ public static final String SUGGEST_RELOAD = SUGGEST_PREFIX + "reload"; /** * Whether to reload the index or not for all suggesters in the component. * Optional and false by default. * This parameter does not need any suggest dictionary names to be specified */ public static final String SUGGEST_RELOAD_ALL = SUGGEST_PREFIX + "reloadAll"; }
williamchengit/TestRepo
solr/core/src/java/org/apache/solr/spelling/suggest/SuggesterParams.java
Java
apache-2.0
2,682
// Copyright 2007-2012 Chris Patterson, Dru Sellers, Travis Smith, et. al. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software distributed // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR // CONDITIONS OF ANY KIND, either express or implied. See the License for the // specific language governing permissions and limitations under the License. namespace Topshelf.Runtime.Windows { public class RunProgramRecoveryAction : ServiceRecoveryAction { public RunProgramRecoveryAction(int delay, string command) : base(delay) { Command = command; } public string Command { get; private set; } public override NativeMethods.SC_ACTION GetAction() { return new NativeMethods.SC_ACTION { Delay = Delay, Type = (int)NativeMethods.SC_ACTION_TYPE.RunCommand, }; } } }
phatboyg/Topshelf
src/Topshelf/Runtime/Windows/RunProgramRecoveryAction.cs
C#
apache-2.0
1,269
using System; using System.Collections.Generic; using System.ComponentModel.Composition; using System.Globalization; using System.Linq; using System.Reflection; namespace NuGet { [Export(typeof(ICommandManager))] public class CommandManager : ICommandManager { private readonly IList<ICommand> _commands = new List<ICommand>(); public IEnumerable<ICommand> GetCommands() { return _commands; } public ICommand GetCommand(string commandName) { if (String.IsNullOrEmpty(commandName)) { throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, commandName); } IEnumerable<ICommand> results = from command in _commands where command.CommandAttribute.CommandName.StartsWith(commandName, StringComparison.OrdinalIgnoreCase) || (command.CommandAttribute.AltName ?? String.Empty).StartsWith(commandName, StringComparison.OrdinalIgnoreCase) select command; if (!results.Any()) { throw new CommandLineException(LocalizedResourceManager.GetString("UnknowCommandError"), commandName); } var matchedCommand = results.First(); if (results.Skip(1).Any()) { // Were there more than one results found? matchedCommand = results.FirstOrDefault(c => c.CommandAttribute.CommandName.Equals(commandName, StringComparison.OrdinalIgnoreCase) || commandName.Equals(c.CommandAttribute.AltName, StringComparison.OrdinalIgnoreCase)); if (matchedCommand == null) { // No exact match was found and the result returned multiple prefixes. throw new CommandLineException(String.Format(CultureInfo.CurrentCulture, LocalizedResourceManager.GetString("AmbiguousCommand"), commandName, String.Join(" ", from c in results select c.CommandAttribute.CommandName))); } } return matchedCommand; } public IDictionary<OptionAttribute, PropertyInfo> GetCommandOptions(ICommand command) { var result = new Dictionary<OptionAttribute, PropertyInfo>(); foreach (PropertyInfo propInfo in command.GetType().GetProperties()) { if (!command.IncludedInHelp(propInfo.Name)) { continue; } foreach (OptionAttribute attr in propInfo.GetCustomAttributes(typeof(OptionAttribute), inherit: true)) { if (!propInfo.CanWrite && !TypeHelper.IsMultiValuedProperty(propInfo)) { // If the property has neither a setter nor is of a type that can be cast to ICollection<> then there's no way to assign // values to it. In this case throw. throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, LocalizedResourceManager.GetString("OptionInvalidWithoutSetter"), command.GetType().FullName + "." + propInfo.Name)); } result.Add(attr, propInfo); } } return result; } public void RegisterCommand(ICommand command) { var attrib = command.CommandAttribute; if (attrib != null) { _commands.Add(command); } } } }
mrward/NuGet.V2
src/V3/NuGet.Client.CommandLine/Common/CommandManager.cs
C#
apache-2.0
3,714
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.ignite.internal.util.typedef; import org.apache.ignite.internal.util.lang.*; /** * Defines {@code alias} for {@link GridAbsClosureX} by extending it. Since Java doesn't provide type aliases * (like Scala, for example) we resort to these types of measures. This is intended to provide for more * concise code in cases when readability won't be sacrificed. For more information see {@link GridAbsClosureX}. * @see GridFunc * @see GridAbsClosureX */ public abstract class CAX extends GridAbsClosureX { /** */ private static final long serialVersionUID = 0L; }
akuznetsov-gridgain/ignite
modules/core/src/main/java/org/apache/ignite/internal/util/typedef/CAX.java
Java
apache-2.0
1,396
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.spark.ml.feature import org.apache.hadoop.fs.Path import org.apache.spark.annotation.Since import org.apache.spark.ml.{Estimator, Model} import org.apache.spark.ml.linalg.{BLAS, Vector, Vectors, VectorUDT} import org.apache.spark.ml.param._ import org.apache.spark.ml.param.shared._ import org.apache.spark.ml.util._ import org.apache.spark.mllib.feature import org.apache.spark.mllib.linalg.VectorImplicits._ import org.apache.spark.sql.{DataFrame, Dataset, SparkSession} import org.apache.spark.sql.functions._ import org.apache.spark.sql.types._ /** * Params for [[Word2Vec]] and [[Word2VecModel]]. */ private[feature] trait Word2VecBase extends Params with HasInputCol with HasOutputCol with HasMaxIter with HasStepSize with HasSeed { /** * The dimension of the code that you want to transform from words. * Default: 100 * @group param */ final val vectorSize = new IntParam( this, "vectorSize", "the dimension of codes after transforming from words (> 0)", ParamValidators.gt(0)) setDefault(vectorSize -> 100) /** @group getParam */ def getVectorSize: Int = $(vectorSize) /** * The window size (context words from [-window, window]). * Default: 5 * @group expertParam */ final val windowSize = new IntParam( this, "windowSize", "the window size (context words from [-window, window]) (> 0)", ParamValidators.gt(0)) setDefault(windowSize -> 5) /** @group expertGetParam */ def getWindowSize: Int = $(windowSize) /** * Number of partitions for sentences of words. * Default: 1 * @group param */ final val numPartitions = new IntParam( this, "numPartitions", "number of partitions for sentences of words (> 0)", ParamValidators.gt(0)) setDefault(numPartitions -> 1) /** @group getParam */ def getNumPartitions: Int = $(numPartitions) /** * The minimum number of times a token must appear to be included in the word2vec model's * vocabulary. * Default: 5 * @group param */ final val minCount = new IntParam(this, "minCount", "the minimum number of times a token must " + "appear to be included in the word2vec model's vocabulary (>= 0)", ParamValidators.gtEq(0)) setDefault(minCount -> 5) /** @group getParam */ def getMinCount: Int = $(minCount) /** * Sets the maximum length (in words) of each sentence in the input data. * Any sentence longer than this threshold will be divided into chunks of * up to `maxSentenceLength` size. * Default: 1000 * @group param */ final val maxSentenceLength = new IntParam(this, "maxSentenceLength", "Maximum length " + "(in words) of each sentence in the input data. Any sentence longer than this threshold will " + "be divided into chunks up to the size (> 0)", ParamValidators.gt(0)) setDefault(maxSentenceLength -> 1000) /** @group getParam */ def getMaxSentenceLength: Int = $(maxSentenceLength) setDefault(stepSize -> 0.025) setDefault(maxIter -> 1) /** * Validate and transform the input schema. */ protected def validateAndTransformSchema(schema: StructType): StructType = { val typeCandidates = List(new ArrayType(StringType, true), new ArrayType(StringType, false)) SchemaUtils.checkColumnTypes(schema, $(inputCol), typeCandidates) SchemaUtils.appendColumn(schema, $(outputCol), new VectorUDT) } } /** * Word2Vec trains a model of `Map(String, Vector)`, i.e. transforms a word into a code for further * natural language processing or machine learning process. */ @Since("1.4.0") final class Word2Vec @Since("1.4.0") ( @Since("1.4.0") override val uid: String) extends Estimator[Word2VecModel] with Word2VecBase with DefaultParamsWritable { @Since("1.4.0") def this() = this(Identifiable.randomUID("w2v")) /** @group setParam */ @Since("1.4.0") def setInputCol(value: String): this.type = set(inputCol, value) /** @group setParam */ @Since("1.4.0") def setOutputCol(value: String): this.type = set(outputCol, value) /** @group setParam */ @Since("1.4.0") def setVectorSize(value: Int): this.type = set(vectorSize, value) /** @group expertSetParam */ @Since("1.6.0") def setWindowSize(value: Int): this.type = set(windowSize, value) /** @group setParam */ @Since("1.4.0") def setStepSize(value: Double): this.type = set(stepSize, value) /** @group setParam */ @Since("1.4.0") def setNumPartitions(value: Int): this.type = set(numPartitions, value) /** @group setParam */ @Since("1.4.0") def setMaxIter(value: Int): this.type = set(maxIter, value) /** @group setParam */ @Since("1.4.0") def setSeed(value: Long): this.type = set(seed, value) /** @group setParam */ @Since("1.4.0") def setMinCount(value: Int): this.type = set(minCount, value) /** @group setParam */ @Since("2.0.0") def setMaxSentenceLength(value: Int): this.type = set(maxSentenceLength, value) @Since("2.0.0") override def fit(dataset: Dataset[_]): Word2VecModel = { transformSchema(dataset.schema, logging = true) val input = dataset.select($(inputCol)).rdd.map(_.getAs[Seq[String]](0)) val wordVectors = new feature.Word2Vec() .setLearningRate($(stepSize)) .setMinCount($(minCount)) .setNumIterations($(maxIter)) .setNumPartitions($(numPartitions)) .setSeed($(seed)) .setVectorSize($(vectorSize)) .setWindowSize($(windowSize)) .setMaxSentenceLength($(maxSentenceLength)) .fit(input) copyValues(new Word2VecModel(uid, wordVectors).setParent(this)) } @Since("1.4.0") override def transformSchema(schema: StructType): StructType = { validateAndTransformSchema(schema) } @Since("1.4.1") override def copy(extra: ParamMap): Word2Vec = defaultCopy(extra) } @Since("1.6.0") object Word2Vec extends DefaultParamsReadable[Word2Vec] { @Since("1.6.0") override def load(path: String): Word2Vec = super.load(path) } /** * Model fitted by [[Word2Vec]]. */ @Since("1.4.0") class Word2VecModel private[ml] ( @Since("1.4.0") override val uid: String, @transient private val wordVectors: feature.Word2VecModel) extends Model[Word2VecModel] with Word2VecBase with MLWritable { import Word2VecModel._ /** * Returns a dataframe with two fields, "word" and "vector", with "word" being a String and * and the vector the DenseVector that it is mapped to. */ @Since("1.5.0") @transient lazy val getVectors: DataFrame = { val spark = SparkSession.builder().getOrCreate() val wordVec = wordVectors.getVectors.mapValues(vec => Vectors.dense(vec.map(_.toDouble))) spark.createDataFrame(wordVec.toSeq).toDF("word", "vector") } /** * Find "num" number of words closest in similarity to the given word, not * including the word itself. Returns a dataframe with the words and the * cosine similarities between the synonyms and the given word. */ @Since("1.5.0") def findSynonyms(word: String, num: Int): DataFrame = { val spark = SparkSession.builder().getOrCreate() spark.createDataFrame(wordVectors.findSynonyms(word, num)).toDF("word", "similarity") } /** * Find "num" number of words whose vector representation most similar to the supplied vector. * If the supplied vector is the vector representation of a word in the model's vocabulary, * that word will be in the results. Returns a dataframe with the words and the cosine * similarities between the synonyms and the given word vector. */ @Since("2.0.0") def findSynonyms(vec: Vector, num: Int): DataFrame = { val spark = SparkSession.builder().getOrCreate() spark.createDataFrame(wordVectors.findSynonyms(vec, num)).toDF("word", "similarity") } /** @group setParam */ @Since("1.4.0") def setInputCol(value: String): this.type = set(inputCol, value) /** @group setParam */ @Since("1.4.0") def setOutputCol(value: String): this.type = set(outputCol, value) /** * Transform a sentence column to a vector column to represent the whole sentence. The transform * is performed by averaging all word vectors it contains. */ @Since("2.0.0") override def transform(dataset: Dataset[_]): DataFrame = { transformSchema(dataset.schema, logging = true) val vectors = wordVectors.getVectors .mapValues(vv => Vectors.dense(vv.map(_.toDouble))) .map(identity) // mapValues doesn't return a serializable map (SI-7005) val bVectors = dataset.sparkSession.sparkContext.broadcast(vectors) val d = $(vectorSize) val word2Vec = udf { sentence: Seq[String] => if (sentence.isEmpty) { Vectors.sparse(d, Array.empty[Int], Array.empty[Double]) } else { val sum = Vectors.zeros(d) sentence.foreach { word => bVectors.value.get(word).foreach { v => BLAS.axpy(1.0, v, sum) } } BLAS.scal(1.0 / sentence.size, sum) sum } } dataset.withColumn($(outputCol), word2Vec(col($(inputCol)))) } @Since("1.4.0") override def transformSchema(schema: StructType): StructType = { validateAndTransformSchema(schema) } @Since("1.4.1") override def copy(extra: ParamMap): Word2VecModel = { val copied = new Word2VecModel(uid, wordVectors) copyValues(copied, extra).setParent(parent) } @Since("1.6.0") override def write: MLWriter = new Word2VecModelWriter(this) } @Since("1.6.0") object Word2VecModel extends MLReadable[Word2VecModel] { private[Word2VecModel] class Word2VecModelWriter(instance: Word2VecModel) extends MLWriter { private case class Data(wordIndex: Map[String, Int], wordVectors: Seq[Float]) override protected def saveImpl(path: String): Unit = { DefaultParamsWriter.saveMetadata(instance, path, sc) val data = Data(instance.wordVectors.wordIndex, instance.wordVectors.wordVectors.toSeq) val dataPath = new Path(path, "data").toString sparkSession.createDataFrame(Seq(data)).repartition(1).write.parquet(dataPath) } } private class Word2VecModelReader extends MLReader[Word2VecModel] { private val className = classOf[Word2VecModel].getName override def load(path: String): Word2VecModel = { val metadata = DefaultParamsReader.loadMetadata(path, sc, className) val dataPath = new Path(path, "data").toString val data = sparkSession.read.parquet(dataPath) .select("wordIndex", "wordVectors") .head() val wordIndex = data.getAs[Map[String, Int]](0) val wordVectors = data.getAs[Seq[Float]](1).toArray val oldModel = new feature.Word2VecModel(wordIndex, wordVectors) val model = new Word2VecModel(metadata.uid, oldModel) DefaultParamsReader.getAndSetParams(model, metadata) model } } @Since("1.6.0") override def read: MLReader[Word2VecModel] = new Word2VecModelReader @Since("1.6.0") override def load(path: String): Word2VecModel = super.load(path) }
spark0001/spark2.1.1
mllib/src/main/scala/org/apache/spark/ml/feature/Word2Vec.scala
Scala
apache-2.0
11,719
package org.zstack.header.vm; import org.zstack.header.message.MessageReply; /** * Created by xing5 on 2016/3/29. */ public class HaStartVmInstanceReply extends MessageReply { }
winger007/zstack
header/src/main/java/org/zstack/header/vm/HaStartVmInstanceReply.java
Java
apache-2.0
182
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: Core types for the response rules -- criteria, responses, rules, and matchers. // // $NoKeywords: $ //=============================================================================// #ifndef RESPONSE_HOST_INTERFACE_H #define RESPONSE_HOST_INTERFACE_H #ifdef _WIN32 #pragma once #endif #include "filesystem.h" class IUniformRandomStream; class ICommandLine; namespace ResponseRules { // FUNCTIONS YOU MUST IMPLEMENT IN THE HOST EXECUTABLE: // These are functions that are mentioned in the header, but need their bodies implemented // in the .dll that links against this lib. // This is to wrap functions that previously came from the engine interface // back when the response rules were inside the server.dll . Now that the rules // are included into a standalone editor, we don't necessarily have an engine around, // so there needs to be some other implementation. abstract_class IEngineEmulator { public: /// Given an input text buffer data pointer, parses a single token into the variable token and returns the new /// reading position virtual const char *ParseFile( const char *data, char *token, int maxlen ) = 0; /// Return a pointer to an IFileSystem we can use to read and process scripts. virtual IFileSystem *GetFilesystem() = 0; /// Return a pointer to an instance of an IUniformRandomStream virtual IUniformRandomStream *GetRandomStream() = 0 ; /// Return a pointer to a tier0 ICommandLine virtual ICommandLine *GetCommandLine() = 0; /// Emulates the server's UTIL_LoadFileForMe virtual byte *LoadFileForMe( const char *filename, int *pLength ) = 0; /// Emulates the server's UTIL_FreeFile virtual void FreeFile( byte *buffer ) = 0; /// Somewhere in the host executable you should define this symbol and /// point it at a singleton instance. static IEngineEmulator *s_pSingleton; // this is just a function that returns the pointer above -- just in // case we need to define it differently. And I get asserts this way. static IEngineEmulator *Get(); }; }; #endif
ppittle/AlienSwarmDirectorMod
trunk/src/public/responserules/response_host_interface.h
C
apache-2.0
2,147
/*========================================================================= * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved. * This product is protected by U.S. and international copyright * and intellectual property laws. Pivotal products are covered by * more patents listed at http://www.pivotal.io/patents. *======================================================================== */ package com.gemstone.gemfire.cache; import java.util.Collections; import java.util.HashSet; import java.util.Set; import com.gemstone.gemfire.cache.control.ResourceManager; import com.gemstone.gemfire.distributed.DistributedMember; /** * Indicates a low memory condition either on the local or a remote {@link Cache}. * The {@link ResourceManager} monitors local tenured memory consumption and determines when operations are rejected. * * @see ResourceManager#setCriticalHeapPercentage(float) * @see Region#put(Object, Object) * * @author sbawaska * @since 6.0 */ public class LowMemoryException extends ResourceException { private static final long serialVersionUID = 6585765466722883168L; private final Set<DistributedMember> critMems; /** * Creates a new instance of <code>LowMemoryException</code>. */ public LowMemoryException() { this.critMems = Collections.emptySet(); } /** * Constructs an instance of <code>LowMemoryException</code> with the specified detail message. * @param msg the detail message * @param criticalMembers the member(s) which are/were in a critical state */ public LowMemoryException(String msg, final Set<DistributedMember> criticalMembers) { super(msg); this.critMems = Collections.unmodifiableSet(criticalMembers); } /** * Get a read-only set of members in a critical state at the time this * exception was constructed. * @return the critical members */ public Set<DistributedMember> getCriticalMembers() { return this.critMems; } }
nchandrappa/incubator-geode
gemfire-core/src/main/java/com/gemstone/gemfire/cache/LowMemoryException.java
Java
apache-2.0
1,966
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.gobblin.ingestion.google.webmaster; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import com.google.api.client.auth.oauth2.Credential; import com.google.api.client.googleapis.batch.BatchRequest; import com.google.api.client.repackaged.com.google.common.base.Preconditions; import com.google.api.services.webmasters.Webmasters; import com.google.api.services.webmasters.model.ApiDataRow; import com.google.api.services.webmasters.model.ApiDimensionFilter; import com.google.api.services.webmasters.model.ApiDimensionFilterGroup; import com.google.api.services.webmasters.model.SearchAnalyticsQueryRequest; import com.google.api.services.webmasters.model.SearchAnalyticsQueryResponse; import org.apache.gobblin.source.extractor.extract.google.GoogleCommon; public class GoogleWebmasterClientImpl extends GoogleWebmasterClient { private final Webmasters.Searchanalytics _analytics; private final Webmasters _service; public GoogleWebmasterClientImpl(Credential credential, String appName) throws IOException { //transport: new NetHttpTransport() or GoogleNetHttpTransport.newTrustedTransport() //jsonFactory: new JacksonFactory() or JacksonFactory.getDefaultInstance() _service = new Webmasters.Builder(credential.getTransport(), GoogleCommon.getJsonFactory(), credential) .setApplicationName(appName).build(); _analytics = _service.searchanalytics(); } @Override public BatchRequest createBatch() { return _service.batch(); } @Override public List<String> getPages(String siteProperty, String startDate, String endDate, String country, int rowLimit, List<GoogleWebmasterFilter.Dimension> requestedDimensions, List<ApiDimensionFilter> filters, int startRow) throws IOException { checkRowLimit(rowLimit); Preconditions.checkArgument(requestedDimensions.contains(GoogleWebmasterFilter.Dimension.PAGE)); SearchAnalyticsQueryResponse rspByCountry = createSearchAnalyticsQuery(siteProperty, startDate, endDate, requestedDimensions, GoogleWebmasterFilter.andGroupFilters(filters), rowLimit, startRow).execute(); List<ApiDataRow> pageRows = rspByCountry.getRows(); List<String> pages = new ArrayList<>(rowLimit); if (pageRows != null) { int pageIndex = requestedDimensions.indexOf(GoogleWebmasterFilter.Dimension.PAGE); for (ApiDataRow row : pageRows) { pages.add(row.getKeys().get(pageIndex)); } } return pages; } @Override public Webmasters.Searchanalytics.Query createSearchAnalyticsQuery(String siteProperty, String startDate, String endDate, List<GoogleWebmasterFilter.Dimension> dimensions, ApiDimensionFilterGroup filterGroup, int rowLimit, int startRow) throws IOException { List<String> dimensionStrings = new ArrayList<>(); for (GoogleWebmasterFilter.Dimension dimension : dimensions) { dimensionStrings.add(dimension.toString().toLowerCase()); } SearchAnalyticsQueryRequest request = new SearchAnalyticsQueryRequest().setStartDate(startDate).setEndDate(endDate).setRowLimit(rowLimit) .setDimensions(dimensionStrings).setStartRow(startRow); if (filterGroup != null) { request.setDimensionFilterGroups(Arrays.asList(filterGroup)); } return _analytics.query(siteProperty, request); } private static void checkRowLimit(int rowLimit) { Preconditions.checkArgument(rowLimit > 0 && rowLimit <= API_ROW_LIMIT, "Row limit for Google Search Console API must be within range (0, 5000]"); } }
jinhyukchang/gobblin
gobblin-modules/google-ingestion/src/main/java/org/apache/gobblin/ingestion/google/webmaster/GoogleWebmasterClientImpl.java
Java
apache-2.0
4,421
/* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using QuantConnect.Data.Market; namespace QuantConnect.Algorithm.CSharp { /// <summary> /// Skeleton algorithm demonstrating filling forward data through gaps and inconsistent data. By default LEAN fills the previous bar forward /// so you get regular bars. /// </summary> /// <meta name="tag" content="using data" /> public class BasicTemplateFillForwardAlgorithm : QCAlgorithm { private Symbol _asur = QuantConnect.Symbol.Create("ASUR", SecurityType.Equity, Market.USA); /// <summary> /// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized. /// </summary> public override void Initialize() { SetStartDate(2013, 10, 01); //Set Start Date SetEndDate(2013, 11, 30); //Set End Date SetCash(100000); //Set Strategy Cash // Find more symbols here: http://quantconnect.com/data AddSecurity(SecurityType.Equity, "ASUR", Resolution.Second); } /// <summary> /// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here. /// </summary> /// <param name="data">TradeBars IDictionary object with your stock data</param> public void OnData(TradeBars data) { if (!Portfolio.Invested) { SetHoldings(_asur, 1); Debug("Purchased Stock"); } } } }
young-zhang/Lean
Algorithm.CSharp/BasicTemplateFillForwardAlgorithm.cs
C#
apache-2.0
2,260
package handlers import ( "bytes" "encoding/json" "fmt" "net/http" "strings" "github.com/docker/distribution" ctxu "github.com/docker/distribution/context" "github.com/docker/distribution/digest" "github.com/docker/distribution/manifest/schema1" "github.com/docker/distribution/registry/api/errcode" "github.com/docker/distribution/registry/api/v2" "github.com/gorilla/handlers" "golang.org/x/net/context" ) // imageManifestDispatcher takes the request context and builds the // appropriate handler for handling image manifest requests. func imageManifestDispatcher(ctx *Context, r *http.Request) http.Handler { imageManifestHandler := &imageManifestHandler{ Context: ctx, } reference := getReference(ctx) dgst, err := digest.ParseDigest(reference) if err != nil { // We just have a tag imageManifestHandler.Tag = reference } else { imageManifestHandler.Digest = dgst } mhandler := handlers.MethodHandler{ "GET": http.HandlerFunc(imageManifestHandler.GetImageManifest), } if !ctx.readOnly { mhandler["PUT"] = http.HandlerFunc(imageManifestHandler.PutImageManifest) mhandler["DELETE"] = http.HandlerFunc(imageManifestHandler.DeleteImageManifest) } return mhandler } // imageManifestHandler handles http operations on image manifests. type imageManifestHandler struct { *Context // One of tag or digest gets set, depending on what is present in context. Tag string Digest digest.Digest } // GetImageManifest fetches the image manifest from the storage backend, if it exists. func (imh *imageManifestHandler) GetImageManifest(w http.ResponseWriter, r *http.Request) { ctxu.GetLogger(imh).Debug("GetImageManifest") manifests, err := imh.Repository.Manifests(imh) if err != nil { imh.Errors = append(imh.Errors, err) return } var sm *schema1.SignedManifest if imh.Tag != "" { sm, err = manifests.GetByTag(imh.Tag) } else { if etagMatch(r, imh.Digest.String()) { w.WriteHeader(http.StatusNotModified) return } sm, err = manifests.Get(imh.Digest) } if err != nil { imh.Errors = append(imh.Errors, v2.ErrorCodeManifestUnknown.WithDetail(err)) return } // Get the digest, if we don't already have it. if imh.Digest == "" { dgst, err := digestManifest(imh, sm) if err != nil { imh.Errors = append(imh.Errors, v2.ErrorCodeDigestInvalid.WithDetail(err)) return } if etagMatch(r, dgst.String()) { w.WriteHeader(http.StatusNotModified) return } imh.Digest = dgst } w.Header().Set("Content-Type", "application/json; charset=utf-8") w.Header().Set("Content-Length", fmt.Sprint(len(sm.Raw))) w.Header().Set("Docker-Content-Digest", imh.Digest.String()) w.Header().Set("Etag", fmt.Sprintf(`"%s"`, imh.Digest)) w.Write(sm.Raw) } func etagMatch(r *http.Request, etag string) bool { for _, headerVal := range r.Header["If-None-Match"] { if headerVal == etag || headerVal == fmt.Sprintf(`"%s"`, etag) { // allow quoted or unquoted return true } } return false } // PutImageManifest validates and stores and image in the registry. func (imh *imageManifestHandler) PutImageManifest(w http.ResponseWriter, r *http.Request) { ctxu.GetLogger(imh).Debug("PutImageManifest") manifests, err := imh.Repository.Manifests(imh) if err != nil { imh.Errors = append(imh.Errors, err) return } var jsonBuf bytes.Buffer if err := copyFullPayload(w, r, &jsonBuf, imh, "image manifest PUT", &imh.Errors); err != nil { // copyFullPayload reports the error if necessary return } var manifest schema1.SignedManifest if err := json.Unmarshal(jsonBuf.Bytes(), &manifest); err != nil { imh.Errors = append(imh.Errors, v2.ErrorCodeManifestInvalid.WithDetail(err)) return } dgst, err := digestManifest(imh, &manifest) if err != nil { imh.Errors = append(imh.Errors, v2.ErrorCodeDigestInvalid.WithDetail(err)) return } // Validate manifest tag or digest matches payload if imh.Tag != "" { if manifest.Tag != imh.Tag { ctxu.GetLogger(imh).Errorf("invalid tag on manifest payload: %q != %q", manifest.Tag, imh.Tag) imh.Errors = append(imh.Errors, v2.ErrorCodeTagInvalid) return } imh.Digest = dgst } else if imh.Digest != "" { if dgst != imh.Digest { ctxu.GetLogger(imh).Errorf("payload digest does match: %q != %q", dgst, imh.Digest) imh.Errors = append(imh.Errors, v2.ErrorCodeDigestInvalid) return } } else { imh.Errors = append(imh.Errors, v2.ErrorCodeTagInvalid.WithDetail("no tag or digest specified")) return } if err := manifests.Put(&manifest); err != nil { // TODO(stevvooe): These error handling switches really need to be // handled by an app global mapper. if err == distribution.ErrUnsupported { imh.Errors = append(imh.Errors, errcode.ErrorCodeUnsupported) return } switch err := err.(type) { case distribution.ErrManifestVerification: for _, verificationError := range err { switch verificationError := verificationError.(type) { case distribution.ErrManifestBlobUnknown: imh.Errors = append(imh.Errors, v2.ErrorCodeManifestBlobUnknown.WithDetail(verificationError.Digest)) case distribution.ErrManifestNameInvalid: imh.Errors = append(imh.Errors, v2.ErrorCodeNameInvalid.WithDetail(err)) case distribution.ErrManifestUnverified: imh.Errors = append(imh.Errors, v2.ErrorCodeManifestUnverified) default: if verificationError == digest.ErrDigestInvalidFormat { imh.Errors = append(imh.Errors, v2.ErrorCodeDigestInvalid) } else { imh.Errors = append(imh.Errors, errcode.ErrorCodeUnknown, verificationError) } } } default: imh.Errors = append(imh.Errors, errcode.ErrorCodeUnknown.WithDetail(err)) } return } // Construct a canonical url for the uploaded manifest. location, err := imh.urlBuilder.BuildManifestURL(imh.Repository.Name(), imh.Digest.String()) if err != nil { // NOTE(stevvooe): Given the behavior above, this absurdly unlikely to // happen. We'll log the error here but proceed as if it worked. Worst // case, we set an empty location header. ctxu.GetLogger(imh).Errorf("error building manifest url from digest: %v", err) } w.Header().Set("Location", location) w.Header().Set("Docker-Content-Digest", imh.Digest.String()) w.WriteHeader(http.StatusCreated) } // DeleteImageManifest removes the manifest with the given digest from the registry. func (imh *imageManifestHandler) DeleteImageManifest(w http.ResponseWriter, r *http.Request) { ctxu.GetLogger(imh).Debug("DeleteImageManifest") manifests, err := imh.Repository.Manifests(imh) if err != nil { imh.Errors = append(imh.Errors, err) return } err = manifests.Delete(imh.Digest) if err != nil { switch err { case digest.ErrDigestUnsupported: case digest.ErrDigestInvalidFormat: imh.Errors = append(imh.Errors, v2.ErrorCodeDigestInvalid) return case distribution.ErrBlobUnknown: imh.Errors = append(imh.Errors, v2.ErrorCodeManifestUnknown) return case distribution.ErrUnsupported: imh.Errors = append(imh.Errors, errcode.ErrorCodeUnsupported) return default: imh.Errors = append(imh.Errors, errcode.ErrorCodeUnknown) return } } w.WriteHeader(http.StatusAccepted) } // digestManifest takes a digest of the given manifest. This belongs somewhere // better but we'll wait for a refactoring cycle to find that real somewhere. func digestManifest(ctx context.Context, sm *schema1.SignedManifest) (digest.Digest, error) { p, err := sm.Payload() if err != nil { if !strings.Contains(err.Error(), "missing signature key") { ctxu.GetLogger(ctx).Errorf("error getting manifest payload: %v", err) return "", err } // NOTE(stevvooe): There are no signatures but we still have a // payload. The request will fail later but this is not the // responsibility of this part of the code. p = sm.Raw } dgst, err := digest.FromBytes(p) if err != nil { ctxu.GetLogger(ctx).Errorf("error digesting manifest: %v", err) return "", err } return dgst, err }
rhuss/gofabric8
vendor/github.com/docker/distribution/registry/handlers/images.go
GO
apache-2.0
7,972
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #include "tensorflow/compiler/tf2tensorrt/common/utils.h" #if GOOGLE_CUDA && GOOGLE_TENSORRT #include "absl/base/call_once.h" #include "absl/strings/str_join.h" #include "third_party/tensorrt/NvInferPlugin.h" #endif namespace tensorflow { namespace tensorrt { std::tuple<int, int, int> GetLinkedTensorRTVersion() { #if GOOGLE_CUDA && GOOGLE_TENSORRT return std::tuple<int, int, int>{NV_TENSORRT_MAJOR, NV_TENSORRT_MINOR, NV_TENSORRT_PATCH}; #else return std::tuple<int, int, int>{0, 0, 0}; #endif } std::tuple<int, int, int> GetLoadedTensorRTVersion() { #if GOOGLE_CUDA && GOOGLE_TENSORRT int ver = getInferLibVersion(); int major = ver / 1000; ver = ver - major * 1000; int minor = ver / 100; int patch = ver - minor * 100; return std::tuple<int, int, int>{major, minor, patch}; #else return std::tuple<int, int, int>{0, 0, 0}; #endif } } // namespace tensorrt } // namespace tensorflow #if GOOGLE_CUDA && GOOGLE_TENSORRT namespace tensorflow { namespace tensorrt { namespace { void InitializeTrtPlugins(nvinfer1::ILogger* trt_logger) { LOG(INFO) << "Linked TensorRT version: " << absl::StrJoin(GetLinkedTensorRTVersion(), "."); LOG(INFO) << "Loaded TensorRT version: " << absl::StrJoin(GetLoadedTensorRTVersion(), "."); bool plugin_initialized = initLibNvInferPlugins(trt_logger, ""); if (!plugin_initialized) { LOG(ERROR) << "Failed to initialize TensorRT plugins, and conversion may " "fail later."; } int num_trt_plugins = 0; nvinfer1::IPluginCreator* const* trt_plugin_creator_list = getPluginRegistry()->getPluginCreatorList(&num_trt_plugins); if (!trt_plugin_creator_list) { LOG_WARNING_WITH_PREFIX << "Can not find any TensorRT plugins in registry."; } else { VLOG(1) << "Found the following " << num_trt_plugins << " TensorRT plugins in registry:"; for (int i = 0; i < num_trt_plugins; ++i) { if (!trt_plugin_creator_list[i]) { LOG_WARNING_WITH_PREFIX << "TensorRT plugin at index " << i << " is not accessible (null pointer returned by " "getPluginCreatorList for this plugin)"; } else { VLOG(1) << " " << trt_plugin_creator_list[i]->getPluginName(); } } } } } // namespace void MaybeInitializeTrtPlugins(nvinfer1::ILogger* trt_logger) { static absl::once_flag once; absl::call_once(once, InitializeTrtPlugins, trt_logger); } } // namespace tensorrt } // namespace tensorflow #endif
sarvex/tensorflow
tensorflow/compiler/tf2tensorrt/common/utils.cc
C++
apache-2.0
3,212
ITK Release 4.1 =============== Announcement: ITK 4.1.0 has been released! We are happy to announce the release of the InsightToolkit 4.1.0! Download links can be found at: [`http://itk.org/ITK/resources/software.html`](http://itk.org/ITK/resources/software.html) This release is the first since ITK 4.0.0 and includes a number of bug fixes and new features. Related to the transition to Git, it also is the first release to deviate from the even-only minor release number. Notable changes: - A plethora of bug fixes. - VTK Bridge support improved -- currently requires VTK Git master. - A number of improvements to the Registrationv4 framework. - A new TimeVaryingBSplineVelocityFieldTransform. - New Deconvolution filtering module with a number of classes. - Performance improvements to the LevelSetsv4 framework. - Better WrapITK support. - A new video filtering module that includes a method to use standard filters in a video pipeline. Some performance regressions were identified that were related to the use of GetInput() and GetOutput() in the inner loop of a filter. If you find similar behavior, please report it to the mailing list and issue tracker. On the compiler front, CLang support continues to improve. Issues have been identified with parallel Visual Studio 10 builds. It appears that Visual Studio 10 has difficulty handling the many projects that result when BUILD\_TESTING and BUILD\_EXAMPLES are ON. The current workaround is to set `Tools>Options>Projects and Solutions>Build and Run>Maximum number of parallel project builds` to 1 or turn BUILD\_TESTING or BUILD\_EXAMPLES to OFF. InsightApplications (from the ITKApps repository) has also seen a number of updates to ITKv4, mostly thanks to the work of Bill Lorenson and Arnaud Gelas. When building InsightApplications, it is recommended to use the “superbuild” by pointing CMake to the directory ` InsightApplications-4.1.1/Superbuild` as the target source directory. New contributors with merged patches include - Andriy Kot - Felix Morency In the upcoming 4.2 release, we will actively re-engage the community and will be seeking out new contributors. Andriy Kot (1): `     ENH: itkMaskFeaturePointSelectionFilter: initial submission` Arnaud Gelas (9): `     DOC: fix doxygen warning`\ `     DOC: Add formula for the curvature term`\ `     DOC: update doxygen configuration file for Doxygen 1.6.1`\ `     ENH: Possibility to provide a propagation image`\ `     PERF: Minor speed improvement in LabelObject / LabelMap`\ `     DOC: fix doxygen warnings`\ `     ENH: Make use of types defined in Histogram to be able to handle 64 bit images`\ `     ENH: Use types from itk::Histogram`\ `     BUG: Lots of classes were undocumented cause of a __itkMacro_h was undefined` Baohua Wu (1): `     ENH: added convergence checking in itkGradientDescentOptimizerv4` Bill Lorensen (6): `     COMP: Unterminated string causes valgrind defect.`\ `     BUG: Wrong size for parameters.`\ `     BUG: Older versions of VTK do not define VTK_LIBRARIES`\ `     BUG: Older version of VTK cannot be used with ITK`\ `     BUG: zlib 1.2.6 API change`\ `     BUG: CPack was not set up propery for ITKv4` Brad King (9): `     ENH: Teach ExternalData to expand DATA{} inside strings`\ `     ENH: ExternalData: Add `“`-stamp`”` suffix to build outputs`\ `     ENH: ExternalData: Add option ExternalData_BINARY_ROOT`\ `     ENH: Teach git-gerrit-(push|merge) to validate topic name`\ `     ENH: Teach git-gerrit-merge to report topic name`\ `     ENH: Simplify local Git hook chaining`\ `     BUG: Fix ITK prepare-commit-msg hook to not erase branch name`\ `     BUG: Fix ITK prepare-commit-msg hook for non-GNU sed`\ `     MetaIO: Always use std:: streams for VTK` Bradley Lowekamp (26): `     COMP: Fixing compilation warning in the thresholding calculators`\ `     DOC: Updated documentation for ThresholdMaximumConnectedComponents`\ `     ENH: Adding support for VectorImages to LabelToRGBImageFilter`\ `     ENH: VectorConnectedComponet filter to work with VectorImages`\ `     BUG: Fixing UpperBoundary parameter in ThresholdMaxCC filter`\ `     BUG: Fix mismatch in internal image types for IsolatedWatershed`\ `     BUG: Some Set by scalar methods were not modifing the time of filter`\ `     ENH: adding support to LabelOverlay for VectorImage output`\ `     ENH: Adding Image::Rebind to support smoothing vector images`\ `     ENH: Adding Image::Rebind to support smoothing vector images`\ `     BUG: VotingBinary could not set output pixels before`\ `     COMP: fix comparison between signed and unsigned with cast`\ `     BUG: Restoring adaptor support to SmoothingRecursiveGaussian`\ `     BUG: corrected libtiff to be confgured for big-endian system`\ `     BUG: Adding tolerance to the VectorThreshold level-set test`\ `     COMP: Address warnings in PreWarpTest`\ `     BUG: Adding tolerance to ThresholdSegmentationLevelSetWhiteMatterTest`\ `     COMP: attributes don't do anything in forward declarations`\ `     COMP: fix warning of signed unsigned comparison`\ `     BUG: Adjust intensity tolerance for SimpleImageRegistrationTest`\ `     COMP: Use SizeValueType for indexing in Neighborhoods`\ `     ENH: adding additional dart metric for image error statistics`\ `     BUG: Corretly choose best baseline for difference image`\ `     COMP: Fix warning in BalloonForceFilte about vd being unintialized`\ `     BUG: prevent divide by zero in computing mean`\ `     BUG: Set the number of components-per-pixel for SeriesReader` Brian Avants (5): `     ENH: adding a multi-start optimizer`\ `     ENH: multi-optimizers w/registration tests`\ `     ENH: fix jacobian wrt params + img-grad reorientation`\ `     ENH: updates for algorithm correctness.`\ `     BUG: cleaning up the tv field registration` Cory Quammen (5): `     STYLE: Fixed typo in test variable name`\ `     COMP: Added undefined type`\ `     ENH: Added Deconvolution module`\ `     ENH: Added linear deconvolution filters`\ `     DOC: Fixed indices in pad image filter diagrams` David Doria (1): `     DOC: Add Doxygen comments to some functions.` Félix C. Morency (1): `     ENH: Added itkVTKImageToImageFilter and Python wrapper to VtkGlue` Gang Song (3): `     BUG: return false if dividing by zero in ANTS CC`\ `     ENH: Clean up the Normalized Cross Correlation in Metricv4`\ `     ENH: add test for validating image gradients in metricv4` Gaëtan Lehmann (9): `     ENH: Add required named inputs managements in ProcessObject`\ `     BUG: fix module name in module2module.py`\ `     ENH: add wrapping backward compatibility macros`\ `     STYLE: fix InitializationBiasedParticleSwarmOptimizer doxygen name`\ `     BUG: fix WRAP_ITK_INSTALL_PREFIX content`\ `     BUG: remove SwigPyIterator/PySwigIterator`\ `     COMP: global Clone() architecture compatible with java`\ `     BUG: *InDoxygenGroup tests should be ignored by valgrind`\ `     COMP: fix missing vtkImagingPythonD lib link` Hans Johnson (13): `     PERF: Updated lbfgsb to fix bug`\ `     COMP: Be compliant with ANSI standard`\ `     COMP: Removed clang compiler warnings.`\ `     BUG: Remove uninitialized memory print.`\ `     BUG: Virtual was missing on derived class`\ `     COMP: Removed HDF5 unused types.`\ `     COMP: Improve coverage of Kernel`\ `     BUG: 32bit windows bug introduced`\ `     DOC: Fixed documentation to match code behavior`\ `     DOC:  Fixed minor documentation issues`\ `     BUG: Added test to expose overlooked bug`\ `     BUG: Propogated bug from ITKv3 Optimized BSplines`\ `     COMP:  Mismatch array length traversal` ITK Migration V4 (3): `     DOC: Modify BinaryMorphologicalOpeningImageFilter comments.`\ `     DOC: Modify ScalarImageToTextureFeaturesFilter comments.`\ `     DOC: Modify IntensityWindowingImageFilter comments.` Kent Williams (3): `     COMP: cleanup based on CLang warnings`\ `     COMP: Disable GNU extensions for CLang++`\ `     ENH: Add Clone Method to transform hierarchy.` Luis Ibanez (1): `     ENH: Scripts to generate Git Statistics.` Marius Staring (1): `     PERF: Switched order of if-statement and for-loop in DetermineRegionOfSupport` Matthew McCormick (16): `     ENH: Bump CMakeLists.txt version to 4.1.0.`\ `     DOC: Fix log_{10} e doxygen LaTeX formula.`\ `     PERF: Thread Whitaker level set ComputeIteration.`\ `     BUG: LevelSetDenseImage test recognize zero values.`\ `     COMP: Fixing missing include in itkMaskFeaturePointSelectionFilter.`\ `     BUG: Only add MRC to registration factories with ITK_USE_REVIEW ON.`\ `     BUG: Check pthread_create return value.`\ `     PERF: Thread LevelSetEvolution::ComputeIteration for multiple domains.`\ `     ENH: Use compensated summation in  MutualInformationImageToImageMetric.`\ `     STYLE: Fix KWStyle errors.`\ `     BUG: Fix VideoFileReader memory leak.`\ `     DOC: Fix typo in DifferenceImageFilter migration guide.`\ `     COMP: Fix HDF5 build with Windows NMake JOM generator.`\ `     BUG: Remove CTEST_MEMORYCHECK_SUPPRESSIONS_FILE from CTestCustom.cmake.in`\ `     BUG: Add TimeVaryingBSplineVelocityFieldTransform to wrapping exclusion.`\ `     COMP: Warn about VisualStudio parallel build issues.` Michael Stauffer (21): `     ENH: Add itkCompensatedSummationTest2`\ `     BUG: Fix the mapping of sampled points in ImageToImageMetricv4.`\ `     BUG: Fix itkCompensatedSummationTest2`\ `     ENH: Add MattesMutualImageToImageMetricv4`\ `     ENH: Add options for scales & learning rate estimation behavior`\ `     BUG: Fix sampled point list creation in ImageToImageMetricv4`\ `     BUG: Metricsv4: set default metric value to max`\ `     PERF: itkTimeVaryingBSplineVelocityFieldImageRegistrationTest duration`\ `     COMP: Fix warnings`\ `     BUG: Remove zero-point assert in JointHistorgram metricv4`\ `     BUG: Address valgrind errors in V4 registration framework.`\ `     BUG: ANTSNeigh metric - check valid point & test non-overlapping`\ `     BUG: MattesMutual v4 metric bug in number of points`\ `     PERF: TimeVaryingVelocityField - Shorten test time`\ `     BUG: Add debug info to SimpleImageRegistrationTest`\ `     BUG: SimpleImageRegistrationTest - remove versions 2 & 3`\ `     BUG: itkSimpleImageRegistrationTest - more debug changes`\ `     BUG: itkSimpleImageRegistrationTest - still more debug changes`\ `     BUG: ImageToImageMetricv4 - concept check for integer image`\ `     BUG: Rename and fix v4 Demons metric to MeansSquares`\ `     BUG: yet still more debugging for itkSimpleImageRegistrationTest` Nick Tustison (5): `     ENH:  Adding time-varying B-spline transform.`\ `     ENH:  Adding SyN registration method.`\ `     BUG: Assignment ordering was not correct.`\ `     ENH:  Adding gaussian interpolators.`\ `     BUG:  array subscript is out of bounds.` Richard Beare (2): `     ENH: Masking option for histogram thresholding`\ `     BUG: Errors from dashboard` Sean McBride (1): `     BUG: disabled use of undefined signed overflow in nrrd test` Xiaoxiao Liu (2): `     ENH: Add a video filtering module.`\ `     BUG: Fix OpenCVVideoIOTest windows compiling errors.`
blowekamp/ITK
Documentation/ReleaseNotes/4.1.md
Markdown
apache-2.0
12,697
// RUN: %clang_cc1 -fsyntax-only -verify %s -fblocks template<typename T> struct is_unary_block { static const bool value = false; }; template<typename T, typename U> struct is_unary_block<T (^)(U)> { static const bool value = true; }; int is_unary_block0[is_unary_block<int>::value ? -1 : 1]; int is_unary_block1[is_unary_block<int (^)()>::value ? -1 : 1]; int is_unary_block2[is_unary_block<int (^)(int, bool)>::value ? -1 : 1]; int is_unary_block3[is_unary_block<int (^)(bool)>::value ? 1 : -1]; int is_unary_block4[is_unary_block<int (^)(int)>::value ? 1 : -1]; template<typename T> struct is_unary_block_with_same_return_type_as_argument_type { static const bool value = false; }; template<typename T> struct is_unary_block_with_same_return_type_as_argument_type<T (^)(T)> { static const bool value = true; }; int is_unary_block5[is_unary_block_with_same_return_type_as_argument_type<int>::value ? -1 : 1]; int is_unary_block6[is_unary_block_with_same_return_type_as_argument_type<int (^)()>::value ? -1 : 1]; int is_unary_block7[is_unary_block_with_same_return_type_as_argument_type<int (^)(int, bool)>::value ? -1 : 1]; int is_unary_block8[is_unary_block_with_same_return_type_as_argument_type<int (^)(bool)>::value ? -1 : 1]; int is_unary_block9[is_unary_block_with_same_return_type_as_argument_type<int (^)(int)>::value ? 1 : -1]; int is_unary_block10[is_unary_block_with_same_return_type_as_argument_type<int (^)(int, ...)>::value ? -1 : 1]; int is_unary_block11[is_unary_block_with_same_return_type_as_argument_type<int (^ const)(int)>::value ? -1 : 1];
jeltz/rust-debian-package
src/llvm/tools/clang/test/SemaTemplate/temp_class_spec_blocks.cpp
C++
apache-2.0
1,578
// Copyright (C) 2014 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package ${package}; import com.google.gerrit.extensions.annotations.Listen; import com.google.gerrit.extensions.webui.JavaScriptPlugin; @Listen public class MyJsExtension extends JavaScriptPlugin { public MyJsExtension() { super("hello-js-plugins.js"); } }
Saulis/gerrit
gerrit-plugin-js-archetype/src/main/resources/archetype-resources/src/main/java/MyJsExtension.java
Java
apache-2.0
876
/* * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except * in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied.See the License for the * specific language governing permissions and limitations * under the License. */ package org.superbiz.servlet; import java.io.PrintStream; import java.net.URL; import javax.xml.ws.Service; public class WebserviceClient { /** * Unfortunately, to run this example with CXF you need to have a HUGE class path. This * is just what is required to run CXF: * <p/> * jaxb-api-2.0.jar * jaxb-impl-2.0.3.jar * <p/> * saaj-api-1.3.jar * saaj-impl-1.3.jar * <p/> * <p/> * cxf-api-2.0.2-incubator.jar * cxf-common-utilities-2.0.2-incubator.jar * cxf-rt-bindings-soap-2.0.2-incubator.jar * cxf-rt-core-2.0.2-incubator.jar * cxf-rt-databinding-jaxb-2.0.2-incubator.jar * cxf-rt-frontend-jaxws-2.0.2-incubator.jar * cxf-rt-frontend-simple-2.0.2-incubator.jar * cxf-rt-transports-http-jetty-2.0.2-incubator.jar * cxf-rt-transports-http-2.0.2-incubator.jar * cxf-tools-common-2.0.2-incubator.jar * <p/> * geronimo-activation_1.1_spec-1.0.jar * geronimo-annotation_1.0_spec-1.1.jar * geronimo-ejb_3.0_spec-1.0.jar * geronimo-jpa_3.0_spec-1.1.jar * geronimo-servlet_2.5_spec-1.1.jar * geronimo-stax-api_1.0_spec-1.0.jar * jaxws-api-2.0.jar * axis2-jws-api-1.3.jar * <p/> * wsdl4j-1.6.1.jar * xml-resolver-1.2.jar * XmlSchema-1.3.1.jar */ public static void main(String[] args) throws Exception { PrintStream out = System.out; Service helloPojoService = Service.create(new URL("http://localhost:8080/ejb-examples/hello?wsdl"), null); HelloPojo helloPojo = helloPojoService.getPort(HelloPojo.class); out.println(); out.println("Pojo Webservice"); out.println(" helloPojo.hello(\"Bob\")=" + helloPojo.hello("Bob")); out.println(" helloPojo.hello(null)=" + helloPojo.hello(null)); out.println(); Service helloEjbService = Service.create(new URL("http://localhost:8080/HelloEjbService?wsdl"), null); HelloEjb helloEjb = helloEjbService.getPort(HelloEjb.class); out.println(); out.println("EJB Webservice"); out.println(" helloEjb.hello(\"Bob\")=" + helloEjb.hello("Bob")); out.println(" helloEjb.hello(null)=" + helloEjb.hello(null)); out.println(); } }
irham0019/product-as
modules/samples/JavaEE-TomEE/javaee-examples/src/main/java/org/superbiz/servlet/WebserviceClient.java
Java
apache-2.0
2,938
/*------------------------------------------------------------------------- * * execUtils.h * * Copyright (c) 2005-2008, Greenplum inc * *------------------------------------------------------------------------- */ #ifndef _EXECUTILS_H_ #define _EXECUTILS_H_ #include "executor/execdesc.h" struct EState; struct QueryDesc; extern void InitSliceTable(struct EState *estate, int nMotions, int nSubplans); extern Slice *getCurrentSlice(struct EState *estate, int sliceIndex); extern bool sliceRunsOnQD(Slice *slice); extern bool sliceRunsOnQE(Slice *slice); extern int sliceCalculateNumSendingProcesses(Slice *slice); extern void InitRootSlices(QueryDesc *queryDesc); extern void AssignGangs(QueryDesc *queryDesc); extern void ReleaseGangs(QueryDesc *queryDesc); #ifdef USE_ASSERT_CHECKING struct PlannedStmt; extern void AssertSliceTableIsValid(SliceTable *st, struct PlannedStmt *pstmt); #endif #endif
royc1/gpdb
src/include/executor/execUtils.h
C
apache-2.0
914
/* * Copyright (c) 2010-2014. Axon Framework * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.axonframework.common.property; import static java.lang.String.format; import static java.util.Locale.ENGLISH; /** * BeanPropertyAccessStrategy implementation that uses JavaBean style property access. This means that for any given * property 'property', a method "getProperty" is expected to provide the property value * * @author Maxim Fedorov * @author Allard Buijze * @since 2.0 */ public class BeanPropertyAccessStrategy extends AbstractMethodPropertyAccessStrategy { @Override protected String getterName(String property) { return format(ENGLISH, "get%S%s", property.charAt(0), property.substring(1)); } @Override protected int getPriority() { return 0; } }
christiaandejong/AxonFramework
core/src/main/java/org/axonframework/common/property/BeanPropertyAccessStrategy.java
Java
apache-2.0
1,334
# Squirrel - fluent SQL generator for Go ```go import "gopkg.in/Masterminds/squirrel.v1" ``` or if you prefer using `master` (which may be arbitrarily ahead of or behind `v1`): **NOTE:** as of Go 1.6, `go get` correctly clones the Github default branch (which is `v1` in this repo). ```go import "github.com/Masterminds/squirrel" ``` [![GoDoc](https://godoc.org/github.com/Masterminds/squirrel?status.png)](https://godoc.org/github.com/Masterminds/squirrel) [![Build Status](https://travis-ci.org/Masterminds/squirrel.svg?branch=v1)](https://travis-ci.org/Masterminds/squirrel) _**Note:** This project has moved from `github.com/lann/squirrel` to `github.com/Masterminds/squirrel`. Lann remains the architect of the project, but we're helping him curate. **Squirrel is not an ORM.** For an application of Squirrel, check out [structable, a table-struct mapper](https://github.com/technosophos/structable) Squirrel helps you build SQL queries from composable parts: ```go import sq "github.com/Masterminds/squirrel" users := sq.Select("*").From("users").Join("emails USING (email_id)") active := users.Where(sq.Eq{"deleted_at": nil}) sql, args, err := active.ToSql() sql == "SELECT * FROM users JOIN emails USING (email_id) WHERE deleted_at IS NULL" ``` ```go sql, args, err := sq. Insert("users").Columns("name", "age"). Values("moe", 13).Values("larry", sq.Expr("? + 5", 12)). ToSql() sql == "INSERT INTO users (name,age) VALUES (?,?),(?,? + 5)" ``` Squirrel can also execute queries directly: ```go stooges := users.Where(sq.Eq{"username": []string{"moe", "larry", "curly", "shemp"}}) three_stooges := stooges.Limit(3) rows, err := three_stooges.RunWith(db).Query() // Behaves like: rows, err := db.Query("SELECT * FROM users WHERE username IN (?,?,?,?) LIMIT 3", "moe", "larry", "curly", "shemp") ``` Squirrel makes conditional query building a breeze: ```go if len(q) > 0 { users = users.Where("name LIKE ?", fmt.Sprint("%", q, "%")) } ``` Squirrel wants to make your life easier: ```go // StmtCache caches Prepared Stmts for you dbCache := sq.NewStmtCacher(db) // StatementBuilder keeps your syntax neat mydb := sq.StatementBuilder.RunWith(dbCache) select_users := mydb.Select("*").From("users") ``` Squirrel loves PostgreSQL: ```go psql := sq.StatementBuilder.PlaceholderFormat(sq.Dollar) // You use question marks for placeholders... sql, _, _ := psql.Select("*").From("elephants").Where("name IN (?,?)", "Dumbo", "Verna") /// ...squirrel replaces them using PlaceholderFormat. sql == "SELECT * FROM elephants WHERE name IN ($1,$2)" /// You can retrieve id ... query := sq.Insert("nodes"). Columns("uuid", "type", "data"). Values(node.Uuid, node.Type, node.Data). Suffix("RETURNING \"id\""). RunWith(m.db). PlaceholderFormat(sq.Dollar) query.QueryRow().Scan(&node.id) ``` You can escape question mask by inserting two question marks: ```sql SELECT * FROM nodes WHERE meta->'format' ??| array[?,?] ``` will generate with the Dollar Placeholder: ```sql SELECT * FROM nodes WHERE meta->'format' ?| array[$1,$2] ``` ## License Squirrel is released under the [MIT License](http://www.opensource.org/licenses/MIT).
stellar/gateway-server
vendor/src/github.com/Masterminds/squirrel/README.md
Markdown
apache-2.0
3,211
package mysql import ( "database/sql" "fmt" "strings" "sync" _ "github.com/go-sql-driver/mysql" "github.com/hashicorp/vault/logical" "github.com/hashicorp/vault/logical/framework" ) func Factory(conf *logical.BackendConfig) (logical.Backend, error) { return Backend().Setup(conf) } func Backend() *backend { var b backend b.Backend = &framework.Backend{ Help: strings.TrimSpace(backendHelp), Paths: []*framework.Path{ pathConfigConnection(&b), pathConfigLease(&b), pathListRoles(&b), pathRoles(&b), pathRoleCreate(&b), }, Secrets: []*framework.Secret{ secretCreds(&b), }, } return &b } type backend struct { *framework.Backend db *sql.DB lock sync.Mutex } // DB returns the database connection. func (b *backend) DB(s logical.Storage) (*sql.DB, error) { b.lock.Lock() defer b.lock.Unlock() // If we already have a DB, we got it! if b.db != nil { if err := b.db.Ping(); err == nil { return b.db, nil } // If the ping was unsuccessful, close it and ignore errors as we'll be // reestablishing anyways b.db.Close() } // Otherwise, attempt to make connection entry, err := s.Get("config/connection") if err != nil { return nil, err } if entry == nil { return nil, fmt.Errorf("configure the DB connection with config/connection first") } var connConfig connectionConfig if err := entry.DecodeJSON(&connConfig); err != nil { return nil, err } conn := connConfig.ConnectionURL if len(conn) == 0 { conn = connConfig.ConnectionString } b.db, err = sql.Open("mysql", conn) if err != nil { return nil, err } // Set some connection pool settings. We don't need much of this, // since the request rate shouldn't be high. b.db.SetMaxOpenConns(connConfig.MaxOpenConnections) b.db.SetMaxIdleConns(connConfig.MaxIdleConnections) return b.db, nil } // ResetDB forces a connection next time DB() is called. func (b *backend) ResetDB() { b.lock.Lock() defer b.lock.Unlock() if b.db != nil { b.db.Close() } b.db = nil } // Lease returns the lease information func (b *backend) Lease(s logical.Storage) (*configLease, error) { entry, err := s.Get("config/lease") if err != nil { return nil, err } if entry == nil { return nil, nil } var result configLease if err := entry.DecodeJSON(&result); err != nil { return nil, err } return &result, nil } const backendHelp = ` The MySQL backend dynamically generates database users. After mounting this backend, configure it using the endpoints within the "config/" path. `
pulcy/vault-monkey
deps/github.com/hashicorp/vault/builtin/logical/mysql/backend.go
GO
apache-2.0
2,536
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.deltaspike.data.impl.meta.verifier; import javax.persistence.Entity; import org.apache.deltaspike.data.impl.meta.unit.PersistenceUnits; public class EntityVerifier implements Verifier<Class<?>> { @Override public boolean verify(Class<?> entity) { return entity.isAnnotationPresent(Entity.class) || PersistenceUnits.instance().isEntity(entity); } }
LightGuard/incubator-deltaspike
deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/verifier/EntityVerifier.java
Java
apache-2.0
1,198
public class J { public static void main(String[] args) { int a = 0, b = 1, c = 2; c ^= a & b; System.out.print(c); } }
jwren/intellij-community
plugins/kotlin/j2k/new/tests/testData/newJ2k/assignmentExpression/compoundAssignmentPriority2.java
Java
apache-2.0
151
/* * Copyright 2000-2011 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.openapi.roots.ui.configuration.dependencyAnalysis; import com.intellij.icons.AllIcons; import com.intellij.ide.presentation.VirtualFilePresentation; import com.intellij.openapi.module.Module; import com.intellij.openapi.roots.*; import com.intellij.openapi.roots.ui.CellAppearanceEx; import com.intellij.openapi.roots.ui.OrderEntryAppearanceService; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileManager; import com.intellij.util.PathUtil; import com.intellij.util.Processor; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.util.*; /** * Analyzer for module classpath. It uses order enumerator to get classpath details. */ public class ModuleDependenciesAnalyzer { /** * The current module */ private final Module myModule; /** * If true production classpath is analyzed. If false, the test classpath. */ private final boolean myProduction; /** * If true the compilation classpath is analyzed. If false, the test classpath. */ private final boolean myCompile; /** * If true, SDK classes are included in the classpath. */ private final boolean mySdk; /** * The order entry explanations */ private final List<OrderEntryExplanation> myOrderEntries = new ArrayList<>(); /** * The url explanations */ private final List<UrlExplanation> myUrls = new ArrayList<>(); /** * The constructor (it creates explanations immediately * * @param module the context module * @param production the production/test flag * @param compile the compile/runtime flag * @param sdk the include sdk paths */ public ModuleDependenciesAnalyzer(Module module, boolean production, boolean compile, boolean sdk) { myModule = module; myProduction = production; myCompile = compile; mySdk = sdk; analyze(); } /** * @return url explanations */ public List<UrlExplanation> getUrls() { return Collections.unmodifiableList(myUrls); } /** * @return order entry explanations */ public List<OrderEntryExplanation> getOrderEntries() { return Collections.unmodifiableList(myOrderEntries); } /** * Analyze module classpath */ private void analyze() { OrderEnumerator e = ModuleRootManager.getInstance(myModule).orderEntries(); e.recursively(); if (!mySdk) { e.withoutSdk(); } if (myCompile) { e.compileOnly(); } else { e.runtimeOnly(); } if (myProduction) { e.productionOnly(); } final Map<String, List<OrderPath>> urlExplanations = new LinkedHashMap<>(); final OrderRootsEnumerator classes = e.classes(); if (myCompile) { classes.withoutSelfModuleOutput(); } for (String url : classes.getUrls()) { if (!urlExplanations.containsKey(url)) { urlExplanations.put(url, new ArrayList<>()); } } final Map<OrderEntry, List<OrderPath>> orderExplanations = new LinkedHashMap<>(); new PathWalker(urlExplanations, orderExplanations).examine(myModule, 0); for (Map.Entry<OrderEntry, List<OrderPath>> entry : orderExplanations.entrySet()) { myOrderEntries.add(new OrderEntryExplanation(entry.getKey(), entry.getValue())); } for (Map.Entry<String, List<OrderPath>> entry : urlExplanations.entrySet()) { myUrls.add(new UrlExplanation(entry.getKey(), entry.getValue())); } } /** * The walker for the class paths. It walks the entire module classpath */ private class PathWalker { /** * The explanations for urls */ private final Map<String, List<OrderPath>> myUrlExplanations; /** * The explanations for order entries */ private final Map<OrderEntry, List<OrderPath>> myOrderExplanations; /** * The current stack */ private final ArrayList<OrderPathElement> myStack = new ArrayList<>(); /** * Visited modules (in order to detect cyclic dependencies) */ private final HashSet<Module> myVisited = new HashSet<>(); /** * The constructor * * @param urlExplanations the url explanations to accumulate * @param orderExplanations the explanations for order entries */ public PathWalker(Map<String, List<OrderPath>> urlExplanations, Map<OrderEntry, List<OrderPath>> orderExplanations) { myUrlExplanations = urlExplanations; myOrderExplanations = orderExplanations; } /** * Examine the specified module * * @param m the module to examine * @param level the level of the examination */ void examine(final Module m, final int level) { if (myVisited.contains(m)) { return; } myVisited.add(m); try { final OrderEnumerator e = ModuleRootManager.getInstance(m).orderEntries(); if (!mySdk || level != 0) { e.withoutSdk(); } if (myCompile && level != 0) { e.exportedOnly(); } if (myProduction) { e.productionOnly(); } if (myCompile) { e.compileOnly(); } else { e.runtimeOnly(); } e.forEach(orderEntry -> { myStack.add(new OrderEntryPathElement(orderEntry)); try { if (orderEntry instanceof ModuleOrderEntry) { ModuleOrderEntry o = (ModuleOrderEntry)orderEntry; examine(o.getModule(), level + 1); } else if (orderEntry instanceof ModuleSourceOrderEntry) { if (!myProduction || !myCompile) { CompilerModuleExtension e1 = CompilerModuleExtension.getInstance(m); final OrderPath p = new OrderPath(myStack); for (String u : e1.getOutputRootUrls(!myCompile ? !myProduction : level > 0 && !myProduction)) { addUrlPath(p, u); } addEntryPath(orderEntry, p); } } else { final OrderPath p = new OrderPath(myStack); for (String u : orderEntry.getUrls(OrderRootType.CLASSES)) { addUrlPath(p, u); } addEntryPath(orderEntry, p); } } finally { myStack.remove(myStack.size() - 1); } return true; }); } finally { myVisited.remove(m); } } /** * Add url path * * @param p the path to add * @param u the url to update */ private void addUrlPath(OrderPath p, String u) { final List<OrderPath> orderPaths = myUrlExplanations.get(u); if (orderPaths != null) { orderPaths.add(p); } } /** * Add order entry explanation * * @param orderEntry the order entry to explain * @param p the path that explain order entry */ private void addEntryPath(OrderEntry orderEntry, OrderPath p) { List<OrderPath> paths = myOrderExplanations.get(orderEntry); if (paths == null) { paths = new ArrayList<>(); myOrderExplanations.put(orderEntry, paths); } paths.add(p); } } /** * The path consisting of order entry path. */ public static class OrderPath { /** * The immutable list of path elements. The first element in the list is an order entry actually included in the current module. */ private final List<OrderPathElement> myEntries; /** * The constructor * * @param entries the list of entries (will be copied and wrapped) */ public OrderPath(List<OrderPathElement> entries) { this.myEntries = Collections.unmodifiableList(new ArrayList<>(entries)); } /** * @return the immutable list of path elements. The first element in the list is an order entry actually included in the current module. */ public List<OrderPathElement> entries() { return myEntries; } @Override public int hashCode() { return myEntries.hashCode(); } @Override public boolean equals(Object obj) { if (!(obj instanceof OrderPath)) { return false; } return myEntries.equals(((OrderPath)obj).myEntries); } } /** * The a entry in the path. The implementation should support {@link #equals(Object)} and {@link #hashCode()} methods. */ public static abstract class OrderPathElement { /** * Get appearance for path element * * @param isSelected true if the element is selected * @return the appearance to use for rendering */ @NotNull public abstract CellAppearanceEx getAppearance(boolean isSelected); } /** * The order entry path element */ public static class OrderEntryPathElement extends OrderPathElement { /** * The order entry */ private final OrderEntry myEntry; /** * The constructor * * @param entry the order entry */ public OrderEntryPathElement(OrderEntry entry) { this.myEntry = entry; } /** * @return the order entry */ public OrderEntry entry() { return myEntry; } /** * {@inheritDoc} */ @Override public int hashCode() { return myEntry.hashCode(); } /** * {@inheritDoc} */ @Override public boolean equals(Object obj) { if (!(obj instanceof OrderEntryPathElement)) { return false; } OrderEntryPathElement o = (OrderEntryPathElement)obj; return o.myEntry == myEntry; } /** * {@inheritDoc} */ @Override public String toString() { return myEntry.getPresentableName(); } /** * {@inheritDoc} */ @NotNull @Override public CellAppearanceEx getAppearance(boolean isSelected) { return OrderEntryAppearanceService.getInstance().forOrderEntry(myEntry.getOwnerModule().getProject(), myEntry, isSelected); } } /** * The base class for explanations */ public static class Explanation { /** * The paths that refer to the path element */ public final List<OrderPath> myPaths; /** * The explanation for the path * * @param paths the paths to analyze (the list is wrapped) */ Explanation(List<OrderPath> paths) { this.myPaths = Collections.unmodifiableList(paths); } /** * @return the paths that refer to the path element */ public List<OrderPath> paths() { return myPaths; } } /** * The explanation for */ public static class OrderEntryExplanation extends Explanation { /** * The URL in the path */ private final OrderEntry myEntry; /** * The explanation for the path * * @param entry the explained order entry * @param paths the paths to analyze */ OrderEntryExplanation(OrderEntry entry, List<OrderPath> paths) { super(paths); myEntry = entry; } /** * @return the explained entry */ public OrderEntry entry() { return myEntry; } } /** * The explanation for url */ public static class UrlExplanation extends Explanation { /** * The URL in the path */ private final String myUrl; /** * The explanation for the path * * @param url the url for the order entry * @param paths the paths to analyze */ UrlExplanation(String url, List<OrderPath> paths) { super(paths); myUrl = url; } /** * @return the explained url */ public String url() { return myUrl; } /** * @return icon for the classpath */ @Nullable public Icon getIcon() { VirtualFile file = getLocalFile(); return file == null ? AllIcons.General.Error : VirtualFilePresentation.getIcon(file); } /** * @return the local file */ @Nullable public VirtualFile getLocalFile() { VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(myUrl); if (file != null) { file = PathUtil.getLocalFile(file); } return file; } } }
asedunov/intellij-community
java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/dependencyAnalysis/ModuleDependenciesAnalyzer.java
Java
apache-2.0
12,803
/** * @license http://www.JSON.org/json2.js */ /* http://www.JSON.org/json2.js 2011-02-23 Public Domain. NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. See http://www.JSON.org/js.html This code should be minified before deployment. See http://javascript.crockford.com/jsmin.html USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO NOT CONTROL. This file creates a global JSON object containing two methods: stringify and parse. JSON.stringify(value, replacer, space) value any JavaScript value, usually an object or array. replacer an optional parameter that determines how object values are stringified for objects. It can be a function or an array of strings. space an optional parameter that specifies the indentation of nested structures. If it is omitted, the text will be packed without extra whitespace. If it is a number, it will specify the number of spaces to indent at each level. If it is a string (such as '\t' or '&nbsp;'), it contains the characters used to indent at each level. This method produces a JSON text from a JavaScript value. When an object value is found, if the object contains a toJSON method, its toJSON method will be called and the result will be stringified. A toJSON method does not serialize: it returns the value represented by the name/value pair that should be serialized, or undefined if nothing should be serialized. The toJSON method will be passed the key associated with the value, and this will be bound to the value For example, this would serialize Dates as ISO strings. Date.prototype.toJSON = function (key) { function f(n) { // Format integers to have at least two digits. return n < 10 ? '0' + n : n; } return this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z'; }; You can provide an optional replacer method. It will be passed the key and value of each member, with this bound to the containing object. The value that is returned from your method will be serialized. If your method returns undefined, then the member will be excluded from the serialization. If the replacer parameter is an array of strings, then it will be used to select the members to be serialized. It filters the results such that only members with keys listed in the replacer array are stringified. Values that do not have JSON representations, such as undefined or functions, will not be serialized. Such values in objects will be dropped; in arrays they will be replaced with null. You can use a replacer function to replace those with JSON values. JSON.stringify(undefined) returns undefined. The optional space parameter produces a stringification of the value that is filled with line breaks and indentation to make it easier to read. If the space parameter is a non-empty string, then that string will be used for indentation. If the space parameter is a number, then the indentation will be that many spaces. Example: text = JSON.stringify(['e', {pluribus: 'unum'}]); // text is '["e",{"pluribus":"unum"}]' text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' text = JSON.stringify([new Date()], function (key, value) { return this[key] instanceof Date ? 'Date(' + this[key] + ')' : value; }); // text is '["Date(---current time---)"]' JSON.parse(text, reviver) This method parses a JSON text to produce an object or array. It can throw a SyntaxError exception. The optional reviver parameter is a function that can filter and transform the results. It receives each of the keys and values, and its return value is used instead of the original value. If it returns what it received, then the structure is not modified. If it returns undefined then the member is deleted. Example: // Parse the text. Values that look like ISO date strings will // be converted to Date objects. myData = JSON.parse(text, function (key, value) { var a; if (typeof value === 'string') { a = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); if (a) { return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], +a[5], +a[6])); } } return value; }); myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { var d; if (typeof value === 'string' && value.slice(0, 5) === 'Date(' && value.slice(-1) === ')') { d = new Date(value.slice(5, -1)); if (d) { return d; } } return value; }); This is a reference implementation. You are free to copy, modify, or redistribute. */ /*jslint evil: true, strict: false, regexp: false */ /*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, lastIndex, length, parse, prototype, push, replace, slice, stringify, test, toJSON, toString, valueOf */ // Create a JSON object only if one does not already exist. We create the // methods in a closure to avoid creating global variables. var JSON; if (!JSON) { JSON = {}; } (function(factory) { if (typeof define === 'function') { define([], factory); } else { factory(); } })(function(require, exports, module) { if (module) module.exports = JSON; //"use strict"; function f(n) { // Format integers to have at least two digits. return n < 10 ? '0' + n : n; } if (typeof Date.prototype.toJSON !== 'function') { Date.prototype.toJSON = function (key) { return isFinite(this.valueOf()) ? this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z' : ''; }; String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function (key) { return this.valueOf(); }; } var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, gap, indent, meta = { // table of character substitutions '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\' }, rep; function quote(string) { // If the string contains no control characters, no quote characters, and no // backslash characters, then we can safely slap some quotes around it. // Otherwise we must also replace the offending characters with safe escape // sequences. escapable.lastIndex = 0; return escapable.test(string) ? '"' + string.replace(escapable, function (a) { var c = meta[a]; return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); }) + '"' : '"' + string + '"'; } function str(key, holder) { // Produce a string from holder[key]. var i, // The loop counter. k, // The member key. v, // The member value. length, mind = gap, partial, value = holder[key]; // If the value has a toJSON method, call it to obtain a replacement value. if (value && typeof value === 'object' && typeof value.toJSON === 'function') { value = value.toJSON(key); } // If we were called with a replacer function, then call the replacer to // obtain a replacement value. if (typeof rep === 'function') { value = rep.call(holder, key, value); } // What happens next depends on the value's type. switch (typeof value) { case 'string': return quote(value); case 'number': // JSON numbers must be finite. Encode non-finite numbers as null. return isFinite(value) ? String(value) : 'null'; case 'boolean': case 'null': // If the value is a boolean or null, convert it to a string. Note: // typeof null does not produce 'null'. The case is included here in // the remote chance that this gets fixed someday. return String(value); // If the type is 'object', we might be dealing with an object or an array or // null. case 'object': // Due to a specification blunder in ECMAScript, typeof null is 'object', // so watch out for that case. if (!value) { return 'null'; } // Make an array to hold the partial results of stringifying this object value. gap += indent; partial = []; // Is the value an array? if (Object.prototype.toString.apply(value) === '[object Array]') { // The value is an array. Stringify every element. Use null as a placeholder // for non-JSON values. length = value.length; for (i = 0; i < length; i += 1) { partial[i] = str(i, value) || 'null'; } // Join all of the elements together, separated with commas, and wrap them in // brackets. v = partial.length === 0 ? '[]' : gap ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : '[' + partial.join(',') + ']'; gap = mind; return v; } // If the replacer is an array, use it to select the members to be stringified. if (rep && typeof rep === 'object') { length = rep.length; for (i = 0; i < length; i += 1) { if (typeof rep[i] === 'string') { k = rep[i]; v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ': ' : ':') + v); } } } } else { // Otherwise, iterate through all of the keys in the object. for (k in value) { if (Object.prototype.hasOwnProperty.call(value, k)) { v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ': ' : ':') + v); } } } } // Join all of the member texts together, separated with commas, // and wrap them in braces. v = partial.length === 0 ? '{}' : gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : '{' + partial.join(',') + '}'; gap = mind; return v; } } // If the JSON object does not yet have a stringify method, give it one. if (typeof JSON.stringify !== 'function') { JSON.stringify = function (value, replacer, space) { // The stringify method takes a value and an optional replacer, and an optional // space parameter, and returns a JSON text. The replacer can be a function // that can replace values, or an array of strings that will select the keys. // A default replacer method can be provided. Use of the space parameter can // produce text that is more easily readable. var i; gap = ''; indent = ''; // If the space parameter is a number, make an indent string containing that // many spaces. if (typeof space === 'number') { for (i = 0; i < space; i += 1) { indent += ' '; } // If the space parameter is a string, it will be used as the indent string. } else if (typeof space === 'string') { indent = space; } // If there is a replacer, it must be a function or an array. // Otherwise, throw an error. rep = replacer; if (replacer && typeof replacer !== 'function' && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) { throw new Error('JSON.stringify'); } // Make a fake root object containing our value under the key of ''. // Return the result of stringifying the value. return str('', {'': value}); }; } // If the JSON object does not yet have a parse method, give it one. if (typeof JSON.parse !== 'function') { JSON.parse = function (text, reviver) { // The parse method takes a text and an optional reviver function, and returns // a JavaScript value if the text is a valid JSON text. var j; function walk(holder, key) { // The walk method is used to recursively walk the resulting structure so // that modifications can be made. var k, v, value = holder[key]; if (value && typeof value === 'object') { for (k in value) { if (Object.prototype.hasOwnProperty.call(value, k)) { v = walk(value, k); if (v !== undefined) { value[k] = v; } else { delete value[k]; } } } } return reviver.call(holder, key, value); } // Parsing happens in four stages. In the first stage, we replace certain // Unicode characters with escape sequences. JavaScript handles many characters // incorrectly, either silently deleting them, or treating them as line endings. text = String(text); cx.lastIndex = 0; if (cx.test(text)) { text = text.replace(cx, function (a) { return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); }); } // In the second stage, we run the text against regular expressions that look // for non-JSON patterns. We are especially concerned with '()' and 'new' // because they can cause invocation, and '=' because it can cause mutation. // But just to be safe, we want to reject all unexpected forms. // We split the second stage into 4 regexp operations in order to work around // crippling inefficiencies in IE's and Safari's regexp engines. First we // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we // replace all simple value tokens with ']' characters. Third, we delete all // open brackets that follow a colon or comma or that begin the text. Finally, // we look to see that the remaining characters are only whitespace or ']' or // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. if (/^[\],:{}\s]*$/ .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { // In the third stage we use the eval function to compile the text into a // JavaScript structure. The '{' operator is subject to a syntactic ambiguity // in JavaScript: it can begin a block or an object literal. We wrap the text // in parens to eliminate the ambiguity. j = eval('(' + text + ')'); // In the optional fourth stage, we recursively walk the new structure, passing // each name/value pair to a reviver function for possible transformation. return typeof reviver === 'function' ? walk({'': j}, '') : j; } // If the text is not JSON parseable, then a SyntaxError is thrown. throw new SyntaxError('JSON.parse'); }; } });
huguijian/webIM
webroot/static/assets/lib/bootstrap/plugins/ie/json2.js
JavaScript
apache-2.0
17,647
/** ****************************************************************************** * @file us_ticker_api.h * @brief Implementation of a Timer driver * @internal * @author ON Semiconductor * $Rev: $ * $Date: 2015-11-15 $ ****************************************************************************** * Copyright 2016 Semiconductor Components Industries LLC (d/b/a “ON Semiconductor”). * All rights reserved. This software and/or documentation is licensed by ON Semiconductor * under limited terms and conditions. The terms and conditions pertaining to the software * and/or documentation are available at http://www.onsemi.com/site/pdf/ONSEMI_T&C.pdf * (“ON Semiconductor Standard Terms and Conditions of Sale, Section 8 Software”) and * if applicable the software license agreement. Do not use this software and/or * documentation unless you have carefully read and you agree to the limited terms and * conditions. By using this software and/or documentation, you agree to the limited * terms and conditions. * * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. * ON SEMICONDUCTOR SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, * INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. * @endinternal * * @ingroup timer */ #include <stddef.h> #include "timer_ncs36510.h" #define US_TIMER TIMER0 #define US_TICKER TIMER1 static int us_ticker_inited = 0; static void us_timer_init(void); static uint32_t us_ticker_target = 0; static volatile uint16_t msb_counter = 0; void us_ticker_init(void) { if (!us_ticker_inited) { us_timer_init(); } } /******************************************************************************* * Timer for us timing reference * * Uptime counter for scheduling reference. It uses TIMER0. * The NCS36510 does not have a 32 bit timer nor the option to chain timers, * which is why a software timer is required to get 32-bit word length. ******************************************************************************/ /* TODO - Need some sort of load value/prescale calculation for non-32MHz clock */ /* TODO - How is overflow handled? */ /* Timer 0 for free running time */ extern void us_timer_isr(void) { TIM0REG->CLEAR = 0; msb_counter++; } /* Initializing TIMER 0(TImer) and TIMER 1(Ticker) */ static void us_timer_init(void) { /* Enable the timer0 periphery clock */ CLOCK_ENABLE(CLOCK_TIMER0); /* Enable the timer0 periphery clock */ CLOCK_ENABLE(CLOCK_TIMER1); /* Timer init */ /* load timer value */ TIM0REG->LOAD = 0xFFFF; /* set timer prescale 32 (1 us), mode & enable */ TIM0REG->CONTROL.WORD = ((CLK_DIVIDER_32 << TIMER_PRESCALE_BIT_POS) | (TIME_MODE_PERIODIC << TIMER_MODE_BIT_POS) | (TIMER_ENABLE_BIT << TIMER_ENABLE_BIT_POS)); /* Ticker init */ /* load timer value */ TIM1REG->LOAD = 0xFFFF; /* set timer prescale 32 (1 us), mode & enable */ TIM1REG->CONTROL.WORD = ((CLK_DIVIDER_32 << TIMER_PRESCALE_BIT_POS) | (TIME_MODE_PERIODIC << TIMER_MODE_BIT_POS)); /* Register & enable interrupt associated with the timer */ NVIC_SetVector(Tim0_IRQn,(uint32_t)us_timer_isr); NVIC_SetVector(Tim1_IRQn,(uint32_t)us_ticker_isr); /* Clear pending irqs */ NVIC_ClearPendingIRQ(Tim0_IRQn); NVIC_ClearPendingIRQ(Tim1_IRQn); /* Setup NVIC for timer */ NVIC_EnableIRQ(Tim0_IRQn); NVIC_EnableIRQ(Tim1_IRQn); us_ticker_inited = 1; } /* Reads 32 bit timer's current value (16 bit s/w timer | 16 bit h/w timer) */ uint32_t us_ticker_read() { if (!us_ticker_inited) { us_timer_init(); } NVIC_DisableIRQ(Tim0_IRQn); uint32_t retval, tim0cval; /* Get the current tick from the hw and sw timers */ tim0cval = TIM0REG->VALUE; /* read current time */ retval = (0xFFFF - tim0cval); /* subtract down count */ if (TIM0REG->CONTROL.BITS.INT) { us_timer_isr(); /* handle ISR again */ NVIC_ClearPendingIRQ(Tim0_IRQn); retval = (0xFFFF - TIM0REG->VALUE); } retval |= msb_counter << 16; /* add software bits */ NVIC_EnableIRQ(Tim0_IRQn); return retval; } void us_ticker_fire_interrupt(void) { NVIC_SetPendingIRQ(Tim0_IRQn); } /******************************************************************************* * Event Timer * * Schedules interrupts at given (32bit)us interval of time. It uses TIMER1. * The NCS36510 does not have a 32 bit timer nor the option to chain timers, * which is why a software timer is required to get 32-bit word length. *******************************************************************************/ /* TODO - Need some sort of load value/prescale calculation for non-32MHz clock */ /* TImer 1 disbale interrupt */ void us_ticker_disable_interrupt(void) { /* Disable the TIMER1 interrupt */ TIM1REG->CONTROL.BITS.ENABLE = 0x0; } /* TImer 1 clear interrupt */ void us_ticker_clear_interrupt(void) { /* Clear the Ticker (TIMER1) interrupt */ TIM1REG->CLEAR = 0; } /* Setting TImer 1 (ticker) */ inline static void ticker_set(uint32_t count) { /* Disable TIMER1, load the new value, and re-enable */ TIM1REG->CONTROL.BITS.ENABLE = 0; TIM1REG->LOAD = count; TIM1REG->CONTROL.BITS.ENABLE = 1; } /* TImer 1 - ticker ISR */ extern void us_ticker_isr(void) { /* Clear IRQ flag */ TIM1REG->CLEAR = 0; if (us_ticker_target > 0) { --us_ticker_target; ticker_set(0xFFFF); } else { us_ticker_irq_handler(); } } /* Set timer 1 ticker interrupt */ void us_ticker_set_interrupt(timestamp_t timestamp) { int32_t delta = timestamp - us_ticker_read(); // we got 16 bit timer, use upper 16bit as a simple counter how many times // we need to schedule full range ticker count us_ticker_target = (uint32_t)delta >> 16; if (delta <= 0) { /* This event was in the past */ //us_ticker_irq_handler(); // This event was in the past. // Set the interrupt as pending, but don't process it here. // This prevents a recurive loop under heavy load // which can lead to a stack overflow. NVIC_SetPendingIRQ(Tim1_IRQn); return; } // we set the full reminder of 16 bit, the next ISR will do the upper part ticker_set(delta & 0xFFFF); }
fahhem/mbed-os
targets/TARGET_ONSEMI/TARGET_NCS36510/ncs36510_us_ticker_api.c
C
apache-2.0
6,609
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.pig.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import java.io.IOException; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; import java.util.Map; import org.apache.pig.EvalFunc; import org.apache.pig.ExecType; import org.apache.pig.FuncSpec; import org.apache.pig.LoadFunc; import org.apache.pig.PigServer; import org.apache.pig.backend.executionengine.ExecException; import org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigMapReduce; import org.apache.pig.backend.hadoop.executionengine.physicalLayer.POStatus; import org.apache.pig.backend.hadoop.executionengine.physicalLayer.Result; import org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POLoad; import org.apache.pig.builtin.PigStorage; import org.apache.pig.data.BagFactory; import org.apache.pig.data.DataBag; import org.apache.pig.data.DataByteArray; import org.apache.pig.data.Tuple; import org.apache.pig.data.TupleFactory; import org.apache.pig.impl.PigContext; import org.apache.pig.impl.io.FileSpec; import org.apache.pig.impl.logicalLayer.schema.Schema; import org.apache.pig.impl.plan.OperatorKey; import org.apache.pig.test.utils.TestHelper; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.Test; public class TestFRJoin { private static final String INPUT_FILE = "testFrJoinInput.txt"; private static final String INPUT_FILE2 = "testFrJoinInput2.txt"; private PigServer pigServer; private static MiniCluster cluster = MiniCluster.buildCluster(); public TestFRJoin() throws ExecException, IOException { pigServer = new PigServer(ExecType.MAPREDUCE, cluster.getProperties()); } @Before public void setUp() throws Exception { int LOOP_SIZE = 2; String[] input = new String[2 * LOOP_SIZE]; int k = 0; for(int i = 1; i <= LOOP_SIZE; i++) { String si = i + ""; for (int j = 1; j <= LOOP_SIZE; j++) input[k++] = si + "\t" + j; } Util.createInputFile(cluster, INPUT_FILE, input); String[] input2 = new String[2 * (LOOP_SIZE / 2)]; k = 0; for (int i = 1; i <= LOOP_SIZE / 2; i++) { String si = i + ""; for (int j = 1; j <= LOOP_SIZE / 2; j++) input2[k++] = si + "\t" + j; } Util.createInputFile(cluster, INPUT_FILE2, input2); } @AfterClass public static void oneTimeTearDown() throws Exception { cluster.shutDown(); } @After public void tearDown() throws Exception { Util.deleteFile(cluster, INPUT_FILE); Util.deleteFile(cluster, INPUT_FILE2); } public static class FRJoin extends EvalFunc<DataBag> { String repl; int keyField; boolean isTblSetUp = false; Hashtable<String, DataBag> replTbl = new Hashtable<String, DataBag>(); public FRJoin() { } public FRJoin(String repl) { this.repl = repl; } @Override public DataBag exec(Tuple input) throws IOException { if (!isTblSetUp) { setUpHashTable(); isTblSetUp = true; } String key = (String)input.get(keyField); if (!replTbl.containsKey(key)) return BagFactory.getInstance().newDefaultBag(); return replTbl.get(key); } private void setUpHashTable() throws IOException { FileSpec replFile = new FileSpec(repl, new FuncSpec(PigStorage.class.getName() + "()")); POLoad ld = new POLoad(new OperatorKey("Repl File Loader", 1L), replFile); PigContext pc = new PigContext(ExecType.MAPREDUCE, PigMapReduce.sJobConfInternal.get()); pc.connect(); ld.setPc(pc); Tuple dummyTuple = null; for (Result res = ld.getNextTuple(); res.returnStatus != POStatus.STATUS_EOP; res = ld .getNextTuple()) { Tuple tup = (Tuple)res.result; LoadFunc lf = ((LoadFunc)pc.instantiateFuncFromSpec(ld.getLFile().getFuncSpec())); String key = lf.getLoadCaster().bytesToCharArray( ((DataByteArray)tup.get(keyField)).get()); Tuple csttup = TupleFactory.getInstance().newTuple(2); csttup.set(0, key); csttup.set(1, lf.getLoadCaster().bytesToInteger(((DataByteArray)tup.get(1)).get())); DataBag vals = null; if (replTbl.containsKey(key)) { vals = replTbl.get(key); } else { vals = BagFactory.getInstance().newDefaultBag(); replTbl.put(key, vals); } vals.add(csttup); } } } @Test public void testSortFRJoin() throws IOException { pigServer.registerQuery("A = LOAD '" + INPUT_FILE + "' as (x:int,y:int);"); pigServer.registerQuery("B = LOAD '" + INPUT_FILE + "' as (x:int,y:int);"); pigServer.registerQuery("D = ORDER A by y;"); pigServer.registerQuery("E = ORDER B by y;"); DataBag dbfrj = BagFactory.getInstance().newDefaultBag(), dbshj = BagFactory.getInstance() .newDefaultBag(); { pigServer.registerQuery("C = join D by $0, E by $0 using \'replicated\';"); Iterator<Tuple> iter = pigServer.openIterator("C"); while (iter.hasNext()) { dbfrj.add(iter.next()); } } { pigServer.registerQuery("C = join D by $0, E by $0;"); Iterator<Tuple> iter = pigServer.openIterator("C"); while (iter.hasNext()) { dbshj.add(iter.next()); } } assertEquals(dbfrj.size(), dbshj.size()); assertTrue(TestHelper.compareBags(dbfrj, dbshj)); } @Test public void testDistinctFRJoin() throws IOException { pigServer.registerQuery("A = LOAD '" + INPUT_FILE + "' as (x:int,y:int);"); pigServer.registerQuery("B = LOAD '" + INPUT_FILE + "' as (x:int,y:int);"); pigServer.registerQuery("D = distinct A ;"); pigServer.registerQuery("E = distinct B ;"); DataBag dbfrj = BagFactory.getInstance().newDefaultBag(), dbshj = BagFactory.getInstance() .newDefaultBag(); { pigServer.registerQuery("C = join D by $0, E by $0 using 'replicated';"); Iterator<Tuple> iter = pigServer.openIterator("C"); while (iter.hasNext()) { dbfrj.add(iter.next()); } } { pigServer.registerQuery("C = join D by $0, E by $0;"); Iterator<Tuple> iter = pigServer.openIterator("C"); while (iter.hasNext()) { dbshj.add(iter.next()); } } assertEquals(dbfrj.size(), dbshj.size()); assertTrue(TestHelper.compareBags(dbfrj, dbshj)); } @Test public void testUDFFRJ() throws IOException { pigServer.registerQuery("A = LOAD '" + INPUT_FILE + "' as (x:chararray,y:int);"); pigServer.registerQuery("B = LOAD '" + INPUT_FILE + "' as (x:chararray,y:int);"); DataBag dbfrj = BagFactory.getInstance().newDefaultBag(), dbshj = BagFactory.getInstance() .newDefaultBag(); { String fSpec = FRJoin.class.getName() + "('" + INPUT_FILE + "')"; pigServer.registerFunction("FRJ", new FuncSpec(fSpec)); pigServer.registerQuery("C = foreach A generate *, flatten(FRJ(*));"); Iterator<Tuple> iter = pigServer.openIterator("C"); while (iter.hasNext()) { dbfrj.add(iter.next()); } } { pigServer.registerQuery("C = join A by $0, B by $0;"); Iterator<Tuple> iter = pigServer.openIterator("C"); while (iter.hasNext()) { dbshj.add(iter.next()); } } assertTrue(dbfrj.size() > 0); assertTrue(dbshj.size() > 0); assertTrue(TestHelper.compareBags(dbfrj, dbshj)); } @Test public void testFRJoinOut1() throws IOException { pigServer.registerQuery("A = LOAD '" + INPUT_FILE + "' as (x:int,y:int);"); pigServer.registerQuery("B = LOAD '" + INPUT_FILE + "' as (x:int,y:int);"); DataBag dbfrj = BagFactory.getInstance().newDefaultBag(), dbshj = BagFactory.getInstance() .newDefaultBag(); { pigServer.registerQuery("C = join A by $0, B by $0 using 'replicated';"); Iterator<Tuple> iter = pigServer.openIterator("C"); while (iter.hasNext()) { dbfrj.add(iter.next()); } } { pigServer.registerQuery("C = join A by $0, B by $0;"); Iterator<Tuple> iter = pigServer.openIterator("C"); while (iter.hasNext()) { dbshj.add(iter.next()); } } assertTrue(dbfrj.size() > 0); assertTrue(dbshj.size() > 0); assertTrue(TestHelper.compareBags(dbfrj, dbshj)); } @Test public void testFRJoinOut2() throws IOException { pigServer.registerQuery("A = LOAD '" + INPUT_FILE + "';"); pigServer.registerQuery("B = LOAD '" + INPUT_FILE + "';"); DataBag dbfrj = BagFactory.getInstance().newDefaultBag(), dbshj = BagFactory.getInstance() .newDefaultBag(); { pigServer.registerQuery("C = join A by $0, B by $0 using 'replicated';"); Iterator<Tuple> iter = pigServer.openIterator("C"); while (iter.hasNext()) { dbfrj.add(iter.next()); } } { pigServer.registerQuery("C = join A by $0, B by $0;"); Iterator<Tuple> iter = pigServer.openIterator("C"); while (iter.hasNext()) { dbshj.add(iter.next()); } } assertTrue(dbfrj.size() > 0); assertTrue(dbshj.size() > 0); assertTrue(TestHelper.compareBags(dbfrj, dbshj)); } @Test public void testFRJoinOut3() throws IOException { pigServer.registerQuery("A = LOAD '" + INPUT_FILE + "' as (x:int,y:int);"); pigServer.registerQuery("B = LOAD '" + INPUT_FILE + "' as (x:int,y:int);"); pigServer.registerQuery("C = LOAD '" + INPUT_FILE + "' as (x:int,y:int);"); DataBag dbfrj = BagFactory.getInstance().newDefaultBag(), dbshj = BagFactory.getInstance() .newDefaultBag(); { pigServer.registerQuery("D = join A by $0, B by $0, C by $0 using 'replicated';"); Iterator<Tuple> iter = pigServer.openIterator("D"); while (iter.hasNext()) { dbfrj.add(iter.next()); } } { pigServer.registerQuery("D = join A by $0, B by $0, C by $0;"); Iterator<Tuple> iter = pigServer.openIterator("D"); while (iter.hasNext()) { dbshj.add(iter.next()); } } assertTrue(dbfrj.size() > 0); assertTrue(dbshj.size() > 0); assertTrue(TestHelper.compareBags(dbfrj, dbshj)); } @Test public void testFRJoinOut4() throws IOException { pigServer.registerQuery("A = LOAD '" + INPUT_FILE + "';"); pigServer.registerQuery("B = LOAD '" + INPUT_FILE + "';"); pigServer.registerQuery("C = LOAD '" + INPUT_FILE + "';"); DataBag dbfrj = BagFactory.getInstance().newDefaultBag(), dbshj = BagFactory.getInstance() .newDefaultBag(); { pigServer.registerQuery("D = join A by $0, B by $0, C by $0 using 'replicated';"); Iterator<Tuple> iter = pigServer.openIterator("D"); while (iter.hasNext()) { dbfrj.add(iter.next()); } } { pigServer.registerQuery("D = join A by $0, B by $0, C by $0;"); Iterator<Tuple> iter = pigServer.openIterator("D"); while (iter.hasNext()) { dbshj.add(iter.next()); } } assertTrue(dbfrj.size() > 0); assertTrue(dbshj.size() > 0); assertTrue(TestHelper.compareBags(dbfrj, dbshj)); } @Test public void testFRJoinOut5() throws IOException { pigServer.registerQuery("A = LOAD '" + INPUT_FILE + "' as (x:int,y:int);"); pigServer.registerQuery("B = LOAD '" + INPUT_FILE + "' as (x:int,y:int);"); DataBag dbfrj = BagFactory.getInstance().newDefaultBag(), dbshj = BagFactory.getInstance() .newDefaultBag(); { pigServer.registerQuery("C = join A by ($0,$1), B by ($0,$1) using 'replicated';"); Iterator<Tuple> iter = pigServer.openIterator("C"); while (iter.hasNext()) { dbfrj.add(iter.next()); } } { pigServer.registerQuery("C = join A by ($0,$1), B by ($0,$1);"); Iterator<Tuple> iter = pigServer.openIterator("C"); while (iter.hasNext()) { dbshj.add(iter.next()); } } assertTrue(dbfrj.size() > 0); assertTrue(dbshj.size() > 0); assertTrue(TestHelper.compareBags(dbfrj, dbshj)); } @Test public void testFRJoinOut6() throws IOException { pigServer.registerQuery("A = LOAD '" + INPUT_FILE + "';"); pigServer.registerQuery("B = LOAD '" + INPUT_FILE + "';"); DataBag dbfrj = BagFactory.getInstance().newDefaultBag(), dbshj = BagFactory.getInstance() .newDefaultBag(); { pigServer.registerQuery("C = join A by ($0,$1), B by ($0,$1) using 'replicated';"); Iterator<Tuple> iter = pigServer.openIterator("C"); while (iter.hasNext()) { dbfrj.add(iter.next()); } } { pigServer.registerQuery("C = join A by ($0,$1), B by ($0,$1);"); Iterator<Tuple> iter = pigServer.openIterator("C"); while (iter.hasNext()) { dbshj.add(iter.next()); } } assertTrue(dbfrj.size() > 0); assertTrue(dbshj.size() > 0); assertTrue(TestHelper.compareBags(dbfrj, dbshj)); } @Test public void testFRJoinOut7() throws IOException { pigServer.registerQuery("A = LOAD '" + INPUT_FILE + "' as (x:int,y:int);"); pigServer.registerQuery("B = LOAD '" + INPUT_FILE + "' as (x:int,y:int);"); DataBag dbfrj = BagFactory.getInstance().newDefaultBag(), dbshj = BagFactory.getInstance() .newDefaultBag(); { pigServer.registerQuery("C = join A by $0, B by $0 using 'replicated';"); pigServer.registerQuery("D = join A by $1, B by $1 using 'replicated';"); pigServer.registerQuery("E = union C,D;"); Iterator<Tuple> iter = pigServer.openIterator("E"); while (iter.hasNext()) { dbfrj.add(iter.next()); } } { pigServer.registerQuery("C = join A by $0, B by $0;"); pigServer.registerQuery("D = join A by $1, B by $1;"); pigServer.registerQuery("E = union C,D;"); Iterator<Tuple> iter = pigServer.openIterator("E"); while (iter.hasNext()) { dbshj.add(iter.next()); } } assertTrue(dbfrj.size() > 0); assertTrue(dbshj.size() > 0); assertTrue(TestHelper.compareBags(dbfrj, dbshj)); } @Test public void testFRJoinOut8() throws IOException { pigServer.registerQuery("A = LOAD '" + INPUT_FILE + "' as (x:int,y:int);"); pigServer.registerQuery("B = LOAD '" + INPUT_FILE2 + "' as (x:int,y:int);"); DataBag dbfrj = BagFactory.getInstance().newDefaultBag(), dbshj = BagFactory.getInstance() .newDefaultBag(); Map<String, Tuple> hashFRJoin = new HashMap<String, Tuple>(); Map<String, Tuple> hashJoin = new HashMap<String, Tuple>(); { pigServer.registerQuery("C = join A by $0 left, B by $0 using 'replicated';"); pigServer.registerQuery("D = join A by $1 left, B by $1 using 'replicated';"); pigServer.registerQuery("E = union C,D;"); Iterator<Tuple> iter = pigServer.openIterator("E"); while (iter.hasNext()) { Tuple tuple = iter.next(); String Key = tuple.toDelimitedString(","); hashFRJoin.put(Key, tuple); dbfrj.add(tuple); } } { pigServer.registerQuery("C = join A by $0 left, B by $0;"); pigServer.registerQuery("D = join A by $1 left, B by $1;"); pigServer.registerQuery("E = union C,D;"); Iterator<Tuple> iter = pigServer.openIterator("E"); while (iter.hasNext()) { Tuple tuple = iter.next(); String Key = tuple.toDelimitedString(","); hashJoin.put(Key, tuple); dbshj.add(tuple); } } assertTrue(dbfrj.size() > 0); assertTrue(dbshj.size() > 0); assertTrue(TestHelper.compareBags(dbfrj, dbshj)); } @Test public void testFRJoinOut9() throws IOException { pigServer.registerQuery("A = LOAD '" + INPUT_FILE + "' as (x:int,y:int);"); pigServer.registerQuery("B = LOAD '" + INPUT_FILE2 + "' as (x:int,y:int);"); DataBag dbfrj = BagFactory.getInstance().newDefaultBag(), dbshj = BagFactory.getInstance() .newDefaultBag(); Map<String, Tuple> hashFRJoin = new HashMap<String, Tuple>(); Map<String, Tuple> hashJoin = new HashMap<String, Tuple>(); { pigServer.registerQuery("C = join A by $0 left, B by $0 using 'repl';"); pigServer.registerQuery("D = join A by $1 left, B by $1 using 'repl';"); pigServer.registerQuery("E = union C,D;"); Iterator<Tuple> iter = pigServer.openIterator("E"); while (iter.hasNext()) { Tuple tuple = iter.next(); String Key = tuple.toDelimitedString(","); hashFRJoin.put(Key, tuple); dbfrj.add(tuple); } } { pigServer.registerQuery("C = join A by $0 left, B by $0;"); pigServer.registerQuery("D = join A by $1 left, B by $1;"); pigServer.registerQuery("E = union C,D;"); Iterator<Tuple> iter = pigServer.openIterator("E"); while (iter.hasNext()) { Tuple tuple = iter.next(); String Key = tuple.toDelimitedString(","); hashJoin.put(Key, tuple); dbshj.add(tuple); } } assertTrue(dbfrj.size() > 0); assertTrue(dbshj.size() > 0); assertTrue(TestHelper.compareBags(dbfrj, dbshj)); } @Test public void testFRJoinSch1() throws IOException { pigServer.registerQuery("A = LOAD '" + INPUT_FILE + "' as (x:int,y:int);"); pigServer.registerQuery("B = LOAD '" + INPUT_FILE + "' as (x:int,y:int);"); Schema frjSch = null, shjSch = null; pigServer.registerQuery("C = join A by $0, B by $0 using 'repl';"); frjSch = pigServer.dumpSchema("C"); pigServer.registerQuery("C = join A by $0, B by $0;"); shjSch = pigServer.dumpSchema("C"); assertEquals(shjSch, frjSch); } @Test public void testFRJoinSch2() throws IOException { pigServer.registerQuery("A = LOAD '" + INPUT_FILE + "';"); pigServer.registerQuery("B = LOAD '" + INPUT_FILE + "';"); Schema frjSch = null, shjSch = null; pigServer.registerQuery("C = join A by $0, B by $0 using 'repl';"); frjSch = pigServer.dumpSchema("C"); pigServer.registerQuery("C = join A by $0, B by $0;"); shjSch = pigServer.dumpSchema("C"); assertNull(shjSch); } @Test public void testFRJoinSch3() throws IOException { pigServer.registerQuery("A = LOAD '" + INPUT_FILE + "' as (x:int,y:int);"); pigServer.registerQuery("B = LOAD '" + INPUT_FILE + "' as (x:int,y:int);"); pigServer.registerQuery("C = LOAD '" + INPUT_FILE + "' as (x:int,y:int);"); Schema frjSch = null, shjSch = null; pigServer.registerQuery("D = join A by $0, B by $0, C by $0 using 'repl';"); frjSch = pigServer.dumpSchema("D"); pigServer.registerQuery("D = join A by $0, B by $0, C by $0;"); shjSch = pigServer.dumpSchema("D"); assertEquals(shjSch, frjSch); } @Test public void testFRJoinSch4() throws IOException { pigServer.registerQuery("A = LOAD '" + INPUT_FILE + "';"); pigServer.registerQuery("B = LOAD '" + INPUT_FILE + "';"); pigServer.registerQuery("C = LOAD '" + INPUT_FILE + "';"); Schema frjSch = null, shjSch = null; pigServer.registerQuery("D = join A by $0, B by $0, C by $0 using 'repl';"); frjSch = pigServer.dumpSchema("D"); pigServer.registerQuery("D = join A by $0, B by $0, C by $0;"); shjSch = pigServer.dumpSchema("D"); assertNull(shjSch); } @Test public void testFRJoinSch5() throws IOException { pigServer.registerQuery("A = LOAD '" + INPUT_FILE + "' as (x:int,y:int);"); pigServer.registerQuery("B = LOAD '" + INPUT_FILE + "' as (x:int,y:int);"); Schema frjSch = null, shjSch = null; pigServer.registerQuery("C = join A by ($0,$1), B by ($0,$1) using 'repl';"); frjSch = pigServer.dumpSchema("C"); pigServer.registerQuery("C = join A by ($0,$1), B by ($0,$1);"); shjSch = pigServer.dumpSchema("C"); assertEquals(shjSch, frjSch); } @Test public void testFRJoinSch6() throws IOException { pigServer.registerQuery("A = LOAD '" + INPUT_FILE + "';"); pigServer.registerQuery("B = LOAD '" + INPUT_FILE + "';"); Schema frjSch = null, shjSch = null; pigServer.registerQuery("C = join A by ($0,$1), B by ($0,$1) using 'repl';"); frjSch = pigServer.dumpSchema("C"); pigServer.registerQuery("C = join A by ($0,$1), B by ($0,$1);"); shjSch = pigServer.dumpSchema("C"); assertNull(shjSch); } }
siddaartha/spork
test/org/apache/pig/test/TestFRJoin.java
Java
apache-2.0
23,396
/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.fbotest; import java.io.Writer; import android.content.res.Resources; import android.renderscript.*; import android.renderscript.Element.DataType; import android.renderscript.Element.DataKind; import android.renderscript.ProgramStore.DepthFunc; import android.renderscript.Type.Builder; import android.util.Log; public class FBOSyncRS { public FBOSyncRS() { } public void init(RenderScriptGL rs, Resources res) { mRS = rs; mRes = res; initRS(); } public void surfaceChanged() { mRS.getWidth(); mRS.getHeight(); } private Resources mRes; private RenderScriptGL mRS; private Sampler mSampler; private ProgramStore mPSBackground; private ProgramFragment mPFBackground; private ProgramVertex mPVBackground; private ProgramVertexFixedFunction.Constants mPVA; private Allocation mGridImage; private Allocation mOffscreen; private Allocation mOffscreenDepth; private Allocation mAllocPV; private Allocation mReadBackTest; private Font mItalic; private Allocation mTextAlloc; private ScriptField_MeshInfo mMeshes; private ScriptC_fbosync mScript; public void onActionDown(float x, float y) { mScript.invoke_onActionDown(x, y); } public void onActionScale(float scale) { mScript.invoke_onActionScale(scale); } public void onActionMove(float x, float y) { mScript.invoke_onActionMove(x, y); } private void initPFS() { ProgramStore.Builder b = new ProgramStore.Builder(mRS); b.setDepthFunc(ProgramStore.DepthFunc.LESS); b.setDitherEnabled(false); b.setDepthMaskEnabled(true); mPSBackground = b.create(); mScript.set_gPFSBackground(mPSBackground); } private void initPF() { Sampler.Builder bs = new Sampler.Builder(mRS); bs.setMinification(Sampler.Value.LINEAR); bs.setMagnification(Sampler.Value.LINEAR); bs.setWrapS(Sampler.Value.CLAMP); bs.setWrapT(Sampler.Value.CLAMP); mSampler = bs.create(); ProgramFragmentFixedFunction.Builder b = new ProgramFragmentFixedFunction.Builder(mRS); b.setTexture(ProgramFragmentFixedFunction.Builder.EnvMode.REPLACE, ProgramFragmentFixedFunction.Builder.Format.RGBA, 0); mPFBackground = b.create(); mPFBackground.bindSampler(mSampler, 0); mScript.set_gPFBackground(mPFBackground); } private void initPV() { ProgramVertexFixedFunction.Builder pvb = new ProgramVertexFixedFunction.Builder(mRS); mPVBackground = pvb.create(); mPVA = new ProgramVertexFixedFunction.Constants(mRS); ((ProgramVertexFixedFunction)mPVBackground).bindConstants(mPVA); mScript.set_gPVBackground(mPVBackground); } private void loadImage() { mGridImage = Allocation.createFromBitmapResource(mRS, mRes, R.drawable.robot, Allocation.MipmapControl.MIPMAP_ON_SYNC_TO_TEXTURE, Allocation.USAGE_GRAPHICS_TEXTURE); mScript.set_gTGrid(mGridImage); } private void initTextAllocation(String fileName) { String allocString = "Displaying file: " + fileName; mTextAlloc = Allocation.createFromString(mRS, allocString, Allocation.USAGE_SCRIPT); mScript.set_gTextAlloc(mTextAlloc); } private void initMeshes(FileA3D model) { int numEntries = model.getIndexEntryCount(); int numMeshes = 0; for (int i = 0; i < numEntries; i ++) { FileA3D.IndexEntry entry = model.getIndexEntry(i); if (entry != null && entry.getEntryType() == FileA3D.EntryType.MESH) { numMeshes ++; } } if (numMeshes > 0) { mMeshes = new ScriptField_MeshInfo(mRS, numMeshes); for (int i = 0; i < numEntries; i ++) { FileA3D.IndexEntry entry = model.getIndexEntry(i); if (entry != null && entry.getEntryType() == FileA3D.EntryType.MESH) { Mesh mesh = entry.getMesh(); mMeshes.set_mMesh(i, mesh, false); mMeshes.set_mNumIndexSets(i, mesh.getPrimitiveCount(), false); } } mMeshes.copyAll(); } else { throw new RSRuntimeException("No valid meshes in file"); } mScript.bind_gMeshes(mMeshes); mScript.invoke_updateMeshInfo(); } public void loadA3DFile(String path) { FileA3D model = FileA3D.createFromFile(mRS, path); initMeshes(model); initTextAllocation(path); } private void initRS() { mScript = new ScriptC_fbosync(mRS, mRes, R.raw.fbosync); initPFS(); initPF(); initPV(); loadImage(); Type.Builder b = new Type.Builder(mRS, Element.RGBA_8888(mRS)); b.setX(512).setY(512); mOffscreen = Allocation.createTyped(mRS, b.create(), Allocation.USAGE_SCRIPT | Allocation.USAGE_GRAPHICS_TEXTURE | Allocation.USAGE_GRAPHICS_RENDER_TARGET); mScript.set_gOffscreen(mOffscreen); mReadBackTest = Allocation.createTyped(mRS, b.create(), Allocation.USAGE_SCRIPT | Allocation.USAGE_GRAPHICS_TEXTURE); mScript.set_gReadBackTest(mReadBackTest); b = new Type.Builder(mRS, Element.createPixel(mRS, DataType.UNSIGNED_16, DataKind.PIXEL_DEPTH)); b.setX(512).setY(512); mOffscreenDepth = Allocation.createTyped(mRS, b.create(), Allocation.USAGE_GRAPHICS_RENDER_TARGET); mScript.set_gOffscreenDepth(mOffscreenDepth); FileA3D model = FileA3D.createFromResource(mRS, mRes, R.raw.robot); initMeshes(model); mItalic = Font.create(mRS, mRes, "serif", Font.Style.ITALIC, 8); mScript.set_gItalic(mItalic); initTextAllocation("R.raw.robot"); mRS.bindRootScript(mScript); } }
Ant-Droid/android_frameworks_base_OLD
tests/RenderScriptTests/FBOTest/src/com/android/fbotest/FBOSyncRS.java
Java
apache-2.0
7,120