text
stringlengths
4
6.14k
// Generated by esidl 0.2.1. // This file is expected to be modified for the Web IDL interface // implementation. Permission to use, copy, modify and distribute // this file in any software license is hereby granted. #ifndef ORG_W3C_DOM_BOOTSTRAP_RECTIMP_H_INCLUDED #define ORG_W3C_DOM_BOOTSTRAP_RECTIMP_H_INCLUDED #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <org/w3c/dom/css/Rect.h> #include <org/w3c/dom/css/CSSPrimitiveValue.h> namespace org { namespace w3c { namespace dom { namespace bootstrap { class RectImp : public ObjectMixin<RectImp> { public: // Rect css::CSSPrimitiveValue getTop(); css::CSSPrimitiveValue getRight(); css::CSSPrimitiveValue getBottom(); css::CSSPrimitiveValue getLeft(); // Object virtual Any message_(uint32_t selector, const char* id, int argc, Any* argv) { return css::Rect::dispatch(this, selector, id, argc, argv); } static const char* const getMetaData() { return css::Rect::getMetaData(); } }; } } } } #endif // ORG_W3C_DOM_BOOTSTRAP_RECTIMP_H_INCLUDED
// 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 CHROMEOS_CHROMEOS_PREF_NAMES_H_ #define CHROMEOS_CHROMEOS_PREF_NAMES_H_ #include "chromeos/chromeos_export.h" namespace chromeos { namespace prefs { CHROMEOS_EXPORT extern const char kAudioDevicesMute[]; CHROMEOS_EXPORT extern const char kAudioDevicesVolumePercent[]; CHROMEOS_EXPORT extern const char kAudioMute[]; CHROMEOS_EXPORT extern const char kAudioOutputAllowed[]; CHROMEOS_EXPORT extern const char kAudioVolumePercent[]; CHROMEOS_EXPORT extern const char kAudioDevicesState[]; CHROMEOS_EXPORT extern const char kQuirksClientLastServerCheck[]; } // namespace prefs } // namespace chromeos #endif // CHROMEOS_CHROMEOS_PREF_NAMES_H_
//===-- DWARFLocationExpression.h -------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_NATIVEPDB_DWARFLOCATIONEXPRESSION_H #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_NATIVEPDB_DWARFLOCATIONEXPRESSION_H #include "lldb/lldb-forward.h" #include "llvm/DebugInfo/CodeView/CodeView.h" namespace llvm { class APSInt; class StringRef; namespace codeview { class TypeIndex; } namespace pdb { class TpiStream; } } // namespace llvm namespace lldb_private { namespace npdb { DWARFExpression MakeEnregisteredLocationExpression(llvm::codeview::RegisterId reg, lldb::ModuleSP module); DWARFExpression MakeRegRelLocationExpression(llvm::codeview::RegisterId reg, int32_t offset, lldb::ModuleSP module); DWARFExpression MakeVFrameRelLocationExpression(llvm::StringRef fpo_program, int32_t offset, lldb::ModuleSP module); DWARFExpression MakeGlobalLocationExpression(uint16_t section, uint32_t offset, lldb::ModuleSP module); DWARFExpression MakeConstantLocationExpression( llvm::codeview::TypeIndex underlying_ti, llvm::pdb::TpiStream &tpi, const llvm::APSInt &constant, lldb::ModuleSP module); } // namespace npdb } // namespace lldb_private #endif
/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the qmake application of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef MINGW_MAKE_H #define MINGW_MAKE_H #include "winmakefile.h" QT_BEGIN_NAMESPACE class MingwMakefileGenerator : public Win32MakefileGenerator { public: MingwMakefileGenerator(); ~MingwMakefileGenerator(); protected: QString escapeDependencyPath(const QString &path) const; QString getLibTarget(); bool writeMakefile(QTextStream &); void init(); private: bool isWindowsShell() const; void writeMingwParts(QTextStream &); void writeIncPart(QTextStream &t); void writeLibsPart(QTextStream &t); void writeLibDirPart(QTextStream &t); void writeObjectsPart(QTextStream &t); void writeBuildRulesPart(QTextStream &t); void writeRcFilePart(QTextStream &t); void processPrlVariable(const QString &var, const QStringList &l); QStringList &findDependencies(const QString &file); QString preCompHeaderOut; virtual bool findLibraries(); bool findLibraries(const QString &where); void fixTargetExt(); bool init_flag; QString objectsLinkLine; QString quote; }; inline MingwMakefileGenerator::~MingwMakefileGenerator() { } QT_END_NAMESPACE #endif // MINGW_MAKE_H
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef ANDROID_WEBVIEW_BROWSER_AW_RENDER_THREAD_CONTEXT_PROVIDER_H_ #define ANDROID_WEBVIEW_BROWSER_AW_RENDER_THREAD_CONTEXT_PROVIDER_H_ #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/synchronization/lock.h" #include "base/threading/thread_checker.h" #include "cc/output/context_provider.h" #include "gpu/command_buffer/service/in_process_command_buffer.h" #include "skia/ext/refptr.h" namespace gfx { class GLSurface; } namespace gpu { class GLInProcessContext; } namespace android_webview { class AwRenderThreadContextProvider : public cc::ContextProvider { public: static scoped_refptr<AwRenderThreadContextProvider> Create( scoped_refptr<gfx::GLSurface> surface, scoped_refptr<gpu::InProcessCommandBuffer::Service> service); private: AwRenderThreadContextProvider( scoped_refptr<gfx::GLSurface> surface, scoped_refptr<gpu::InProcessCommandBuffer::Service> service); ~AwRenderThreadContextProvider() override; // cc::ContextProvider: bool BindToCurrentThread() override; Capabilities ContextCapabilities() override; gpu::gles2::GLES2Interface* ContextGL() override; gpu::ContextSupport* ContextSupport() override; class GrContext* GrContext() override; void InvalidateGrContext(uint32_t state) override; void SetupLock() override; base::Lock* GetLock() override; void VerifyContexts() override; void DeleteCachedResources() override; bool DestroyedOnMainThread() override; void SetLostContextCallback( const LostContextCallback& lost_context_callback) override; void SetMemoryPolicyChangedCallback( const MemoryPolicyChangedCallback& memory_policy_changed_callback) override; void OnLostContext(); base::ThreadChecker main_thread_checker_; scoped_ptr<gpu::GLInProcessContext> context_; skia::RefPtr<class GrContext> gr_context_; cc::ContextProvider::Capabilities capabilities_; LostContextCallback lost_context_callback_; bool destroyed_; base::Lock context_lock_; DISALLOW_COPY_AND_ASSIGN(AwRenderThreadContextProvider); }; } // namespace android_webview #endif // ANDROID_WEBVIEW_BROWSER_AW_RENDER_THREAD_CONTEXT_PROVIDER_H_
/** ****************************************************************************** * @file hal_tick.c * @author MCD Application Team * @brief Initialization of HAL tick ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ #include "hal_tick.h" // 0=NO, 1=PG6 toggles at each tick #define DEBUG_TICK 0 TIM_HandleTypeDef TimMasterHandle; uint32_t PreviousVal = 0; void HAL_IncTick(void); void us_ticker_irq_handler(void); void timer_irq_handler(void) { // Channel 1 for mbed timeout if (__HAL_TIM_GET_FLAG(&TimMasterHandle, TIM_FLAG_CC1) == SET) { if (__HAL_TIM_GET_IT_SOURCE(&TimMasterHandle, TIM_IT_CC1) == SET) { __HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC1); us_ticker_irq_handler(); } } // Channel 2 for HAL tick if (__HAL_TIM_GET_FLAG(&TimMasterHandle, TIM_FLAG_CC2) == SET) { if (__HAL_TIM_GET_IT_SOURCE(&TimMasterHandle, TIM_IT_CC2) == SET) { __HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC2); uint32_t val = __HAL_TIM_GetCounter(&TimMasterHandle); if ((val - PreviousVal) >= HAL_TICK_DELAY) { // Increment HAL variable HAL_IncTick(); // Prepare next interrupt __HAL_TIM_SetCompare(&TimMasterHandle, TIM_CHANNEL_2, val + HAL_TICK_DELAY); PreviousVal = val; #if DEBUG_TICK > 0 HAL_GPIO_TogglePin(GPIOG, GPIO_PIN_6); #endif } } } } // Reconfigure the HAL tick using a standard timer instead of systick. HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) { RCC_ClkInitTypeDef RCC_ClkInitStruct; uint32_t PclkFreq; // Get clock configuration // Note: PclkFreq contains here the Latency (not used after) HAL_RCC_GetClockConfig(&RCC_ClkInitStruct, &PclkFreq); // Get TIM5 clock value PclkFreq = HAL_RCC_GetPCLK1Freq(); // Enable timer clock TIM_MST_RCC; // Reset timer TIM_MST_RESET_ON; TIM_MST_RESET_OFF; // Configure time base TimMasterHandle.Instance = TIM_MST; TimMasterHandle.Init.Period = 0xFFFFFFFF; // TIMxCLK = PCLKx when the APB prescaler = 1 else TIMxCLK = 2 * PCLKx if (RCC_ClkInitStruct.APB1CLKDivider == RCC_HCLK_DIV1) TimMasterHandle.Init.Prescaler = (uint16_t)((PclkFreq) / 1000000) - 1; // 1 us tick else TimMasterHandle.Init.Prescaler = (uint16_t)((PclkFreq * 2) / 1000000) - 1; // 1 us tick TimMasterHandle.Init.ClockDivision = 0; TimMasterHandle.Init.CounterMode = TIM_COUNTERMODE_UP; TimMasterHandle.Init.RepetitionCounter = 0; HAL_TIM_OC_Init(&TimMasterHandle); NVIC_SetVector(TIM_MST_IRQ, (uint32_t)timer_irq_handler); NVIC_EnableIRQ(TIM_MST_IRQ); // Channel 1 for mbed timeout HAL_TIM_OC_Start(&TimMasterHandle, TIM_CHANNEL_1); // Channel 2 for HAL tick HAL_TIM_OC_Start(&TimMasterHandle, TIM_CHANNEL_2); PreviousVal = __HAL_TIM_GetCounter(&TimMasterHandle); __HAL_TIM_SetCompare(&TimMasterHandle, TIM_CHANNEL_2, PreviousVal + HAL_TICK_DELAY); __HAL_TIM_ENABLE_IT(&TimMasterHandle, TIM_IT_CC2); #if DEBUG_TICK > 0 __GPIOG_CLK_ENABLE(); GPIO_InitTypeDef GPIO_InitStruct; GPIO_InitStruct.Pin = GPIO_PIN_6; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FAST; HAL_GPIO_Init(GPIOG, &GPIO_InitStruct); #endif return HAL_OK; } /** * @} */ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
/* Copyright (C) 1995-2015 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 Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SHM_H # error "Never include <bits/shm.h> directly; use <sys/shm.h> instead." #endif #include <bits/types.h> /* Permission flag for shmget. */ #define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */ #define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */ /* Flags for `shmat'. */ #define SHM_RDONLY 010000 /* attach read-only else read-write */ #define SHM_RND 020000 /* round attach address to SHMLBA */ #define SHM_REMAP 040000 /* take-over region on attach */ #define SHM_EXEC 0100000 /* execution access */ /* Commands for `shmctl'. */ #define SHM_LOCK 11 /* lock segment (root only) */ #define SHM_UNLOCK 12 /* unlock segment (root only) */ /* Segment low boundary address multiple. */ #define SHMLBA 0x40000 /* Type to count number of attaches. */ typedef unsigned long int shmatt_t; /* Data structure describing a shared memory segment. */ struct shmid_ds { struct ipc_perm shm_perm; /* operation permission struct */ size_t shm_segsz; /* size of segment in bytes */ __time_t shm_atime; /* time of last shmat() */ __time_t shm_dtime; /* time of last shmdt() */ __time_t shm_ctime; /* time of last change by shmctl() */ __pid_t shm_cpid; /* pid of creator */ __pid_t shm_lpid; /* pid of last shmop */ shmatt_t shm_nattch; /* number of current attaches */ unsigned long int __glibc_reserved1; unsigned long int __glibc_reserved2; }; #ifdef __USE_MISC /* ipcs ctl commands */ # define SHM_STAT 13 # define SHM_INFO 14 /* shm_mode upper byte flags */ # define SHM_DEST 01000 /* segment will be destroyed on last detach */ # define SHM_LOCKED 02000 /* segment will not be swapped */ # define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */ # define SHM_NORESERVE 010000 /* don't check for reservations */ struct shminfo { unsigned long int shmmax; unsigned long int shmmin; unsigned long int shmmni; unsigned long int shmseg; unsigned long int shmall; unsigned long int __glibc_reserved1; unsigned long int __glibc_reserved2; unsigned long int __glibc_reserved3; unsigned long int __glibc_reserved4; }; struct shm_info { int used_ids; unsigned long int shm_tot; /* total allocated shm */ unsigned long int shm_rss; /* total resident shm */ unsigned long int shm_swp; /* total swapped shm */ unsigned long int swap_attempts; unsigned long int swap_successes; }; #endif /* __USE_MISC */
/* Test jdd constraint, which is used for linux kernel jump labels. */ /* { dg-do link } */ /* { dg-options "-O2 -fPIC -shared" } */ __attribute__ ((visibility ("default"))) extern int i; void f (void) { asm goto (".pushsection foo\n" #if defined(__s390x__) ".quad %0-.\n" #else ".long %0-.\n" #endif ".popsection\n" : : "jdd" (&i) : : l); l:; }
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dumpmode.c,v 1.5.2.1 2009-01-01 00:10:43 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * "Null" Compression Algorithm Support. */ #include "tiffiop.h" /* * Encode a hunk of pixels. */ static int DumpModeEncode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s) { (void) s; while (cc > 0) { tsize_t n; n = cc; if (tif->tif_rawcc + n > tif->tif_rawdatasize) n = tif->tif_rawdatasize - tif->tif_rawcc; assert( n > 0 ); /* * Avoid copy if client has setup raw * data buffer to avoid extra copy. */ if (tif->tif_rawcp != pp) _TIFFmemcpy(tif->tif_rawcp, pp, n); tif->tif_rawcp += n; tif->tif_rawcc += n; pp += n; cc -= n; if (tif->tif_rawcc >= tif->tif_rawdatasize && !TIFFFlushData1(tif)) return (-1); } return (1); } /* * Decode a hunk of pixels. */ static int DumpModeDecode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s) { (void) s; /* fprintf(stderr,"DumpModeDecode: scanline %ld, expected %ld bytes, got %ld bytes\n", */ /* (long) tif->tif_row, (long) tif->tif_rawcc, (long) cc); */ if (tif->tif_rawcc < cc) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "DumpModeDecode: Not enough data for scanline %d", tif->tif_row); return (0); } /* * Avoid copy if client has setup raw * data buffer to avoid extra copy. */ if (tif->tif_rawcp != buf) _TIFFmemcpy(buf, tif->tif_rawcp, cc); tif->tif_rawcp += cc; tif->tif_rawcc -= cc; return (1); } /* * Seek forwards nrows in the current strip. */ static int DumpModeSeek(TIFF* tif, uint32 nrows) { tif->tif_rawcp += nrows * tif->tif_scanlinesize; tif->tif_rawcc -= nrows * tif->tif_scanlinesize; return (1); } /* * Initialize dump mode. */ int TIFFInitDumpMode(TIFF* tif, int scheme) { (void) scheme; tif->tif_decoderow = DumpModeDecode; tif->tif_decodestrip = DumpModeDecode; tif->tif_decodetile = DumpModeDecode; tif->tif_encoderow = DumpModeEncode; tif->tif_encodestrip = DumpModeEncode; tif->tif_encodetile = DumpModeEncode; tif->tif_seek = DumpModeSeek; return (1); }
/* * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef CSSFontFace_h #define CSSFontFace_h #include "core/CoreExport.h" #include "core/css/CSSFontFaceSource.h" #include "core/css/CSSSegmentedFontFace.h" #include "core/css/FontFace.h" #include "wtf/Deque.h" #include "wtf/Forward.h" #include "wtf/PassRefPtr.h" #include "wtf/Vector.h" namespace blink { class FontDescription; class RemoteFontFaceSource; class SimpleFontData; class CORE_EXPORT CSSFontFace final : public NoBaseWillBeGarbageCollectedFinalized<CSSFontFace> { WTF_MAKE_NONCOPYABLE(CSSFontFace); public: struct UnicodeRange; class UnicodeRangeSet; CSSFontFace(FontFace* fontFace, Vector<UnicodeRange>& ranges) : m_ranges(ranges) , m_segmentedFontFace(nullptr) , m_fontFace(fontFace) { ASSERT(m_fontFace); } FontFace* fontFace() const { return m_fontFace; } UnicodeRangeSet& ranges() { return m_ranges; } void setSegmentedFontFace(CSSSegmentedFontFace*); void clearSegmentedFontFace() { m_segmentedFontFace = nullptr; } bool isValid() const { return !m_sources.isEmpty(); } void addSource(PassOwnPtrWillBeRawPtr<CSSFontFaceSource>); void didBeginLoad(); void fontLoaded(RemoteFontFaceSource*); void fontLoadWaitLimitExceeded(RemoteFontFaceSource*); PassRefPtr<SimpleFontData> getFontData(const FontDescription&); struct UnicodeRange { UnicodeRange(UChar32 from, UChar32 to) : m_from(from) , m_to(to) { } UChar32 from() const { return m_from; } UChar32 to() const { return m_to; } bool contains(UChar32 c) const { return m_from <= c && c <= m_to; } bool operator<(const UnicodeRange& other) const { return m_from < other.m_from; } bool operator<(UChar32 c) const { return m_to < c; } private: UChar32 m_from; UChar32 m_to; }; class CORE_EXPORT UnicodeRangeSet { public: explicit UnicodeRangeSet(const Vector<UnicodeRange>&); bool contains(UChar32) const; bool intersectsWith(const String&) const; bool isEntireRange() const { return m_ranges.isEmpty(); } size_t size() const { return m_ranges.size(); } const UnicodeRange& rangeAt(size_t i) const { return m_ranges[i]; } private: Vector<UnicodeRange> m_ranges; // If empty, represents the whole code space. }; FontFace::LoadStatus loadStatus() const { return m_fontFace->loadStatus(); } bool maybeScheduleFontLoad(const FontDescription&, UChar32); void load(); void load(const FontDescription&); bool hadBlankText() { return isValid() && m_sources.first()->hadBlankText(); } DECLARE_TRACE(); private: void setLoadStatus(FontFace::LoadStatus); UnicodeRangeSet m_ranges; RawPtrWillBeMember<CSSSegmentedFontFace> m_segmentedFontFace; WillBeHeapDeque<OwnPtrWillBeMember<CSSFontFaceSource>> m_sources; RawPtrWillBeMember<FontFace> m_fontFace; }; } #endif
/* 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. ==============================================================================*/ #ifndef TENSORFLOW_LITE_PROFILING_PROFILE_SUMMARY_FORMATTER_H_ #define TENSORFLOW_LITE_PROFILING_PROFILE_SUMMARY_FORMATTER_H_ #include <functional> #include <memory> #include <sstream> #include <string> #include <utility> #include <vector> #include "tensorflow/core/util/stats_calculator.h" namespace tflite { namespace profiling { // Formats the profile summary in a certain way. class ProfileSummaryFormatter { public: ProfileSummaryFormatter() {} virtual ~ProfileSummaryFormatter() {} // Returns a string detailing the accumulated runtime stats in StatsCalculator // of ProfileSummarizer. virtual std::string GetOutputString( const std::map<uint32_t, std::unique_ptr<tensorflow::StatsCalculator>>& stats_calculator_map, const tensorflow::StatsCalculator& delegate_stats_calculator) const = 0; // Returns a string detailing the short summary of the accumulated runtime // stats in StatsCalculator of ProfileSummarizer. virtual std::string GetShortSummary( const std::map<uint32_t, std::unique_ptr<tensorflow::StatsCalculator>>& stats_calculator_map, const tensorflow::StatsCalculator& delegate_stats_calculator) const = 0; virtual tensorflow::StatSummarizerOptions GetStatSummarizerOptions() const = 0; }; class ProfileSummaryDefaultFormatter : public ProfileSummaryFormatter { public: ProfileSummaryDefaultFormatter() {} ~ProfileSummaryDefaultFormatter() override {} std::string GetOutputString( const std::map<uint32_t, std::unique_ptr<tensorflow::StatsCalculator>>& stats_calculator_map, const tensorflow::StatsCalculator& delegate_stats_calculator) const override; std::string GetShortSummary( const std::map<uint32_t, std::unique_ptr<tensorflow::StatsCalculator>>& stats_calculator_map, const tensorflow::StatsCalculator& delegate_stats_calculator) const override; tensorflow::StatSummarizerOptions GetStatSummarizerOptions() const override; private: std::string GenerateReport( const std::string& tag, bool include_output_string, const std::map<uint32_t, std::unique_ptr<tensorflow::StatsCalculator>>& stats_calculator_map, const tensorflow::StatsCalculator& delegate_stats_calculator) const; }; class ProfileSummaryCSVFormatter : public ProfileSummaryDefaultFormatter { public: ProfileSummaryCSVFormatter() {} tensorflow::StatSummarizerOptions GetStatSummarizerOptions() const override; }; } // namespace profiling } // namespace tflite #endif // TENSORFLOW_LITE_PROFILING_PROFILE_SUMMARY_FORMATTER_H_
/* * arch/arm/mach-mps/include/mach/system.h * * Copyright (C) 2009 ARM Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __ASM_ARCH_SYSTEM_H #define __ASM_ARCH_SYSTEM_H #include <linux/io.h> #include <mach/hardware.h> #include <mach/platform.h> static inline void arch_idle(void) { cpu_do_idle(); } static inline void arch_reset(char mode, const char *cmd) { } #endif
/* { dg-do compile } */ /* { dg-options "-mror -O2" } */ unsigned int rotate (unsigned int a, int b) { return ( a >> b ) | ( a << ( 32 - b ) ); } /* { dg-final { scan-assembler "l.ror" } } */
/**************************************************************************** * * Copyright 2016 Samsung Electronics 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. * ****************************************************************************/ /**************************************************************************** * libc/pthread/pthread_attrsetstacksize.c * * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. Neither the name NuttX 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. * ****************************************************************************/ /**************************************************************************** * Included Files ****************************************************************************/ #include <tinyara/config.h> #include <pthread.h> #include <string.h> #include <debug.h> #include <errno.h> /**************************************************************************** * Definitions ****************************************************************************/ /**************************************************************************** * Private Type Declarations ****************************************************************************/ /**************************************************************************** * Global Variables ****************************************************************************/ /**************************************************************************** * Private Variables ****************************************************************************/ /**************************************************************************** * Private Functions ****************************************************************************/ /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** * Function: pthread_attr_setstacksize * * Description: * * Parameters: * attr * stacksize * * Return Value: * 0 if successful. Otherwise, an error code. * * Assumptions: * ****************************************************************************/ int pthread_attr_setstacksize(FAR pthread_attr_t *attr, long stacksize) { int ret; sdbg("attr=0x%p stacksize=%ld\n", attr, stacksize); if (!attr || stacksize < PTHREAD_STACK_MIN) { ret = EINVAL; } else { attr->stacksize = stacksize; ret = OK; } sdbg("Returning %d\n", ret); return ret; }
/* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* * Modified by the GLib Team and others 1997-2000. See the AUTHORS * file for a list of people on the GLib Team. See the ChangeLog * files for a list of changes. These files are distributed with * GLib at ftp://ftp.gtk.org/pub/gtk/. */ #ifndef __G_ALLOCA_H__ #define __G_ALLOCA_H__ #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) #error "Only <glib.h> can be included directly." #endif #include <glib/gtypes.h> #if defined(__BIONIC__) && defined (GLIB_HAVE_ALLOCA_H) # include <alloca.h> #elif defined(__GNUC__) /* GCC does the right thing */ # undef alloca # define alloca(size) __builtin_alloca (size) #elif defined (GLIB_HAVE_ALLOCA_H) /* a native and working alloca.h is there */ # include <alloca.h> #else /* !__GNUC__ && !GLIB_HAVE_ALLOCA_H */ # if defined(_MSC_VER) || defined(__DMC__) # include <malloc.h> # define alloca _alloca # else /* !_MSC_VER && !__DMC__ */ # ifdef _AIX # pragma alloca # else /* !_AIX */ # ifndef alloca /* predefined by HP cc +Olibcalls */ G_BEGIN_DECLS char *alloca (); G_END_DECLS # endif /* !alloca */ # endif /* !_AIX */ # endif /* !_MSC_VER && !__DMC__ */ #endif /* !__GNUC__ && !GLIB_HAVE_ALLOCA_H */ /** * g_alloca: * @size: number of bytes to allocate. * * Allocates @size bytes on the stack; these bytes will be freed when the current * stack frame is cleaned up. This macro essentially just wraps the alloca() * function present on most UNIX variants. * Thus it provides the same advantages and pitfalls as alloca(): * * - alloca() is very fast, as on most systems it's implemented by just adjusting * the stack pointer register. * * - It doesn't cause any memory fragmentation, within its scope, separate alloca() * blocks just build up and are released together at function end. * * - Allocation sizes have to fit into the current stack frame. For instance in a * threaded environment on Linux, the per-thread stack size is limited to 2 Megabytes, * so be sparse with alloca() uses. * * - Allocation failure due to insufficient stack space is not indicated with a %NULL * return like e.g. with malloc(). Instead, most systems probably handle it the same * way as out of stack space situations from infinite function recursion, i.e. * with a segmentation fault. * * - Special care has to be taken when mixing alloca() with GNU C variable sized arrays. * Stack space allocated with alloca() in the same scope as a variable sized array * will be freed together with the variable sized array upon exit of that scope, and * not upon exit of the enclosing function scope. * * Returns: space for @size bytes, allocated on the stack */ #define g_alloca(size) alloca (size) /** * g_newa: * @struct_type: Type of memory chunks to be allocated * @n_structs: Number of chunks to be allocated * * Wraps g_alloca() in a more typesafe manner. * * Returns: Pointer to stack space for @n_structs chunks of type @struct_type */ #define g_newa(struct_type, n_structs) ((struct_type*) g_alloca (sizeof (struct_type) * (gsize) (n_structs))) #endif /* __G_ALLOCA_H__ */
/* * Copyright (C) 2012 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. */ #ifndef WebMediaPlayerEncryptedMediaClient_h #define WebMediaPlayerEncryptedMediaClient_h #include "WebCommon.h" #include "WebEncryptedMediaTypes.h" namespace blink { class WebString; class WebURL; class BLINK_PLATFORM_EXPORT WebMediaPlayerEncryptedMediaClient { public: enum MediaKeyErrorCode { MediaKeyErrorCodeUnknown = 1, MediaKeyErrorCodeClient, MediaKeyErrorCodeService, MediaKeyErrorCodeOutput, MediaKeyErrorCodeHardwareChange, MediaKeyErrorCodeDomain }; virtual void keyAdded(const WebString& keySystem, const WebString& sessionId) = 0; virtual void keyError(const WebString& keySystem, const WebString& sessionId, MediaKeyErrorCode, unsigned short systemCode) = 0; virtual void keyMessage(const WebString& keySystem, const WebString& sessionId, const unsigned char* message, unsigned messageLength, const WebURL& defaultURL) = 0; virtual void encrypted(WebEncryptedMediaInitDataType, const unsigned char* initData, unsigned initDataLength) = 0; virtual void didBlockPlaybackWaitingForKey() = 0; virtual void didResumePlaybackBlockedForKey() = 0; protected: ~WebMediaPlayerEncryptedMediaClient() { } }; } // namespace blink #endif
/* * linux/arch/mips/tx4938/toshiba_rbtx4938/spi_txx9.c * Copyright (C) 2000-2001 Toshiba Corporation * * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the * terms of the GNU General Public License version 2. This program is * licensed "as is" without any warranty of any kind, whether express * or implied. * * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com) */ #include <linux/init.h> #include <linux/delay.h> #include <linux/errno.h> #include <linux/interrupt.h> #include <linux/module.h> #include <linux/sched.h> #include <linux/spinlock.h> #include <linux/wait.h> #include <asm/tx4938/spi.h> #include <asm/tx4938/tx4938.h> static int (*txx9_spi_cs_func)(int chipid, int on); static DEFINE_SPINLOCK(txx9_spi_lock); extern unsigned int txx9_gbus_clock; #define SPI_FIFO_SIZE 4 void __init txx9_spi_init(unsigned long base, int (*cs_func)(int chipid, int on)) { txx9_spi_cs_func = cs_func; /* enter config mode */ tx4938_spiptr->mcr = TXx9_SPMCR_CONFIG | TXx9_SPMCR_BCLR; } static DECLARE_WAIT_QUEUE_HEAD(txx9_spi_wait); static void txx9_spi_interrupt(int irq, void *dev_id, struct pt_regs *regs) { /* disable rx intr */ tx4938_spiptr->cr0 &= ~TXx9_SPCR0_RBSIE; wake_up(&txx9_spi_wait); } static struct irqaction txx9_spi_action = { txx9_spi_interrupt, 0, 0, "spi", NULL, NULL, }; void __init txx9_spi_irqinit(int irc_irq) { setup_irq(irc_irq, &txx9_spi_action); } int txx9_spi_io(int chipid, struct spi_dev_desc *desc, unsigned char **inbufs, unsigned int *incounts, unsigned char **outbufs, unsigned int *outcounts, int cansleep) { unsigned int incount, outcount; unsigned char *inp, *outp; int ret; unsigned long flags; spin_lock_irqsave(&txx9_spi_lock, flags); if ((tx4938_spiptr->mcr & TXx9_SPMCR_OPMODE) == TXx9_SPMCR_ACTIVE) { spin_unlock_irqrestore(&txx9_spi_lock, flags); return -EBUSY; } /* enter config mode */ tx4938_spiptr->mcr = TXx9_SPMCR_CONFIG | TXx9_SPMCR_BCLR; tx4938_spiptr->cr0 = (desc->byteorder ? TXx9_SPCR0_SBOS : 0) | (desc->polarity ? TXx9_SPCR0_SPOL : 0) | (desc->phase ? TXx9_SPCR0_SPHA : 0) | 0x08; tx4938_spiptr->cr1 = (((TXX9_IMCLK + desc->baud) / (2 * desc->baud) - 1) << 8) | 0x08 /* 8 bit only */; /* enter active mode */ tx4938_spiptr->mcr = TXx9_SPMCR_ACTIVE; spin_unlock_irqrestore(&txx9_spi_lock, flags); /* CS ON */ if ((ret = txx9_spi_cs_func(chipid, 1)) < 0) { spin_unlock_irqrestore(&txx9_spi_lock, flags); return ret; } udelay(desc->tcss); /* do scatter IO */ inp = inbufs ? *inbufs : NULL; outp = outbufs ? *outbufs : NULL; incount = 0; outcount = 0; while (1) { unsigned char data; unsigned int count; int i; if (!incount) { incount = incounts ? *incounts++ : 0; inp = (incount && inbufs) ? *inbufs++ : NULL; } if (!outcount) { outcount = outcounts ? *outcounts++ : 0; outp = (outcount && outbufs) ? *outbufs++ : NULL; } if (!inp && !outp) break; count = SPI_FIFO_SIZE; if (incount) count = min(count, incount); if (outcount) count = min(count, outcount); /* now tx must be idle... */ while (!(tx4938_spiptr->sr & TXx9_SPSR_SIDLE)) ; tx4938_spiptr->cr0 = (tx4938_spiptr->cr0 & ~TXx9_SPCR0_RXIFL_MASK) | ((count - 1) << 12); if (cansleep) { /* enable rx intr */ tx4938_spiptr->cr0 |= TXx9_SPCR0_RBSIE; } /* send */ for (i = 0; i < count; i++) tx4938_spiptr->dr = inp ? *inp++ : 0; /* wait all rx data */ if (cansleep) { wait_event(txx9_spi_wait, tx4938_spiptr->sr & TXx9_SPSR_SRRDY); } else { while (!(tx4938_spiptr->sr & TXx9_SPSR_RBSI)) ; } /* receive */ for (i = 0; i < count; i++) { data = tx4938_spiptr->dr; if (outp) *outp++ = data; } if (incount) incount -= count; if (outcount) outcount -= count; } /* CS OFF */ udelay(desc->tcsh); txx9_spi_cs_func(chipid, 0); udelay(desc->tcsr); spin_lock_irqsave(&txx9_spi_lock, flags); /* enter config mode */ tx4938_spiptr->mcr = TXx9_SPMCR_CONFIG | TXx9_SPMCR_BCLR; spin_unlock_irqrestore(&txx9_spi_lock, flags); return 0; }
/* { dg-do compile } */ /* { dg-options "-Ofast -fdump-tree-ifcvt-details-blocks" } */ /* { dg-require-visibility "" } */ #define LEN 4096 __attribute__((visibility("hidden"), aligned (32))) float array[LEN] = {}; void test () { for (int i = 0; i < LEN; i++) { if (array[i] > (float)0.) array[i] = 3; } } /* { dg-final { scan-tree-dump-times "Applying if-conversion" 1 "ifcvt" } } */ /* We insert into code if (LOOP_VECTORIZED (...)) which is folded by vectorizer. Both outgoing edges must have probability 100% so the resulting profile match after folding. */ /* { dg-final { scan-tree-dump-times "Invalid sum of outgoing probabilities 200.0" 1 "ifcvt" } } */ /* { dg-final { scan-tree-dump-times "Invalid sum of incoming counts" 1 "ifcvt" } } */
/* * Wi-Fi Protected Setup - attribute parsing * Copyright (c) 2008-2012, Jouni Malinen <j@w1.fi> * * This software may be distributed under the terms of the BSD license. * See README for more details. */ #ifndef WPS_ATTR_PARSE_H #define WPS_ATTR_PARSE_H #include "wps.h" struct wps_parse_attr { /* fixed length fields */ const u8 *version; /* 1 octet */ const u8 *version2; /* 1 octet */ const u8 *msg_type; /* 1 octet */ const u8 *enrollee_nonce; /* WPS_NONCE_LEN (16) octets */ const u8 *registrar_nonce; /* WPS_NONCE_LEN (16) octets */ const u8 *uuid_r; /* WPS_UUID_LEN (16) octets */ const u8 *uuid_e; /* WPS_UUID_LEN (16) octets */ const u8 *auth_type_flags; /* 2 octets */ const u8 *encr_type_flags; /* 2 octets */ const u8 *conn_type_flags; /* 1 octet */ const u8 *config_methods; /* 2 octets */ const u8 *sel_reg_config_methods; /* 2 octets */ const u8 *primary_dev_type; /* 8 octets */ const u8 *rf_bands; /* 1 octet */ const u8 *assoc_state; /* 2 octets */ const u8 *config_error; /* 2 octets */ const u8 *dev_password_id; /* 2 octets */ const u8 *os_version; /* 4 octets */ const u8 *wps_state; /* 1 octet */ const u8 *authenticator; /* WPS_AUTHENTICATOR_LEN (8) octets */ const u8 *r_hash1; /* WPS_HASH_LEN (32) octets */ const u8 *r_hash2; /* WPS_HASH_LEN (32) octets */ const u8 *e_hash1; /* WPS_HASH_LEN (32) octets */ const u8 *e_hash2; /* WPS_HASH_LEN (32) octets */ const u8 *r_snonce1; /* WPS_SECRET_NONCE_LEN (16) octets */ const u8 *r_snonce2; /* WPS_SECRET_NONCE_LEN (16) octets */ const u8 *e_snonce1; /* WPS_SECRET_NONCE_LEN (16) octets */ const u8 *e_snonce2; /* WPS_SECRET_NONCE_LEN (16) octets */ const u8 *key_wrap_auth; /* WPS_KWA_LEN (8) octets */ const u8 *auth_type; /* 2 octets */ const u8 *encr_type; /* 2 octets */ const u8 *network_idx; /* 1 octet */ const u8 *network_key_idx; /* 1 octet */ const u8 *mac_addr; /* ETH_ALEN (6) octets */ const u8 *selected_registrar; /* 1 octet (Bool) */ const u8 *request_type; /* 1 octet */ const u8 *response_type; /* 1 octet */ const u8 *ap_setup_locked; /* 1 octet */ const u8 *settings_delay_time; /* 1 octet */ const u8 *network_key_shareable; /* 1 octet (Bool) */ const u8 *request_to_enroll; /* 1 octet (Bool) */ const u8 *ap_channel; /* 2 octets */ const u8 *registrar_configuration_methods; /* 2 octets */ /* variable length fields */ const u8 *manufacturer; const u8 *model_name; const u8 *model_number; const u8 *serial_number; const u8 *dev_name; const u8 *public_key; const u8 *encr_settings; const u8 *ssid; /* <= 32 octets */ const u8 *network_key; /* <= 64 octets */ const u8 *authorized_macs; /* <= 30 octets */ const u8 *sec_dev_type_list; /* <= 128 octets */ const u8 *oob_dev_password; /* 38..54 octets */ u16 manufacturer_len; u16 model_name_len; u16 model_number_len; u16 serial_number_len; u16 dev_name_len; u16 public_key_len; u16 encr_settings_len; u16 ssid_len; u16 network_key_len; u16 authorized_macs_len; u16 sec_dev_type_list_len; u16 oob_dev_password_len; /* attributes that can occur multiple times */ #define MAX_CRED_COUNT 10 #define MAX_REQ_DEV_TYPE_COUNT 10 unsigned int num_cred; unsigned int num_req_dev_type; unsigned int num_vendor_ext; u16 cred_len[MAX_CRED_COUNT]; u16 vendor_ext_len[MAX_WPS_PARSE_VENDOR_EXT]; const u8 *cred[MAX_CRED_COUNT]; const u8 *req_dev_type[MAX_REQ_DEV_TYPE_COUNT]; const u8 *vendor_ext[MAX_WPS_PARSE_VENDOR_EXT]; }; int wps_parse_msg(const struct wpabuf *msg, struct wps_parse_attr *attr); #endif /* WPS_ATTR_PARSE_H */
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_MAC_H_ #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_MAC_H_ #import <IOBluetooth/IOBluetooth.h> #include <string> #include "base/basictypes.h" #include "base/mac/scoped_nsobject.h" #include "base/observer_list.h" #include "device/bluetooth/bluetooth_device.h" @class IOBluetoothDevice; namespace device { class BluetoothDeviceMac : public BluetoothDevice { public: explicit BluetoothDeviceMac(IOBluetoothDevice* device); ~BluetoothDeviceMac() override; // BluetoothDevice override uint32 GetBluetoothClass() const override; std::string GetAddress() const override; VendorIDSource GetVendorIDSource() const override; uint16 GetVendorID() const override; uint16 GetProductID() const override; uint16 GetDeviceID() const override; bool IsPaired() const override; bool IsConnected() const override; bool IsConnectable() const override; bool IsConnecting() const override; UUIDList GetUUIDs() const override; bool ExpectingPinCode() const override; bool ExpectingPasskey() const override; bool ExpectingConfirmation() const override; void GetConnectionInfo(const ConnectionInfoCallback& callback) override; void Connect(PairingDelegate* pairing_delegate, const base::Closure& callback, const ConnectErrorCallback& error_callback) override; void SetPinCode(const std::string& pincode) override; void SetPasskey(uint32 passkey) override; void ConfirmPairing() override; void RejectPairing() override; void CancelPairing() override; void Disconnect(const base::Closure& callback, const ErrorCallback& error_callback) override; void Forget(const ErrorCallback& error_callback) override; void ConnectToService( const BluetoothUUID& uuid, const ConnectToServiceCallback& callback, const ConnectToServiceErrorCallback& error_callback) override; void ConnectToServiceInsecurely( const BluetoothUUID& uuid, const ConnectToServiceCallback& callback, const ConnectToServiceErrorCallback& error_callback) override; void CreateGattConnection( const GattConnectionCallback& callback, const ConnectErrorCallback& error_callback) override; // Returns the timestamp when the device was last seen during an inquiry. // Returns nil if the device has never been seen during an inquiry. NSDate* GetLastInquiryUpdate(); // Returns the Bluetooth address for the |device|. The returned address has a // normalized format (see below). static std::string GetDeviceAddress(IOBluetoothDevice* device); protected: // BluetoothDevice override std::string GetDeviceName() const override; private: friend class BluetoothAdapterMac; // Implementation to read the host's transmit power level of type // |power_level_type|. int GetHostTransmitPower( BluetoothHCITransmitPowerLevelType power_level_type) const; base::scoped_nsobject<IOBluetoothDevice> device_; DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceMac); }; } // namespace device #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_MAC_H_
// // NSDictionary+RKRequestSerialization.h // RestKit // // Created by Blake Watters on 7/28/09. // Copyright (c) 2009-2012 RestKit. 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. // #import <Foundation/Foundation.h> #import "RKRequestSerializable.h" /* Extends NSDictionary to enable usage as the params of an RKRequest. This category provides for the serialization of the receiving NSDictionary into a URL encoded string representation (MIME Type application/x-www-form-urlencoded). This enables NSDictionary objects to act as the params for an RKRequest. @see RKRequestSerializable @see [RKRequest params] @class NSDictionary (RKRequestSerialization) */ @interface NSDictionary (RKRequestSerialization) <RKRequestSerializable> @end
/* Copyright (C) 1991-2014 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 Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #include <stdarg.h> #include <wchar.h> #include "../libio/libioP.h" /* Write formatted output to FP from the format string FORMAT. */ int __vfwprintf_chk (FILE *fp, int flag, const wchar_t *format, va_list ap) { int done; _IO_acquire_lock_clear_flags2 (fp); if (flag > 0) fp->_flags2 |= _IO_FLAGS2_FORTIFY; done = _IO_vfwprintf (fp, format, ap); if (flag > 0) fp->_flags2 &= ~_IO_FLAGS2_FORTIFY; _IO_release_lock (fp); return done; } libc_hidden_def (__vfwprintf_chk)
/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. * * The information contained herein is property of Nordic Semiconductor ASA. * Terms and conditions of usage are described in detail in NORDIC * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. * * Licensees are granted free, non-transferable use of the information. NO * WARRANTY of ANY KIND is provided. This heading must NOT be removed from * the file. * */ #ifndef BLE_L2CAP_EVT_APP_H__ #define BLE_L2CAP_EVT_APP_H__ /** * @addtogroup ser_codecs Serialization codecs * @ingroup ble_sdk_lib_serialization */ /** * @addtogroup ser_app_s130_codecs Application s130 codecs * @ingroup ser_codecs */ /**@file * * @defgroup ble_l2cap_evt_app L2CAP Application event decoders * @{ * @ingroup ser_app_s130_codecs * * @brief L2CAP Application event decoders. */ #include "ble.h" /** * @brief Decodes ble_l2cap_evt_rx event. * * @sa @ref nrf51_l2cap_evt_rx_encoding for packet format. * * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. * * @param[in] p_buf Pointer to the beginning of an event packet. * @param[in] packet_len Length (in bytes) of the event packet. * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be * stored. If NULL, required length will be returned in \p p_event_len. * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. * \c out: Length of decoded contents of \p p_event. * * @retval NRF_SUCCESS Decoding success. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to * hold decoded event. */ uint32_t ble_l2cap_evt_rx_dec(uint8_t const * const p_buf, uint32_t packet_len, ble_evt_t * const p_event, uint32_t * const p_event_len); /** @} */ #endif
/* * MessagePack for C deflate buffer implementation * * Copyright (C) 2010 FURUHASHI Sadayuki * * 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. */ #ifndef MSGPACK_ZBUFFER_H #define MSGPACK_ZBUFFER_H #include "sysdep.h" #include <stdlib.h> #include <string.h> #include <zlib.h> #ifdef __cplusplus extern "C" { #endif /** * @defgroup msgpack_zbuffer Compressed buffer * @ingroup msgpack_buffer * @{ */ typedef struct msgpack_zbuffer { z_stream stream; char* data; size_t init_size; } msgpack_zbuffer; #ifndef MSGPACK_ZBUFFER_INIT_SIZE #define MSGPACK_ZBUFFER_INIT_SIZE 8192 #endif static inline bool msgpack_zbuffer_init( msgpack_zbuffer* zbuf, int level, size_t init_size); static inline void msgpack_zbuffer_destroy(msgpack_zbuffer* zbuf); static inline msgpack_zbuffer* msgpack_zbuffer_new(int level, size_t init_size); static inline void msgpack_zbuffer_free(msgpack_zbuffer* zbuf); static inline char* msgpack_zbuffer_flush(msgpack_zbuffer* zbuf); static inline const char* msgpack_zbuffer_data(const msgpack_zbuffer* zbuf); static inline size_t msgpack_zbuffer_size(const msgpack_zbuffer* zbuf); static inline bool msgpack_zbuffer_reset(msgpack_zbuffer* zbuf); static inline void msgpack_zbuffer_reset_buffer(msgpack_zbuffer* zbuf); static inline char* msgpack_zbuffer_release_buffer(msgpack_zbuffer* zbuf); #ifndef MSGPACK_ZBUFFER_RESERVE_SIZE #define MSGPACK_ZBUFFER_RESERVE_SIZE 512 #endif static inline int msgpack_zbuffer_write(void* data, const char* buf, size_t len); static inline bool msgpack_zbuffer_expand(msgpack_zbuffer* zbuf); bool msgpack_zbuffer_init(msgpack_zbuffer* zbuf, int level, size_t init_size) { memset(zbuf, 0, sizeof(msgpack_zbuffer)); zbuf->init_size = init_size; if(deflateInit(&zbuf->stream, level) != Z_OK) { free(zbuf->data); return false; } return true; } void msgpack_zbuffer_destroy(msgpack_zbuffer* zbuf) { deflateEnd(&zbuf->stream); free(zbuf->data); } msgpack_zbuffer* msgpack_zbuffer_new(int level, size_t init_size) { msgpack_zbuffer* zbuf = (msgpack_zbuffer*)malloc(sizeof(msgpack_zbuffer)); if (zbuf == NULL) return NULL; if(!msgpack_zbuffer_init(zbuf, level, init_size)) { free(zbuf); return NULL; } return zbuf; } void msgpack_zbuffer_free(msgpack_zbuffer* zbuf) { if(zbuf == NULL) { return; } msgpack_zbuffer_destroy(zbuf); free(zbuf); } bool msgpack_zbuffer_expand(msgpack_zbuffer* zbuf) { size_t used = (char*)zbuf->stream.next_out - zbuf->data; size_t csize = used + zbuf->stream.avail_out; size_t nsize = (csize == 0) ? zbuf->init_size : csize * 2; char* tmp = (char*)realloc(zbuf->data, nsize); if(tmp == NULL) { return false; } zbuf->data = tmp; zbuf->stream.next_out = (Bytef*)(tmp + used); zbuf->stream.avail_out = nsize - used; return true; } int msgpack_zbuffer_write(void* data, const char* buf, size_t len) { msgpack_zbuffer* zbuf = (msgpack_zbuffer*)data; zbuf->stream.next_in = (Bytef*)buf; zbuf->stream.avail_in = len; do { if(zbuf->stream.avail_out < MSGPACK_ZBUFFER_RESERVE_SIZE) { if(!msgpack_zbuffer_expand(zbuf)) { return -1; } } if(deflate(&zbuf->stream, Z_NO_FLUSH) != Z_OK) { return -1; } } while(zbuf->stream.avail_in > 0); return 0; } char* msgpack_zbuffer_flush(msgpack_zbuffer* zbuf) { while(true) { switch(deflate(&zbuf->stream, Z_FINISH)) { case Z_STREAM_END: return zbuf->data; case Z_OK: if(!msgpack_zbuffer_expand(zbuf)) { return NULL; } break; default: return NULL; } } } const char* msgpack_zbuffer_data(const msgpack_zbuffer* zbuf) { return zbuf->data; } size_t msgpack_zbuffer_size(const msgpack_zbuffer* zbuf) { return (char*)zbuf->stream.next_out - zbuf->data; } void msgpack_zbuffer_reset_buffer(msgpack_zbuffer* zbuf) { zbuf->stream.avail_out += (char*)zbuf->stream.next_out - zbuf->data; zbuf->stream.next_out = (Bytef*)zbuf->data; } bool msgpack_zbuffer_reset(msgpack_zbuffer* zbuf) { if(deflateReset(&zbuf->stream) != Z_OK) { return false; } msgpack_zbuffer_reset_buffer(zbuf); return true; } char* msgpack_zbuffer_release_buffer(msgpack_zbuffer* zbuf) { char* tmp = zbuf->data; zbuf->data = NULL; zbuf->stream.next_out = NULL; zbuf->stream.avail_out = 0; return tmp; } /** @} */ #ifdef __cplusplus } #endif #endif /* msgpack/zbuffer.h */
//****************************************************************************** // // Copyright (c) 2016 Microsoft Corporation. All rights reserved. // // This code is licensed under the MIT License (MIT). // // 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. // //****************************************************************************** #pragma once #import <UIKit/UIKitExport.h> #import <Foundation/NSObject.h> #import <CoreGraphics/CGGeometry.h> @class NSArray; @class NSString; @class NSDictionary; UIKIT_EXPORT_CLASS @interface UICollectionViewLayoutInvalidationContext : NSObject @property (readonly, nonatomic) BOOL invalidateEverything STUB_PROPERTY; @property (readonly, nonatomic) BOOL invalidateDataSourceCounts STUB_PROPERTY; @property (nonatomic) CGPoint contentOffsetAdjustment STUB_PROPERTY; @property (nonatomic) CGSize contentSizeAdjustment STUB_PROPERTY; - (void)invalidateItemsAtIndexPaths:(NSArray*)indexPaths STUB_METHOD; - (void)invalidateSupplementaryElementsOfKind:(NSString*)elementKind atIndexPaths:(NSArray*)indexPaths STUB_METHOD; - (void)invalidateDecorationElementsOfKind:(NSString*)elementKind atIndexPaths:(NSArray*)indexPaths STUB_METHOD; @property (readonly, nonatomic) NSArray* invalidatedItemIndexPaths STUB_PROPERTY; @property (readonly, nonatomic) NSDictionary* invalidatedSupplementaryIndexPaths STUB_PROPERTY; @property (readonly, nonatomic) NSDictionary* invalidatedDecorationIndexPaths STUB_PROPERTY; @property (readonly, copy, nonatomic) NSArray* previousIndexPathsForInteractivelyMovingItems STUB_PROPERTY; @property (readonly, copy, nonatomic) NSArray* targetIndexPathsForInteractivelyMovingItems STUB_PROPERTY; @property (readonly, nonatomic) CGPoint interactiveMovementTarget STUB_PROPERTY; @end
/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (c) 2018 - Bootlin * * Author: Boris Brezillon <boris.brezillon@bootlin.com> * * Header containing internal definitions to be used only by core files. * NAND controller drivers should not include this file. */ #ifndef __LINUX_RAWNAND_INTERNALS #define __LINUX_RAWNAND_INTERNALS #include <linux/mtd/rawnand.h> /* * NAND Flash Manufacturer ID Codes */ #define NAND_MFR_AMD 0x01 #define NAND_MFR_ATO 0x9b #define NAND_MFR_EON 0x92 #define NAND_MFR_ESMT 0xc8 #define NAND_MFR_FUJITSU 0x04 #define NAND_MFR_HYNIX 0xad #define NAND_MFR_INTEL 0x89 #define NAND_MFR_MACRONIX 0xc2 #define NAND_MFR_MICRON 0x2c #define NAND_MFR_NATIONAL 0x8f #define NAND_MFR_RENESAS 0x07 #define NAND_MFR_SAMSUNG 0xec #define NAND_MFR_SANDISK 0x45 #define NAND_MFR_STMICRO 0x20 #define NAND_MFR_TOSHIBA 0x98 #define NAND_MFR_WINBOND 0xef /** * struct nand_manufacturer_ops - NAND Manufacturer operations * @detect: detect the NAND memory organization and capabilities * @init: initialize all vendor specific fields (like the ->read_retry() * implementation) if any. * @cleanup: the ->init() function may have allocated resources, ->cleanup() * is here to let vendor specific code release those resources. * @fixup_onfi_param_page: apply vendor specific fixups to the ONFI parameter * page. This is called after the checksum is verified. */ struct nand_manufacturer_ops { void (*detect)(struct nand_chip *chip); int (*init)(struct nand_chip *chip); void (*cleanup)(struct nand_chip *chip); void (*fixup_onfi_param_page)(struct nand_chip *chip, struct nand_onfi_params *p); }; /** * struct nand_manufacturer - NAND Flash Manufacturer structure * @name: Manufacturer name * @id: manufacturer ID code of device. * @ops: manufacturer operations */ struct nand_manufacturer { int id; char *name; const struct nand_manufacturer_ops *ops; }; extern struct nand_flash_dev nand_flash_ids[]; extern const struct nand_manufacturer_ops amd_nand_manuf_ops; extern const struct nand_manufacturer_ops esmt_nand_manuf_ops; extern const struct nand_manufacturer_ops hynix_nand_manuf_ops; extern const struct nand_manufacturer_ops macronix_nand_manuf_ops; extern const struct nand_manufacturer_ops micron_nand_manuf_ops; extern const struct nand_manufacturer_ops samsung_nand_manuf_ops; extern const struct nand_manufacturer_ops toshiba_nand_manuf_ops; /* Core functions */ const struct nand_manufacturer *nand_get_manufacturer(u8 id); int nand_markbad_bbm(struct nand_chip *chip, loff_t ofs); int nand_erase_nand(struct nand_chip *chip, struct erase_info *instr, int allowbbt); int onfi_fill_data_interface(struct nand_chip *chip, enum nand_data_interface_type type, int timing_mode); int nand_get_features(struct nand_chip *chip, int addr, u8 *subfeature_param); int nand_set_features(struct nand_chip *chip, int addr, u8 *subfeature_param); int nand_read_page_raw_notsupp(struct nand_chip *chip, u8 *buf, int oob_required, int page); int nand_write_page_raw_notsupp(struct nand_chip *chip, const u8 *buf, int oob_required, int page); int nand_exit_status_op(struct nand_chip *chip); int nand_read_param_page_op(struct nand_chip *chip, u8 page, void *buf, unsigned int len); void nand_decode_ext_id(struct nand_chip *chip); void panic_nand_wait(struct nand_chip *chip, unsigned long timeo); void sanitize_string(uint8_t *s, size_t len); /* BBT functions */ int nand_markbad_bbt(struct nand_chip *chip, loff_t offs); int nand_isreserved_bbt(struct nand_chip *chip, loff_t offs); int nand_isbad_bbt(struct nand_chip *chip, loff_t offs, int allowbbt); /* Legacy */ void nand_legacy_set_defaults(struct nand_chip *chip); void nand_legacy_adjust_cmdfunc(struct nand_chip *chip); int nand_legacy_check_hooks(struct nand_chip *chip); /* ONFI functions */ u16 onfi_crc16(u16 crc, u8 const *p, size_t len); int nand_onfi_detect(struct nand_chip *chip); /* JEDEC functions */ int nand_jedec_detect(struct nand_chip *chip); #endif /* __LINUX_RAWNAND_INTERNALS */
/* { dg-do compile { target { { powerpc*-*-* } && { ! powerpc*-apple-darwin* } } } } */ /* { dg-options "-O2 -mrecip -ffast-math -mcpu=power5" } */ /* { dg-final { scan-assembler-times "frsqrtes" 1 } } */ /* { dg-final { scan-assembler-times "fmsubs" 1 } } */ /* { dg-final { scan-assembler-times "fmuls" 6 } } */ /* { dg-final { scan-assembler-times "fnmsubs" 3 } } */ /* { dg-final { scan-assembler-times "fsqrt" 1 } } */ /* power5 resqrte is not accurate enough, and should not be generated by default for -mrecip. */ double rsqrt_d (double a) { return 1.0 / __builtin_sqrt (a); } float rsqrt_f (float a) { return 1.0f / __builtin_sqrtf (a); }
//===----- ABIInfo.h - ABI information access & encapsulation ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_LIB_CODEGEN_ABIINFO_H #define LLVM_CLANG_LIB_CODEGEN_ABIINFO_H #include "clang/AST/CharUnits.h" #include "clang/AST/Type.h" #include "llvm/IR/CallingConv.h" #include "llvm/IR/Type.h" namespace llvm { class Value; class LLVMContext; class DataLayout; class Type; } namespace clang { class ASTContext; class CodeGenOptions; class TargetInfo; namespace CodeGen { class ABIArgInfo; class Address; class CGCXXABI; class CGFunctionInfo; class CodeGenFunction; class CodeGenTypes; class SwiftABIInfo; namespace swiftcall { class SwiftAggLowering; } // FIXME: All of this stuff should be part of the target interface // somehow. It is currently here because it is not clear how to factor // the targets to support this, since the Targets currently live in a // layer below types n'stuff. /// ABIInfo - Target specific hooks for defining how a type should be /// passed or returned from functions. class ABIInfo { public: CodeGen::CodeGenTypes &CGT; protected: llvm::CallingConv::ID RuntimeCC; llvm::CallingConv::ID BuiltinCC; public: ABIInfo(CodeGen::CodeGenTypes &cgt) : CGT(cgt), RuntimeCC(llvm::CallingConv::C), BuiltinCC(llvm::CallingConv::C) {} virtual ~ABIInfo(); virtual bool supportsSwift() const { return false; } CodeGen::CGCXXABI &getCXXABI() const; ASTContext &getContext() const; llvm::LLVMContext &getVMContext() const; const llvm::DataLayout &getDataLayout() const; const TargetInfo &getTarget() const; const CodeGenOptions &getCodeGenOpts() const; /// Return the calling convention to use for system runtime /// functions. llvm::CallingConv::ID getRuntimeCC() const { return RuntimeCC; } /// Return the calling convention to use for compiler builtins llvm::CallingConv::ID getBuiltinCC() const { return BuiltinCC; } virtual void computeInfo(CodeGen::CGFunctionInfo &FI) const = 0; /// EmitVAArg - Emit the target dependent code to load a value of /// \arg Ty from the va_list pointed to by \arg VAListAddr. // FIXME: This is a gaping layering violation if we wanted to drop // the ABI information any lower than CodeGen. Of course, for // VAArg handling it has to be at this level; there is no way to // abstract this out. virtual CodeGen::Address EmitVAArg(CodeGen::CodeGenFunction &CGF, CodeGen::Address VAListAddr, QualType Ty) const = 0; bool isAndroid() const; /// Emit the target dependent code to load a value of /// \arg Ty from the \c __builtin_ms_va_list pointed to by \arg VAListAddr. virtual CodeGen::Address EmitMSVAArg(CodeGen::CodeGenFunction &CGF, CodeGen::Address VAListAddr, QualType Ty) const; virtual bool isHomogeneousAggregateBaseType(QualType Ty) const; virtual bool isHomogeneousAggregateSmallEnough(const Type *Base, uint64_t Members) const; virtual bool shouldSignExtUnsignedType(QualType Ty) const; bool isHomogeneousAggregate(QualType Ty, const Type *&Base, uint64_t &Members) const; /// A convenience method to return an indirect ABIArgInfo with an /// expected alignment equal to the ABI alignment of the given type. CodeGen::ABIArgInfo getNaturalAlignIndirect(QualType Ty, bool ByRef = true, bool Realign = false, llvm::Type *Padding = nullptr) const; CodeGen::ABIArgInfo getNaturalAlignIndirectInReg(QualType Ty, bool Realign = false) const; }; /// A refining implementation of ABIInfo for targets that support swiftcall. /// /// If we find ourselves wanting multiple such refinements, they'll probably /// be independent refinements, and we should probably find another way /// to do it than simple inheritance. class SwiftABIInfo : public ABIInfo { public: SwiftABIInfo(CodeGen::CodeGenTypes &cgt) : ABIInfo(cgt) {} bool supportsSwift() const final override { return true; } virtual bool shouldPassIndirectlyForSwift(CharUnits totalSize, ArrayRef<llvm::Type*> types, bool asReturnValue) const = 0; virtual bool isLegalVectorTypeForSwift(CharUnits totalSize, llvm::Type *eltTy, unsigned elts) const; virtual bool isSwiftErrorInRegister() const = 0; static bool classof(const ABIInfo *info) { return info->supportsSwift(); } }; } // end namespace CodeGen } // end namespace clang #endif
/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QHOSTADDRESSPRIVATE_H #define QHOSTADDRESSPRIVATE_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists for the convenience // of the QHostAddress and QNetworkInterface classes. This header file may change from // version to version without notice, or even be removed. // // We mean it. // QT_BEGIN_NAMESPACE #include "qhostaddress.h" #include "qabstractsocket.h" class QNetmaskAddress: public QHostAddress { int length; public: QNetmaskAddress() : QHostAddress(), length(-1) { } bool setAddress(const QString &address); bool setAddress(const QHostAddress &address); int prefixLength() const; void setPrefixLength(QAbstractSocket::NetworkLayerProtocol proto, int len); }; #ifdef Q_OS_SYMBIAN class TInetAddr; QHostAddress qt_QHostAddressFromTInetAddr(const TInetAddr& addr); #endif QT_END_NAMESPACE #endif
/******************************************************************************* MRF24WG Universal Driver PLL Work-around Summary: This module contains defintions for the PLL work-around Description: None *******************************************************************************/ /* MRF24WG0M Universal Driver * * Copyright (c) 2012-2013, Microchip <www.microchip.com> * Contact Microchip for the latest version. * * This program is free software; distributed under the terms of BSD * license: * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name(s) of the above-listed copyright holder(s) 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. */ #ifndef __WF_PLL_H #define __WF_PLL_H #ifdef __cplusplus extern "C" { #endif void ResetPll(void); #ifdef __cplusplus } #endif #endif /* __WF_PLL_H */
#ifndef foonativecommonhfoo #define foonativecommonhfoo /*** This file is part of PulseAudio. Copyright 2004-2006 Lennart Poettering Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB PulseAudio is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. PulseAudio 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 PulseAudio; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ***/ #include <pulse/cdecl.h> #include <pulse/def.h> PA_C_DECL_BEGIN enum { /* Generic commands */ PA_COMMAND_ERROR, PA_COMMAND_TIMEOUT, /* pseudo command */ PA_COMMAND_REPLY, /* CLIENT->SERVER */ PA_COMMAND_CREATE_PLAYBACK_STREAM, /* Payload changed in v9, v12 (0.9.0, 0.9.8) */ PA_COMMAND_DELETE_PLAYBACK_STREAM, PA_COMMAND_CREATE_RECORD_STREAM, /* Payload changed in v9, v12 (0.9.0, 0.9.8) */ PA_COMMAND_DELETE_RECORD_STREAM, PA_COMMAND_EXIT, PA_COMMAND_AUTH, PA_COMMAND_SET_CLIENT_NAME, PA_COMMAND_LOOKUP_SINK, PA_COMMAND_LOOKUP_SOURCE, PA_COMMAND_DRAIN_PLAYBACK_STREAM, PA_COMMAND_STAT, PA_COMMAND_GET_PLAYBACK_LATENCY, PA_COMMAND_CREATE_UPLOAD_STREAM, PA_COMMAND_DELETE_UPLOAD_STREAM, PA_COMMAND_FINISH_UPLOAD_STREAM, PA_COMMAND_PLAY_SAMPLE, PA_COMMAND_REMOVE_SAMPLE, PA_COMMAND_GET_SERVER_INFO, PA_COMMAND_GET_SINK_INFO, PA_COMMAND_GET_SINK_INFO_LIST, PA_COMMAND_GET_SOURCE_INFO, PA_COMMAND_GET_SOURCE_INFO_LIST, PA_COMMAND_GET_MODULE_INFO, PA_COMMAND_GET_MODULE_INFO_LIST, PA_COMMAND_GET_CLIENT_INFO, PA_COMMAND_GET_CLIENT_INFO_LIST, PA_COMMAND_GET_SINK_INPUT_INFO, /* Payload changed in v11 (0.9.7) */ PA_COMMAND_GET_SINK_INPUT_INFO_LIST, /* Payload changed in v11 (0.9.7) */ PA_COMMAND_GET_SOURCE_OUTPUT_INFO, PA_COMMAND_GET_SOURCE_OUTPUT_INFO_LIST, PA_COMMAND_GET_SAMPLE_INFO, PA_COMMAND_GET_SAMPLE_INFO_LIST, PA_COMMAND_SUBSCRIBE, PA_COMMAND_SET_SINK_VOLUME, PA_COMMAND_SET_SINK_INPUT_VOLUME, PA_COMMAND_SET_SOURCE_VOLUME, PA_COMMAND_SET_SINK_MUTE, PA_COMMAND_SET_SOURCE_MUTE, PA_COMMAND_CORK_PLAYBACK_STREAM, PA_COMMAND_FLUSH_PLAYBACK_STREAM, PA_COMMAND_TRIGGER_PLAYBACK_STREAM, PA_COMMAND_SET_DEFAULT_SINK, PA_COMMAND_SET_DEFAULT_SOURCE, PA_COMMAND_SET_PLAYBACK_STREAM_NAME, PA_COMMAND_SET_RECORD_STREAM_NAME, PA_COMMAND_KILL_CLIENT, PA_COMMAND_KILL_SINK_INPUT, PA_COMMAND_KILL_SOURCE_OUTPUT, PA_COMMAND_LOAD_MODULE, PA_COMMAND_UNLOAD_MODULE, /* Obsolete */ PA_COMMAND_ADD_AUTOLOAD___OBSOLETE, PA_COMMAND_REMOVE_AUTOLOAD___OBSOLETE, PA_COMMAND_GET_AUTOLOAD_INFO___OBSOLETE, PA_COMMAND_GET_AUTOLOAD_INFO_LIST___OBSOLETE, PA_COMMAND_GET_RECORD_LATENCY, PA_COMMAND_CORK_RECORD_STREAM, PA_COMMAND_FLUSH_RECORD_STREAM, PA_COMMAND_PREBUF_PLAYBACK_STREAM, /* SERVER->CLIENT */ PA_COMMAND_REQUEST, PA_COMMAND_OVERFLOW, PA_COMMAND_UNDERFLOW, PA_COMMAND_PLAYBACK_STREAM_KILLED, PA_COMMAND_RECORD_STREAM_KILLED, PA_COMMAND_SUBSCRIBE_EVENT, /* A few more client->server commands */ /* Supported since protocol v10 (0.9.5) */ PA_COMMAND_MOVE_SINK_INPUT, PA_COMMAND_MOVE_SOURCE_OUTPUT, /* Supported since protocol v11 (0.9.7) */ PA_COMMAND_SET_SINK_INPUT_MUTE, PA_COMMAND_SUSPEND_SINK, PA_COMMAND_SUSPEND_SOURCE, /* Supported since protocol v12 (0.9.8) */ PA_COMMAND_SET_PLAYBACK_STREAM_BUFFER_ATTR, PA_COMMAND_SET_RECORD_STREAM_BUFFER_ATTR, PA_COMMAND_UPDATE_PLAYBACK_STREAM_SAMPLE_RATE, PA_COMMAND_UPDATE_RECORD_STREAM_SAMPLE_RATE, /* SERVER->CLIENT */ PA_COMMAND_PLAYBACK_STREAM_SUSPENDED, PA_COMMAND_RECORD_STREAM_SUSPENDED, PA_COMMAND_PLAYBACK_STREAM_MOVED, PA_COMMAND_RECORD_STREAM_MOVED, /* Supported since protocol v13 (0.9.11) */ PA_COMMAND_UPDATE_RECORD_STREAM_PROPLIST, PA_COMMAND_UPDATE_PLAYBACK_STREAM_PROPLIST, PA_COMMAND_UPDATE_CLIENT_PROPLIST, PA_COMMAND_REMOVE_RECORD_STREAM_PROPLIST, PA_COMMAND_REMOVE_PLAYBACK_STREAM_PROPLIST, PA_COMMAND_REMOVE_CLIENT_PROPLIST, /* SERVER->CLIENT */ PA_COMMAND_STARTED, /* Supported since protocol v14 (0.9.12) */ PA_COMMAND_EXTENSION, /* Supported since protocol v15 (0.9.15) */ PA_COMMAND_GET_CARD_INFO, PA_COMMAND_GET_CARD_INFO_LIST, PA_COMMAND_SET_CARD_PROFILE, PA_COMMAND_CLIENT_EVENT, PA_COMMAND_PLAYBACK_STREAM_EVENT, PA_COMMAND_RECORD_STREAM_EVENT, /* SERVER->CLIENT */ PA_COMMAND_PLAYBACK_BUFFER_ATTR_CHANGED, PA_COMMAND_RECORD_BUFFER_ATTR_CHANGED, /* Supported since protocol v16 (0.9.16) */ PA_COMMAND_SET_SINK_PORT, PA_COMMAND_SET_SOURCE_PORT, /* Supported since protocol v22 (1.0) */ PA_COMMAND_SET_SOURCE_OUTPUT_VOLUME, PA_COMMAND_SET_SOURCE_OUTPUT_MUTE, PA_COMMAND_MAX }; #define PA_NATIVE_COOKIE_LENGTH 256 #define PA_NATIVE_COOKIE_FILE ".pulse-cookie" #define PA_NATIVE_DEFAULT_PORT 4713 #define PA_NATIVE_COOKIE_PROPERTY_NAME "protocol-native-cookie" #define PA_NATIVE_SERVER_PROPERTY_NAME "protocol-native-server" #define PA_NATIVE_DEFAULT_UNIX_SOCKET "native" PA_C_DECL_END #endif
/* packet-intrngreq.c * Routines for Intial Ranging Request Message dissection * Copyright 2003, Brian Wheeler <brian.wheeler[AT]arrisi.com> * * Wireshark - Network traffic analyzer * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include <epan/packet.h> /* Initialize the protocol and registered fields */ static int proto_docsis_intrngreq = -1; static int hf_docsis_intrngreq_down_chid = -1; static int hf_docsis_intrngreq_sid = -1; static int hf_docsis_intrngreq_up_chid = -1; void proto_register_docsis_intrngreq(void); void proto_reg_handoff_docsis_intrngreq(void); /* Initialize the subtree pointers */ static gint ett_docsis_intrngreq = -1; /* Dissection */ static void dissect_intrngreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { proto_item *intrngreq_item; proto_tree *intrngreq_tree; guint16 sid; sid = tvb_get_ntohs (tvb, 0); col_add_fstr (pinfo->cinfo, COL_INFO, "Ranging Request: SID = %u",sid); if (tree) { intrngreq_item = proto_tree_add_protocol_format (tree, proto_docsis_intrngreq, tvb, 0, tvb_captured_length(tvb), "Initial Ranging Request"); intrngreq_tree = proto_item_add_subtree (intrngreq_item, ett_docsis_intrngreq); proto_tree_add_item (intrngreq_tree, hf_docsis_intrngreq_sid, tvb, 0, 2, ENC_BIG_ENDIAN); proto_tree_add_item (intrngreq_tree, hf_docsis_intrngreq_down_chid, tvb, 2, 1, ENC_BIG_ENDIAN); proto_tree_add_item (intrngreq_tree, hf_docsis_intrngreq_up_chid, tvb, 3, 1, ENC_BIG_ENDIAN); } } /* Register the protocol with Wireshark */ void proto_register_docsis_intrngreq (void) { static hf_register_info hf[] = { {&hf_docsis_intrngreq_sid, {"Service Identifier", "docsis_intrngreq.sid", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL} }, {&hf_docsis_intrngreq_down_chid, {"Downstream Channel ID", "docsis_intrngreq.downchid", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL} }, {&hf_docsis_intrngreq_up_chid, {"Upstream Channel ID", "docsis_intrngreq.upchid", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL} }, }; static gint *ett[] = { &ett_docsis_intrngreq, }; proto_docsis_intrngreq = proto_register_protocol ("DOCSIS Initial Ranging Message", "DOCSIS INT-RNG-REQ", "docsis_intrngreq"); proto_register_field_array (proto_docsis_intrngreq, hf, array_length (hf)); proto_register_subtree_array (ett, array_length (ett)); register_dissector ("docsis_intrngreq", dissect_intrngreq, proto_docsis_intrngreq); } void proto_reg_handoff_docsis_intrngreq (void) { dissector_handle_t docsis_intrngreq_handle; docsis_intrngreq_handle = find_dissector ("docsis_intrngreq"); dissector_add_uint ("docsis_mgmt", 0x1E, docsis_intrngreq_handle); } /* * Editor modelines - http://www.wireshark.org/tools/modelines.html * * Local Variables: * c-basic-offset: 2 * tab-width: 8 * indent-tabs-mode: nil * End: * * ex: set shiftwidth=2 tabstop=8 expandtab: * :indentSize=2:tabSize=8:noTabs=true: */
/* * binfmt_elf32.c: Support 32-bit Sparc ELF binaries on Ultra. * * Copyright (C) 1995, 1996, 1997, 1998 David S. Miller (davem@davemloft.net) * Copyright (C) 1995, 1996, 1997, 1998 Jakub Jelinek (jj@ultra.linux.cz) */ #define ELF_ARCH EM_SPARC #define ELF_CLASS ELFCLASS32 #define ELF_DATA ELFDATA2MSB; /* For the most part we present code dumps in the format * Solaris does. */ typedef unsigned int elf_greg_t; #define ELF_NGREG 38 typedef elf_greg_t elf_gregset_t[ELF_NGREG]; /* Format is: * G0 --> G7 * O0 --> O7 * L0 --> L7 * I0 --> I7 * PSR, PC, nPC, Y, WIM, TBR */ #include <asm/psrcompat.h> #define ELF_CORE_COPY_REGS(__elf_regs, __pt_regs) \ do { unsigned int *dest = &(__elf_regs[0]); \ struct pt_regs *src = (__pt_regs); \ unsigned int __user *sp; \ int i; \ for(i = 0; i < 16; i++) \ dest[i] = (unsigned int) src->u_regs[i];\ /* Don't try this at home kids... */ \ sp = (unsigned int __user *) (src->u_regs[14] & \ 0x00000000fffffffc); \ for(i = 0; i < 16; i++) \ __get_user(dest[i+16], &sp[i]); \ dest[32] = tstate_to_psr(src->tstate); \ dest[33] = (unsigned int) src->tpc; \ dest[34] = (unsigned int) src->tnpc; \ dest[35] = src->y; \ dest[36] = dest[37] = 0; /* XXX */ \ } while(0); typedef struct { union { unsigned int pr_regs[32]; unsigned long pr_dregs[16]; } pr_fr; unsigned int __unused; unsigned int pr_fsr; unsigned char pr_qcnt; unsigned char pr_q_entrysize; unsigned char pr_en; unsigned int pr_q[64]; } elf_fpregset_t; /* UltraSparc extensions. Still unused, but will be eventually. */ typedef struct { unsigned int pr_type; unsigned int pr_align; union { struct { union { unsigned int pr_regs[32]; unsigned long pr_dregs[16]; long double pr_qregs[8]; } pr_xfr; } pr_v8p; unsigned int pr_xfsr; unsigned int pr_fprs; unsigned int pr_xg[8]; unsigned int pr_xo[8]; unsigned long pr_tstate; unsigned int pr_filler[8]; } pr_un; } elf_xregset_t; #define elf_check_arch(x) (((x)->e_machine == EM_SPARC) || ((x)->e_machine == EM_SPARC32PLUS)) #define ELF_ET_DYN_BASE 0x70000000 #include <asm/processor.h> #include <linux/module.h> #include <linux/elfcore.h> #include <linux/compat.h> #define elf_prstatus elf_prstatus32 struct elf_prstatus32 { struct elf_siginfo pr_info; /* Info associated with signal */ short pr_cursig; /* Current signal */ unsigned int pr_sigpend; /* Set of pending signals */ unsigned int pr_sighold; /* Set of held signals */ pid_t pr_pid; pid_t pr_ppid; pid_t pr_pgrp; pid_t pr_sid; struct compat_timeval pr_utime; /* User time */ struct compat_timeval pr_stime; /* System time */ struct compat_timeval pr_cutime; /* Cumulative user time */ struct compat_timeval pr_cstime; /* Cumulative system time */ elf_gregset_t pr_reg; /* GP registers */ int pr_fpvalid; /* True if math co-processor being used. */ }; #define elf_prpsinfo elf_prpsinfo32 struct elf_prpsinfo32 { char pr_state; /* numeric process state */ char pr_sname; /* char for pr_state */ char pr_zomb; /* zombie */ char pr_nice; /* nice val */ unsigned int pr_flag; /* flags */ u16 pr_uid; u16 pr_gid; pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid; /* Lots missing */ char pr_fname[16]; /* filename of executable */ char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */ }; #include <linux/highuid.h> #undef NEW_TO_OLD_UID #undef NEW_TO_OLD_GID #define NEW_TO_OLD_UID(uid) ((uid) > 65535) ? (u16)overflowuid : (u16)(uid) #define NEW_TO_OLD_GID(gid) ((gid) > 65535) ? (u16)overflowgid : (u16)(gid) #include <linux/time.h> #undef cputime_to_timeval #define cputime_to_timeval cputime_to_compat_timeval static inline void cputime_to_compat_timeval(const cputime_t cputime, struct compat_timeval *value) { unsigned long jiffies = cputime_to_jiffies(cputime); value->tv_usec = (jiffies % HZ) * (1000000L / HZ); value->tv_sec = jiffies / HZ; } #undef start_thread #define start_thread start_thread32 #define init_elf_binfmt init_elf32_binfmt MODULE_DESCRIPTION("Binary format loader for compatibility with 32bit SparcLinux binaries on the Ultra"); MODULE_AUTHOR("Eric Youngdale, David S. Miller, Jakub Jelinek"); #undef MODULE_DESCRIPTION #undef MODULE_AUTHOR #include <asm/a.out.h> #undef TASK_SIZE #define TASK_SIZE STACK_TOP32 #include "../../../fs/binfmt_elf.c"
// RUN: %clang -target x86_64-apple-darwin -arch armv6m -resource-dir=%S/Inputs/resource_dir %s -### 2> %t // RUN: %clang -target x86_64-apple-darwin -arch armv7em -resource-dir=%S/Inputs/resource_dir %s -### 2>> %t // RUN: %clang -target x86_64-apple-darwin -arch armv7em -mhard-float -resource-dir=%S/Inputs/resource_dir %s -### 2>> %t // RUN: %clang -target x86_64-apple-darwin -arch armv7m -fPIC -resource-dir=%S/Inputs/resource_dir %s -### 2>> %t // RUN: %clang -target x86_64-apple-darwin -arch armv7em -fPIC -mfloat-abi=hard -resource-dir=%S/Inputs/resource_dir %s -### 2>> %t // RUN: %clang -target x86_64-apple-darwin -arch armv7em -fPIC -mfloat-abi=softfp -resource-dir=%S/Inputs/resource_dir %s -### 2>> %t // RUN: %clang -target x86_64-apple-none-macho -arch armv7 -mhard-float -resource-dir=%S/Inputs/resource_dir %s -### 2>> %t // RUN: %clang -target x86_64-apple-none-macho -arch armv7 -msoft-float -fPIC -resource-dir=%S/Inputs/resource_dir %s -### 2>> %t // RUN: FileCheck %s < %t // ARMv6m has no float // CHECK-LABEL: Target: // CHECK-NOT: warning: unknown platform // CHECK: "-mfloat-abi" "soft" // CHECK: libclang_rt.soft_static.a // ARMv7em does, but defaults to soft // CHECK-LABEL: Target: // CHECK-NOT: warning: unknown platform // CHECK: "-mfloat-abi" "soft" // CHECK: libclang_rt.soft_static.a // Which can be overridden // CHECK-LABEL: Target: // CHECK-NOT: warning: unknown platform // CHECK: "-mfloat-abi" "hard" // CHECK: libclang_rt.hard_static.a // ARMv7m has no float either // CHECK-LABEL: Target: // CHECK-NOT: warning: unknown platform // CHECK: "-mfloat-abi" "soft" // CHECK: libclang_rt.soft_pic.a // But it can be enabled on ARMv7em // CHECK-LABEL: Target: // CHECK-NOT: warning: unknown platform // CHECK: "-mfloat-abi" "hard" // CHECK: libclang_rt.hard_pic.a // "softfp" must link against a soft-float library since that's what the // callers we're compiling will expect. // CHECK-LABEL: Target: // CHECK-NOT: warning: unknown platform // CHECK: "-mfloat-abi" "soft" // CHECK: libclang_rt.soft_pic.a // -arch "armv7" (== embedded v7a) can be used in a couple of variants: // CHECK-LABEL: Target: // CHECK-NOT: warning: unknown platform // CHECK: "-mfloat-abi" "hard" // CHECK: libclang_rt.hard_static.a // CHECK-LABEL: Target: // CHECK-NOT: warning: unknown platform // CHECK: "-mfloat-abi" "soft" // CHECK: libclang_rt.soft_pic.a
/**************************************************************************/ /* */ /* OCaml */ /* */ /* Pierre Chambart, OCamlPro */ /* */ /* Copyright 2014 Institut National de Recherche en Informatique et */ /* en Automatique. */ /* */ /* All rights reserved. This file is distributed under the terms of */ /* the GNU Lesser General Public License version 2.1, with the */ /* special exception on linking described in the file LICENSE. */ /* */ /**************************************************************************/ #include <caml/mlvalues.h> #include <caml/custom.h> static int free_counter = 0; static int alloc_counter = 0; static void caml_test_finalize(value v) { free_counter++; } static void caml_test_serialize(value v, uintnat * wsize_32, uintnat * wsize_64) { *wsize_32 = 0; *wsize_64 = 0; } uintnat caml_test_deserialize(void * dst) { alloc_counter++; return 0; } static struct custom_operations caml_test_ops = { "_test", caml_test_finalize, custom_compare_default, custom_hash_default, caml_test_serialize, caml_test_deserialize, custom_compare_ext_default, custom_fixed_length_default }; value caml_test_pr3612_alloc(value unit) { return caml_alloc_custom(&caml_test_ops, 0, 0, 1); } value caml_test_pr3612_counter(value unit) { return Val_int(alloc_counter-free_counter); } CAMLprim value caml_test_pr3612_init(value unit) { caml_register_custom_operations(&caml_test_ops); return Val_unit; }
// Copyright 2011 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Constructor.h // JreEmulation // // Created by Tom Ball on 11/11/11. // #ifndef _JAVA_LANG_REFLECT_CONSTRUCTOR_H #define _JAVA_LANG_REFLECT_CONSTRUCTOR_H #import "ExecutableMember.h" #import "J2ObjC_common.h" #import "java/lang/reflect/GenericDeclaration.h" #import "java/lang/reflect/Member.h" @class JavaMethodMetadata; // A native implementation of java.lang.reflect.Constructor. Its methods are // limited to those that can be derived from an Objective-C Method instance, // so instances can be created and released as needed. @interface JavaLangReflectConstructor : ExecutableMember + (instancetype)constructorWithMethodSignature:(NSMethodSignature *)methodSignature selector:(SEL)selector class:(IOSClass *)aClass metadata:(JavaMethodMetadata *)metadata; // Create a new instance using this constructor. - (id)newInstanceWithNSObjectArray:(IOSObjectArray *)initArgs OBJC_METHOD_FAMILY_NONE; // Faster version of Constructor.newInstance() for JNI code. This does not // require boxing arguments. - (id)jniNewInstance:(const J2ObjcRawValue *)args; @end J2OBJC_EMPTY_STATIC_INIT(JavaLangReflectConstructor) J2OBJC_TYPE_LITERAL_HEADER(JavaLangReflectConstructor) #endif // _JAVA_LANG_REFLECT_CONSTRUCTOR_H
/* * Architecture specific parts of the Floppy driver * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 1995 */ #ifndef __ASM_ALPHA_FLOPPY_H #define __ASM_ALPHA_FLOPPY_H #define fd_inb(port) inb_p(port) #define fd_outb(value,port) outb_p(value,port) #define fd_enable_dma() enable_dma(FLOPPY_DMA) #define fd_disable_dma() disable_dma(FLOPPY_DMA) #define fd_request_dma() request_dma(FLOPPY_DMA,"floppy") #define fd_free_dma() free_dma(FLOPPY_DMA) #define fd_clear_dma_ff() clear_dma_ff(FLOPPY_DMA) #define fd_set_dma_mode(mode) set_dma_mode(FLOPPY_DMA,mode) #define fd_set_dma_addr(addr) set_dma_addr(FLOPPY_DMA,virt_to_bus(addr)) #define fd_set_dma_count(count) set_dma_count(FLOPPY_DMA,count) #define fd_enable_irq() enable_irq(FLOPPY_IRQ) #define fd_disable_irq() disable_irq(FLOPPY_IRQ) #define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt,\ 0, "floppy", NULL) #define fd_free_irq() free_irq(FLOPPY_IRQ, NULL) #ifdef CONFIG_PCI #include <linux/pci.h> #define fd_dma_setup(addr,size,mode,io) alpha_fd_dma_setup(addr,size,mode,io) static __inline__ int alpha_fd_dma_setup(char *addr, unsigned long size, int mode, int io) { static unsigned long prev_size; static dma_addr_t bus_addr = 0; static char *prev_addr; static int prev_dir; int dir; dir = (mode != DMA_MODE_READ) ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE; if (bus_addr && (addr != prev_addr || size != prev_size || dir != prev_dir)) { /* different from last time -- unmap prev */ pci_unmap_single(isa_bridge, bus_addr, prev_size, prev_dir); bus_addr = 0; } if (!bus_addr) /* need to map it */ bus_addr = pci_map_single(isa_bridge, addr, size, dir); /* remember this one as prev */ prev_addr = addr; prev_size = size; prev_dir = dir; fd_clear_dma_ff(); fd_set_dma_mode(mode); set_dma_addr(FLOPPY_DMA, bus_addr); fd_set_dma_count(size); virtual_dma_port = io; fd_enable_dma(); return 0; } #endif /* CONFIG_PCI */ __inline__ void virtual_dma_init(void) { /* Nothing to do on an Alpha */ } static int FDC1 = 0x3f0; static int FDC2 = -1; /* * Again, the CMOS information doesn't work on the alpha.. */ #define FLOPPY0_TYPE 6 #define FLOPPY1_TYPE 0 #define N_FDC 2 #define N_DRIVE 8 /* * Most Alphas have no problems with floppy DMA crossing 64k borders, * except for certain ones, like XL and RUFFIAN. * * However, the test is simple and fast, and this *is* floppy, after all, * so we do it for all platforms, just to make sure. * * This is advantageous in other circumstances as well, as in moving * about the PCI DMA windows and forcing the floppy to start doing * scatter-gather when it never had before, and there *is* a problem * on that platform... ;-} */ static inline unsigned long CROSS_64KB(void *a, unsigned long s) { unsigned long p = (unsigned long)a; return ((p + s - 1) ^ p) & ~0xffffUL; } #define EXTRA_FLOPPY_PARAMS #endif /* __ASM_ALPHA_FLOPPY_H */
// // NSLayoutConstraint+MASDebugAdditions.h // Masonry // // Created by Jonas Budelmann on 3/08/13. // Copyright (c) 2013 Jonas Budelmann. All rights reserved. // #import "MASUtilities.h" /** * makes debug and log output of NSLayoutConstraints more readable */ @interface NSLayoutConstraint (MASDebugAdditions) @end
/* * This file is part of the Micro Python project, http://micropython.org/ * * The MIT License (MIT) * * Copyright (c) 2013, 2014 Damien P. George * * 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. */ #include <stdio.h> #include "py/obj.h" STATIC const char *help_text = "Welcome to MicroPython!\n" "\n" "For online help please visit http://micropython.org/help/.\n" "\n" "Quick overview of commands for the board:\n" " pyb.info() -- print some general information\n" " pyb.gc() -- run the garbage collector\n" " pyb.delay(n) -- wait for n milliseconds\n" " pyb.Switch() -- create a switch object\n" " Switch methods: (), callback(f)\n" " pyb.LED(n) -- create an LED object for LED n (n=1,2,3,4)\n" " LED methods: on(), off(), toggle(), intensity(<n>)\n" " pyb.Pin(pin) -- get a pin, eg pyb.Pin('X1')\n" " pyb.Pin(pin, m, [p]) -- get a pin and configure it for IO mode m, pull mode p\n" " Pin methods: init(..), value([v]), high(), low()\n" " pyb.ExtInt(pin, m, p, callback) -- create an external interrupt object\n" " pyb.ADC(pin) -- make an analog object from a pin\n" " ADC methods: read(), read_timed(buf, freq)\n" " pyb.DAC(port) -- make a DAC object\n" " DAC methods: triangle(freq), write(n), write_timed(buf, freq)\n" " pyb.RTC() -- make an RTC object; methods: datetime([val])\n" " pyb.rng() -- get a 30-bit hardware random number\n" " pyb.Servo(n) -- create Servo object for servo n (n=1,2,3,4)\n" " Servo methods: calibration(..), angle([x, [t]]), speed([x, [t]])\n" " pyb.Accel() -- create an Accelerometer object\n" " Accelerometer methods: x(), y(), z(), tilt(), filtered_xyz()\n" "\n" "Pins are numbered X1-X12, X17-X22, Y1-Y12, or by their MCU name\n" "Pin IO modes are: pyb.Pin.IN, pyb.Pin.OUT_PP, pyb.Pin.OUT_OD\n" "Pin pull modes are: pyb.Pin.PULL_NONE, pyb.Pin.PULL_UP, pyb.Pin.PULL_DOWN\n" "Additional serial bus objects: pyb.I2C(n), pyb.SPI(n), pyb.UART(n)\n" "\n" "Control commands:\n" " CTRL-A -- on a blank line, enter raw REPL mode\n" " CTRL-B -- on a blank line, enter normal REPL mode\n" " CTRL-C -- interrupt a running program\n" " CTRL-D -- on a blank line, do a soft reset of the board\n" "\n" "For further help on a specific object, type help(obj)\n" ; STATIC void pyb_help_print_info_about_object(mp_obj_t name_o, mp_obj_t value) { printf(" "); mp_obj_print(name_o, PRINT_STR); printf(" -- "); mp_obj_print(value, PRINT_STR); printf("\n"); } STATIC mp_obj_t pyb_help(uint n_args, const mp_obj_t *args) { if (n_args == 0) { // print a general help message printf("%s", help_text); } else { // try to print something sensible about the given object printf("object "); mp_obj_print(args[0], PRINT_STR); printf(" is of type %s\n", mp_obj_get_type_str(args[0])); mp_map_t *map = NULL; if (MP_OBJ_IS_TYPE(args[0], &mp_type_module)) { map = mp_obj_dict_get_map(mp_obj_module_get_globals(args[0])); } else { mp_obj_type_t *type; if (MP_OBJ_IS_TYPE(args[0], &mp_type_type)) { type = args[0]; } else { type = mp_obj_get_type(args[0]); } if (type->locals_dict != MP_OBJ_NULL && MP_OBJ_IS_TYPE(type->locals_dict, &mp_type_dict)) { map = mp_obj_dict_get_map(type->locals_dict); } } if (map != NULL) { for (uint i = 0; i < map->alloc; i++) { if (map->table[i].key != MP_OBJ_NULL) { pyb_help_print_info_about_object(map->table[i].key, map->table[i].value); } } } } return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_help_obj, 0, 1, pyb_help);
#include "OpenCV.h" class Constants: public node::ObjectWrap { public: static void Init(Handle<Object> target); };
/* Copyright (c) 2007 Scott Lembcke * * 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. */ #include "chipmunk/chipmunk.h" #include "ChipmunkDemo.h" #define DENSITY (1.0/10000.0) static void ClipPoly(cpSpace *space, cpShape *shape, cpVect n, cpFloat dist) { cpBody *body = cpShapeGetBody(shape); int count = cpPolyShapeGetCount(shape); int clippedCount = 0; cpVect *clipped = (cpVect *)alloca((count + 1)*sizeof(cpVect)); for(int i=0, j=count-1; i<count; j=i, i++){ cpVect a = cpBodyLocalToWorld(body, cpPolyShapeGetVert(shape, j)); cpFloat a_dist = cpvdot(a, n) - dist; if(a_dist < 0.0){ clipped[clippedCount] = a; clippedCount++; } cpVect b = cpBodyLocalToWorld(body, cpPolyShapeGetVert(shape, i)); cpFloat b_dist = cpvdot(b, n) - dist; if(a_dist*b_dist < 0.0f){ cpFloat t = cpfabs(a_dist)/(cpfabs(a_dist) + cpfabs(b_dist)); clipped[clippedCount] = cpvlerp(a, b, t); clippedCount++; } } cpVect centroid = cpCentroidForPoly(clippedCount, clipped); cpFloat mass = cpAreaForPoly(clippedCount, clipped, 0.0f)*DENSITY; cpFloat moment = cpMomentForPoly(mass, clippedCount, clipped, cpvneg(centroid), 0.0f); cpBody *new_body = cpSpaceAddBody(space, cpBodyNew(mass, moment)); cpBodySetPosition(new_body, centroid); cpBodySetVelocity(new_body, cpBodyGetVelocityAtWorldPoint(body, centroid)); cpBodySetAngularVelocity(new_body, cpBodyGetAngularVelocity(body)); cpTransform transform = cpTransformTranslate(cpvneg(centroid)); cpShape *new_shape = cpSpaceAddShape(space, cpPolyShapeNew(new_body, clippedCount, clipped, transform, 0.0)); // Copy whatever properties you have set on the original shape that are important cpShapeSetFriction(new_shape, cpShapeGetFriction(shape)); } // Context structs are annoying, use blocks or closures instead if your compiler supports them. struct SliceContext { cpVect a, b; cpSpace *space; }; static void SliceShapePostStep(cpSpace *space, cpShape *shape, struct SliceContext *context) { cpVect a = context->a; cpVect b = context->b; // Clipping plane normal and distance. cpVect n = cpvnormalize(cpvperp(cpvsub(b, a))); cpFloat dist = cpvdot(a, n); ClipPoly(space, shape, n, dist); ClipPoly(space, shape, cpvneg(n), -dist); cpBody *body = cpShapeGetBody(shape); cpSpaceRemoveShape(space, shape); cpSpaceRemoveBody(space, body); cpShapeFree(shape); cpBodyFree(body); } static void SliceQuery(cpShape *shape, cpVect point, cpVect normal, cpFloat alpha, struct SliceContext *context) { cpVect a = context->a; cpVect b = context->b; // Check that the slice was complete by checking that the endpoints aren't in the sliced shape. if(cpShapePointQuery(shape, a, NULL) > 0.0f && cpShapePointQuery(shape, b, NULL) > 0.0f){ // Can't modify the space during a query. // Must make a post-step callback to do the actual slicing. cpSpaceAddPostStepCallback(context->space, (cpPostStepFunc)SliceShapePostStep, shape, context); } } static void update(cpSpace *space, double dt) { cpSpaceStep(space, dt); static cpBool lastClickState = cpFalse; static cpVect sliceStart = {0.0, 0.0}; // Annoying state tracking code that you wouldn't need // in a real event driven system. if(ChipmunkDemoRightClick != lastClickState){ if(ChipmunkDemoRightClick){ // MouseDown sliceStart = ChipmunkDemoMouse; } else { // MouseUp struct SliceContext context = {sliceStart, ChipmunkDemoMouse, space}; cpSpaceSegmentQuery(space, sliceStart, ChipmunkDemoMouse, 0.0, GRAB_FILTER, (cpSpaceSegmentQueryFunc)SliceQuery, &context); } lastClickState = ChipmunkDemoRightClick; } if(ChipmunkDemoRightClick){ ChipmunkDebugDrawSegment(sliceStart, ChipmunkDemoMouse, RGBAColor(1, 0, 0, 1)); } } static cpSpace * init(void) { ChipmunkDemoMessageString = "Right click and drag to slice up the block."; cpSpace *space = cpSpaceNew(); cpSpaceSetIterations(space, 30); cpSpaceSetGravity(space, cpv(0, -500)); cpSpaceSetSleepTimeThreshold(space, 0.5f); cpSpaceSetCollisionSlop(space, 0.5f); cpBody *body, *staticBody = cpSpaceGetStaticBody(space); cpShape *shape; // Create segments around the edge of the screen. shape = cpSpaceAddShape(space, cpSegmentShapeNew(staticBody, cpv(-1000,-240), cpv(1000,-240), 0.0f)); cpShapeSetElasticity(shape, 1.0f); cpShapeSetFriction(shape, 1.0f); cpShapeSetFilter(shape, NOT_GRABBABLE_FILTER); cpFloat width = 200.0f; cpFloat height = 300.0f; cpFloat mass = width*height*DENSITY; cpFloat moment = cpMomentForBox(mass, width, height); body = cpSpaceAddBody(space, cpBodyNew(mass, moment)); shape = cpSpaceAddShape(space, cpBoxShapeNew(body, width, height, 0.0)); cpShapeSetFriction(shape, 0.6f); return space; } static void destroy(cpSpace *space) { ChipmunkDemoFreeSpaceChildren(space); cpSpaceFree(space); } ChipmunkDemo Slice = { "Slice.", 1.0/60.0, init, update, ChipmunkDemoDefaultDrawImpl, destroy, };
/** * @file * * Ethernet output for IPv6. Uses ND tables for link-layer addressing. */ /* * Copyright (c) 2010 Inico Technologies Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. 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. * * This file is part of the lwIP TCP/IP stack. * * Author: Ivan Delamer <delamer@inicotech.com> * * * Please coordinate changes and requests with Ivan Delamer * <delamer@inicotech.com> */ #ifndef __LWIP_ETHIP6_H__ #define __LWIP_ETHIP6_H__ #include "lwip/opt.h" #if LWIP_IPV6 && LWIP_ETHERNET /* don't build if not configured for use in lwipopts.h */ #include "lwip/pbuf.h" #include "lwip/ip6.h" #include "lwip/ip6_addr.h" #include "lwip/netif.h" #ifdef __cplusplus extern "C" { #endif err_t ethip6_output(struct netif *netif, struct pbuf *q, ip6_addr_t *ip6addr); #ifdef __cplusplus } #endif #endif /* LWIP_IPV6 && LWIP_ETHERNET */ #endif /* __LWIP_ETHIP6_H__ */
/* $NetBSD: gets_chk.c,v 1.7 2013/10/04 20:49:16 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Christos Zoulas. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> __RCSID("$NetBSD: gets_chk.c,v 1.7 2013/10/04 20:49:16 christos Exp $"); /*LINTLIBRARY*/ #include <ssp/ssp.h> #include <stdio.h> #include <string.h> #include <limits.h> #include <stdlib.h> #include <ssp/stdio.h> extern char *__gets(char *); #undef gets #ifdef __NEWLIB__ #define __gets gets #endif char * __gets_chk(char * __restrict buf, size_t slen) { char *abuf; size_t len; if (slen >= (size_t)INT_MAX) return __gets(buf); if ((abuf = malloc(slen + 1)) == NULL) return __gets(buf); if (fgets(abuf, (int)(slen + 1), stdin) == NULL) { free(abuf); return NULL; } len = strlen(abuf); if (len > 0 && abuf[len - 1] == '\n') --len; if (len >= slen) __chk_fail(); (void)memcpy(buf, abuf, len); buf[len] = '\0'; free(abuf); return buf; }
/*************************************************************************** memoryprovider.h - provider with storage in memory ------------------ begin : June 2008 copyright : (C) 2008 by Martin Dobias email : wonder dot sk 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. * * * ***************************************************************************/ #define SIP_NO_FILE #include "qgsvectordataprovider.h" #include "qgscoordinatereferencesystem.h" #include "qgsfields.h" ///@cond PRIVATE typedef QMap<QgsFeatureId, QgsFeature> QgsFeatureMap; class QgsSpatialIndex; class QgsMemoryFeatureIterator; class QgsMemoryProvider final: public QgsVectorDataProvider { Q_OBJECT public: explicit QgsMemoryProvider( const QString &uri, const QgsVectorDataProvider::ProviderOptions &coordinateTransformContext, QgsDataProvider::ReadFlags flags = QgsDataProvider::ReadFlags() ); ~QgsMemoryProvider() override; //! Returns the memory provider key static QString providerKey(); //! Returns the memory provider description static QString providerDescription(); /** * Creates a new memory provider, with provider properties embedded within the given \a uri and \a options * argument. */ static QgsMemoryProvider *createProvider( const QString &uri, const QgsVectorDataProvider::ProviderOptions &coordinateTransformContext, QgsDataProvider::ReadFlags flags = QgsDataProvider::ReadFlags() ); /* Implementation of functions from QgsVectorDataProvider */ QgsAbstractFeatureSource *featureSource() const override; QString dataSourceUri( bool expandAuthConfig = true ) const override; QString storageType() const override; QgsFeatureIterator getFeatures( const QgsFeatureRequest &request ) const override; QgsWkbTypes::Type wkbType() const override; long long featureCount() const override; QgsFields fields() const override; bool addFeatures( QgsFeatureList &flist, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() ) override; bool deleteFeatures( const QgsFeatureIds &id ) override; bool addAttributes( const QList<QgsField> &attributes ) override; bool renameAttributes( const QgsFieldNameMap &renamedAttributes ) override; bool deleteAttributes( const QgsAttributeIds &attributes ) override; bool changeAttributeValues( const QgsChangedAttributesMap &attr_map ) override; bool changeGeometryValues( const QgsGeometryMap &geometry_map ) override; QString subsetString() const override; bool setSubsetString( const QString &theSQL, bool updateFeatureCount = true ) override; bool supportsSubsetString() const override { return true; } bool createSpatialIndex() override; QgsFeatureSource::SpatialIndexPresence hasSpatialIndex() const override; QgsVectorDataProvider::Capabilities capabilities() const override; bool truncate() override; /* Implementation of functions from QgsDataProvider */ QString name() const override; QString description() const override; QgsRectangle extent() const override; void updateExtents() override; bool isValid() const override; QgsCoordinateReferenceSystem crs() const override; void handlePostCloneOperations( QgsVectorDataProvider *source ) override; private: // Coordinate reference system QgsCoordinateReferenceSystem mCrs; // fields QgsFields mFields; QgsWkbTypes::Type mWkbType; mutable QgsRectangle mExtent; // features QgsFeatureMap mFeatures; QgsFeatureId mNextFeatureId; // indexing QgsSpatialIndex *mSpatialIndex = nullptr; QString mSubsetString; friend class QgsMemoryFeatureSource; }; ///@endcond
// license:BSD-3-Clause // copyright-holders: Couriersud NETLIST_EXTERNAL(pongf)
// // Semaphore_POSIX.h // // $Id: //poco/1.3/Foundation/include/Poco/Semaphore_POSIX.h#1 $ // // Library: Foundation // Package: Threading // Module: Semaphore // // Definition of the SemaphoreImpl class for POSIX Threads. // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. // // Permission is hereby granted, free of charge, to any person or organization // obtaining a copy of the software and accompanying documentation covered by // this license (the "Software") to use, reproduce, display, distribute, // execute, and transmit the Software, and to prepare derivative works of the // Software, and to permit third-parties to whom the Software is furnished to // do so, all subject to the following: // // The copyright notices in the Software and this entire statement, including // the above license grant, this restriction and the following disclaimer, // must be included in all copies of the Software, in whole or in part, and // all derivative works of the Software, unless such copies or derivative // works are solely in the form of machine-executable object code generated by // a source language processor. // // 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. // #ifndef Foundation_Semaphore_POSIX_INCLUDED #define Foundation_Semaphore_POSIX_INCLUDED #include "Poco/Foundation.h" #include "Poco/Exception.h" #include <pthread.h> #include <errno.h> namespace Poco { class Foundation_API SemaphoreImpl { protected: SemaphoreImpl(int n, int max); ~SemaphoreImpl(); void setImpl(); void waitImpl(); bool waitImpl(long milliseconds); private: volatile int _n; int _max; pthread_mutex_t _mutex; pthread_cond_t _cond; }; // // inlines // inline void SemaphoreImpl::setImpl() { if (pthread_mutex_lock(&_mutex)) throw SystemException("cannot signal semaphore (lock)"); if (_n < _max) { ++_n; } else { pthread_mutex_unlock(&_mutex); throw SystemException("cannot signal semaphore: count would exceed maximum"); } if (pthread_cond_signal(&_cond)) { pthread_mutex_unlock(&_mutex); throw SystemException("cannot signal semaphore"); } pthread_mutex_unlock(&_mutex); } } // namespace Poco #endif // Foundation_Semaphore_POSIX_INCLUDED
#ifndef MICRO_ALLOCATOR_H #define MICRO_ALLOCATOR_H /*! ** ** Copyright (c) 2009 by John W. Ratcliff mailto:jratcliffscarab@gmail.com ** ** If you find this code useful or you are feeling particularily generous I would ** ask that you please go to http://www.amillionpixels.us and make a donation ** to Troy DeMolay. ** ** If you wish to contact me you can use the following methods: ** ** Skype ID: jratcliff63367 ** email: jratcliffscarab@gmail.com ** ** ** The MIT license: ** ** 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. */ // This code snippet provides a high speed micro-allocator. // // The concept is that you reserve an initial bank of memory for small allocations. Ideally a megabyte or two. // The amount of memory reserved is equal to chunkSize*6 // // All micro-allocations are split into 6 seperate pools. // They are: 0-8 bytes // 9-32 bytes // 33-64 bytes // 65-128 bytes // 129-256 bytes // // On creation of the micro-allocation system you preserve a certiain amount of memory for each of these banks. // // The user provides a heap interface to callback for additional memory as needed. // // In most cases allocations are order-N and frees are order-N as well. // // The larger a buffer you provide, the closer to 'order-N' the allocator behaves. // // This kind of a micro-allocator is ideal for use with STL as it does many tiny allocations. // All allocations are 16 byte aligned (with the exception of the 8 byte allocations, which are 8 byte aligned every other one). // #include <stdio.h> #ifdef WIN32 typedef __int64 NxI64; typedef signed int NxI32; typedef signed short NxI16; typedef signed char NxI8; typedef unsigned __int64 NxU64; typedef unsigned int NxU32; typedef unsigned short NxU16; typedef unsigned char NxU8; typedef float NxF32; typedef double NxF64; #elif __gnu_linux__ typedef long long NxI64; typedef signed int NxI32; typedef signed short NxI16; typedef signed char NxI8; typedef unsigned long long NxU64; typedef unsigned int NxU32; typedef unsigned short NxU16; typedef unsigned char NxU8; typedef float NxF32; typedef double NxF64; #elif __APPLE__ typedef long long NxI64; typedef signed int NxI32; typedef signed short NxI16; typedef signed char NxI8; typedef unsigned long long NxU64; typedef unsigned int NxU32; typedef unsigned short NxU16; typedef unsigned char NxU8; typedef float NxF32; typedef double NxF64; #elif __CELLOS_LV2__ typedef long long NxI64; typedef signed int NxI32; typedef signed short NxI16; typedef signed char NxI8; typedef unsigned long long NxU64; typedef unsigned int NxU32; typedef unsigned short NxU16; typedef unsigned char NxU8; typedef float NxF32; typedef double NxF64; #elif _XBOX typedef __int64 NxI64; typedef signed int NxI32; typedef signed short NxI16; typedef signed char NxI8; typedef unsigned __int64 NxU64; typedef unsigned int NxU32; typedef unsigned short NxU16; typedef unsigned char NxU8; typedef float NxF32; typedef double NxF64; #elif defined(__PPCGEKKO__) typedef long long NxI64; typedef signed int NxI32; typedef signed short NxI16; typedef signed char NxI8; typedef unsigned long long NxU64; typedef unsigned int NxU32; typedef unsigned short NxU16; typedef float NxF32; typedef double NxF64; #else #error Unknown platform! #endif namespace HACD { // user provided heap allocator class MicroHeap { public: virtual void * micro_malloc(size_t size) = 0; virtual void micro_free(void *p) = 0; virtual void * micro_realloc(void *oldMen,size_t newSize) = 0; }; class MemoryChunk; class MicroAllocator { public: virtual void * malloc(size_t size) = 0; virtual void free(void *p,MemoryChunk *chunk) = 0; // free relative to previously located MemoryChunk virtual MemoryChunk * isMicroAlloc(const void *p) = 0; // returns pointer to the chunk this memory belongs to, or null if not a micro-allocated block. virtual NxU32 getChunkSize(MemoryChunk *chunk) = 0; }; MicroAllocator *createMicroAllocator(MicroHeap *heap,NxU32 chunkSize=32768); // initial chunk size 32k per block. void releaseMicroAllocator(MicroAllocator *m); class HeapManager { public: virtual void * heap_malloc(size_t size) = 0; virtual void heap_free(void *p) = 0; virtual void * heap_realloc(void *oldMem,size_t newSize) = 0; }; // creates a heap manager that uses micro-allocations for all allocations < 256 bytes and standard malloc/free for anything larger. HeapManager * createHeapManager(NxU32 defaultChunkSize=32768); void releaseHeapManager(HeapManager *heap); // about 10% faster than using the virtual interface, inlines the functions as much as possible. void * heap_malloc(HeapManager *hm,size_t size); void heap_free(HeapManager *hm,void *p); void * heap_realloc(HeapManager *hm,void *oldMem,size_t newSize); void performUnitTests(void); // }; // end of namespace #endif
/* * Copyright 2013 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkLruImageCache_DEFINED #define SkLruImageCache_DEFINED #include "SkImageCache.h" #include "SkThread.h" #include "SkTInternalLList.h" class CachedPixels; /** * SkImageCache implementation that uses an LRU cache to age out old images. */ class SkLruImageCache : public SkImageCache { public: SK_DECLARE_INST_COUNT(SkLruImageCache) SkLruImageCache(size_t budget); virtual ~SkLruImageCache(); #ifdef SK_DEBUG virtual MemoryStatus getMemoryStatus(ID) const SK_OVERRIDE; virtual void purgeAllUnpinnedCaches() SK_OVERRIDE; #endif /** * Set the byte limit on cached pixels. If more bytes are used than this, the cache will free * unpinned memory until under the new limit or until all unpinned memory is freed. This will * never free pinned memory, so the cache can potentially remain over the limit. The limit is * enforced each time memory is allocated or released. * 0 is a special flag for an infinite budget. * @return size_t The previous limit. */ size_t setImageCacheLimit(size_t newLimit); /** * Return the number of bytes of memory currently in use by the cache. Can include memory that * is no longer pinned, but has not been freed. */ size_t getImageCacheUsed() const { return fRamUsed; } virtual void* allocAndPinCache(size_t bytes, ID*) SK_OVERRIDE; virtual void* pinCache(ID, SkImageCache::DataStatus*) SK_OVERRIDE; virtual void releaseCache(ID) SK_OVERRIDE; virtual void throwAwayCache(ID) SK_OVERRIDE; private: // Linked list of recently used. Head is the most recently used, and tail is the least. SkTInternalLList<CachedPixels> fLRU; typedef SkTInternalLList<CachedPixels>::Iter Iter; #ifdef SK_DEBUG // fMutex is mutable so that getMemoryStatus can be const mutable #endif SkMutex fMutex; size_t fRamBudget; size_t fRamUsed; /** * Find the CachedPixels represented by ID, or NULL if not in the cache. Mutex must be locked * before calling. */ CachedPixels* findByID(ID) const; /** * If over budget, throw away pixels which are not currently in use until below budget or there * are no more pixels eligible to be thrown away. Mutex must be locked before calling. */ void purgeIfNeeded(); /** * Purge until below limit. Mutex must be locked before calling. */ void purgeTilAtOrBelow(size_t limit); /** * Remove a set of CachedPixels. Mutex must be locked before calling. */ void removePixels(CachedPixels*); }; #endif // SkLruImageCache_DEFINED
#ifndef UDF25_H #define UDF25_H /* * Copyright (C) 2010 Team Boxee * http://www.boxee.tv * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with XBMC; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * * * Note: parts of this code comes from libdvdread. * Jorgen Lundman did the necessary modifications to support udf 2.5 */ #include "File.h" /** * The length of one Logical Block of a DVD. */ #define DVD_VIDEO_LB_LEN 2048 /** * Maximum length of filenames allowed in UDF. */ #define MAX_UDF_FILE_NAME_LEN 2048 struct Partition { int valid; char VolumeDesc[128]; uint16_t Flags; uint16_t Number; char Contents[32]; uint32_t AccessType; uint32_t Start; uint32_t Length; }; struct AD { uint32_t Location; uint32_t Length; uint8_t Flags; uint16_t Partition; }; /* Previously dvdread would assume files only had one AD chain, and since they * are 1GB or less, this is most problably true. However, now we handle chains * for large files. ECMA_167 does not specify the maximum number of chains, is * it as many as can fit in a 2048 block (minus ID 266 size), or some other * limit. For now, I have assumed that; * a 4.4GB file uses 5 AD chains. A BluRay disk can store 50GB of data, so the * largest file should be 50 GB. So the maximum number of chains should be * around 62. */ #define UDF_MAX_AD_CHAINS 50 struct FileAD { uint64_t Length; uint32_t num_AD; uint32_t Partition_Start; struct AD AD_chain[UDF_MAX_AD_CHAINS]; }; struct extent_ad { uint32_t location; uint32_t length; }; struct avdp_t { struct extent_ad mvds; struct extent_ad rvds; }; struct pvd_t { uint8_t VolumeIdentifier[32]; uint8_t VolumeSetIdentifier[128]; }; struct lbudf { uint32_t lb; uint8_t *data; /* needed for proper freeing */ uint8_t *data_base; }; struct icbmap { uint32_t lbn; struct FileAD file; uint8_t filetype; }; struct udf_cache { int avdp_valid; struct avdp_t avdp; int pvd_valid; struct pvd_t pvd; int partition_valid; struct Partition partition; int rooticb_valid; struct AD rooticb; int lb_num; struct lbudf *lbs; int map_num; struct icbmap *maps; }; typedef enum { PartitionCache, RootICBCache, LBUDFCache, MapCache, AVDPCache, PVDCache } UDFCacheType; /* * DVDReaddir entry types. */ typedef enum { DVD_DT_UNKNOWN = 0, DVD_DT_FIFO, DVD_DT_CHR, DVD_DT_DIR, DVD_DT_BLK, DVD_DT_REG, DVD_DT_LNK, DVD_DT_SOCK, DVD_DT_WHT } udf_dir_type_t; /* * DVDReaddir structure. * Extended a little from POSIX to also return filesize. */ typedef struct { unsigned char d_name[MAX_UDF_FILE_NAME_LEN]; // "Shall not exceed 1023; Ecma-167 page 123" udf_dir_type_t d_type; // DT_REG, DT_DIR unsigned int d_namlen; uint64_t d_filesize; } udf_dirent_t; /* * DVDOpendir DIR* structure */ typedef struct { uint32_t dir_location; uint32_t dir_length; uint32_t dir_current; // Separate to _location should we one day want to // implement dir_rewind() unsigned int current_p; // Internal implementation specific. UDFScanDirX udf_dirent_t entry; } udf_dir_t; typedef struct FileAD *UDF_FILE; typedef struct _BD_FILE { UDF_FILE file; uint64_t seek_pos; // in bytes uint64_t filesize; // in bytes } *BD_FILE; class udf25 { public: udf25( ); virtual ~udf25( ); DWORD SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod ); int64_t GetFileSize(HANDLE hFile); int64_t GetFilePosition(HANDLE hFile); int64_t Seek(HANDLE hFile, int64_t lOffset, int whence); HANDLE OpenFile( const char* filename ); long ReadFile(HANDLE fd, unsigned char *pBuffer, long lSize); void CloseFile(HANDLE hFile); udf_dir_t *OpenDir( const char *subdir ); udf_dirent_t *ReadDir( udf_dir_t *dirp ); int CloseDir( udf_dir_t *dirp ); void Reset(); void Scan(); bool IsScanned(); private: UDF_FILE UDFFindFile( const char* filename, uint64_t *filesize ); int UDFScanDirX( udf_dir_t *dirp ); void UDFFreeFile(UDF_FILE file); int DVDUDFCacheLevel(int level); void* GetUDFCacheHandle(); void SetUDFCacheHandle(void *cache); int GetUDFCache(UDFCacheType type,uint32_t nr, void *data); int UDFFindPartition( int partnum, struct Partition *part ); int UDFGetAVDP( struct avdp_t *avdp); int DVDReadLBUDF( uint32_t lb_number, size_t block_count, unsigned char *data, int encrypted ); int UDFReadBlocksRaw( uint32_t lb_number, size_t block_count, unsigned char *data, int encrypted ); int UDFMapICB( struct AD ICB, uint8_t *FileType, struct Partition *partition, struct FileAD *File ); int UDFScanDir( struct FileAD Dir, char *FileName, struct Partition *partition, struct AD *FileICB, int cache_file_info); int SetUDFCache(UDFCacheType type, uint32_t nr, void *data); protected: /* Filesystem cache */ int m_udfcache_level; /* 0 - turned off, 1 - on */ void *m_udfcache; XFILE::CFile* m_fp; }; #endif
/* * Copyright (c) 2018-2019, Arm Limited and affiliates. * SPDX-License-Identifier: Apache-2.0 * * 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. */ #ifndef KDE_HELPER_H_ #define KDE_HELPER_H_ /* * EAPOL KDE helper functions * */ #define KDE_GTK_LEN 6 + 2 + 16 #define KDE_PMKID_LEN 6 + 16 #define KDE_PTKID_LEN 6 + 16 #define KDE_LIFETIME_LEN 6 + 4 #define KDE_GTKL_LEN 6 + 1 /** * kde_padded_length_calc calculates padded length for kde (see IEEE 802.11 chapter 11.6.2 EAPOL-Key frames) * * \param kde_length length without padding * * \return padded length */ uint16_t kde_padded_length_calc(uint16_t kde_length); /** * kde_padding_write writes padded bytes * * \param start_ptr first byte of the padding * \param end_ptr last bytes next byte * */ void kde_padding_write(uint8_t *start_ptr, uint8_t *end_ptr); /** * kde_gtk_write writes GTK * * \param ptr pointer where to write * \param key_id key identifier (index) * \param gtk GTK * * return incremented write pointer * */ uint8_t *kde_gtk_write(uint8_t *ptr, uint8_t key_id, const uint8_t *gtk); /** * kde_pmkid_write writes PMKID * * \param ptr pointer where to write * \param pmkid PMKID * * return incremented write pointer * */ uint8_t *kde_pmkid_write(uint8_t *ptr, const uint8_t *pmkid); /** * kde_ptkid_write writes PTKID * * \param ptr pointer where to write * \param pmkid PTKID * * return incremented write pointer * */ uint8_t *kde_ptkid_write(uint8_t *ptr, const uint8_t *ptkid); /** * kde_lifetime_write writes GTK lifetime * * \param ptr pointer where to write * \param lifetime GTK lifetime * * return incremented write pointer * */ uint8_t *kde_lifetime_write(uint8_t *ptr, uint32_t lifetime); /** * kde_gtkl_write writes GTK liveness information * * \param ptr pointer where to write * \param gtkl GTK liveness bit field * * return incremented write pointer * */ uint8_t *kde_gtkl_write(uint8_t *ptr, uint8_t gtkl); /** * kde_gtk_read reads GTK * * \param ptr pointer where to read * \param len length of the remaining data * \param key_id key identifier (index) * \param gtk GTK * * \return < 0 failure * \return >= 0 success * */ int8_t kde_gtk_read(const uint8_t *ptr, uint16_t len, uint8_t *key_id, uint8_t *gtk); /** * kde_pmkid_read reads PMKID * * \param ptr pointer where to read * \param len length of the remaining data * \param pmkid PMKID * * \return < 0 failure * \return >= 0 success * */ int8_t kde_pmkid_read(const uint8_t *ptr, uint16_t len, uint8_t *pmkid); /** * kde_ptkid_read reads PTKID * * \param ptr pointer where to read * \param len length of the remaining data * \param ptkid PTKID * * \return < 0 failure * \return >= 0 success * */ int8_t kde_ptkid_read(const uint8_t *ptr, uint16_t len, uint8_t *ptkid); /** * kde_lifetime_read reads GTK lifetime * * \param ptr pointer where to read * \param len length of the remaining data * \param lifetime GTK lifetime * * \return < 0 failure * \return >= 0 success * */ int8_t kde_lifetime_read(const uint8_t *ptr, uint16_t len, uint32_t *lifetime); /** * kde_gtkl_read reads GTK liveness information * * \param ptr pointer where to read * \param len length of the remaining data * \param gtkl GTK liveness bit field * * \return < 0 failure * \return >= 0 success * */ int8_t kde_gtkl_read(const uint8_t *ptr, uint16_t len, uint8_t *gtkl); #endif /* KDE_HELPER_H_ */
/* * vim:ts=4:sw=4:expandtab * * i3 - an improved dynamic tiling window manager * © 2009 Michael Stapelberg and contributors (see also: LICENSE) * * cmdparse.y: the parser for commands you send to i3 (or bind on keys) * */ #pragma once char *parse_cmd(const char *new);
/* * Copyright 2003 Motorola,Inc. * Xianghua Xiao(x.xiao@motorola.com) */ #ifndef __E500_H__ #define __E500_H__ #ifndef __ASSEMBLY__ typedef struct { unsigned long freq_processor[CONFIG_MAX_CPUS]; #ifdef CONFIG_HETROGENOUS_CLUSTERS unsigned long freq_processor_dsp[CONFIG_MAX_DSP_CPUS]; #endif unsigned long freq_systembus; unsigned long freq_ddrbus; unsigned long freq_localbus; unsigned long freq_qe; unsigned long freq_sdhc; #ifdef CONFIG_SYS_DPAA_FMAN unsigned long freq_fman[CONFIG_SYS_NUM_FMAN]; #endif #ifdef CONFIG_SYS_DPAA_QBMAN unsigned long freq_qman; #endif #ifdef CONFIG_SYS_DPAA_PME unsigned long freq_pme; #endif #ifdef CONFIG_SYS_CPRI unsigned long freq_cpri; #endif #ifdef CONFIG_SYS_MAPLE unsigned long freq_maple; unsigned long freq_maple_ulb; unsigned long freq_maple_etvpe; #endif #ifdef CONFIG_SYS_FSL_SINGLE_SOURCE_CLK unsigned char diff_sysclk; #endif } MPC85xx_SYS_INFO; #endif /* _ASMLANGUAGE */ #define RESET_VECTOR 0xfffffffc #endif /* __E500_H__ */
/* sigstack, sigaltstack definitions. Copyright (C) 1998-2015 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 Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _SIGNAL_H # error "Never include this file directly. Use <signal.h> instead" #endif /* Structure describing a signal stack (obsolete). */ struct sigstack { __ptr_t ss_sp; /* Signal stack pointer. */ int ss_onstack; /* Nonzero if executing on this stack. */ }; /* Possible values for `ss_flags.'. */ enum { SS_ONSTACK = 1, #define SS_ONSTACK SS_ONSTACK SS_DISABLE #define SS_DISABLE SS_DISABLE }; /* Minimum stack size for a signal handler. */ #define MINSIGSTKSZ 4096 /* System default stack size. */ #define SIGSTKSZ 16384 /* Alternate, preferred interface. */ typedef struct sigaltstack { __ptr_t ss_sp; int ss_flags; size_t ss_size; } stack_t;
/* Copyright (C) 2007-2015 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 Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library. If not, see <http://www.gnu.org/licenses/>. */ #include <errno.h> #include <sys/shm.h> #include <ipc_priv.h> #include <sysdep.h> int __shmctl (int shmid, int cmd, struct shmid_ds *buf); int __shmctl (int shmid, int cmd, struct shmid_ds *buf) { return INLINE_SYSCALL (shmctl, 3, shmid, cmd | __IPC_64, buf); } #include <shlib-compat.h> versioned_symbol (libc, __shmctl, shmctl, GLIBC_2_0);
/* { dg-do compile { target { powerpc*-*-* } } } */ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_htm_ok } */ /* { dg-options "-O2 -mhtm -ffixed-r3 -ffixed-r4 -ffixed-r5 -ffixed-r6 -ffixed-r7 -ffixed-r8 -ffixed-r9 -ffixed-r10 -ffixed-r11 -ffixed-r12" } */ /* { dg-final { scan-assembler-not "tabort\\.\[ \t\]0" } } */ int foo (void) { return __builtin_tabort (10); }
/* Rubin encoder/decoder header */ /* work started at : aug 3, 1994 */ /* last modification : aug 15, 1994 */ /* $Id: compr_rubin.h,v 1.5 2001/02/26 13:50:01 dwmw2 Exp $ */ #include "pushpull.h" #define RUBIN_REG_SIZE 16 #define UPPER_BIT_RUBIN (((long) 1)<<(RUBIN_REG_SIZE-1)) #define LOWER_BITS_RUBIN ((((long) 1)<<(RUBIN_REG_SIZE-1))-1) struct rubin_state { unsigned long p; unsigned long q; unsigned long rec_q; long bit_number; struct pushpull pp; int bit_divider; int bits[8]; }; void init_rubin (struct rubin_state *rs, int div, int *bits); int encode (struct rubin_state *, long, long, int); void end_rubin (struct rubin_state *); void init_decode (struct rubin_state *, int div, int *bits); int decode (struct rubin_state *, long, long);
// Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../lcms2-2.6/src/cmserr.c"
// Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #ifndef _JBIG2_SEGMENT_H_ #define _JBIG2_SEGMENT_H_ #include "JBig2_Define.h" #include "JBig2_SymbolDict.h" #include "JBig2_PatternDict.h" #include "JBig2_Module.h" #include "JBig2_HuffmanTable.h" #define JBIG2_GET_INT32(buf) (((buf)[0]<<24) | ((buf)[1]<<16) | ((buf)[2]<<8) | (buf)[3]) #define JBIG2_GET_INT16(buf) (((buf)[0]<<8) | (buf)[1]) typedef enum { JBIG2_SEGMENT_HEADER_UNPARSED, JBIG2_SEGMENT_DATA_UNPARSED, JBIG2_SEGMENT_PARSE_COMPLETE, JBIG2_SEGMENT_PAUSED, JBIG2_SEGMENT_ERROR } JBig2_SegmentState; typedef enum { JBIG2_VOID_POINTER = 0, JBIG2_IMAGE_POINTER, JBIG2_SYMBOL_DICT_POINTER, JBIG2_PATTERN_DICT_POINTER, JBIG2_HUFFMAN_TABLE_POINTER } JBig2_ResultType; class CJBig2_Segment : public CJBig2_Object { public: CJBig2_Segment(); ~CJBig2_Segment(); void init(); void clean(); public: FX_DWORD m_dwNumber; union { struct { FX_BYTE type : 6; FX_BYTE page_association_size : 1; FX_BYTE deferred_non_retain : 1; } s; FX_BYTE c; } m_cFlags; FX_INT32 m_nReferred_to_segment_count; FX_DWORD * m_pReferred_to_segment_numbers; FX_DWORD m_dwPage_association; FX_DWORD m_dwData_length; FX_DWORD m_dwHeader_Length; FX_BYTE *m_pData; JBig2_SegmentState m_State; JBig2_ResultType m_nResultType; union { CJBig2_SymbolDict *sd; CJBig2_PatternDict *pd; CJBig2_Image *im; CJBig2_HuffmanTable *ht; FX_LPVOID vd; } m_Result; }; #endif
/* * (C) Copyright 2009 DENX Software Engineering * Author: John Rigby <jrigby@gmail.com> * * Based on mx27/generic.c: * Copyright (c) 2008 Eric Jarrige <eric.jarrige@armadeus.org> * Copyright (c) 2009 Ilya Yanok <yanok@emcraft.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA */ #include <common.h> #include <div64.h> #include <netdev.h> #include <asm/io.h> #include <asm/arch/imx-regs.h> #include <asm/arch/clock.h> #ifdef CONFIG_FSL_ESDHC #include <fsl_esdhc.h> DECLARE_GLOBAL_DATA_PTR; #endif /* * get the system pll clock in Hz * * mfi + mfn / (mfd +1) * f = 2 * f_ref * -------------------- * pd + 1 */ static unsigned int imx_decode_pll(unsigned int pll, unsigned int f_ref) { unsigned int mfi = (pll >> CCM_PLL_MFI_SHIFT) & CCM_PLL_MFI_MASK; int mfn = (pll >> CCM_PLL_MFN_SHIFT) & CCM_PLL_MFN_MASK; unsigned int mfd = (pll >> CCM_PLL_MFD_SHIFT) & CCM_PLL_MFD_MASK; unsigned int pd = (pll >> CCM_PLL_PD_SHIFT) & CCM_PLL_PD_MASK; mfi = mfi <= 5 ? 5 : mfi; mfn = mfn >= 512 ? mfn - 1024 : mfn; mfd += 1; pd += 1; return lldiv(2 * (u64) f_ref * (mfi * mfd + mfn), mfd * pd); } static ulong imx_get_mpllclk(void) { struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE; ulong fref = MXC_HCLK; return imx_decode_pll(readl(&ccm->mpctl), fref); } static ulong imx_get_armclk(void) { struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE; ulong cctl = readl(&ccm->cctl); ulong fref = imx_get_mpllclk(); ulong div; if (cctl & CCM_CCTL_ARM_SRC) fref = lldiv((u64) fref * 3, 4); div = ((cctl >> CCM_CCTL_ARM_DIV_SHIFT) & CCM_CCTL_ARM_DIV_MASK) + 1; return fref / div; } static ulong imx_get_ahbclk(void) { struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE; ulong cctl = readl(&ccm->cctl); ulong fref = imx_get_armclk(); ulong div; div = ((cctl >> CCM_CCTL_AHB_DIV_SHIFT) & CCM_CCTL_AHB_DIV_MASK) + 1; return fref / div; } static ulong imx_get_ipgclk(void) { return imx_get_ahbclk() / 2; } static ulong imx_get_perclk(int clk) { struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE; ulong fref = imx_get_ahbclk(); ulong div; div = readl(&ccm->pcdr[CCM_PERCLK_REG(clk)]); div = ((div >> CCM_PERCLK_SHIFT(clk)) & CCM_PERCLK_MASK) + 1; return fref / div; } unsigned int mxc_get_clock(enum mxc_clock clk) { if (clk >= MXC_CLK_NUM) return -1; switch (clk) { case MXC_ARM_CLK: return imx_get_armclk(); case MXC_AHB_CLK: return imx_get_ahbclk(); case MXC_IPG_CLK: case MXC_CSPI_CLK: case MXC_FEC_CLK: return imx_get_ipgclk(); default: return imx_get_perclk(clk); } } u32 get_cpu_rev(void) { u32 srev; u32 system_rev = 0x25000; /* read SREV register from IIM module */ struct iim_regs *iim = (struct iim_regs *)IMX_IIM_BASE; srev = readl(&iim->iim_srev); switch (srev) { case 0x00: system_rev |= CHIP_REV_1_0; break; case 0x01: system_rev |= CHIP_REV_1_1; break; case 0x02: system_rev |= CHIP_REV_1_2; break; default: system_rev |= 0x8000; break; } return system_rev; } #if defined(CONFIG_DISPLAY_CPUINFO) static char *get_reset_cause(void) { /* read RCSR register from CCM module */ struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE; u32 cause = readl(&ccm->rcsr) & 0x0f; if (cause == 0) return "POR"; else if (cause == 1) return "RST"; else if ((cause & 2) == 2) return "WDOG"; else if ((cause & 4) == 4) return "SW RESET"; else if ((cause & 8) == 8) return "JTAG"; else return "unknown reset"; } int print_cpuinfo(void) { char buf[32]; u32 cpurev = get_cpu_rev(); printf("CPU: Freescale i.MX25 rev%d.%d%s at %s MHz\n", (cpurev & 0xF0) >> 4, (cpurev & 0x0F), ((cpurev & 0x8000) ? " unknown" : ""), strmhz(buf, imx_get_armclk())); printf("Reset cause: %s\n\n", get_reset_cause()); return 0; } #endif void enable_caches(void) { #ifndef CONFIG_SYS_DCACHE_OFF /* Enable D-cache. I-cache is already enabled in start.S */ dcache_enable(); #endif } #if defined(CONFIG_FEC_MXC) /* * Initializes on-chip ethernet controllers. * to override, implement board_eth_init() */ int cpu_eth_init(bd_t *bis) { struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE; ulong val; val = readl(&ccm->cgr0); val |= (1 << 23); writel(val, &ccm->cgr0); return fecmxc_initialize(bis); } #endif int get_clocks(void) { #ifdef CONFIG_FSL_ESDHC #if CONFIG_SYS_FSL_ESDHC_ADDR == IMX_MMC_SDHC2_BASE gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK); #else gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC1_CLK); #endif #endif return 0; } #ifdef CONFIG_FSL_ESDHC /* * Initializes on-chip MMC controllers. * to override, implement board_mmc_init() */ int cpu_mmc_init(bd_t *bis) { return fsl_esdhc_mmc_init(bis); } #endif #ifdef CONFIG_FEC_MXC void imx_get_mac_from_fuse(int dev_id, unsigned char *mac) { int i; struct iim_regs *iim = (struct iim_regs *)IMX_IIM_BASE; struct fuse_bank *bank = &iim->bank[0]; struct fuse_bank0_regs *fuse = (struct fuse_bank0_regs *)bank->fuse_regs; for (i = 0; i < 6; i++) mac[i] = readl(&fuse->mac_addr[i]) & 0xff; } #endif /* CONFIG_FEC_MXC */
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef EXTENSIONS_BROWSER_API_USB_USB_EVENT_ROUTER_H_ #define EXTENSIONS_BROWSER_API_USB_USB_EVENT_ROUTER_H_ #include "base/macros.h" #include "content/public/browser/browser_thread.h" #include "device/usb/usb_service.h" #include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" namespace device { class UsbDevice; } namespace extensions { // A BrowserContext-scoped object which is registered as an observer of the // EventRouter and UsbService in order to generate device add/remove events. class UsbEventRouter : public BrowserContextKeyedAPI, public EventRouter::Observer, public device::UsbService::Observer { public: // BrowserContextKeyedAPI implementation. static BrowserContextKeyedAPIFactory<UsbEventRouter>* GetFactoryInstance(); private: friend class BrowserContextKeyedAPIFactory<UsbEventRouter>; explicit UsbEventRouter(content::BrowserContext* context); ~UsbEventRouter() override; // BrowserContextKeyedAPI implementation. static const char* service_name() { return "UsbEventRouter"; } static const bool kServiceIsNULLWhileTesting = true; // KeyedService implementation. void Shutdown() override; // EventRouter::Observer implementation. void OnListenerAdded(const EventListenerInfo& details) override; // UsbService::Observer implementation. void OnDeviceAdded(scoped_refptr<device::UsbDevice> device) override; void OnDeviceRemoved(scoped_refptr<device::UsbDevice> device) override; // Broadcasts a device add or remove event for the given device. void DispatchEvent(const std::string& event_name, scoped_refptr<device::UsbDevice> device); content::BrowserContext* const browser_context_; ScopedObserver<device::UsbService, device::UsbService::Observer> observer_; DISALLOW_COPY_AND_ASSIGN(UsbEventRouter); }; template <> void BrowserContextKeyedAPIFactory< UsbEventRouter>::DeclareFactoryDependencies(); } // namespace extensions #endif // EXTENSIONS_BROWSER_API_USB_USB_EVENT_ROUTER_H_
/* plugin_common - Routines common to several plugins * Copyright (C) 2002-2009 Josh Coalson * Copyright (C) 2011-2014 Xiph.Org Foundation * * Only slightly modified charset.c from: * EasyTAG - Tag editor for MP3 and OGG files * Copyright (C) 1999-2001 Håvard Kvålen <havardk@xmms.org> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #ifdef HAVE_ICONV #include <iconv.h> #endif #ifdef HAVE_LANGINFO_CODESET #include <langinfo.h> #endif #include "charset.h" /************* * Functions * *************/ char* FLAC_plugin__charset_get_current (void) { char *charset = getenv("CHARSET"); #ifdef HAVE_LANGINFO_CODESET if (!charset) charset = nl_langinfo(CODESET); #endif if (!charset) charset = "ISO-8859-1"; return charset; } #ifdef HAVE_ICONV char* FLAC_plugin__charset_convert_string (const char *string, char *from, char *to) { size_t outleft, outsize, length; iconv_t cd; char *out, *outptr; const char *input = string; if (!string) return NULL; length = strlen(string); if ((cd = iconv_open(to, from)) == (iconv_t)-1) { #ifdef DEBUG fprintf(stderr, "convert_string(): Conversion not supported. Charsets: %s -> %s", from, to); #endif return strdup(string); } /* Due to a GLIBC bug, round outbuf_size up to a multiple of 4 */ /* + 1 for nul in case len == 1 */ outsize = ((length + 3) & ~3) + 1; if(outsize < length) /* overflow check */ return NULL; out = malloc(outsize); outleft = outsize - 1; outptr = out; retry: if (iconv(cd, (char**)&input, &length, &outptr, &outleft) == (size_t)(-1)) { int used; switch (errno) { case E2BIG: used = outptr - out; if((outsize - 1) * 2 + 1 <= outsize) { /* overflow check */ free(out); return NULL; } outsize = (outsize - 1) * 2 + 1; out = realloc(out, outsize); outptr = out + used; outleft = outsize - 1 - used; goto retry; case EINVAL: break; case EILSEQ: /* Invalid sequence, try to get the rest of the string */ input++; length = strlen(input); goto retry; default: #ifdef DEBUG fprintf(stderr, "convert_string(): Conversion failed. Inputstring: %s; Error: %s", string, strerror(errno)); #endif break; } } *outptr = '\0'; iconv_close(cd); return out; } #else char* FLAC_plugin__charset_convert_string (const char *string, char *from, char *to) { (void)from, (void)to; if (!string) return NULL; return strdup(string); } #endif #ifdef HAVE_ICONV int FLAC_plugin__charset_test_conversion (char *from, char *to) { iconv_t cd; if ((cd=iconv_open(to,from)) == (iconv_t)-1) { /* Conversion not supported */ return 0; } iconv_close(cd); return 1; } #else int FLAC_plugin__charset_test_conversion (char *from, char *to) { (void)from, (void)to; return 1; } #endif
/* * linux/fs/9p/vfs_dir.c * * This file contains vfs directory ops for the 9P2000 protocol. * * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to: * Free Software Foundation * 51 Franklin Street, Fifth Floor * Boston, MA 02111-1301 USA * */ #include <linux/module.h> #include <linux/errno.h> #include <linux/fs.h> #include <linux/file.h> #include <linux/stat.h> #include <linux/string.h> #include <linux/sched.h> #include <linux/inet.h> #include <linux/idr.h> #include <linux/slab.h> #include <net/9p/9p.h> #include <net/9p/client.h> #include "v9fs.h" #include "v9fs_vfs.h" #include "fid.h" /** * struct p9_rdir - readdir accounting * @head: start offset of current dirread buffer * @tail: end offset of current dirread buffer * @buf: dirread buffer * * private structure for keeping track of readdir * allocated on demand */ struct p9_rdir { int head; int tail; uint8_t buf[]; }; /** * dt_type - return file type * @mistat: mistat structure * */ static inline int dt_type(struct p9_wstat *mistat) { unsigned long perm = mistat->mode; int rettype = DT_REG; if (perm & P9_DMDIR) rettype = DT_DIR; if (perm & P9_DMSYMLINK) rettype = DT_LNK; return rettype; } static void p9stat_init(struct p9_wstat *stbuf) { stbuf->name = NULL; stbuf->uid = NULL; stbuf->gid = NULL; stbuf->muid = NULL; stbuf->extension = NULL; } /** * v9fs_alloc_rdir_buf - Allocate buffer used for read and readdir * @filp: opened file structure * @buflen: Length in bytes of buffer to allocate * */ static struct p9_rdir *v9fs_alloc_rdir_buf(struct file *filp, int buflen) { struct p9_fid *fid = filp->private_data; if (!fid->rdir) fid->rdir = kzalloc(sizeof(struct p9_rdir) + buflen, GFP_KERNEL); return fid->rdir; } /** * v9fs_dir_readdir - iterate through a directory * @file: opened file structure * @ctx: actor we feed the entries to * */ static int v9fs_dir_readdir(struct file *file, struct dir_context *ctx) { bool over; struct p9_wstat st; int err = 0; struct p9_fid *fid; int buflen; int reclen = 0; struct p9_rdir *rdir; p9_debug(P9_DEBUG_VFS, "name %pD\n", file); fid = file->private_data; buflen = fid->clnt->msize - P9_IOHDRSZ; rdir = v9fs_alloc_rdir_buf(file, buflen); if (!rdir) return -ENOMEM; while (1) { if (rdir->tail == rdir->head) { err = v9fs_file_readn(file, rdir->buf, NULL, buflen, ctx->pos); if (err <= 0) return err; rdir->head = 0; rdir->tail = err; } while (rdir->head < rdir->tail) { p9stat_init(&st); err = p9stat_read(fid->clnt, rdir->buf + rdir->head, rdir->tail - rdir->head, &st); if (err) { p9_debug(P9_DEBUG_VFS, "returned %d\n", err); p9stat_free(&st); return -EIO; } reclen = st.size+2; over = !dir_emit(ctx, st.name, strlen(st.name), v9fs_qid2ino(&st.qid), dt_type(&st)); p9stat_free(&st); if (over) return 0; rdir->head += reclen; ctx->pos += reclen; } } } /** * v9fs_dir_readdir_dotl - iterate through a directory * @file: opened file structure * @ctx: actor we feed the entries to * */ static int v9fs_dir_readdir_dotl(struct file *file, struct dir_context *ctx) { int err = 0; struct p9_fid *fid; int buflen; struct p9_rdir *rdir; struct p9_dirent curdirent; p9_debug(P9_DEBUG_VFS, "name %pD\n", file); fid = file->private_data; buflen = fid->clnt->msize - P9_READDIRHDRSZ; rdir = v9fs_alloc_rdir_buf(file, buflen); if (!rdir) return -ENOMEM; while (1) { if (rdir->tail == rdir->head) { err = p9_client_readdir(fid, rdir->buf, buflen, ctx->pos); if (err <= 0) return err; rdir->head = 0; rdir->tail = err; } while (rdir->head < rdir->tail) { err = p9dirent_read(fid->clnt, rdir->buf + rdir->head, rdir->tail - rdir->head, &curdirent); if (err < 0) { p9_debug(P9_DEBUG_VFS, "returned %d\n", err); return -EIO; } if (!dir_emit(ctx, curdirent.d_name, strlen(curdirent.d_name), v9fs_qid2ino(&curdirent.qid), curdirent.d_type)) return 0; ctx->pos = curdirent.d_off; rdir->head += err; } } } /** * v9fs_dir_release - close a directory * @inode: inode of the directory * @filp: file pointer to a directory * */ int v9fs_dir_release(struct inode *inode, struct file *filp) { struct p9_fid *fid; fid = filp->private_data; p9_debug(P9_DEBUG_VFS, "inode: %p filp: %p fid: %d\n", inode, filp, fid ? fid->fid : -1); if (fid) p9_client_clunk(fid); return 0; } const struct file_operations v9fs_dir_operations = { .read = generic_read_dir, .llseek = generic_file_llseek, .iterate = v9fs_dir_readdir, .open = v9fs_file_open, .release = v9fs_dir_release, }; const struct file_operations v9fs_dir_operations_dotl = { .read = generic_read_dir, .llseek = generic_file_llseek, .iterate = v9fs_dir_readdir_dotl, .open = v9fs_file_open, .release = v9fs_dir_release, .fsync = v9fs_file_fsync_dotl, };
for (int c0 = 0; c0 <= 4; c0 += 1) { if (c0 == 0) { S_0(0, 4); } else { S_0(2 * c0 - 1, 1); if (c0 == 4) { for (int c6 = 3; c6 <= 5; c6 += 1) S_0(7, c6); } else { for (int c4 = 2 * c0 - 1; c4 <= 2 * c0; c4 += 1) for (int c6 = -2 * c0 + c4 + 4; c6 <= 2 * c0 - c4 + 4; c6 += 1) S_0(c4, c6); } } for (int c4 = max(0, 2 * c0 - 1); c4 <= min(7, 2 * c0); c4 += 1) for (int c6 = -2 * c0 + c4 + 8; c6 <= 8; c6 += 1) S_0(c4, c6); if (c0 >= 1 && c0 <= 3) { for (int c2 = 0; c2 <= 1; c2 += 1) for (int c4 = 2 * c0 - 1; c4 <= 2 * c0; c4 += 1) for (int c6 = 2 * c0 + 4 * c2 - c4 + 1; c6 <= -2 * c0 + 4 * c2 + c4 + 3; c6 += 1) S_0(c4, c6); } else if (c0 == 4) { for (int c2 = 0; c2 <= 1; c2 += 1) S_0(7, 4 * c2 + 2); } else { for (int c2 = 0; c2 <= 1; c2 += 1) for (int c6 = 4 * c2 + 1; c6 <= 4 * c2 + 3; c6 += 1) S_0(0, c6); } }
/* kaiomy.h - Keytable for kaiomy Remote Controller * * keymap imported from ir-keymaps.c * * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.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 <media/rc-map.h> /* Kaiomy TVnPC U2 Mauro Carvalho Chehab <mchehab@infradead.org> */ static struct rc_map_table kaiomy[] = { { 0x43, KEY_POWER2}, { 0x01, KEY_LIST}, { 0x0b, KEY_ZOOM}, { 0x03, KEY_POWER}, { 0x04, KEY_1}, { 0x08, KEY_2}, { 0x02, KEY_3}, { 0x0f, KEY_4}, { 0x05, KEY_5}, { 0x06, KEY_6}, { 0x0c, KEY_7}, { 0x0d, KEY_8}, { 0x0a, KEY_9}, { 0x11, KEY_0}, { 0x09, KEY_CHANNELUP}, { 0x07, KEY_CHANNELDOWN}, { 0x0e, KEY_VOLUMEUP}, { 0x13, KEY_VOLUMEDOWN}, { 0x10, KEY_HOME}, { 0x12, KEY_ENTER}, { 0x14, KEY_RECORD}, { 0x15, KEY_STOP}, { 0x16, KEY_PLAY}, { 0x17, KEY_MUTE}, { 0x18, KEY_UP}, { 0x19, KEY_DOWN}, { 0x1a, KEY_LEFT}, { 0x1b, KEY_RIGHT}, { 0x1c, KEY_RED}, { 0x1d, KEY_GREEN}, { 0x1e, KEY_YELLOW}, { 0x1f, KEY_BLUE}, }; static struct rc_map_list kaiomy_map = { .map = { .scan = kaiomy, .size = ARRAY_SIZE(kaiomy), .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_KAIOMY, } }; static int __init init_rc_map_kaiomy(void) { return rc_map_register(&kaiomy_map); } static void __exit exit_rc_map_kaiomy(void) { rc_map_unregister(&kaiomy_map); } module_init(init_rc_map_kaiomy) module_exit(exit_rc_map_kaiomy) MODULE_LICENSE("GPL"); MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
/* fat.h (09.11.10) File Allocation Table creation code. Free exFAT implementation. Copyright (C) 2011-2013 Andrew Nayenko 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 MKFS_FAT_H_INCLUDED #define MKFS_FAT_H_INCLUDED #include "mkexfat.h" extern const struct fs_object fat; #endif /* ifndef MKFS_FAT_H_INCLUDED */
/** * FreeRDP: A Remote Desktop Protocol Implementation * Wayland Displays * * Copyright 2014 Manuel Bachmann <tarnyko@tarnyko.net> * * 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 <stdio.h> #include <stdlib.h> #include "wlf_display.h" static void wl_registry_handle_global(void* data, struct wl_registry* registry, uint32_t id, const char *interface, uint32_t version) { wlfDisplay* display = data; if (strcmp(interface, "wl_compositor") == 0) display->compositor = wl_registry_bind(registry, id, &wl_compositor_interface, 1); else if (strcmp(interface, "wl_shell") == 0) display->shell = wl_registry_bind(registry, id, &wl_shell_interface, 1); else if (strcmp(interface, "wl_shm") == 0) display->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1); else if (strcmp(interface, "wl_seat") == 0) display->seat = wl_registry_bind(registry, id, &wl_seat_interface, 1); } static void wl_registry_handle_global_remove(void* data, struct wl_registry* registry, uint32_t name) { } static const struct wl_registry_listener wl_registry_listener = { wl_registry_handle_global, wl_registry_handle_global_remove }; wlfDisplay* wlf_CreateDisplay(void) { wlfDisplay* display; display = (wlfDisplay*) calloc(1, sizeof(wlfDisplay)); if (display) { display->display = wl_display_connect(NULL); if (!display->display) { WLog_ERR(TAG, "wl_pre_connect: failed to connect to Wayland compositor"); WLog_ERR(TAG, "Please check that the XDG_RUNTIME_DIR environment variable is properly set."); free(display); return NULL; } display->registry = wl_display_get_registry(display->display); wl_registry_add_listener(display->registry, &wl_registry_listener, display); wl_display_roundtrip(display->display); if (!display->compositor || !display->shell || !display->shm) { WLog_ERR(TAG, "wl_pre_connect: failed to find needed compositor interfaces"); free(display); return NULL; } } return display; } BOOL wlf_RefreshDisplay(wlfDisplay* display) { if (wl_display_dispatch(display->display) == -1) return FALSE; return TRUE; } void wlf_DestroyDisplay(wlfContext* wlfc, wlfDisplay* display) { if (display == NULL) return; if (wlfc->display == display) wlfc->display = NULL; if (display->seat) wl_seat_destroy(display->seat); if (display->shm) wl_shm_destroy(display->shm); if (display->shell) wl_shell_destroy(display->shell); if (display->compositor) wl_compositor_destroy(display->compositor); if (display->registry) wl_registry_destroy(display->registry); wl_display_disconnect(display->display); free(display); }
/* * Qlogic FAS408 ISA card driver * * Copyright 1994, Tom Zerucha. * tz@execpc.com * * Redistributable under terms of the GNU General Public License * * For the avoidance of doubt the "preferred form" of this code is one which * is in an open non patent encumbered format. Where cryptographic key signing * forms part of the process of creating an executable the information * including keys needed to generate an equivalently functional executable * are deemed to be part of the source code. * * Check qlogicfas408.c for more credits and info. */ #include <linux/module.h> #include <linux/blkdev.h> /* to get disk capacity */ #include <linux/kernel.h> #include <linux/string.h> #include <linux/init.h> #include <linux/interrupt.h> #include <linux/ioport.h> #include <linux/proc_fs.h> #include <linux/unistd.h> #include <linux/spinlock.h> #include <linux/stat.h> #include <asm/io.h> #include <asm/irq.h> #include <asm/dma.h> #include "scsi.h" #include <scsi/scsi_host.h> #include "qlogicfas408.h" /* Set the following to 2 to use normal interrupt (active high/totempole- * tristate), otherwise use 0 (REQUIRED FOR PCMCIA) for active low, open * drain */ #define INT_TYPE 2 static char qlogicfas_name[] = "qlogicfas"; /* * Look for qlogic card and init if found */ static struct Scsi_Host *__qlogicfas_detect(Scsi_Host_Template *host, int qbase, int qlirq) { int qltyp; /* type of chip */ int qinitid; struct Scsi_Host *hreg; /* registered host structure */ struct qlogicfas408_priv *priv; /* Qlogic Cards only exist at 0x230 or 0x330 (the chip itself * decodes the address - I check 230 first since MIDI cards are * typically at 0x330 * * Theoretically, two Qlogic cards can coexist in the same system. * This should work by simply using this as a loadable module for * the second card, but I haven't tested this. */ if (!qbase || qlirq == -1) goto err; if (!request_region(qbase, 0x10, qlogicfas_name)) { printk(KERN_INFO "%s: address %#x is busy\n", qlogicfas_name, qbase); goto err; } if (!qlogicfas408_detect(qbase, INT_TYPE)) { printk(KERN_WARNING "%s: probe failed for %#x\n", qlogicfas_name, qbase); goto err_release_mem; } printk(KERN_INFO "%s: Using preset base address of %03x," " IRQ %d\n", qlogicfas_name, qbase, qlirq); qltyp = qlogicfas408_get_chip_type(qbase, INT_TYPE); qinitid = host->this_id; if (qinitid < 0) qinitid = 7; /* if no ID, use 7 */ qlogicfas408_setup(qbase, qinitid, INT_TYPE); hreg = scsi_host_alloc(host, sizeof(struct qlogicfas408_priv)); if (!hreg) goto err_release_mem; priv = get_priv_by_host(hreg); hreg->io_port = qbase; hreg->n_io_port = 16; hreg->dma_channel = -1; if (qlirq != -1) hreg->irq = qlirq; priv->qbase = qbase; priv->qlirq = qlirq; priv->qinitid = qinitid; priv->shost = hreg; priv->int_type = INT_TYPE; sprintf(priv->qinfo, "Qlogicfas Driver version 0.46, chip %02X at %03X, IRQ %d, TPdma:%d", qltyp, qbase, qlirq, QL_TURBO_PDMA); host->name = qlogicfas_name; if (request_irq(qlirq, qlogicfas408_ihandl, 0, qlogicfas_name, hreg)) goto free_scsi_host; if (scsi_add_host(hreg, NULL)) goto free_interrupt; scsi_scan_host(hreg); return hreg; free_interrupt: free_irq(qlirq, hreg); free_scsi_host: scsi_host_put(hreg); err_release_mem: release_region(qbase, 0x10); err: return NULL; } #define MAX_QLOGICFAS 8 static struct qlogicfas408_priv *cards; static int iobase[MAX_QLOGICFAS]; static int irq[MAX_QLOGICFAS] = { [0 ... MAX_QLOGICFAS-1] = -1 }; module_param_array(iobase, int, NULL, 0); module_param_array(irq, int, NULL, 0); MODULE_PARM_DESC(iobase, "I/O address"); MODULE_PARM_DESC(irq, "IRQ"); static int __devinit qlogicfas_detect(Scsi_Host_Template *sht) { struct Scsi_Host *shost; struct qlogicfas408_priv *priv; int num; for (num = 0; num < MAX_QLOGICFAS; num++) { shost = __qlogicfas_detect(sht, iobase[num], irq[num]); if (shost == NULL) { /* no more devices */ break; } priv = get_priv_by_host(shost); priv->next = cards; cards = priv; } return num; } static int qlogicfas_release(struct Scsi_Host *shost) { struct qlogicfas408_priv *priv = get_priv_by_host(shost); if (shost->irq) { qlogicfas408_disable_ints(priv); free_irq(shost->irq, shost); } if (shost->dma_channel != 0xff) free_dma(shost->dma_channel); if (shost->io_port && shost->n_io_port) release_region(shost->io_port, shost->n_io_port); scsi_remove_host(shost); scsi_host_put(shost); return 0; } /* * The driver template is also needed for PCMCIA */ static Scsi_Host_Template qlogicfas_driver_template = { .module = THIS_MODULE, .name = qlogicfas_name, .proc_name = qlogicfas_name, .info = qlogicfas408_info, .queuecommand = qlogicfas408_queuecommand, .eh_abort_handler = qlogicfas408_abort, .eh_bus_reset_handler = qlogicfas408_bus_reset, .eh_device_reset_handler= qlogicfas408_device_reset, .eh_host_reset_handler = qlogicfas408_host_reset, .bios_param = qlogicfas408_biosparam, .can_queue = 1, .this_id = -1, .sg_tablesize = SG_ALL, .cmd_per_lun = 1, .use_clustering = DISABLE_CLUSTERING, }; static __init int qlogicfas_init(void) { if (!qlogicfas_detect(&qlogicfas_driver_template)) { /* no cards found */ printk(KERN_INFO "%s: no cards were found, please specify " "I/O address and IRQ using iobase= and irq= " "options", qlogicfas_name); return -ENODEV; } return 0; } static __exit void qlogicfas_exit(void) { struct qlogicfas408_priv *priv; for (priv = cards; priv != NULL; priv = priv->next) qlogicfas_release(priv->shost); } MODULE_AUTHOR("Tom Zerucha, Michael Griffith"); MODULE_DESCRIPTION("Driver for the Qlogic FAS408 based ISA card"); MODULE_LICENSE("GPL"); module_init(qlogicfas_init); module_exit(qlogicfas_exit);
/* * SMP stuff which is common to all sub-architectures. */ #include <linux/module.h> #include <asm/smp.h> DEFINE_PER_CPU(unsigned long, this_cpu_off); EXPORT_PER_CPU_SYMBOL(this_cpu_off); /* Initialize the CPU's GDT. This is either the boot CPU doing itself (still using the master per-cpu area), or a CPU doing it for a secondary which will soon come up. */ __cpuinit void init_gdt(int cpu) { struct desc_struct *gdt = get_cpu_gdt_table(cpu); pack_descriptor((u32 *)&gdt[GDT_ENTRY_PERCPU].a, (u32 *)&gdt[GDT_ENTRY_PERCPU].b, __per_cpu_offset[cpu], 0xFFFFF, 0x80 | DESCTYPE_S | 0x2, 0x8); per_cpu(this_cpu_off, cpu) = __per_cpu_offset[cpu]; per_cpu(cpu_number, cpu) = cpu; } /** * smp_call_function(): Run a function on all other CPUs. * @func: The function to run. This must be fast and non-blocking. * @info: An arbitrary pointer to pass to the function. * @nonatomic: Unused. * @wait: If true, wait (atomically) until function has completed on other CPUs. * * Returns 0 on success, else a negative status code. * * If @wait is true, then returns once @func has returned; otherwise * it returns just before the target cpu calls @func. * * You must not call this function with disabled interrupts or from a * hardware interrupt handler or from a bottom half handler. */ int smp_call_function(void (*func) (void *info), void *info, int nonatomic, int wait) { return smp_call_function_mask(cpu_online_map, func, info, wait); } EXPORT_SYMBOL(smp_call_function); /** * smp_call_function_single - Run a function on a specific CPU * @cpu: The target CPU. Cannot be the calling CPU. * @func: The function to run. This must be fast and non-blocking. * @info: An arbitrary pointer to pass to the function. * @nonatomic: Unused. * @wait: If true, wait until function has completed on other CPUs. * * Returns 0 on success, else a negative status code. * * If @wait is true, then returns once @func has returned; otherwise * it returns just before the target cpu calls @func. */ int smp_call_function_single(int cpu, void (*func) (void *info), void *info, int nonatomic, int wait) { /* prevent preemption and reschedule on another processor */ int ret; int me = get_cpu(); if (cpu == me) { local_irq_disable(); func(info); local_irq_enable(); put_cpu(); return 0; } ret = smp_call_function_mask(cpumask_of_cpu(cpu), func, info, wait); put_cpu(); return ret; } EXPORT_SYMBOL(smp_call_function_single);
#ifndef __EMMCPARTINFO_H__ #define __EMMCPARTINFO_H__ struct excel_info{ char * name; unsigned int size; unsigned int start_address; unsigned int partition_idx; }; #define PART_NUM 20 #endif
/* ============================================================================== This file is part of the JUCE library. Copyright (c) 2013 - Raw Material Software Ltd. Permission is granted to use this software under the terms of either: a) the GPL v2 (or any later version) b) the Affero GPL v3 Details of these licenses can be found at: www.gnu.org/licenses JUCE 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. ------------------------------------------------------------------------------ To release a closed-source product which uses JUCE, commercial licenses are available: visit www.juce.com for more information. ============================================================================== */ #ifdef __aeffect__ // NB: this must come first, *before* the header-guard. #ifndef JUCE_VSTMIDIEVENTLIST_H_INCLUDED #define JUCE_VSTMIDIEVENTLIST_H_INCLUDED //============================================================================== /** Holds a set of VSTMidiEvent objects and makes it easy to add events to the list. This is used by both the VST hosting code and the plugin wrapper. */ class VSTMidiEventList { public: //============================================================================== VSTMidiEventList() : numEventsUsed (0), numEventsAllocated (0) { } ~VSTMidiEventList() { freeEvents(); } //============================================================================== void clear() { numEventsUsed = 0; if (events != nullptr) events->numEvents = 0; } void addEvent (const void* const midiData, const int numBytes, const int frameOffset) { ensureSize (numEventsUsed + 1); VstMidiEvent* const e = (VstMidiEvent*) (events->events [numEventsUsed]); events->numEvents = ++numEventsUsed; if (numBytes <= 4) { if (e->type == kVstSysExType) { delete[] (((VstMidiSysexEvent*) e)->sysexDump); e->type = kVstMidiType; e->byteSize = sizeof (VstMidiEvent); e->noteLength = 0; e->noteOffset = 0; e->detune = 0; e->noteOffVelocity = 0; } e->deltaFrames = frameOffset; memcpy (e->midiData, midiData, (size_t) numBytes); } else { VstMidiSysexEvent* const se = (VstMidiSysexEvent*) e; if (se->type == kVstSysExType) delete[] se->sysexDump; se->sysexDump = new char [numBytes]; memcpy (se->sysexDump, midiData, (size_t) numBytes); se->type = kVstSysExType; se->byteSize = sizeof (VstMidiSysexEvent); se->deltaFrames = frameOffset; se->flags = 0; se->dumpBytes = numBytes; se->resvd1 = 0; se->resvd2 = 0; } } //============================================================================== // Handy method to pull the events out of an event buffer supplied by the host // or plugin. static void addEventsToMidiBuffer (const VstEvents* events, MidiBuffer& dest) { for (int i = 0; i < events->numEvents; ++i) { const VstEvent* const e = events->events[i]; if (e != nullptr) { if (e->type == kVstMidiType) { dest.addEvent ((const juce::uint8*) ((const VstMidiEvent*) e)->midiData, 4, e->deltaFrames); } else if (e->type == kVstSysExType) { dest.addEvent ((const juce::uint8*) ((const VstMidiSysexEvent*) e)->sysexDump, (int) ((const VstMidiSysexEvent*) e)->dumpBytes, e->deltaFrames); } } } } //============================================================================== void ensureSize (int numEventsNeeded) { if (numEventsNeeded > numEventsAllocated) { numEventsNeeded = (numEventsNeeded + 32) & ~31; const size_t size = 20 + sizeof (VstEvent*) * (size_t) numEventsNeeded; if (events == nullptr) events.calloc (size, 1); else events.realloc (size, 1); for (int i = numEventsAllocated; i < numEventsNeeded; ++i) events->events[i] = allocateVSTEvent(); numEventsAllocated = numEventsNeeded; } } void freeEvents() { if (events != nullptr) { for (int i = numEventsAllocated; --i >= 0;) freeVSTEvent (events->events[i]); events.free(); numEventsUsed = 0; numEventsAllocated = 0; } } //============================================================================== HeapBlock <VstEvents> events; private: int numEventsUsed, numEventsAllocated; static VstEvent* allocateVSTEvent() { VstEvent* const e = (VstEvent*) std::calloc (1, sizeof (VstMidiEvent) > sizeof (VstMidiSysexEvent) ? sizeof (VstMidiEvent) : sizeof (VstMidiSysexEvent)); e->type = kVstMidiType; e->byteSize = sizeof (VstMidiEvent); return e; } static void freeVSTEvent (VstEvent* e) { if (e->type == kVstSysExType) delete[] (((VstMidiSysexEvent*) e)->sysexDump); std::free (e); } }; #endif // JUCE_VSTMIDIEVENTLIST_H_INCLUDED #endif
#include <CoincidentalNameCollision.h> #include <A.h> #include <B.h> #include <C.h> #include <D.h> #include <E.h> #include <F.h> #include <G.h> #include <H.h> #include <I.h> void appBridgingHeaderLoaded(void);
/* * cocos2d for iPhone: http://www.cocos2d-iphone.org * * Copyright (c) 2008-2010 Ricardo Quesada * Copyright (c) 2009 Valentin Milea * * 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. * */ #import "CCAction.h" #import "Support/ccCArray.h" #import "Support/uthash.h" typedef struct _hashElement { struct ccArray *actions; id target; NSUInteger actionIndex; CCAction *currentAction; BOOL currentActionSalvaged; BOOL paused; UT_hash_handle hh; } tHashElement; /** CCActionManager is a singleton that manages all the actions. Normally you won't need to use this singleton directly. 99% of the cases you will use the CCNode interface, which uses this singleton. But there are some cases where you might need to use this singleton. Examples: - When you want to run an action where the target is different from a CCNode. - When you want to pause / resume the actions @since v0.8 */ @interface CCActionManager : NSObject { tHashElement *targets; tHashElement *currentTarget; BOOL currentTargetSalvaged; } /** returns a shared instance of the CCActionManager */ + (CCActionManager *)sharedManager; /** purges the shared action manager. It releases the retained instance. @since v0.99.0 */ +(void)purgeSharedManager; // actions /** Adds an action with a target. If the target is already present, then the action will be added to the existing target. If the target is not present, a new instance of this target will be created either paused or paused, and the action will be added to the newly created target. When the target is paused, the queued actions won't be 'ticked'. */ -(void) addAction: (CCAction*) action target:(id)target paused:(BOOL)paused; /** Removes all actions from all the targers. */ -(void) removeAllActions; /** Removes all actions from a certain target. All the actions that belongs to the target will be removed. */ -(void) removeAllActionsFromTarget:(id)target; /** Removes an action given an action reference. */ -(void) removeAction: (CCAction*) action; /** Removes an action given its tag and the target */ -(void) removeActionByTag:(NSInteger)tag target:(id)target; /** Gets an action given its tag an a target @return the Action the with the given tag */ -(CCAction*) getActionByTag:(NSInteger) tag target:(id)target; /** Returns the numbers of actions that are running in a certain target * Composable actions are counted as 1 action. Example: * If you are running 1 Sequence of 7 actions, it will return 1. * If you are running 7 Sequences of 2 actions, it will return 7. */ -(NSUInteger) numberOfRunningActionsInTarget:(id)target; /** Pauses the target: all running actions and newly added actions will be paused. */ -(void) pauseTarget:(id)target; /** Resumes the target. All queued actions will be resumed. */ -(void) resumeTarget:(id)target; @end
/* Copyright (C) 1992, 1996, 1997, 2001 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 Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #include <errno.h> #include <stddef.h> /* For NULL. */ #include <sys/time.h> #include <time.h> /* Set the system clock to *WHEN. */ int stime (when) const time_t *when; { struct timeval tv; if (when == NULL) { __set_errno (EINVAL); return -1; } tv.tv_sec = *when; tv.tv_usec = 0; return __settimeofday (&tv, (struct timezone *) 0); }
/* * Copyright (C) 2005-2020 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #pragma once #include <cstddef> #include <cstdint> #include <memory> #include <vector> #include <xf86drmMode.h> namespace KODI { namespace WINDOWING { namespace GBM { class CDRMObject { public: CDRMObject(const CDRMObject&) = delete; CDRMObject& operator=(const CDRMObject&) = delete; virtual ~CDRMObject() = default; std::string GetTypeName() const; std::string GetPropertyName(uint32_t propertyId) const; uint32_t GetId() const { return m_id; } uint32_t GetPropertyId(const std::string& name) const; std::tuple<bool, uint64_t> GetPropertyValue(const std::string& name, const std::string& valueName) const; bool SetProperty(const std::string& name, uint64_t value); bool SupportsProperty(const std::string& name); protected: explicit CDRMObject(int fd); bool GetProperties(uint32_t id, uint32_t type); struct DrmModeObjectPropertiesDeleter { void operator()(drmModeObjectProperties* p) { drmModeFreeObjectProperties(p); } }; std::unique_ptr<drmModeObjectProperties, DrmModeObjectPropertiesDeleter> m_props; struct DrmModePropertyResDeleter { void operator()(drmModePropertyRes* p) { drmModeFreeProperty(p); } }; std::vector<std::unique_ptr<drmModePropertyRes, DrmModePropertyResDeleter>> m_propsInfo; int m_fd{-1}; private: uint32_t m_id{0}; uint32_t m_type{0}; }; } // namespace GBM } // namespace WINDOWING } // namespace KODI
/*********************************************************************** filename: CEGUIWidgetModule.h created: Sun Sep 25 2005 author: Paul D Turner <paul@cegui.org.uk> *************************************************************************/ /*************************************************************************** * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. ***************************************************************************/ #ifndef _CEGUIWidgetModule_h_ #define _CEGUIWidgetModule_h_ #include "CEGUIExceptions.h" #include "CEGUIWindowFactoryManager.h" #if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC) # ifdef CEGUIWIDGETMODULE_EXPORTS # define CEGUIWIDGETMODULE_API __declspec(dllexport) # else # define CEGUIWIDGETMODULE_API __declspec(dllimport) # endif #else # define CEGUIWIDGETMODULE_API #endif #define CEGUI_DECLARE_WIDGET_MODULE( moduleName )\ \ class CEGUI::WindowFactory;\ \ extern "C" CEGUIWIDGETMODULE_API void registerFactory(const CEGUI::String& type_name);\ extern "C" CEGUIWIDGETMODULE_API CEGUI::uint registerAllFactories(void);\ void doSafeFactoryRegistration(CEGUI::WindowFactory* factory); #define CEGUI_DEFINE_FACTORY( className )\ namespace CEGUI {\ class className ## Factory : public WindowFactory\ {\ public:\ className ## Factory(void) : WindowFactory(className::WidgetTypeName) { }\ Window* createWindow(const String& name)\ { return new className(d_type, name); }\ void destroyWindow(Window* window)\ { delete window; }\ };\ }\ static CEGUI::className ## Factory s_ ## className ## Factory; #define CEGUI_START_FACTORY_MAP( module )\ struct module ## MapEntry\ {\ const CEGUI::utf8* d_name;\ CEGUI::WindowFactory* d_factory;\ };\ \ module ## MapEntry module ## FactoriesMap[] =\ {\ #define CEGUI_END_FACTORY_MAP {0,0}}; #define CEGUI_FACTORY_MAP_ENTRY( class )\ {CEGUI::class::WidgetTypeName, &s_ ## class ## Factory}, #define CEGUI_DEFINE_WIDGET_MODULE( module )\ extern "C" void registerFactory(const CEGUI::String& type_name)\ {\ module ## MapEntry* entry = module ## FactoriesMap;\ while (entry->d_name)\ {\ if (entry->d_name == type_name)\ {\ doSafeFactoryRegistration(entry->d_factory);\ return;\ }\ ++entry;\ }\ \ CEGUI_THROW(CEGUI::UnknownObjectException("::registerFactory - The window factory for type '" + type_name + "' is not known in this module."));\ }\ \ extern "C" CEGUI::uint registerAllFactories(void)\ {\ CEGUI::uint count = 0;\ module ## MapEntry* entry = module ## FactoriesMap;\ while (entry->d_name)\ {\ doSafeFactoryRegistration(entry->d_factory);\ ++entry;\ ++count;\ }\ return count;\ }\ \ void doSafeFactoryRegistration(CEGUI::WindowFactory* factory)\ {\ assert(factory != 0);\ \ CEGUI::WindowFactoryManager& wfm = CEGUI::WindowFactoryManager::getSingleton();\ if (wfm.isFactoryPresent(factory->getTypeName()))\ {\ CEGUI::Logger::getSingleton().logEvent(\ "Widget factory '" + factory->getTypeName() + "' appears to be already registered, skipping.",\ CEGUI::Informative);\ }\ else\ {\ wfm.addFactory(factory);\ }\ } #endif // end of guard _CEGUIWidgetModule_h_
/* ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio 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. */ #ifndef _TESTQUEUES_H_ #define _TESTQUEUES_H_ extern ROMCONST struct testcase * ROMCONST patternqueues[]; #endif /* _TESTQUEUES_H_ */
/* * driver.h: core driver methods for managing qemu guests * * Copyright (C) 2006, 2007 Red Hat, Inc. * Copyright (C) 2006 Daniel P. Berrange * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * <http://www.gnu.org/licenses/>. * * Author: Daniel P. Berrange <berrange@redhat.com> */ #ifndef __QEMU_DRIVER_H__ # define __QEMU_DRIVER_H__ int qemuRegister(void); #endif /* __QEMU_DRIVER_H__ */
/* Copyright (c) 2015, Apple Inc. All rights reserved. Copyright (c) 2015, James Cox. Copyright (c) 2015, Ricardo Sánchez-Sáez. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder(s) nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. No license is granted to the trademarks of the copyright holders even if such marks are included in this software. 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. */ #import <UIKit/UIKit.h> @class ORKPieChartView; @interface ORKPieChartLegendView : UICollectionView <UICollectionViewDataSource, UICollectionViewDelegateFlowLayout> @property (nonatomic) UIFont *labelFont; - (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)collectionViewLayout NS_UNAVAILABLE; - (instancetype)initWithParentPieChartView:(ORKPieChartView *)parentPieChartView NS_DESIGNATED_INITIALIZER; - (void)animateWithDuration:(NSTimeInterval)animationDuration; @end
// 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 DEVICE_TEST_USB_TEST_GADGET_H_ #define DEVICE_TEST_USB_TEST_GADGET_H_ #include <string> #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" namespace base { class SingleThreadTaskRunner; } namespace device { class UsbDevice; class UsbTestGadget { public: enum Type { DEFAULT = 0, KEYBOARD, MOUSE, HID_ECHO, ECHO, }; virtual ~UsbTestGadget() {} static bool IsTestEnabled(); static scoped_ptr<UsbTestGadget> Claim( scoped_refptr<base::SingleThreadTaskRunner> io_task_runner); virtual bool Unclaim() = 0; virtual bool Disconnect() = 0; virtual bool Reconnect() = 0; virtual bool SetType(Type type) = 0; virtual UsbDevice* GetDevice() const = 0; protected: UsbTestGadget() {} private: DISALLOW_COPY_AND_ASSIGN(UsbTestGadget); }; } // namespace device #endif // DEVICE_TEST_USB_TEST_GADGET_H_
/* Broadcom B43 wireless driver RFKILL support Copyright (c) 2007 Michael Buesch <mb@bu3sch.de> 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; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "rfkill.h" #include "b43.h" #include <linux/kmod.h> /* Returns TRUE, if the radio is enabled in hardware. */ static bool b43_is_hw_radio_enabled(struct b43_wldev *dev) { if (dev->phy.rev >= 3) { if (!(b43_read32(dev, B43_MMIO_RADIO_HWENABLED_HI) & B43_MMIO_RADIO_HWENABLED_HI_MASK)) return 1; } else { if (b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO) & B43_MMIO_RADIO_HWENABLED_LO_MASK) return 1; } return 0; } /* The poll callback for the hardware button. */ static void b43_rfkill_poll(struct input_polled_dev *poll_dev) { struct b43_wldev *dev = poll_dev->private; struct b43_wl *wl = dev->wl; bool enabled; bool report_change = 0; mutex_lock(&wl->mutex); if (unlikely(b43_status(dev) < B43_STAT_INITIALIZED)) { mutex_unlock(&wl->mutex); return; } enabled = b43_is_hw_radio_enabled(dev); if (unlikely(enabled != dev->radio_hw_enable)) { dev->radio_hw_enable = enabled; report_change = 1; b43info(wl, "Radio hardware status changed to %s\n", enabled ? "ENABLED" : "DISABLED"); } mutex_unlock(&wl->mutex); /* send the radio switch event to the system - note both a key press * and a release are required */ if (unlikely(report_change)) { input_report_key(poll_dev->input, KEY_WLAN, 1); input_report_key(poll_dev->input, KEY_WLAN, 0); } } /* Called when the RFKILL toggled in software. */ static int b43_rfkill_soft_toggle(void *data, enum rfkill_state state) { struct b43_wldev *dev = data; struct b43_wl *wl = dev->wl; int err = -EBUSY; if (!wl->rfkill.registered) return 0; mutex_lock(&wl->mutex); if (b43_status(dev) < B43_STAT_INITIALIZED) goto out_unlock; err = 0; switch (state) { case RFKILL_STATE_ON: if (!dev->radio_hw_enable) { /* No luck. We can't toggle the hardware RF-kill * button from software. */ err = -EBUSY; goto out_unlock; } if (!dev->phy.radio_on) b43_radio_turn_on(dev); break; case RFKILL_STATE_OFF: if (dev->phy.radio_on) b43_radio_turn_off(dev, 0); break; } out_unlock: mutex_unlock(&wl->mutex); return err; } char * b43_rfkill_led_name(struct b43_wldev *dev) { struct b43_rfkill *rfk = &(dev->wl->rfkill); if (!rfk->registered) return NULL; return rfkill_get_led_name(rfk->rfkill); } void b43_rfkill_init(struct b43_wldev *dev) { struct b43_wl *wl = dev->wl; struct b43_rfkill *rfk = &(wl->rfkill); int err; rfk->registered = 0; rfk->rfkill = rfkill_allocate(dev->dev->dev, RFKILL_TYPE_WLAN); if (!rfk->rfkill) goto out_error; snprintf(rfk->name, sizeof(rfk->name), "b43-%s", wiphy_name(wl->hw->wiphy)); rfk->rfkill->name = rfk->name; rfk->rfkill->state = RFKILL_STATE_ON; rfk->rfkill->data = dev; rfk->rfkill->toggle_radio = b43_rfkill_soft_toggle; rfk->rfkill->user_claim_unsupported = 1; rfk->poll_dev = input_allocate_polled_device(); if (!rfk->poll_dev) { rfkill_free(rfk->rfkill); goto err_freed_rfk; } rfk->poll_dev->private = dev; rfk->poll_dev->poll = b43_rfkill_poll; rfk->poll_dev->poll_interval = 1000; /* msecs */ rfk->poll_dev->input->name = rfk->name; rfk->poll_dev->input->id.bustype = BUS_HOST; rfk->poll_dev->input->id.vendor = dev->dev->bus->boardinfo.vendor; rfk->poll_dev->input->evbit[0] = BIT(EV_KEY); set_bit(KEY_WLAN, rfk->poll_dev->input->keybit); err = rfkill_register(rfk->rfkill); if (err) goto err_free_polldev; #ifdef CONFIG_RFKILL_INPUT_MODULE /* B43 RF-kill isn't useful without the rfkill-input subsystem. * Try to load the module. */ err = request_module("rfkill-input"); if (err) b43warn(wl, "Failed to load the rfkill-input module. " "The built-in radio LED will not work.\n"); #endif /* CONFIG_RFKILL_INPUT */ err = input_register_polled_device(rfk->poll_dev); if (err) goto err_unreg_rfk; rfk->registered = 1; return; err_unreg_rfk: rfkill_unregister(rfk->rfkill); err_free_polldev: input_free_polled_device(rfk->poll_dev); rfk->poll_dev = NULL; err_freed_rfk: rfk->rfkill = NULL; out_error: rfk->registered = 0; b43warn(wl, "RF-kill button init failed\n"); } void b43_rfkill_exit(struct b43_wldev *dev) { struct b43_rfkill *rfk = &(dev->wl->rfkill); if (!rfk->registered) return; rfk->registered = 0; input_unregister_polled_device(rfk->poll_dev); rfkill_unregister(rfk->rfkill); input_free_polled_device(rfk->poll_dev); rfk->poll_dev = NULL; rfk->rfkill = NULL; }
/* * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ #include "jni.h" #include "java_lang_ref_Finalizer.h" JNIEXPORT void JNICALL Java_java_lang_ref_Finalizer_invokeFinalizeMethod(JNIEnv *env, jclass clazz, jobject ob) { jclass cls; jmethodID mid; cls = (*env)->GetObjectClass(env, ob); if (cls == NULL) return; mid = (*env)->GetMethodID(env, cls, "finalize", "()V"); if (mid == NULL) return; (*env)->CallVoidMethod(env, ob, mid); }
// SPDX-License-Identifier: GPL-2.0+ /* * vimc-streamer.c Virtual Media Controller Driver * * Copyright (C) 2018 Lucas A. M. Magalhães <lucmaga@gmail.com> * */ #include <linux/init.h> #include <linux/freezer.h> #include <linux/kthread.h> #include "vimc-streamer.h" /** * vimc_get_source_entity - get the entity connected with the first sink pad * * @ent: reference media_entity * * Helper function that returns the media entity containing the source pad * linked with the first sink pad from the given media entity pad list. * * Return: The source pad or NULL, if it wasn't found. */ static struct media_entity *vimc_get_source_entity(struct media_entity *ent) { struct media_pad *pad; int i; for (i = 0; i < ent->num_pads; i++) { if (ent->pads[i].flags & MEDIA_PAD_FL_SOURCE) continue; pad = media_entity_remote_pad(&ent->pads[i]); return pad ? pad->entity : NULL; } return NULL; } /** * vimc_streamer_pipeline_terminate - Disable stream in all ved in stream * * @stream: the pointer to the stream structure with the pipeline to be * disabled. * * Calls s_stream to disable the stream in each entity of the pipeline * */ static void vimc_streamer_pipeline_terminate(struct vimc_stream *stream) { struct vimc_ent_device *ved; struct v4l2_subdev *sd; while (stream->pipe_size) { stream->pipe_size--; ved = stream->ved_pipeline[stream->pipe_size]; stream->ved_pipeline[stream->pipe_size] = NULL; if (!is_media_entity_v4l2_subdev(ved->ent)) continue; sd = media_entity_to_v4l2_subdev(ved->ent); v4l2_subdev_call(sd, video, s_stream, 0); } } /** * vimc_streamer_pipeline_init - Initializes the stream structure * * @stream: the pointer to the stream structure to be initialized * @ved: the pointer to the vimc entity initializing the stream * * Initializes the stream structure. Walks through the entity graph to * construct the pipeline used later on the streamer thread. * Calls vimc_streamer_s_stream() to enable stream in all entities of * the pipeline. * * Return: 0 if success, error code otherwise. */ static int vimc_streamer_pipeline_init(struct vimc_stream *stream, struct vimc_ent_device *ved) { struct media_entity *entity; struct video_device *vdev; struct v4l2_subdev *sd; int ret = 0; stream->pipe_size = 0; while (stream->pipe_size < VIMC_STREAMER_PIPELINE_MAX_SIZE) { if (!ved) { vimc_streamer_pipeline_terminate(stream); return -EINVAL; } stream->ved_pipeline[stream->pipe_size++] = ved; if (is_media_entity_v4l2_subdev(ved->ent)) { sd = media_entity_to_v4l2_subdev(ved->ent); ret = v4l2_subdev_call(sd, video, s_stream, 1); if (ret && ret != -ENOIOCTLCMD) { dev_err(ved->dev, "subdev_call error %s\n", ved->ent->name); vimc_streamer_pipeline_terminate(stream); return ret; } } entity = vimc_get_source_entity(ved->ent); /* Check if the end of the pipeline was reached */ if (!entity) { /* the first entity of the pipe should be source only */ if (!vimc_is_source(ved->ent)) { dev_err(ved->dev, "first entity in the pipe '%s' is not a source\n", ved->ent->name); vimc_streamer_pipeline_terminate(stream); return -EPIPE; } return 0; } /* Get the next device in the pipeline */ if (is_media_entity_v4l2_subdev(entity)) { sd = media_entity_to_v4l2_subdev(entity); ved = v4l2_get_subdevdata(sd); } else { vdev = container_of(entity, struct video_device, entity); ved = video_get_drvdata(vdev); } } vimc_streamer_pipeline_terminate(stream); return -EINVAL; } /** * vimc_streamer_thread - Process frames through the pipeline * * @data: vimc_stream struct of the current stream * * From the source to the sink, gets a frame from each subdevice and send to * the next one of the pipeline at a fixed framerate. * * Return: * Always zero (created as ``int`` instead of ``void`` to comply with * kthread API). */ static int vimc_streamer_thread(void *data) { struct vimc_stream *stream = data; u8 *frame = NULL; int i; set_freezable(); for (;;) { try_to_freeze(); if (kthread_should_stop()) break; for (i = stream->pipe_size - 1; i >= 0; i--) { frame = stream->ved_pipeline[i]->process_frame( stream->ved_pipeline[i], frame); if (!frame || IS_ERR(frame)) break; } //wait for 60hz set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(HZ / 60); } return 0; } /** * vimc_streamer_s_stream - Start/stop the streaming on the media pipeline * * @stream: the pointer to the stream structure of the current stream * @ved: pointer to the vimc entity of the entity of the stream * @enable: flag to determine if stream should start/stop * * When starting, check if there is no ``stream->kthread`` allocated. This * should indicate that a stream is already running. Then, it initializes the * pipeline, creates and runs a kthread to consume buffers through the pipeline. * When stopping, analogously check if there is a stream running, stop the * thread and terminates the pipeline. * * Return: 0 if success, error code otherwise. */ int vimc_streamer_s_stream(struct vimc_stream *stream, struct vimc_ent_device *ved, int enable) { int ret; if (!stream || !ved) return -EINVAL; if (enable) { if (stream->kthread) return 0; ret = vimc_streamer_pipeline_init(stream, ved); if (ret) return ret; stream->kthread = kthread_run(vimc_streamer_thread, stream, "vimc-streamer thread"); if (IS_ERR(stream->kthread)) return PTR_ERR(stream->kthread); } else { if (!stream->kthread) return 0; ret = kthread_stop(stream->kthread); if (ret) return ret; stream->kthread = NULL; vimc_streamer_pipeline_terminate(stream); } return 0; }
// Copyright 2014 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_COMPILER_VALUE_NUMBERING_REDUCER_H_ #define V8_COMPILER_VALUE_NUMBERING_REDUCER_H_ #include "src/compiler/graph-reducer.h" namespace v8 { namespace internal { namespace compiler { class ValueNumberingReducer final : public Reducer { public: explicit ValueNumberingReducer(Zone* zone); ~ValueNumberingReducer(); Reduction Reduce(Node* node) override; private: enum { kInitialCapacity = 256u, kCapacityToSizeRatio = 2u }; void Grow(); Zone* zone() const { return zone_; } Node** entries_; size_t capacity_; size_t size_; Zone* zone_; }; } // namespace compiler } // namespace internal } // namespace v8 #endif // V8_COMPILER_VALUE_NUMBERING_REDUCER_H_
#ifndef CEPH_MSGR_H #define CEPH_MSGR_H /* * Data types for message passing layer used by Ceph. */ #define CEPH_MON_PORT 6789 /* default monitor port */ /* * client-side processes will try to bind to ports in this * range, simply for the benefit of tools like nmap or wireshark * that would like to identify the protocol. */ #define CEPH_PORT_FIRST 6789 #define CEPH_PORT_START 6800 /* non-monitors start here */ #define CEPH_PORT_LAST 6900 /* * tcp connection banner. include a protocol version. and adjust * whenever the wire protocol changes. try to keep this string length * constant. */ #define CEPH_BANNER "ceph v027" #define CEPH_BANNER_MAX_LEN 30 /* * Rollover-safe type and comparator for 32-bit sequence numbers. * Comparator returns -1, 0, or 1. */ typedef __u32 ceph_seq_t; static inline __s32 ceph_seq_cmp(__u32 a, __u32 b) { return (__s32)a - (__s32)b; } /* * entity_name -- logical name for a process participating in the * network, e.g. 'mds0' or 'osd3'. */ struct ceph_entity_name { __u8 type; /* CEPH_ENTITY_TYPE_* */ __le64 num; } __attribute__ ((packed)); #define CEPH_ENTITY_TYPE_MON 0x01 #define CEPH_ENTITY_TYPE_MDS 0x02 #define CEPH_ENTITY_TYPE_OSD 0x04 #define CEPH_ENTITY_TYPE_CLIENT 0x08 #define CEPH_ENTITY_TYPE_AUTH 0x20 #define CEPH_ENTITY_TYPE_ANY 0xFF extern const char *ceph_entity_type_name(int type); /* * entity_addr -- network address */ struct ceph_entity_addr { __le32 type; __le32 nonce; /* unique id for process (e.g. pid) */ struct sockaddr_storage in_addr; } __attribute__ ((packed)); struct ceph_entity_inst { struct ceph_entity_name name; struct ceph_entity_addr addr; } __attribute__ ((packed)); /* used by message exchange protocol */ #define CEPH_MSGR_TAG_READY 1 /* server->client: ready for messages */ #define CEPH_MSGR_TAG_RESETSESSION 2 /* server->client: reset, try again */ #define CEPH_MSGR_TAG_WAIT 3 /* server->client: wait for racing incoming connection */ #define CEPH_MSGR_TAG_RETRY_SESSION 4 /* server->client + cseq: try again with higher cseq */ #define CEPH_MSGR_TAG_RETRY_GLOBAL 5 /* server->client + gseq: try again with higher gseq */ #define CEPH_MSGR_TAG_CLOSE 6 /* closing pipe */ #define CEPH_MSGR_TAG_MSG 7 /* message */ #define CEPH_MSGR_TAG_ACK 8 /* message ack */ #define CEPH_MSGR_TAG_KEEPALIVE 9 /* just a keepalive byte! */ #define CEPH_MSGR_TAG_BADPROTOVER 10 /* bad protocol version */ #define CEPH_MSGR_TAG_BADAUTHORIZER 11 /* bad authorizer */ #define CEPH_MSGR_TAG_FEATURES 12 /* insufficient features */ #define CEPH_MSGR_TAG_SEQ 13 /* 64-bit int follows with seen seq number */ /* * connection negotiation */ struct ceph_msg_connect { __le64 features; /* supported feature bits */ __le32 host_type; /* CEPH_ENTITY_TYPE_* */ __le32 global_seq; /* count connections initiated by this host */ __le32 connect_seq; /* count connections initiated in this session */ __le32 protocol_version; __le32 authorizer_protocol; __le32 authorizer_len; __u8 flags; /* CEPH_MSG_CONNECT_* */ } __attribute__ ((packed)); struct ceph_msg_connect_reply { __u8 tag; __le64 features; /* feature bits for this session */ __le32 global_seq; __le32 connect_seq; __le32 protocol_version; __le32 authorizer_len; __u8 flags; } __attribute__ ((packed)); #define CEPH_MSG_CONNECT_LOSSY 1 /* messages i send may be safely dropped */ /* * message header */ struct ceph_msg_header_old { __le64 seq; /* message seq# for this session */ __le64 tid; /* transaction id */ __le16 type; /* message type */ __le16 priority; /* priority. higher value == higher priority */ __le16 version; /* version of message encoding */ __le32 front_len; /* bytes in main payload */ __le32 middle_len;/* bytes in middle payload */ __le32 data_len; /* bytes of data payload */ __le16 data_off; /* sender: include full offset; receiver: mask against ~PAGE_MASK */ struct ceph_entity_inst src, orig_src; __le32 reserved; __le32 crc; /* header crc32c */ } __attribute__ ((packed)); struct ceph_msg_header { __le64 seq; /* message seq# for this session */ __le64 tid; /* transaction id */ __le16 type; /* message type */ __le16 priority; /* priority. higher value == higher priority */ __le16 version; /* version of message encoding */ __le32 front_len; /* bytes in main payload */ __le32 middle_len;/* bytes in middle payload */ __le32 data_len; /* bytes of data payload */ __le16 data_off; /* sender: include full offset; receiver: mask against ~PAGE_MASK */ struct ceph_entity_name src; __le32 reserved; __le32 crc; /* header crc32c */ } __attribute__ ((packed)); #define CEPH_MSG_PRIO_LOW 64 #define CEPH_MSG_PRIO_DEFAULT 127 #define CEPH_MSG_PRIO_HIGH 196 #define CEPH_MSG_PRIO_HIGHEST 255 /* * follows data payload */ struct ceph_msg_footer { __le32 front_crc, middle_crc, data_crc; __u8 flags; } __attribute__ ((packed)); #define CEPH_MSG_FOOTER_COMPLETE (1<<0) /* msg wasn't aborted */ #define CEPH_MSG_FOOTER_NOCRC (1<<1) /* no data crc */ #endif
/* Generated automatically. DO NOT EDIT! */ #define SIMD_HEADER "simd-avx.h" #include "../common/n2bv_8.c"
// // PNChannelsForGroupResponseParser_Protected.h // pubnub // // Created by Sergey Mamontov on 10/10/14. // Copyright (c) 2014 PubNub Inc. All rights reserved. // #import "PNChannelsForGroupResponseParser.h" #pragma mark Static /** @brief Reference on key under which list of channel group channels is stored @since 3.7.0 */ static NSString * const kPNResponseChanelsKey = @"channels"; #pragma mark - Private interface declaration @interface PNChannelsForGroupResponseParser () #pragma mark - Properties @property (nonatomic, strong) NSArray *channels; #pragma mark - @end
#ifndef MAILCORE_MCRFC822_H #define MAILCORE_MCRFC822_H #include <MailCore/MCAttachment.h> #include <MailCore/MCMessageBuilder.h> #include <MailCore/MCMessageParser.h> #include <MailCore/MCMessagePart.h> #include <MailCore/MCMultipart.h> #endif
// // ______ ______ ______ // /\ __ \ /\ ___\ /\ ___\ // \ \ __< \ \ __\_ \ \ __\_ // \ \_____\ \ \_____\ \ \_____\ // \/_____/ \/_____/ \/_____/ // // // Copyright (c) 2014-2015, Geek Zoo Studio // http://www.bee-framework.com // // // 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. // #if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR) #import "Bee_Precompile.h" #import "Bee_Foundation.h" #pragma mark - @interface UIView(Wireframe) @property (nonatomic, retain) NSString * hintString; @property (nonatomic, retain) UIColor * hintColor; @property (nonatomic, readonly) UILabel * hintLabel; @property (nonatomic, assign) BOOL hintEnabled; - (void)hintAllSubviews; - (void)unhintAllSubviews; @end #endif // #if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
/* * Copyright (C) 2006 Michael Brown <mbrown@fensystems.co.uk>. * * 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 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. */ FILE_LICENCE ( GPL2_OR_LATER ); #include <stdint.h> #include <stdlib.h> #include <stdio.h> #include <readline/readline.h> #include <gpxe/command.h> #include <gpxe/shell.h> /** @file * * Minimal command shell * */ /** The shell prompt string */ static const char shell_prompt[] = "gPXE> "; /** Flag set in order to exit shell */ static int exit_flag = 0; /** "exit" command body */ static int exit_exec ( int argc, char **argv __unused ) { if ( argc == 1 ) { exit_flag = 1; } else { printf ( "Usage: exit\n" "Exits the command shell\n" ); } return 0; } /** "exit" command definition */ struct command exit_command __command = { .name = "exit", .exec = exit_exec, }; /** "help" command body */ static int help_exec ( int argc __unused, char **argv __unused ) { struct command *command; unsigned int hpos = 0; printf ( "\nAvailable commands:\n\n" ); for_each_table_entry ( command, COMMANDS ) { hpos += printf ( " %s", command->name ); if ( hpos > ( 16 * 4 ) ) { printf ( "\n" ); hpos = 0; } else { while ( hpos % 16 ) { printf ( " " ); hpos++; } } } printf ( "\n\nType \"<command> --help\" for further information\n\n" ); return 0; } /** "help" command definition */ struct command help_command __command = { .name = "help", .exec = help_exec, }; /** * Start command shell * */ void shell ( void ) { char *line; exit_flag = 0; while ( ! exit_flag ) { line = readline ( shell_prompt ); if ( line ) { system ( line ); free ( line ); } } }
/* 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 CEGUI_PANEL_H #define CEGUI_PANEL_H #include "common/scummsys.h" #include "common/system.h" #include "common/hashmap.h" #include "common/str.h" #include "common/config-manager.h" #include "PanelItem.h" #include "Toolbar.h" using Common::String; using Common::HashMap; namespace CEGUI { class Panel : public Toolbar { public: Panel(int interleave_first, int interleave); virtual bool draw(SDL_Surface *surface); virtual ~Panel(); bool add(const String &name, const PanelItem *item); void clear(); virtual void forceRedraw(); virtual bool action(int x, int y, bool pushed); private: typedef HashMap<String, PanelItem *, Common::IgnoreCase_Hash , Common::IgnoreCase_EqualTo> ItemMap; ItemMap _itemsMap; int _interleave; int _currentItem; }; } // End of namespace CEGUI #endif
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef UI_VIEWS_CONTROLS_SCROLLBAR_OVERLAY_SCROLL_BAR_H_ #define UI_VIEWS_CONTROLS_SCROLLBAR_OVERLAY_SCROLL_BAR_H_ #include "ui/gfx/animation/slide_animation.h" #include "ui/views/controls/scrollbar/base_scroll_bar.h" namespace views { // The transparent scrollbar which overlays its contents. class VIEWS_EXPORT OverlayScrollBar : public BaseScrollBar { public: explicit OverlayScrollBar(bool horizontal); ~OverlayScrollBar() override; protected: // BaseScrollBar overrides: gfx::Rect GetTrackBounds() const override; void OnGestureEvent(ui::GestureEvent* event) override; // ScrollBar overrides: int GetLayoutSize() const override; int GetContentOverlapSize() const override; void OnMouseEnteredScrollView(const ui::MouseEvent& event) override; void OnMouseExitedScrollView(const ui::MouseEvent& event) override; // View overrides: gfx::Size GetPreferredSize() const override; void Layout() override; void OnPaint(gfx::Canvas* canvas) override; private: gfx::SlideAnimation animation_; DISALLOW_COPY_AND_ASSIGN(OverlayScrollBar); }; } // namespace views #endif // UI_VIEWS_CONTROLS_SCROLLBAR_OVERLAY_SCROLL_BAR_H_
/* Definitions of target machine for GCC, for SPARC running Solaris 2 using the GNU linker. */ /* Undefine this so that attribute((init_priority)) works. */ #undef CTORS_SECTION_ASM_OP #undef DTORS_SECTION_ASM_OP #undef SUPPORTS_INIT_PRIORITY #define SUPPORTS_INIT_PRIORITY 1
/* * MTD device concatenation layer definitions * * Copyright © 2002 Robert Kaiser <rkaiser@sysgo.de> * * 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 St, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef MTD_CONCAT_H #define MTD_CONCAT_H struct mtd_info *mtd_concat_create( struct mtd_info *subdev[], int num_devs, const char *name); void mtd_concat_destroy(struct mtd_info *mtd); #endif
/* OreoLED I2C driver This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #if CONFIG_HAL_BOARD == HAL_BOARD_PX4 #include <AP_HAL/AP_HAL.h> #include "NotifyDevice.h" #include <drivers/drv_oreoled.h> #define OREOLED_NUM_LEDS 4 // maximum number of individual LEDs connected to the oreo led cpu #define OREOLED_INSTANCE_ALL 0xff // instance number to indicate all LEDs (used for set_rgb and set_macro) #define OREOLED_BRIGHT 0xff // maximum brightness when flying (disconnected from usb) #define CUSTOM_HEADER_LENGTH 4 // number of bytes in the custom LED buffer that are used to identify the command class OreoLED_PX4 : public NotifyDevice { public: // constuctor OreoLED_PX4(uint8_t theme); // init - initialised the device bool init(void); // update - updates device according to timed_updated. Should be // called at 50Hz void update(); // healthy - return true if at least one LED is responding bool healthy() const { return _overall_health; } // handle a LED_CONTROL message, by default device ignore message void handle_led_control(mavlink_message_t *msg); private: // update_timer - called by scheduler and updates PX4 driver with commands void update_timer(void); // set_rgb - set color as a combination of red, green and blue values for one or all LEDs, pattern defaults to solid color void set_rgb(uint8_t instance, uint8_t red, uint8_t green, uint8_t blue); // set_rgb - set color as a combination of red, green and blue values for one or all LEDs, using the specified pattern void set_rgb(uint8_t instance, enum oreoled_pattern pattern, uint8_t red, uint8_t green, uint8_t blue); // set_rgb - set color as a combination of red, green and blue values for one or all LEDs, using the specified pattern and other parameters void set_rgb(uint8_t instance, oreoled_pattern pattern, uint8_t red, uint8_t green, uint8_t blue, uint8_t amplitude_red, uint8_t amplitude_green, uint8_t amplitude_blue, uint16_t period, uint16_t phase_offset); // set_macro - set macro for one or all LEDs void set_macro(uint8_t instance, enum oreoled_macro macro); // send_sync - force a syncronisation of the all LED's void send_sync(); // functions to set LEDs to specific patterns. These functions return true if no further updates should be made to LEDs this iteration bool slow_counter(void); void sync_counter(void); bool mode_firmware_update(void); bool mode_init(void); bool mode_failsafe_radio(void); bool set_standard_colors(void); bool mode_failsafe_batt(void); bool mode_auto_flight(void); bool mode_pilot_flight(void); // Clear the desired state void clear_state(void); // oreo led modes (pattern, macro or rgb) enum oreoled_mode { OREOLED_MODE_NONE, OREOLED_MODE_MACRO, OREOLED_MODE_RGB, OREOLED_MODE_RGB_EXTENDED, OREOLED_MODE_SYNC }; // Oreo LED modes enum Oreo_LED_Theme { OreoLED_Disabled = 0, OreoLED_Aircraft = 1, OreoLED_Automobile = 2, }; // oreo_state structure holds possible state of an led struct oreo_state { enum oreoled_mode mode; enum oreoled_pattern pattern; enum oreoled_macro macro; uint8_t red; uint8_t green; uint8_t blue; uint8_t amplitude_red; uint8_t amplitude_green; uint8_t amplitude_blue; uint16_t period; int8_t repeat; uint16_t phase_offset; oreo_state(); void clear_state(); void send_sync(); void set_macro(oreoled_macro new_macro); void set_rgb(enum oreoled_pattern new_pattern, uint8_t new_red, uint8_t new_green, uint8_t new_blue); void set_rgb(enum oreoled_pattern new_pattern, uint8_t new_red, uint8_t new_green, uint8_t new_blue, uint8_t new_amplitude_red, uint8_t new_amplitude_green, uint8_t new_amplitude_blue, uint16_t new_period, uint16_t new_phase_offset); bool operator==(const oreo_state &os); }; // private members bool _overall_health; // overall health int _oreoled_fd; // file descriptor bool _send_required; // true when we need to send an update to at least one led volatile bool _state_desired_semaphore; // true when we are updating the state desired values to ensure they are not sent prematurely oreo_state _state_desired[OREOLED_NUM_LEDS]; // desired state oreo_state _state_sent[OREOLED_NUM_LEDS]; // last state sent to led uint8_t _pattern_override; // holds last processed pattern override, 0 if we are not overriding a pattern uint8_t _oreo_theme; // theme (1=AirCraft, 2=Ground Vehicle) uint8_t _rear_color_r = 255; // the rear LED red value uint8_t _rear_color_g = 255; // the rear LED green value uint8_t _rear_color_b = 255; // the rear LED blue value }; #endif // CONFIG_HAL_BOARD == HAL_BOARD_PX4
// SPDX-License-Identifier: GPL-2.0 /* * fs/partitions/sgi.c * * Code extracted from drivers/block/genhd.c */ #include "check.h" #define SGI_LABEL_MAGIC 0x0be5a941 enum { LINUX_RAID_PARTITION = 0xfd, /* autodetect RAID partition */ }; struct sgi_disklabel { __be32 magic_mushroom; /* Big fat spliff... */ __be16 root_part_num; /* Root partition number */ __be16 swap_part_num; /* Swap partition number */ s8 boot_file[16]; /* Name of boot file for ARCS */ u8 _unused0[48]; /* Device parameter useless crapola.. */ struct sgi_volume { s8 name[8]; /* Name of volume */ __be32 block_num; /* Logical block number */ __be32 num_bytes; /* How big, in bytes */ } volume[15]; struct sgi_partition { __be32 num_blocks; /* Size in logical blocks */ __be32 first_block; /* First logical block */ __be32 type; /* Type of this partition */ } partitions[16]; __be32 csum; /* Disk label checksum */ __be32 _unused1; /* Padding */ }; int sgi_partition(struct parsed_partitions *state) { int i, csum; __be32 magic; int slot = 1; unsigned int start, blocks; __be32 *ui, cs; Sector sect; struct sgi_disklabel *label; struct sgi_partition *p; label = read_part_sector(state, 0, &sect); if (!label) return -1; p = &label->partitions[0]; magic = label->magic_mushroom; if(be32_to_cpu(magic) != SGI_LABEL_MAGIC) { /*printk("Dev %s SGI disklabel: bad magic %08x\n", state->disk->disk_name, be32_to_cpu(magic));*/ put_dev_sector(sect); return 0; } ui = ((__be32 *) (label + 1)) - 1; for(csum = 0; ui >= ((__be32 *) label);) { cs = *ui--; csum += be32_to_cpu(cs); } if(csum) { printk(KERN_WARNING "Dev %s SGI disklabel: csum bad, label corrupted\n", state->disk->disk_name); put_dev_sector(sect); return 0; } /* All SGI disk labels have 16 partitions, disks under Linux only * have 15 minor's. Luckily there are always a few zero length * partitions which we don't care about so we never overflow the * current_minor. */ for(i = 0; i < 16; i++, p++) { blocks = be32_to_cpu(p->num_blocks); start = be32_to_cpu(p->first_block); if (blocks) { put_partition(state, slot, start, blocks); if (be32_to_cpu(p->type) == LINUX_RAID_PARTITION) state->parts[slot].flags = ADDPART_FLAG_RAID; } slot++; } strlcat(state->pp_buf, "\n", PAGE_SIZE); put_dev_sector(sect); return 1; }
/* Copyright (C) 2012-2014 Free Software Foundation, Inc. Contributed by Richard Henderson <rth@redhat.com>. This file is part of the GNU Transactional Memory Library (libitm). Libitm is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. Libitm 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. Under Section 7 of GPL version 3, you are granted additional permissions described in the GCC Runtime Library Exception, version 3.1, as published by the Free Software Foundation. You should have received a copy of the GNU General Public License and a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ #include <sys/syscall.h> static inline long sys_futex0 (std::atomic<int> *addr, int op, int val) { register long int r0 __asm__ ("r0"); register long int r3 __asm__ ("r3"); register long int r4 __asm__ ("r4"); register long int r5 __asm__ ("r5"); register long int r6 __asm__ ("r6"); r0 = SYS_futex; r3 = (long) addr; r4 = op; r5 = val; r6 = 0; /* ??? The powerpc64 sysdep.h file clobbers ctr; the powerpc32 sysdep.h doesn't. It doesn't much matter for us. In the interest of unity, go ahead and clobber it always. */ __asm volatile ("sc; mfcr %0" : "=r"(r0), "=r"(r3), "=r"(r4), "=r"(r5), "=r"(r6) : "r"(r0), "r"(r3), "r"(r4), "r"(r5), "r"(r6) : "r7", "r8", "r9", "r10", "r11", "r12", "cr0", "ctr", "memory"); if (__builtin_expect (r0 & (1 << 28), 0)) return r3; return 0; }
/******************************************************************* * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters. * * Copyright (C) 2017-2020 Broadcom. All Rights Reserved. The term * * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * * Copyright (C) 2004-2016 Emulex. All rights reserved. * * EMULEX and SLI are trademarks of Emulex. * * www.broadcom.com * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of version 2 of the GNU General * * Public License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful. * * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND * * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, * * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE * * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD * * TO BE LEGALLY INVALID. See the GNU General Public License for * * more details, a copy of which can be found in the file COPYING * * included with this package. * *******************************************************************/ #define LPFC_DRIVER_VERSION "12.8.0.1" #define LPFC_DRIVER_NAME "lpfc" /* Used for SLI 2/3 */ #define LPFC_SP_DRIVER_HANDLER_NAME "lpfc:sp" #define LPFC_FP_DRIVER_HANDLER_NAME "lpfc:fp" /* Used for SLI4 */ #define LPFC_DRIVER_HANDLER_NAME "lpfc:" #define LPFC_MODULE_DESC "Emulex LightPulse Fibre Channel SCSI driver " \ LPFC_DRIVER_VERSION #define LPFC_COPYRIGHT "Copyright (C) 2017-2019 Broadcom. All Rights " \ "Reserved. The term \"Broadcom\" refers to Broadcom Inc. " \ "and/or its subsidiaries."
/* * Copyright 2006 Michael Ellerman, IBM Corporation * * 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 <asm/machdep.h> #include <asm/page.h> #include <asm/firmware.h> #include <asm/kexec.h> #include <asm/mpic.h> #include <asm/smp.h> #include "pseries.h" #include "xics.h" #include "plpar_wrappers.h" static void pseries_kexec_cpu_down(int crash_shutdown, int secondary) { /* Don't risk a hypervisor call if we're crashing */ if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) { unsigned long addr; int ret; if (get_lppaca()->dtl_enable_mask) { ret = unregister_dtl(hard_smp_processor_id()); if (ret) { pr_err("WARNING: DTL deregistration for cpu " "%d (hw %d) failed with %d\n", smp_processor_id(), hard_smp_processor_id(), ret); } } addr = __pa(get_slb_shadow()); if (unregister_slb_shadow(hard_smp_processor_id(), addr)) printk("SLB shadow buffer deregistration of " "cpu %u (hw_cpu_id %d) failed\n", smp_processor_id(), hard_smp_processor_id()); addr = __pa(get_lppaca()); if (unregister_vpa(hard_smp_processor_id(), addr)) { printk("VPA deregistration of cpu %u (hw_cpu_id %d) " "failed\n", smp_processor_id(), hard_smp_processor_id()); } } } static void pseries_kexec_cpu_down_mpic(int crash_shutdown, int secondary) { pseries_kexec_cpu_down(crash_shutdown, secondary); mpic_teardown_this_cpu(secondary); } void __init setup_kexec_cpu_down_mpic(void) { ppc_md.kexec_cpu_down = pseries_kexec_cpu_down_mpic; } static void pseries_kexec_cpu_down_xics(int crash_shutdown, int secondary) { pseries_kexec_cpu_down(crash_shutdown, secondary); xics_kexec_teardown_cpu(secondary); } void __init setup_kexec_cpu_down_xics(void) { ppc_md.kexec_cpu_down = pseries_kexec_cpu_down_xics; } static int __init pseries_kexec_setup(void) { ppc_md.machine_kexec = default_machine_kexec; ppc_md.machine_kexec_prepare = default_machine_kexec_prepare; ppc_md.machine_crash_shutdown = default_machine_crash_shutdown; return 0; } machine_device_initcall(pseries, pseries_kexec_setup);
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_FIRST_RUN_FIRST_RUN_INTERNAL_H_ #define CHROME_BROWSER_FIRST_RUN_FIRST_RUN_INTERNAL_H_ class MasterPrefs; class Profile; namespace base { class FilePath; } namespace installer { class MasterPreferences; } namespace first_run { namespace internal { enum FirstRunState { FIRST_RUN_UNKNOWN, // The state is not tested or set yet. FIRST_RUN_TRUE, FIRST_RUN_FALSE, }; // Sets up master preferences by preferences passed by installer. void SetupMasterPrefsFromInstallPrefs( const installer::MasterPreferences& install_prefs, MasterPrefs* out_prefs); // Get the file path of the first run sentinel; returns false on failure. bool GetFirstRunSentinelFilePath(base::FilePath* path); // Create the first run sentinel file; returns false on failure. bool CreateSentinel(); // -- Platform-specific functions -- void DoPostImportPlatformSpecificTasks(Profile* profile); // Returns true if the sentinel file exists (or the path cannot be obtained). // Migrates Windows legacy sentinel files to the corrent location, if needed. bool IsFirstRunSentinelPresent(); // This function has a common implementationin for all non-linux platforms, and // a linux specific implementation. bool IsOrganicFirstRun(); // Shows the EULA dialog if required. Returns true if the EULA is accepted, // returns false if the EULA has not been accepted, in which case the browser // should exit. bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs); // Returns the path for the master preferences file. base::FilePath MasterPrefsPath(); } // namespace internal } // namespace first_run #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_INTERNAL_H_
/* Module object interface */ #ifndef Py_MODULEOBJECT_H #define Py_MODULEOBJECT_H #ifdef __cplusplus extern "C" { #endif PyAPI_DATA(PyTypeObject) PyModule_Type; #define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type) #define PyModule_CheckExact(op) (Py_TYPE(op) == &PyModule_Type) #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyModule_NewObject( PyObject *name ); #endif PyAPI_FUNC(PyObject *) PyModule_New( const char *name /* UTF-8 encoded string */ ); PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyModule_GetNameObject(PyObject *); #endif PyAPI_FUNC(const char *) PyModule_GetName(PyObject *); PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *); PyAPI_FUNC(PyObject *) PyModule_GetFilenameObject(PyObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyModule_Clear(PyObject *); PyAPI_FUNC(void) _PyModule_ClearDict(PyObject *); #endif PyAPI_FUNC(struct PyModuleDef*) PyModule_GetDef(PyObject*); PyAPI_FUNC(void*) PyModule_GetState(PyObject*); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 /* New in 3.5 */ PyAPI_FUNC(PyObject *) PyModuleDef_Init(struct PyModuleDef*); PyAPI_DATA(PyTypeObject) PyModuleDef_Type; #endif typedef struct PyModuleDef_Base { PyObject_HEAD PyObject* (*m_init)(void); Py_ssize_t m_index; PyObject* m_copy; } PyModuleDef_Base; #define PyModuleDef_HEAD_INIT { \ PyObject_HEAD_INIT(NULL) \ NULL, /* m_init */ \ 0, /* m_index */ \ NULL, /* m_copy */ \ } struct PyModuleDef_Slot; #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 /* New in 3.5 */ typedef struct PyModuleDef_Slot{ int slot; void *value; } PyModuleDef_Slot; #define Py_mod_create 1 #define Py_mod_exec 2 #ifndef Py_LIMITED_API #define _Py_mod_LAST_SLOT 2 #endif #endif /* New in 3.5 */ typedef struct PyModuleDef{ PyModuleDef_Base m_base; const char* m_name; const char* m_doc; Py_ssize_t m_size; PyMethodDef *m_methods; struct PyModuleDef_Slot* m_slots; traverseproc m_traverse; inquiry m_clear; freefunc m_free; } PyModuleDef; #ifdef __cplusplus } #endif #endif /* !Py_MODULEOBJECT_H */