text
stringlengths
4
6.14k
//===-- NetBSDSignals.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 liblldb_NetBSDSignals_H_ #define liblldb_NetBSDSignals_H_ #include "lldb/Target/UnixSignals.h" namespace lldb_private { /// NetBSD specific set of Unix signals. class NetBSDSignals : public UnixSignals { public: NetBSDSignals(); private: void Reset() override; }; } // namespace lldb_private #endif // liblldb_NetBSDSignals_H_
/** @file strncasecmp implementation Copyright (c) 2011, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License that accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. * Copyright (c) 1987, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University 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 REGENTS 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 REGENTS 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. $NetBSD: strncasecmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $ strcasecmp.c 8.1 (Berkeley) 6/4/93 **/ #include <LibConfig.h> #include <sys/cdefs.h> #if !defined(_KERNEL) && !defined(_STANDALONE) #include "namespace.h" #include <assert.h> #include <ctype.h> #include <string.h> #ifdef __weak_alias __weak_alias(strcasecmp,_strcasecmp) __weak_alias(strncasecmp,_strncasecmp) #endif #else #include <lib/libkern/libkern.h> #include <machine/limits.h> #endif int strncasecmp(const char *s1, const char *s2, size_t n) { int CompareVal; _DIAGASSERT(s1 != NULL); _DIAGASSERT(s2 != NULL); if (n != 0) { do { CompareVal = tolower(*s1) - tolower(*s2); if (CompareVal != 0) { return (CompareVal); } ++s1; ++s2; if (*s1 == '\0') { break; } } while (--n != 0); } return (0); }
/*========================================================================= * * Copyright Insight Software Consortium * * 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.txt * * 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 __itkCellInterfaceVisitor_h #define __itkCellInterfaceVisitor_h #include "itkLightObject.h" #include "itkObjectFactory.h" namespace itk { // forward reference CellInterface template< typename TPixelType, typename TCellTraits > class CellInterface; /** \class CellInterfaceVisitor * Define the abstract interface for a visitor class that can visit the * cells in a Mesh. This follows the Visitor Design Pattern. To make * this class easier to use, the CellInterfaceVisitorImplementation is * provided as a templated class to implement the pure virtual functions * of CellInterfaceVisitor. * * \ingroup MeshAccess * \ingroup ITK-Common */ template< typename TPixelType, typename TCellTraits > class CellInterfaceVisitor:public LightObject { public: /** Standard class typedefs. */ typedef CellInterfaceVisitor Self; typedef LightObject Superclass; typedef SmartPointer< Self > Pointer; typedef SmartPointer< const Self > ConstPointer; typedef typename TCellTraits::CellIdentifier CellIdentifier; /** Run-time type information (and related methods). */ itkTypeMacro(CellInterfaceVisitor, LightObject); /** This method is called by each cell as it visits this visitor. */ virtual void VisitFromCell(CellIdentifier cellId, CellInterface< TPixelType, TCellTraits > *) = 0; /** Return the index of the CellTopology. */ virtual int GetCellTopologyId() = 0; protected: CellInterfaceVisitor() {} ~CellInterfaceVisitor() {} private: CellInterfaceVisitor(const Self &); //purposely not implemented void operator=(const Self &); //purposely not implemented }; /** \class CellInterfaceVisitorImplementation * A template class used to implement a visitor object. * * The Visitor implementation does the down cast to * the specific cell type that is being visited. After the * cast, a member of the UserVisitor type called Visit is * passed the exact cell type being visited. To use this * class, write a class that implements a function * Visit(int id, CellTopology*). Then, use that as the UserVisitor * template parameter. * * Template parameters for CellInterfaceVisitorImplementation: * TPixelType = see CellInterface * * TCellTraits = see CellInterface * * CellTopology = The specific type of cell that needs to be visited. * * UserVisitor = A user supplied class that implements the function * Visit(int id, CellTopology*) * * \ingroup MeshAccess * \ingroup ITK-Common */ template< typename TPixelType, typename TCellTraits, class CellTopology, class UserVisitor > class CellInterfaceVisitorImplementation: public CellInterfaceVisitor< TPixelType, TCellTraits >, public UserVisitor { public: /** Standard class typedefs. */ typedef CellInterfaceVisitorImplementation Self; typedef SmartPointer< Self > Pointer; typedef typename TCellTraits::CellIdentifier CellIdentifier; /** Method for creation through the object factory. */ itkNewMacro(Self); /** Run-time type information (and related methods). */ itkTypeMacro(CellInterfaceVisitorImplementation, LightObject); /** Call the static method GetTopologyId for the CellTopology type that * we are templated over. */ virtual int GetCellTopologyId() { return CellTopology::GetTopologyId(); } /** Call the method Visit from the UserVisitor template parameter that * this class inherits from. I am my own gradpa... */ void VisitFromCell(CellIdentifier cellId, CellInterface< TPixelType, TCellTraits > *c) { this->UserVisitor::Visit(cellId, (CellTopology *)c); } protected: CellInterfaceVisitorImplementation() {} ~CellInterfaceVisitorImplementation() {} private: CellInterfaceVisitorImplementation(const Self &); //purposely not implemented void operator=(const Self &); //purposely not implemented }; } // end namespace itk #endif
//===-- DIERef.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 SymbolFileDWARF_DIERef_h_ #define SymbolFileDWARF_DIERef_h_ #include "lldb/Core/dwarf.h" #include "llvm/ADT/Optional.h" #include "llvm/Support/FormatProviders.h" #include <cassert> #include <vector> /// Identifies a DWARF debug info entry within a given Module. It contains three /// "coordinates": /// - dwo_num: identifies the dwo file in the Module. If this field is not set, /// the DIERef references the main file. /// - section: identifies the section of the debug info entry in the given file: /// debug_info or debug_types. /// - die_offset: The offset of the debug info entry as an absolute offset from /// the beginning of the section specified in the section field. class DIERef { public: enum Section : uint8_t { DebugInfo, DebugTypes }; DIERef(llvm::Optional<uint32_t> dwo_num, Section section, dw_offset_t die_offset) : m_dwo_num(dwo_num.getValueOr(0)), m_dwo_num_valid(bool(dwo_num)), m_section(section), m_die_offset(die_offset) { assert(this->dwo_num() == dwo_num && "Dwo number out of range?"); } llvm::Optional<uint32_t> dwo_num() const { if (m_dwo_num_valid) return m_dwo_num; return llvm::None; } Section section() const { return static_cast<Section>(m_section); } dw_offset_t die_offset() const { return m_die_offset; } private: uint32_t m_dwo_num : 30; uint32_t m_dwo_num_valid : 1; uint32_t m_section : 1; dw_offset_t m_die_offset; }; static_assert(sizeof(DIERef) == 8, ""); typedef std::vector<DIERef> DIEArray; namespace llvm { template<> struct format_provider<DIERef> { static void format(const DIERef &ref, raw_ostream &OS, StringRef Style); }; } // namespace llvm #endif // SymbolFileDWARF_DIERef_h_
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import "NSObject-Protocol.h" @protocol NSOpenSavePanelDelegate <NSObject> @optional - (void)panel:(id)arg1 didChangeToDirectoryURL:(id)arg2; - (BOOL)panel:(id)arg1 shouldEnableURL:(id)arg2; - (id)panel:(id)arg1 userEnteredFilename:(id)arg2 confirmed:(BOOL)arg3; - (BOOL)panel:(id)arg1 validateURL:(id)arg2 error:(id *)arg3; - (void)panel:(id)arg1 willExpand:(BOOL)arg2; - (void)panelSelectionDidChange:(id)arg1; @end
/*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef MITKRDFSTORE_H #define MITKRDFSTORE_H #include <MitkRDFExports.h> #include <map> #include <list> #include "mitkRdfTriple.h" #include <mitkCommon.h> namespace mitk { class RdfStorePrivate; /** * \ingroup MitkRDFModule */ class MITKRDF_EXPORT RdfStore { public: typedef std::map<std::string, std::list<RdfNode> > ResultMap; typedef std::map<std::string, RdfUri> PrefixMap; /** * Construct a new triplestore. */ RdfStore(); /** * Destruct a triplestore. */ ~RdfStore(); /** * Set the base URI of the triplestore. * @param uri An URI which is the base for the triplestore and for new nodes. */ void SetBaseUri(RdfUri uri); /** * Get the base URI of the triplestore. */ RdfUri GetBaseUri() const; /** * Add a new prefix which represents an URI as an abbreviation to the triplestore. * @param prefix The short form of an URI. * @param uri The full form of an URI. */ void AddPrefix(std::string prefix, RdfUri uri); /** * Get a Map with all prefixes of the triplestore. * @return A Map with all Prefixes of the RdfStore. */ PrefixMap GetPrefixes() const; /** * Clean up the triplestore to the state of a new store. */ void CleanUp(); /** * Add a new triple to the triplestore. * Checks if the triplestore contains the triple. * @param triple A triple. * @return If the triple is successfully added or if the triplestore already contains the triple, true will be returned. If none of the previous options happen, false will be returned. */ bool Add(RdfTriple triple); /** * Remove a triple from the triplestore. * Checks if the triplestore contains the triple. * @param triple A triple. * @return If the triple is successfully removed or if the triplestore doesn't contain the triple, true will be returned. If none of the previous options happen, false will be returned. */ bool Remove(RdfTriple triple); /** * Checks if the triplestore contains the triple. * @param triple A triple. * @return If the triplestore contains the triple, true will be returned. Otherwise, false will be returned. */ bool Contains(RdfTriple triple); /** * Queries over the triplestore with the given SPARQL query. * @param query A std:string which stands for a SPARQL query text. * @return The result of the query will be returned as a map of keys with their values as lists of nodes. * @deprecatedSince{2016_03} Use mitk::RdfStore::ExecuteTupleQuery() instead. */ DEPRECATED(ResultMap Query(const std::string& query) const); /** * Queries over the triplestore with the given SPARQL query. * @param query A std:string which stands for a SPARQL query text. * @return The result of the query will be returned as a map of keys with their values as lists of nodes. */ ResultMap ExecuteTupleQuery(const std::string& query) const; /** * Tests whether or not the specified query pattern has a solution. * @param query The SPARQL query string in ASK form. * @return True if query pattern has a solution, otherwise false. * @throws mitk::Exception This exception is thrown if one of the following errors occur: * (1) failure on query object creation, (2) SPARQL syntax error, * (3) trying to execute a non-boolean query, (4) error while retrieving execution result */ bool ExecuteBooleanQuery(const std::string& query) const; /** * Saves the current state of the triplestore in a file. The currently supported formats are: "ntriples", "turtle"(default), "nquads". * @param filename A full filepath to the lokal storage. * @param format One of the supported formats. Default: "turtle". */ void Save(std::string filename, std::string format = ""); /** * Imports the state of the triplestore of an URL (URI). * @param filename A full filepath to the lokal storage or http address as URL. A lokal file path has to look like "file:YOURPATH" ( Example: file:D:/home/readme.txt ). * @param format The current supported formats are: "turtle" (default), "ntriples", "nquads". */ void Import(std::string url, std::string format = ""); private: RdfStorePrivate* d; }; } #endif // MITKRDFSTORE_H
// // Copyright (c) 2014 The ANGLE 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 SAMPLE_UTIL_WINDOW_H #define SAMPLE_UTIL_WINDOW_H #include "Event.h" #include <EGL/egl.h> #include <EGL/eglext.h> #include <list> class OSWindow { public: OSWindow(); virtual ~OSWindow(); virtual bool initialize(const std::string &name, size_t width, size_t height) = 0; virtual void destroy() = 0; int getWidth() const; int getHeight() const; virtual EGLNativeWindowType getNativeWindow() const = 0; virtual EGLNativeDisplayType getNativeDisplay() const = 0; virtual void messageLoop() = 0; bool popEvent(Event *event); virtual void pushEvent(Event event); virtual void setMousePosition(int x, int y) = 0; virtual bool resize(int width, int height) = 0; virtual void setVisible(bool isVisible) = 0; protected: int mWidth; int mHeight; std::list<Event> mEvents; }; OSWindow *CreateOSWindow(); #endif // SAMPLE_UTIL_WINDOW_H
#ifndef __GO_STRUCTS_H__ #define __GO_STRUCTS_H__ struct GoIPEndPoint { unsigned char *ip_buf; size_t ip_length; uint16_t port; }; #endif // __GO_STRUCTS_H__
/* * Copyright 2017 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SKSL_NFASTATE #define SKSL_NFASTATE #include <string> #include <vector> #include "src/sksl/lex/LexUtil.h" struct NFAState { enum Kind { // represents an accept state - if the NFA ends up in this state, we have successfully // matched the token indicated by fData[0] kAccept_Kind, // matches the single character fChar kChar_Kind, // the regex '.'; matches any char but '\n' kDot_Kind, // a state which serves as a placeholder for the states indicated in fData. When we // transition to this state, we instead transition to all of the fData states. kRemapped_Kind, // contains a list of true/false values in fData. fData[c] tells us whether we accept the // character c. kTable_Kind }; NFAState(Kind kind, std::vector<int> next) : fKind(kind) , fNext(std::move(next)) {} NFAState(char c, std::vector<int> next) : fKind(kChar_Kind) , fChar(c) , fNext(std::move(next)) {} NFAState(std::vector<int> states) : fKind(kRemapped_Kind) , fData(std::move(states)) {} NFAState(bool inverse, std::vector<bool> accepts, std::vector<int> next) : fKind(kTable_Kind) , fInverse(inverse) , fNext(std::move(next)) { for (bool b : accepts) { fData.push_back(b); } } NFAState(int token) : fKind(kAccept_Kind) { fData.push_back(token); } bool accept(char c) const { switch (fKind) { case kAccept_Kind: return false; case kChar_Kind: return c == fChar; case kDot_Kind: return c != '\n'; case kTable_Kind: { bool value; if ((size_t) c < fData.size()) { value = fData[c]; } else { value = false; } return value != fInverse; } default: ABORT("unreachable"); } } std::string description() const { switch (fKind) { case kAccept_Kind: return "Accept(" + std::to_string(fData[0]) + ")"; case kChar_Kind: { std::string result = "Char('" + std::string(1, fChar) + "'"; for (int v : fNext) { result += ", "; result += std::to_string(v); } result += ")"; return result; } case kDot_Kind: { std::string result = "Dot("; const char* separator = ""; for (int v : fNext) { result += separator; result += std::to_string(v); separator = ", "; } result += ")"; return result; } case kRemapped_Kind: { std::string result = "Remapped("; const char* separator = ""; for (int v : fData) { result += separator; result += std::to_string(v); separator = ", "; } result += ")"; return result; } case kTable_Kind: { std::string result = std::string("Table(") + (fInverse ? "true" : "false") + ", ["; const char* separator = ""; for (int v : fData) { result += separator; result += v ? "true" : "false"; separator = ", "; } result += "]"; for (int n : fNext) { result += ", "; result += std::to_string(n); } result += ")"; return result; } default: ABORT("unreachable"); } } Kind fKind; char fChar = 0; bool fInverse = false; std::vector<int> fData; // states we transition to upon a succesful match from this state std::vector<int> fNext; }; #endif
/** * Leaping POR * * Using some POR search method, compute multiple independent stubborn sets and * schedule all their interleavings at once. * * Independent sets are found by search for disjoint stubborn sets. As * disjointness implies independence, by the fact that outside transitions * always commute with transitions inside the stubborn set. * * "Scheduling multiple interleavings at once" is done by taking the Cartesian * product of all disjoint sets, and atomically executing the resulting vectors * (i.e. not returning the intermediate steps). * */ #ifndef LEAP_POR #define LEAP_POR #include <pins-lib/por/pins2pins-por.h> typedef struct leap_s leap_t; extern leap_t *leap_create_context (model_t por_model, model_t pre_por, next_method_black_t next_all); extern bool leap_is_stubborn (por_context *ctx, int group); extern int leap_search_all (model_t self, int *src, TransitionCB cb, void *user_context); extern void leap_add_leap_group (model_t por_model, model_t pre_por); extern void leap_stats (model_t model); #endif
// Copyright (c) 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 CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_OS_SETTINGS_UI_H_ #define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_OS_SETTINGS_UI_H_ #include <memory> #include "ash/services/cellular_setup/public/mojom/cellular_setup.mojom-forward.h" #include "ash/services/cellular_setup/public/mojom/esim_manager.mojom-forward.h" #include "base/time/time.h" #include "chrome/browser/ui/webui/app_management/app_management_page_handler.h" #include "chrome/browser/ui/webui/app_management/app_management_page_handler_factory.h" #include "chrome/browser/ui/webui/nearby_share/nearby_share.mojom.h" #include "chrome/browser/ui/webui/nearby_share/public/mojom/nearby_share_settings.mojom.h" #include "chrome/browser/ui/webui/settings/ash/os_apps_page/mojom/app_notification_handler.mojom-forward.h" #include "chrome/browser/ui/webui/settings/chromeos/search/user_action_recorder.mojom-forward.h" #include "chrome/browser/ui/webui/webui_load_timer.h" #include "chromeos/services/bluetooth_config/public/mojom/cros_bluetooth_config.mojom-forward.h" #include "chromeos/services/network_config/public/mojom/cros_network_config.mojom-forward.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "ui/webui/mojo_web_ui_controller.h" #include "ui/webui/resources/cr_components/app_management/app_management.mojom-forward.h" namespace user_prefs { class PrefRegistrySyncable; } // namespace user_prefs namespace chromeos { namespace settings { namespace mojom { class SearchHandler; } // namespace mojom // The WebUI handler for chrome://os-settings. class OSSettingsUI : public ui::MojoWebUIController { public: static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); explicit OSSettingsUI(content::WebUI* web_ui); OSSettingsUI(const OSSettingsUI&) = delete; OSSettingsUI& operator=(const OSSettingsUI&) = delete; ~OSSettingsUI() override; // Instantiates implementor of the mojom::CellularSetup mojo interface // passing the pending receiver that will be internally bound. void BindInterface( mojo::PendingReceiver<ash::cellular_setup::mojom::CellularSetup> receiver); // Instantiates implementor of the mojom::ESimManager mojo interface // passing the pending receiver that will be internally bound. void BindInterface( mojo::PendingReceiver<ash::cellular_setup::mojom::ESimManager> receiver); // Instantiates implementor of the mojom::CrosNetworkConfig mojo interface // passing the pending receiver that will be internally bound. void BindInterface( mojo::PendingReceiver<network_config::mojom::CrosNetworkConfig> receiver); // Instantiates implementor of the mojom::UserActionRecorder mojo interface // passing the pending receiver that will be internally bound. void BindInterface(mojo::PendingReceiver<mojom::UserActionRecorder> receiver); // Instantiates implementor of the mojom::SearchHandler mojo interface // passing the pending receiver that will be internally bound. void BindInterface(mojo::PendingReceiver<mojom::SearchHandler> receiver); // Instantiates implementor of the mojom::AppNotificationsHandler mojo // interface passing the pending receiver that will be internally bound. void BindInterface( mojo::PendingReceiver<app_notification::mojom::AppNotificationsHandler> receiver); // Instantiates implementor of the mojom::PageHandlerFactory mojo interface // passing the pending receiver that will be internally bound. void BindInterface( mojo::PendingReceiver<app_management::mojom::PageHandlerFactory> receiver); // Binds to the existing settings instance owned by the nearby share keyed // service. void BindInterface( mojo::PendingReceiver<nearby_share::mojom::NearbyShareSettings> receiver); // Creates and binds a new receive manager. void BindInterface( mojo::PendingReceiver<nearby_share::mojom::ReceiveManager> receiver); // Binds to the existing contacts manager instance owned by the nearby share // keyed service. void BindInterface( mojo::PendingReceiver<nearby_share::mojom::ContactManager> receiver); // Instantiates implementor of the mojom::CrosBluetoothConfig mojo interface // passing the pending receiver that will be internally bound. void BindInterface( mojo::PendingReceiver<bluetooth_config::mojom::CrosBluetoothConfig> receiver); private: base::TimeTicks time_when_opened_; WebuiLoadTimer webui_load_timer_; std::unique_ptr<mojom::UserActionRecorder> user_action_recorder_; std::unique_ptr<AppManagementPageHandlerFactory> app_management_page_handler_factory_; WEB_UI_CONTROLLER_TYPE_DECL(); }; } // namespace settings } // namespace chromeos #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_OS_SETTINGS_UI_H_
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Copyright (c) 2011-2012 Litecoin Developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_SYNC_H #define BITCOIN_SYNC_H #include <stdint.h> #include <boost/thread/mutex.hpp> #include <boost/thread/recursive_mutex.hpp> #include <boost/thread/locks.hpp> #include <boost/thread/condition_variable.hpp> /** Wrapped boost mutex: supports recursive locking, but no waiting */ typedef boost::recursive_mutex CCriticalSection; /** Wrapped boost mutex: supports waiting but not recursive locking */ typedef boost::mutex CWaitableCriticalSection; #ifdef DEBUG_LOCKORDER void EnterCritical(const char* pszName, const char* pszFile, int nLine, void* cs, bool fTry = false); void LeaveCritical(); #else void static inline EnterCritical(const char* pszName, const char* pszFile, int nLine, void* cs, bool fTry = false) {} void static inline LeaveCritical() {} #endif #ifdef DEBUG_LOCKCONTENTION void PrintLockContention(const char* pszName, const char* pszFile, int nLine); #endif /** Wrapper around boost::interprocess::scoped_lock */ template<typename Mutex> class CMutexLock { private: boost::unique_lock<Mutex> lock; public: void Enter(const char* pszName, const char* pszFile, int nLine) { if (!lock.owns_lock()) { EnterCritical(pszName, pszFile, nLine, (void*)(lock.mutex())); #ifdef DEBUG_LOCKCONTENTION if (!lock.try_lock()) { PrintLockContention(pszName, pszFile, nLine); #endif lock.lock(); #ifdef DEBUG_LOCKCONTENTION } #endif } } void Leave() { if (lock.owns_lock()) { lock.unlock(); LeaveCritical(); } } bool TryEnter(const char* pszName, const char* pszFile, int nLine) { if (!lock.owns_lock()) { EnterCritical(pszName, pszFile, nLine, (void*)(lock.mutex()), true); lock.try_lock(); if (!lock.owns_lock()) LeaveCritical(); } return lock.owns_lock(); } CMutexLock(Mutex& mutexIn, const char* pszName, const char* pszFile, int nLine, bool fTry = false) : lock(mutexIn, boost::defer_lock) { if (fTry) TryEnter(pszName, pszFile, nLine); else Enter(pszName, pszFile, nLine); } ~CMutexLock() { if (lock.owns_lock()) LeaveCritical(); } operator bool() { return lock.owns_lock(); } boost::unique_lock<Mutex> &GetLock() { return lock; } }; typedef CMutexLock<CCriticalSection> CCriticalBlock; #define LOCK(cs) CCriticalBlock criticalblock(cs, #cs, __FILE__, __LINE__) #define LOCK2(cs1,cs2) CCriticalBlock criticalblock1(cs1, #cs1, __FILE__, __LINE__),criticalblock2(cs2, #cs2, __FILE__, __LINE__) #define TRY_LOCK(cs,name) CCriticalBlock name(cs, #cs, __FILE__, __LINE__, true) #define ENTER_CRITICAL_SECTION(cs) \ { \ EnterCritical(#cs, __FILE__, __LINE__, (void*)(&cs)); \ (cs).lock(); \ } #define LEAVE_CRITICAL_SECTION(cs) \ { \ (cs).unlock(); \ LeaveCritical(); \ } class CSemaphore { private: boost::condition_variable condition; boost::mutex mutex; int value; public: CSemaphore(int init) : value(init) {} void wait() { boost::unique_lock<boost::mutex> lock(mutex); while (value < 1) { condition.wait(lock); } value--; } bool try_wait() { boost::unique_lock<boost::mutex> lock(mutex); if (value < 1) return false; value--; return true; } void post() { { boost::unique_lock<boost::mutex> lock(mutex); value++; } condition.notify_one(); } }; /** RAII-style semaphore lock */ class CSemaphoreGrant { private: CSemaphore *sem; bool fHaveGrant; public: void Acquire() { if (fHaveGrant) return; sem->wait(); fHaveGrant = true; } void Release() { if (!fHaveGrant) return; sem->post(); fHaveGrant = false; } bool TryAcquire() { if (!fHaveGrant && sem->try_wait()) fHaveGrant = true; return fHaveGrant; } void MoveTo(CSemaphoreGrant &grant) { grant.Release(); grant.sem = sem; grant.fHaveGrant = fHaveGrant; sem = NULL; fHaveGrant = false; } CSemaphoreGrant() : sem(NULL), fHaveGrant(false) {} CSemaphoreGrant(CSemaphore &sema, bool fTry = false) : sem(&sema), fHaveGrant(false) { if (fTry) TryAcquire(); else Acquire(); } ~CSemaphoreGrant() { Release(); } operator bool() { return fHaveGrant; } }; #endif
/* ARP has been moved to core/ipv4, provide this #include for compatibility only */ #include "lwip/etharp.h"
/* * The MIT License (MIT) * * Copyright (c) 2015 Microsoft Corporation * * -=- Robust Distributed System Nucleus (rDSN) -=- * * 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. */ /* * Description: * What is this file about? * * Revision history: * xxxx-xx-xx, author, first version * xxxx-xx-xx, author, fix bug about xxx */ # pragma once namespace dsn { namespace replication { void install_checkers(); } }
// This file was generated based on 'C:\ProgramData\Uno\Packages\Fuse.Android\0.19.3\.upk\meta'. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Uno.h> namespace g{namespace Uno{namespace Runtime{namespace Implementation{namespace ShaderBackends{namespace OpenGL{struct GLProgram;}}}}}} namespace g{struct Fuse_Android_bundle;} namespace g{ // public static generated class Fuse_Android_bundle :0 // { uClassType* Fuse_Android_bundle_typeof(); struct Fuse_Android_bundle : uObject { static uSStrong< ::g::Uno::Runtime::Implementation::ShaderBackends::OpenGL::GLProgram*> Blitter8e9d75eb_; static uSStrong< ::g::Uno::Runtime::Implementation::ShaderBackends::OpenGL::GLProgram*>& Blitter8e9d75eb() { return Fuse_Android_bundle_typeof()->Init(), Blitter8e9d75eb_; } }; // } } // ::g
#import <Foundation/Foundation.h> @class GHGherkinLineSpan; @protocol GHGherkinLineProtocol <NSObject> @property (nonatomic, readonly) NSString * lineText; @property (nonatomic, readonly) NSUInteger lineNumber; @property (nonatomic, readonly) NSUInteger indent; /// <summary> /// Called by the parser to indicate non-streamed reading (e.g. during look-ahead). /// </summary> /// <remarks> /// If the implementation depends on streamed reading behavior, with this method, it can clone itself, so that it will be detached. /// </remarks> - (void)detach; /// <summary> /// Gets if the line is empty or contains whitespaces only. /// </summary> /// <returns>YES, if empty or contains whitespaces only; otherwise, NO.</returns> - (BOOL)empty; /// <summary> /// Determines whether the beginning of the line (wihtout whitespaces) matches a specified string. /// </summary> /// <param name="theText">The string to compare. </param> /// <returns>YES if text matches the beginning of this line; otherwise, NO.</returns> - (BOOL)hasPrefix:(NSString *)theText; /// <summary> /// Determines whether the beginning of the line (wihtout whitespaces) matches a specified title keyword (ie. a keyword followed by a ':' character). /// </summary> /// <param name="theKeyword">The keyword to compare. </param> /// <returns>YES if keyword matches the beginning of this line and followed by a ':' character; otherwise, NO.</returns> - (BOOL)hasTitleKeywordPrefix:(NSString *)theKeyword; /// <summary> /// Returns the line text /// </summary> /// <param name="theIndentToRemove">The maximum number of whitespace characters to remove. -1 removes all leading whitespaces.</param> /// <returns>The line text.</returns> - (NSString *)lineTextByRemovingIndent:(NSInteger)theIndentToRemove; /// <summary> /// Returns the remaining part of the line. /// </summary> /// <param name="theLength"></param> /// <returns></returns> - (NSString *)trimmedRest:(NSUInteger)theLength; /// <summary> /// Tries parsing the line as a tag list, and returns the tags wihtout the leading '@' characters. /// </summary> /// <returns>(position,text) pairs, position is 0-based index</returns> - (NSArray<GHGherkinLineSpan *> *)tags; /// <summary> /// Tries parsing the line as table row and returns the trimmed cell values. /// </summary> /// <returns>(position,text) pairs, position is 0-based index</returns> - (NSArray<GHGherkinLineSpan *> *)tableCells; @end
/* $Id$Revision: */ /* vim:set shiftwidth=4 ts=8: */ /************************************************************************* * Copyright (c) 2011 AT&T Intellectual Property * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: See CVS logs. Details at http://www.graphviz.org/ *************************************************************************/ #include "config.h" #include <limits.h> #include "memory.h" #include "sgraph.h" #include "fPQ.h" #if 0 /* Max. number of maze segments around a node */ static int MaxNodeBoundary = 100; typedef struct { int left, right, up, down; } irect; /* nodes in the search graph correspond to line segments in the * grid formed by n_hlines horizontal lines and n_vlines vertical lines. * The vertical segments are enumerated first, top to bottom, left to right. * Then the horizontal segments left to right, top to bottom. For example, * with an array of 4 vertical and 3 horizontal lines, we have * * |--14--|--15--|--16--| * 1 3 5 7 * |--11--|--12--|--13--| * 0 2 4 6 * |-- 8--|-- 9--|--10--| */ static irect get_indices(orthograph* OG,int i, int j) { irect r; int hl = OG->n_hlines-1; int vl = OG->n_vlines-1; r.left = i*hl + j; r.right = r.left + hl; r.down = (vl+1)*hl + j*vl + i; r.up = r.down + vl; return r; } static irect find_boundary(orthograph* G, int n) { rect R = G->Nodes[n]; irect r; int i; for (i = 0; i < G->n_vlines; i++) { if (R.left == G->v_lines[i]) { r.left = i; break; } } for (; i < G->n_vlines; i++) { if (R.right == G->v_lines[i]) { r.right = i; break; } } for (i = 0; i < G->n_hlines; i++) { if (R.down == G->h_lines[i]) { r.down = i; break; } } for (; i < G->n_hlines; i++) { if (R.up == G->h_lines[i]) { r.up = i; break; } } return r; } #endif void gsave (sgraph* G) { int i; G->save_nnodes = G->nnodes; G->save_nedges = G->nedges; for (i = 0; i < G->nnodes; i++) G->nodes[i].save_n_adj = G->nodes[i].n_adj; } void reset(sgraph* G) { int i; G->nnodes = G->save_nnodes; G->nedges = G->save_nedges; for (i = 0; i < G->nnodes; i++) G->nodes[i].n_adj = G->nodes[i].save_n_adj; for (; i < G->nnodes+2; i++) G->nodes[i].n_adj = 0; } void initSEdges (sgraph* g, int maxdeg) { int i; int* adj = N_NEW (6*g->nnodes + 2*maxdeg, int); g->edges = N_NEW (3*g->nnodes + maxdeg, sedge); for (i = 0; i < g->nnodes; i++) { g->nodes[i].adj_edge_list = adj; adj += 6; } for (; i < g->nnodes+2; i++) { g->nodes[i].adj_edge_list = adj; adj += maxdeg; } } sgraph* createSGraph (int nnodes) { sgraph* g = NEW(sgraph); /* create the nodes vector in the search graph */ g->nnodes = 0; g->nodes = N_NEW(nnodes, snode); return g; } snode* createSNode (sgraph* g) { snode* np = g->nodes+g->nnodes; np->index = g->nnodes; g->nnodes++; return np; } static void addEdgeToNode (snode* np, sedge* e, int idx) { np->adj_edge_list[np->n_adj] = idx; np->n_adj++; } sedge* createSEdge (sgraph* g, snode* v1, snode* v2, double wt) { sedge* e; int idx = g->nedges++; e = g->edges + idx; e->v1 = v1->index; e->v2 = v2->index; e->weight = wt; e->cnt = 0; addEdgeToNode (v1, e, idx); addEdgeToNode (v2, e, idx); return e; } void freeSGraph (sgraph* g) { free (g->nodes[0].adj_edge_list); free (g->nodes); free (g->edges); free (g); } #include "fPQ.h" /* shortest path: * Constructs the path of least weight between from and to. * * Assumes graph, node and edge type, and that nodes * have associated values N_VAL, N_IDX, and N_DAD, the first two * being ints, the last being a node*. Edges have a E_WT function * to specify the edge length or weight. * * Assumes there are functions: * agnnodes: graph -> int number of nodes in the graph * agfstnode, agnxtnode : iterators over the nodes in the graph * agfstedge, agnxtedge : iterators over the edges attached to a node * adjacentNode : given an edge e and an endpoint n of e, returns the * other endpoint. * * The path is given by * to, N_DAD(to), N_DAD(N_DAD(to)), ..., from */ #define UNSEEN INT_MIN static snode* adjacentNode(sgraph* g, sedge* e, snode* n) { if (e->v1==n->index) return (&(g->nodes[e->v2])); else return (&(g->nodes[e->v1])); } int shortPath (sgraph* g, snode* from, snode* to) { snode* n; sedge* e; snode* adjn; int d; int x, y; for (x = 0; x<g->nnodes; x++) { snode* temp; temp = &(g->nodes[x]); N_VAL(temp) = UNSEEN; } PQinit(); if (PQ_insert (from)) return 1; N_DAD(from) = NULL; N_VAL(from) = 0; while ((n = PQremove())) { #ifdef DEBUG fprintf (stderr, "process %d\n", n->index); #endif N_VAL(n) *= -1; if (n == to) break; for (y=0; y<n->n_adj; y++) { e = &(g->edges[n->adj_edge_list[y]]); adjn = adjacentNode(g, e, n); if (N_VAL(adjn) < 0) { d = -(N_VAL(n) + E_WT(e)); if (N_VAL(adjn) == UNSEEN) { #ifdef DEBUG fprintf (stderr, "new %d (%d)\n", adjn->index, -d); #endif N_VAL(adjn) = d; if (PQ_insert(adjn)) return 1; N_DAD(adjn) = n; N_EDGE(adjn) = e; } else { if (N_VAL(adjn) < d) { #ifdef DEBUG fprintf (stderr, "adjust %d (%d)\n", adjn->index, -d); #endif PQupdate(adjn, d); N_DAD(adjn) = n; N_EDGE(adjn) = e; } } } } } /* PQfree(); */ return 0; }
// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (c) 2019 Western Digital Corporation or its affiliates. * * Author: Anup Patel <anup.patel@wdc.com> */ #include <common.h> #include <clk-uclass.h> #include <div64.h> #include <dm.h> #include <linux/err.h> struct clk_fixed_factor { struct clk parent; unsigned int div; unsigned int mult; }; #define to_clk_fixed_factor(dev) \ ((struct clk_fixed_factor *)dev_get_platdata(dev)) static ulong clk_fixed_factor_get_rate(struct clk *clk) { uint64_t rate; struct clk_fixed_factor *ff = to_clk_fixed_factor(clk->dev); rate = clk_get_rate(&ff->parent); if (IS_ERR_VALUE(rate)) return rate; do_div(rate, ff->div); return rate * ff->mult; } const struct clk_ops clk_fixed_factor_ops = { .get_rate = clk_fixed_factor_get_rate, }; static int clk_fixed_factor_ofdata_to_platdata(struct udevice *dev) { #if !CONFIG_IS_ENABLED(OF_PLATDATA) int err; struct clk_fixed_factor *ff = to_clk_fixed_factor(dev); err = clk_get_by_index(dev, 0, &ff->parent); if (err) return err; ff->div = dev_read_u32_default(dev, "clock-div", 1); ff->mult = dev_read_u32_default(dev, "clock-mult", 1); #endif return 0; } static const struct udevice_id clk_fixed_factor_match[] = { { .compatible = "fixed-factor-clock", }, { /* sentinel */ } }; U_BOOT_DRIVER(clk_fixed_factor) = { .name = "fixed_factor_clock", .id = UCLASS_CLK, .of_match = clk_fixed_factor_match, .ofdata_to_platdata = clk_fixed_factor_ofdata_to_platdata, .platdata_auto_alloc_size = sizeof(struct clk_fixed_factor), .ops = &clk_fixed_factor_ops, };
/* This testcase is part of GDB, the GNU debugger. Copyright 2010-2012 Free Software Foundation, Inc. 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/>. */ #ifdef __cplusplus class SimpleClass { private: int i; public: void seti (int arg) { i = arg; } int valueofi (void) { return i; /* Break in class. */ } }; #endif int func (int arg) { int i = 2; i = i * arg; return arg; /* Block break here. */ } int main (int argc, char *argv[]) { #ifdef __cplusplus SimpleClass sclass; #endif int a = 0; int result; enum tag {one, two, three}; enum tag t = one; result = func (42); #ifdef __cplusplus sclass.seti (42); sclass.valueofi (); #endif return 0; /* Break at end. */ }
/* vi: set sw=4 ts=4: */ /* * Mini insmod implementation for busybox * * Copyright (C) 2008 Timo Teras <timo.teras@iki.fi> * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ //config:config INSMOD //config: bool "insmod (22 kb)" //config: default y //config: select PLATFORM_LINUX //config: help //config: insmod is used to load specified modules in the running kernel. //applet:IF_INSMOD(IF_NOT_MODPROBE_SMALL(APPLET_NOEXEC(insmod, insmod, BB_DIR_SBIN, BB_SUID_DROP, insmod))) //kbuild:ifneq ($(CONFIG_MODPROBE_SMALL),y) //kbuild:lib-$(CONFIG_INSMOD) += insmod.o modutils.o //kbuild:endif #include "libbb.h" #include "modutils.h" /* 2.6 style insmod has no options and required filename * (not module name - .ko can't be omitted) */ //usage:#if !ENABLE_MODPROBE_SMALL //usage:#define insmod_trivial_usage //usage: IF_FEATURE_2_4_MODULES("[OPTIONS] MODULE") //usage: IF_NOT_FEATURE_2_4_MODULES("FILE") //usage: IF_FEATURE_CMDLINE_MODULE_OPTIONS(" [SYMBOL=VALUE]...") //usage:#define insmod_full_usage "\n\n" //usage: "Load kernel module" //usage: IF_FEATURE_2_4_MODULES( "\n" //usage: "\n -f Force module to load into the wrong kernel version" //usage: "\n -k Make module autoclean-able" //usage: "\n -v Verbose" //usage: "\n -q Quiet" //usage: "\n -L Lock: prevent simultaneous loads" //usage: IF_FEATURE_INSMOD_LOAD_MAP( //usage: "\n -m Output load map to stdout" //usage: ) //usage: "\n -x Don't export externs" //usage: ) //usage:#endif int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int insmod_main(int argc UNUSED_PARAM, char **argv) { char *filename; int rc; /* Compat note: * 2.6 style insmod has no options and required filename * (not module name - .ko can't be omitted). * 2.4 style insmod can take module name without .o * and performs module search in default directories * or in $MODPATH. */ IF_FEATURE_2_4_MODULES( getopt32(argv, INSMOD_OPTS INSMOD_ARGS); argv += optind - 1; ); filename = *++argv; if (!filename) bb_show_usage(); rc = bb_init_module(filename, parse_cmdline_module_options(argv, /*quote_spaces:*/ 0)); if (rc) bb_error_msg("can't insert '%s': %s", filename, moderror(rc)); return rc; }
#ifndef PA_ENDIANNESS_H #define PA_ENDIANNESS_H /* * $Id: pa_endianness.h,v 1.1.2.5 2006/02/16 16:26:07 bjornroche Exp $ * Portable Audio I/O Library current platform endianness macros * * Based on the Open Source API proposed by Ross Bencina * Copyright (c) 1999-2002 Phil Burk, Ross Bencina * * 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. * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that * they can be incorporated into the canonical version. * * 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. */ /** @file @brief Configure endianness symbols for the target processor. Arrange for either the PA_LITTLE_ENDIAN or PA_BIG_ENDIAN preprocessor symbols to be defined. The one that is defined reflects the endianness of the target platform and may be used to implement conditional compilation of byte-order dependent code. If either PA_LITTLE_ENDIAN or PA_BIG_ENDIAN is defined already, then no attempt is made to override that setting. This may be useful if you have a better way of determining the platform's endianness. The autoconf mechanism uses this for example. A PA_VALIDATE_ENDIANNESS macro is provided to compare the compile time and runtime endiannes and raise an assertion if they don't match. */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #if defined(PA_LITTLE_ENDIAN) || defined(PA_BIG_ENDIAN) /* endianness define has been set externally, such as by autoconf */ #if defined(PA_LITTLE_ENDIAN) && defined(PA_BIG_ENDIAN) #error both PA_LITTLE_ENDIAN and PA_BIG_ENDIAN have been defined externally to pa_endianness.h - only one endianness at a time please #endif #else /* endianness define has not been set externally */ /* set PA_LITTLE_ENDIAN or PA_BIG_ENDIAN by testing well known platform specific defines */ #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(LITTLE_ENDIAN) || defined(__i386) || defined(_M_IX86) #define PA_LITTLE_ENDIAN /* win32, assume intel byte order */ #else #define PA_BIG_ENDIAN #endif #if !defined(PA_LITTLE_ENDIAN) && !defined(PA_BIG_ENDIAN) /* If the following error is raised, you either need to modify the code above to automatically determine the endianness from other symbols defined on your platform, or define either PA_LITTLE_ENDIAN or PA_BIG_ENDIAN externally. */ #error pa_endianness.h was unable to automatically determine the endianness of the target platform #endif #endif /* PA_VALIDATE_ENDIANNESS compares the compile time and runtime endianness, and raises an assertion if they don't match. <assert.h> must be included in the context in which this macro is used. */ #if defined(PA_LITTLE_ENDIAN) #define PA_VALIDATE_ENDIANNESS \ { \ const long nativeOne = 1; \ assert( "PortAudio: compile time and runtime endianness don't match" && (((char *)&nativeOne)[0]) == 1 ); \ } #elif defined(PA_BIG_ENDIAN) #define PA_VALIDATE_ENDIANNESS \ { \ const long nativeOne = 1; \ assert( "PortAudio: compile time and runtime endianness don't match" && (((char *)&nativeOne)[0]) == 0 ); \ } #endif #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* PA_ENDIANNESS_H */
// Copyright 2017 Citra Emulator Project // Licensed under GPLv2 or any later version // Refer to the license.txt file included. #pragma once #include "core/hle/service/service.h" namespace Service::PXI { /// Interface to "pxi:dev" service class DEV final : public ServiceFramework<DEV> { public: DEV(); ~DEV(); }; } // namespace Service::PXI
/* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ #ifdef FIX_CLASS FixStyle(langevin/spin,FixLangevinSpin) #else #ifndef LMP_FIX_LANGEVIN_SPIN_H #define LMP_FIX_LANGEVIN_SPIN_H #include "fix.h" namespace LAMMPS_NS { class FixLangevinSpin : public Fix { public: FixLangevinSpin(class LAMMPS *, int, char **); virtual ~FixLangevinSpin(); int setmask(); void init(); void setup(int); void post_force_respa(int, int, int); void add_tdamping(double spi[3], double fmi[3]); // add transverse damping void add_temperature(double fmi[3]); // add temperature int tdamp_flag, ldamp_flag, temp_flag; // damping and temperature flags protected: double *spi, *fmi; double alpha_t; // transverse mag. damping double dts; // magnetic timestep double temp; // spin bath temperature double D,sigma; // bath intensity var. double gil_factor; // gilbert's prefactor char *id_temp; class Compute *temperature; int nlevels_respa; class RanPark *random; int seed; }; } #endif #endif /* ERROR/WARNING messages: E: Illegal langevin/spin command Self-explanatory. Check the input script syntax and compare to the documentation for the command. You can use -echo screen as a command-line option when running LAMMPS to see the offending line. E: Fix langevin period must be > 0.0 The time window for temperature relaxation must be > 0 W: Energy tally does not account for 'zero yes' The energy removed by using the 'zero yes' flag is not accounted for in the energy tally and thus energy conservation cannot be monitored in this case. E: Variable for fix langevin is invalid style It must be an equal-style variable. E: Cannot zero Langevin force of 0 atoms The group has zero atoms, so you cannot request its force be zeroed. E: Fix langevin variable returned negative temperature Self-explanatory. E: Could not find fix_modify temperature ID The compute ID for computing temperature does not exist. E: Fix_modify temperature ID does not compute temperature The compute ID assigned to the fix must compute temperature. W: Group for fix_modify temp != fix group The fix_modify command is specifying a temperature computation that computes a temperature on a different group of atoms than the fix itself operates on. This is probably not what you want to do. */
/* * Copyright (C) 2008 Texas Instruments, Inc <www.ti.com> * * Based on davinci_dvevm.h. Original Copyrights follow: * * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net> * * SPDX-License-Identifier: GPL-2.0+ */ #ifndef __CONFIG_H #define __CONFIG_H #include <asm/sizes.h> #include <asm/arch/hardware.h> #include <asm/arch/clock.h> /* Architecture, CPU, etc */ #define CONFIG_ARM1176 #define CONFIG_TNETV107X #define CONFIG_TNETV107X_EVM #define CONFIG_TNETV107X_WATCHDOG #define CONFIG_ARCH_CPU_INIT #define CONFIG_SYS_UBOOT_BASE CONFIG_SYS_TEXT_BASE #define CONFIG_DISABLE_TCM #define CONFIG_PERIPORT_REMAP #define CONFIG_PERIPORT_BASE 0x2000000 #define CONFIG_PERIPORT_SIZE 0x10 #define CONFIG_SYS_CLK_FREQ clk_get_rate(TNETV107X_LPSC_ARM) #define CONFIG_SYS_TIMERBASE TNETV107X_TIMER0_BASE #define CONFIG_SYS_HZ_CLOCK clk_get_rate(TNETV107X_LPSC_TIMER0) #define CONFIG_PLL_SYS_EXT_FREQ 25000000 #define CONFIG_PLL_TDM_EXT_FREQ 19200000 #define CONFIG_PLL_ETH_EXT_FREQ 25000000 /* Memory Info */ #define CONFIG_SYS_MALLOC_LEN (0x10000 + 1*1024*1024) #define PHYS_SDRAM_1 TNETV107X_DDR_EMIF_DATA_BASE #define PHYS_SDRAM_1_SIZE 0x04000000 #define CONFIG_SYS_MEMTEST_START PHYS_SDRAM_1 #define CONFIG_SYS_MEMTEST_END (PHYS_SDRAM_1 + 16*1024*1024) #define CONFIG_NR_DRAM_BANKS 1 #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 #define CONFIG_SYS_INIT_RAM_SIZE 0x1000 #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + \ CONFIG_SYS_INIT_RAM_SIZE - \ GENERATED_GBL_DATA_SIZE) /* Serial Driver Info */ #define CONFIG_SYS_NS16550 #define CONFIG_SYS_NS16550_SERIAL #define CONFIG_SYS_NS16550_REG_SIZE -4 #define CONFIG_SYS_NS16550_COM1 TNETV107X_UART1_BASE #define CONFIG_SYS_NS16550_CLK clk_get_rate(TNETV107X_LPSC_UART1) #define CONFIG_CONS_INDEX 1 #define CONFIG_BAUDRATE 115200 /* Flash and environment info */ #define CONFIG_SYS_NO_FLASH #define CONFIG_ENV_IS_IN_NAND #define CONFIG_NAND_DAVINCI #define CONFIG_ENV_SIZE (SZ_128K) #define CONFIG_SYS_NAND_HW_ECC #define CONFIG_SYS_NAND_1BIT_ECC #define CONFIG_SYS_NAND_CS 2 #define CONFIG_SYS_NAND_USE_FLASH_BBT #define CONFIG_SYS_NAND_BASE TNETV107X_ASYNC_EMIF_DATA_CE0_BASE #define CONFIG_SYS_NAND_MASK_CLE 0x10 #define CONFIG_SYS_NAND_MASK_ALE 0x8 #define CONFIG_SYS_MAX_NAND_DEVICE 1 #define CONFIG_MTD_PARTITIONS #define CONFIG_CMD_MTDPARTS #define CONFIG_MTD_DEVICE #define CONFIG_JFFS2_NAND #define CONFIG_ENV_OFFSET 0x180000 /* * davinci_nand is a bit of a misnomer since this particular EMIF block is * commonly used across multiple TI devices. Unfortunately, this misnomer * (amongst others) carries forward into the kernel too. Consequently, if we * use a different device name here, the mtdparts variable won't be usable as * a kernel command-line argument. */ #define MTDIDS_DEFAULT "nand0=davinci_nand.0" #define MTDPARTS_DEFAULT "mtdparts=davinci_nand.0:" \ "1536k(uboot)ro," \ "128k(params)ro," \ "4m(kernel)," \ "-(filesystem)" /* General U-Boot configuration */ #define CONFIG_BOOTFILE "uImage" #define CONFIG_SYS_PROMPT "U-Boot > " #define CONFIG_SYS_CBSIZE 1024 #define CONFIG_SYS_MAXARGS 64 #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE #define CONFIG_VERSION_VARIABLE #define CONFIG_AUTO_COMPLETE #define CONFIG_SYS_HUSH_PARSER #define CONFIG_CMDLINE_EDITING #define CONFIG_SYS_LONGHELP #define CONFIG_CRC32_VERIFY #define CONFIG_MX_CYCLIC #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ sizeof(CONFIG_SYS_PROMPT) + 16) #define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_MEMTEST_START + \ 0x700000) #define LINUX_BOOT_PARAM_ADDR (CONFIG_SYS_MEMTEST_START + 0x100) #define CONFIG_CMDLINE_TAG #define CONFIG_SETUP_MEMORY_TAGS #define CONFIG_BOOTARGS "mem=32M console=ttyS1,115200n8 " \ "root=/dev/mmcblk0p1 rw noinitrd" #define CONFIG_BOOTCOMMAND "" #define CONFIG_BOOTDELAY 1 #define CONFIG_CMD_BDI #define CONFIG_CMD_BOOTD #define CONFIG_CMD_CONSOLE #define CONFIG_CMD_ECHO #define CONFIG_CMD_EDITENV #define CONFIG_CMD_IMI #define CONFIG_CMD_ITEST #define CONFIG_CMD_LOADB #define CONFIG_CMD_LOADS #define CONFIG_CMD_MEMORY #define CONFIG_CMD_MISC #define CONFIG_CMD_RUN #define CONFIG_CMD_SAVEENV #define CONFIG_CMD_SOURCE #define CONFIG_CMD_ENV #define CONFIG_CMD_ASKENV #define CONFIG_CMD_SAVES #define CONFIG_CMD_MEMORY #define CONFIG_CMD_NAND #define CONFIG_CMD_JFFS2 #endif /* __CONFIG_H */
/* <!-- copyright */ /* * aria2 - The high speed download utility * * Copyright (C) 2006 Tatsuhiro Tsujikawa * * 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 * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * You must obey the GNU General Public License in all respects * for all of the code used other than OpenSSL. If you modify * file(s) with this exception, you may extend this exception to your * version of the file(s), but you are not obligated to do so. If you * do not wish to do so, delete this exception statement from your * version. If you delete this exception statement from all source * files in the program, then also delete it here. */ /* copyright --> */ #ifndef D_DHT_PING_TASK_H #define D_DHT_PING_TASK_H #include "DHTAbstractTask.h" #include "a2time.h" namespace aria2 { class DHTPingReplyMessage; class DHTPingTask:public DHTAbstractTask { private: std::shared_ptr<DHTNode> remoteNode_; int numMaxRetry_; int numRetry_; bool pingSuccessful_; std::chrono::seconds timeout_; void addMessage(); public: DHTPingTask(const std::shared_ptr<DHTNode>& remoteNode, int numMaxRetry = 0); virtual ~DHTPingTask(); virtual void startup() CXX11_OVERRIDE; void onReceived(const DHTPingReplyMessage* message); void onTimeout(const std::shared_ptr<DHTNode>& node); void setTimeout(std::chrono::seconds timeout) { timeout_ = std::move(timeout); } bool isPingSuccessful() const; }; } // namespace aria2 #endif // D_DHT_PING_TASK_H
#ifndef __INCLUDE_LINUX_OOM_H #define __INCLUDE_LINUX_OOM_H /* * /proc/<pid>/oom_adj is deprecated, see * Documentation/feature-removal-schedule.txt. * * /proc/<pid>/oom_adj set to -17 protects from the oom-killer */ #define OOM_DISABLE (-17) /* inclusive */ #define OOM_ADJUST_MIN (-16) #define OOM_ADJUST_MAX 15 /* * /proc/<pid>/oom_score_adj set to OOM_SCORE_ADJ_MIN disables oom killing for * pid. */ #define OOM_SCORE_ADJ_MIN (-1000) #define OOM_SCORE_ADJ_MAX 1000 #ifdef __KERNEL__ #include <linux/sched.h> #include <linux/types.h> #include <linux/nodemask.h> struct zonelist; struct notifier_block; struct mem_cgroup; struct task_struct; /* * Types of limitations to the nodes from which allocations may occur */ enum oom_constraint { CONSTRAINT_NONE, CONSTRAINT_CPUSET, CONSTRAINT_MEMORY_POLICY, CONSTRAINT_MEMCG, }; extern void compare_swap_oom_score_adj(short old_val, short new_val); extern short test_set_oom_score_adj(short new_val); extern unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *memcg, const nodemask_t *nodemask, unsigned long totalpages); extern int oom_kills_count(void); extern void note_oom_kill(void); extern int try_set_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order, nodemask_t *mask, bool force_kill); extern int register_oom_notifier(struct notifier_block *nb); extern int unregister_oom_notifier(struct notifier_block *nb); extern bool oom_killer_disabled; static inline void oom_killer_disable(void) { oom_killer_disabled = true; } static inline void oom_killer_enable(void) { oom_killer_disabled = false; } extern struct task_struct *find_lock_task_mm(struct task_struct *p); extern void dump_tasks(const struct mem_cgroup *memcg, const nodemask_t *nodemask); /* sysctls */ extern int sysctl_oom_dump_tasks; extern int sysctl_oom_kill_allocating_task; extern int sysctl_panic_on_oom; #endif /* __KERNEL__*/ #endif /* _INCLUDE_LINUX_OOM_H */
/*------------------------------------------------------------------------- tanf.c - Computes tan(x) where x is a 32-bit float. Copyright (C) 2001, 2002, Jesus Calvino-Fraga, jesusc@ieee.org This library 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 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this library; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. As a special exception, if you link this library with other files, some of which are compiled with SDCC, to produce an executable, this library does not by itself cause the resulting executable to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the executable file might be covered by the GNU General Public License. -------------------------------------------------------------------------*/ /* Version 1.0 - Initial release */ #include <math.h> #include <stdbool.h> float tancotf(const float x, const bool iscotan); float tanf(const float x) _FLOAT_FUNC_REENTRANT { return tancotf(x, 0); }
/* * File : application.c * This file is part of RT-Thread RTOS * COPYRIGHT (C) 2012, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes * 2012-02-13 mojingxian first version */ #ifndef __APPLICATION_H__ #define __APPLICATION_H__ #ifdef __cplusplus extern "C" { #endif void rt_application_init(void); #ifdef __cplusplus } #endif #endif /* __APPLICATION_H__ */
/* * PowerPC machine specifics */ #ifndef _PPC_MACHINE_H_ #define _PPC_MACHINE_H_ /* Bit encodings for Machine State Register (MSR) */ #define MSR_POW (1<<18) /* Enable Power Management */ #define MSR_TGPR (1<<17) /* TLB Update registers in use */ #define MSR_ILE (1<<16) /* Interrupt Little-Endian enable */ #define MSR_EE (1<<15) /* External Interrupt enable */ #define MSR_PR (1<<14) /* Supervisor/User privilege */ #define MSR_FP (1<<13) /* Floating Point enable */ #define MSR_ME (1<<12) /* Machine Check enable */ #define MSR_FE0 (1<<11) /* Floating Exception mode 0 */ #define MSR_SE (1<<10) /* Single Step */ #define MSR_BE (1<<9) /* Branch Trace */ #define MSR_FE1 (1<<8) /* Floating Exception mode 1 */ #define MSR_IP (1<<6) /* Exception prefix 0x000/0xFFF */ #define MSR_IR (1<<5) /* Instruction MMU enable */ #define MSR_DR (1<<4) /* Data MMU enable */ #define MSR_RI (1<<1) /* Recoverable Exception */ #define MSR_LE (1<<0) /* Little-Endian enable */ #define MSR_ MSR_FP|MSR_FE0|MSR_FE1|MSR_ME #define MSR_USER MSR_|MSR_PR|MSR_EE|MSR_IR|MSR_DR /* Bit encodings for Hardware Implementation Register (HID0) */ #define HID0_EMCP (1<<31) /* Enable Machine Check pin */ #define HID0_EBA (1<<29) /* Enable Bus Address Parity */ #define HID0_EBD (1<<28) /* Enable Bus Data Parity */ #define HID0_SBCLK (1<<27) #define HID0_EICE (1<<26) #define HID0_ECLK (1<<25) #define HID0_PAR (1<<24) #define HID0_DOZE (1<<23) #define HID0_NAP (1<<22) #define HID0_SLEEP (1<<21) #define HID0_DPM (1<<20) #define HID0_ICE (1<<15) /* Instruction Cache Enable */ #define HID0_DCE (1<<14) /* Data Cache Enable */ #define HID0_ILOCK (1<<13) /* Instruction Cache Lock */ #define HID0_DLOCK (1<<12) /* Data Cache Lock */ #define HID0_ICFI (1<<11) /* Instruction Cache Flash Invalidate */ #define HID0_DCI (1<<10) /* Data Cache Invalidate */ #define HID0_SIED (1<<7) /* Serial Instruction Execution [Disable] */ #define HID0_BHTE (1<<2) /* Branch History Table Enable */ #endif
/* * Mesa 3-D graphics library * Version: 7.2 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * * 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 * BRIAN PAUL 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. * * Authors: * Keith Whitwell <keith@tungstengraphics.com> */ #include <precomp.h> #if FEATURE_dlist static void vbo_save_callback_init( struct gl_context *ctx ) { ctx->Driver.NewList = vbo_save_NewList; ctx->Driver.EndList = vbo_save_EndList; ctx->Driver.SaveFlushVertices = vbo_save_SaveFlushVertices; ctx->Driver.BeginCallList = vbo_save_BeginCallList; ctx->Driver.EndCallList = vbo_save_EndCallList; ctx->Driver.NotifySaveBegin = vbo_save_NotifyBegin; } void vbo_save_init( struct gl_context *ctx ) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_save_context *save = &vbo->save; save->ctx = ctx; vbo_save_api_init( save ); vbo_save_callback_init(ctx); { struct gl_client_array *arrays = save->arrays; unsigned i; memcpy(arrays, vbo->currval, VBO_ATTRIB_MAX * sizeof(arrays[0])); for (i = 0; i < VBO_ATTRIB_MAX; ++i) { struct gl_client_array *array; array = &arrays[i]; array->BufferObj = NULL; _mesa_reference_buffer_object(ctx, &arrays->BufferObj, vbo->currval[i].BufferObj); } } ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; } void vbo_save_destroy( struct gl_context *ctx ) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_save_context *save = &vbo->save; GLuint i; if (save->prim_store) { if ( --save->prim_store->refcount == 0 ) { FREE( save->prim_store ); save->prim_store = NULL; } if ( --save->vertex_store->refcount == 0 ) { _mesa_reference_buffer_object(ctx, &save->vertex_store->bufferobj, NULL); FREE( save->vertex_store ); save->vertex_store = NULL; } } for (i = 0; i < VBO_ATTRIB_MAX; i++) { _mesa_reference_buffer_object(ctx, &save->arrays[i].BufferObj, NULL); } } /* Note that this can occur during the playback of a display list: */ void vbo_save_fallback( struct gl_context *ctx, GLboolean fallback ) { struct vbo_save_context *save = &vbo_context(ctx)->save; if (fallback) save->replay_flags |= VBO_SAVE_FALLBACK; else save->replay_flags &= ~VBO_SAVE_FALLBACK; } #endif /* FEATURE_dlist */
/* * Copyright (C) 2011-2013 Andreas Steffen * HSR Hochschule fuer Technik Rapperswil * * 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. See <http://www.fsf.org/copyleft/gpl.txt>. * * 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. */ /** * @defgroup tnccs_dynamic_h tnccs_dynamic * @{ @ingroup tnccs_dynamic */ #ifndef TNCCS_DYNAMIC_H_ #define TNCCS_DYNAMIC_H_ #include <library.h> #include <tnc/tnccs/tnccs.h> /** * Create an instance of a dynamic TNC IF-TNCCS protocol handler. * * @param is_server TRUE to act as TNC Server, FALSE for TNC Client * @param server Server identity * @param peer Client identity * @param transport Underlying IF-T transport protocol * @param cb Callback function if TNC Server, NULL if TNC Client * @return dynamic TNC IF-TNCCS protocol stack */ tnccs_t* tnccs_dynamic_create(bool is_server, identification_t *server, identification_t *peer, tnc_ift_type_t transport, tnccs_cb_t cb); #endif /** TNCCS_DYNAMIC_H_ @}*/
#ifndef _GNU_SOURCE # define _GNU_SOURCE #endif #include <glib.h> #include <asm/unistd.h> #include <errno.h> #include <unistd.h> #include <fcntl.h> #include "sysfuzz.h" #include "typelib.h" #include "iknowthis.h" // Unimplemented system call. SYSFUZZ(break, __NR_break, SYS_FAIL | SYS_BORING | SYS_SAFE, CLONE_DEFAULT, 0) { gint retcode; // Execute systemcall. retcode = spawn_syscall_lwp(this, NULL,__NR_break); // These system calls always return -1 and set errno to ENOSYS. g_assert_cmpuint(retcode, ==, ENOSYS); return retcode; }
/* This file is part of p4est. p4est is a C library to manage a collection (a forest) of multiple connected adaptive quadtrees or octrees in parallel. Copyright (C) 2010 The University of Texas System Additional copyright (C) 2011 individual authors Written by Carsten Burstedde, Lucas C. Wilcox, and Tobin Isaac p4est 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. p4est 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 p4est; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef P4_TO_P8 #include <p4est_connectivity.h> #include <p4est_ghost.h> #include <p4est_lnodes.h> #else #include <p8est_connectivity.h> #include <p8est_ghost.h> #include <p8est_lnodes.h> #endif static void test_the_p4est (p4est_connectivity_t * conn, int N) { p4est_t *p4est; p4est_ghost_t *ghost; p4est_lnodes_t *lnodes; p4est = p4est_new (sc_MPI_COMM_WORLD, conn, 0, NULL, NULL); ghost = p4est_ghost_new (p4est, P4EST_CONNECT_FULL); lnodes = p4est_lnodes_new (p4est, ghost, N); p4est_lnodes_destroy (lnodes); p4est_ghost_destroy (ghost); p4est_destroy (p4est); } static void test_complete (p4est_connectivity_t * conn, const char *which, int test_p4est) { SC_GLOBAL_INFOF ("Testing standard connectivity %s\n", which); SC_CHECK_ABORTF (p4est_connectivity_is_valid (conn), "Invalid connectivity %s before completion", which); if (0 && test_p4est) { test_the_p4est (conn, 3); } SC_GLOBAL_INFOF ("Testing completion for connectivity %s\n", which); p4est_connectivity_complete (conn); SC_CHECK_ABORTF (p4est_connectivity_is_valid (conn), "Invalid connectivity %s after completion", which); if (test_p4est) { test_the_p4est (conn, 3); } p4est_connectivity_destroy (conn); } int main (int argc, char **argv) { int mpiret; mpiret = sc_MPI_Init (&argc, &argv); SC_CHECK_MPI (mpiret); sc_init (sc_MPI_COMM_WORLD, 1, 1, NULL, SC_LP_DEFAULT); p4est_init (NULL, SC_LP_DEFAULT); #ifndef P4_TO_P8 test_complete (p4est_connectivity_new_unitsquare (), "unitsquare", 1); test_complete (p4est_connectivity_new_periodic (), "2D periodic", 0); test_complete (p4est_connectivity_new_rotwrap (), "rotwrap", 0); test_complete (p4est_connectivity_new_corner (), "corner", 1); test_complete (p4est_connectivity_new_moebius (), "moebius", 1); test_complete (p4est_connectivity_new_star (), "star", 1); test_complete (p4est_connectivity_new_brick (3, 18, 0, 1), "2D periodic brick", 0); test_complete (p4est_connectivity_new_brick (3, 18, 0, 0), "2D brick", 1); #else test_complete (p8est_connectivity_new_unitcube (), "unitcube", 1); test_complete (p8est_connectivity_new_periodic (), "3D periodic", 0); test_complete (p8est_connectivity_new_rotwrap (), "rotwrap", 0); test_complete (p8est_connectivity_new_twowrap (), "twowrap", 1); test_complete (p8est_connectivity_new_twocubes (), "twocubes", 1); test_complete (p8est_connectivity_new_rotcubes (), "rotcubes", 1); test_complete (p8est_connectivity_new_brick (3, 2, 8, 1, 0, 1), "3D periodic brick", 0); test_complete (p8est_connectivity_new_brick (3, 2, 8, 0, 0, 0), "3D brick", 1); #endif sc_finalize (); mpiret = sc_MPI_Finalize (); SC_CHECK_MPI (mpiret); return 0; }
/* * debug.c * * Created on: Jan 31, 2014 * Author: david_s5 */ #include <stdio.h> #include <stdint.h> #include <stdarg.h> #include <string.h> #include "config.h" #include "spark_macros.h" #include "debug.h" #include "timer_hal.h" LoggerOutputLevel log_level_at_run_time = LOG_LEVEL_AT_RUN_TIME; debug_output_fn debug_output_; void set_logger_output(debug_output_fn output, LoggerOutputLevel level) { if (output) debug_output_ = output; if (level==DEFAULT_LEVEL) level = LOG_LEVEL_AT_RUN_TIME; log_level_at_run_time = level; } void log_print_(int level, int line, const char *func, const char *file, const char *msg, ...) { if (level<log_level_at_run_time || !debug_output_) return; char _buffer[MAX_DEBUG_MESSAGE_LENGTH]; static char * levels[] = { "", "LOG ", "DEBUG", "INFO ", "WARN ", "ERROR", "PANIC", }; va_list args; va_start(args, msg); file = file ? strrchr(file,'/') + 1 : ""; int trunc = snprintf(_buffer, arraySize(_buffer), "%010u:%s: %s %s(%d):", (unsigned)HAL_Timer_Get_Milli_Seconds(), levels[level/10], func, file, line); debug_output_(_buffer); if (trunc > arraySize(_buffer)) { debug_output_("..."); } trunc = vsnprintf(_buffer,arraySize(_buffer), msg, args); debug_output_(_buffer); if (trunc > arraySize(_buffer)) { debug_output_("..."); } debug_output_("\r\n"); va_end(args); } void log_print_direct_(int level, void* reserved, const char *msg, ...) { if (level<log_level_at_run_time || !debug_output_) return; char _buffer[MAX_DEBUG_MESSAGE_LENGTH]; va_list args; va_start(args, msg); int trunc = vsnprintf(_buffer, arraySize(_buffer), msg, args); debug_output_(_buffer); if (trunc > arraySize(_buffer)) { debug_output_("..."); } va_end(args); } void log_direct_(const char* s) { if (LOG_LEVEL<log_level_at_run_time || !debug_output_) return; debug_output_(s); } int log_level_active(LoggerOutputLevel level, void* reserved) { return (level>=log_level_at_run_time && debug_output_); }
/*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at https://curl.haxx.se/docs/copyright.html. * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ***************************************************************************/ #include "test.h" #include "memdebug.h" static const char *post[]={ "one", "two", "three", "and a final longer crap: four", NULL }; struct WriteThis { int counter; }; static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp) { struct WriteThis *pooh = (struct WriteThis *)userp; const char *data; if(size*nmemb < 1) return 0; data = post[pooh->counter]; if(data) { size_t len = strlen(data); memcpy(ptr, data, len); pooh->counter++; /* advance pointer */ return len; } return 0; /* no more data left to deliver */ } int test(char *URL) { CURL *curl; CURLcode res=CURLE_OK; struct curl_slist *slist = NULL; struct WriteThis pooh; pooh.counter = 0; if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } curl = curl_easy_init(); if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; } slist = curl_slist_append(slist, "Transfer-Encoding: chunked"); if(slist == NULL) { fprintf(stderr, "curl_slist_append() failed\n"); curl_easy_cleanup(curl); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; } /* First set the URL that is about to receive our POST. */ test_setopt(curl, CURLOPT_URL, URL); /* Now specify we want to POST data */ test_setopt(curl, CURLOPT_POST, 1L); #ifdef CURL_DOES_CONVERSIONS /* Convert the POST data to ASCII */ test_setopt(curl, CURLOPT_TRANSFERTEXT, 1L); #endif /* we want to use our own read function */ test_setopt(curl, CURLOPT_READFUNCTION, read_callback); /* pointer to pass to our read function */ test_setopt(curl, CURLOPT_READDATA, &pooh); /* get verbose debug output please */ test_setopt(curl, CURLOPT_VERBOSE, 1L); /* include headers in the output */ test_setopt(curl, CURLOPT_HEADER, 1L); /* enforce chunked transfer by setting the header */ test_setopt(curl, CURLOPT_HTTPHEADER, slist); #ifdef LIB565 test_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_DIGEST); test_setopt(curl, CURLOPT_USERPWD, "foo:bar"); #endif /* Perform the request, res will get the return code */ res = curl_easy_perform(curl); test_cleanup: /* clean up the headers list */ if(slist) curl_slist_free_all(slist); /* always cleanup */ curl_easy_cleanup(curl); curl_global_cleanup(); return res; }
/***************************************************************************** * * PROJECT: Multi Theft Auto v1.0 * (Shared logic for modifications) * LICENSE: See LICENSE in the top level directory * FILE: mods/shared_logic/CClientPickupManager.h * PURPOSE: Pickup entity manager class header * DEVELOPERS: Christian Myhre Lundheim <> * Jax <> * *****************************************************************************/ class CClientPickupManager; #ifndef __CCLIENTPICKUPMANAGER_H #define __CCLIENTPICKUPMANAGER_H #include "CClientManager.h" #include "CClientPickup.h" #include <list> class CClientPickupManager { friend class CClientManager; friend class CClientPickup; public: inline unsigned int Count ( void ) { return static_cast < unsigned int > ( m_List.size () ); }; static CClientPickup* Get ( ElementID ID ); void DeleteAll ( void ); bool Exists ( CClientPickup* pPickup ); inline std::list < CClientPickup* > ::const_iterator IterBegin ( void ) { return m_List.begin (); }; inline std::list < CClientPickup* > ::const_iterator IterEnd ( void ) { return m_List.end (); }; inline bool IsPickupProcessingDisabled ( void ) { return m_bPickupProcessingDisabled; }; void SetPickupProcessingDisabled ( bool bDisabled ); static bool IsValidPickupID ( unsigned short usPickupID ); static bool IsValidWeaponID ( unsigned short usWeaponID ); static unsigned short GetWeaponModel ( unsigned int uiWeaponID ); inline static unsigned short GetHealthModel ( void ) { return 1240; }; inline static unsigned short GetArmorModel ( void ) { return 1242; }; static bool IsPickupLimitReached ( void ); private: CClientPickupManager ( CClientManager* pManager ); ~CClientPickupManager ( void ); void RemoveFromList ( CClientPickup* pPickup ); CClientManager* m_pManager; std::list < CClientPickup* > m_List; bool m_bDontRemoveFromList; bool m_bPickupProcessingDisabled; static unsigned int m_uiPickupCount; }; #endif
/* * Copyright (C) 2005-2011 MaNGOS <http://www.getmangos.com/> * * Copyright (C) 2008-2011 Trinity <http://www.trinitycore.org/> * * Copyright (C) 2010-2011 Project SkyFire <http://www.projectskyfire.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef SC_SIMPLEAI_H #define SC_SIMPLEAI_H enum CastTarget { CAST_SELF = 0, //Self cast CAST_HOSTILE_TARGET, //Our current target (ie: highest aggro) CAST_HOSTILE_SECOND_AGGRO, //Second highest aggro (generaly used for cleaves and some special attacks) CAST_HOSTILE_LAST_AGGRO, //Dead last on aggro (no idea what this could be used for) CAST_HOSTILE_RANDOM, //Just any random target on our threat list CAST_FRIENDLY_RANDOM, //NOT YET IMPLEMENTED //Special cases CAST_KILLEDUNIT_VICTIM, //Only works within KilledUnit function CAST_JUSTDIED_KILLER, //Only works within JustDied function }; #define MAX_SIMPLEAI_SPELLS 10 struct SimpleAI : public ScriptedAI { SimpleAI(Creature *c);// : ScriptedAI(c); void Reset(); void EnterCombat(Unit * /*who*/); void KilledUnit(Unit * /*victim*/); void DamageTaken(Unit *killer, uint32 &damage); void UpdateAI(const uint32 diff); public: int32 Aggro_TextId[3]; uint32 Aggro_Sound[3]; int32 Death_TextId[3]; uint32 Death_Sound[3]; uint32 Death_Spell; uint32 Death_Target_Type; int32 Kill_TextId[3]; uint32 Kill_Sound[3]; uint32 Kill_Spell; uint32 Kill_Target_Type; struct SimpleAI_Spell { uint32 Spell_Id; //Spell ID to cast int32 First_Cast; //Delay for first cast uint32 Cooldown; //Cooldown between casts uint32 CooldownRandomAddition; //Random addition to cooldown (in range from 0 - CooldownRandomAddition) uint32 Cast_Target_Type; //Target type (note that certain spells may ignore this) bool InterruptPreviousCast; //Interrupt a previous cast if this spell needs to be cast bool Enabled; //Spell enabled or disabled (default: false) //3 texts to many? int32 TextId[3]; uint32 Text_Sound[3]; }Spell[MAX_SIMPLEAI_SPELLS]; protected: uint32 Spell_Timer[MAX_SIMPLEAI_SPELLS]; }; #endif
#ifndef CONFIGHELPER_H #define CONFIGHELPER_H #include <QtCore> #include <QtGui> #ifdef QT5 #include <QtWidgets> #endif /* This file allows to avoid writing bothersome code in order to make GUI config windows. Just generate a ConfigForm and add the corresponding ConfigHelper, and the variables will be modified internally automatically when the user plays with the GUI. */ class AbstractConfigHelper; class ConfigForm : public QObject { Q_OBJECT public: ConfigForm(const QString &button1, const QString &button2, QObject*parent=NULL); ~ConfigForm(); QWidget* generateConfigWidget(); void addConfigHelper(AbstractConfigHelper *helper); public slots: void applyVals(); signals: void button1(); void button2(); private: QList<AbstractConfigHelper *> helpers; QString button1S, button2S; }; class AbstractConfigHelper { public: AbstractConfigHelper(const QString &desc = ""); virtual ~AbstractConfigHelper(){} QWidget * generateConfigWidget(); virtual void updateVal(){} protected: QString description; QWidget* internalWidget; private: virtual QWidget *getInternalWidget() {return NULL;} }; template <class T> class ConfigHelper : public AbstractConfigHelper { public: ConfigHelper(const QString &desc, T &var); protected: T &var; }; /* Creates a combobox. You must also specify the values, of type T, that correspond to the different labels in the combobox */ template <class T> class ConfigCombo : public ConfigHelper<T> { public: ConfigCombo(const QString &desc, T &var, const QStringList &labels, const QList<T> &values); void updateVal(); private: QStringList labels; QList<T> values; virtual QWidget *getInternalWidget(); }; /* Creates a SpinBox */ class ConfigSpin : public ConfigHelper<int> { public: ConfigSpin(const QString &desc, int &var, int min, int max); void updateVal(); private: int min, max; virtual QWidget *getInternalWidget(); }; /* Creates a line edit */ class ConfigLine : public ConfigHelper<QString> { public: ConfigLine(const QString &desc, QString &var); void updateVal(); private: virtual QWidget *getInternalWidget(); }; /* Creates a text edit */ class ConfigText : public ConfigHelper<QString> { public: ConfigText(const QString &desc, QString &var); void updateVal(); private: virtual QWidget *getInternalWidget(); }; /* Creates a QCheckBox */ class ConfigCheck : public ConfigHelper<bool> { public: ConfigCheck(const QString &desc, bool &var); void updateVal(); private: QString checkBoxText; virtual QWidget *getInternalWidget(); }; /* Finds a file path */ class ConfigFile : public QObject, public ConfigHelper<QString> { Q_OBJECT public: ConfigFile(const QString &desc, QString &path); void updateVal(); public slots: void findPath(); private: QString path; virtual QWidget *getInternalWidget(); QLineEdit *edit; }; /* Slider */ class ConfigSlider : public ConfigHelper<int> { public: ConfigSlider(const QString &desc, int &var, int min=0, int max=100); void updateVal(); private: int min, max; virtual QWidget *getInternalWidget(); }; template<class T> ConfigHelper<T>::ConfigHelper(const QString &desc, T &var) : AbstractConfigHelper(desc), var(var) { } template<class T> ConfigCombo<T>::ConfigCombo(const QString &desc, T &var, const QStringList &labels, const QList<T> &values) : ConfigHelper<T>(desc, var), labels(labels), values(values) { } template<class T> QWidget *ConfigCombo<T>::getInternalWidget() { QComboBox *ret = new QComboBox(); ret->addItems(labels); for (int i = 0; i < values.size(); i++) { if (values[i] == ConfigHelper<T>::var) { ret->setCurrentIndex(i); break; } } return ret; } template<class T> void ConfigCombo<T>::updateVal() { int index = ((QComboBox*)(ConfigHelper<T>::internalWidget))->currentIndex(); if (index >= 0 && index < values.size()) { ConfigHelper<T>::var = values[index]; } } #endif // CONFIGHELPER_H
/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL21$ ** 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 The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** As a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QDECLARATIVELISTMODEL_H #define QDECLARATIVELISTMODEL_H #include <qdeclarative.h> #include <private/qdeclarativecustomparser_p.h> #include <QtCore/QObject> #include <QtCore/QStringList> #include <QtCore/QHash> #include <QtCore/QList> #include <QtCore/QVariant> #include <private/qlistmodelinterface_p.h> #include <QtScript/qscriptvalue.h> QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class FlatListModel; class NestedListModel; class QDeclarativeListModelWorkerAgent; struct ModelNode; class FlatListScriptClass; class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeListModel : public QListModelInterface { Q_OBJECT Q_PROPERTY(int count READ count NOTIFY countChanged) public: QDeclarativeListModel(QObject *parent=0); ~QDeclarativeListModel(); virtual QList<int> roles() const; virtual QString toString(int role) const; virtual int count() const; virtual QVariant data(int index, int role) const; Q_INVOKABLE void clear(); Q_INVOKABLE void remove(int index); Q_INVOKABLE void append(const QScriptValue&); Q_INVOKABLE void insert(int index, const QScriptValue&); Q_INVOKABLE QScriptValue get(int index) const; Q_INVOKABLE void set(int index, const QScriptValue&); Q_INVOKABLE void setProperty(int index, const QString& property, const QVariant& value); Q_INVOKABLE void move(int from, int to, int count); Q_INVOKABLE void sync(); QDeclarativeListModelWorkerAgent *agent(); Q_SIGNALS: void countChanged(); private: friend class QDeclarativeListModelParser; friend class QDeclarativeListModelWorkerAgent; friend class FlatListModel; friend class FlatListScriptClass; friend struct ModelNode; // Constructs a flat list model for a worker agent QDeclarativeListModel(const QDeclarativeListModel *orig, QDeclarativeListModelWorkerAgent *parent); void set(int index, const QScriptValue&, QList<int> *roles); void setProperty(int index, const QString& property, const QVariant& value, QList<int> *roles); bool flatten(); bool inWorkerThread() const; inline bool canMove(int from, int to, int n) const { return !(from+n > count() || to+n > count() || from < 0 || to < 0 || n < 0); } QDeclarativeListModelWorkerAgent *m_agent; NestedListModel *m_nested; FlatListModel *m_flat; }; // ### FIXME class QDeclarativeListElement : public QObject { Q_OBJECT }; class QDeclarativeListModelParser : public QDeclarativeCustomParser { public: QByteArray compile(const QList<QDeclarativeCustomParserProperty> &); void setCustomData(QObject *, const QByteArray &); private: struct ListInstruction { enum { Push, Pop, Value, Set } type; int dataIdx; }; struct ListModelData { int dataOffset; int instrCount; ListInstruction *instructions() const; }; bool compileProperty(const QDeclarativeCustomParserProperty &prop, QList<ListInstruction> &instr, QByteArray &data); bool definesEmptyList(const QString &); QByteArray listElementTypeName; }; QT_END_NAMESPACE QML_DECLARE_TYPE(QDeclarativeListModel) QML_DECLARE_TYPE(QDeclarativeListElement) #endif // QDECLARATIVELISTMODEL_H
/* $Id$ * * Copyright 2010 Anders Wallin (anders.e.e.wallin "at" gmail.com) * * This file is part of OpenCAMlib. * * OpenCAMlib 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. * * OpenCAMlib 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 OpenCAMlib. If not, see <http://www.gnu.org/licenses/>. */ #ifndef VOLUME_WRAP_H #define VOLUME_WRAP_H #include <boost/python.hpp> #include "volume.h" namespace ocl { /* required wrapper class for virtual functions in boost-python */ /// \brief a wrapper around OCTVolume required for boost-python class OCTVolumeWrap : public OCTVolume, public boost::python::wrapper<OCTVolume> { public: bool isInside(Point &p) const { return this->get_override("isInside")(p); } }; } // end namespace #endif // end file volume_wrap.h
//===- MIParser.h - Machine Instructions Parser ---------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file declares the function that parses the machine instructions. // //===----------------------------------------------------------------------===// #ifndef LLVM_LIB_CODEGEN_MIRPARSER_MIPARSER_H #define LLVM_LIB_CODEGEN_MIRPARSER_MIPARSER_H #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallSet.h" namespace llvm { class StringRef; class BasicBlock; class MachineBasicBlock; class MachineFunction; class MachineInstr; class MachineRegisterInfo; class MDNode; class RegisterBank; struct SlotMapping; class SMDiagnostic; class SourceMgr; class TargetRegisterClass; struct VRegInfo { enum uint8_t { UNKNOWN, NORMAL, GENERIC, REGBANK } Kind = UNKNOWN; bool Explicit = false; ///< VReg was explicitly specified in the .mir file. union { const TargetRegisterClass *RC; const RegisterBank *RegBank; } D; unsigned VReg; unsigned PreferredReg = 0; }; typedef StringMap<const TargetRegisterClass*> Name2RegClassMap; typedef StringMap<const RegisterBank*> Name2RegBankMap; struct PerFunctionMIParsingState { BumpPtrAllocator Allocator; MachineFunction &MF; SourceMgr *SM; const SlotMapping &IRSlots; const Name2RegClassMap &Names2RegClasses; const Name2RegBankMap &Names2RegBanks; DenseMap<unsigned, MachineBasicBlock *> MBBSlots; DenseMap<unsigned, VRegInfo*> VRegInfos; DenseMap<unsigned, int> FixedStackObjectSlots; DenseMap<unsigned, int> StackObjectSlots; DenseMap<unsigned, unsigned> ConstantPoolSlots; DenseMap<unsigned, unsigned> JumpTableSlots; PerFunctionMIParsingState(MachineFunction &MF, SourceMgr &SM, const SlotMapping &IRSlots, const Name2RegClassMap &Names2RegClasses, const Name2RegBankMap &Names2RegBanks); VRegInfo &getVRegInfo(unsigned VReg); }; /// Parse the machine basic block definitions, and skip the machine /// instructions. /// /// This function runs the first parsing pass on the machine function's body. /// It parses only the machine basic block definitions and creates the machine /// basic blocks in the given machine function. /// /// The machine instructions aren't parsed during the first pass because all /// the machine basic blocks aren't defined yet - this makes it impossible to /// resolve the machine basic block references. /// /// Return true if an error occurred. bool parseMachineBasicBlockDefinitions(PerFunctionMIParsingState &PFS, StringRef Src, SMDiagnostic &Error); /// Parse the machine instructions. /// /// This function runs the second parsing pass on the machine function's body. /// It skips the machine basic block definitions and parses only the machine /// instructions and basic block attributes like liveins and successors. /// /// The second parsing pass assumes that the first parsing pass already ran /// on the given source string. /// /// Return true if an error occurred. bool parseMachineInstructions(PerFunctionMIParsingState &PFS, StringRef Src, SMDiagnostic &Error); bool parseMBBReference(PerFunctionMIParsingState &PFS, MachineBasicBlock *&MBB, StringRef Src, SMDiagnostic &Error); bool parseRegisterReference(PerFunctionMIParsingState &PFS, unsigned &Reg, StringRef Src, SMDiagnostic &Error); bool parseNamedRegisterReference(PerFunctionMIParsingState &PFS, unsigned &Reg, StringRef Src, SMDiagnostic &Error); bool parseVirtualRegisterReference(PerFunctionMIParsingState &PFS, VRegInfo *&Info, StringRef Src, SMDiagnostic &Error); bool parseStackObjectReference(PerFunctionMIParsingState &PFS, int &FI, StringRef Src, SMDiagnostic &Error); bool parseMDNode(PerFunctionMIParsingState &PFS, MDNode *&Node, StringRef Src, SMDiagnostic &Error); } // end namespace llvm #endif
// *** Hardwarespecific defines *** #define __cbi(reg, bitmask) (*(reg + 1)) = bitmask #define __sbi(reg, bitmask) (*(reg + 2)) = bitmask #define pulseClock digitalWrite(SCK_Pin, LOW); digitalWrite(SCK_Pin, HIGH) #define fontbyte(x) cfont.font[x] #define bitmapbyte(x) bitmap[x] #define PROGMEM #define bitmapdatatype unsigned char* #if !defined(_UP_MCU_) #if defined(__32MX320F128H__) #define SDA 18 // A4 (Remeber to set the jumper correctly) #define SCL 19 // A5 (Remeber to set the jumper correctly) #elif defined(__32MX340F512H__) #define SDA 18 // A4 (Remeber to set the jumper correctly) #define SCL 19 // A5 (Remeber to set the jumper correctly) #elif defined(__32MX795F512L__) #define SDA 20 // Digital 20 #define SCL 21 // Digital 21 #else #error "Unsupported PIC32 MCU!" #endif #endif #ifndef TWI_FREQ #define TWI_FREQ 400000L #endif
#import "MWMTableViewCell.h" @interface MWMSearchShowOnMapCell : MWMTableViewCell + (CGFloat)cellHeight; @end
// Copyright 2016 The Draco Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #ifndef DRACO_COMPRESSION_CONFIG_ENCODER_OPTIONS_H_ #define DRACO_COMPRESSION_CONFIG_ENCODER_OPTIONS_H_ #include "draco/attributes/geometry_attribute.h" #include "draco/compression/config/draco_options.h" #include "draco/compression/config/encoding_features.h" #include "draco/draco_features.h" namespace draco { // EncoderOptions allow users to specify so called feature options that are used // to inform the encoder which encoding features can be used (i.e. which // features are going to be available to the decoder). template <typename AttributeKeyT> class EncoderOptionsBase : public DracoOptions<AttributeKeyT> { public: static EncoderOptionsBase CreateDefaultOptions() { EncoderOptionsBase options; #ifdef DRACO_STANDARD_EDGEBREAKER_SUPPORTED options.SetSupportedFeature(features::kEdgebreaker, true); #endif #ifdef DRACO_PREDICTIVE_EDGEBREAKER_SUPPORTED options.SetSupportedFeature(features::kPredictiveEdgebreaker, true); #endif return options; } static EncoderOptionsBase CreateEmptyOptions() { return EncoderOptionsBase(); } // Returns speed options with default value of 5. int GetEncodingSpeed() const { return this->GetGlobalInt("encoding_speed", 5); } int GetDecodingSpeed() const { return this->GetGlobalInt("decoding_speed", 5); } // Returns the maximum speed for both encoding/decoding. int GetSpeed() const { const int encoding_speed = this->GetGlobalInt("encoding_speed", -1); const int decoding_speed = this->GetGlobalInt("decoding_speed", -1); const int max_speed = std::max(encoding_speed, decoding_speed); if (max_speed == -1) { return 5; // Default value. } return max_speed; } void SetSpeed(int encoding_speed, int decoding_speed) { this->SetGlobalInt("encoding_speed", encoding_speed); this->SetGlobalInt("decoding_speed", decoding_speed); } // Sets a given feature as supported or unsupported by the target decoder. // Encoder will always use only supported features when encoding the input // geometry. void SetSupportedFeature(const std::string &name, bool supported) { feature_options_.SetBool(name, supported); } bool IsFeatureSupported(const std::string &name) const { return feature_options_.GetBool(name); } void SetFeatureOptions(const Options &options) { feature_options_ = options; } const Options &GetFeaturelOptions() const { return feature_options_; } private: // Use helper methods to construct the encoder options. // See CreateDefaultOptions(); EncoderOptionsBase() {} // List of supported/unsupported features that can be used by the encoder. Options feature_options_; }; // Encoder options where attributes are identified by their attribute id. // Used to set options that are specific to a given geometry. typedef EncoderOptionsBase<int32_t> EncoderOptions; } // namespace draco #endif // DRACO_COMPRESSION_CONFIG_ENCODER_OPTIONS_H_
/* $NetBSD: tprintf.h,v 1.18 2011/11/21 04:36:06 christos Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University 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 REGENTS 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 REGENTS 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. * * @(#)tprintf.h 8.1 (Berkeley) 6/2/93 */ #ifndef _SYS_TPRINTF_H_ #define _SYS_TPRINTF_H_ typedef struct session *tpr_t; tpr_t tprintf_open(struct proc *); void tprintf_close(tpr_t); void tprintf(tpr_t, const char *fmt, ...) __printflike(2, 3); #endif /* _SYS_TPRINTF_H_ */
/* * Copyright (c) 2020 Alexander Kozhinov Mail: <AlexanderKozhinov@yandex.com> * * SPDX-License-Identifier: Apache-2.0 */ #ifndef __HTTP_SERVER_HANDLERS__ #define __HTTP_SERVER_HANDLERS__ #include "civetweb.h" void init_http_server_handlers(struct mg_context *ctx); #endif /* __HTTP_SERVER_HANDLERS__ */
/* Copyright 2009-2015 Urban Airship 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 THE URBAN AIRSHIP 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 URBAN AIRSHIP 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. */ #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> NS_ASSUME_NONNULL_BEGIN /** * Protocol for mediating the display of rich content pages */ @protocol UARichContentWindow <NSObject> @optional /** * Closes the webview. * * @param webView The web view to close. * @param animated Indicates whether to animate the transition. */ - (void)closeWebView:(UIWebView *)webView animated:(BOOL)animated; @end NS_ASSUME_NONNULL_END
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ #ifndef _THRIFT_THRIFT_H_ #define _THRIFT_THRIFT_H_ 1 #if defined(_WIN32) || defined(_WIN64) || defined(WIN32) #ifndef THRIFT_WIN32 #define THRIFT_WIN32 #endif #include <boost\cstdint.hpp> using namespace boost; #endif #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <stdio.h> #include <sys/types.h> #ifndef THRIFT_WIN32 #include <netinet/in.h> #else #include <Winsock2.h> #include <algorithm> #endif #ifdef HAVE_INTTYPES_H #include <inttypes.h> #endif #include <string> #include <map> #include <list> #include <set> #include <vector> #include <exception> #include "TLogging.h" namespace apache { namespace thrift { class TOutput { public: TOutput() : f_(&errorTimeWrapper) {} inline void setOutputFunction(void (*function)(const char *)){ f_ = function; } inline void operator()(const char *message){ f_(message); } // It is important to have a const char* overload here instead of // just the string version, otherwise errno could be corrupted // if there is some problem allocating memory when constructing // the string. void perror(const char *message, int errno_copy); inline void perror(const std::string &message, int errno_copy) { perror(message.c_str(), errno_copy); } void printf(const char *message, ...); inline static void errorTimeWrapper(const char* msg) { time_t now; time(&now); #ifndef THRIFT_WIN32 char dbgtime[26]; ctime_r(&now, dbgtime); dbgtime[24] = 0; fprintf(stderr, "Thrift: %s %s\n", dbgtime, msg); #else fprintf(stderr, "Thrift: %s %s\n", ctime(&now), msg); #endif } /** Just like strerror_r but returns a C++ string object. */ static std::string strerror_s(int errno_copy); private: void (*f_)(const char *); }; extern TOutput GlobalOutput; class TException : public std::exception { public: TException() {} TException(const std::string& message) : message_(message) {} virtual ~TException() throw() {} virtual const char* what() const throw() { if (message_.empty()) { return "Default TException."; } else { return message_.c_str(); } } protected: std::string message_; }; // Forward declare this structure used by TDenseProtocol namespace reflection { namespace local { struct TypeSpec; }} }} // apache::thrift #endif // #ifndef _THRIFT_THRIFT_H_
/* Copyright 2009-2015 Urban Airship 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 THE URBAN AIRSHIP 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 URBAN AIRSHIP 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. */ #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BEGIN /** * A block to be executed when a `UADisposable` is disposed. */ typedef void (^UADisposalBlock)(void); /** * A convenience class for creating self-referencing cancellation tokens. * * @note: It is left up to the creator to determine what is disposed of and * under what circumstances. This includes threading and memory management concerns. */ @interface UADisposable : NSObject /** * Create a new disposable. * * @param disposalBlock A `UADisposalBlock` to be executed upon disposal. */ + (instancetype)disposableWithBlock:(UADisposalBlock)disposalBlock; /** * Dispose of associated resources. */ - (void)dispose; @end NS_ASSUME_NONNULL_END
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef IOS_CHROME_BROWSER_OVERLAYS_PUBLIC_OVERLAY_PRESENTER_OBSERVER_H_ #define IOS_CHROME_BROWSER_OVERLAYS_PUBLIC_OVERLAY_PRESENTER_OBSERVER_H_ #include "base/observer_list_types.h" class OverlayPresenter; class OverlayRequestSupport; class OverlayRequest; // Observer interface for objects interested in overlay presentation events // triggered by OverlayPresenter. class OverlayPresenterObserver : public base::CheckedObserver { public: OverlayPresenterObserver(); ~OverlayPresenterObserver() override; // The request support for this observer. Request-specific observer callbacks // will not be executed for unsupported requests. By default, all requests // are supported. Subclasses can override to use a more specific request // support. virtual const OverlayRequestSupport* GetRequestSupport( OverlayPresenter* presenter) const; // Called when |presenter| is about to show the overlay UI for |request|. // |initial_presentation| is true if this is the first time the UI for // |request| is being shown in the current OverlayPresentationContext. virtual void WillShowOverlay(OverlayPresenter* presenter, OverlayRequest* request, bool initial_presentation) {} // Called when |presenter| has finished showing the overlay UI for // |request|. virtual void DidShowOverlay(OverlayPresenter* presenter, OverlayRequest* request) {} // Called when |presenter| is finished dismissing its overlay UI. virtual void DidHideOverlay(OverlayPresenter* presenter, OverlayRequest* request) {} // Called when |presenter| is destroyed. virtual void OverlayPresenterDestroyed(OverlayPresenter* presenter) {} }; #endif // IOS_CHROME_BROWSER_OVERLAYS_PUBLIC_OVERLAY_PRESENTER_OBSERVER_H_
// Copyright 2018 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 SERVICES_NETWORK_PROXY_RESOLVING_SOCKET_FACTORY_MOJO_H_ #define SERVICES_NETWORK_PROXY_RESOLVING_SOCKET_FACTORY_MOJO_H_ #include "base/component_export.h" #include "base/memory/ref_counted.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/unique_receiver_set.h" #include "net/traffic_annotation/network_traffic_annotation.h" #include "services/network/proxy_resolving_client_socket_factory.h" #include "services/network/public/mojom/proxy_resolving_socket.mojom.h" #include "services/network/tls_socket_factory.h" namespace net { class NetworkIsolationKey; class URLRequestContext; } // namespace net namespace network { class COMPONENT_EXPORT(NETWORK_SERVICE) ProxyResolvingSocketFactoryMojo : public mojom::ProxyResolvingSocketFactory { public: ProxyResolvingSocketFactoryMojo(net::URLRequestContext* request_context); ProxyResolvingSocketFactoryMojo(const ProxyResolvingSocketFactoryMojo&) = delete; ProxyResolvingSocketFactoryMojo& operator=( const ProxyResolvingSocketFactoryMojo&) = delete; ~ProxyResolvingSocketFactoryMojo() override; // mojom::ProxyResolvingSocketFactory implementation. void CreateProxyResolvingSocket( const GURL& url, const net::NetworkIsolationKey& network_isolation_key, mojom::ProxyResolvingSocketOptionsPtr options, const net::MutableNetworkTrafficAnnotationTag& traffic_annotation, mojo::PendingReceiver<mojom::ProxyResolvingSocket> receiver, mojo::PendingRemote<mojom::SocketObserver> observer, CreateProxyResolvingSocketCallback callback) override; private: ProxyResolvingClientSocketFactory factory_impl_; TLSSocketFactory tls_socket_factory_; mojo::UniqueReceiverSet<mojom::ProxyResolvingSocket> proxy_resolving_socket_receivers_; }; } // namespace network #endif // SERVICES_NETWORK_PROXY_RESOLVING_SOCKET_FACTORY_MOJO_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 MEDIA_CDM_PPAPI_SUPPORTED_CDM_VERSIONS_H_ #define MEDIA_CDM_PPAPI_SUPPORTED_CDM_VERSIONS_H_ #include "media/cdm/ppapi/api/content_decryption_module.h" namespace media { bool IsSupportedCdmModuleVersion(int version) { switch(version) { // Latest. case CDM_MODULE_VERSION: return true; default: return false; } } bool IsSupportedCdmInterfaceVersion(int version) { COMPILE_ASSERT(cdm::ContentDecryptionModule::kVersion == cdm::ContentDecryptionModule_6::kVersion, update_code_below); switch(version) { // Supported versions in decreasing order. case cdm::ContentDecryptionModule_6::kVersion: case cdm::ContentDecryptionModule_5::kVersion: case cdm::ContentDecryptionModule_4::kVersion: return true; default: return false; } } bool IsSupportedCdmHostVersion(int version) { COMPILE_ASSERT(cdm::ContentDecryptionModule::Host::kVersion == cdm::ContentDecryptionModule_6::Host::kVersion, update_code_below); switch(version) { // Supported versions in decreasing order. case cdm::Host_6::kVersion: case cdm::Host_5::kVersion: case cdm::Host_4::kVersion: return true; default: return false; } } } // namespace media #endif // MEDIA_CDM_PPAPI_SUPPORTED_CDM_VERSIONS_H_
/*- * Copyright (c) 2012 NetApp, Inc. * Copyright (c) 2015 xhyve developers * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY NETAPP, 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 NETAPP, 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. * * $FreeBSD$ */ #include <stdint.h> #include <stdio.h> #include <xhyve/support/misc.h> #include <xhyve/xhyve.h> #include <xhyve/pci_emul.h> #include <xhyve/uart_emul.h> /* * Pick a PCI vid/did of a chip with a single uart at * BAR0, that most versions of FreeBSD can understand: * Siig CyberSerial 1-port. */ #define COM_VENDOR 0x131f #define COM_DEV 0x2000 static void pci_uart_intr_assert(void *arg) { struct pci_devinst *pi = arg; pci_lintr_assert(pi); } static void pci_uart_intr_deassert(void *arg) { struct pci_devinst *pi = arg; pci_lintr_deassert(pi); } static void pci_uart_write(UNUSED int vcpu, struct pci_devinst *pi, int baridx, uint64_t offset, int size, uint64_t value) { assert(baridx == 0); assert(size == 1); uart_write(pi->pi_arg, ((int) offset), ((uint8_t) value)); } static uint64_t pci_uart_read(UNUSED int vcpu, struct pci_devinst *pi, int baridx, uint64_t offset, int size) { uint8_t val; assert(baridx == 0); assert(size == 1); val = uart_read(pi->pi_arg, ((int) offset)); return (val); } static int pci_uart_init(struct pci_devinst *pi, char *opts) { struct uart_softc *sc; char *name; pci_emul_alloc_bar(pi, 0, PCIBAR_IO, UART_IO_BAR_SIZE); pci_lintr_request(pi); /* initialize config space */ pci_set_cfgdata16(pi, PCIR_DEVICE, COM_DEV); pci_set_cfgdata16(pi, PCIR_VENDOR, COM_VENDOR); pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_SIMPLECOMM); sc = uart_init(pci_uart_intr_assert, pci_uart_intr_deassert, pi); pi->pi_arg = sc; asprintf(&name, "pci uart at %d:%d", pi->pi_slot, pi->pi_func); if (uart_set_backend(sc, opts, name) != 0) { fprintf(stderr, "Unable to initialize backend '%s' for %s\n", opts, name); free(name); return (-1); } free(name); return (0); } static struct pci_devemu pci_de_com = { .pe_emu = "uart", .pe_init = pci_uart_init, .pe_barwrite = pci_uart_write, .pe_barread = pci_uart_read }; PCI_EMUL_SET(pci_de_com);
/* $NetBSD: t_cosh.c,v 1.6 2014/03/03 10:39:08 martin Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Jukka Ruohonen. * * 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: t_cosh.c,v 1.6 2014/03/03 10:39:08 martin Exp $"); #include <atf-c.h> #include <math.h> #include <stdio.h> static const struct { double x; double y; double e; } values[] = { { -10, 11013.23292010332, 1e4, }, { -2, 3.762195691083631, 1, }, { -1, 1.543080634815244, 1, }, { -0.05, 1.001250260438369, 1, }, { -0.001, 1.000000500000042, 1, }, { 0, 1, 1, }, { 0.001, 1.000000500000042, 1, }, { 0.05, 1.001250260438369, 1, }, { 1, 1.543080634815244, 1, }, { 2, 3.762195691083631, 1, }, { 10, 11013.23292010332, 1e4, }, }; /* * cosh(3) */ ATF_TC(cosh_inrange); ATF_TC_HEAD(cosh_inrange, tc) { atf_tc_set_md_var(tc, "descr", "cosh(x) for some values"); } ATF_TC_BODY(cosh_inrange, tc) { double eps; double x; double y; size_t i; for (i = 0; i < __arraycount(values); i++) { x = values[i].x; y = values[i].y; eps = 1e-15 * values[i].e; if (fabs(cosh(x) - y) > eps) atf_tc_fail_nonfatal("cosh(%g) != %g\n", x, y); } } ATF_TC(cosh_nan); ATF_TC_HEAD(cosh_nan, tc) { atf_tc_set_md_var(tc, "descr", "Test cosh(NaN) == NaN"); } ATF_TC_BODY(cosh_nan, tc) { const double x = 0.0L / 0.0L; ATF_CHECK(isnan(x) != 0); ATF_CHECK(isnan(cosh(x)) != 0); } ATF_TC(cosh_inf_neg); ATF_TC_HEAD(cosh_inf_neg, tc) { atf_tc_set_md_var(tc, "descr", "Test cosh(-Inf) == +Inf"); } ATF_TC_BODY(cosh_inf_neg, tc) { const double x = -1.0L / 0.0L; double y = cosh(x); ATF_CHECK(isinf(y) != 0); ATF_CHECK(signbit(y) == 0); } ATF_TC(cosh_inf_pos); ATF_TC_HEAD(cosh_inf_pos, tc) { atf_tc_set_md_var(tc, "descr", "Test cosh(+Inf) == +Inf"); } ATF_TC_BODY(cosh_inf_pos, tc) { const double x = 1.0L / 0.0L; double y = cosh(x); ATF_CHECK(isinf(y) != 0); ATF_CHECK(signbit(y) == 0); } ATF_TC(cosh_zero_neg); ATF_TC_HEAD(cosh_zero_neg, tc) { atf_tc_set_md_var(tc, "descr", "Test cosh(-0.0) == 1.0"); } ATF_TC_BODY(cosh_zero_neg, tc) { const double x = -0.0L; if (cosh(x) != 1.0) atf_tc_fail_nonfatal("cosh(-0.0) != 1.0"); } ATF_TC(cosh_zero_pos); ATF_TC_HEAD(cosh_zero_pos, tc) { atf_tc_set_md_var(tc, "descr", "Test cosh(+0.0) == 1.0"); } ATF_TC_BODY(cosh_zero_pos, tc) { const double x = 0.0L; if (cosh(x) != 1.0) atf_tc_fail_nonfatal("cosh(+0.0) != 1.0"); } /* * coshf(3) */ ATF_TC(coshf_inrange); ATF_TC_HEAD(coshf_inrange, tc) { atf_tc_set_md_var(tc, "descr", "coshf(x) for some values"); } ATF_TC_BODY(coshf_inrange, tc) { float eps; float x; float y; size_t i; for (i = 0; i < __arraycount(values); i++) { x = values[i].x; y = values[i].y; eps = 1e-6 * values[i].e; if (fabsf(coshf(x) - y) > eps) atf_tc_fail_nonfatal("coshf(%g) != %g\n", x, y); } } ATF_TC(coshf_nan); ATF_TC_HEAD(coshf_nan, tc) { atf_tc_set_md_var(tc, "descr", "Test coshf(NaN) == NaN"); } ATF_TC_BODY(coshf_nan, tc) { const float x = 0.0L / 0.0L; ATF_CHECK(isnan(x) != 0); ATF_CHECK(isnan(coshf(x)) != 0); } ATF_TC(coshf_inf_neg); ATF_TC_HEAD(coshf_inf_neg, tc) { atf_tc_set_md_var(tc, "descr", "Test coshf(-Inf) == +Inf"); } ATF_TC_BODY(coshf_inf_neg, tc) { const float x = -1.0L / 0.0L; float y = coshf(x); ATF_CHECK(isinf(y) != 0); ATF_CHECK(signbit(y) == 0); } ATF_TC(coshf_inf_pos); ATF_TC_HEAD(coshf_inf_pos, tc) { atf_tc_set_md_var(tc, "descr", "Test coshf(+Inf) == +Inf"); } ATF_TC_BODY(coshf_inf_pos, tc) { const float x = 1.0L / 0.0L; float y = coshf(x); ATF_CHECK(isinf(y) != 0); ATF_CHECK(signbit(y) == 0); } ATF_TC(coshf_zero_neg); ATF_TC_HEAD(coshf_zero_neg, tc) { atf_tc_set_md_var(tc, "descr", "Test coshf(-0.0) == 1.0"); } ATF_TC_BODY(coshf_zero_neg, tc) { const float x = -0.0L; if (coshf(x) != 1.0) atf_tc_fail_nonfatal("coshf(-0.0) != 1.0"); } ATF_TC(coshf_zero_pos); ATF_TC_HEAD(coshf_zero_pos, tc) { atf_tc_set_md_var(tc, "descr", "Test coshf(+0.0) == 1.0"); } ATF_TC_BODY(coshf_zero_pos, tc) { const float x = 0.0L; if (coshf(x) != 1.0) atf_tc_fail_nonfatal("coshf(+0.0) != 1.0"); } ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, cosh_inrange); ATF_TP_ADD_TC(tp, cosh_nan); ATF_TP_ADD_TC(tp, cosh_inf_neg); ATF_TP_ADD_TC(tp, cosh_inf_pos); ATF_TP_ADD_TC(tp, cosh_zero_neg); ATF_TP_ADD_TC(tp, cosh_zero_pos); ATF_TP_ADD_TC(tp, coshf_inrange); ATF_TP_ADD_TC(tp, coshf_nan); ATF_TP_ADD_TC(tp, coshf_inf_neg); ATF_TP_ADD_TC(tp, coshf_inf_pos); ATF_TP_ADD_TC(tp, coshf_zero_neg); ATF_TP_ADD_TC(tp, coshf_zero_pos); return atf_no_error(); }
/* * Copyright (C) 2012 by Darren Reed. * * See the IPFILTER.LICENCE file for details on licencing. * * $Id$ */ #include "ipf.h" char *icmptypename(family, type) int family, type; { icmptype_t *i; if ((type < 0) || (type > 255)) return NULL; for (i = icmptypelist; i->it_name != NULL; i++) { if ((family == AF_INET) && (i->it_v4 == type)) return i->it_name; #ifdef USE_INET6 if ((family == AF_INET6) && (i->it_v6 == type)) return i->it_name; #endif } return NULL; }
#ifndef __LINUX_NETFILTER_H #define __LINUX_NETFILTER_H #ifdef __KERNEL__ #include <linux/init.h> #include <linux/types.h> #include <linux/skbuff.h> #include <linux/net.h> #include <linux/if.h> #include <linux/wait.h> #include <linux/list.h> #endif /* Responses from hook functions. */ #define NF_DROP 0 #define NF_ACCEPT 1 #define NF_STOLEN 2 #define NF_QUEUE 3 #define NF_REPEAT 4 #define NF_MAX_VERDICT NF_REPEAT /* Generic cache responses from hook functions. <= 0x2000 is used for protocol-flags. */ #define NFC_UNKNOWN 0x4000 #define NFC_ALTERED 0x8000 #ifdef __KERNEL__ #include <linux/config.h> #ifdef CONFIG_NETFILTER extern void netfilter_init(void); /* Largest hook number + 1 */ #define NF_MAX_HOOKS 8 struct sk_buff; struct net_device; typedef unsigned int nf_hookfn(unsigned int hooknum, struct sk_buff **skb, const struct net_device *in, const struct net_device *out, int (*okfn)(struct sk_buff *)); struct nf_hook_ops { struct list_head list; /* User fills in from here down. */ nf_hookfn *hook; int pf; int hooknum; /* Hooks are ordered in ascending priority. */ int priority; }; struct nf_sockopt_ops { struct list_head list; int pf; /* Non-inclusive ranges: use 0/0/NULL to never get called. */ int set_optmin; int set_optmax; int (*set)(struct sock *sk, int optval, void *user, unsigned int len); int get_optmin; int get_optmax; int (*get)(struct sock *sk, int optval, void *user, int *len); /* Number of users inside set() or get(). */ unsigned int use; struct task_struct *cleanup_task; }; /* Each queued (to userspace) skbuff has one of these. */ struct nf_info { /* The ops struct which sent us to userspace. */ struct nf_hook_ops *elem; /* If we're sent to userspace, this keeps housekeeping info */ int pf; unsigned int hook; struct net_device *indev, *outdev; int (*okfn)(struct sk_buff *); }; /* Function to register/unregister hook points. */ int nf_register_hook(struct nf_hook_ops *reg); void nf_unregister_hook(struct nf_hook_ops *reg); /* Functions to register get/setsockopt ranges (non-inclusive). You need to check permissions yourself! */ int nf_register_sockopt(struct nf_sockopt_ops *reg); void nf_unregister_sockopt(struct nf_sockopt_ops *reg); extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS]; /* Activate hook; either okfn or kfree_skb called, unless a hook returns NF_STOLEN (in which case, it's up to the hook to deal with the consequences). Returns -ERRNO if packet dropped. Zero means queued, stolen or accepted. */ /* RR: > I don't want nf_hook to return anything because people might forget > about async and trust the return value to mean "packet was ok". AK: Just document it clearly, then you can expect some sense from kernel coders :) */ /* This is gross, but inline doesn't cut it for avoiding the function call in fast path: gcc doesn't inline (needs value tracking?). --RR */ #ifdef CONFIG_NETFILTER_DEBUG #define NF_HOOK nf_hook_slow #else #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \ (list_empty(&nf_hooks[(pf)][(hook)]) \ ? (okfn)(skb) \ : nf_hook_slow((pf), (hook), (skb), (indev), (outdev), (okfn))) #endif int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb, struct net_device *indev, struct net_device *outdev, int (*okfn)(struct sk_buff *)); /* Call setsockopt() */ int nf_setsockopt(struct sock *sk, int pf, int optval, char *opt, int len); int nf_getsockopt(struct sock *sk, int pf, int optval, char *opt, int *len); /* Packet queuing */ typedef int (*nf_queue_outfn_t)(struct sk_buff *skb, struct nf_info *info, void *data); extern int nf_register_queue_handler(int pf, nf_queue_outfn_t outfn, void *data); extern int nf_unregister_queue_handler(int pf); extern void nf_reinject(struct sk_buff *skb, struct nf_info *info, unsigned int verdict); extern inline struct ipt_target * ipt_find_target_lock(const char *name, int *error, struct semaphore *mutex); extern inline struct ip6t_target * ip6t_find_target_lock(const char *name, int *error, struct semaphore *mutex); extern inline struct arpt_target * arpt_find_target_lock(const char *name, int *error, struct semaphore *mutex); extern void (*ip_ct_attach)(struct sk_buff *, struct nf_ct_info *); extern void nf_ct_attach(struct sk_buff *, struct sk_buff *); #ifdef CONFIG_NETFILTER_DEBUG extern void nf_dump_skb(int pf, struct sk_buff *skb); #endif /* FIXME: Before cache is ever used, this must be implemented for real. */ extern void nf_invalidate_cache(int pf); #else /* !CONFIG_NETFILTER */ #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} #endif /*CONFIG_NETFILTER*/ /* From arch/i386/kernel/smp.c: * * Why isn't this somewhere standard ?? * * Maybe because this procedure is horribly buggy, and does * not deserve to live. Think about signedness issues for five * seconds to see why. - Linus */ /* Two signed, return a signed. */ #define SMAX(a,b) ((ssize_t)(a)>(ssize_t)(b) ? (ssize_t)(a) : (ssize_t)(b)) #define SMIN(a,b) ((ssize_t)(a)<(ssize_t)(b) ? (ssize_t)(a) : (ssize_t)(b)) /* Two unsigned, return an unsigned. */ #define UMAX(a,b) ((size_t)(a)>(size_t)(b) ? (size_t)(a) : (size_t)(b)) #define UMIN(a,b) ((size_t)(a)<(size_t)(b) ? (size_t)(a) : (size_t)(b)) /* Two unsigned, return a signed. */ #define SUMAX(a,b) ((size_t)(a)>(size_t)(b) ? (ssize_t)(a) : (ssize_t)(b)) #define SUMIN(a,b) ((size_t)(a)<(size_t)(b) ? (ssize_t)(a) : (ssize_t)(b)) #endif /*__KERNEL__*/ #endif /*__LINUX_NETFILTER_H*/
/* SPDX-License-Identifier: BSD-3-Clause * Copyright (c) 2016 - 2020 Cavium Inc. * All rights reserved. * www.cavium.com */ #ifndef _HSI_FUNC_COMMON_H #define _HSI_FUNC_COMMON_H /* Physical memory descriptor */ struct phys_mem_desc { dma_addr_t phys_addr; void *virt_addr; u32 size; /* In bytes */ }; /* Virtual memory descriptor */ struct virt_mem_desc { void *ptr; u32 size; /* In bytes */ }; #endif
#import <Foundation/Foundation.h> typedef struct { size_t a, b, c, d; } LargeIncrementerStruct; typedef LargeIncrementerStruct (^ComplexIncrementerBlock)(NSNumber *, LargeIncrementerStruct, id<NSCoding>); @class FooSuperclass; @protocol InheritedProtocol<NSObject> @end @protocol SimpleIncrementer<InheritedProtocol> @required - (size_t)value; - (size_t)aVeryLargeNumber; - (NSNumber *)valueAsNumber; - (void)increment; - (void)incrementBy:(size_t)amount; - (void)incrementByNumber:(NSNumber *)number; - (void)incrementByInteger:(NSUInteger)number; - (void)incrementByABit:(unsigned int)aBit andABitMore:(NSNumber *)aBitMore; - (void)incrementWithException; - (void)methodWithBlock:(void(^)())blockArgument; - (void)methodWithCString:(char *)string; - (id)methodWithInheritedProtocol:(id<InheritedProtocol>)protocol; - (NSString *)methodWithString:(NSString *)string; - (NSNumber *)methodWithNumber1:(NSNumber *)arg1 andNumber2:(NSNumber *)arg2; - (double)methodWithDouble1:(double)double1 andDouble2:(double)double2; - (LargeIncrementerStruct)methodWithLargeStruct1:(LargeIncrementerStruct)struct1 andLargeStruct2:(LargeIncrementerStruct)struct2; - (void)methodWithNumber:(NSNumber *)number complexBlock:(ComplexIncrementerBlock)block; - (NSString *)methodWithFooSuperclass:(FooSuperclass *)fooInstance; - (void)methodWithPrimitivePointerArgument:(int *)arg; - (void)methodWithObjectPointerArgument:(out id *)anObjectPointer; @optional - (size_t)whatIfIIncrementedBy:(size_t)amount; @end @interface IncrementerBase : NSObject @end @interface SimpleIncrementer : IncrementerBase<SimpleIncrementer> @property (nonatomic, copy) NSString *string; @end
/* Copyright 2015 BitPay, Inc. * Distributed under the MIT/X11 software license, see the accompanying * file COPYING or http://www.opensource.org/licenses/mit-license.php. */ #include <assert.h> #include <string.h> #include <ccoin/clist.h> static int cstr_cmp(const void *a_, const void *b_, void *user_priv) { const char *a = a_; const char *b = b_; return strcmp(a, b); } static void test_basic(void) { clist_free(NULL); clist_free_ext(NULL, NULL); assert(clist_length(NULL) == 0); assert(clist_last(NULL) == NULL); assert(clist_nth(NULL, 22) == NULL); clist *l = NULL; l = clist_append(l, "1"); l = clist_append(l, "2"); l = clist_prepend(l, "0"); assert(clist_length(l) == 3); assert(strcmp(clist_nth(l, 0)->data, "0") == 0); assert(strcmp(clist_nth(l, 1)->data, "1") == 0); assert(strcmp(clist_nth(l, 2)->data, "2") == 0); assert(strcmp(clist_last(l)->data, "2") == 0); clist *first = clist_nth(l, 0); assert(first != NULL); l = clist_delete(l, first); assert(clist_length(l) == 2); assert(strcmp(clist_nth(l, 0)->data, "1") == 0); assert(strcmp(clist_nth(l, 1)->data, "2") == 0); l = clist_append(l, "0"); l = clist_sort(l, cstr_cmp, NULL); assert(clist_length(l) == 3); assert(strcmp(clist_nth(l, 0)->data, "0") == 0); assert(strcmp(clist_nth(l, 1)->data, "1") == 0); assert(strcmp(clist_nth(l, 2)->data, "2") == 0); clist_free(l); } int main (int argc, char *argv[]) { test_basic(); return 0; }
/* * libjingle * Copyright 2013 Google Inc. * * 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. */ #ifndef TALK_APP_WEBRTC_TEST_PEERCONNECTIONTESTWRAPPER_H_ #define TALK_APP_WEBRTC_TEST_PEERCONNECTIONTESTWRAPPER_H_ #include "talk/app/webrtc/peerconnectioninterface.h" #include "talk/app/webrtc/test/fakeaudiocapturemodule.h" #include "talk/app/webrtc/test/fakeconstraints.h" #include "talk/app/webrtc/test/fakevideotrackrenderer.h" #include "webrtc/base/sigslot.h" namespace webrtc { class DtlsIdentityStoreInterface; class PortAllocatorFactoryInterface; } class PeerConnectionTestWrapper : public webrtc::PeerConnectionObserver, public webrtc::CreateSessionDescriptionObserver, public sigslot::has_slots<> { public: static void Connect(PeerConnectionTestWrapper* caller, PeerConnectionTestWrapper* callee); explicit PeerConnectionTestWrapper(const std::string& name); virtual ~PeerConnectionTestWrapper(); bool CreatePc(const webrtc::MediaConstraintsInterface* constraints); rtc::scoped_refptr<webrtc::DataChannelInterface> CreateDataChannel( const std::string& label, const webrtc::DataChannelInit& init); // Implements PeerConnectionObserver. virtual void OnSignalingChange( webrtc::PeerConnectionInterface::SignalingState new_state) {} virtual void OnStateChange( webrtc::PeerConnectionObserver::StateType state_changed) {} virtual void OnAddStream(webrtc::MediaStreamInterface* stream); virtual void OnRemoveStream(webrtc::MediaStreamInterface* stream) {} virtual void OnDataChannel(webrtc::DataChannelInterface* data_channel); virtual void OnRenegotiationNeeded() {} virtual void OnIceConnectionChange( webrtc::PeerConnectionInterface::IceConnectionState new_state) {} virtual void OnIceGatheringChange( webrtc::PeerConnectionInterface::IceGatheringState new_state) {} virtual void OnIceCandidate(const webrtc::IceCandidateInterface* candidate); virtual void OnIceComplete() {} // Implements CreateSessionDescriptionObserver. virtual void OnSuccess(webrtc::SessionDescriptionInterface* desc); virtual void OnFailure(const std::string& error) {} void CreateOffer(const webrtc::MediaConstraintsInterface* constraints); void CreateAnswer(const webrtc::MediaConstraintsInterface* constraints); void ReceiveOfferSdp(const std::string& sdp); void ReceiveAnswerSdp(const std::string& sdp); void AddIceCandidate(const std::string& sdp_mid, int sdp_mline_index, const std::string& candidate); void WaitForCallEstablished(); void WaitForConnection(); void WaitForAudio(); void WaitForVideo(); void GetAndAddUserMedia( bool audio, const webrtc::FakeConstraints& audio_constraints, bool video, const webrtc::FakeConstraints& video_constraints); // sigslots sigslot::signal1<std::string*> SignalOnIceCandidateCreated; sigslot::signal3<const std::string&, int, const std::string&> SignalOnIceCandidateReady; sigslot::signal1<std::string*> SignalOnSdpCreated; sigslot::signal1<const std::string&> SignalOnSdpReady; sigslot::signal1<webrtc::DataChannelInterface*> SignalOnDataChannel; private: void SetLocalDescription(const std::string& type, const std::string& sdp); void SetRemoteDescription(const std::string& type, const std::string& sdp); bool CheckForConnection(); bool CheckForAudio(); bool CheckForVideo(); rtc::scoped_refptr<webrtc::MediaStreamInterface> GetUserMedia( bool audio, const webrtc::FakeConstraints& audio_constraints, bool video, const webrtc::FakeConstraints& video_constraints); std::string name_; rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface> allocator_factory_; rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_; rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> peer_connection_factory_; rtc::scoped_refptr<FakeAudioCaptureModule> fake_audio_capture_module_; rtc::scoped_ptr<webrtc::FakeVideoTrackRenderer> renderer_; }; #endif // TALK_APP_WEBRTC_TEST_PEERCONNECTIONTESTWRAPPER_H_
/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2020 Broadcom * All rights reserved. */ #ifndef _BCMFS_SYM_REQ_H_ #define _BCMFS_SYM_REQ_H_ #include <rte_cryptodev.h> #include "bcmfs_dev_msg.h" #include "bcmfs_sym_defs.h" /** Max variable length. Since we adjust AAD * in same BD if it is less than BCMFS_AAD_THRESH_LEN * so we add it here. */ #define BCMFS_MAX_OMDMD_LEN ((2 * (BCMFS_MAX_KEY_SIZE)) + \ (2 * (BCMFS_MAX_IV_SIZE)) + \ (BCMFS_AAD_THRESH_LEN)) /* Fixed SPU2 Metadata */ struct spu2_fmd { uint64_t ctrl0; uint64_t ctrl1; uint64_t ctrl2; uint64_t ctrl3; }; /* * This structure hold the supportive data required to process a * rte_crypto_op */ struct bcmfs_sym_request { /* * Only single BD for metadata so * FMD + OMD must be in continuation */ /* spu2 engine related data */ struct spu2_fmd fmd; /* variable metadata in continuation with fmd */ uint8_t omd[BCMFS_MAX_OMDMD_LEN]; /* digest data output from crypto h/w */ uint8_t digest[BCMFS_MAX_DIGEST_SIZE]; /* 2-Bytes response from crypto h/w */ uint8_t resp[2]; /* * Below are all iovas for above members * from top */ /* iova for fmd */ rte_iova_t fptr; /* iova for omd */ rte_iova_t optr; /* iova for digest */ rte_iova_t dptr; /* iova for response */ rte_iova_t rptr; /* bcmfs qp message for h/w queues to process */ struct bcmfs_qp_message msgs; /* crypto op */ struct rte_crypto_op *op; }; #endif /* _BCMFS_SYM_REQ_H_ */
/*********************************************************************** SpaceBall - Class for 6-DOF joysticks (Spaceball 4000FLX). Copyright (c) 2002-2011 Oliver Kreylos This file is part of the Vrui VR Device Driver Daemon (VRDeviceDaemon). The Vrui VR Device Driver Daemon 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. The Vrui VR Device Driver Daemon 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 the Vrui VR Device Driver Daemon; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***********************************************************************/ #ifndef SPACEBALL_INCLUDED #define SPACEBALL_INCLUDED #include <Comm/SerialPort.h> #include <VRDeviceDaemon/VRDevice.h> /* Forward declarations: */ namespace Misc { class Time; } class SpaceBall:public VRDevice { /* Embedded classes: */ private: typedef Vrui::VRDeviceState::TrackerState::PositionOrientation PositionOrientation; // Type for tracker position/orientation /* Elements: */ Comm::SerialPort devicePort; // Serial port the tracking device hardware is connected to double linearGain; // Multiplication factor for linear velocities double angularGain; // Multiplication factor for angular velocities PositionOrientation currentPositionOrientation; // Current position/orientation of space ball device /* Private methods: */ bool readLine(int lineBufferSize,char* lineBuffer,const Misc::Time& deadline); // Reads a line of text from the space ball with timeout int readPacket(int packetBufferSize,unsigned char* packetBuffer); // Reads a space ball status packet from the serial port; returns number of read characters /* Protected methods: */ virtual void deviceThreadMethod(void); /* Constructors and destructors: */ public: SpaceBall(VRDevice::Factory* sFactory,VRDeviceManager* sDeviceManager,Misc::ConfigurationFile& configFile); /* Methods: */ virtual void start(void); virtual void stop(void); }; #endif
/* linux/arch/arm/plat-s5pc1xx/include/plat/gpio-bank-mp13.h * * Copyright 2008 Openmoko, Inc. * Copyright 2008 Simtec Electronics * Ben Dooks <ben@simtec.co.uk> * http://armlinux.simtec.co.uk/ * * GPIO Bank MP13 register and configuration definitions * * 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. */ #define S5PC11X_MP13CON (S5PC11X_MP13_BASE + 0x00) #define S5PC11X_MP13DAT (S5PC11X_MP13_BASE + 0x04) #define S5PC11X_MP13PUD (S5PC11X_MP13_BASE + 0x08) #define S5PC11X_MP13DRV (S5PC11X_MP13_BASE + 0x0c) #define S5PC11X_MP13CONPDN (S5PC11X_MP13_BASE + 0x10) #define S5PC11X_MP13PUDPDN (S5PC11X_MP13_BASE + 0x14) #define S5PC11X_MP13_CONMASK(__gpio) (0xf << ((__gpio) * 4)) #define S5PC11X_MP13_INPUT(__gpio) (0x0 << ((__gpio) * 4)) #define S5PC11X_MP13_OUTPUT(__gpio) (0x1 << ((__gpio) * 4)) #define S5PC11X_MP13_0_LD0_DATA_8 (0x2 << 0) #define S5PC11X_MP13_1_LD0_DATA_9 (0x2 << 4) #define S5PC11X_MP13_2_LD0_DATA_10 (0x2 << 8) #define S5PC11X_MP13_3_LD0_DATA_11 (0x2 << 12) #define S5PC11X_MP13_4_LD0_DATA_12 (0x2 << 16) #define S5PC11X_MP13_5_LD0_DATA_13 (0x2 << 20) #define S5PC11X_MP13_6_LD0_DATA_14 (0x2 << 24) #define S5PC11X_MP13_7_LD0_DATA_15 (0x2 << 28)
/* * linux/arch/m68k/hp300/config.c * * Copyright (C) 1998 Philip Blundell <philb@gnu.org> * * This file contains the HP300-specific initialisation code. It gets * called by setup.c. */ #include <linux/config.h> #include <linux/types.h> #include <linux/mm.h> #include <linux/kd.h> #include <linux/tty.h> #include <linux/console.h> #include <linux/interrupt.h> #include <linux/init.h> #include <asm/machdep.h> #include <asm/blinken.h> #include <asm/hwtest.h> /* hwreg_present() */ #include "ints.h" #include "time.h" extern void hp300_reset(void); extern irqreturn_t (*hp300_default_handler[])(int, void *, struct pt_regs *); extern int show_hp300_interrupts(struct seq_file *, void *); #ifdef CONFIG_HEARTBEAT static void hp300_pulse(int x) { if (x) blinken_leds(0xfe); else blinken_leds(0xff); } #endif static void hp300_get_model(char *model) { strcpy(model, "HP9000/300"); } void __init config_hp300(void) { mach_sched_init = hp300_sched_init; mach_init_IRQ = hp300_init_IRQ; mach_request_irq = hp300_request_irq; mach_free_irq = hp300_free_irq; mach_get_model = hp300_get_model; mach_get_irq_list = show_hp300_interrupts; mach_gettimeoffset = hp300_gettimeoffset; mach_default_handler = &hp300_default_handler; mach_reset = hp300_reset; #ifdef CONFIG_HEARTBEAT mach_heartbeat = hp300_pulse; #endif #ifdef CONFIG_DUMMY_CONSOLE conswitchp = &dummy_con; #endif mach_max_dma_address = 0xffffffff; }
/*************************************************************************** qgslayerstylingwidget.h --------------------- begin : April 2016 copyright : (C) 2016 by Nathan Woodrow email : woodrow dot nathan 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. * * * ***************************************************************************/ #ifndef QGSLAYERSTYLESDOCK_H #define QGSLAYERSTYLESDOCK_H #include <QToolButton> #include <QWidget> #include <QLabel> #include <QTabWidget> #include <QStackedWidget> #include <QDialogButtonBox> #include <QCheckBox> #include <QUndoCommand> #include <QDomNode> #include <QTime> #include <QTimer> #include "ui_qgsmapstylingwidgetbase.h" #include "qgsmaplayerconfigwidgetfactory.h" #include "qgis_app.h" class QgsLabelingWidget; class QgsMaskingWidget; class QgsMapLayer; class QgsMapCanvas; class QgsRendererPropertiesDialog; class QgsRendererRasterPropertiesWidget; class QgsRendererMeshPropertiesWidget; class QgsUndoWidget; class QgsRasterHistogramWidget; class QgsMapLayerStyleManagerWidget; class QgsVectorLayer3DRendererWidget; class QgsMeshLayer3DRendererWidget; class QgsMessageBar; class APP_EXPORT QgsLayerStyleManagerWidgetFactory : public QgsMapLayerConfigWidgetFactory { public: QgsLayerStyleManagerWidgetFactory(); bool supportsStyleDock() const override { return true; } QgsMapLayerConfigWidget *createWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, bool dockMode, QWidget *parent ) const override; bool supportsLayer( QgsMapLayer *layer ) const override; }; class APP_EXPORT QgsMapLayerStyleCommand : public QUndoCommand { public: QgsMapLayerStyleCommand( QgsMapLayer *layer, const QString &text, const QDomNode &current, const QDomNode &last, bool triggerRepaint = true ); /** * Returns unique ID for this kind of undo command. * Currently we do not have a central registry of undo command IDs, so it is a random magic number. */ int id() const override { return 0xbeef; } void undo() override; void redo() override; //! Try to merge with other commands of this type when they are created in small time interval bool mergeWith( const QUndoCommand *other ) override; private: QgsMapLayer *mLayer = nullptr; QDomNode mXml; QDomNode mLastState; QTime mTime; bool mTriggerRepaint = true; }; class APP_EXPORT QgsLayerStylingWidget : public QWidget, private Ui::QgsLayerStylingWidgetBase { Q_OBJECT public: enum Page { Symbology = 1, VectorLabeling, RasterTransparency, RasterHistogram, History, Symbology3D, }; QgsLayerStylingWidget( QgsMapCanvas *canvas, QgsMessageBar *messageBar, const QList<QgsMapLayerConfigWidgetFactory *> &pages, QWidget *parent = nullptr ); ~QgsLayerStylingWidget() override; QgsMapLayer *layer() { return mCurrentLayer; } void setPageFactories( const QList<QgsMapLayerConfigWidgetFactory *> &factories ); /** * Sets whether updates of the styling widget are blocked. This can be called to prevent * the widget being refreshed multiple times when a batch of layer style changes are * about to be applied * \param blocked set to true to block updates, or false to re-allow updates */ void blockUpdates( bool blocked ); signals: void styleChanged( QgsMapLayer *layer ); public slots: void setLayer( QgsMapLayer *layer ); void apply(); void autoApply(); void undo(); void redo(); void updateCurrentWidgetLayer(); /** * Sets the current visible page in the widget. * \param page standard page to display */ void setCurrentPage( QgsLayerStylingWidget::Page page ); private slots: void layerAboutToBeRemoved( QgsMapLayer *layer ); void liveApplyToggled( bool value ); private: void pushUndoItem( const QString &name, bool triggerRepaint = true ); int mNotSupportedPage; int mLayerPage; QTimer *mAutoApplyTimer = nullptr; QDomNode mLastStyleXml; QgsMapCanvas *mMapCanvas = nullptr; QgsMessageBar *mMessageBar = nullptr; bool mBlockAutoApply; QgsUndoWidget *mUndoWidget = nullptr; QgsMapLayer *mCurrentLayer = nullptr; QgsLabelingWidget *mLabelingWidget = nullptr; QgsMaskingWidget *mMaskingWidget = nullptr; #ifdef HAVE_3D QgsVectorLayer3DRendererWidget *mVector3DWidget = nullptr; QgsMeshLayer3DRendererWidget *mMesh3DWidget = nullptr; #endif QgsRendererRasterPropertiesWidget *mRasterStyleWidget = nullptr; QgsRendererMeshPropertiesWidget *mMeshStyleWidget = nullptr; QList<QgsMapLayerConfigWidgetFactory *> mPageFactories; QMap<int, QgsMapLayerConfigWidgetFactory *> mUserPages; QgsLayerStyleManagerWidgetFactory *mStyleManagerFactory = nullptr; }; #endif // QGSLAYERSTYLESDOCK_H
/* SPDX-License-Identifier: LGPL-2.1+ */ #ifndef foosdndiscfoo #define foosdndiscfoo /*** This file is part of systemd. Copyright (C) 2014 Intel Corporation. All rights reserved. systemd 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. systemd 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 systemd; If not, see <http://www.gnu.org/licenses/>. ***/ #include <inttypes.h> #include <net/ethernet.h> #include <netinet/in.h> #include <sys/types.h> #include "sd-event.h" #include "_sd-common.h" _SD_BEGIN_DECLARATIONS; /* Neightbor Discovery Options, RFC 4861, Section 4.6 and * https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml#icmpv6-parameters-5 */ enum { SD_NDISC_OPTION_SOURCE_LL_ADDRESS = 1, SD_NDISC_OPTION_TARGET_LL_ADDRESS = 2, SD_NDISC_OPTION_PREFIX_INFORMATION = 3, SD_NDISC_OPTION_MTU = 5, SD_NDISC_OPTION_ROUTE_INFORMATION = 24, SD_NDISC_OPTION_RDNSS = 25, SD_NDISC_OPTION_FLAGS_EXTENSION = 26, SD_NDISC_OPTION_DNSSL = 31, SD_NDISC_OPTION_CAPTIVE_PORTAL = 37, }; /* Route preference, RFC 4191, Section 2.1 */ enum { SD_NDISC_PREFERENCE_LOW = 3U, SD_NDISC_PREFERENCE_MEDIUM = 0U, SD_NDISC_PREFERENCE_HIGH = 1U, }; typedef struct sd_ndisc sd_ndisc; typedef struct sd_ndisc_router sd_ndisc_router; typedef enum sd_ndisc_event { SD_NDISC_EVENT_TIMEOUT = 't', SD_NDISC_EVENT_ROUTER = 'r', } sd_ndisc_event; typedef void (*sd_ndisc_callback_t)(sd_ndisc *nd, sd_ndisc_event event, sd_ndisc_router *rt, void *userdata); int sd_ndisc_new(sd_ndisc **ret); sd_ndisc *sd_ndisc_ref(sd_ndisc *nd); sd_ndisc *sd_ndisc_unref(sd_ndisc *nd); int sd_ndisc_start(sd_ndisc *nd); int sd_ndisc_stop(sd_ndisc *nd); int sd_ndisc_attach_event(sd_ndisc *nd, sd_event *event, int64_t priority); int sd_ndisc_detach_event(sd_ndisc *nd); sd_event *sd_ndisc_get_event(sd_ndisc *nd); int sd_ndisc_set_callback(sd_ndisc *nd, sd_ndisc_callback_t cb, void *userdata); int sd_ndisc_set_ifindex(sd_ndisc *nd, int interface_index); int sd_ndisc_set_mac(sd_ndisc *nd, const struct ether_addr *mac_addr); int sd_ndisc_get_mtu(sd_ndisc *nd, uint32_t *ret); int sd_ndisc_get_hop_limit(sd_ndisc *nd, uint8_t *ret); int sd_ndisc_router_from_raw(sd_ndisc_router **ret, const void *raw, size_t raw_size); sd_ndisc_router *sd_ndisc_router_ref(sd_ndisc_router *rt); sd_ndisc_router *sd_ndisc_router_unref(sd_ndisc_router *rt); int sd_ndisc_router_get_address(sd_ndisc_router *rt, struct in6_addr *ret_addr); int sd_ndisc_router_get_timestamp(sd_ndisc_router *rt, clockid_t clock, uint64_t *ret); int sd_ndisc_router_get_raw(sd_ndisc_router *rt, const void **ret, size_t *size); int sd_ndisc_router_get_hop_limit(sd_ndisc_router *rt, uint8_t *ret); int sd_ndisc_router_get_flags(sd_ndisc_router *rt, uint64_t *ret_flags); int sd_ndisc_router_get_preference(sd_ndisc_router *rt, unsigned *ret); int sd_ndisc_router_get_lifetime(sd_ndisc_router *rt, uint16_t *ret_lifetime); int sd_ndisc_router_get_mtu(sd_ndisc_router *rt, uint32_t *ret); /* Generic option access */ int sd_ndisc_router_option_rewind(sd_ndisc_router *rt); int sd_ndisc_router_option_next(sd_ndisc_router *rt); int sd_ndisc_router_option_get_type(sd_ndisc_router *rt, uint8_t *ret); int sd_ndisc_router_option_is_type(sd_ndisc_router *rt, uint8_t type); int sd_ndisc_router_option_get_raw(sd_ndisc_router *rt, const void **ret, size_t *size); /* Specific option access: SD_NDISC_OPTION_PREFIX_INFORMATION */ int sd_ndisc_router_prefix_get_valid_lifetime(sd_ndisc_router *rt, uint32_t *ret); int sd_ndisc_router_prefix_get_preferred_lifetime(sd_ndisc_router *rt, uint32_t *ret); int sd_ndisc_router_prefix_get_flags(sd_ndisc_router *rt, uint8_t *ret); int sd_ndisc_router_prefix_get_address(sd_ndisc_router *rt, struct in6_addr *ret_addr); int sd_ndisc_router_prefix_get_prefixlen(sd_ndisc_router *rt, unsigned *prefixlen); /* Specific option access: SD_NDISC_OPTION_ROUTE_INFORMATION */ int sd_ndisc_router_route_get_lifetime(sd_ndisc_router *rt, uint32_t *ret); int sd_ndisc_router_route_get_address(sd_ndisc_router *rt, struct in6_addr *ret_addr); int sd_ndisc_router_route_get_prefixlen(sd_ndisc_router *rt, unsigned *prefixlen); int sd_ndisc_router_route_get_preference(sd_ndisc_router *rt, unsigned *ret); /* Specific option access: SD_NDISC_OPTION_RDNSS */ int sd_ndisc_router_rdnss_get_addresses(sd_ndisc_router *rt, const struct in6_addr **ret); int sd_ndisc_router_rdnss_get_lifetime(sd_ndisc_router *rt, uint32_t *ret); /* Specific option access: SD_NDISC_OPTION_DNSSL */ int sd_ndisc_router_dnssl_get_domains(sd_ndisc_router *rt, char ***ret); int sd_ndisc_router_dnssl_get_lifetime(sd_ndisc_router *rt, uint32_t *ret); _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_ndisc, sd_ndisc_unref); _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_ndisc_router, sd_ndisc_router_unref); _SD_END_DECLARATIONS; #endif
/* Software floating-point emulation. Convert IEEE double to 128bit unsigned integer Copyright (C) 2007-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Uros Bizjak (ubizjak@gmail.com). 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. In addition to the permissions in the GNU Lesser General Public License, the Free Software Foundation gives you unlimited permission to link the compiled version of this file into combinations with other programs, and to distribute those combinations without any restriction coming from the use of this file. (The Lesser General Public License restrictions do apply in other respects; for example, they cover modification of the file, and distribution when not linked into a combine executable.) 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 "soft-fp.h" #include "double.h" UTItype __fixunsdfti (DFtype a) { FP_DECL_EX; FP_DECL_D (A); UTItype r; FP_INIT_EXCEPTIONS; FP_UNPACK_RAW_D (A, a); FP_TO_INT_D (r, A, TI_BITS, 0); FP_HANDLE_EXCEPTIONS; return r; }
/* * This file contains a typical set of register access routines which may be * used with the m48t08 chip if accesses to the chip are as follows: * * + registers are accessed as bytes * + registers are on 64-bit boundaries * * COPYRIGHT (c) 1989-1997. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. */ #define _M48T08_MULTIPLIER 8 #define _M48T08_NAME(_X) _X##_8 #define _M48T08_TYPE uint8_t #include "m48t08_reg.c"
/* Test *_IS_IEC_60559 not defined for C11. */ /* { dg-do preprocess } */ /* { dg-options "-std=c11 -pedantic-errors" } */ #include <float.h> #ifdef FLT_IS_IEC_60559 #error "FLT_IS_IEC_60559 defined" #endif #ifdef DBL_IS_IEC_60559 #error "DBL_IS_IEC_60559 defined" #endif #ifdef LDBL_IS_IEC_60559 #error "LDBL_IS_IEC_60559 defined" #endif
// Copyright 2017 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. #pragma once #include <cstddef> #include <functional> #include <list> #include <memory> #include <mutex> #include <string> #include <vector> #include "Common/CommonTypes.h" class PointerWrap; namespace Core { class TitleDatabase; } namespace UICommon { class GameFile; std::vector<std::string> FindAllGamePaths(const std::vector<std::string>& directories_to_scan, bool recursive_scan); class GameFileCache { public: void ForEach(std::function<void(const std::shared_ptr<const GameFile>&)> f) const; void Clear(); // Returns nullptr if the file is invalid. std::shared_ptr<const GameFile> AddOrGet(const std::string& path, bool* cache_changed, const Core::TitleDatabase& title_database); // These functions return true if the call modified the cache. bool Update(const std::vector<std::string>& all_game_paths); bool UpdateAdditionalMetadata(const Core::TitleDatabase& title_database); bool Load(); bool Save(); private: bool UpdateAdditionalMetadata(std::shared_ptr<GameFile>* game_file, const Core::TitleDatabase& title_database); bool SyncCacheFile(bool save); void DoState(PointerWrap* p, u64 size = 0); std::vector<std::shared_ptr<GameFile>> m_cached_files; }; } // namespace UICommon
/* Definitions for non-Linux based ARM systems using ELF Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Catherine Moore <clm@cygnus.com> This file is part of GNU CC. GNU CC 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. GNU CC 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* elfos.h should have already been included. Now just override any conflicting definitions and add any extras. */ /* Run-time Target Specification. */ #ifndef TARGET_VERSION #define TARGET_VERSION fputs (" (ARM/ELF)", stderr); #endif /* Default to using APCS-32 and software floating point. */ #ifndef TARGET_DEFAULT #define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME) #endif /* Now we define the strings used to build the spec file. */ #undef STARTFILE_SPEC #define STARTFILE_SPEC " crti%O%s crtbegin%O%s crt0%O%s" #undef ENDFILE_SPEC #define ENDFILE_SPEC "crtend%O%s crtn%O%s" /* The __USES_INITFINI__ define is tested in newlib/libc/sys/arm/crt0.S to see if it needs to invoked _init() and _fini(). */ #undef SUBTARGET_CPP_SPEC #define SUBTARGET_CPP_SPEC "-D__ELF__ -D__USES_INITFINI__" #undef PREFERRED_DEBUGGING_TYPE #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG /* Return a nonzero value if DECL has a section attribute. */ #define IN_NAMED_SECTION(DECL) \ ((TREE_CODE (DECL) == FUNCTION_DECL || TREE_CODE (DECL) == VAR_DECL) \ && DECL_SECTION_NAME (DECL) != NULL_TREE) #undef ASM_OUTPUT_ALIGNED_BSS #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ do \ { \ if (IN_NAMED_SECTION (DECL)) \ named_section (DECL, NULL, 0); \ else \ bss_section (); \ \ (*targetm.asm_out.globalize_label) (FILE, NAME); \ \ ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT)); \ \ last_assemble_variable_decl = DECL; \ ASM_DECLARE_OBJECT_NAME (FILE, NAME, DECL); \ ASM_OUTPUT_SKIP (FILE, SIZE ? SIZE : 1); \ } \ while (0) #undef ASM_OUTPUT_ALIGNED_DECL_LOCAL #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \ do \ { \ if ((DECL) != NULL && IN_NAMED_SECTION (DECL)) \ named_section (DECL, NULL, 0); \ else \ bss_section (); \ \ ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT)); \ ASM_OUTPUT_LABEL (FILE, NAME); \ fprintf (FILE, "\t.space\t%d\n", SIZE ? SIZE : 1); \ } \ while (0) #ifndef CPP_APCS_PC_DEFAULT_SPEC #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__" #endif #ifndef SUBTARGET_CPU_DEFAULT #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm7tdmi #endif
#pragma once /* * Copyright (C) 2005-2008 Team XBMC * http://www.xbmc.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, 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 * */ #include "threads/Thread.h" #include "VideoInfoTag.h" #include "addons/Scraper.h" #include "Episode.h" #include "XBDateTime.h" #include "filesystem/CurlFile.h" // forward declarations class CXBMCTinyXML; class CGUIDialogProgress; namespace ADDON { class CScraperError; } typedef std::vector<CScraperUrl> MOVIELIST; class CVideoInfoDownloader : public CThread { public: CVideoInfoDownloader(const ADDON::ScraperPtr &scraper); virtual ~CVideoInfoDownloader(); // threaded lookup functions /*! \brief Do a search for matching media items (possibly asynchronously) with our scraper \param strMovie name of the media item to look for \param movielist [out] list of results to fill. May be empty on success. \param pProgress progress bar to update as we go. If NULL we run on thread, if non-NULL we run off thread. \return 1 on success, -1 on a scraper-specific error, 0 on some other error */ int FindMovie(const CStdString& strMovie, MOVIELIST& movielist, CGUIDialogProgress *pProgress = NULL); bool GetDetails(const CScraperUrl& url, CVideoInfoTag &movieDetails, CGUIDialogProgress *pProgress = NULL); bool GetEpisodeDetails(const CScraperUrl& url, CVideoInfoTag &movieDetails, CGUIDialogProgress *pProgress = NULL); bool GetEpisodeList(const CScraperUrl& url, EPISODELIST& details, CGUIDialogProgress *pProgress = NULL); static void ShowErrorDialog(const ADDON::CScraperError &sce); protected: enum LOOKUP_STATE { DO_NOTHING = 0, FIND_MOVIE = 1, GET_DETAILS = 2, GET_EPISODE_LIST = 3, GET_EPISODE_DETAILS = 4 }; XFILE::CCurlFile* m_http; CStdString m_strMovie; MOVIELIST m_movieList; CVideoInfoTag m_movieDetails; CScraperUrl m_url; EPISODELIST m_episode; LOOKUP_STATE m_state; int m_found; ADDON::ScraperPtr m_info; // threaded stuff void Process(); void CloseThread(); int InternalFindMovie(const CStdString& strMovie, MOVIELIST& movielist, bool cleanChars = true); };
#include <stdio.h> #define INI_MAX_LINE 200 typedef char* (*ini_reader)(char* str, int num, void* stream); int ini_parse(const char* filename); static int ini_parse_stream(ini_reader reader, void* stream) { char line[INI_MAX_LINE]; int max_line = INI_MAX_LINE; while (reader(line, max_line, stream) != NULL) ; return 0; } static int ini_parse_file(FILE* file) { return ini_parse_stream((ini_reader)fgets, file); } int ini_parse(const char* filename) { FILE* file; int error; file = fopen(filename, "r"); if (!file) return -1; error = ini_parse_file(file); fclose(file); return error; }
/* ChibiOS - Copyright (C) 2006..2018 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. */ #include "hal.h" /** * @brief PAL setup. * @details Digital I/O ports static configuration as defined in @p board.h. * This variable is used by the HAL when initializing the PAL driver. */ #if HAL_USE_PAL || defined(__DOXYGEN__) const PALConfig pal_default_config = { #if defined(PORTA) {VAL_PORTA, VAL_DDRA}, #endif #if defined(PORTB) {VAL_PORTB, VAL_DDRB}, #endif #if defined(PORTC) {VAL_PORTC, VAL_DDRC}, #endif #if defined(PORTD) {VAL_PORTD, VAL_DDRD}, #endif #if defined(PORTE) {VAL_PORTE, VAL_DDRE}, #endif #if defined(PORTF) {VAL_PORTF, VAL_DDRF}, #endif #if defined(PORTG) {VAL_PORTG, VAL_DDRG}, #endif }; #endif /* HAL_USE_PAL */ CH_IRQ_HANDLER(TIMER0_COMP_vect) { CH_IRQ_PROLOGUE(); chSysLockFromIsr(); chSysTimerHandlerI(); chSysUnlockFromIsr(); CH_IRQ_EPILOGUE(); } /* * Board-specific initialization code. */ void boardInit(void) { /* * External interrupts setup, all disabled initially. */ EICRA = 0x00; EICRB = 0x00; EIMSK = 0x00; /* * Enables Idle mode for SLEEP instruction. */ SMCR = (1 << SE); /* * Timer 0 setup. */ TCCR0A = (1 << WGM01) | (0 << WGM00) | /* CTC mode. */ (0 << COM0A1) | (0 << COM0A0) | /* OC0A disabled. */ (0 << CS02) | (1 << CS01) | (1 << CS00); /* CLK/64 clock. */ OCR0A = F_CPU / 64 / CH_FREQUENCY - 1; TCNT0 = 0; /* Reset counter. */ TIFR0 = (1 << OCF0A); /* Reset pending. */ TIMSK0 = (1 << OCIE0A); /* IRQ on compare. */ }
/* Definitions of target machine for GCC, for SPARC running in an embedded environment using the ELF file format. Copyright (C) 2005, 2007, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC 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 GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ #undef TARGET_VERSION #define TARGET_VERSION fprintf (stderr, " (sparc-elf)") /* Don't assume anything about the header files. */ #define NO_IMPLICIT_EXTERN_C /* It's safe to pass -s always, even if -g is not used. */ #undef ASM_SPEC #define ASM_SPEC \ "-s \ %{fpic|fpie|fPIC|fPIE:-K PIC} %(asm_cpu)" /* Use the default. */ #undef LINK_SPEC #undef STARTFILE_SPEC #define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s" #undef ENDFILE_SPEC #define ENDFILE_SPEC \ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ crtend.o%s crtn.o%s" /* Don't set the target flags, this is done by the linker script */ #undef LIB_SPEC #define LIB_SPEC "" #undef LOCAL_LABEL_PREFIX #define LOCAL_LABEL_PREFIX "." /* This is how to store into the string LABEL the symbol_ref name of an internal numbered label where PREFIX is the class of label and NUM is the number within the class. This is suitable for output with `assemble_name'. */ #undef ASM_GENERATE_INTERNAL_LABEL #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ sprintf ((LABEL), "*.L%s%ld", (PREFIX), (long)(NUM)) /* ??? Inherited from sol2.h. Probably wrong. */ #undef WCHAR_TYPE #define WCHAR_TYPE "long int" #undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE BITS_PER_WORD /* ??? until fixed. */ #undef LONG_DOUBLE_TYPE_SIZE #define LONG_DOUBLE_TYPE_SIZE 64
/* disc_io.h Interface template for low level disc functions. Copyright (c) 2006 Michael "Chishm" Chisholm 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. 2006-07-11 - Chishm * Original release 2006-07-16 - Chishm * Renamed _CF_USE_DMA to _IO_USE_DMA * Renamed _CF_ALLOW_UNALIGNED to _IO_ALLOW_UNALIGNED */ #ifndef _DISC_IO_H #define _DISC_IO_H #include <nds/ndstypes.h> #define BYTES_PER_SECTOR 512 //---------------------------------------------------------------------- // Customisable features // Use DMA to read the card, remove this line to use normal reads/writes // #define _IO_USE_DMA // Allow buffers not alligned to 16 bits when reading files. // Note that this will slow down access speed, so only use if you have to. // It is also incompatible with DMA #define _IO_ALLOW_UNALIGNED #if defined _IO_USE_DMA && defined _IO_ALLOW_UNALIGNED #error "You can't use both DMA and unaligned memory" #endif #define FEATURE_MEDIUM_CANREAD 0x00000001 #define FEATURE_MEDIUM_CANWRITE 0x00000002 #define FEATURE_SLOT_GBA 0x00000010 #define FEATURE_SLOT_NDS 0x00000020 typedef bool (* FN_MEDIUM_STARTUP)(void) ; typedef bool (* FN_MEDIUM_ISINSERTED)(void) ; typedef bool (* FN_MEDIUM_READSECTORS)(u32 sector, u32 numSectors, void* buffer) ; typedef bool (* FN_MEDIUM_WRITESECTORS)(u32 sector, u32 numSectors, const void* buffer) ; typedef bool (* FN_MEDIUM_CLEARSTATUS)(void) ; typedef bool (* FN_MEDIUM_SHUTDOWN)(void) ; struct IO_INTERFACE_STRUCT { unsigned long ioType ; unsigned long features ; FN_MEDIUM_STARTUP fn_startup ; FN_MEDIUM_ISINSERTED fn_isInserted ; FN_MEDIUM_READSECTORS fn_readSectors ; FN_MEDIUM_WRITESECTORS fn_writeSectors ; FN_MEDIUM_CLEARSTATUS fn_clearStatus ; FN_MEDIUM_SHUTDOWN fn_shutdown ; } ; typedef struct IO_INTERFACE_STRUCT IO_INTERFACE ; #endif // define _DISC_IO_H
/* Copyright 2009, 2011 William Hart. 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 William Hart ``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 William Hart OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of William Hart. */ #include "mpir.h" #include "gmp-impl.h" void mpir_butterfly_lshB(mp_ptr t, mp_ptr u, mp_ptr i1, mp_ptr i2, mp_size_t limbs, mp_size_t x, mp_size_t y) { mp_limb_t cy, cy1, cy2; if (x == 0) { if (y == 0) cy = mpn_sumdiff_n(t + x, u + y, i1, i2, limbs + 1); else { cy = mpn_sumdiff_n(t, u + y, i1, i2, limbs - y); u[limbs] = -(cy&1); cy1 = cy>>1; cy = mpn_sumdiff_n(t + limbs - y, u, i2 + limbs - y, i1 + limbs - y, y); t[limbs] = cy>>1; mpn_add_1(t + limbs - y, t + limbs - y, y + 1, cy1); cy1 = -(cy&1) + (i2[limbs] - i1[limbs]); mpn_addmod_2expp1_1(u + y, limbs - y, cy1); cy1 = -(i1[limbs] + i2[limbs]); mpn_addmod_2expp1_1(t, limbs, cy1); } } else if (y == 0) { cy = mpn_sumdiff_n(t + x, u, i1, i2, limbs - x); t[limbs] = cy>>1; cy1 = cy&1; cy = mpn_sumdiff_n(t, u + limbs - x, i1 + limbs - x, i2 + limbs - x, x); cy2 = mpn_neg_n(t, t, x); u[limbs] = -(cy&1); mpn_sub_1(u + limbs - x, u + limbs - x, x + 1, cy1); cy1 = -(cy>>1) - cy2; cy1 -= (i1[limbs] + i2[limbs]); mpn_addmod_2expp1_1(t + x, limbs - x, cy1); cy1 = (i2[limbs] - i1[limbs]); mpn_addmod_2expp1_1(u, limbs, cy1); } else if (x > y) { cy = mpn_sumdiff_n(t + x, u + y, i1, i2, limbs - x); t[limbs] = cy>>1; cy1 = cy&1; cy = mpn_sumdiff_n(t, u + y + limbs - x, i1 + limbs - x, i2 + limbs - x, x - y); cy2 = mpn_neg_n(t, t, x - y); u[limbs] = -(cy&1); mpn_sub_1(u + y + limbs - x, u + y + limbs - x, x - y + 1, cy1); cy1 = (cy>>1) + cy2; cy = mpn_sumdiff_n(t + x - y, u, i2 + limbs - y, i1 + limbs - y, y); cy2 = mpn_neg_n(t + x - y, t + x - y, y); cy1 = -(cy>>1) - mpn_sub_1(t + x - y, t + x - y, y, cy1) - cy2; cy1 -= (i1[limbs] + i2[limbs]); mpn_addmod_2expp1_1(t + x, limbs - x, cy1); cy1 = -(cy&1) + (i2[limbs] - i1[limbs]); mpn_addmod_2expp1_1(u + y, limbs - y, cy1); } else if (x < y) { cy = mpn_sumdiff_n(t + x, u + y, i1, i2, limbs - y); u[limbs] = -(cy&1); cy1 = cy>>1; cy = mpn_sumdiff_n(t + x + limbs - y, u, i2 + limbs - y, i1 + limbs - y, y - x); t[limbs] = cy>>1; mpn_add_1(t + x + limbs - y, t + x + limbs - y, y - x + 1, cy1); cy1 = cy&1; cy = mpn_sumdiff_n(t, u + y - x, i2 + limbs - x, i1 + limbs - x, x); cy1 = -(cy&1) - mpn_sub_1(u + y - x, u + y - x, x, cy1); cy1 += (i2[limbs] - i1[limbs]); mpn_addmod_2expp1_1(u + y, limbs - y, cy1); cy2 = mpn_neg_n(t, t, x); cy1 = -(cy>>1) - (i1[limbs] + i2[limbs]) - cy2; mpn_addmod_2expp1_1(t + x, limbs - x, cy1); } else /* x == y */ { cy = mpn_sumdiff_n(t + x, u + x, i1, i2, limbs - x); t[limbs] = cy>>1; u[limbs] = -(cy&1); cy = mpn_sumdiff_n(t, u, i2 + limbs - x, i1 + limbs - x, x); cy2 = mpn_neg_n(t, t, x); cy1 = -(cy>>1) - (i1[limbs] + i2[limbs]) - cy2; mpn_addmod_2expp1_1(t + x, limbs - x, cy1); cy1 = -(cy&1) + i2[limbs] - i1[limbs]; mpn_addmod_2expp1_1(u + x, limbs - x, cy1); } }
#include "some_struct.h" void foo() { struct X x; x. // RUN: env CINDEXTEST_EDITING=1 c-index-test -code-completion-at=%s:4:5 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: FieldDecl:{ResultType int}{TypedText m} (35) (parent: StructDecl 'X')
// Copyright (c) 1999 // Utrecht University (The Netherlands), // ETH Zurich (Switzerland), // INRIA Sophia-Antipolis (France), // Max-Planck-Institute Saarbruecken (Germany), // and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org); you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public License as // published by the Free Software Foundation; either version 3 of the License, // or (at your option) any later version. // // Licensees holding a valid commercial license may use this file in // accordance with the commercial license agreement provided with the software. // // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // $URL$ // $Id$ // // // Author(s) : Stefan Schirra #ifndef CGAL_HOMOGENEOUS_H #define CGAL_HOMOGENEOUS_H #include <CGAL/Homogeneous/Homogeneous_base.h> #include <CGAL/Handle_for.h> #include <CGAL/Kernel/Type_equality_wrapper.h> #include <CGAL/Quotient.h> namespace CGAL { template < typename RT_, typename FT_, typename Kernel > struct Homogeneous_base_ref_count : public Homogeneous_base<RT_, FT_, Kernel > { typedef RT_ RT; typedef FT_ FT; // The mechanism that allows to specify reference-counting or not. template < typename T > struct Handle { typedef Handle_for<T> type; }; template < typename Kernel2 > struct Base { typedef Homogeneous_base_ref_count<RT_,FT_,Kernel2> Type; }; }; template < typename RT_, typename FT_ = Quotient<RT_> > struct Homogeneous : public Type_equality_wrapper< Homogeneous_base_ref_count<RT_, FT_, Homogeneous<RT_, FT_> >, Homogeneous<RT_, FT_> > {}; } //namespace CGAL #endif // CGAL_HOMOGENEOUS_H
//===-- Latency.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 // //===----------------------------------------------------------------------===// /// /// \file /// A BenchmarkRunner implementation to measure instruction latencies. /// //===----------------------------------------------------------------------===// #ifndef LLVM_TOOLS_LLVM_EXEGESIS_LATENCY_H #define LLVM_TOOLS_LLVM_EXEGESIS_LATENCY_H #include "BenchmarkRunner.h" #include "Error.h" #include "MCInstrDescView.h" #include "SnippetGenerator.h" namespace llvm { namespace exegesis { class LatencySnippetGenerator : public SnippetGenerator { public: using SnippetGenerator::SnippetGenerator; ~LatencySnippetGenerator() override; Expected<std::vector<CodeTemplate>> generateCodeTemplates(const Instruction &Instr, const BitVector &ForbiddenRegisters) const override; }; class LatencyBenchmarkRunner : public BenchmarkRunner { public: LatencyBenchmarkRunner(const LLVMState &State, InstructionBenchmark::ModeE Mode); ~LatencyBenchmarkRunner() override; private: Expected<std::vector<BenchmarkMeasure>> runMeasurements(const FunctionExecutor &Executor) const override; }; } // namespace exegesis } // namespace llvm #endif // LLVM_TOOLS_LLVM_EXEGESIS_LATENCY_H
#ifndef _INCLUDED_C_ASW_T75_H #define _INCLUDED_C_ASW_T75_H #include "c_basecombatcharacter.h" #include "iasw_client_usable_entity.h" struct dlight_t; class C_ASW_T75 : public C_BaseCombatCharacter, public IASW_Client_Usable_Entity { public: DECLARE_CLASS( C_ASW_T75, C_BaseCombatCharacter ); DECLARE_CLIENTCLASS(); C_ASW_T75(); virtual ~C_ASW_T75(); bool IsArmed() { return m_bArmed; } bool IsInUse() { return m_bIsInUse; } float GetArmProgress() { return m_flArmProgress; } int GetT75IconTextureID(); static bool s_bLoadedArmIcons; static int s_nArmIconTextureID; // IASW_Client_Usable_Entity virtual C_BaseEntity* GetEntity() { return this; } virtual bool IsUsable(C_BaseEntity *pUser); virtual bool GetUseAction(ASWUseAction &action, C_ASW_Marine *pUser); virtual void CustomPaint(int ix, int iy, int alpha, vgui::Panel *pUseIcon); virtual bool ShouldPaintBoxAround() { return true; } virtual bool NeedsLOSCheck() { return true; } CNetworkVar( bool, m_bArmed ); CNetworkVar( bool, m_bIsInUse ); CNetworkVar( float, m_flArmProgress ); CNetworkVar( float, m_flDetonateTime ); private: C_ASW_T75( const C_ASW_T75 & ); // not defined, not accessible }; #endif /* _INCLUDED_C_ASW_T75_H */
// Copyright (c) 2013, Cornell University // 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 HyperDex 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 hyperdex_daemon_index_info_h_ #define hyperdex_daemon_index_info_h_ // LevelDB #include <hyperleveldb/write_batch.h> // e #include <e/slice.h> // HyperDex #include "include/hyperdex.h" #include "namespace.h" #include "common/attribute_check.h" #include "common/ids.h" #include "common/range.h" #include "daemon/datalayer.h" BEGIN_HYPERDEX_NAMESPACE class index_encoding { public: // return NULL for unencodable type static const index_encoding* lookup(hyperdatatype datatype); public: index_encoding(); virtual ~index_encoding() throw (); public: // is this encoding fixed in size? are encoded_size() and // decoded_size() invariant of the passed slice? virtual bool encoding_fixed() const = 0; // the number of bytes necessary to encode "decoded" virtual size_t encoded_size(const e::slice& decoded) const = 0; // write the encoded form of "decoded" to "encoded" which points to at // least "encoded_size" bytes of memory virtual char* encode(const e::slice& decoded, char* encoded) const = 0; // the number of bytes necessary to decode "encoded" virtual size_t decoded_size(const e::slice& encoded) const = 0; // write the decoded form of "encoded" to "decoded" which points to at // least "decoded_size" bytes of memory virtual char* decode(const e::slice& encoded, char* decoded) const = 0; }; class index_info { public: // return NULL for unindexable type static const index_info* lookup(hyperdatatype datatype); public: index_info(); virtual ~index_info() throw (); public: // what datatype is this index for? virtual hyperdatatype datatype() const = 0; // apply to updates all the writes necessary to transform the index from // old_value to new_value virtual void index_changes(const index* idx, const region_id& ri, const index_encoding* key_ie, const e::slice& key, const e::slice* old_value, const e::slice* new_value, leveldb::WriteBatch* updates) const = 0; // return an iterator across all keys // if not indexable (full scan), return NULL virtual datalayer::index_iterator* iterator_for_keys(leveldb_snapshot_ptr snap, const region_id& ri) const; // return an iterator that retrieves at least the keys matching r // if not indexable (full scan), return NULL virtual datalayer::index_iterator* iterator_from_range(leveldb_snapshot_ptr snap, const region_id& ri, const index_id& ii, const range& r, const index_encoding* key_ie) const; // return an iterator that retrieves at least the keys that pass c // if not indexable (full scan), return NULL virtual datalayer::index_iterator* iterator_from_check(leveldb_snapshot_ptr snap, const region_id& ri, const index_id& ii, const attribute_check& c, const index_encoding* key_ie) const; }; END_HYPERDEX_NAMESPACE #endif // hyperdex_daemon_index_info_h_
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_PLATFORM_KEYS_EXTENSION_PLATFORM_KEYS_SERVICE_FACTORY_H_ #define CHROME_BROWSER_PLATFORM_KEYS_EXTENSION_PLATFORM_KEYS_SERVICE_FACTORY_H_ #include "components/keyed_service/content/browser_context_keyed_service_factory.h" namespace base { template <typename T> struct DefaultSingletonTraits; } // namespace base namespace chromeos { class ExtensionPlatformKeysService; // Factory to create ExtensionPlatformKeysService. class ExtensionPlatformKeysServiceFactory : public BrowserContextKeyedServiceFactory { public: static ExtensionPlatformKeysService* GetForBrowserContext( content::BrowserContext* context); static ExtensionPlatformKeysServiceFactory* GetInstance(); private: friend struct base::DefaultSingletonTraits< ExtensionPlatformKeysServiceFactory>; ExtensionPlatformKeysServiceFactory(); ExtensionPlatformKeysServiceFactory( const ExtensionPlatformKeysServiceFactory&) = delete; auto operator=(const ExtensionPlatformKeysServiceFactory&) = delete; ~ExtensionPlatformKeysServiceFactory() override; // BrowserContextKeyedServiceFactory: content::BrowserContext* GetBrowserContextToUse( content::BrowserContext* context) const override; KeyedService* BuildServiceInstanceFor( content::BrowserContext* context) const override; }; } // namespace chromeos #endif // CHROME_BROWSER_PLATFORM_KEYS_EXTENSION_PLATFORM_KEYS_SERVICE_FACTORY_H_
#include "tommath_private.h" #ifdef BN_MP_SET_I32_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ MP_SET_SIGNED(mp_set_i32, mp_set_u32, int32_t, uint32_t) #endif
// // BNCLinkData.h // Branch-SDK // // Created by Qinwei Gong on 1/22/15. // Copyright (c) 2015 Branch Metrics. All rights reserved. // #if __has_feature(modules) @import Foundation; #else #import <Foundation/Foundation.h> #endif typedef NS_ENUM(NSUInteger, BranchLinkType) { BranchLinkTypeUnlimitedUse = 0, BranchLinkTypeOneTimeUse = 1 }; @interface BNCLinkData : NSObject <NSSecureCoding> @property (strong, nonatomic) NSMutableDictionary *data; - (void)setupTags:(NSArray *)tags; - (void)setupAlias:(NSString *)alias; - (void)setupType:(BranchLinkType)type; - (void)setupChannel:(NSString *)channel; - (void)setupFeature:(NSString *)feature; - (void)setupStage:(NSString *)stage; - (void)setupCampaign:(NSString *)campaign; - (void)setupParams:(NSDictionary *)params; - (void)setupMatchDuration:(NSUInteger)duration; - (void)setupIgnoreUAString:(NSString *)ignoreUAString; @end
/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-skip-if "" { powerpc*-*-*spe* } } */ /* { dg-require-effective-target powerpc_p8vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ /* { dg-options "-mcpu=power8 -O2" } */ /* { dg-final { scan-assembler "mtvsrd" } } */ /* { dg-final { scan-assembler "mfvsrd" } } */ /* Check code generation for direct move for vector types. */ #define TYPE vector int #define VSX_REG_ATTR "wa" #include "direct-move.h"
/* Structures and definitions for the user accounting database. GNU version. Copyright (C) 1997, 1998, 2000, 2001, 2002, 2008 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 _UTMPX_H # error "Never include <bits/utmpx.h> directly; use <utmpx.h> instead." #endif #include <bits/types.h> #include <sys/time.h> #include <bits/wordsize.h> #ifdef __USE_GNU # include <paths.h> # define _PATH_UTMPX _PATH_UTMP # define _PATH_WTMPX _PATH_WTMP #endif #define __UT_LINESIZE 32 #define __UT_NAMESIZE 32 #define __UT_HOSTSIZE 256 /* The structure describing the status of a terminated process. This type is used in `struct utmpx' below. */ struct __exit_status { #ifdef __USE_GNU short int e_termination; /* Process termination status. */ short int e_exit; /* Process exit status. */ #else short int __e_termination; /* Process termination status. */ short int __e_exit; /* Process exit status. */ #endif }; /* The structure describing an entry in the user accounting database. */ struct utmpx { short int ut_type; /* Type of login. */ __pid_t ut_pid; /* Process ID of login process. */ char ut_line[__UT_LINESIZE]; /* Devicename. */ char ut_id[4]; /* Inittab ID. */ char ut_user[__UT_NAMESIZE]; /* Username. */ char ut_host[__UT_HOSTSIZE]; /* Hostname for remote login. */ struct __exit_status ut_exit; /* Exit status of a process marked as DEAD_PROCESS. */ /* The fields ut_session and ut_tv must be the same size when compiled 32- and 64-bit. This allows files and shared memory to be shared between 32- and 64-bit applications. */ #if __WORDSIZE == 32 __int64_t ut_session; /* Session ID, used for windowing. */ struct { __int64_t tv_sec; /* Seconds. */ __int64_t tv_usec; /* Microseconds. */ } ut_tv; /* Time entry was made. */ #else long int ut_session; /* Session ID, used for windowing. */ struct timeval ut_tv; /* Time entry was made. */ #endif __int32_t ut_addr_v6[4]; /* Internet address of remote host. */ char __unused[20]; /* Reserved for future use. */ }; /* Values for the `ut_type' field of a `struct utmpx'. */ #define EMPTY 0 /* No valid user accounting information. */ #ifdef __USE_GNU # define RUN_LVL 1 /* The system's runlevel. */ #endif #define BOOT_TIME 2 /* Time of system boot. */ #define NEW_TIME 3 /* Time after system clock changed. */ #define OLD_TIME 4 /* Time when system clock changed. */ #define INIT_PROCESS 5 /* Process spawned by the init process. */ #define LOGIN_PROCESS 6 /* Session leader of a logged in user. */ #define USER_PROCESS 7 /* Normal process. */ #define DEAD_PROCESS 8 /* Terminated process. */ #ifdef __USE_GNU # define ACCOUNTING 9 /* System accounting. */ #endif
/* packet-ansi_tcap.h * * $Id$ * * Copyright 2007 Anders Broman <anders.broman@ericsson.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. */ #ifndef PACKET_ANSI_TCAP_H #define PACKET_ANSI_TCAP_H #define ANSI_TCAP_CTX_SIGNATURE 0x41544341 /* "ATCA" */ struct ansi_tcap_private_t { guint32 signature; gboolean oid_is_present; /* Is the Application Context Version present */ void * objectApplicationId_oid; guint32 session_id; void * context; gchar *TransactionID_str; struct { /* "dynamic" data */ gint pdu; /* 1 : invoke, 2 : returnResult, 3 : returnError, 4 : reject */ gint OperationCode; /* 0 : national, 1 : private */ gint32 OperationCode_national; gint32 OperationCode_private; proto_item *OperationCode_item; } d; }; /*extern void add_ansi_tcap_subdissector(guint32 ssn, dissector_handle_t dissector);*/ /*extern void delete_ansi_tcap_subdissector(guint32 ssn, dissector_handle_t dissector);*/ #endif /* PACKET_ANSI_TCAP_H */
// // UUColor.h // UUChart // // Created by shake on 14-7-24. // Copyright (c) 2014年 uyiuyao. All rights reserved. // #import <UIKit/UIKit.h> /* * System Versioning Preprocessor Macros */ #define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width) #define UUGrey [UIColor colorWithRed:246.0/255.0 green:246.0/255.0 blue:246.0/255.0 alpha:1.0f] #define UULightBlue [UIColor colorWithRed:94.0/255.0 green:147.0/255.0 blue:196.0/255.0 alpha:1.0f] #define UUGreen [UIColor colorWithRed:77.0/255.0 green:186.0/255.0 blue:122.0/255.0 alpha:1.0f] #define UUTitleColor [UIColor colorWithRed:0.0/255.0 green:189.0/255.0 blue:113.0/255.0 alpha:1.0f] #define UUButtonGrey [UIColor colorWithRed:141.0/255.0 green:141.0/255.0 blue:141.0/255.0 alpha:1.0f] #define UUFreshGreen [UIColor colorWithRed:77.0/255.0 green:196.0/255.0 blue:122.0/255.0 alpha:1.0f] #define UURed [UIColor colorWithRed:245.0/255.0 green:94.0/255.0 blue:78.0/255.0 alpha:1.0f] #define UUMauve [UIColor colorWithRed:88.0/255.0 green:75.0/255.0 blue:103.0/255.0 alpha:1.0f] #define UUBrown [UIColor colorWithRed:119.0/255.0 green:107.0/255.0 blue:95.0/255.0 alpha:1.0f] #define UUBlue [UIColor colorWithRed:82.0/255.0 green:116.0/255.0 blue:188.0/255.0 alpha:1.0f] #define UUDarkBlue [UIColor colorWithRed:121.0/255.0 green:134.0/255.0 blue:142.0/255.0 alpha:1.0f] #define UUYellow [UIColor colorWithRed:242.0/255.0 green:197.0/255.0 blue:117.0/255.0 alpha:1.0f] #define UUWhite [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0f] #define UUDeepGrey [UIColor colorWithRed:99.0/255.0 green:99.0/255.0 blue:99.0/255.0 alpha:1.0f] #define UUPinkGrey [UIColor colorWithRed:200.0/255.0 green:193.0/255.0 blue:193.0/255.0 alpha:1.0f] #define UUHealYellow [UIColor colorWithRed:245.0/255.0 green:242.0/255.0 blue:238.0/255.0 alpha:1.0f] #define UULightGrey [UIColor colorWithRed:225.0/255.0 green:225.0/255.0 blue:225.0/255.0 alpha:1.0f] #define UUCleanGrey [UIColor colorWithRed:251.0/255.0 green:251.0/255.0 blue:251.0/255.0 alpha:1.0f] #define UULightYellow [UIColor colorWithRed:241.0/255.0 green:240.0/255.0 blue:240.0/255.0 alpha:1.0f] #define UUDarkYellow [UIColor colorWithRed:152.0/255.0 green:150.0/255.0 blue:159.0/255.0 alpha:1.0f] #define UUPinkDark [UIColor colorWithRed:170.0/255.0 green:165.0/255.0 blue:165.0/255.0 alpha:1.0f] #define UUCloudWhite [UIColor colorWithRed:244.0/255.0 green:244.0/255.0 blue:244.0/255.0 alpha:1.0f] #define UUBlack [UIColor colorWithRed:45.0/255.0 green:45.0/255.0 blue:45.0/255.0 alpha:1.0f] #define UUStarYellow [UIColor colorWithRed:252.0/255.0 green:223.0/255.0 blue:101.0/255.0 alpha:1.0f] #define UUTwitterColor [UIColor colorWithRed:0.0/255.0 green:171.0/255.0 blue:243.0/255.0 alpha:1.0] #define UUWeiboColor [UIColor colorWithRed:250.0/255.0 green:0.0/255.0 blue:33.0/255.0 alpha:1.0] #define UUiOSGreenColor [UIColor colorWithRed:98.0/255.0 green:247.0/255.0 blue:77.0/255.0 alpha:1.0] #define UURandomColor [UIColor colorWithRed:arc4random()%255/255.0 green:arc4random()%255/255.0 blue:arc4random()%255/255.0 alpha:1.0f] //范围 struct Range { CGFloat max; CGFloat min; }; typedef struct Range CGRange; CG_INLINE CGRange CGRangeMake(CGFloat max, CGFloat min); CG_INLINE CGRange CGRangeMake(CGFloat max, CGFloat min){ CGRange p; p.max = max; p.min = min; return p; } static const CGRange CGRangeZero = {0,0}; @interface UUColor : NSObject - (UIImage *)imageFromColor:(UIColor *)color; @end
/* * IBM TrackPoint PS/2 mouse driver * * Stephen Evanchik <evanchsa@gmail.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ #ifndef _TRACKPOINT_H #define _TRACKPOINT_H /* */ #define TP_COMMAND 0xE2 /* */ #define TP_READ_ID 0xE1 /* */ #define TP_MAGIC_IDENT 0x01 /* */ /* */ /* */ #define TP_RECALIB 0x51 /* */ #define TP_POWER_DOWN 0x44 /* */ #define TP_EXT_DEV 0x21 /* */ #define TP_EXT_BTN 0x4B /* */ #define TP_POR 0x7F /* */ #define TP_POR_RESULTS 0x25 /* */ #define TP_DISABLE_EXT 0x40 /* */ #define TP_ENABLE_EXT 0x41 /* */ /* */ #define TP_SET_SOFT_TRANS 0x4E /* */ #define TP_CANCEL_SOFT_TRANS 0xB9 /* */ #define TP_SET_HARD_TRANS 0x45 /* */ /* */ #define TP_WRITE_MEM 0x81 #define TP_READ_MEM 0x80 /* */ /* */ #define TP_SENS 0x4A /* */ #define TP_MB 0x4C /* */ #define TP_INERTIA 0x4D /* */ #define TP_SPEED 0x60 /* */ #define TP_REACH 0x57 /* */ #define TP_DRAGHYS 0x58 /* */ /* */ /* */ #define TP_MINDRAG 0x59 /* */ /* */ #define TP_THRESH 0x5C /* */ #define TP_UP_THRESH 0x5A /* */ #define TP_Z_TIME 0x5E /* */ #define TP_JENKS_CURV 0x5D /* */ /* */ #define TP_TOGGLE 0x47 /* */ #define TP_TOGGLE_MB 0x23 /* */ #define TP_MASK_MB 0x01 #define TP_TOGGLE_EXT_DEV 0x23 /* */ #define TP_MASK_EXT_DEV 0x02 #define TP_TOGGLE_DRIFT 0x23 /* */ #define TP_MASK_DRIFT 0x80 #define TP_TOGGLE_BURST 0x28 /* */ #define TP_MASK_BURST 0x80 #define TP_TOGGLE_PTSON 0x2C /* */ #define TP_MASK_PTSON 0x01 #define TP_TOGGLE_HARD_TRANS 0x2C /* */ #define TP_MASK_HARD_TRANS 0x80 #define TP_TOGGLE_TWOHAND 0x2D /* */ #define TP_MASK_TWOHAND 0x01 #define TP_TOGGLE_STICKY_TWO 0x2D /* */ #define TP_MASK_STICKY_TWO 0x04 #define TP_TOGGLE_SKIPBACK 0x2D /* */ #define TP_MASK_SKIPBACK 0x08 #define TP_TOGGLE_SOURCE_TAG 0x20 /* */ #define TP_MASK_SOURCE_TAG 0x80 #define TP_TOGGLE_EXT_TAG 0x22 /* */ #define TP_MASK_EXT_TAG 0x04 /* */ #define TP_POR_SUCCESS 0x3B /* */ #define TP_DEF_SENS 0x80 #define TP_DEF_INERTIA 0x06 #define TP_DEF_SPEED 0x61 #define TP_DEF_REACH 0x0A #define TP_DEF_DRAGHYS 0xFF #define TP_DEF_MINDRAG 0x14 #define TP_DEF_THRESH 0x08 #define TP_DEF_UP_THRESH 0xFF #define TP_DEF_Z_TIME 0x26 #define TP_DEF_JENKS_CURV 0x87 /* */ #define TP_DEF_MB 0x00 #define TP_DEF_PTSON 0x00 #define TP_DEF_SKIPBACK 0x00 #define TP_DEF_EXT_DEV 0x00 /* */ #define MAKE_PS2_CMD(params, results, cmd) ((params<<12) | (results<<8) | (cmd)) struct trackpoint_data { unsigned char sensitivity, speed, inertia, reach; unsigned char draghys, mindrag; unsigned char thresh, upthresh; unsigned char ztime, jenks; unsigned char press_to_select; unsigned char skipback; unsigned char ext_dev; }; #ifdef CONFIG_MOUSE_PS2_TRACKPOINT int trackpoint_detect(struct psmouse *psmouse, bool set_properties); #else inline int trackpoint_detect(struct psmouse *psmouse, bool set_properties) { return -ENOSYS; } #endif /* */ #endif /* */
/****************************************************************************** * * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. * * 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, 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, USA * * ******************************************************************************/ #ifndef __RTL8188E_CMD_H__ #define __RTL8188E_CMD_H__ #if 0 enum cmd_msg_element_id { NONE_CMDMSG_EID, AP_OFFLOAD_EID = 0, SET_PWRMODE_EID = 1, JOINBSS_RPT_EID = 2, RSVD_PAGE_EID = 3, RSSI_4_EID = 4, RSSI_SETTING_EID = 5, MACID_CONFIG_EID = 6, MACID_PS_MODE_EID = 7, P2P_PS_OFFLOAD_EID = 8, SELECTIVE_SUSPEND_ROF_CMD = 9, P2P_PS_CTW_CMD_EID = 32, MAX_CMDMSG_EID }; #else typedef enum _RTL8188E_H2C_CMD_ID { /* Class Common */ H2C_COM_RSVD_PAGE = 0x00, H2C_COM_MEDIA_STATUS_RPT = 0x01, H2C_COM_SCAN = 0x02, H2C_COM_KEEP_ALIVE = 0x03, H2C_COM_DISCNT_DECISION = 0x04, #ifndef CONFIG_WOWLAN H2C_COM_WWLAN = 0x05, #endif H2C_COM_INIT_OFFLOAD = 0x06, H2C_COM_REMOTE_WAKE_CTL = 0x07, H2C_COM_AP_OFFLOAD = 0x08, H2C_COM_BCN_RSVD_PAGE = 0x09, H2C_COM_PROB_RSP_RSVD_PAGE = 0x0A, /* Class PS */ H2C_PS_PWR_MODE = 0x20, H2C_PS_TUNE_PARA = 0x21, H2C_PS_TUNE_PARA_2 = 0x22, H2C_PS_LPS_PARA = 0x23, H2C_PS_P2P_OFFLOAD = 0x24, /* Class DM */ H2C_DM_MACID_CFG = 0x40, H2C_DM_TXBF = 0x41, H2C_RSSI_REPORT = 0x42, /* Class BT */ H2C_BT_COEX_MASK = 0x60, H2C_BT_COEX_GPIO_MODE = 0x61, H2C_BT_DAC_SWING_VAL = 0x62, H2C_BT_PSD_RST = 0x63, /* Class Remote WakeUp */ #ifdef CONFIG_WOWLAN H2C_COM_WWLAN = 0x80, H2C_COM_REMOTE_WAKE_CTRL = 0x81, H2C_COM_AOAC_GLOBAL_INFO = 0x82, H2C_COM_AOAC_RSVD_PAGE = 0x83, #endif /* Class */ /* H2C_RESET_TSF =0xc0, */ } RTL8188E_H2C_CMD_ID; #endif struct cmd_msg_parm { u8 eid; /* element id */ u8 sz; /* sz */ u8 buf[6]; }; enum { PWRS }; typedef struct _SETPWRMODE_PARM { u8 Mode;/* 0:Active,1:LPS,2:WMMPS */ /* u8 RLBM:4; */ /* 0:Min,1:Max,2: User define */ u8 SmartPS_RLBM;/* LPS=0:PS_Poll,1:PS_Poll,2:NullData,WMM=0:PS_Poll,1:NullData */ u8 AwakeInterval; /* unit: beacon interval */ u8 bAllQueueUAPSD; u8 PwrState;/* AllON(0x0c),RFON(0x04),RFOFF(0x00) */ } SETPWRMODE_PARM, *PSETPWRMODE_PARM; struct H2C_SS_RFOFF_PARAM { u8 ROFOn; /* 1: on, 0:off */ u16 gpio_period; /* unit: 1024 us */ } __attribute__((packed)); typedef struct JOINBSSRPT_PARM_88E { u8 OpMode; /* RT_MEDIA_STATUS */ #ifdef CONFIG_WOWLAN u8 MacID; /* MACID */ #endif /* CONFIG_WOWLAN */ } JOINBSSRPT_PARM_88E, *PJOINBSSRPT_PARM_88E; #if 0 /* move to hal_com_h2c.h */ typedef struct _RSVDPAGE_LOC_88E { u8 LocProbeRsp; u8 LocPsPoll; u8 LocNullData; u8 LocQosNull; u8 LocBTQosNull; #ifdef CONFIG_WOWLAN u8 LocRemoteCtrlInfo; u8 LocArpRsp; u8 LocNbrAdv; u8 LocGTKRsp; u8 LocGTKInfo; u8 LocProbeReq; u8 LocNetList; #endif /* CONFIG_WOWLAN */ } RSVDPAGE_LOC_88E, *PRSVDPAGE_LOC_88E; #endif /* host message to firmware cmd */ void rtl8188e_set_FwPwrMode_cmd(PADAPTER padapter, u8 Mode); void rtl8188e_set_FwJoinBssReport_cmd(PADAPTER padapter, u8 mstatus); u8 rtl8188e_set_rssi_cmd(PADAPTER padapter, u8 *param); u8 rtl8188e_set_raid_cmd(_adapter *padapter, u32 bitmap, u8 *arg, u8 bw); s32 FillH2CCmd_88E(PADAPTER padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer); /* u8 rtl8192c_set_FwSelectSuspend_cmd(PADAPTER padapter, u8 bfwpoll, u16 period); */ u8 GetTxBufferRsvdPageNum8188E(_adapter *padapter, bool wowlan); #ifdef CONFIG_P2P void rtl8188e_set_p2p_ps_offload_cmd(PADAPTER padapter, u8 p2p_ps_state); #endif /* CONFIG_P2P */ void CheckFwRsvdPageContent(PADAPTER padapter); #ifdef CONFIG_TSF_RESET_OFFLOAD /* u8 rtl8188e_reset_tsf(_adapter *padapter, u8 reset_port); */ int reset_tsf(PADAPTER Adapter, u8 reset_port); #endif /* CONFIG_TSF_RESET_OFFLOAD */ /* #define H2C_8188E_RSVDPAGE_LOC_LEN 5 */ /* #define H2C_8188E_AOAC_RSVDPAGE_LOC_LEN 7 */ /* --------------------------------------------------------------------------------------------------------- * ---------------------------------- H2C CMD CONTENT -------------------------------------------------- * --------------------------------------------------------------------------------------------------------- * */ #if 0 /* move to hal_com_h2c.h * _RSVDPAGE_LOC_CMD_0x00 */ #define SET_8188E_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 8, __Value) #define SET_8188E_H2CCMD_RSVDPAGE_LOC_PSPOLL(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE((__pH2CCmd)+1, 0, 8, __Value) #define SET_8188E_H2CCMD_RSVDPAGE_LOC_NULL_DATA(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE((__pH2CCmd)+2, 0, 8, __Value) #define SET_8188E_H2CCMD_RSVDPAGE_LOC_QOS_NULL_DATA(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE((__pH2CCmd)+3, 0, 8, __Value) /* AOAC_RSVDPAGE_LOC_0x83 */ #define SET_8188E_H2CCMD_AOAC_RSVDPAGE_LOC_REMOTE_WAKE_CTRL_INFO(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE((__pH2CCmd), 0, 8, __Value) #define SET_8188E_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE((__pH2CCmd)+1, 0, 8, __Value) #endif #endif/* __RTL8188E_CMD_H__ */
/* * Copyright (c) Bull S.A. 2007 All Rights Reserved. * * 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 would be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * Further, this software is distributed without any warranty that it is * free of the rightful claim of any third person regarding infringement * or the like. Any license provided herein, whether implied or * otherwise, applies only to this software file. Patent licenses, if * any, provided herein do not apply to combinations of this program with * other software, or any other product whatsoever. * * You should have received a copy of the GNU General Public License along * with this program; if not, write the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * History: * Created by: Cyril Lacabanne (Cyril.Lacabanne@bull.net) * */ #include <stdio.h> #include <stdlib.h> #include <time.h> #include <rpc/rpc.h> #include <sys/socket.h> #include <utmp.h> #include <sys/time.h> #include <netdb.h> #include <sys/types.h> #include <unistd.h> #include <errno.h> //Standard define #define PROCNUM 1 #define VERSNUM 1 int main(void) { //Program parameters : argc[1] : HostName or Host IP // argc[2] : Server Program Number // other arguments depend on test case int test_status = 1; //Default test result set to FAILED //This is only a test case, normally use, clnt->cl_auth instead of an AUTH structure AUTH *authUnx = NULL; authUnx = authunix_create_default(); //If we are here, macro call was successful test_status = ((AUTH *) authUnx != NULL) ? 0 : 1; //This last printf gives the result status to the tests suite //normally should be 0: test has passed or 1: test has failed printf("%d\n", test_status); return test_status; }
/* * This file is part of Cleanflight and Betaflight. * * Cleanflight and Betaflight are free software. You can redistribute * this software and/or modify this software 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. * * Cleanflight and Betaflight are distributed in the hope that they * 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 software. * * If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include "drivers/time.h" #include "interface/msp.h" // Each MSP port requires state and a receive buffer, revisit this default if someone needs more than 3 MSP ports. #define MAX_MSP_PORT_COUNT 3 typedef enum { MSP_IDLE, MSP_HEADER_START, MSP_HEADER_M, MSP_HEADER_X, MSP_HEADER_V1, MSP_PAYLOAD_V1, MSP_CHECKSUM_V1, MSP_HEADER_V2_OVER_V1, MSP_PAYLOAD_V2_OVER_V1, MSP_CHECKSUM_V2_OVER_V1, MSP_HEADER_V2_NATIVE, MSP_PAYLOAD_V2_NATIVE, MSP_CHECKSUM_V2_NATIVE, MSP_COMMAND_RECEIVED } mspState_e; typedef enum { MSP_PACKET_COMMAND, MSP_PACKET_REPLY } mspPacketType_e; typedef enum { MSP_EVALUATE_NON_MSP_DATA, MSP_SKIP_NON_MSP_DATA } mspEvaluateNonMspData_e; typedef enum { MSP_PENDING_NONE, MSP_PENDING_BOOTLOADER, MSP_PENDING_CLI } mspPendingSystemRequest_e; #define MSP_PORT_INBUF_SIZE 192 #ifdef USE_FLASHFS #ifdef STM32F1 #define MSP_PORT_DATAFLASH_BUFFER_SIZE 1024 #else #define MSP_PORT_DATAFLASH_BUFFER_SIZE 4096 #endif #define MSP_PORT_DATAFLASH_INFO_SIZE 16 #define MSP_PORT_OUTBUF_SIZE (MSP_PORT_DATAFLASH_BUFFER_SIZE + MSP_PORT_DATAFLASH_INFO_SIZE) #else #define MSP_PORT_OUTBUF_SIZE 256 #endif typedef struct __attribute__((packed)) { uint8_t size; uint8_t cmd; } mspHeaderV1_t; typedef struct __attribute__((packed)) { uint16_t size; } mspHeaderJUMBO_t; typedef struct __attribute__((packed)) { uint8_t flags; uint16_t cmd; uint16_t size; } mspHeaderV2_t; #define MSP_MAX_HEADER_SIZE 9 struct serialPort_s; typedef struct mspPort_s { struct serialPort_s *port; // null when port unused. timeMs_t lastActivityMs; mspPendingSystemRequest_e pendingRequest; mspState_e c_state; mspPacketType_e packetType; uint8_t inBuf[MSP_PORT_INBUF_SIZE]; uint16_t cmdMSP; uint8_t cmdFlags; mspVersion_e mspVersion; uint_fast16_t offset; uint_fast16_t dataSize; uint8_t checksum1; uint8_t checksum2; bool sharedWithTelemetry; } mspPort_t; void mspSerialInit(void); bool mspSerialWaiting(void); void mspSerialProcess(mspEvaluateNonMspData_e evaluateNonMspData, mspProcessCommandFnPtr mspProcessCommandFn, mspProcessReplyFnPtr mspProcessReplyFn); void mspSerialAllocatePorts(void); void mspSerialReleasePortIfAllocated(struct serialPort_s *serialPort); void mspSerialReleaseSharedTelemetryPorts(void); int mspSerialPush(uint8_t cmd, uint8_t *data, int datalen, mspDirection_e direction); uint32_t mspSerialTxBytesFree(void);
/* * This file is part of Cleanflight. * * Cleanflight 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. * * Cleanflight 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 Cleanflight. If not, see <http://www.gnu.org/licenses/>. */ #pragma once // Type of magnetometer used/detected typedef enum { MAG_DEFAULT = 0, MAG_NONE = 1, MAG_HMC5883 = 2, MAG_AK8975 = 3, MAG_AK8963 = 4 } magSensor_e; #define MAG_MAX MAG_AK8963 typedef struct compassConfig_s { int16_t mag_declination; // Get your magnetic decliniation from here : http://magnetic-declination.com/ // For example, -6deg 37min, = -637 Japan, format is [sign]dddmm (degreesminutes) default is zero. } compassConfig_t; PG_DECLARE_PROFILE(compassConfig_t, compassConfig); #ifdef MAG void compassInit(void); void updateCompass(flightDynamicsTrims_t *magZero); #endif void recalculateMagneticDeclination(void); extern int32_t magADC[XYZ_AXIS_COUNT]; extern sensor_align_e magAlign; extern mag_t mag; extern float magneticDeclination;
/* Paned Widgets * * The GtkHPaned and GtkVPaned Widgets divide their content * area into two panes with a divider in between that the * user can adjust. A separate child is placed into each * pane. * * There are a number of options that can be set for each pane. * This test contains both a horizontal (HPaned) and a vertical * (VPaned) widget, and allows you to adjust the options for * each side of each widget. */ #include <gtk/gtk.h> void toggle_resize (GtkWidget *widget, GtkWidget *child) { GtkPaned *paned = GTK_PANED (child->parent); gboolean is_child1 = (child == paned->child1); gboolean resize, shrink; resize = is_child1 ? paned->child1_resize : paned->child2_resize; shrink = is_child1 ? paned->child1_shrink : paned->child2_shrink; g_object_ref (child); gtk_container_remove (GTK_CONTAINER (child->parent), child); if (is_child1) gtk_paned_pack1 (paned, child, !resize, shrink); else gtk_paned_pack2 (paned, child, !resize, shrink); g_object_unref (child); } void toggle_shrink (GtkWidget *widget, GtkWidget *child) { GtkPaned *paned = GTK_PANED (child->parent); gboolean is_child1 = (child == paned->child1); gboolean resize, shrink; resize = is_child1 ? paned->child1_resize : paned->child2_resize; shrink = is_child1 ? paned->child1_shrink : paned->child2_shrink; g_object_ref (child); gtk_container_remove (GTK_CONTAINER (child->parent), child); if (is_child1) gtk_paned_pack1 (paned, child, resize, !shrink); else gtk_paned_pack2 (paned, child, resize, !shrink); g_object_unref (child); } GtkWidget * create_pane_options (GtkPaned *paned, const gchar *frame_label, const gchar *label1, const gchar *label2) { GtkWidget *frame; GtkWidget *table; GtkWidget *label; GtkWidget *check_button; frame = gtk_frame_new (frame_label); gtk_container_set_border_width (GTK_CONTAINER (frame), 4); table = gtk_table_new (3, 2, TRUE); gtk_container_add (GTK_CONTAINER (frame), table); label = gtk_label_new (label1); gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1); check_button = gtk_check_button_new_with_mnemonic ("_Resize"); gtk_table_attach_defaults (GTK_TABLE (table), check_button, 0, 1, 1, 2); g_signal_connect (check_button, "toggled", G_CALLBACK (toggle_resize), paned->child1); check_button = gtk_check_button_new_with_mnemonic ("_Shrink"); gtk_table_attach_defaults (GTK_TABLE (table), check_button, 0, 1, 2, 3); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE); g_signal_connect (check_button, "toggled", G_CALLBACK (toggle_shrink), paned->child1); label = gtk_label_new (label2); gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 0, 1); check_button = gtk_check_button_new_with_mnemonic ("_Resize"); gtk_table_attach_defaults (GTK_TABLE (table), check_button, 1, 2, 1, 2); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE); g_signal_connect (check_button, "toggled", G_CALLBACK (toggle_resize), paned->child2); check_button = gtk_check_button_new_with_mnemonic ("_Shrink"); gtk_table_attach_defaults (GTK_TABLE (table), check_button, 1, 2, 2, 3); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE); g_signal_connect (check_button, "toggled", G_CALLBACK (toggle_shrink), paned->child2); return frame; } GtkWidget * do_panes (GtkWidget *do_widget) { static GtkWidget *window = NULL; GtkWidget *frame; GtkWidget *hpaned; GtkWidget *vpaned; GtkWidget *button; GtkWidget *vbox; if (!window) { window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget)); g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window); gtk_window_set_title (GTK_WINDOW (window), "Panes"); gtk_container_set_border_width (GTK_CONTAINER (window), 0); vbox = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (window), vbox); vpaned = gtk_vpaned_new (); gtk_box_pack_start (GTK_BOX (vbox), vpaned, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER(vpaned), 5); hpaned = gtk_hpaned_new (); gtk_paned_add1 (GTK_PANED (vpaned), hpaned); frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN); gtk_widget_set_size_request (frame, 60, 60); gtk_paned_add1 (GTK_PANED (hpaned), frame); button = gtk_button_new_with_mnemonic ("_Hi there"); gtk_container_add (GTK_CONTAINER(frame), button); frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN); gtk_widget_set_size_request (frame, 80, 60); gtk_paned_add2 (GTK_PANED (hpaned), frame); frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN); gtk_widget_set_size_request (frame, 60, 80); gtk_paned_add2 (GTK_PANED (vpaned), frame); /* Now create toggle buttons to control sizing */ gtk_box_pack_start (GTK_BOX (vbox), create_pane_options (GTK_PANED (hpaned), "Horizontal", "Left", "Right"), FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), create_pane_options (GTK_PANED (vpaned), "Vertical", "Top", "Bottom"), FALSE, FALSE, 0); gtk_widget_show_all (vbox); } if (!gtk_widget_get_visible (window)) { gtk_widget_show (window); } else { gtk_widget_destroy (window); window = NULL; } return window; }
/* * Copyright (C) 2014 Freie Universität Berlin * * This file is subject to the terms and conditions of the GNU Lesser * General Public License v2.1. See the file LICENSE in the top level * directory for more details. */ /** * @ingroup core_arch * @{ * * @file atomic_arch.h * @brief Architecture dependent interface for an atomic set operation * * @author Hauke Petersen <hauke.petersen@fu-berlin.de> */ #ifndef __ATOMIC_ARCH_H #define __ATOMIC_ARCH_H #ifdef __cplusplus extern "C" { #endif /** * @brief Define mappings between arch and internal interfaces * * This mapping is done for compatibility of existing platforms, * new platforms should always use the *_arch_* interfaces. * @{ */ #ifdef COREIF_NG #define atomic_set_return atomic_arch_set_return #endif /** @} */ /** * @brief Set a value atomically without interruption from interrupts etc. * * @param[out] to_set variable to set * @param[in] value value to set to_set to * * @return the value that was set */ unsigned int atomic_arch_set_return(unsigned int *to_set, unsigned int value); #ifdef __cplusplus } #endif #endif /* __ATOMIC_ARCH_H */ /** @} */
#ifndef DICT2_CLASSA_H #define DICT2_CLASSA_H #include "ClassM.h" static int s_i = 97; class ClassA: public ClassM { public: template <class T> ClassA& operator =(const T&) { return *this; } ClassA(): fA(s_i) {} // This is the "constructor" virtual ~ClassA() {} // This is the 'destructor' operator int() { return 1; } // This is operator int() int a() { return fA; } // This is a comment of method a() void // This the previous line setA(int v) { // This is a comment of method setA() fA = v; ClassA aa; int i = 3; aa = i; } // End of body void dummy(int, float); // Dummy comment private: int fA; // This is a comment of fA }; void ClassA::dummy(int, float) {} #include <vector> namespace Bla { struct Base { typedef std::vector<int> MyVector; typedef int MyInteger; typedef MyInteger MyOtherInteger; enum { A, B, C }; enum { X }; enum { Y }; enum { Z }; enum {}; enum ENUM2 { D, E, F }; enum ENUM3_ { G, H, I }; typedef enum { J, K, L } enum4; int i; Base(): i(99) {} virtual ~Base() {} protected: enum protectedEnum { PA, PB, PC }; private: enum privateEnum { QA, QB, QC }; }; struct Left: virtual Base {}; struct Right: virtual Base {}; struct Diamond: Left, Right {}; } #include <iostream> #include <vector> #include <utility> namespace zot { struct foo_base { public: foo_base(): fBar(4711) {} ~foo_base() {} protected: int fBar; }; class foo: virtual public foo_base { public: int bar(); void set_bar(int i); void set_bar(float f); void operator ++(); }; inline int foo::bar() { return fBar; } inline void foo::set_bar(float f) { fBar = int (f); } inline void foo::set_bar(int i) { fBar = i; } inline void foo::operator ++() { ++fBar; } } // namespace zot template <int i> class classVec { private: double arr[i]; }; template class classVec<5>; #endif // DICT2_CLASSA_H
/* * Copyright 2014 Red Hat Inc., Durham, North Carolina. * All Rights Reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * */ #ifndef OSCAP_SOURCE_DOC_TYPE_H #define OSCAP_SOURCE_DOC_TYPE_H #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <libxml/xmlreader.h> #include "common/public/oscap.h" #include "common/util.h" OSCAP_HIDDEN_START; /** * Determines the SCAP type of the document xmlTextReder. This function is deemed * to be private forever, as it moves with the reader context. * @param reader xmlTextReader to determine document type * @param doc_type determined document type (output parameter) * @returns -1 on error, 0 otherwise */ int oscap_determine_document_type_reader(xmlTextReader *reader, oscap_document_type_t *doc_type); OSCAP_HIDDEN_END; #endif
/*************************************************************** * * Copyright (C) 1990-2011, Condor Team, Computer Sciences Department, * University of Wisconsin-Madison, WI. * * 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 __DEBUG_TIMER_H__ #define __DEBUG_TIMER_H__ class DebugTimerBase { public: DebugTimerBase( bool start = true ); virtual ~DebugTimerBase( void ); void Start( void ); double Stop( void ); // stop + return diff double Elapsed( void ); // Seconds since started double Diff( void ); // stop time - start time void Log( const char *s, int count = -1, bool stop = true ); virtual void Output( const char *) { }; private: bool m_on; double m_t1; double m_t2; double dtime( void ); }; #endif//__DEBUG_TIMER_H__
// // ______ _ _ _ _____ _____ _ __ // | ____| | | (_) | | / ____| __ \| |/ / // | |__ ___| |_ _ _ __ ___ ___ | |_ ___ | (___ | | | | ' / // | __| / __| __| | '_ ` _ \ / _ \| __/ _ \ \___ \| | | | < // | |____\__ \ |_| | | | | | | (_) | || __/ ____) | |__| | . \ // |______|___/\__|_|_| |_| |_|\___/ \__\___| |_____/|_____/|_|\_\ // // // Copyright (c) 2015 Estimote. All rights reserved. #import <Foundation/Foundation.h> #import "ESTSettingReadWrite.h" @class ESTSettingDeviceInfoName; NS_ASSUME_NONNULL_BEGIN /** * Block used as a result of read/write setting Name operation for Device Info packet. * * @param name Name setting carrying value. * @param error Operation error. No error means success. */ typedef void(^ESTSettingDeviceInfoNameCompletionBlock)(ESTSettingDeviceInfoName * _Nullable nameSetting, NSError * _Nullable error); /** * ESTSettingDeviceInfoName represents Device Info Name value. */ @interface ESTSettingDeviceInfoName : ESTSettingReadWrite <NSCopying> /** * Designated initializer. Validates provided value internally with +validationErrorForValue:. * * @see +[ESTSettingDeviceInfoName validationErrorForValue:] * * @param name Device Info Name value. * * @return Initialized object. Nil if validation fails. */ - (instancetype)initWithValue:(NSString *)name; /** * Returns current value of Device Info Name setting. * * @return Device Info Name value. */ - (NSString *)getValue; /** * Method allows to read value of initialized Device Info Name setting object. * * @param completion Block to be invoked when operation is complete. * * @return Initialized operation object. */ - (void)readValueWithCompletion:(ESTSettingDeviceInfoNameCompletionBlock)completion; /** * Method allows to create write operation from already initialized Device Info Name setting object. * Value provided during initialization will be used as a desired value. * * @param name Name value to be written to the device. * @param completion Block to be invoked when operation is complete. * * @return Initialized operation object. */ - (void)writeValue:(NSString *)name completion:(ESTSettingDeviceInfoNameCompletionBlock)completion; /** * Method checks if provided value is allowed. Returns nil if validation passes. * * @param name Name value. * * @return Error object describing why validation failed. Nil if validation passes. */ + (NSError * _Nullable)validationErrorForValue:(NSString *)name; @end NS_ASSUME_NONNULL_END