text
stringlengths
4
6.14k
#include "config.h" #include "rtapi.h" /* RTAPI realtime OS API */ #include "hal.h" /* HAL public API decls */ #include "hal_priv.h" /* HAL private decls */ #include "hal_internal.h" #if defined(ULAPI) #include <stdio.h> #include <sys/types.h> /* pid_t */ #include <unistd.h> /* getpid() */ #endif /*********************************************************************** * Public HAL vtable functions * ************************************************************************/ int halg_export_vtable(const int use_hal_mutex, const char *name, int version, void *vtref, int comp_id) { CHECK_HALDATA(); CHECK_STRLEN(name, HAL_NAME_LEN); CHECK_NULL(vtref); CHECK_LOCK(HAL_LOCK_LOAD); HALDBG("exporting vtable '%s' version=%d owner=%d at %p", name, version, comp_id, vtref); { WITH_HAL_MUTEX_IF(use_hal_mutex); hal_vtable_t *vt; // make sure no such vtable name already exists if ((vt = halg_find_vtable_by_name(0, name, version)) != 0) { HALFAIL_RC(EEXIST, "vtable '%s' already exists", name); } // allocate vtable descriptor if ((vt = halg_create_objectf(0, sizeof(hal_vtable_t), HAL_VTABLE, comp_id, name)) == NULL) return _halerrno; vt->vtable = vtref; vt->version = version; #ifdef RTAPI vt->context = 0; // this is in RTAPI, and can be shared #else vt->context = getpid(); // in per-process memory, no shareable code #endif // make it visible halg_add_object(false, (hal_object_ptr)vt); HALDBG("created vtable '%s' vtable=%p version=%d", hh_get_name(&vt->hdr), vt->vtable, vt->version); // automatic unlock by scope exit return hh_get_id(&vt->hdr); } } int halg_remove_vtable(const int use_hal_mutex, const int vtable_id) { CHECK_HALDATA(); CHECK_LOCK(HAL_LOCK_LOAD); { WITH_HAL_MUTEX_IF(use_hal_mutex); hal_vtable_t *vt; // make sure no such vtable name already exists if ((vt = halpr_find_vtable_by_id(vtable_id)) == NULL) { HALFAIL_RC(ENOENT, "vtable %d not found", vtable_id); } // still referenced? if (ho_referenced(vt)) { HALFAIL_RC(ENOENT, "vtable %d busy (refcount=%d)", vtable_id, ho_refcnt(vt)); } HALDBG("vtable %s/%d version %d removed", hh_get_name(&vt->hdr), vtable_id, vt->version); return halg_free_object(false, (hal_object_ptr)vt); } } // returns vtable_id (handle) or error code // increases refcount int halg_reference_vtable(const int use_hal_mutex, const char *name, int version, void **vtableref) { CHECK_HALDATA(); CHECK_STRLEN(name, HAL_NAME_LEN); CHECK_NULL(vtableref); CHECK_LOCK(HAL_LOCK_LOAD); { WITH_HAL_MUTEX_IF(use_hal_mutex); hal_vtable_t *vt; // make sure no such vtable name already exists if ((vt = halpr_find_vtable_by_name(name, version)) == NULL) { HALFAIL_RC(ENOENT, "vtable '%s' version %d not found", name, version); } // make sure it's in the proper context #ifdef RTAPI int context = 0; // this is in RTAPI, and can be shared #else int context = getpid(); // in per-process memory, no shareable code #endif if (vt->context != context) { HALFAIL_RC(ENOENT, "vtable %s version %d: " "context mismatch - found context %d", name, version, vt->context); } ho_incref(vt); *vtableref = vt->vtable; HALDBG("vtable %s,%d found vtable=%p context=%d", hh_get_name(&vt->hdr), vt->version, vt->vtable, vt->context); // automatic unlock by scope exit return hh_get_id(&vt->hdr); } } // drops refcount int halg_unreference_vtable(const int use_hal_mutex, int vtable_id) { CHECK_HALDATA(); { WITH_HAL_MUTEX_IF(use_hal_mutex); hal_vtable_t *vt; // make sure no such vtable name already exists if ((vt = halpr_find_vtable_by_id(vtable_id)) == NULL) { HALFAIL_RC(ENOENT, "vtable %d not found", vtable_id); } // make sure it's in the proper context #ifdef RTAPI int context = 0; // this is in RTAPI, and can be shared #else int context = getpid(); // in per-process memory, no shareable code #endif if (vt->context != context) { HALFAIL_RC(ENOENT, "vtable %s/%d: " "context mismatch - calling context %d vtable context %d", hh_get_name(&vt->hdr), vtable_id, context, vt->context); } ho_decref(vt); HALDBG("vtable %s/%d refcount=%d", hh_get_name(&vt->hdr), vtable_id, ho_refcnt(vt)); // automatic unlock by scope exit return 0; } } hal_vtable_t *halg_find_vtable_by_name(const int use_hal_mutex, const char *name, const int version) { foreach_args_t args = { .type = HAL_VTABLE, .name = (char *)name, .user_arg1 = version, .user_ptr1 = NULL }; if (halg_foreach(use_hal_mutex, &args, yield_versioned_vtable_object)) return args.user_ptr1; return NULL; } // user_arg2 returns the number of vtables exported by the // comp with id passed in in user_arg1 static int count_exported_vtables_cb(hal_object_ptr o, foreach_args_t *args) { if (hh_get_owner_id(o.hdr) == args->user_arg1) { args->user_arg2++; } return 0; } int halg_count_exported_vtables(const int use_hal_mutex, const int comp_id) { foreach_args_t args = { .type = HAL_VTABLE, .user_arg1 = comp_id, .user_arg2 = 0, // returned count of exported vtables }; halg_foreach(use_hal_mutex, &args, count_exported_vtables_cb); return args.user_arg2; } #ifdef RTAPI EXPORT_SYMBOL(halg_export_vtable); EXPORT_SYMBOL(halg_remove_vtable); EXPORT_SYMBOL(halg_reference_vtable); EXPORT_SYMBOL(halg_unreference_vtable); EXPORT_SYMBOL(halg_find_vtable_by_name); EXPORT_SYMBOL(halg_count_exported_vtables); #endif
// Copyright (c) 1997-2001 // 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) : Sven Schoenherr <sven@inf.ethz.ch> #ifndef CGAL_MIN_SPHERE_ANULUS_D_TRAITS_D_H #define CGAL_MIN_SPHERE_ANULUS_D_TRAITS_D_H // includes # include <CGAL/Optimisation/Access_dimension_d.h> # include <CGAL/Optimisation/Access_coordinates_begin_d.h> # include <CGAL/Optimisation/Construct_point_d.h> namespace CGAL { // Class declaration // ================= template < class K_, class ET_ = typename K_::RT, class NT_ = typename K_::RT > class Min_sphere_annulus_d_traits_d; // Class interface // =============== template < class K_, class ET_, class NT_> class Min_sphere_annulus_d_traits_d { public: // self typedef K_ K; typedef ET_ ET; typedef NT_ NT; typedef Min_sphere_annulus_d_traits_d<K,ET,NT> Self; // types typedef typename K::Point_d Point_d; typedef typename K::Rep_tag Rep_tag; typedef typename K::RT RT; typedef typename K::FT FT; typedef CGAL::Access_dimension_d<K> Access_dimension_d; typedef CGAL::Access_coordinates_begin_d<K> Access_coordinates_begin_d; typedef CGAL::_Construct_point_d<K> Construct_point_d; // creation Min_sphere_annulus_d_traits_d( ) { } Min_sphere_annulus_d_traits_d( const Min_sphere_annulus_d_traits_d<K_,ET_,NT_>&) {} // operations Access_dimension_d access_dimension_d_object( ) const { return Access_dimension_d(); } Access_coordinates_begin_d access_coordinates_begin_d_object( ) const { return Access_coordinates_begin_d(); } Construct_point_d construct_point_d_object( ) const { return Construct_point_d(); } }; } //namespace CGAL #endif // CGAL_MIN_SPHERE_ANULUS_D_TRAITS_D_H // ===== EOF ==================================================================
//////////////////////////////////////////////////////////////////////////////// /// @brief collection write locker /// /// @file /// /// DISCLAIMER /// /// Copyright 2014 ArangoDB GmbH, Cologne, Germany /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany /// /// 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. /// /// Copyright holder is ArangoDB GmbH, Cologne, Germany /// /// @author Jan Steemann /// @author Copyright 2014, ArangoDB GmbH, Cologne, Germany /// @author Copyright 2012-2013, triAGENS GmbH, Cologne, Germany //////////////////////////////////////////////////////////////////////////////// #ifndef ARANGODB_UTILS_COLLECTION_WRITE_LOCKER_H #define ARANGODB_UTILS_COLLECTION_WRITE_LOCKER_H 1 #include "Basics/Common.h" #include "VocBase/document-collection.h" namespace triagens { namespace arango { // ----------------------------------------------------------------------------- // --SECTION-- class CollectionWriteLocker // ----------------------------------------------------------------------------- class CollectionWriteLocker { // ----------------------------------------------------------------------------- // --SECTION-- constructors / destructors // ----------------------------------------------------------------------------- public: CollectionWriteLocker (CollectionWriteLocker const&) = delete; CollectionWriteLocker& operator= (CollectionWriteLocker const&) = delete; //////////////////////////////////////////////////////////////////////////////// /// @brief create the locker //////////////////////////////////////////////////////////////////////////////// CollectionWriteLocker (TRI_document_collection_t* document, bool doLock) : _document(document), _doLock(false) { if (doLock) { _document->beginWrite(_document); _doLock = true; } } //////////////////////////////////////////////////////////////////////////////// /// @brief destroy the locker //////////////////////////////////////////////////////////////////////////////// ~CollectionWriteLocker () { unlock(); } // ----------------------------------------------------------------------------- // --SECTION-- public functions // ----------------------------------------------------------------------------- //////////////////////////////////////////////////////////////////////////////// /// @brief release the lock //////////////////////////////////////////////////////////////////////////////// inline void unlock () { if (_doLock) { _document->endWrite(_document); _doLock = false; } } // ----------------------------------------------------------------------------- // --SECTION-- private variables // ----------------------------------------------------------------------------- private: //////////////////////////////////////////////////////////////////////////////// /// @brief collection pointer //////////////////////////////////////////////////////////////////////////////// TRI_document_collection_t* _document; //////////////////////////////////////////////////////////////////////////////// /// @brief lock flag //////////////////////////////////////////////////////////////////////////////// bool _doLock; }; } } #endif // ----------------------------------------------------------------------------- // --SECTION-- END-OF-FILE // ----------------------------------------------------------------------------- // Local Variables: // mode: outline-minor // outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|// --SECTION--\\|/// @\\}" // End:
//===------------ MIRVRegNamerUtils.h - MIR VReg Renaming Utilities -------===// // // 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 // //===----------------------------------------------------------------------===// // // The purpose of these utilities is to abstract out parts of the MIRCanon pass // that are responsible for renaming virtual registers with the purpose of // sharing code with a MIRVRegNamer pass that could be the analog of the // opt -instnamer pass. // //===----------------------------------------------------------------------===// #ifndef LLVM_LIB_CODEGEN_MIRVREGNAMERUTILS_H #define LLVM_LIB_CODEGEN_MIRVREGNAMERUTILS_H #include "llvm/ADT/PostOrderIterator.h" #include "llvm/ADT/STLExtras.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/Passes.h" #include "llvm/Support/raw_ostream.h" #include <queue> namespace llvm { /// NamedVRegCursor - The cursor is an object that keeps track of what the next /// vreg name should be. It does book keeping to determine when to skip the /// index value and by how much, or if the next vreg name should be an increment /// from the previous. class NamedVRegCursor { MachineRegisterInfo &MRI; /// virtualVRegNumber - Book keeping of the last vreg position. unsigned virtualVRegNumber; /// SkipGapSize - Used to calculate a modulo amount to skip by after every /// sequence of instructions starting from a given side-effecting /// MachineInstruction for a given MachineBasicBlock. The general idea is that /// for a given program compiled with two different opt pipelines, there /// shouldn't be greater than SkipGapSize difference in how many vregs are in /// play between the two and for every def-use graph of vregs we rename we /// will round up to the next SkipGapSize'th number so that we have a high /// change of landing on the same name for two given matching side-effects /// for the two compilation outcomes. const unsigned SkipGapSize; /// RenamedInOtherBB - VRegs that we already renamed: ie breadcrumbs. std::vector<Register> RenamedInOtherBB; public: NamedVRegCursor() = delete; /// 1000 for the SkipGapSize was a good heuristic at the time of the writing /// of the MIRCanonicalizerPass. Adjust as needed. NamedVRegCursor(MachineRegisterInfo &MRI, unsigned SkipGapSize = 1000) : MRI(MRI), virtualVRegNumber(0), SkipGapSize(SkipGapSize) {} /// SkipGapSize - Skips modulo a gap value of indices. Indices are used to /// produce the next vreg name. void skipVRegs(); unsigned getVirtualVReg() const { return virtualVRegNumber; } /// incrementVirtualVReg - This increments an index value that us used to /// create a new vreg name. This is not a Register. unsigned incrementVirtualVReg(unsigned incr = 1) { virtualVRegNumber += incr; return virtualVRegNumber; } /// createVirtualRegister - Given an existing vreg, create a named vreg to /// take its place. unsigned createVirtualRegister(unsigned VReg); /// renameVRegs - For a given MachineBasicBlock, scan for side-effecting /// instructions, walk the def-use from each side-effecting root (in sorted /// root order) and rename the encountered vregs in the def-use graph in a /// canonical ordering. This method maintains book keeping for which vregs /// were already renamed in RenamedInOtherBB. // @return changed bool renameVRegs(MachineBasicBlock *MBB); }; } // namespace llvm #endif
/* * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2017-5-30 bernard the first version */ #include <rtthread.h> #include <rtdevice.h> #include <board.h> #include "mbox.h" void set_led(int state) //set state LED nyala atau mati { if (state==1) //LED nyala { mbox[0] = 8*4; // length of the message mbox[1] = MBOX_REQUEST; // this is a request message mbox[2] = 0x00038041; // get serial number command mbox[3] = 8; // buffer size mbox[4] = 0; mbox[5] = 130; // clear output buffer mbox[6] = 1; mbox[7] = MBOX_TAG_LAST; mbox_call(8, MMU_DISABLE); } else if (state==0) //LED mati { mbox[0] = 8*4; // length of the message mbox[1] = MBOX_REQUEST; // this is a request message mbox[2] = 0x00038041; // get serial number command mbox[3] = 8; // buffer size mbox[4] = 0; mbox[5] = 130; // clear output buffer mbox[6] = 0; mbox[7] = MBOX_TAG_LAST; mbox_call(8, MMU_DISABLE); } } int main(int argc, char** argv) { int count = 1; rt_kprintf("Hi, this is RT-Thread!!\n"); while (count++) { set_led(1); rt_thread_mdelay(500); set_led(0); rt_thread_mdelay(500); } return RT_EOK; }
/* * Copyright 2014-2016 CyberVision, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef Kaa_UserTransport_h #define Kaa_UserTransport_h #import <Foundation/Foundation.h> #import "KaaTransport.h" #import "EndpointGen.h" #import "EndpointRegistrationProcessor.h" /** * KaaTransport for the Endpoint service. * Updates the Endpoint manager state. */ @protocol UserTransport <KaaTransport> /** * Creates new User update request. * * @return New User update request. * @see UserSyncRequest */ - (UserSyncRequest *)createUserRequest; /** * Updates the state of the Endpoint manager according to the given response. * * @param response The response from the server. * @see UserSyncResponse */ - (void)onUserResponse:(UserSyncResponse *)response; /** * Sets the given Endpoint processor. * * @param processor The Endpoint processor to be set. * @see EndpointRegistrationProcessor */ - (void)setEndpointRegistrationProcessor:(id<EndpointRegistrationProcessor>)processor; @end #endif
// Copyright 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef IOS_CHROME_BROWSER_UI_SETTINGS_SYNC_UTILS_SYNC_ERROR_INFOBAR_DELEGATE_H_ #define IOS_CHROME_BROWSER_UI_SETTINGS_SYNC_UTILS_SYNC_ERROR_INFOBAR_DELEGATE_H_ #include <memory> #include <string> #include "components/infobars/core/confirm_infobar_delegate.h" #include "components/sync/driver/sync_service_observer.h" #include "ios/chrome/browser/sync/sync_setup_service.h" #include "ui/gfx/image/image.h" class ChromeBrowserState; @protocol SyncPresenter; namespace gfx { class Image; } namespace infobars { class InfoBarManager; } // Shows a sync error in an infobar. class SyncErrorInfoBarDelegate : public ConfirmInfoBarDelegate, public syncer::SyncServiceObserver { public: SyncErrorInfoBarDelegate(ChromeBrowserState* browser_state, id<SyncPresenter> presenter); SyncErrorInfoBarDelegate(const SyncErrorInfoBarDelegate&) = delete; SyncErrorInfoBarDelegate& operator=(const SyncErrorInfoBarDelegate&) = delete; ~SyncErrorInfoBarDelegate() override; // Creates a sync error infobar and adds it to |infobar_manager|. static bool Create(infobars::InfoBarManager* infobar_manager, ChromeBrowserState* browser_state, id<SyncPresenter> presenter); // InfoBarDelegate implementation. InfoBarIdentifier GetIdentifier() const override; // ConfirmInfoBarDelegate implementation. std::u16string GetMessageText() const override; int GetButtons() const override; std::u16string GetButtonLabel(InfoBarButton button) const override; gfx::Image GetIcon() const override; bool UseIconBackgroundTint() const override; bool Accept() override; // syncer::SyncServiceObserver implementation. void OnStateChanged(syncer::SyncService* sync) override; private: gfx::Image icon_; ChromeBrowserState* browser_state_; SyncSetupService::SyncServiceState error_state_; std::u16string message_; std::u16string button_text_; id<SyncPresenter> presenter_; }; #endif // IOS_CHROME_BROWSER_UI_SETTINGS_SYNC_UTILS_SYNC_ERROR_INFOBAR_DELEGATE_H_
#define CAVL_PARAM_NAME NCDVal__MapTree #define CAVL_PARAM_FEATURE_COUNTS 0 #define CAVL_PARAM_FEATURE_KEYS_ARE_INDICES 0 #define CAVL_PARAM_FEATURE_NOKEYS 0 #define CAVL_PARAM_TYPE_ENTRY NCDVal__maptree_entry #define CAVL_PARAM_TYPE_LINK NCDVal__idx #define CAVL_PARAM_TYPE_KEY NCDValRef #define CAVL_PARAM_TYPE_ARG NCDVal__maptree_arg #define CAVL_PARAM_VALUE_NULL ((NCDVal__idx)-1) #define CAVL_PARAM_FUN_DEREF(arg, link) ((struct NCDVal__mapelem *)buffer_at((arg), (link))) #define CAVL_PARAM_FUN_COMPARE_ENTRIES(arg, node1, node2) NCDVal_Compare(make_ref((arg), (node1).ptr->key_idx), make_ref((arg), (node2).ptr->key_idx)) #define CAVL_PARAM_FUN_COMPARE_KEY_ENTRY(arg, key1, node2) NCDVal_Compare((key1), make_ref((arg), (node2).ptr->key_idx)) #define CAVL_PARAM_MEMBER_CHILD tree_child #define CAVL_PARAM_MEMBER_BALANCE tree_balance #define CAVL_PARAM_MEMBER_PARENT tree_parent
/*************************************************************************** Copyright (c) 2016, The OpenBLAS Project 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 OpenBLAS project 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 OPENBLAS PROJECT 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 "common.h" #include <stdio.h> int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT dummy3, FLOAT *x, BLASLONG inc_x, FLOAT *y, BLASLONG inc_y, FLOAT *dummy, BLASLONG dummy2) { BLASLONG i=0; BLASLONG ix=0,iy=0; FLOAT temp; if ( n < 0 ) return(0); while(i < n) { temp = x[ix] ; x[ix] = y[iy] ; y[iy] = temp ; ix += inc_x ; iy += inc_y ; i++ ; } return(0); }
// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-apple-darwin9 %s #pragma ms_struct on #pragma ms_struct off #pragma ms_struct reset #pragma ms_struct // expected-warning {{incorrect use of '#pragma ms_struct on|off' - ignored}} #pragma ms_struct on top of spaghetti // expected-warning {{extra tokens at end of '#pragma ms_struct' - ignored}} struct foo { int a; int b; char c; }; struct { unsigned long bf_1 : 12; unsigned long : 0; unsigned long bf_2 : 12; } __attribute__((__ms_struct__)) t1; struct S { double __attribute__((ms_struct)) d; // expected-warning {{'ms_struct' attribute ignored}} unsigned long bf_1 : 12; unsigned long : 0; unsigned long bf_2 : 12; } __attribute__((ms_struct)) t2; enum { A = 0, B, C } __attribute__((ms_struct)) e1; // expected-warning {{'ms_struct' attribute ignored}} // rdar://10513599 #pragma ms_struct on typedef struct { void *pv; int l; } Foo; typedef struct { void *pv1; Foo foo; unsigned short fInited : 1; void *pv2; } PackOddity; #pragma ms_struct off static int arr[sizeof(PackOddity) == 40 ? 1 : -1];
// Copyright 2016 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 ASH_DISPLAY_DISPLAY_CONFIGURATION_CONTROLLER_H_ #define ASH_DISPLAY_DISPLAY_CONFIGURATION_CONTROLLER_H_ #include <memory> #include "ash/ash_export.h" #include "ash/display/window_tree_host_manager.h" #include "base/memory/weak_ptr.h" #include "ui/display/display.h" #include "ui/display/unified_desktop_utils.h" namespace display { class DisplayLayout; class DisplayManager; } // namespace display namespace ash { class DisplayAnimator; class ScreenRotationAnimator; // This class controls Display related configuration. Specifically it: // * Handles animated transitions where appropriate. // * Limits the frequency of certain operations. // * Provides a single interface for UI and API classes. // * TODO: Forwards display configuration changed events to UI and API classes. class ASH_EXPORT DisplayConfigurationController : public WindowTreeHostManager::Observer { public: // Use SYNC if it is important to rotate immediately after the // |SetDisplayRotation()|. As a side effect, the animation is less smooth. // ASYNC is actually slower because it takes longer to rotate the screen after // a screenshot is taken. http://crbug.com/757851. enum RotationAnimation { ANIMATION_SYNC = 0, ANIMATION_ASYNC, }; DisplayConfigurationController( display::DisplayManager* display_manager, WindowTreeHostManager* window_tree_host_manager); DisplayConfigurationController(const DisplayConfigurationController&) = delete; DisplayConfigurationController& operator=( const DisplayConfigurationController&) = delete; ~DisplayConfigurationController() override; // Sets the layout for the current displays with a fade in/out // animation. void SetDisplayLayout(std::unique_ptr<display::DisplayLayout> layout); // This should be called instead of SetDisplayLayout() to set the display // layout in the case of Unified Desktop mode. A fade in/out animation is // used as well. void SetUnifiedDesktopLayoutMatrix( const display::UnifiedDesktopLayoutMatrix& matrix); // Sets the mirror mode with a fade-in/fade-out animation. Affects all // displays. If |throttle| is true, this will fail if called within the // throttle time. void SetMirrorMode(bool mirror, bool throttle); // Sets the display's rotation with animation if available. void SetDisplayRotation(int64_t display_id, display::Display::Rotation rotation, display::Display::RotationSource source, RotationAnimation mode = ANIMATION_ASYNC); // Returns the rotation of the display given by |display_id|. This returns // the target rotation when the display is being rotated. display::Display::Rotation GetTargetRotation(int64_t display_id); // Sets the primary display id. If |throttle| is true, this will fail if // called within the throttle time. void SetPrimaryDisplayId(int64_t display_id, bool throttle); // In Unified Desktop mode, we consider the display in which the shelf will be // placed to be the "primary mirroring display". Note that this is different // from the "normal" primary display, which is just the single unified display // in unified mode. This display will be: // - The bottom-left in the matrix if the shelf alignment is "bottom", // - The top-left in the matrix if the shelf alignment is "left", // - The top-right in the matrix if the shelf alignment is "right". // This should only be called when Unified Desktop mode is active. display::Display GetPrimaryMirroringDisplayForUnifiedDesktop() const; // WindowTreeHostManager::Observer void OnDisplayConfigurationChanged() override; static void DisableAnimatorForTest(); protected: friend class DisplayConfigurationControllerTestApi; // Allow tests to enable or disable animations. void SetAnimatorForTest(bool enable); private: class DisplayChangeLimiter; // Sets the timeout for the DisplayChangeLimiter if it exists. Call this // *before* starting any animations. void SetThrottleTimeout(int64_t throttle_ms); bool IsLimited(); void SetDisplayLayoutImpl(std::unique_ptr<display::DisplayLayout> layout); void SetMirrorModeImpl(bool mirror); void SetPrimaryDisplayIdImpl(int64_t display_id); void SetUnifiedDesktopLayoutMatrixImpl( const display::UnifiedDesktopLayoutMatrix& matrix); // Returns the ScreenRotationAnimator associated with the |display_id|'s // |root_window|. If there is no existing ScreenRotationAnimator for // |root_window|, it will make one and store in the |root_window| property // |kScreenRotationAnimatorKey|. ScreenRotationAnimator* GetScreenRotationAnimatorForDisplay( int64_t display_id); display::DisplayManager* display_manager_; // weak ptr WindowTreeHostManager* window_tree_host_manager_; // weak ptr std::unique_ptr<DisplayAnimator> display_animator_; std::unique_ptr<DisplayChangeLimiter> limiter_; base::WeakPtrFactory<DisplayConfigurationController> weak_ptr_factory_{this}; }; } // namespace ash #endif // ASH_DISPLAY_DISPLAY_CONFIGURATION_CONTROLLER_H_
//----------------------------------------------------------------------------- // Copyright (c) 2012 GarageGames, LLC // // 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. //----------------------------------------------------------------------------- #ifndef _EDITOR_TOOL_ #define _EDITOR_TOOL_ #ifndef _WORLDEDITOR_H_ #include "gui/worldEditor/worldEditor.h" #endif class EditorTool : public SimObject { typedef SimObject Parent; protected: WorldEditor* mWorldEditor; bool mUseMouseDown; bool mUseMouseUp; bool mUseMouseMove; bool mUseRightMouseDown; bool mUseRightMouseUp; bool mUseRightMouseMove; bool mUseMiddleMouseDown; bool mUseMiddleMouseUp; bool mUseMiddleMouseMove; bool mUseKeyInput; public: EditorTool(); ~EditorTool(){} DECLARE_CONOBJECT(EditorTool); bool onAdd(); void onRemove(); //Called when the tool is activated on the World Editor virtual void onActivated(WorldEditor*); //Called when the tool is deactivated on the World Editor virtual void onDeactivated(); // virtual bool onMouseMove(const Gui3DMouseEvent &); virtual bool onMouseDown(const Gui3DMouseEvent &); virtual bool onMouseDragged(const Gui3DMouseEvent &); virtual bool onMouseUp(const Gui3DMouseEvent &); // virtual bool onRightMouseDown(const Gui3DMouseEvent &); virtual bool onRightMouseDragged(const Gui3DMouseEvent &); virtual bool onRightMouseUp(const Gui3DMouseEvent &); // virtual bool onMiddleMouseDown(const Gui3DMouseEvent &); virtual bool onMiddleMouseDragged(const Gui3DMouseEvent &); virtual bool onMiddleMouseUp(const Gui3DMouseEvent &); // virtual bool onInputEvent(const InputEventInfo &); // virtual void render(){} }; #endif
#pragma once #include "resource.h" class CSupportEnterCode : public CDialogImpl<CSupportEnterCode> { public: BEGIN_MSG_MAP_EX(CSettingConfig) MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) COMMAND_ID_HANDLER(IDOK, OnOkCmd) COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd) COMMAND_ID_HANDLER(IDC_REQUEST_LINK, OnRequestCode) END_MSG_MAP() enum { IDD = IDD_Support_EnterCode }; CSupportEnterCode(CProjectSupport & Support); private: CSupportEnterCode(void); CSupportEnterCode(const CSupportEnterCode&); CSupportEnterCode& operator=(const CSupportEnterCode&); LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled); LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled); LRESULT OnOkCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); LRESULT OnRequestCode(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); CHyperLink m_RequestLink; CProjectSupport & m_Support; };
/* * Copyright (c) 2020 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_BUFFER_LEVEL_FILTER_H_ #define MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_BUFFER_LEVEL_FILTER_H_ #include "modules/audio_coding/neteq/buffer_level_filter.h" #include "test/gmock.h" namespace webrtc { class MockBufferLevelFilter : public BufferLevelFilter { public: MOCK_METHOD(void, Update, (size_t buffer_size_samples, int time_stretched_samples)); MOCK_METHOD(int, filtered_current_level, (), (const)); }; } // namespace webrtc #endif // MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_BUFFER_LEVEL_FILTER_H_
/**************************************************************************** ** ** This file is part of the Qt Extended Opensource Package. ** ** Copyright (C) 2009 Trolltech ASA. ** ** Contact: Qt Extended Information (info@qtextended.org) ** ** This file may be used under the terms of the GNU General Public License ** version 2.0 as published by the Free Software Foundation and appearing ** in the file LICENSE.GPL included in the packaging of this file. ** ** Please review the following information to ensure GNU General Public ** Licensing requirements will be met: ** http://www.fsf.org/licensing/licenses/info/GPLv2.html. ** ** ****************************************************************************/ #ifndef UIFACTORY_H #define UIFACTORY_H #include <QDialog> class UIFactory { public: typedef QWidget* (*WidgetCreateFunction)(QWidget*,Qt::WFlags); static QWidget* createWidget( const QByteArray &widgetClassName, QWidget *parent = 0, Qt::WFlags flags = 0); static QDialog* createDialog( const QByteArray &dialogClassName, QWidget *parent = 0, Qt::WFlags flags = 0); static bool isAvailable( const QByteArray &widgetClassName ); static void install( const QMetaObject *meta, WidgetCreateFunction function ); }; #define UIFACTORY_REGISTER_WIDGET(CLASSNAME) \ static QWidget *install_##CLASSNAME( QWidget *p, Qt::WFlags f ) \ { return new CLASSNAME(p,f); } \ static UIFactory::WidgetCreateFunction append_##CLASSNAME() \ { UIFactory::install( &CLASSNAME::staticMetaObject, install_##CLASSNAME ); \ return install_##CLASSNAME; }\ static UIFactory::WidgetCreateFunction dummy_##CLASSNAME = \ append_##CLASSNAME(); #endif
#include <console/console.h> #include <arch/stages.h> #include <program_loading.h> #include <ip_checksum.h> #include <string.h> #include <symbols.h> /* When the ramstage is relocatable the elf loading ensures an elf image cannot * be loaded over the ramstage code. */ static void jmp_payload_no_bounce_buffer(void *entry) { /* Jump to kernel */ __asm__ __volatile__( " cld \n\t" /* Now jump to the loaded image */ " call *%0\n\t" /* The loaded image returned? */ " cli \n\t" " cld \n\t" :: "r" (entry) ); } static void jmp_payload(void *entry, unsigned long buffer, unsigned long size) { unsigned long lb_start, lb_size; lb_start = (unsigned long)&_program; lb_size = _program_size; printk(BIOS_SPEW, "entry = 0x%08lx\n", (unsigned long)entry); printk(BIOS_SPEW, "lb_start = 0x%08lx\n", lb_start); printk(BIOS_SPEW, "lb_size = 0x%08lx\n", lb_size); printk(BIOS_SPEW, "buffer = 0x%08lx\n", buffer); /* Jump to kernel */ __asm__ __volatile__( " cld \n\t" #ifdef __x86_64__ /* switch back to 32-bit mode */ " push %4\n\t" " push %3\n\t" " push %2\n\t" " push %1\n\t" " push %0\n\t" ".intel_syntax noprefix\n\t" /* use iret to switch to 32-bit code segment */ " xor rax,rax\n\t" " mov ax, ss\n\t" " push rax\n\t" " mov rax, rsp\n\t" " add rax, 8\n\t" " push rax\n\t" " pushfq\n\t" " push 0x10\n\t" " lea rax,[rip+3]\n\t" " push rax\n\t" " iretq\n\t" ".code32\n\t" /* disable paging */ " mov eax, cr0\n\t" " btc eax, 31\n\t" " mov cr0, eax\n\t" /* disable long mode */ " mov ecx, 0xC0000080\n\t" " rdmsr\n\t" " btc eax, 8\n\t" " wrmsr\n\t" " pop eax\n\t" " add esp, 4\n\t" " pop ebx\n\t" " add esp, 4\n\t" " pop ecx\n\t" " add esp, 4\n\t" " pop edx\n\t" " add esp, 4\n\t" " pop esi\n\t" " add esp, 4\n\t" ".att_syntax prefix\n\t" #endif /* Save the callee save registers... */ " pushl %%esi\n\t" " pushl %%edi\n\t" " pushl %%ebx\n\t" /* Save the parameters I was passed */ #ifdef __x86_64__ " pushl $0\n\t" /* 20 adjust */ " pushl %%eax\n\t" /* 16 lb_start */ " pushl %%ebx\n\t" /* 12 buffer */ " pushl %%ecx\n\t" /* 8 lb_size */ " pushl %%edx\n\t" /* 4 entry */ " pushl %%esi\n\t" /* 0 elf_boot_notes */ #else " pushl $0\n\t" /* 20 adjust */ " pushl %0\n\t" /* 16 lb_start */ " pushl %1\n\t" /* 12 buffer */ " pushl %2\n\t" /* 8 lb_size */ " pushl %3\n\t" /* 4 entry */ " pushl %4\n\t" /* 0 elf_boot_notes */ #endif /* Compute the adjustment */ " xorl %%eax, %%eax\n\t" " subl 16(%%esp), %%eax\n\t" " addl 12(%%esp), %%eax\n\t" " addl 8(%%esp), %%eax\n\t" " movl %%eax, 20(%%esp)\n\t" /* Place a copy of coreboot in its new location */ /* Move ``longs'' the coreboot size is 4 byte aligned */ " movl 12(%%esp), %%edi\n\t" " addl 8(%%esp), %%edi\n\t" " movl 16(%%esp), %%esi\n\t" " movl 8(%%esp), %%ecx\n\n" " shrl $2, %%ecx\n\t" " rep movsl\n\t" /* Adjust the stack pointer to point into the new coreboot image */ " addl 20(%%esp), %%esp\n\t" /* Adjust the instruction pointer to point into the new coreboot image */ " movl $1f, %%eax\n\t" " addl 20(%%esp), %%eax\n\t" " jmp *%%eax\n\t" "1: \n\t" /* Copy the coreboot bounce buffer over coreboot */ /* Move ``longs'' the coreboot size is 4 byte aligned */ " movl 16(%%esp), %%edi\n\t" " movl 12(%%esp), %%esi\n\t" " movl 8(%%esp), %%ecx\n\t" " shrl $2, %%ecx\n\t" " rep movsl\n\t" /* Now jump to the loaded image */ " movl %5, %%eax\n\t" " movl 0(%%esp), %%ebx\n\t" " call *4(%%esp)\n\t" /* The loaded image returned? */ " cli \n\t" " cld \n\t" /* Copy the saved copy of coreboot where coreboot runs */ /* Move ``longs'' the coreboot size is 4 byte aligned */ " movl 16(%%esp), %%edi\n\t" " movl 12(%%esp), %%esi\n\t" " addl 8(%%esp), %%esi\n\t" " movl 8(%%esp), %%ecx\n\t" " shrl $2, %%ecx\n\t" " rep movsl\n\t" /* Adjust the stack pointer to point into the old coreboot image */ " subl 20(%%esp), %%esp\n\t" /* Adjust the instruction pointer to point into the old coreboot image */ " movl $1f, %%eax\n\t" " subl 20(%%esp), %%eax\n\t" " jmp *%%eax\n\t" "1: \n\t" /* Drop the parameters I was passed */ " addl $24, %%esp\n\t" /* Restore the callee save registers */ " popl %%ebx\n\t" " popl %%edi\n\t" " popl %%esi\n\t" #ifdef __x86_64__ ".code64\n\t" #endif :: "ri" (lb_start), "ri" (buffer), "ri" (lb_size), "ri" (entry), "ri"(0), "ri" (0) ); } static void try_payload(struct prog *prog) { if (prog_type(prog) == ASSET_PAYLOAD) { if (IS_ENABLED(CONFIG_RELOCATABLE_RAMSTAGE)) jmp_payload_no_bounce_buffer(prog_entry(prog)); else jmp_payload(prog_entry(prog), (uintptr_t)prog_start(prog), prog_size(prog)); } } void arch_prog_run(struct prog *prog) { if (ENV_RAMSTAGE) try_payload(prog); __asm__ volatile ( #ifdef __x86_64__ "jmp *%%rdi\n" #else "jmp *%%edi\n" #endif :: "D"(prog_entry(prog)) ); }
/* EABI unaligned read/write functions. Copyright (C) 2005-2017 Free Software Foundation, Inc. Contributed by CodeSourcery, LLC. This file 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. This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Under Section 7 of GPL version 3, you are granted additional permissions described in the GCC Runtime Library Exception, version 3.1, as published by the Free Software Foundation. You should have received a copy of the GNU General Public License and a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ int __aeabi_uread4 (void *); int __aeabi_uwrite4 (int, void *); long long __aeabi_uread8 (void *); long long __aeabi_uwrite8 (long long, void *); struct __attribute__((packed)) u4 { int data; }; struct __attribute__((packed)) u8 { long long data; }; int __aeabi_uread4 (void *ptr) { return ((struct u4 *) ptr)->data; } int __aeabi_uwrite4 (int data, void *ptr) { ((struct u4 *) ptr)->data = data; return data; } long long __aeabi_uread8 (void *ptr) { return ((struct u8 *) ptr)->data; } long long __aeabi_uwrite8 (long long data, void *ptr) { ((struct u8 *) ptr)->data = data; return data; }
#ifndef _ASM_X86_VISWS_PIIX4_H #define _ASM_X86_VISWS_PIIX4_H /* */ #define PIIX_PM_START 0x0F80 #define SIO_GPIO_START 0x0FC0 #define SIO_PM_START 0x0FC8 #define PMBASE PIIX_PM_START #define GPIREG0 (PMBASE+0x30) #define GPIREG(x) (GPIREG0+((x)/8)) #define GPIBIT(x) (1 << ((x)%8)) #define PIIX_GPI_BD_ID1 18 #define PIIX_GPI_BD_ID2 19 #define PIIX_GPI_BD_ID3 20 #define PIIX_GPI_BD_ID4 21 #define PIIX_GPI_BD_REG GPIREG(PIIX_GPI_BD_ID1) #define PIIX_GPI_BD_MASK (GPIBIT(PIIX_GPI_BD_ID1) | \ GPIBIT(PIIX_GPI_BD_ID2) | \ GPIBIT(PIIX_GPI_BD_ID3) | \ GPIBIT(PIIX_GPI_BD_ID4) ) #define PIIX_GPI_BD_SHIFT (PIIX_GPI_BD_ID1 % 8) #define SIO_INDEX 0x2e #define SIO_DATA 0x2f #define SIO_DEV_SEL 0x7 #define SIO_DEV_ENB 0x30 #define SIO_DEV_MSB 0x60 #define SIO_DEV_LSB 0x61 #define SIO_GP_DEV 0x7 #define SIO_GP_BASE SIO_GPIO_START #define SIO_GP_MSB (SIO_GP_BASE>>8) #define SIO_GP_LSB (SIO_GP_BASE&0xff) #define SIO_GP_DATA1 (SIO_GP_BASE+0) #define SIO_PM_DEV 0x8 #define SIO_PM_BASE SIO_PM_START #define SIO_PM_MSB (SIO_PM_BASE>>8) #define SIO_PM_LSB (SIO_PM_BASE&0xff) #define SIO_PM_INDEX (SIO_PM_BASE+0) #define SIO_PM_DATA (SIO_PM_BASE+1) #define SIO_PM_FER2 0x1 #define SIO_PM_GP_EN 0x80 /* */ #define SPECIAL_DEV 0xff #define SPECIAL_REG 0x00 /* */ #define PIIX_SPECIAL_STOP 0x00120002 #define PIIX4_RESET_PORT 0xcf9 #define PIIX4_RESET_VAL 0x6 #define PMSTS_PORT 0xf80 // #define PMEN_PORT 0xf82 // #define PMCNTRL_PORT 0xf84 // #define PM_SUSPEND_ENABLE 0x2000 // /* */ #define PM_STS_RSM (1<<15) // #define PM_STS_PWRBTNOR (1<<11) // #define PM_STS_RTC (1<<10) // #define PM_STS_PWRBTN (1<<8) // #define PM_STS_GBL (1<<5) // #define PM_STS_BM (1<<4) // #define PM_STS_TMROF (1<<0) // /* */ #define PIIX_GPIREG0 (0xf80 + 0x30) /* */ #define PIIX_GPI_STPCLK 0x4 // #endif /* */
/* * Copyright (C) 2011, SAMSUNG Corporation. * Author: YongTaek Lee <ytk.lee@samsung.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 __BQ24157_CHARGER_H #define __BQ24157_CHARGER_H #include <linux/workqueue.h> #include <linux/wakelock.h> #define BQ24157_STAT_IRQ_DELAY (HZ*1) // 1 sec #define BQ24157_SET_CURRENT_LIMIT_DELAY (HZ*0.5) // 1 sec struct bq24157_platform_data{ unsigned int cd; struct work_struct stat_irq_work; struct delayed_work stat_irq_delayed_work; struct wake_lock stat_irq_wakelock; struct delayed_work set_current_limit_work; struct wake_lock set_current_limit_wakelock; unsigned int max_charger_current; unsigned int max_charger_voltage; unsigned int regulation_voltage; unsigned int cin_limit_current; unsigned int weak_bat_voltage; unsigned int charge_ta_current; unsigned int charge_usb_current; bool low_charge_mode; unsigned int dpm_voltage; unsigned int temination_current; unsigned int lpm_temination_current; bool termination_en; }; /* BQ24157 register map */ #define BQ24157_STATUS_CONTROL 0x0 #define BQ24157_CONTROL 0x1 #define BQ24157_BATTERY_VOLTAGE 0x2 #define BQ24157_VENDER_PART_REVISION 0x3 #define BQ24157_BATTERY_TERMINATION 0x4 #define BQ24157_CHARGER_VOLTAGE 0x5 #define BQ24157_SAFETY_LIMIT 0x6 /* BQ24157_STATUS_CONTROL REGISTER */ #define TMR_RST_OTG (1 << 7) #define EN_STAT (1 << 6) #define STAT2 (1 << 5) #define STAT1 (1 << 4) #define BOOST (1 << 3) #define FAULT_3 (1 << 2) #define FAULT_2 (1 << 1) #define FAULT_1 (1 << 0) #define STAT (STAT1 | STAT2) #define STAT_READY 0 #define STAT_INPROGRESS (STAT1) #define STAT_CHARGE_DONE (STAT2) #define STAT_FAULT (STAT1 | STAT2) #define FAULT (FAULT_1 | FAULT_2 | FAULT_3) #define FAULT_NORMAL 0 #define FAULT_VBUS_OVP (FAULT_1) #define FAULT_SLEEP_MODE (FAULT_2) #define FAULT_BAD_ADAPTOR (FAULT_1 | FAULT_2) #define FAULT_OUTPUT_OVP (FAULT_3) #define FAULT_THEMAL_SHUTDOWN (FAULT_1 | FAULT_3) #define FAULT_TIMER_FAULT (FAULT_2 | FAULT_3) #define FAULT_NO_BATTERY (FAULT_1 | FAULT_2 | FAULT_3) /* BQ24157_CONTROL REGISTER */ #define LIN_LIMIT2 (1 << 7) #define LIN_LIMIT1 (1 << 6) #define V_LOWV2 (1 << 5) #define V_LOWV1 (1 << 4) #define TE (1 << 3) #define CE (1 << 2) #define HZ_MODE (1 << 1) #define OPA_MODE (1 << 0) #define LIN_LIMIT (LIN_LIMIT1 | LIN_LIMIT2) #define USB_100MA 0 #define USB_500MA (LIN_LIMIT1) #define USB_CHARGER_800MA (LIN_LIMIT2) #define NO_LIMIT (LIN_LIMIT1 | LIN_LIMIT2) #define V_LOWV (V_LOWV1 | V_LOWV2) #define WEAK_BATTERY_3700MV (V_LOWV1 | V_LOWV2) #define WEAK_BATTERY_3600MV (V_LOWV2) #define WEAK_BATTERY_3500MV (V_LOWV1) #define WEAK_BATTERY_3400MV 0 #define TE_ENABLE (TE) #define TE_DISABLE 0 #define INPUT_CURRENT_LIMIT_SHIFT 6 #define ENABLE_ITERM_SHIFT 3 #define WEAK_BATTERY_VOLTAGE_SHIFT 4 /* BQ24157_BATTERY_VOLTAGE REGISTER */ #define VO_REG5 (1 << 7) #define VO_REG4 (1 << 6) #define VO_REG3 (1 << 5) #define VO_REG2 (1 << 4) #define VO_REG1 (1 << 3) #define VO_REG0 (1 << 2) #define OTG_PL (1 << 1) #define OTG_EN (1 << 0) #define VO_REG (VO_REG0 | VO_REG1 | VO_REG2 | \ VO_REG3 | VO_REG4 | VO_REG5 ) #define VOLTAGE_4200MV (VO_REG5 | VO_REG1 | VO_REG0) #define VOLTAGE_4350MV (VO_REG5 | VO_REG3 | VO_REG1) #define VOLTAGE_4360MV (VO_REG5 | VO_REG3 | VO_REG1 | VO_REG0) #define VOLTAGE_SHIFT 2 /* BQ24157_VENDER_PART_REVISION REGISTER */ #define VENDER2 (1 << 7) #define VENDER1 (1 << 6) #define VENDER0 (1 << 5) #define PN1 (1 << 4) #define PN0 (1 << 3) #define REVISION2 (1 << 2) #define REVISION1 (1 << 1) #define REVISION0 (1 << 0) /* BQ24157_BATTERY_TERMINATION REGISTER */ #define RESET (1 << 7) #define VI_CHRG3 (1 << 6) #define VI_CHRG2 (1 << 5) #define VI_CHRG1 (1 << 4) #define VI_CHRG0 (1 << 3) #define VI_TERM2 (1 << 2) #define VI_TERM1 (1 << 1) #define VI_TERM0 (1 << 0) #define VI_CHRG (VI_CHRG1 | VI_CHRG2 | VI_CHRG3) //VI_CHRG0 is NA for bq24157 #define VI_CHRG_550MA 0 #define VI_CHRG_650MA (VI_CHRG1) #define VI_CHRG_750MA (VI_CHRG2) #define VI_CHRG_850MA (VI_CHRG1 | VI_CHRG2) #define VI_CHRG_950MA (VI_CHRG3) #define VI_CHRG_1050MA (VI_CHRG1 | VI_CHRG3) #define VI_CHRG_1150MA (VI_CHRG2 | VI_CHRG3) #define VI_CHRG_1250MA (VI_CHRG1 | VI_CHRG2 | VI_CHRG3) #define VI_TERM (VI_TERM0 | VI_TERM1 | VI_TERM2) #define VI_TERM_50MA 0 #define VI_TERM_100MA (VI_TERM0) #define VI_TERM_150MA (VI_TERM1) #define VI_TERM_200MA (VI_TERM0 | VI_TERM1) #define VI_TERM_250MA (VI_TERM2) #define VI_TERM_300MA (VI_TERM0 | VI_TERM2) #define VI_TERM_350MA (VI_TERM1 | VI_TERM2) #define VI_TERM_400MA (VI_TERM0 | VI_TERM1 | VI_TERM2) #define CHARGE_CURRENT_SHIFT 4 /* BQ24157_CHARGER_VOLTAGE REGISTER */ #define LOW_CHG (1 << 5) #define DPM_STATUS (1 << 4) #define CD_STATUS (1 << 3) #define VSREG2 (1 << 2) #define VSREG1 (1 << 1) #define VSREG0 (1 << 0) #define DPM_MASK (VSREG0 | VSREG1 | VSREG2) #define DPM_4600 (VSREG2 | VSREG0) #define LOW_CHG_CURRENT LOW_CHG #define NORMAL_CHG_CURRENT 0 /* BQ24157_SAFETY_LIMIT REGISTER */ #define VMCHRG3 (1 << 7) #define VMCHRG2 (1 << 6) #define VMCHRG1 (1 << 5) #define VMCHRG0 (1 << 4) #define VMREG3 (1 << 3) #define VMREG2 (1 << 2) #define VMREG1 (1 << 1) #define VMREG0 (1 << 0) #define LIMIT_VOLTAGE_MASK (VMREG0 | VMREG1 | VMREG2 | VMREG3) #define LIMIT_VOLTAGE_4340MV (VMREG0 | VMREG1 | VMREG2) #define VMREG (VMREG0 | VMREG1 | VMREG2 | VMREG3 | VMCHRG0 | VMCHRG1 | VMCHRG2 | VMCHRG3) #define LIMIT_4360MV_1150MA (VMREG3 | VMCHRG1 | VMCHRG2) #define LIMIT_4200MV_1150MA (VMCHRG1 | VMCHRG2) #define MAX_CURRENT_SHIFT 4 #endif
/* * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) * Licensed under the GPL */ #ifndef __UM_NET_USER_H__ #define __UM_NET_USER_H__ #define ETH_ADDR_LEN (6) #define ETH_HEADER_ETHERTAP (16) #define ETH_HEADER_OTHER (26) /* */ #define ETH_MAX_PACKET (1500) #define UML_NET_VERSION (4) struct net_user_info { int (*init)(void *, void *); int (*open)(void *); void (*close)(int, void *); void (*remove)(void *); void (*add_address)(unsigned char *, unsigned char *, void *); void (*delete_address)(unsigned char *, unsigned char *, void *); int max_packet; int mtu; }; extern void ether_user_init(void *data, void *dev); extern void iter_addresses(void *d, void (*cb)(unsigned char *, unsigned char *, void *), void *arg); extern void *get_output_buffer(int *len_out); extern void free_output_buffer(void *buffer); extern int tap_open_common(void *dev, char *gate_addr); extern void tap_check_ips(char *gate_addr, unsigned char *eth_addr); extern void read_output(int fd, char *output_out, int len); extern int net_read(int fd, void *buf, int len); extern int net_recvfrom(int fd, void *buf, int len); extern int net_write(int fd, void *buf, int len); extern int net_send(int fd, void *buf, int len); extern int net_sendto(int fd, void *buf, int len, void *to, int sock_len); extern void open_addr(unsigned char *addr, unsigned char *netmask, void *arg); extern void close_addr(unsigned char *addr, unsigned char *netmask, void *arg); extern char *split_if_spec(char *str, ...); extern int dev_netmask(void *d, void *m); #endif
/* Conversion from and to IBM037. Copyright (C) 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #include <stdint.h> /* Get the conversion table. */ #include <ibm037.h> #define CHARSET_NAME "IBM037//" #define HAS_HOLES 1 /* Not all 256 character are defined. */ #include <8bit-generic.c>
// license:BSD-3-Clause // copyright-holders:Sandro Ronco #pragma once #ifndef __Z88_ROM_H__ #define __Z88_ROM_H__ #include "emu.h" #include "z88.h" //************************************************************************** // TYPE DEFINITIONS //************************************************************************** // ======================> z88_32k_rom_device class z88_32k_rom_device : public device_t, public device_z88cart_interface { public: // construction/destruction z88_32k_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); z88_32k_rom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); protected: // device-level overrides virtual void device_start() override; // z88cart_interface overrides virtual DECLARE_READ8_MEMBER(read) override; virtual UINT8* get_cart_base() override; virtual UINT32 get_cart_size() override { return 0x8000; } protected: // internal state UINT8 * m_rom; }; // ======================> z88_128k_rom_device class z88_128k_rom_device : public z88_32k_rom_device { public: // construction/destruction z88_128k_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); protected: // z88cart_interface overrides virtual UINT32 get_cart_size() override { return 0x20000; } }; // ======================> z88_256k_rom_device class z88_256k_rom_device : public z88_32k_rom_device { public: // construction/destruction z88_256k_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); protected: // z88cart_interface overrides virtual UINT32 get_cart_size() override { return 0x200000; } }; // device type definition extern const device_type Z88_32K_ROM; extern const device_type Z88_128K_ROM; extern const device_type Z88_256K_ROM; #endif /* __Z88_ROM_H__ */
// Vigenere Cipher // Author: Rishav Pandey #include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> int main(int argc, char* argv[]) { //check if user give more or less than two arguments. if(argc != 2) { printf("Enter the Valid Key"); return 1; } else { for(int i =0, n = strlen(argv[1]); i<n ;i++) { //check weather the key is only alphabet or not if(!isalpha(argv[1][i])) { printf("Enter only Alphabets"); return 1; } } } printf("plaintext: "); char s[100]; scanf("%s", s); char* k = argv[1]; int klen = strlen(k); printf("ciphertext: "); for(int i = 0, j = 0, n = strlen(s); i<n ; i++) { //wrap key for plaintext. int key = tolower(k[j % klen]) - 97; if(isalpha(s[i])) { //for upper case letters. if(isupper(s[i])) { printf("%c",((s[i]-65+key)%26)+65); //increase key for next char. j++; } //for lower case letters. else if(islower(s[i])) { printf("%c",((s[i]-97+key)%26)+97); //for lower case letters. j++; //increase key for next char. } } //for non alphabetical values. else { printf("%c",s[i]); } } printf("\n"); return 0; }
/** * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules 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/>. */ #ifndef COMMON_NULLPO_H #define COMMON_NULLPO_H #include "common/hercules.h" // enabled by default on debug builds #if defined(DEBUG) && !defined(NULLPO_CHECK) #define NULLPO_CHECK #endif // Skip assert checks on release builds #if !defined(RELEASE) && !defined(ASSERT_CHECK) #define ASSERT_CHECK #endif /** Assert */ #if defined(ASSERT_CHECK) // extern "C" { #include <assert.h> // } #if !defined(DEFCPP) && defined(WIN32) && !defined(MINGW) #include <crtdbg.h> #endif // !DEFCPP && WIN && !MINGW #define Assert(EX) assert(EX) /** * Reports an assertion failure if the passed expression is false. * * @param EX The expression to test. * @return false if the passed expression is true, false otherwise. */ #define Assert_chk(EX) ( (EX) ? false : (nullpo->assert_report(__FILE__, __LINE__, __func__, #EX, "failed assertion"), true) ) /** * Reports an assertion failure (without actually checking it). * * @param EX the expression to report. */ #define Assert_report(EX) (nullpo->assert_report(__FILE__, __LINE__, __func__, #EX, "failed assertion")) #else // ! ASSERT_CHECK #define Assert(EX) (EX) #define Assert_chk(EX) ((EX), false) #define Assert_report(EX) ((void)(EX)) #endif // ASSERT_CHECK #if defined(NULLPO_CHECK) /** * Reports NULL pointer information if the passed pointer is NULL * * @param t pointer to check * @return true if the passed pointer is NULL, false otherwise */ #define nullpo_chk(t) ( (t) != NULL ? false : (nullpo->assert_report(__FILE__, __LINE__, __func__, #t, "nullpo info"), true) ) #else // ! NULLPO_CHECK #define nullpo_chk(t) ((void)(t), false) #endif // NULLPO_CHECK /** * The following macros check for NULL pointers and return from the current * function or block in case one is found. * * It is guaranteed that the argument is evaluated once and only once, so it * is safe to call them as: * nullpo_ret(x = func()); * The macros can be used safely in any context, as they expand to a do/while * construct, except nullpo_retb, which expands to an if/else construct. */ /** * Returns 0 if a NULL pointer is found. * * @param t pointer to check */ #define nullpo_ret(t) \ do { if (nullpo_chk(t)) return(0); } while(0) /** * Returns 0 if the given assertion fails. * * @param t statement to check */ #define Assert_ret(t) \ do { if (Assert_chk(t)) return(0); } while(0) /** * Returns void if a NULL pointer is found. * * @param t pointer to check */ #define nullpo_retv(t) \ do { if (nullpo_chk(t)) return; } while(0) /** * Returns void if the given assertion fails. * * @param t statement to check */ #define Assert_retv(t) \ do { if (Assert_chk(t)) return; } while(0) /** * Returns the given value if a NULL pointer is found. * * @param ret value to return * @param t pointer to check */ #define nullpo_retr(ret, t) \ do { if (nullpo_chk(t)) return(ret); } while(0) /** * Returns the given value if the given assertion fails. * * @param ret value to return * @param t statement to check */ #define Assert_retr(ret, t) \ do { if (Assert_chk(t)) return(ret); } while(0) /** * Breaks from the current loop/switch if a NULL pointer is found. * * @param t pointer to check */ #define nullpo_retb(t) \ if (nullpo_chk(t)) break; else (void)0 /** * Breaks from the current loop/switch if the given assertion fails. * * @param t statement to check */ #define Assert_retb(t) \ if (Assert_chk(t)) break; else (void)0 struct nullpo_interface { void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); }; #ifdef HERCULES_CORE void nullpo_defaults(void); #endif // HERCULES_CORE HPShared struct nullpo_interface *nullpo; #endif /* COMMON_NULLPO_H */
/* Unaligned memory access functionality. Copyright (C) 2000, 2001, 2002, 2003, 2008 Red Hat, Inc. This file is part of elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. This file 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. elfutils 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/>. */ #ifndef _UNALIGNED_H #define _UNALIGNED_H 1 #include <byteswap.h> #include <endian.h> #ifndef UNALIGNED_ACCESS_CLASS # error "UNALIGNED_ACCESS_CLASS must be defined" #endif /* Macros to convert from the host byte order to that of the object file. */ #if UNALIGNED_ACCESS_CLASS == BYTE_ORDER # define target_bswap_16(n) (n) # define target_bswap_32(n) (n) # define target_bswap_64(n) (n) #else # define target_bswap_16(n) bswap_16 (n) # define target_bswap_32(n) bswap_32 (n) # define target_bswap_64(n) bswap_64 (n) #endif union u_2ubyte_unaligned { uint16_t u; char c[2]; } __attribute__((packed)); union u_4ubyte_unaligned { uint32_t u; char c[4]; } __attribute__((packed)); union u_8ubyte_unaligned { uint64_t u; char c[8]; } __attribute__((packed)); /* Macros to store value at unaligned address. */ #define store_2ubyte_unaligned(ptr, value) \ (void) (((union u_2ubyte_unaligned *) (ptr))->u = target_bswap_16 (value)) #define store_4ubyte_unaligned(ptr, value) \ (void) (((union u_4ubyte_unaligned *) (ptr))->u = target_bswap_32 (value)) #define store_8ubyte_unaligned(ptr, value) \ (void) (((union u_8ubyte_unaligned *) (ptr))->u = target_bswap_64 (value)) /* Macros to add value to unaligned address. This is a bit more complicated since the value must be read from memory and eventually converted twice. */ #if UNALIGNED_ACCESS_CLASS == BYTE_ORDER # define add_2ubyte_unaligned(ptr, value) \ (void) (((union u_2ubyte_unaligned *) (ptr))->u += value) # define add_4ubyte_unaligned(ptr, value) \ (void) (((union u_4ubyte_unaligned *) (ptr))->u += value) # define add_8ubyte_unaligned(ptr, value) \ (void) (((union u_8ubyte_unaligned *) (ptr))->u += value) #else # define add_2ubyte_unaligned(ptr, value) \ do { \ union u_2ubyte_unaligned *_ptr = (void *) (ptr); \ uint16_t _val = bswap_16 (_ptr->u) + (value); \ _ptr->u = bswap_16 (_val); \ } while (0) # define add_4ubyte_unaligned(ptr, value) \ do { \ union u_4ubyte_unaligned *_ptr = (void *) (ptr); \ uint32_t _val = bswap_32 (_ptr->u) + (value); \ _ptr->u = bswap_32 (_val); \ } while (0) # define add_8ubyte_unaligned(ptr, value) \ do { \ union u_8ubyte_unaligned *_ptr = (void *) (ptr); \ uint64_t _val = bswap_64 (_ptr->u) + (value); \ _ptr->u = bswap_64 (_val); \ } while (0) #endif #endif /* unaligned.h */
/* xoreos - A reimplementation of BioWare's Aurora engine * * xoreos is the legal property of its developers, whose names * can be found in the AUTHORS file distributed with this source * distribution. * * xoreos 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. * * xoreos 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 xoreos. If not, see <http://www.gnu.org/licenses/>. */ /** @file * The new game menu, expansion 1. */ #ifndef ENGINES_NWN_GUI_MAIN_NEWXP1_H #define ENGINES_NWN_GUI_MAIN_NEWXP1_H #include "src/engines/nwn/gui/gui.h" namespace Engines { namespace NWN { class Module; /** The NWN new game menu, expansion 1. */ class NewXP1Menu : public GUI { public: NewXP1Menu(Module &module, GUI &charType, ::Engines::Console *console = 0); ~NewXP1Menu(); protected: void initWidget(Widget &widget); void callbackActive(Widget &widget); private: Module *_module; GUI *_charType; void loadModule(const Common::UString &module); }; } // End of namespace NWN } // End of namespace Engines #endif // ENGINES_NWN_GUI_MAIN_NEWXP1_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 * * Authors: * Simon Lukasik <slukasik@redhat.com> * */ #pragma once #ifndef _OSCAP_XCCDF_POLICY_REPORT_CB_PRIV_H #define _OSCAP_XCCDF_POLICY_REPORT_CB_PRIV_H #include "common/util.h" #include "public/xccdf_policy.h" OSCAP_HIDDEN_START; /** * Callback structure with callback function and usr data (optional) * After rule evaluation action will be called the callback with user data. */ struct reporter; struct reporter *reporter_new(char *report_type, void *output_func, void *usr); int reporter_send_simple(struct reporter *reporter, void *data); OSCAP_HIDDEN_END; #endif
/* * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. * Copyright (C) 2008 Collabora Ltd. * Copyright (C) 2009 Martin Robinson * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * */ #ifndef WTF_GRefPtr_h #define WTF_GRefPtr_h #include "AlwaysInline.h" #include <algorithm> typedef struct _GHashTable GHashTable; namespace WTF { enum GRefPtrAdoptType { GRefPtrAdopt }; template <typename T> inline T* refGPtr(T*); template <typename T> inline void derefGPtr(T*); template <typename T> class GRefPtr; template <typename T> GRefPtr<T> adoptGRef(T*); template <> GHashTable* refGPtr(GHashTable* ptr); template <> void derefGPtr(GHashTable* ptr); template <typename T> class GRefPtr { public: GRefPtr() : m_ptr(0) { } GRefPtr(T* ptr) : m_ptr(ptr) { if (ptr) refGPtr(ptr); } GRefPtr(const GRefPtr& o) : m_ptr(o.m_ptr) { if (T* ptr = m_ptr) refGPtr(ptr); } template <typename U> GRefPtr(const GRefPtr<U>& o) : m_ptr(o.get()) { if (T* ptr = m_ptr) refGPtr(ptr); } ~GRefPtr() { if (T* ptr = m_ptr) derefGPtr(ptr); } void clear() { if (T* ptr = m_ptr) derefGPtr(ptr); m_ptr = 0; } T* get() const { return m_ptr; } T& operator*() const { return *m_ptr; } ALWAYS_INLINE T* operator->() const { return m_ptr; } bool operator!() const { return !m_ptr; } // This conversion operator allows implicit conversion to bool but not to other integer types. typedef T* GRefPtr::*UnspecifiedBoolType; operator UnspecifiedBoolType() const { return m_ptr ? &GRefPtr::m_ptr : 0; } GRefPtr& operator=(const GRefPtr&); GRefPtr& operator=(T*); template <typename U> GRefPtr& operator=(const GRefPtr<U>&); void swap(GRefPtr&); friend GRefPtr adoptGRef<T>(T*); private: static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); } // Adopting constructor. GRefPtr(T* ptr, GRefPtrAdoptType) : m_ptr(ptr) {} T* m_ptr; }; template <typename T> inline GRefPtr<T>& GRefPtr<T>::operator=(const GRefPtr<T>& o) { T* optr = o.get(); if (optr) refGPtr(optr); T* ptr = m_ptr; m_ptr = optr; if (ptr) derefGPtr(ptr); return *this; } template <typename T> inline GRefPtr<T>& GRefPtr<T>::operator=(T* optr) { T* ptr = m_ptr; if (optr) refGPtr(optr); m_ptr = optr; if (ptr) derefGPtr(ptr); return *this; } template <class T> inline void GRefPtr<T>::swap(GRefPtr<T>& o) { std::swap(m_ptr, o.m_ptr); } template <class T> inline void swap(GRefPtr<T>& a, GRefPtr<T>& b) { a.swap(b); } template <typename T, typename U> inline bool operator==(const GRefPtr<T>& a, const GRefPtr<U>& b) { return a.get() == b.get(); } template <typename T, typename U> inline bool operator==(const GRefPtr<T>& a, U* b) { return a.get() == b; } template <typename T, typename U> inline bool operator==(T* a, const GRefPtr<U>& b) { return a == b.get(); } template <typename T, typename U> inline bool operator!=(const GRefPtr<T>& a, const GRefPtr<U>& b) { return a.get() != b.get(); } template <typename T, typename U> inline bool operator!=(const GRefPtr<T>& a, U* b) { return a.get() != b; } template <typename T, typename U> inline bool operator!=(T* a, const GRefPtr<U>& b) { return a != b.get(); } template <typename T, typename U> inline GRefPtr<T> static_pointer_cast(const GRefPtr<U>& p) { return GRefPtr<T>(static_cast<T*>(p.get())); } template <typename T, typename U> inline GRefPtr<T> const_pointer_cast(const GRefPtr<U>& p) { return GRefPtr<T>(const_cast<T*>(p.get())); } template <typename T> inline T* getPtr(const GRefPtr<T>& p) { return p.get(); } template <typename T> GRefPtr<T> adoptGRef(T* p) { return GRefPtr<T>(p, GRefPtrAdopt); } template <typename T> inline T* refGPtr(T* ptr) { if (ptr) g_object_ref_sink(ptr); return ptr; } template <typename T> inline void derefGPtr(T* ptr) { if (ptr) g_object_unref(ptr); } } // namespace WTF using WTF::GRefPtr; using WTF::refGPtr; using WTF::derefGPtr; using WTF::adoptGRef; using WTF::static_pointer_cast; using WTF::const_pointer_cast; #endif // WTF_GRefPtr_h
#include <Windows.h> #include <csp/csp.h> #include <csp/arch/csp_semaphore.h> int csp_mutex_create(csp_mutex_t * mutex) { HANDLE mutexHandle = CreateMutex(NULL, FALSE, FALSE); if( mutexHandle == NULL ) { return CSP_MUTEX_ERROR; } *mutex = mutexHandle; return CSP_MUTEX_OK; } int csp_mutex_remove(csp_mutex_t * mutex) { if( !CloseHandle(*mutex) ) { return CSP_MUTEX_ERROR; } return CSP_MUTEX_OK; } int csp_mutex_lock(csp_mutex_t * mutex, uint32_t timeout) { if(WaitForSingleObject(*mutex, timeout) == WAIT_OBJECT_0) { return CSP_MUTEX_OK; } return CSP_MUTEX_ERROR; } int csp_mutex_unlock(csp_mutex_t * mutex) { if( !ReleaseMutex(*mutex) ) { return CSP_MUTEX_ERROR; } return CSP_MUTEX_OK; } int csp_bin_sem_create(csp_bin_sem_handle_t * sem) { HANDLE semHandle = CreateSemaphore(NULL, 1, 1, NULL); if( semHandle == NULL ) { return CSP_SEMAPHORE_ERROR; } *sem = semHandle; return CSP_SEMAPHORE_OK; } int csp_bin_sem_remove(csp_bin_sem_handle_t * sem) { if( !CloseHandle(*sem) ) { return CSP_SEMAPHORE_ERROR; } return CSP_SEMAPHORE_OK; } int csp_bin_sem_wait(csp_bin_sem_handle_t * sem, uint32_t timeout) { if( WaitForSingleObject(*sem, timeout) == WAIT_OBJECT_0 ) { return CSP_SEMAPHORE_OK; } return CSP_SEMAPHORE_ERROR; } int csp_bin_sem_post(csp_bin_sem_handle_t * sem) { if( !ReleaseSemaphore(*sem, 1, NULL) ) { return CSP_SEMAPHORE_ERROR; } return CSP_SEMAPHORE_OK; } int csp_bin_sem_post_isr(csp_bin_sem_handle_t * sem, CSP_BASE_TYPE * task_woken) { if( task_woken != NULL ) { *task_woken = 0; } return csp_bin_sem_post(sem); }
/* * File: ftk_cairo.c * Author: Li XianJing <xianjimli@hotmail.com> * Brief: cairo wrapper * * Copyright (c) 2009 - 2010 Li XianJing <xianjimli@hotmail.com> * * Licensed under the Academic Free License version 2.1 * * 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 */ /* * History: * ================================================================ * 2009-12-18 Li XianJing <xianjimli@hotmail.com> created * */ #include "ftk_cairo.h" cairo_surface_t* ftk_cairo_surface_create(FtkWidget* window) { FtkBitmap* bitmap = NULL; FtkCanvas* canvas = NULL; return_val_if_fail(window != NULL, NULL); canvas = ftk_widget_canvas(window); ftk_canvas_lock_buffer(canvas, &bitmap); return_val_if_fail(bitmap != NULL, NULL); return ftk_cairo_surface_create_with_bitmap(bitmap); } cairo_surface_t* ftk_cairo_surface_create_with_bitmap(FtkBitmap* bitmap) { int width = 0; int height = 0; FtkColor* data = NULL; cairo_surface_t* surface = NULL; return_val_if_fail(bitmap != NULL, NULL); data = ftk_bitmap_lock(bitmap); width = ftk_bitmap_width(bitmap); height = ftk_bitmap_height(bitmap); surface = cairo_image_surface_create_for_data(data, CAIRO_FORMAT_ARGB32, width, height, width * 4); return surface; }
// The 'features' section in 'target.json' is now used to create the device's hardware preprocessor switches. // Check the 'features' section of the target description in 'targets.json' for more details. /* mbed Microcontroller Library * Copyright (c) 2006-2013 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MBED_DEVICE_H #define MBED_DEVICE_H #define DEVICE_ID_LENGTH 24 #ifdef HYPERFLASH_BOOT /* 64MB HyperFlash, 4MB reserved for mbed-os */ #define BOARD_FLASH_SIZE (0x4000000U) #define BOARD_FLASH_START_ADDR (0x60000000U) #define BOARD_FLASHIAP_SIZE (0x3C00000U) #define BOARD_FLASHIAP_START_ADDR (0x60400000U) #define BOARD_FLASH_PAGE_SIZE (512) #define BOARD_FLASH_SECTOR_SIZE (262144) #else /* 8MB QSPI Flash, 64KB reserved for mbed_bootloader */ #define BOARD_FLASH_SIZE (0x800000U) #define BOARD_FLASH_START_ADDR (0x60000000U) #define BOARD_FLASHIAP_SIZE (0x7F0000U) #define BOARD_FLASHIAP_START_ADDR (0x60010000U) #define BOARD_FLASH_PAGE_SIZE (256) #define BOARD_FLASH_SECTOR_SIZE (4096) #endif #define BOARD_ENET_PHY_ADDR (2) /* CMSIS defines this, we use it as linker symbol, undefined it and let a linker symbol to be as vector table */ #undef __VECTOR_TABLE #include "objects.h" #endif
/* Copyright 2009 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #import <SenTestingKit/SenTestingKit.h> @interface MBEngineRuntimeTest : SenTestCase @end
//===-- Implementation header for fmin --------------------------*- 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 LLVM_LIBC_SRC_MATH_FMIN_H #define LLVM_LIBC_SRC_MATH_FMIN_H namespace __llvm_libc { double fmin(double x, double y); } // namespace __llvm_libc #endif // LLVM_LIBC_SRC_MATH_FMIN_H
#include <dsverifier.h> digital_system controller = { .b = { 0 , -0.00097656 , 0 , 0 }, .b_uncertainty = { 0 , 0 , 0 , 0 }, .b_size = 4, .a = { 0.76172 , 0 , 0 , 0 }, .a_uncertainty = { 0 , 0 , 0 , 0 }, .a_size = 4, .sample_time = 2 }; implementation impl = { .int_bits = 9, .frac_bits = 7, .max = 1.000000, .min = -1.000000 }; digital_system plant = { .b = { 0 , 15.1315 , 17.86 , 17.4549 }, .b_uncertainty = { 0 , 0 , 0 , 0 }, .b_size = 4, .a = { 1 , -2.6207 , 2.3586 , -0.657 }, .a_size = 4, .a_uncertainty = { 0 , 0 , 0 , 0 } };
// Copyright 2010 Todd Ditchendorf // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import <ParseKit/PKAssembly.h> @class PKTokenizer; @class PKToken; /*! @class PKSTokenAssembly @brief A <tt>PKSTokenAssembly</tt> is a <tt>PKAssembly</tt> whose elements are <tt>PKToken</tt>s. @details <tt>PKToken</tt>s are, roughly, the chunks of text that a <tt>PKTokenizer</tt> returns. */ @interface PKSTokenAssembly : PKAssembly <NSCopying> { PKTokenizer *tokenizer; NSMutableArray *tokens; BOOL preservesWhitespaceTokens; BOOL gathersConsumedTokens; } /*! @brief Convenience factory method for initializing an autoreleased assembly with the tokenizer <tt>t</tt> and its string @param t tokenizer whose string will be worked on @result an initialized autoreleased assembly */ + (PKSTokenAssembly *)assemblyWithTokenizer:(PKTokenizer *)t; /*! @brief Initializes an assembly with the tokenizer <tt>t</tt> and its string @param t tokenizer whose string will be worked on @result an initialized assembly */ - (id)initWithTokenzier:(PKTokenizer *)t; /*! @property preservesWhitespaceTokens @brief If true, whitespace tokens retreived from this assembly's tokenizier will be silently placed on this assembly's stack without being reported by -next or -peek. Default is false. */ @property (nonatomic) BOOL preservesWhitespaceTokens; @property (nonatomic) BOOL gathersConsumedTokens; @end
/* * Copyright (C) 2009 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef QuotaTracker_h #define QuotaTracker_h #include "modules/ModulesExport.h" #include "platform/weborigin/SecurityOrigin.h" #include "wtf/HashMap.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/text/StringHash.h" #include "wtf/text/WTFString.h" namespace blink { class MODULES_EXPORT QuotaTracker { USING_FAST_MALLOC(QuotaTracker); WTF_MAKE_NONCOPYABLE(QuotaTracker); public: static QuotaTracker& instance(); void getDatabaseSizeAndSpaceAvailableToOrigin( const String& originIdentifier, const String& databaseName, unsigned long long* databaseSize, unsigned long long* spaceAvailable); void updateDatabaseSize( const String& originIdentifier, const String& databaseName, unsigned long long databaseSize); void updateSpaceAvailableToOrigin(const String& originIdentifier, unsigned long long spaceAvailable); void resetSpaceAvailableToOrigin(const String& originIdentifier); private: QuotaTracker() { } typedef HashMap<String, unsigned long long> SizeMap; SizeMap m_spaceAvailableToOrigins; HashMap<String, SizeMap> m_databaseSizes; Mutex m_dataGuard; }; } #endif // QuotaTracker_h
/****************************************************************************** * Filename: aon_rtc.c * Revised: 2016-10-06 17:21:09 +0200 (Thu, 06 Oct 2016) * Revision: 47343 * * Description: Driver for the AON RTC. * * Copyright (c) 2015 - 2017, Texas Instruments Incorporated * 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 ORGANIZATION nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * ******************************************************************************/ #include "aon_rtc.h" #include "cpu.h" //***************************************************************************** // // Handle support for DriverLib in ROM: // This section will undo prototype renaming made in the header file // //***************************************************************************** #if !defined(DOXYGEN) #undef AONRTCCurrentCompareValueGet #define AONRTCCurrentCompareValueGet NOROM_AONRTCCurrentCompareValueGet #undef AONRTCCurrent64BitValueGet #define AONRTCCurrent64BitValueGet NOROM_AONRTCCurrent64BitValueGet #endif //***************************************************************************** // // Get the current value of the RTC counter in a format compatible to the compare registers. // //***************************************************************************** uint32_t AONRTCCurrentCompareValueGet( void ) { uint32_t ui32CurrentSec ; uint32_t ui32CurrentSubSec ; uint32_t ui32SecondSecRead ; // Reading SEC both before and after SUBSEC in order to detect if SEC incremented while reading SUBSEC // If SEC incremented, we can't be sure which SEC the SUBSEC belongs to, so repeating the sequence then. do { ui32CurrentSec = HWREG( AON_RTC_BASE + AON_RTC_O_SEC ); ui32CurrentSubSec = HWREG( AON_RTC_BASE + AON_RTC_O_SUBSEC ); ui32SecondSecRead = HWREG( AON_RTC_BASE + AON_RTC_O_SEC ); } while ( ui32CurrentSec != ui32SecondSecRead ); return (( ui32CurrentSec << 16 ) | ( ui32CurrentSubSec >> 16 )); } //***************************************************************************** // // Get the current 64-bit value of the RTC counter. // //***************************************************************************** uint64_t AONRTCCurrent64BitValueGet( void ) { union { uint64_t returnValue ; uint32_t secAndSubSec[ 2 ] ; } currentRtc ; uint32_t ui32SecondSecRead ; // Reading SEC both before and after SUBSEC in order to detect if SEC incremented while reading SUBSEC // If SEC incremented, we can't be sure which SEC the SUBSEC belongs to, so repeating the sequence then. do { currentRtc.secAndSubSec[ 1 ] = HWREG( AON_RTC_BASE + AON_RTC_O_SEC ); currentRtc.secAndSubSec[ 0 ] = HWREG( AON_RTC_BASE + AON_RTC_O_SUBSEC ); ui32SecondSecRead = HWREG( AON_RTC_BASE + AON_RTC_O_SEC ); } while ( currentRtc.secAndSubSec[ 1 ] != ui32SecondSecRead ); return ( currentRtc.returnValue ); }
/* * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * */ #ifndef LayoutTextControlSingleLine_h #define LayoutTextControlSingleLine_h #include "core/html/HTMLInputElement.h" #include "core/layout/LayoutTextControl.h" namespace blink { class HTMLInputElement; class LayoutTextControlSingleLine : public LayoutTextControl { public: LayoutTextControlSingleLine(HTMLInputElement*); ~LayoutTextControlSingleLine() override; // FIXME: Move createInnerEditorStyle() to TextControlInnerEditorElement. PassRefPtr<ComputedStyle> createInnerEditorStyle(const ComputedStyle& startStyle) const final; void capsLockStateMayHaveChanged(); protected: virtual void centerContainerIfNeeded(LayoutBox*) const { } virtual LayoutUnit computeLogicalHeightLimit() const; Element* containerElement() const; Element* editingViewPortElement() const; HTMLInputElement* inputElement() const; private: bool hasControlClip() const final; LayoutRect controlClipRect(const LayoutPoint&) const final; bool isOfType(LayoutObjectType type) const override { return type == LayoutObjectTextField || LayoutTextControl::isOfType(type); } void paint(const PaintInfo&, const LayoutPoint&) const override; void layout() override; bool nodeAtPoint(HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) final; void autoscroll(const IntPoint&) final; // Subclassed to forward to our inner div. LayoutUnit scrollLeft() const final; LayoutUnit scrollTop() const final; LayoutUnit scrollWidth() const final; LayoutUnit scrollHeight() const final; void setScrollLeft(LayoutUnit) final; void setScrollTop(LayoutUnit) final; int textBlockWidth() const; float getAvgCharWidth(const AtomicString& family) const final; LayoutUnit preferredContentLogicalWidth(float charWidth) const final; LayoutUnit computeControlLogicalHeight(LayoutUnit lineHeight, LayoutUnit nonContentHeight) const override; void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) final; bool textShouldBeTruncated() const; HTMLElement* innerSpinButtonElement() const; bool m_shouldDrawCapsLockIndicator; LayoutUnit m_desiredInnerEditorLogicalHeight; }; DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTextControlSingleLine, isTextField()); // ---------------------------- class LayoutTextControlInnerBlock : public LayoutBlockFlow { public: LayoutTextControlInnerBlock(Element* element) : LayoutBlockFlow(element) { } bool shouldIgnoreOverflowPropertyForInlineBlockBaseline() const override { return true; } private: bool isIntrinsicallyScrollable(ScrollbarOrientation orientation) const override { return orientation == HorizontalScrollbar; } bool scrollsOverflowX() const override { return hasOverflowClip(); } bool scrollsOverflowY() const override { return false; } bool hasLineIfEmpty() const override { return true; } }; } #endif
// 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 CONTENT_RENDERER_MEDIA_ANDROID_FLINGING_RENDERER_CLIENT_FACTORY_H_ #define CONTENT_RENDERER_MEDIA_ANDROID_FLINGING_RENDERER_CLIENT_FACTORY_H_ #include <memory> #include <string> #include "content/common/content_export.h" #include "media/base/media_status.h" #include "media/base/renderer_factory.h" #include "media/renderers/remote_playback_client_wrapper.h" namespace media { class MojoRendererFactory; } namespace content { // Creates a renderer for media flinging. // The FRCF uses a MojoRendererFactory to create a FlingingRenderer in the // browser process. class CONTENT_EXPORT FlingingRendererClientFactory : public media::RendererFactory { public: FlingingRendererClientFactory( std::unique_ptr<media::MojoRendererFactory> mojo_renderer_factory, std::unique_ptr<media::RemotePlaybackClientWrapper> remote_playback_client); FlingingRendererClientFactory(const FlingingRendererClientFactory&) = delete; FlingingRendererClientFactory& operator=( const FlingingRendererClientFactory&) = delete; ~FlingingRendererClientFactory() override; // Sets a callback that renderers created by |this| will use to propagate // Play/Pause state changes on remote devices. // NOTE: This must be called before CreateRenderer(). void SetRemotePlayStateChangeCB(media::RemotePlayStateChangeCB callback); std::unique_ptr<media::Renderer> CreateRenderer( const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, const scoped_refptr<base::TaskRunner>& worker_task_runner, media::AudioRendererSink* audio_renderer_sink, media::VideoRendererSink* video_renderer_sink, media::RequestOverlayInfoCB request_overlay_info_cb, const gfx::ColorSpace& target_color_space) override; // Returns whether media flinging has started, based off of whether the // |remote_playback_client_| has a presentation ID or not. Called by // RendererFactorySelector to determine when to create a FlingingRenderer. bool IsFlingingActive(); private: std::string GetActivePresentationId(); std::unique_ptr<media::MojoRendererFactory> mojo_flinging_factory_; std::unique_ptr<media::RemotePlaybackClientWrapper> remote_playback_client_; media::RemotePlayStateChangeCB remote_play_state_change_cb_; }; } // namespace content #endif // CONTENT_RENDERER_MEDIA_ANDROID_FLINGING_RENDERER_CLIENT_FACTORY_H_
/* * Copyright 2010 The Native Client Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include <assert.h> #include <pthread.h> #include <stdint.h> #include <stdio.h> /* On x86, gcc normally assumes that the stack is already 16-byte-aligned. It is the responsibility of the runtime to ensure that stacks are set up this way. This test checks that the runtime does this properly. */ struct AlignedType { int blah; } __attribute__((aligned(16))); /* We do this check in a separate function just in case the compiler is clever enough to optimise away the expression (uintptr_t) &var % 16 == 0 for a stack-allocated variable. */ void CheckAlignment(void *pointer) { printf("Variable address: %p\n", pointer); assert((uintptr_t) pointer % 16 == 0); } void *ThreadFunc(void *arg) { struct AlignedType var; printf("Check alignment in second thread...\n"); CheckAlignment(&var); return NULL; } int main(void) { pthread_t tid; int err; struct AlignedType var; /* Turn off stdout buffering to aid debugging in case of a crash. */ setvbuf(stdout, NULL, _IONBF, 0); printf("Check alignment in initial thread...\n"); CheckAlignment(&var); err = pthread_create(&tid, NULL, ThreadFunc, NULL); assert(err == 0); err = pthread_join(tid, NULL); assert(err == 0); return 0; }
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_ASH_PLATFORM_KEYS_KEY_PERMISSIONS_MOCK_KEY_PERMISSIONS_MANAGER_H_ #define CHROME_BROWSER_ASH_PLATFORM_KEYS_KEY_PERMISSIONS_MOCK_KEY_PERMISSIONS_MANAGER_H_ #include <string> #include "base/callback.h" #include "chrome/browser/ash/platform_keys/key_permissions/key_permissions_manager.h" #include "testing/gmock/include/gmock/gmock.h" namespace ash { namespace platform_keys { class MockKeyPermissionsManager : public KeyPermissionsManager { public: MockKeyPermissionsManager(); MockKeyPermissionsManager(const MockKeyPermissionsManager&) = delete; MockKeyPermissionsManager& operator=(const MockKeyPermissionsManager&) = delete; ~MockKeyPermissionsManager() override; MOCK_METHOD(void, AllowKeyForUsage, (AllowKeyForUsageCallback callback, KeyUsage usage, const std::string& public_key_spki_der), (override)); MOCK_METHOD(void, IsKeyAllowedForUsage, (IsKeyAllowedForUsageCallback callback, KeyUsage key_usage, const std::string& public_key_spki_der), (override)); MOCK_METHOD(bool, AreCorporateKeysAllowedForArcUsage, (), (const, override)); MOCK_METHOD(void, Shutdown, (), (override)); }; } // namespace platform_keys } // namespace ash #endif // CHROME_BROWSER_ASH_PLATFORM_KEYS_KEY_PERMISSIONS_MOCK_KEY_PERMISSIONS_MANAGER_H_
#define _GNU_SOURCE #include <stddef.h> #include <getopt.h> #include <stdio.h> #include <string.h> extern int __optpos, __optreset; static void permute(char *const *argv, int dest, int src) { char **av = (char **)argv; char *tmp = av[src]; int i; for (i=src; i>dest; i--) av[i] = av[i-1]; av[dest] = tmp; } void __getopt_msg(const char *, const char *, const char *, size_t); static int __getopt_long_core(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx, int longonly); static int __getopt_long(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx, int longonly) { int ret, skipped, resumed; if (!optind || __optreset) { __optreset = 0; __optpos = 0; optind = 1; } if (optind >= argc || !argv[optind]) return -1; skipped = optind; if (optstring[0] != '+' && optstring[0] != '-') { int i; for (i=optind; ; i++) { if (i >= argc || !argv[i]) return -1; if (argv[i][0] == '-' && argv[i][1]) break; } optind = i; } resumed = optind; ret = __getopt_long_core(argc, argv, optstring, longopts, idx, longonly); if (resumed > skipped) { int i, cnt = optind-resumed; for (i=0; i<cnt; i++) permute(argv, skipped, optind-1); optind = skipped + cnt; } return ret; } static int __getopt_long_core(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx, int longonly) { optarg = 0; if (longopts && argv[optind][0] == '-' && ((longonly && argv[optind][1]) || (argv[optind][1] == '-' && argv[optind][2]))) { int colon = optstring[optstring[0]=='+'||optstring[0]=='-']==':'; int i, cnt, match; char *opt; for (cnt=i=0; longopts[i].name; i++) { const char *name = longopts[i].name; opt = argv[optind]+1; if (*opt == '-') opt++; for (; *name && *name == *opt; name++, opt++); if (*opt && *opt != '=') continue; match = i; if (!*name) { cnt = 1; break; } cnt++; } if (cnt==1) { i = match; optind++; optopt = longopts[i].val; if (*opt == '=') { if (!longopts[i].has_arg) { if (colon || !opterr) return '?'; __getopt_msg(argv[0], ": option does not take an argument: ", longopts[i].name, strlen(longopts[i].name)); return '?'; } optarg = opt+1; } else if (longopts[i].has_arg == required_argument) { if (!(optarg = argv[optind])) { if (colon) return ':'; if (!opterr) return '?'; __getopt_msg(argv[0], ": option requires an argument: ", longopts[i].name, strlen(longopts[i].name)); return '?'; } optind++; } if (idx) *idx = i; if (longopts[i].flag) { *longopts[i].flag = longopts[i].val; return 0; } return longopts[i].val; } if (argv[optind][1] == '-') { if (!colon && opterr) __getopt_msg(argv[0], cnt ? ": option is ambiguous: " : ": unrecognized option: ", argv[optind]+2, strlen(argv[optind]+2)); optind++; return '?'; } } return getopt(argc, argv, optstring); } int getopt_long(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx) { return __getopt_long(argc, argv, optstring, longopts, idx, 0); } int getopt_long_only(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx) { return __getopt_long(argc, argv, optstring, longopts, idx, 1); }
/* ----------------------------------------------------------------------------- This source file is part of OGRE (Object-oriented Graphics Rendering Engine) For the latest info, see http://www.ogre3d.org/ Copyright (c) 2000-2014 Torus Knot Software Ltd 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. ----------------------------------------------------------------------------- */ #ifndef __Ogre_PageContent_H__ #define __Ogre_PageContent_H__ #include "OgrePagingPrerequisites.h" namespace Ogre { /** \addtogroup Optional Components * @{ */ /** \addtogroup Paging * Some details on paging component * @{ */ /** Interface definition for a unit of content within a page. */ class _OgrePagingExport PageContent : public PageAlloc { protected: PageContentFactory* mCreator; PageContentCollection* mParent; public: PageContent(PageContentFactory* creator); virtual ~PageContent(); PageManager* getManager() const; SceneManager* getSceneManager() const; /// Internal method to notify a page that it is attached virtual void _notifyAttached(PageContentCollection* parent); /// Get the type of the content, which will match it's factory virtual const String& getType() const; /// Save the content to a stream virtual void save(StreamSerialiser& stream) = 0; /// Called when the frame starts virtual void frameStart(Real timeSinceLastFrame) {} /// Called when the frame ends virtual void frameEnd(Real timeElapsed) {} /// Notify a section of the current camera virtual void notifyCamera(Camera* cam) {} /// Prepare data - may be called in the background virtual bool prepare(StreamSerialiser& ser) = 0; /// Load - will be called in main thread virtual void load() = 0; /// Unload - will be called in main thread virtual void unload() = 0; /// Unprepare data - may be called in the background virtual void unprepare() = 0; }; /** @} */ /** @} */ } #endif
//===-- IntelJITEventsWrapper.h - Intel JIT Events API Wrapper --*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines a wrapper for the Intel JIT Events API. It allows for the // implementation of the jitprofiling library to be swapped with an alternative // implementation (for testing). To include this file, you must have the // jitprofiling.h header available; it is available in Intel(R) VTune(TM) // Amplifier XE 2011. // //===----------------------------------------------------------------------===// #ifndef INTEL_JIT_EVENTS_WRAPPER_H #define INTEL_JIT_EVENTS_WRAPPER_H #include "jitprofiling.h" namespace llvm { class IntelJITEventsWrapper { // Function pointer types for testing implementation of Intel jitprofiling // library typedef int (*NotifyEventPtr)(iJIT_JVM_EVENT, void*); typedef void (*RegisterCallbackExPtr)(void *, iJIT_ModeChangedEx ); typedef iJIT_IsProfilingActiveFlags (*IsProfilingActivePtr)(void); typedef void (*FinalizeThreadPtr)(void); typedef void (*FinalizeProcessPtr)(void); typedef unsigned int (*GetNewMethodIDPtr)(void); NotifyEventPtr NotifyEventFunc; RegisterCallbackExPtr RegisterCallbackExFunc; IsProfilingActivePtr IsProfilingActiveFunc; GetNewMethodIDPtr GetNewMethodIDFunc; public: bool isAmplifierRunning() { return iJIT_IsProfilingActive() == iJIT_SAMPLING_ON; } IntelJITEventsWrapper() : NotifyEventFunc(::iJIT_NotifyEvent), RegisterCallbackExFunc(::iJIT_RegisterCallbackEx), IsProfilingActiveFunc(::iJIT_IsProfilingActive), GetNewMethodIDFunc(::iJIT_GetNewMethodID) { } IntelJITEventsWrapper(NotifyEventPtr NotifyEventImpl, RegisterCallbackExPtr RegisterCallbackExImpl, IsProfilingActivePtr IsProfilingActiveImpl, FinalizeThreadPtr FinalizeThreadImpl, FinalizeProcessPtr FinalizeProcessImpl, GetNewMethodIDPtr GetNewMethodIDImpl) : NotifyEventFunc(NotifyEventImpl), RegisterCallbackExFunc(RegisterCallbackExImpl), IsProfilingActiveFunc(IsProfilingActiveImpl), GetNewMethodIDFunc(GetNewMethodIDImpl) { } // Sends an event anncouncing that a function has been emitted // return values are event-specific. See Intel documentation for details. int iJIT_NotifyEvent(iJIT_JVM_EVENT EventType, void *EventSpecificData) { if (!NotifyEventFunc) return -1; return NotifyEventFunc(EventType, EventSpecificData); } // Registers a callback function to receive notice of profiling state changes void iJIT_RegisterCallbackEx(void *UserData, iJIT_ModeChangedEx NewModeCallBackFuncEx) { if (RegisterCallbackExFunc) RegisterCallbackExFunc(UserData, NewModeCallBackFuncEx); } // Returns the current profiler mode iJIT_IsProfilingActiveFlags iJIT_IsProfilingActive(void) { if (!IsProfilingActiveFunc) return iJIT_NOTHING_RUNNING; return IsProfilingActiveFunc(); } // Generates a locally unique method ID for use in code registration unsigned int iJIT_GetNewMethodID(void) { if (!GetNewMethodIDFunc) return -1; return GetNewMethodIDFunc(); } }; } //namespace llvm #endif //INTEL_JIT_EVENTS_WRAPPER_H
/* Copyright (C) 2003-2007 Datapark corp. All rights reserved. Based on Electric Fence 2.2 by Bruce Perens This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "dps_common.h" #ifdef EFENCE #include "dps_efence.h" #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <sys/mman.h> #include <stdio.h> #include <errno.h> #include <string.h> /* * Lots of systems are missing the definition of PROT_NONE. */ #ifndef PROT_NONE #define PROT_NONE 0 #endif /* * 386 BSD has MAP_ANON instead of MAP_ANONYMOUS. */ #if ( !defined(MAP_ANONYMOUS) && defined(MAP_ANON) ) #define MAP_ANONYMOUS MAP_ANON #endif /* * For some reason, I can't find mprotect() in any of the headers on * IRIX or SunOS 4.1.2 */ /* extern C_LINKAGE int mprotect(void * addr, size_t len, int prot); */ static caddr_t startAddr = (caddr_t) 0; #if ( !defined(sgi) && !defined(_AIX) && !(defined(BSD) && (BSD >= 199103)) && !defined(__linux__) ) extern int sys_nerr; extern char * sys_errlist[]; #endif static const char * stringErrorReport(void) { #if ( defined(sgi) ) return strerror(oserror()); #elif ( defined(_AIX) ) return strerror(errno); #else if ( errno > 0 && errno < sys_nerr ) return sys_errlist[errno]; else return "Unknown error.\n"; #endif } /* * Create memory. */ #if defined(MAP_ANONYMOUS) void * Page_Create(size_t size) { caddr_t allocation; /* * In this version, "startAddr" is a _hint_, not a demand. * When the memory I map here is contiguous with other * mappings, the allocator can coalesce the memory from two * or more mappings into one large contiguous chunk, and thus * might be able to find a fit that would not otherwise have * been possible. I could _force_ it to be contiguous by using * the MMAP_FIXED flag, but I don't want to stomp on memory mappings * generated by other software, etc. */ allocation = (caddr_t) mmap( startAddr ,(int)size ,PROT_READ|PROT_WRITE ,MAP_PRIVATE|MAP_ANONYMOUS ,-1 ,0); #ifndef __hpux /* * Set the "address hint" for the next mmap() so that it will abut * the mapping we just created. * * HP/UX 9.01 has a kernel bug that makes mmap() fail sometimes * when given a non-zero address hint, so we'll leave the hint set * to zero on that system. HP recently told me this is now fixed. * Someone please tell me when it is probable to assume that most * of those systems that were running 9.01 have been upgraded. */ startAddr = allocation + size; #endif if ( allocation == (caddr_t)-1 ) EF_Abort("mmap() failed at %s:%d: %s [startAddr:0x%x, size:%d]", __FILE__, __LINE__, stringErrorReport(), startAddr, size); return (void *)allocation; } #else void * Page_Create(size_t size) { static int devZeroFd = -1; caddr_t allocation; if ( devZeroFd == -1 ) { devZeroFd = open("/dev/zero", O_RDWR); if ( devZeroFd < 0 ) EF_Exit( "open() on /dev/zero failed: %s" ,stringErrorReport()); } /* * In this version, "startAddr" is a _hint_, not a demand. * When the memory I map here is contiguous with other * mappings, the allocator can coalesce the memory from two * or more mappings into one large contiguous chunk, and thus * might be able to find a fit that would not otherwise have * been possible. I could _force_ it to be contiguous by using * the MMAP_FIXED flag, but I don't want to stomp on memory mappings * generated by other software, etc. */ allocation = (caddr_t) mmap( startAddr ,(int)size ,PROT_READ|PROT_WRITE ,MAP_PRIVATE ,devZeroFd ,0); startAddr = allocation + size; if ( allocation == (caddr_t)-1 ) EF_Exit("mmap() failed %s:%d: %s", __FILE__, __LINE__, stringErrorReport()); return (void *)allocation; } #endif static void mprotectFailed(void) { char buf[128]; snprintf(buf, sizeof(buf), "cat /proc/%d/maps|wc -l", (int)getpid()); system(buf); EF_Exit("mprotect() failed: %s", stringErrorReport()); } void Page_AllowAccess(void * address, size_t size) { if ( mprotect((caddr_t)address, size, PROT_READ|PROT_WRITE) < 0 ) mprotectFailed(); } void Page_DenyAccess(void * address, size_t size) { if ( mprotect((caddr_t)address, size, PROT_NONE) < 0 ) mprotectFailed(); } void Page_Delete(void * address, size_t size) { if ( munmap((caddr_t)address, size) < 0 ) Page_DenyAccess(address, size); } #if defined(_SC_PAGESIZE) size_t Page_Size(void) { return (size_t)sysconf(_SC_PAGESIZE); } #elif defined(_SC_PAGE_SIZE) size_t Page_Size(void) { return (size_t)sysconf(_SC_PAGE_SIZE); } #else /* extern int getpagesize(); */ size_t Page_Size(void) { return getpagesize(); } #endif #endif /* EFENCE */
/* * Copyright (C) 2007 Voice System SRL * Copyright (C) 2011 Carsten Bock, carsten@ng-voice.com * * This file is part of Kamailio, a free SIP server. * * Kamailio 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 * * Kamailio 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 * */ /*! * \file * \brief Database interface * \ingroup dialog * Module: \ref dialog */ #ifndef _DLG_DB_HANDLER_H_ #define _DLG_DB_HANDLER_H_ #include "../../str.h" #include "../../lib/srdb1/db.h" #define CALL_ID_COL "callid" #define FROM_URI_COL "from_uri" #define FROM_TAG_COL "from_tag" #define TO_URI_COL "to_uri" #define TO_TAG_COL "to_tag" #define HASH_ID_COL "hash_id" #define HASH_ENTRY_COL "hash_entry" #define STATE_COL "state" #define START_TIME_COL "start_time" #define TIMEOUT_COL "timeout" #define TO_CSEQ_COL "callee_cseq" #define FROM_CSEQ_COL "caller_cseq" #define TO_ROUTE_COL "callee_route_set" #define FROM_ROUTE_COL "caller_route_set" #define TO_CONTACT_COL "callee_contact" #define FROM_CONTACT_COL "caller_contact" #define FROM_SOCK_COL "caller_sock" #define TO_SOCK_COL "callee_sock" #define IFLAGS_COL "iflags" #define SFLAGS_COL "sflags" #define TOROUTE_NAME_COL "toroute_name" #define REQ_URI_COL "req_uri" #define XDATA_COL "xdata" #define DIALOG_TABLE_NAME "dialog" #define DLG_TABLE_VERSION 7 #define DIALOG_TABLE_COL_NO 23 #define VARS_HASH_ID_COL "hash_id" #define VARS_HASH_ENTRY_COL "hash_entry" #define VARS_KEY_COL "dialog_key" #define VARS_VALUE_COL "dialog_value" #define DIALOG_VARS_TABLE_NAME "dialog_vars" #define DLG_VARS_TABLE_VERSION 1 #define DIALOG_VARS_TABLE_COL_NO 4 /*every minute the dialogs' information will be refreshed*/ #define DB_DEFAULT_UPDATE_PERIOD 60 #define DB_MODE_NONE 0 #define DB_MODE_REALTIME 1 #define DB_MODE_DELAYED 2 #define DB_MODE_SHUTDOWN 3 /* Dialog table */ extern str call_id_column; extern str from_uri_column; extern str from_tag_column; extern str to_uri_column; extern str to_tag_column; extern str h_id_column; extern str h_entry_column; extern str state_column; extern str start_time_column; extern str timeout_column; extern str to_cseq_column; extern str from_cseq_column; extern str to_route_column; extern str from_route_column; extern str to_contact_column; extern str from_contact_column; extern str to_sock_column; extern str from_sock_column; extern str iflags_column; extern str sflags_column; extern str toroute_name_column; extern str dialog_table_name; extern int dlg_db_mode; /* Dialog-Vars Table */ extern str vars_h_id_column; extern str vars_h_entry_column; extern str vars_key_column; extern str vars_value_column; extern str dialog_vars_table_name; int init_dlg_db(const str *db_url, int dlg_hash_size , int db_update_period, int fetch_num_rows, int db_skip_load); int dlg_connect_db(const str *db_url); void destroy_dlg_db(void); int remove_dialog_from_db(struct dlg_cell * cell); int update_dialog_dbinfo(struct dlg_cell * cell); void dialog_update_db(unsigned int ticks, void * param); #endif
#ifndef __TZPM_H__ #define __TZPM_H__ extern struct device *tzdev_mcd; #define TZDEV_USE_DEVICE_TREE #define NO_SLEEP_REQ 0 #define REQ_TO_SLEEP 1 #define NORMAL_EXECUTION 0 #define READY_TO_SLEEP 1 /* How much time after resume the daemon should backoff */ #define DAEMON_BACKOFF_TIME 500 /* Initialize secure crypto clocks */ int qc_pm_clock_initialize(void); /* Free secure crypto clocks */ void qc_pm_clock_finalize(void); /* Enable secure crypto clocks */ int qc_pm_clock_enable(void); /* Disable secure crypto clocks */ void qc_pm_clock_disable(void); #endif /* __TZPM_H__ */
/* * File: intset.h * Author: Vincent Gramoli <vincent.gramoli@sydney.edu.au>, * Vasileios Trigonakis <vasileios.trigonakis@epfl.ch> * Description: * intset.h is part of ASCYLIB * * Copyright (c) 2014 Vasileios Trigonakis <vasileios.trigonakis@epfl.ch>, * Tudor David <tudor.david@epfl.ch> * Distributed Programming Lab (LPD), EPFL * * ASCYLIB is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, version 2 * of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #include "stack-optik.h" sval_t mstack_contains(mstack_t *set, skey_t key); int mstack_add(mstack_t *set, skey_t key, sval_t val); sval_t mstack_remove(mstack_t *set);
/* Compute radix independent exponent. Copyright (C) 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gmail.com>, 2011. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #include <math.h> #include <math_private.h> double __logb (double x) { int64_t ix, ex; EXTRACT_WORDS64 (ix, x); ix &= UINT64_C(0x7fffffffffffffff); if (ix == 0) return -1.0 / fabs (x); ex = ix >> 52; if (ex == 0x7ff) return x * x; if (__builtin_expect (ex == 0, 0)) { int m = __builtin_clzll (ix); ex -= m - 12; } return (double) (ex - 1023); } weak_alias (__logb, logb) #ifdef NO_LONG_DOUBLE strong_alias (__logb, __logbl) weak_alias (__logb, logbl) #endif
/* Copyright (C) 1991-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #include <stdarg.h> #include <stdio.h> #include <wchar.h> #include "../libio/libioP.h" /* Write formatted output to stdout from the format string FORMAT. */ int __vwprintf_chk (int flag, const wchar_t *format, va_list ap) { int done; _IO_acquire_lock_clear_flags2 (stdout); if (flag > 0) stdout->_flags2 |= _IO_FLAGS2_FORTIFY; done = _IO_vfwprintf (stdout, format, ap); if (flag > 0) stdout->_flags2 &= ~_IO_FLAGS2_FORTIFY; _IO_release_lock (stdout); return done; }
/* * This file is part of the coreboot project. * * Copyright (C) 2007 Advanced Micro Devices, 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; version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc. */ #include <console/console.h> #include <string.h> #include <arch/acpi.h> #include <arch/ioapic.h> #include <device/pci.h> #include <device/pci_ids.h> #include <cpu/x86/msr.h> #include <cpu/amd/mtrr.h> #include <cpu/amd/amdfam10_sysconf.h> #include <cbfs.h> #include "mb_sysconf.h" #include "mainboard.h" unsigned long acpi_fill_madt(unsigned long current) { u32 gsi_base=0x18; struct mb_sysconf_t *m; m = sysconf.mb; /* create all subtables for processors */ current = acpi_create_madt_lapics(current); /* Write 8111 IOAPIC */ current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, m->apicid_8111, IO_APIC_ADDR, 0); /* Write all 8131 IOAPICs */ { device_t dev; struct resource *res; dev = dev_find_slot(m->bus_8132_0, PCI_DEVFN((sysconf.hcdn[0]&0xff), 1)); if (dev) { res = find_resource(dev, PCI_BASE_ADDRESS_0); if (res) { current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, m->apicid_8132_1, res->base, gsi_base ); gsi_base+=7; } } dev = dev_find_slot(m->bus_8132_0, PCI_DEVFN((sysconf.hcdn[0] & 0xff)+1, 1)); if (dev) { res = find_resource(dev, PCI_BASE_ADDRESS_0); if (res) { current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, m->apicid_8132_2, res->base, gsi_base ); gsi_base+=7; } } int i; int j = 0; for(i=1; i< sysconf.hc_possible_num; i++) { u32 d = 0; if(!(sysconf.pci1234[i] & 0x1) ) continue; // 8131 need to use +4 switch (sysconf.hcid[i]) { case 1: d = 7; break; case 3: d = 4; break; } switch (sysconf.hcid[i]) { case 1: case 3: dev = dev_find_slot(m->bus_8132a[j][0], PCI_DEVFN(m->sbdn3a[j], 1)); if (dev) { res = find_resource(dev, PCI_BASE_ADDRESS_0); if (res) { current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, m->apicid_8132a[j][0], res->base, gsi_base ); gsi_base+=d; } } dev = dev_find_slot(m->bus_8132a[j][0], PCI_DEVFN(m->sbdn3a[j]+1, 1)); if (dev) { res = find_resource(dev, PCI_BASE_ADDRESS_0); if (res) { current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, m->apicid_8132a[j][1], res->base, gsi_base ); gsi_base+=d; } } break; } j++; } } current += acpi_create_madt_irqoverride( (acpi_madt_irqoverride_t *) current, 0, 0, 2, 5 ); /* 0: mean bus 0--->ISA */ /* 0: PIC 0 */ /* 2: APIC 2 */ /* 5 mean: 0101 --> Edge-triggered, Active high*/ /* create all subtables for processors */ current = acpi_create_madt_lapic_nmis(current, 5, 1); /* 1: LINT1 connect to NMI */ return current; } unsigned long mainboard_write_acpi_tables(device_t device, unsigned long current, acpi_rsdp_t *rsdp) { acpi_header_t *ssdtx; const void *p; size_t p_size; int i; get_bus_conf(); //it will get sblk, pci1234, hcdn, and sbdn /* same htio, but different possition? We may have to copy, change HCIN, and recalculate the checknum and add_table */ for(i=1;i<sysconf.hc_possible_num;i++) { // 0: is hc sblink const char *file_name; if((sysconf.pci1234[i] & 1) != 1 ) continue; u8 c; if(i<7) { c = (u8) ('4' + i - 1); } else { c = (u8) ('A' + i - 1 - 6); } current = ALIGN(current, 8); printk(BIOS_DEBUG, "ACPI: * SSDT for PCI%c at %lx\n", c, current); //pci0 and pci1 are in dsdt ssdtx = (acpi_header_t *)current; switch(sysconf.hcid[i]) { case 1: file_name = CONFIG_CBFS_PREFIX "/ssdt2.aml"; break; case 2: file_name = CONFIG_CBFS_PREFIX "/ssdt3.aml"; break; case 3: //8131 file_name = CONFIG_CBFS_PREFIX "/ssdt4.aml"; break; default: //HTX no io apic file_name = CONFIG_CBFS_PREFIX "/ssdt5.aml"; } p = cbfs_boot_map_with_leak( file_name, CBFS_TYPE_RAW, &p_size); if (!p || p_size < sizeof(acpi_header_t)) continue; memcpy(ssdtx, p, sizeof(acpi_header_t)); current += ssdtx->length; memcpy(ssdtx, p, ssdtx->length); update_ssdtx((void *)ssdtx, i); ssdtx->checksum = 0; ssdtx->checksum = acpi_checksum((u8 *)ssdtx, ssdtx->length); acpi_add_table(rsdp, ssdtx); } return current; }
/* Copyright (C) 1997-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. 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/>. */ #define USE_IN_EXTENDED_LOCALE_MODEL 1 #include <wcsncase.c> libc_hidden_def (__wcsncasecmp_l) weak_alias (__wcsncasecmp_l, wcsncasecmp_l)
/* Copyright (C) 1991-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #include <hurd.h> /* This is initialized in dtable.c when that gets linked in. If dtable.c is not linked in, it will be zero. */ static file_t (*_default_hurd_getdport_fn) (int fd) = 0; weak_alias (_default_hurd_getdport_fn, _hurd_getdport_fn) file_t __getdport (int fd) { if (_hurd_getdport_fn) /* dtable.c has defined the function to fetch a port from the real file descriptor table. */ return (*_hurd_getdport_fn) (fd); /* getdport is the only use of file descriptors, so we don't bother allocating a real table. */ if (_hurd_init_dtable == NULL) { /* Never had a descriptor table. */ errno = EBADF; return MACH_PORT_NULL; } if (fd < 0 || (unsigned int) fd > _hurd_init_dtablesize || _hurd_init_dtable[fd] == MACH_PORT_NULL) { errno = EBADF; return MACH_PORT_NULL; } else { __mach_port_mod_refs (__mach_task_self (), _hurd_init_dtable[fd], MACH_PORT_RIGHT_SEND, 1); return _hurd_init_dtable[fd]; } } weak_alias (__getdport, getdport)
/* * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) * Licensed under the GPL */ #ifndef __UM_UACCESS_H #define __UM_UACCESS_H /* thread_info has a mm_segment_t in it, so put the definition up here */ typedef struct { unsigned long seg; } mm_segment_t; #include <linux/thread_info.h> #include <linux/errno.h> #include <asm/processor.h> #include <asm/elf.h> #define VERIFY_READ 0 #define VERIFY_WRITE 1 /* * The fs value determines whether argument validity checking should be * performed or not. If get_fs() == USER_DS, checking is performed, with * get_fs() == KERNEL_DS, checking is bypassed. * * For historical reasons, these macros are grossly misnamed. */ #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) #define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF) #define USER_DS MAKE_MM_SEG(TASK_SIZE) #define get_ds() (KERNEL_DS) #define get_fs() (current_thread_info()->addr_limit) #define set_fs(x) (current_thread_info()->addr_limit = (x)) #define segment_eq(a, b) ((a).seg == (b).seg) #define __under_task_size(addr, size) \ (((unsigned long) (addr) < TASK_SIZE) && \ (((unsigned long) (addr) + (size)) < TASK_SIZE)) #define __access_ok_vsyscall(type, addr, size) \ ((type == VERIFY_READ) && \ ((unsigned long) (addr) >= FIXADDR_USER_START) && \ ((unsigned long) (addr) + (size) <= FIXADDR_USER_END) && \ ((unsigned long) (addr) + (size) >= (unsigned long)(addr))) #define __addr_range_nowrap(addr, size) \ ((unsigned long) (addr) <= ((unsigned long) (addr) + (size))) #define access_ok(type, addr, size) \ (__addr_range_nowrap(addr, size) && \ (__under_task_size(addr, size) || \ __access_ok_vsyscall(type, addr, size) || \ segment_eq(get_fs(), KERNEL_DS))) extern int copy_from_user(void *to, const void __user *from, int n); extern int copy_to_user(void __user *to, const void *from, int n); /* * strncpy_from_user: - Copy a NUL terminated string from userspace. * @dst: Destination address, in kernel space. This buffer must be at * least @count bytes long. * @src: Source address, in user space. * @count: Maximum number of bytes to copy, including the trailing NUL. * * Copies a NUL-terminated string from userspace to kernel space. * * On success, returns the length of the string (not including the trailing * NUL). * * If access to userspace fails, returns -EFAULT (some data may have been * copied). * * If @count is smaller than the length of the string, copies @count bytes * and returns @count. */ extern int strncpy_from_user(char *dst, const char __user *src, int count); /* * __clear_user: - Zero a block of memory in user space, with less checking. * @to: Destination address, in user space. * @n: Number of bytes to zero. * * Zero a block of memory in user space. Caller must check * the specified block with access_ok() before calling this function. * * Returns number of bytes that could not be cleared. * On success, this will be zero. */ extern int __clear_user(void __user *mem, int len); /* * clear_user: - Zero a block of memory in user space. * @to: Destination address, in user space. * @n: Number of bytes to zero. * * Zero a block of memory in user space. * * Returns number of bytes that could not be cleared. * On success, this will be zero. */ extern int clear_user(void __user *mem, int len); /* * strlen_user: - Get the size of a string in user space. * @str: The string to measure. * @n: The maximum valid length * * Get the size of a NUL-terminated string in user space. * * Returns the size of the string INCLUDING the terminating NUL. * On exception, returns 0. * If the string is too long, returns a value greater than @n. */ extern int strnlen_user(const void __user *str, int len); #define __copy_from_user(to, from, n) copy_from_user(to, from, n) #define __copy_to_user(to, from, n) copy_to_user(to, from, n) #define __copy_to_user_inatomic __copy_to_user #define __copy_from_user_inatomic __copy_from_user #define __get_user(x, ptr) \ ({ \ const __typeof__(*(ptr)) __user *__private_ptr = (ptr); \ __typeof__(x) __private_val; \ int __private_ret = -EFAULT; \ (x) = (__typeof__(*(__private_ptr)))0; \ if (__copy_from_user((__force void *)&__private_val, (__private_ptr),\ sizeof(*(__private_ptr))) == 0) { \ (x) = (__typeof__(*(__private_ptr))) __private_val; \ __private_ret = 0; \ } \ __private_ret; \ }) #define get_user(x, ptr) \ ({ \ const __typeof__((*(ptr))) __user *private_ptr = (ptr); \ (access_ok(VERIFY_READ, private_ptr, sizeof(*private_ptr)) ? \ __get_user(x, private_ptr) : ((x) = (__typeof__(*ptr))0, -EFAULT)); \ }) #define __put_user(x, ptr) \ ({ \ __typeof__(*(ptr)) __user *__private_ptr = ptr; \ __typeof__(*(__private_ptr)) __private_val; \ int __private_ret = -EFAULT; \ __private_val = (__typeof__(*(__private_ptr))) (x); \ if (__copy_to_user((__private_ptr), &__private_val, \ sizeof(*(__private_ptr))) == 0) { \ __private_ret = 0; \ } \ __private_ret; \ }) #define put_user(x, ptr) \ ({ \ __typeof__(*(ptr)) __user *private_ptr = (ptr); \ (access_ok(VERIFY_WRITE, private_ptr, sizeof(*private_ptr)) ? \ __put_user(x, private_ptr) : -EFAULT); \ }) #define strlen_user(str) strnlen_user(str, ~0U >> 1) struct exception_table_entry { unsigned long insn; unsigned long fixup; }; #endif
/* This file is part of libmspack. * (C) 2003-2010 Stuart Caie. * * libmspack is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License (LGPL) version 2.1 * * For further details, see the file COPYING.LIB distributed with libmspack */ #ifndef MSPACK_KWAJ_H #define MSPACK_KWAJ_H 1 #include <lzss.h> /* generic KWAJ definitions */ #define kwajh_Signature1 (0x00) #define kwajh_Signature2 (0x04) #define kwajh_CompMethod (0x08) #define kwajh_DataOffset (0x0a) #define kwajh_Flags (0x0c) #define kwajh_SIZEOF (0x0e) /* KWAJ compression definitions */ struct mskwaj_compressor_p { struct mskwaj_compressor base; struct mspack_system *system; /* todo */ int param[2]; /* !!! MATCH THIS TO NUM OF PARAMS IN MSPACK.H !!! */ int error; }; /* KWAJ decompression definitions */ struct mskwaj_decompressor_p { struct mskwaj_decompressor base; struct mspack_system *system; int error; }; struct mskwajd_header_p { struct mskwajd_header base; struct mspack_file *fh; }; /* input buffer size during decompression - not worth parameterising IMHO */ #define KWAJ_INPUT_SIZE (2048) /* huffman codes that are 9 bits or less are decoded immediately */ #define KWAJ_TABLEBITS (9) /* number of codes in each huffman table */ #define KWAJ_MATCHLEN1_SYMS (16) #define KWAJ_MATCHLEN2_SYMS (16) #define KWAJ_LITLEN_SYMS (32) #define KWAJ_OFFSET_SYMS (64) #define KWAJ_LITERAL_SYMS (256) /* define decoding table sizes */ #define KWAJ_TABLESIZE (1 << KWAJ_TABLEBITS) #if KWAJ_TABLESIZE < (KWAJ_MATCHLEN1_SYMS * 2) # define KWAJ_MATCHLEN1_TBLSIZE (KWAJ_MATCHLEN1_SYMS * 4) #else # define KWAJ_MATCHLEN1_TBLSIZE (KWAJ_TABLESIZE + (KWAJ_MATCHLEN1_SYMS * 2)) #endif #if KWAJ_TABLESIZE < (KWAJ_MATCHLEN2_SYMS * 2) # define KWAJ_MATCHLEN2_TBLSIZE (KWAJ_MATCHLEN2_SYMS * 4) #else # define KWAJ_MATCHLEN2_TBLSIZE (KWAJ_TABLESIZE + (KWAJ_MATCHLEN2_SYMS * 2)) #endif #if KWAJ_TABLESIZE < (KWAJ_LITLEN_SYMS * 2) # define KWAJ_LITLEN_TBLSIZE (KWAJ_LITLEN_SYMS * 4) #else # define KWAJ_LITLEN_TBLSIZE (KWAJ_TABLESIZE + (KWAJ_LITLEN_SYMS * 2)) #endif #if KWAJ_TABLESIZE < (KWAJ_OFFSET_SYMS * 2) # define KWAJ_OFFSET_TBLSIZE (KWAJ_OFFSET_SYMS * 4) #else # define KWAJ_OFFSET_TBLSIZE (KWAJ_TABLESIZE + (KWAJ_OFFSET_SYMS * 2)) #endif #if KWAJ_TABLESIZE < (KWAJ_LITERAL_SYMS * 2) # define KWAJ_LITERAL_TBLSIZE (KWAJ_LITERAL_SYMS * 4) #else # define KWAJ_LITERAL_TBLSIZE (KWAJ_TABLESIZE + (KWAJ_LITERAL_SYMS * 2)) #endif struct kwajd_stream { /* I/O buffering */ struct mspack_system *sys; struct mspack_file *input; struct mspack_file *output; unsigned char *i_ptr, *i_end; unsigned int bit_buffer, bits_left; int input_end; /* huffman code lengths */ unsigned char MATCHLEN1_len [KWAJ_MATCHLEN1_SYMS]; unsigned char MATCHLEN2_len [KWAJ_MATCHLEN2_SYMS]; unsigned char LITLEN_len [KWAJ_LITLEN_SYMS]; unsigned char OFFSET_len [KWAJ_OFFSET_SYMS]; unsigned char LITERAL_len [KWAJ_LITERAL_SYMS]; /* huffman decoding tables */ unsigned short MATCHLEN1_table [KWAJ_MATCHLEN1_TBLSIZE]; unsigned short MATCHLEN2_table [KWAJ_MATCHLEN2_TBLSIZE]; unsigned short LITLEN_table [KWAJ_LITLEN_TBLSIZE]; unsigned short OFFSET_table [KWAJ_OFFSET_TBLSIZE]; unsigned short LITERAL_table [KWAJ_LITERAL_TBLSIZE]; /* input buffer */ unsigned char inbuf[KWAJ_INPUT_SIZE]; /* history window */ unsigned char window[LZSS_WINDOW_SIZE]; }; #endif
/* morphology.h * * 20/9/09 * - from proto.h */ /* This file is part of VIPS. VIPS is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /* These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk */ #ifndef VIPS_MORPHOLOGY_H #define VIPS_MORPHOLOGY_H #ifdef __cplusplus extern "C" { #endif /*__cplusplus*/ typedef enum { VIPS_OPERATION_MORPHOLOGY_ERODE, VIPS_OPERATION_MORPHOLOGY_DILATE, VIPS_OPERATION_MORPHOLOGY_LAST } VipsOperationMorphology; int vips_morph( VipsImage *in, VipsImage **out, VipsImage *mask, VipsOperationMorphology morph, ... ) __attribute__((sentinel)); int vips_rank( VipsImage *in, VipsImage **out, int width, int height, int index, ... ) __attribute__((sentinel)); int vips_median( VipsImage *in, VipsImage **out, int size, ... ) __attribute__((sentinel)); int vips_countlines( VipsImage *in, double *nolines, VipsDirection direction, ... ) __attribute__((sentinel)); int vips_labelregions( VipsImage *in, VipsImage **mask, ... ) __attribute__((sentinel)); int vips_fill_nearest( VipsImage *in, VipsImage **out, ... ) __attribute__((sentinel)); #ifdef __cplusplus } #endif /*__cplusplus*/ #endif /*VIPS_MORPHOLOGY_H*/
// SPDX-License-Identifier: BSD-3-Clause /*============================================================================ This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic Package, Release 3a, by John R. Hauser. Copyright 2011, 2012, 2013, 2014 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. =============================================================================*/ #include <stdbool.h> #include <stdint.h> #include "platform.h" #include "internals.h" #include "softfloat.h" uint_fast32_t extF80_to_ui32_r_minMag( extFloat80_t a, bool exact ) { union { struct extFloat80M s; extFloat80_t f; } uA; uint_fast16_t uiA64; int_fast32_t exp; uint_fast64_t sig; int_fast32_t shiftCount; uint_fast32_t z; uA.f = a; uiA64 = uA.s.signExp; exp = expExtF80UI64( uiA64 ); sig = uA.s.signif; shiftCount = 0x403E - exp; if ( 64 <= shiftCount ) { if ( exact && (exp | sig) ) { softfloat_exceptionFlags |= softfloat_flag_inexact; } return 0; } if ( signExtF80UI64( uiA64 ) || (shiftCount < 32) ) { softfloat_raiseFlags( softfloat_flag_invalid ); return 0xFFFFFFFF; } z = sig>>shiftCount; if ( exact && ((uint_fast64_t) z<<shiftCount != sig) ) { softfloat_exceptionFlags |= softfloat_flag_inexact; } return z; }
//-*- Mode: C++ -*- // $Id$ /************************************************************************** * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * * * * Authors: Per Thomas Hille for the ALICE * * offline/HLT Project. Contributors are mentioned in the code where * * appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ #ifndef ALIHLTPHOSONLINEDISPLAYFOURIERTAB_H #define ALIHLTPHOSONLINEDISPLAYFOURIERTAB_H #include <TGTab.h> #include <TRootEmbeddedCanvas.h> #include "AliHLTPHOSOnlineDisplayTab.h" // #include <TCanvas.h> // #include <TH2D.h> // #include <TH1D.h> // #include "AliHLTPHOSOnlineDisplayTH2D.h" // #include "AliHLTPHOSConstants.h" // //#include "AliHLTPHOSFourier.h" // #include "AliHLTPHOSRcuFFTDataStruct.h" #define NZRCUCOORD 2 #define NXRCUCOORD 2 using namespace PhosHLTConst; class TH1D; class TH2D; class TCanvas; class TRootEmbeddedCanvas; class TGTab; class AliHLTPHOSRcuFFTDataStruct; class AliHLTPHOSConstants; class AliHLTPHOSOnlineDisplayTH2D; class AliHLTPHOSGetEventButton; class AliHLTHOMERReader; class AliHLTPHOSRcuCellEnergyDataStruct; class AliHLTPHOSOnlineDisplay; class AliHLTPHOSSharedMemoryInterfacev2; class AliHLTPHOSFourier; class AliHLTPHOSOnlineDisplayFourierTab : public AliHLTPHOSOnlineDisplayTab { public: virtual ~AliHLTPHOSOnlineDisplayFourierTab(); // destructor AliHLTPHOSOnlineDisplayFourierTab(AliHLTPHOSOnlineDisplay * const onlineDisplayPtr, TGTab *tabPtr, const AliHLTHOMERReader * fgHomerReaderPtr, const AliHLTHOMERReader * const fgHomerReadersPtr[MAXHOSTS], int nHosts); // constructor Int_t GetRawData(TH1D *histPtr, int x, int z, int gain); // GetRawData void UpdateDisplay(); //UpdateDisplay int GetNextEvent(); //GetNextEvent virtual void ReadBlockData(AliHLTHOMERReader * const homeReaderPtr); //ReadBlockData void FindFourierBlocks(AliHLTHOMERReader *homeReaderPtr);//FindFourierBlocks void ResetDisplay(); //ResetDisplay TGTab *fTab; //fTab TGTab *fSubTab1; //fSubTab1 TRootEmbeddedCanvas *fEc1, *fEc2, *fEc3, *fEc4, *fEc5, *fEc6; //Canvases // TRootEmbeddedCanvas *fEc1, *fEc2, *fEc3, *fEc4; // TGCompositeFrame *fSubF1, *fSubF2; TGCompositeFrame *fSubF1, *fSubF2, *fSubF3; //frames TCanvas *fgCanvasPtr[NGAINS]; // canvas AliHLTPHOSOnlineDisplayTH2D *fgLegoPlotPtr[NGAINS]; //legoplot TH1D *fFourierHistoNew[NGAINS]; //histogram TH1D *fFourierHistoOld[NGAINS]; //histogram TH1D *fFourierHistoAccumulated[NGAINS]; //histogram // TRootEmbeddedCanvas *fFourierHistoAccumulatedEC[NGAINS]; // TRootEmbeddedCanvas *fFourierHistoOldEC[NGAINS]; // TRootEmbeddedCanvas *fFourierHistoAccumulatedEC[NGAINS]; // int *fChannelData[NMODULES][NXRCUCOORD][NZRCUCOORD][NXCOLUMNSRCU][NZROWSRCU][NGAINS]; // Int_t fNChannelSamples[NMODULES][NXRCUCOORD][NZRCUCOORD][NXCOLUMNSRCU][NZROWSRCU][NGAINS]; // Int_t fChannelEnergy[NMODULES][NXRCUCOORD][NZRCUCOORD][NXCOLUMNSRCU][NZROWSRCU][NGAINS]; const char* Gain2Text(const int gain, const char delimeter); //gain2text protected: Bool_t fgAccumulate; //fgAccumulate private: void FillHistograms(const AliHLTPHOSRcuFFTDataStruct psd, const int size); //FillHistograms AliHLTPHOSOnlineDisplayFourierTab(); // default constructor AliHLTPHOSGetEventButton* fgEventButtPtr; // fgEventButtPtr void InitDisplay(TGTab *tabPtr); //InitDisplay AliHLTPHOSOnlineDisplay *fOnlineDisplayPtr; //fOnlineDisplayPtr AliHLTPHOSSharedMemoryInterfacev2 *fShmPtr; //fShmPtr AliHLTPHOSFourier *fFourierPtr; //fFourierPtr char fGainText[256]; //fGainText unsigned long fEvtCnt; //fEvtCnt AliHLTPHOSOnlineDisplayFourierTab(const AliHLTPHOSOnlineDisplayFourierTab&); //copy constructor AliHLTPHOSOnlineDisplayFourierTab & operator=(const AliHLTPHOSOnlineDisplayFourierTab); //assignement operator }; #endif
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_LOADER_FETCH_TRUST_TOKEN_PARAMS_CONVERSION_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_LOADER_FETCH_TRUST_TOKEN_PARAMS_CONVERSION_H_ #include "services/network/public/cpp/optional_trust_token_params.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/public/platform/web_common.h" namespace network { namespace mojom { namespace blink { class TrustTokenParams; } // namespace blink } // namespace mojom } // namespace network namespace blink { // Converts a mojom::blink TrustTokenParams object to its non-Blink counterpart // by directly copying all fields, converting types where necessary. network::OptionalTrustTokenParams ConvertTrustTokenParams( const absl::optional<network::mojom::blink::TrustTokenParams>& maybe_in); } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_LOADER_FETCH_TRUST_TOKEN_PARAMS_CONVERSION_H_
#ifndef ALIHLTTRIGGERDETECTORGEOMRECTANGLE_H #define ALIHLTTRIGGERDETECTORGEOMRECTANGLE_H //* This file is property of and copyright by the ALICE HLT Project * //* ALICE Experiment at CERN, All rights reserved. * //* See cxx source for full Copyright notice * /// @file AliHLTTriggerDetectorGeomRectangle.h /// @author Oystein Djuvsland /// @date 2009-10-08 /// @brief HLT class describing simple rectangular geometry of (sub-)detectors. /// Used for the AliHLTTriggerBarrelGeomMultiplicity classes #include "AliHLTTriggerDetectorGeom.h" /** * @class AliHLTTriggerDetectorGeomRectangle * HLT class describing simple rectangular geometry cuts of (sub-)detectors. * Used for the AliHLTTriggerBarrelGeomMultiplicity classes * * \ingroup alihlt_trigger */ #include "AliHLTTriggerDetectorGeom.h" class AliHLTTriggerDetectorGeomRectangle : public AliHLTTriggerDetectorGeom { public: /** Default constructor */ AliHLTTriggerDetectorGeomRectangle(); /** Default destructor */ virtual ~AliHLTTriggerDetectorGeomRectangle(); /** * Check if a point is in the detector geometry. * @param point is the point in global coordinates (cm) * @return true if the point is in the geometry */ Bool_t IsInDetector(Double_t point[3]); ClassDef(AliHLTTriggerDetectorGeomRectangle, 1); }; #endif
// 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_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CALLBACK_TRACKER_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CALLBACK_TRACKER_H_ #include <map> #include "base/bind.h" #include "base/callback_forward.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/sync_file_system/drive_backend/callback_tracker_internal.h" namespace sync_file_system { namespace drive_backend { // A helper class to ensure one-shot callback to be called exactly once. // // Usage: // class Foo { // private: // CallbackTracker callback_tracker_; // }; // // void DoSomethingAsync(const SomeCallbackType& callback) { // base::Closure abort_case_handler = base::Bind(callback, ABORT_ERROR); // // SomeCallbackType wrapped_callback = // callback_tracker_.Register( // abort_case_handler, callback); // // // The body of the operation goes here. // } class CallbackTracker { public: typedef std::map<internal::AbortHelper*, base::Closure> AbortClosureByHelper; CallbackTracker(); ~CallbackTracker(); // Returns a wrapped callback. // Upon AbortAll() call, CallbackTracker invokes |abort_closure| and voids all // wrapped callbacks returned by Register(). // Invocation of the wrapped callback unregisters |callback| from // CallbackTracker. template <typename T> base::Callback<T> Register(const base::Closure& abort_closure, const base::Callback<T>& callback) { internal::AbortHelper* helper = new internal::AbortHelper(this); helpers_[helper] = abort_closure; return base::Bind(&internal::InvokeAndInvalidateHelper<T>::Run, helper->AsWeakPtr(), callback); } void AbortAll(); private: friend class internal::AbortHelper; scoped_ptr<internal::AbortHelper> PassAbortHelper( internal::AbortHelper* helper); AbortClosureByHelper helpers_; // Owns AbortHelpers. DISALLOW_COPY_AND_ASSIGN(CallbackTracker); }; } // namespace drive_backend } // namespace sync_file_system #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CALLBACK_TRACKER_H_
/* Copyright (C) 1995 Aladdin Enterprises. All rights reserved. This file is part of Aladdin Ghostscript. Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author or distributor accepts any responsibility for the consequences of using it, or for whether it serves any particular purpose or works at all, unless he or she says so in writing. Refer to the Aladdin Ghostscript Free Public License (the "License") for full details. Every copy of Aladdin Ghostscript must include a copy of the License, normally in a plain ASCII text file named PUBLIC. The License grants you the right to copy, modify and redistribute Aladdin Ghostscript, but only under certain conditions described in the License. Among other things, the License requires that the copyright notice and this notice be preserved on all copies. */ /* smtf.h */ /* Definitions for MoveToFront streams */ /* Requires scommon.h; strimpl.h if any templates are referenced */ /* MoveToFrontEncode/Decode */ typedef struct stream_MTF_state_s { stream_state_common; /* The following change dynamically. */ union _p { ulong l[256 / sizeof(long)]; byte b[256]; } prev; } stream_MTF_state; typedef stream_MTF_state stream_MTFE_state; typedef stream_MTF_state stream_MTFD_state; #define private_st_MTF_state() /* in sbwbs.c */\ gs_private_st_simple(st_MTF_state, stream_MTF_state,\ "MoveToFrontEncode/Decode state") extern const stream_template s_MTFE_template; extern const stream_template s_MTFD_template;
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef REMOTING_CLIENT_AUDIO_DECODE_SCHEDULER_H_ #define REMOTING_CLIENT_AUDIO_DECODE_SCHEDULER_H_ #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "remoting/protocol/audio_stub.h" namespace base { class SingleThreadTaskRunner; } // namespace base namespace remoting { namespace protocol { class SessionConfig; } // namespace protocol class AudioDecoder; class AudioPacket; class AudioPlayer; class AudioDecodeScheduler : public protocol::AudioStub { public: AudioDecodeScheduler( scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, scoped_refptr<base::SingleThreadTaskRunner> audio_decode_task_runner, scoped_ptr<AudioPlayer> audio_player); ~AudioDecodeScheduler() override; // Initializes decoder with the information from the protocol config. void Initialize(const protocol::SessionConfig& config); // AudioStub implementation. void ProcessAudioPacket(scoped_ptr<AudioPacket> packet, const base::Closure& done) override; private: class Core; scoped_refptr<Core> core_; DISALLOW_COPY_AND_ASSIGN(AudioDecodeScheduler); }; } // namespace remoting #endif // REMOTING_CLIENT_AUDIO_DECODE_SCHEDULER_H_
/* Copyright ©2006-2010 Kris Maglione <maglione.k at Gmail> * See LICENSE file for license details. */ #include "event.h" void event_focusout(XFocusChangeEvent *ev) { Window *w; if(!((ev->detail == NotifyNonlinear) ||(ev->detail == NotifyNonlinearVirtual) ||(ev->detail == NotifyVirtual) ||(ev->detail == NotifyInferior) ||(ev->detail == NotifyAncestor))) return; if((w = findwin(ev->window))) event_handle(w, focusout, ev); }
// This code is in the public domain -- castanyo@yahoo.es #ifndef NV_CORE_BITARRAY_H #define NV_CORE_BITARRAY_H #include <nvcore/nvcore.h> #include <nvcore/Containers.h> namespace nv { /// Count the bits of @a x. inline uint bitsSet(uint8 x) { uint count = 0; for(; x != 0; x >>= 1) { count += (x & 1); } return count; } /// Count the bits of @a x. inline uint bitsSet(uint32 x, int bits) { uint count = 0; for(; x != 0 && bits != 0; x >>= 1, bits--) { count += (x & 1); } return count; } /// Simple bit array. class BitArray { public: /// Default ctor. BitArray() {} /// Ctor with initial m_size. BitArray(uint sz) { resize(sz); } /// Get array m_size. uint size() const { return m_size; } /// Clear array m_size. void clear() { resize(0); } /// Set array m_size. void resize(uint sz) { m_size = sz; m_bitArray.resize( (m_size + 7) >> 3 ); } /// Get bit. bool bitAt(uint b) const { nvDebugCheck( b < m_size ); return (m_bitArray[b >> 3] & (1 << (b & 7))) != 0; } /// Set a bit. void setBitAt(uint b) { nvDebugCheck( b < m_size ); m_bitArray[b >> 3] |= (1 << (b & 7)); } /// Clear a bit. void clearBitAt( uint b ) { nvDebugCheck( b < m_size ); m_bitArray[b >> 3] &= ~(1 << (b & 7)); } /// Clear all the bits. void clearAll() { memset(m_bitArray.unsecureBuffer(), 0, m_bitArray.size()); } /// Set all the bits. void setAll() { memset(m_bitArray.unsecureBuffer(), 0xFF, m_bitArray.size()); } /// Toggle all the bits. void toggleAll() { const uint byte_num = m_bitArray.size(); for(uint b = 0; b < byte_num; b++) { m_bitArray[b] ^= 0xFF; } } /// Get a byte of the bit array. const uint8 & byteAt(uint index) const { return m_bitArray[index]; } /// Set the given byte of the byte array. void setByteAt(uint index, uint8 b) { m_bitArray[index] = b; } /// Count the number of bits set. uint countSetBits() const { const uint num = m_bitArray.size(); if( num == 0 ) { return 0; } uint count = 0; for(uint i = 0; i < num - 1; i++) { count += bitsSet(m_bitArray[i]); } count += bitsSet(m_bitArray[num-1], m_size & 0x7); //piDebugCheck(count + countClearBits() == m_size); return count; } /// Count the number of bits clear. uint countClearBits() const { const uint num = m_bitArray.size(); if( num == 0 ) { return 0; } uint count = 0; for(uint i = 0; i < num - 1; i++) { count += bitsSet(~m_bitArray[i]); } count += bitsSet(~m_bitArray[num-1], m_size & 0x7); //piDebugCheck(count + countSetBits() == m_size); return count; } friend void swap(BitArray & a, BitArray & b) { swap(a.m_size, b.m_size); swap(a.m_bitArray, b.m_bitArray); } private: /// Number of bits stored. uint m_size; /// Array of bits. Array<uint8> m_bitArray; }; } // nv namespace #endif // _PI_CORE_BITARRAY_H_
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, as published by the Free Software Foundation. This program is also distributed with certain software (including but not limited to OpenSSL) that is licensed under separate terms, as designated in a particular file or component or in included license documentation. The authors of MySQL hereby grant you an additional permission to link the program and your derivative works with the separately licensed software that they have included with MySQL. 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, version 2.0, 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 _my_check_opt_h #define _my_check_opt_h #ifdef __cplusplus extern "C" { #endif /* All given definitions needed for MyISAM storage engine: myisamchk.c or/and ha_myisam.cc or/and micheck.c Some definitions are needed by the MySQL parser. */ #define T_AUTO_INC (1UL << 0) #define T_AUTO_REPAIR (1UL << 1) #define T_BACKUP_DATA (1UL << 2) #define T_CALC_CHECKSUM (1UL << 3) #define T_CHECK (1UL << 4) #define T_CHECK_ONLY_CHANGED (1UL << 5) #define T_CREATE_MISSING_KEYS (1UL << 6) #define T_DESCRIPT (1UL << 7) #define T_DONT_CHECK_CHECKSUM (1UL << 8) #define T_EXTEND (1UL << 9) #define T_FAST (1UL << 10) #define T_FORCE_CREATE (1UL << 11) #define T_FORCE_UNIQUENESS (1UL << 12) #define T_INFO (1UL << 13) /** CHECK TABLE...MEDIUM (the default) */ #define T_MEDIUM (1UL << 14) /** CHECK TABLE...QUICK */ #define T_QUICK (1UL << 15) #define T_READONLY (1UL << 16) #define T_REP (1UL << 17) #define T_REP_BY_SORT (1UL << 18) #define T_REP_PARALLEL (1UL << 19) #define T_RETRY_WITHOUT_QUICK (1UL << 20) #define T_SAFE_REPAIR (1UL << 21) #define T_SILENT (1UL << 22) #define T_SORT_INDEX (1UL << 23) #define T_SORT_RECORDS (1UL << 24) #define T_STATISTICS (1UL << 25) #define T_UNPACK (1UL << 26) #define T_UPDATE_STATE (1UL << 27) #define T_VERBOSE (1UL << 28) #define T_VERY_SILENT (1UL << 29) #define T_WAIT_FOREVER (1UL << 30) #define T_WRITE_LOOP (1UL << 31) #define T_REP_ANY (T_REP | T_REP_BY_SORT | T_REP_PARALLEL) #ifdef __cplusplus } #endif #endif
/* * This file is part of the coreboot project. * * Copyright (C) 2011 Mark Norman <mpnorman@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. * * 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. */ #include <console/console.h> #include <device/device.h> static void init(struct device *dev) { printk(BIOS_DEBUG, "AAEON PFM-540I_REVB ENTER %s\n", __func__); printk(BIOS_DEBUG, "AAEON PFM-540I_REVB EXIT %s\n", __func__); } static void mainboard_enable(struct device *dev) { dev->ops->init = init; } struct chip_operations mainboard_ops = { .enable_dev = mainboard_enable, };
/* * Copyright (C) 2010-2015 Junjiro R. Okajima * * This program, aufs is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* * special support for filesystems which aqucires an inode mutex * at final closing a file, eg, hfsplus. * * This trick is very simple and stupid, just to open the file before really * neceeary open to tell hfsplus that this is not the final closing. * The caller should call au_h_open_pre() after acquiring the inode mutex, * and au_h_open_post() after releasing it. */ #include "aufs.h" struct file *au_h_open_pre(struct dentry *dentry, aufs_bindex_t bindex, int force_wr) { struct file *h_file; struct dentry *h_dentry; h_dentry = au_h_dptr(dentry, bindex); AuDebugOn(!h_dentry); AuDebugOn(d_is_negative(h_dentry)); h_file = NULL; if (au_test_hfsplus(h_dentry->d_sb) && d_is_reg(h_dentry)) h_file = au_h_open(dentry, bindex, O_RDONLY | O_NOATIME | O_LARGEFILE, /*file*/NULL, force_wr); return h_file; } void au_h_open_post(struct dentry *dentry, aufs_bindex_t bindex, struct file *h_file) { if (h_file) { fput(h_file); au_sbr_put(dentry->d_sb, bindex); } }
/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" { target { ! ilp32 } } } } */ #include "test_sve_acle.h" /* ** st2_s32_base: ** st2w {z0\.s(?: - |, )z1\.s}, p0, \[x0\] ** ret */ TEST_STORE (st2_s32_base, svint32x2_t, int32_t, svst2_s32 (p0, x0, z0), svst2 (p0, x0, z0)) /* ** st2_s32_index: ** st2w {z0\.s(?: - |, )z1\.s}, p0, \[x0, x1, lsl 2\] ** ret */ TEST_STORE (st2_s32_index, svint32x2_t, int32_t, svst2_s32 (p0, x0 + x1, z0), svst2 (p0, x0 + x1, z0)) /* Moving the constant into a register would also be OK. */ /* ** st2_s32_1: ** incb x0 ** st2w {z0\.s(?: - |, )z1\.s}, p0, \[x0\] ** ret */ TEST_STORE (st2_s32_1, svint32x2_t, int32_t, svst2_s32 (p0, x0 + svcntw (), z0), svst2 (p0, x0 + svcntw (), z0)) /* ** st2_s32_2: ** st2w {z0\.s(?: - |, )z1\.s}, p0, \[x0, #2, mul vl\] ** ret */ TEST_STORE (st2_s32_2, svint32x2_t, int32_t, svst2_s32 (p0, x0 + svcntw () * 2, z0), svst2 (p0, x0 + svcntw () * 2, z0)) /* ** st2_s32_14: ** st2w {z0\.s(?: - |, )z1\.s}, p0, \[x0, #14, mul vl\] ** ret */ TEST_STORE (st2_s32_14, svint32x2_t, int32_t, svst2_s32 (p0, x0 + svcntw () * 14, z0), svst2 (p0, x0 + svcntw () * 14, z0)) /* Moving the constant into a register would also be OK. */ /* ** st2_s32_16: ** incb x0, all, mul #16 ** st2w {z0\.s(?: - |, )z1\.s}, p0, \[x0\] ** ret */ TEST_STORE (st2_s32_16, svint32x2_t, int32_t, svst2_s32 (p0, x0 + svcntw () * 16, z0), svst2 (p0, x0 + svcntw () * 16, z0)) /* Moving the constant into a register would also be OK. */ /* ** st2_s32_m1: ** decb x0 ** st2w {z0\.s(?: - |, )z1\.s}, p0, \[x0\] ** ret */ TEST_STORE (st2_s32_m1, svint32x2_t, int32_t, svst2_s32 (p0, x0 - svcntw (), z0), svst2 (p0, x0 - svcntw (), z0)) /* ** st2_s32_m2: ** st2w {z0\.s(?: - |, )z1\.s}, p0, \[x0, #-2, mul vl\] ** ret */ TEST_STORE (st2_s32_m2, svint32x2_t, int32_t, svst2_s32 (p0, x0 - svcntw () * 2, z0), svst2 (p0, x0 - svcntw () * 2, z0)) /* ** st2_s32_m16: ** st2w {z0\.s(?: - |, )z1\.s}, p0, \[x0, #-16, mul vl\] ** ret */ TEST_STORE (st2_s32_m16, svint32x2_t, int32_t, svst2_s32 (p0, x0 - svcntw () * 16, z0), svst2 (p0, x0 - svcntw () * 16, z0)) /* ** st2_s32_m18: ** addvl (x[0-9]+), x0, #-18 ** st2w {z0\.s(?: - |, )z1\.s}, p0, \[\1\] ** ret */ TEST_STORE (st2_s32_m18, svint32x2_t, int32_t, svst2_s32 (p0, x0 - svcntw () * 18, z0), svst2 (p0, x0 - svcntw () * 18, z0)) /* ** st2_vnum_s32_0: ** st2w {z0\.s(?: - |, )z1\.s}, p0, \[x0\] ** ret */ TEST_STORE (st2_vnum_s32_0, svint32x2_t, int32_t, svst2_vnum_s32 (p0, x0, 0, z0), svst2_vnum (p0, x0, 0, z0)) /* Moving the constant into a register would also be OK. */ /* ** st2_vnum_s32_1: ** incb x0 ** st2w {z0\.s(?: - |, )z1\.s}, p0, \[x0\] ** ret */ TEST_STORE (st2_vnum_s32_1, svint32x2_t, int32_t, svst2_vnum_s32 (p0, x0, 1, z0), svst2_vnum (p0, x0, 1, z0)) /* ** st2_vnum_s32_2: ** st2w {z0\.s(?: - |, )z1\.s}, p0, \[x0, #2, mul vl\] ** ret */ TEST_STORE (st2_vnum_s32_2, svint32x2_t, int32_t, svst2_vnum_s32 (p0, x0, 2, z0), svst2_vnum (p0, x0, 2, z0)) /* ** st2_vnum_s32_14: ** st2w {z0\.s(?: - |, )z1\.s}, p0, \[x0, #14, mul vl\] ** ret */ TEST_STORE (st2_vnum_s32_14, svint32x2_t, int32_t, svst2_vnum_s32 (p0, x0, 14, z0), svst2_vnum (p0, x0, 14, z0)) /* Moving the constant into a register would also be OK. */ /* ** st2_vnum_s32_16: ** incb x0, all, mul #16 ** st2w {z0\.s(?: - |, )z1\.s}, p0, \[x0\] ** ret */ TEST_STORE (st2_vnum_s32_16, svint32x2_t, int32_t, svst2_vnum_s32 (p0, x0, 16, z0), svst2_vnum (p0, x0, 16, z0)) /* Moving the constant into a register would also be OK. */ /* ** st2_vnum_s32_m1: ** decb x0 ** st2w {z0\.s(?: - |, )z1\.s}, p0, \[x0\] ** ret */ TEST_STORE (st2_vnum_s32_m1, svint32x2_t, int32_t, svst2_vnum_s32 (p0, x0, -1, z0), svst2_vnum (p0, x0, -1, z0)) /* ** st2_vnum_s32_m2: ** st2w {z0\.s(?: - |, )z1\.s}, p0, \[x0, #-2, mul vl\] ** ret */ TEST_STORE (st2_vnum_s32_m2, svint32x2_t, int32_t, svst2_vnum_s32 (p0, x0, -2, z0), svst2_vnum (p0, x0, -2, z0)) /* ** st2_vnum_s32_m16: ** st2w {z0\.s(?: - |, )z1\.s}, p0, \[x0, #-16, mul vl\] ** ret */ TEST_STORE (st2_vnum_s32_m16, svint32x2_t, int32_t, svst2_vnum_s32 (p0, x0, -16, z0), svst2_vnum (p0, x0, -16, z0)) /* ** st2_vnum_s32_m18: ** addvl (x[0-9]+), x0, #-18 ** st2w {z0\.s(?: - |, )z1\.s}, p0, \[\1\] ** ret */ TEST_STORE (st2_vnum_s32_m18, svint32x2_t, int32_t, svst2_vnum_s32 (p0, x0, -18, z0), svst2_vnum (p0, x0, -18, z0)) /* Using MUL to calculate an index would also be OK. */ /* ** st2_vnum_s32_x1: ** cntb (x[0-9]+) ** madd (x[0-9]+), (x1, \1|\1, x1), x0 ** st2w {z0\.s(?: - |, )z1\.s}, p0, \[\2\] ** ret */ TEST_STORE (st2_vnum_s32_x1, svint32x2_t, int32_t, svst2_vnum_s32 (p0, x0, x1, z0), svst2_vnum (p0, x0, x1, z0))
/* * Demonstrates loading a binary PPM file and displaying it in a window * as a Pixmap. */ /* Comment this definition out if you don't want to use server side pixmaps */ /* (it will be slower but will work on device drivers without bitblt) */ #define USE_PIXMAPS #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <nano-X.h> GR_WINDOW_ID window; /* ID for output window */ #ifdef USE_PIXMAPS GR_WINDOW_ID pmap; /* ID for pixmap */ #endif GR_GC_ID gc; /* Graphics context */ int width, height; /* Size of image */ unsigned char *data; /* Local copy of image data */ static void do_exposure(GR_EVENT_EXPOSURE *event) { /* The window has been exposed so redraw it */ #ifdef USE_PIXMAPS GrCopyArea(window, gc, 0, 0, width, height, pmap, 0, 0, MWROP_SRCCOPY); #else GrArea(window, gc, 0, 0, width, height, data, MWPF_RGB); #endif } static void errorhandler(GR_EVENT *ep) { printf("Error (%s) code %d id %d", ep->error.name, ep->error.code, ep->error.id); exit(1); } int main(int argc, char *argv[]) { unsigned char line[256]; GR_EVENT event; FILE *infile; int i, o; unsigned char *p; if(argc != 2) { printf("Usage: demo6 <filename.ppm>\n"); exit(1); } if(!(infile = fopen(argv[1], "r"))) { printf("Couldn't open \"%s\" for reading: %s\n", argv[1], strerror(errno)); exit(2); } /* Read magic number (P6 = colour, binary encoded PPM file) */ if(!fgets(line, 256, infile)) goto truncated; if(line[0] != 'P' || line[1] != '6') { printf("Unsupported PPM type or not a PPM file.\n"); printf("Please supply a valid P6 format file (colour, with " "binary encoding).\n"); } /* Strip comments */ do { if(!fgets(line, 256, infile)) goto truncated; } while(line[0] == '#'); /* Read width and height */ sscanf(line, "%i %i", &width, &height); /* Read the maximum colour value */ if(!fgets(line, 256, infile)) goto truncated; sscanf(line, "%i", &i); if(i != 255) { printf("Truecolour mode only is supported\n"); exit(4); } /* Calculate how many bytes of image data there is */ i = width * height * 3; /* Calculate how many bytes of data there will be after unpacking */ o = width * height * 4; /* Allocate the space to store the data whilst it's being loaded */ if(!(data = malloc(o))) { printf("Not enough memory to load image\n"); exit(5); } /* Read the data in and unpack it to RGBX format */ /* The lower byte isn't used so we don't set it to anything */ p = data; while(o) { if(fread(p, 1, 3, infile) != 3) goto truncated; p += 4; o -= 4; } /* We don't need the input file anymore so close it */ fclose(infile); /* Register the error handler */ GrSetErrorHandler(errorhandler); if(GrOpen() < 0) { printf("Couldn't connect to Nano-X server\n"); exit(6); } #ifdef USE_PIXMAPS /* Create the pixmap to store the picture in */ pmap = GrNewPixmap(width, height, NULL); #endif /* Create a graphics context */ gc = GrNewGC(); #ifdef USE_PIXMAPS /* Copy the image data into the pixmap */ GrArea(pmap, gc, 0, 0, width, height, data, MWPF_RGB); /* We can free the image data now because it's stored in the pixmap */ free(data); #endif /* Create a window to output the image to */ window = GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, width, height, 0, 0, 0); /* Select expose events so we can redraw the image when necessary */ GrSelectEvents(window, GR_EVENT_MASK_EXPOSURE | GR_EVENT_MASK_CLOSE_REQ); /* Make the window visible */ GrMapWindow(window); #ifdef USE_PIXMAPS /* Paint the pixmap onto it */ GrCopyArea(window, gc, 0, 0, width, height, pmap, 0, 0, MWROP_SRCCOPY); #else GrArea(window, gc, 0, 0, width, height, data, MWPF_RGB); #endif while(1) { GrGetNextEvent(&event); switch(event.type) { case GR_EVENT_TYPE_EXPOSURE: do_exposure(&event.exposure); break; case GR_EVENT_TYPE_CLOSE_REQ: GrClose(); exit(0); } } return 0; truncated: printf("Error: File appears to be truncated\n"); exit(3); }
#ifndef D_MOCK_DHT_MESSAGE_FACTORY_H #define D_MOCK_DHT_MESSAGE_FACTORY_H #include "DHTMessageFactory.h" #include "DHTNode.h" #include "MockDHTMessage.h" #include "DHTPingMessage.h" #include "DHTPingReplyMessage.h" #include "DHTFindNodeMessage.h" #include "DHTFindNodeReplyMessage.h" #include "DHTGetPeersMessage.h" #include "DHTGetPeersReplyMessage.h" #include "DHTAnnouncePeerMessage.h" #include "DHTAnnouncePeerReplyMessage.h" #include "DHTUnknownMessage.h" namespace aria2 { class MockDHTMessageFactory:public DHTMessageFactory { protected: std::shared_ptr<DHTNode> localNode_; public: MockDHTMessageFactory() {} virtual std::unique_ptr<DHTQueryMessage> createQueryMessage(const Dict* dict, const std::string& ipaddr, uint16_t port) CXX11_OVERRIDE { return nullptr; } virtual std::unique_ptr<DHTResponseMessage> createResponseMessage(const std::string& messageType, const Dict* dict, const std::string& ipaddr, uint16_t port) CXX11_OVERRIDE { auto remoteNode = std::make_shared<DHTNode>(); // TODO At this point, removeNode's ID is random. remoteNode->setIPAddress(ipaddr); remoteNode->setPort(port); return make_unique<MockDHTResponseMessage> (localNode_, remoteNode, downcast<String>(dict->get("t"))->s()); } virtual std::unique_ptr<DHTPingMessage> createPingMessage(const std::shared_ptr<DHTNode>& remoteNode, const std::string& transactionID = "") CXX11_OVERRIDE { return nullptr; } virtual std::unique_ptr<DHTPingReplyMessage> createPingReplyMessage(const std::shared_ptr<DHTNode>& remoteNode, const unsigned char* remoteNodeID, const std::string& transactionID) CXX11_OVERRIDE { return nullptr; } virtual std::unique_ptr<DHTFindNodeMessage> createFindNodeMessage(const std::shared_ptr<DHTNode>& remoteNode, const unsigned char* targetNodeID, const std::string& transactionID = "") CXX11_OVERRIDE { return nullptr; } virtual std::unique_ptr<DHTFindNodeReplyMessage> createFindNodeReplyMessage (const std::shared_ptr<DHTNode>& remoteNode, std::vector<std::shared_ptr<DHTNode>> closestKNodes, const std::string& transactionID) CXX11_OVERRIDE { return nullptr; } virtual std::unique_ptr<DHTGetPeersMessage> createGetPeersMessage(const std::shared_ptr<DHTNode>& remoteNode, const unsigned char* infoHash, const std::string& transactionID) CXX11_OVERRIDE { return nullptr; } virtual std::unique_ptr<DHTGetPeersReplyMessage> createGetPeersReplyMessage (const std::shared_ptr<DHTNode>& remoteNode, std::vector<std::shared_ptr<DHTNode>> closestKNodes, std::vector<std::shared_ptr<Peer>> peers, const std::string& token, const std::string& transactionID) CXX11_OVERRIDE { return nullptr; } virtual std::unique_ptr<DHTAnnouncePeerMessage> createAnnouncePeerMessage(const std::shared_ptr<DHTNode>& remoteNode, const unsigned char* infoHash, uint16_t tcpPort, const std::string& token, const std::string& transactionID = "") CXX11_OVERRIDE { return nullptr; } virtual std::unique_ptr<DHTAnnouncePeerReplyMessage> createAnnouncePeerReplyMessage(const std::shared_ptr<DHTNode>& remoteNode, const std::string& transactionID) CXX11_OVERRIDE { return nullptr; } virtual std::unique_ptr<DHTUnknownMessage> createUnknownMessage(const unsigned char* data, size_t length, const std::string& ipaddr, uint16_t port) CXX11_OVERRIDE { return nullptr; } void setLocalNode(const std::shared_ptr<DHTNode>& node) { localNode_ = node; } }; } // namespace aria2 #endif // D_MOCK_DHT_MESSAGE_FACTORY_H
// Archive/Tar/Header.h #ifndef __ARCHIVE_TAR_HEADER_H #define __ARCHIVE_TAR_HEADER_H #include "Common/Types.h" namespace NArchive { namespace NTar { namespace NFileHeader { const int kRecordSize = 512; const int kNameSize = 100; const int kUserNameSize = 32; const int kGroupNameSize = 32; const int kPrefixSize = 155; /* struct CHeader { char Name[kNameSize]; char Mode[8]; char UID[8]; char GID[8]; char Size[12]; char ModificationTime[12]; char CheckSum[8]; char LinkFlag; char LinkName[kNameSize]; char Magic[8]; char UserName[kUserNameSize]; char GroupName[kGroupNameSize]; char DeviceMajor[8]; char DeviceMinor[8]; char Prefix[155]; }; union CRecord { CHeader Header; Byte Padding[kRecordSize]; }; */ namespace NMode { const int kSetUID = 04000; // Set UID on execution const int kSetGID = 02000; // Set GID on execution const int kSaveText = 01000; // Save text (sticky bit) } namespace NFilePermissions { const int kUserRead = 00400; // read by owner const int kUserWrite = 00200; // write by owner const int kUserExecute = 00100; // execute/search by owner const int kGroupRead = 00040; // read by group const int kGroupWrite = 00020; // write by group const int kGroupExecute = 00010; // execute/search by group const int kOtherRead = 00004; // read by other const int kOtherWrite = 00002; // write by other const int kOtherExecute = 00001; // execute/search by other } // The linkflag defines the type of file namespace NLinkFlag { const char kOldNormal = '\0'; // Normal disk file, Unix compatible const char kNormal = '0'; // Normal disk file const char kLink = '1'; // Link to previously dumped file const char kSymbolicLink = '2'; // Symbolic link const char kCharacter = '3'; // Character special file const char kBlock = '4'; // Block special file const char kDirectory = '5'; // Directory const char kFIFO = '6'; // FIFO special file const char kContiguous = '7'; // Contiguous file } // Further link types may be defined later. // The checksum field is filled with this while the checksum is computed. extern const char *kCheckSumBlanks;// = " "; // 8 blanks, no null extern const char *kLongLink; // = "././@LongLink"; extern const char *kLongLink2; // = "@LongLink"; // The magic field is filled with this if uname and gname are valid. namespace NMagic { extern const char *kUsTar; // = "ustar"; // 5 chars extern const char *kGNUTar; // = "GNUtar "; // 7 chars and a null extern const char *kEmpty; // = "GNUtar "; // 7 chars and a null } } }} #endif
/* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ #ifndef TWINE_MUSIC_H #define TWINE_MUSIC_H #include "audio/midiplayer.h" #include "audio/mixer.h" #include "common/scummsys.h" namespace TwinE { class TwinEEngine; class TwinEMidiPlayer : public Audio::MidiPlayer { private: TwinEEngine *_engine; public: TwinEMidiPlayer(TwinEEngine *engine); void play(byte *buf, int size); }; class Music { private: TwinEEngine *_engine; TwinEMidiPlayer _midiPlayer; void musicFadeIn(); void musicFadeOut(); /** Auxiliar midi pointer to */ uint8 *midiPtr = nullptr; Audio::SoundHandle _midiHandle; /** Track number of the current playing music */ int32 currentMusic = -1; /** * Play CD music * @param track track number to play */ bool playTrackMusicCd(int32 track); /** Stop CD music */ void stopTrackMusicCd(); public: Music(TwinEEngine *engine); /** * Music volume * @param current volume number */ void musicVolume(int32 volume); /** * Generic play music, according with settings it plays CD or high quality sounds instead * @param track track number to play */ bool playTrackMusic(int32 track); /** Generic stop music according with settings */ void stopTrackMusic(); /** * Play MIDI music * @param midiIdx music index under mini_mi_win.hqr * @note valid indices for lba1 are [1-32] */ bool playMidiMusic(int32 midiIdx, int32 loop = 0); /** Stop MIDI music */ void stopMidiMusic(); /** Initialize CD-Rom */ bool initCdrom(); /** Stop MIDI and Track music */ void stopMusic(); }; } // namespace TwinE #endif
/* This file is part of Clementine. Copyright 2011, David Sansome <me@davidsansome.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // Note: this file is licensed under the Apache License instead of GPL because // it is used by the Spotify blob which links against libspotify and is not GPL // compatible. #ifndef TIMECONSTANTS_H #define TIMECONSTANTS_H #include <QtGlobal> // Use these to convert between time units const qint64 kMsecPerSec = 1000ll; const qint64 kUsecPerMsec = 1000ll; const qint64 kUsecPerSec = 1000000ll; const qint64 kNsecPerUsec = 1000ll; const qint64 kNsecPerMsec = 1000000ll; const qint64 kNsecPerSec = 1000000000ll; const qint64 kSecsPerDay = 24 * 60 * 60; #endif // TIMECONSTANTS_H
/* * 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 _IGNITE_ODBC_COLUMN #define _IGNITE_ODBC_COLUMN #include <stdint.h> #include <ignite/impl/binary/binary_reader_impl.h> #include "ignite/odbc/app/application_data_buffer.h" namespace ignite { namespace odbc { /** * Result set column. */ class Column { public: /** * Default constructor. */ Column(); /** * Copy constructor. * * @param other Another instance. */ Column(const Column& other); /** * Copy operator. * * @param other Another instance. * @return This. */ Column& operator=(const Column& other); /** * Destructor. */ ~Column(); /** * Constructor. * * @param reader Reader to be used to retrieve column data. */ Column(ignite::impl::binary::BinaryReaderImpl& reader); /** * Get column size in bytes. * * @return Column size. */ int32_t GetSize() const { return size; } /** * Read column data and store it in application data buffer. * * @param dataBuf Application data buffer. * @return Operation result. */ SqlResult::Type ReadToBuffer(ignite::impl::binary::BinaryReaderImpl& reader, app::ApplicationDataBuffer& dataBuf); /** * Check if the column is in valid state. * * Invalid instance can be returned if some of the previous * operations have resulted in a failure. For example invalid * instance can be returned by not-throwing version of method * in case of error. Invalid instances also often can be * created using default constructor. * * @return True if valid. */ bool IsValid() const { return startPos >= 0; } /** * Get unread data length. * Find out how many bytes of data are left unread. * * @return Lengh of unread data in bytes. */ int32_t GetUnreadDataLength() const { return size - offset; } /** * Get unread data length. * Find out how many bytes of data are left unread. * * @return Lengh of unread data in bytes. */ int32_t GetEndPosition() const { return endPos; } private: /** * Increase offset. * * Increases offset on specified value and makes sure resulting * offset does not exceed column size. * * @param value Offset is incremented on this value. */ void IncreaseOffset(int32_t value); /** Column type */ int8_t type; /** Column position in current row. */ int32_t startPos; /** Column end position in current row. */ int32_t endPos; /** Current offset in column. */ int32_t offset; /** Column data size in bytes. */ int32_t size; }; } } #endif //_IGNITE_ODBC_COLUMN
/*========================================================================= Program: ParaView Module: vtkXMLCompositeDataReader.h Copyright (c) Kitware, Inc. All rights reserved. See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkXMLCompositeDataReader - Reader for multi-group datasets // .SECTION Description // vtkXMLCompositeDataReader reads the VTK XML multi-group data file // format. XML multi-group data files are meta-files that point to a list // of serial VTK XML files. When reading in parallel, it will distribute // sub-blocks among processor. If the number of sub-blocks is less than // the number of processors, some processors will not have any sub-blocks // for that group. If the number of sub-blocks is larger than the // number of processors, each processor will possibly have more than // 1 sub-block. #ifndef vtkXMLCompositeDataReader_h #define vtkXMLCompositeDataReader_h #include "vtkIOXMLModule.h" // For export macro #include "vtkXMLReader.h" class vtkCompositeDataSet; class vtkInformationIntegerKey; class vtkInformationIntegerVectorKey; //BTX struct vtkXMLCompositeDataReaderInternals; //ETX class VTKIOXML_EXPORT vtkXMLCompositeDataReader : public vtkXMLReader { public: vtkTypeMacro(vtkXMLCompositeDataReader,vtkXMLReader); void PrintSelf(ostream& os, vtkIndent indent); // Description: // Get the output data object for a port on this algorithm. vtkCompositeDataSet* GetOutput(); vtkCompositeDataSet* GetOutput(int); protected: vtkXMLCompositeDataReader(); ~vtkXMLCompositeDataReader(); // Get the name of the data set being read. virtual const char* GetDataSetName(); // Returns the primary element pass to ReadPrimaryElement(). vtkXMLDataElement* GetPrimaryElement(); virtual void ReadXMLData(); virtual int ReadPrimaryElement(vtkXMLDataElement* ePrimary); // Setup the output with no data available. Used in error cases. virtual void SetupEmptyOutput(); virtual int FillOutputPortInformation(int, vtkInformation* info); // Create a default executive. virtual vtkExecutive* CreateDefaultExecutive(); vtkXMLReader* GetReaderOfType(const char* type); virtual int RequestInformation(vtkInformation*, vtkInformationVector**, vtkInformationVector*); // Adds a child data object to the composite parent. childXML is the XML for // the child data object need to obtain certain meta-data about the child. void AddChild(vtkCompositeDataSet* parent, vtkDataObject* child, vtkXMLDataElement* childXML); // Read the XML element for the subtree of a the composite dataset. // dataSetIndex is used to rank the leaf nodes in an inorder traversal. virtual void ReadComposite(vtkXMLDataElement* element, vtkCompositeDataSet* composite, const char* filePath, unsigned int &dataSetIndex)=0; // Read the vtkDataSet (a leaf) in the composite dataset. virtual vtkDataSet* ReadDataset(vtkXMLDataElement* xmlElem, const char* filePath); // Counts "DataSet" elements in the subtree. unsigned int CountLeaves(vtkXMLDataElement* elem); // Description: // Given the inorder index for a leaf node, this method tells if the current // process should read the dataset. int ShouldReadDataSet(unsigned int datasetIndex); private: vtkXMLCompositeDataReader(const vtkXMLCompositeDataReader&); // Not implemented. void operator=(const vtkXMLCompositeDataReader&); // Not implemented. vtkXMLCompositeDataReaderInternals* Internal; }; #endif
// 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 EXTENSIONS_SHELL_COMMON_SHELL_EXTENSIONS_CLIENT_H_ #define EXTENSIONS_SHELL_COMMON_SHELL_EXTENSIONS_CLIENT_H_ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "extensions/common/extensions_client.h" #include "extensions/common/permissions/extensions_api_permissions.h" namespace extensions { // The app_shell implementation of ExtensionsClient. class ShellExtensionsClient : public ExtensionsClient { public: ShellExtensionsClient(); ~ShellExtensionsClient() override; // ExtensionsClient overrides: void Initialize() override; const PermissionMessageProvider& GetPermissionMessageProvider() const override; const std::string GetProductName() override; scoped_ptr<FeatureProvider> CreateFeatureProvider( const std::string& name) const override; scoped_ptr<JSONFeatureProviderSource> CreateFeatureProviderSource( const std::string& name) const override; void FilterHostPermissions( const URLPatternSet& hosts, URLPatternSet* new_hosts, std::set<PermissionMessage>* messages) const override; void FilterHostPermissions(const URLPatternSet& hosts, URLPatternSet* new_hosts, PermissionIDSet* permissions) const override; void SetScriptingWhitelist(const ScriptingWhitelist& whitelist) override; const ScriptingWhitelist& GetScriptingWhitelist() const override; URLPatternSet GetPermittedChromeSchemeHosts( const Extension* extension, const APIPermissionSet& api_permissions) const override; bool IsScriptableURL(const GURL& url, std::string* error) const override; bool IsAPISchemaGenerated(const std::string& name) const override; base::StringPiece GetAPISchema(const std::string& name) const override; void RegisterAPISchemaResources(ExtensionAPI* api) const override; bool ShouldSuppressFatalErrors() const override; void RecordDidSuppressFatalError() override; std::string GetWebstoreBaseURL() const override; std::string GetWebstoreUpdateURL() const override; bool IsBlacklistUpdateURL(const GURL& url) const override; private: const ExtensionsAPIPermissions extensions_api_permissions_; ScriptingWhitelist scripting_whitelist_; DISALLOW_COPY_AND_ASSIGN(ShellExtensionsClient); }; } // namespace extensions #endif // EXTENSIONS_SHELL_COMMON_SHELL_EXTENSIONS_CLIENT_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 EXTENSIONS_COMMON_FEATURES_COMPLEX_FEATURE_H_ #define EXTENSIONS_COMMON_FEATURES_COMPLEX_FEATURE_H_ #include <set> #include <string> #include <vector> #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "extensions/common/extension.h" #include "extensions/common/features/feature.h" #include "extensions/common/manifest.h" namespace extensions { // A ComplexFeature is composed of one or many Features. A ComplexFeature // is available if any Feature (i.e. permission rule) that composes it is // available, but not if only some combination of Features is available. class ComplexFeature : public Feature { public: using FeatureList = std::vector<scoped_ptr<Feature>>; explicit ComplexFeature(scoped_ptr<FeatureList> features); ~ComplexFeature() override; // extensions::Feature: Availability IsAvailableToManifest(const std::string& extension_id, Manifest::Type type, Manifest::Location location, int manifest_version, Platform platform) const override; Availability IsAvailableToContext(const Extension* extension, Context context, const GURL& url, Platform platform) const override; bool IsIdInBlacklist(const std::string& extension_id) const override; bool IsIdInWhitelist(const std::string& extension_id) const override; protected: // extensions::Feature: std::string GetAvailabilityMessage(AvailabilityResult result, Manifest::Type type, const GURL& url, Context context) const override; bool IsInternal() const override; private: FeatureList features_; DISALLOW_COPY_AND_ASSIGN(ComplexFeature); }; } // namespace extensions #endif // EXTENSIONS_COMMON_FEATURES_COMPLEX_FEATURE_H_
/* * * Copyright 2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef GRPC_CORE_EXT_CENSUS_TRACE_STRING_H #define GRPC_CORE_EXT_CENSUS_TRACE_STRING_H #include <grpc/slice.h> /* String struct for tracing messages. Since this is a C API, we do not have access to a string class. This is intended for use by higher level languages which wrap around the C API, as most of them have a string class. This will also be more efficient when copying, as we have an explicitly specified length. Also, grpc_slice has reference counting which allows for interning. */ typedef struct trace_string { char *string; size_t length; } trace_string; #endif
// 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 BASE_TASK_SEQUENCE_MANAGER_TASK_TIME_OBSERVER_H_ #define BASE_TASK_SEQUENCE_MANAGER_TASK_TIME_OBSERVER_H_ #include "base/time/time.h" namespace base { namespace sequence_manager { // TaskTimeObserver provides an API for observing completion of tasks. class TaskTimeObserver { public: TaskTimeObserver() = default; TaskTimeObserver(const TaskTimeObserver&) = delete; TaskTimeObserver& operator=(const TaskTimeObserver&) = delete; virtual ~TaskTimeObserver() = default; // To be called when task is about to start. virtual void WillProcessTask(TimeTicks start_time) = 0; // To be called when task is completed. virtual void DidProcessTask(TimeTicks start_time, TimeTicks end_time) = 0; }; } // namespace sequence_manager } // namespace base #endif // BASE_TASK_SEQUENCE_MANAGER_TASK_TIME_OBSERVER_H_
/* { dg-do run } */ /* { dg-options "-O2 -fno-strict-aliasing -msse2" } */ /* { dg-additional-options "-mno-mmx" { target { ! ia32 } } } */ #include "sse2-check.h" #include "mmx-vals.h" __attribute__((noinline, noclone)) static void test_pmaddwd (long long *ll1, long long *ll2, long long *r) { __m64 t1 = *(__m64 *) ll1; __m64 t2 = *(__m64 *) ll2; *(__m64 *) r = _m_pmaddwd (t1, t2); } /* Routine to manually compute the results */ static void compute_correct_result (long long *dst_p, long long *src_p, long long *res_p) { short *dst = (short *) dst_p; short *src = (short *) src_p; int *res = (int *) res_p; res[0] = dst[0] * src[0] + dst[1] * src[1]; res[1] = dst[2] * src[2] + dst[3] * src[3]; } static void sse2_test (void) { int i; long long r, ck; int fail = 0; /* Run the MMX tests */ for (i = 0; i < MMX_num_ops; i += 2) { test_pmaddwd (&MMXops[i], &MMXops[i + 1], &r); compute_correct_result (&MMXops[i], &MMXops[i + 1], &ck); if (ck != r) fail++; } if (fail != 0) abort (); }
// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2016, Bin Meng <bmeng.cn@gmail.com> */ #include <common.h> #include <asm/io.h> #include <errno.h> #include <smsc_sio1007.h> static inline u8 sio1007_read(int port, int reg) { outb(reg, port); return inb(port + 1); } static inline void sio1007_write(int port, int reg, int val) { outb(reg, port); outb(val, port + 1); } static inline void sio1007_clrsetbits(int port, int reg, u8 clr, u8 set) { sio1007_write(port, reg, (sio1007_read(port, reg) & ~clr) | set); } void sio1007_enable_serial(int port, int num, int iobase, int irq) { if (num < 0 || num > SIO1007_UART_NUM) return; /* enter configuration state */ outb(0x55, port); /* power on serial port and set up its i/o base & irq */ if (!num) { sio1007_clrsetbits(port, DEV_POWER_CTRL, 0, UART1_POWER_ON); sio1007_clrsetbits(port, UART1_IOBASE, 0xfe, iobase >> 2); sio1007_clrsetbits(port, UART_IRQ, 0xf0, irq << 4); } else { sio1007_clrsetbits(port, DEV_POWER_CTRL, 0, UART2_POWER_ON); sio1007_clrsetbits(port, UART2_IOBASE, 0xfe, iobase >> 2); sio1007_clrsetbits(port, UART_IRQ, 0x0f, irq); } /* exit configuration state */ outb(0xaa, port); } void sio1007_enable_runtime(int port, int iobase) { /* enter configuration state */ outb(0x55, port); /* set i/o base for the runtime register block */ sio1007_clrsetbits(port, RTR_IOBASE_LOW, 0, iobase >> 4); sio1007_clrsetbits(port, RTR_IOBASE_HIGH, 0, iobase >> 12); /* turn on address decoding for this block */ sio1007_clrsetbits(port, DEV_ACTIVATE, 0, RTR_EN); /* exit configuration state */ outb(0xaa, port); } void sio1007_gpio_config(int port, int gpio, int dir, int pol, int type) { int reg = GPIO0_DIR; if (gpio < 0 || gpio > SIO1007_GPIO_NUM) return; if (gpio >= GPIO_NUM_PER_GROUP) { reg = GPIO1_DIR; gpio -= GPIO_NUM_PER_GROUP; } /* enter configuration state */ outb(0x55, port); /* set gpio pin direction, polority and type */ sio1007_clrsetbits(port, reg, 1 << gpio, dir << gpio); sio1007_clrsetbits(port, reg + 1, 1 << gpio, pol << gpio); sio1007_clrsetbits(port, reg + 2, 1 << gpio, type << gpio); /* exit configuration state */ outb(0xaa, port); } int sio1007_gpio_get_value(int port, int gpio) { int reg = GPIO0_DATA; int val; if (gpio < 0 || gpio > SIO1007_GPIO_NUM) return -EINVAL; if (gpio >= GPIO_NUM_PER_GROUP) { reg = GPIO1_DATA; gpio -= GPIO_NUM_PER_GROUP; } val = inb(port + reg); if (val & (1 << gpio)) return 1; else return 0; } void sio1007_gpio_set_value(int port, int gpio, int val) { int reg = GPIO0_DATA; u8 data; if (gpio < 0 || gpio > SIO1007_GPIO_NUM) return; if (gpio >= GPIO_NUM_PER_GROUP) { reg = GPIO1_DATA; gpio -= GPIO_NUM_PER_GROUP; } data = inb(port + reg); data &= ~(1 << gpio); data |= (val << gpio); outb(data, port + reg); }
/* * (C) Copyright 2000 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * * See file CREDITS for list of people who contributed to this * project. * * 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. * */ /* * Definitions for Command Processor */ #ifndef __COMMAND_H #define __COMMAND_H #include <linux/list.h> #include <linux/stringify.h> #ifndef NULL #define NULL 0 #endif #ifndef __ASSEMBLY__ extern struct list_head command_list; #define for_each_command(cmd) list_for_each_entry(cmd, &command_list, list) struct string_list; /* * Monitor Command Table */ struct command { const char *name; /* Command Name */ const char **aliases; /* Implementation function */ int (*cmd)(int, char *[]); int (*complete)(struct string_list *sl, char *instr); const char *desc; /* Short command description, start with lowercase */ const char *opts; /* command options */ struct list_head list; /* List of commands */ uint32_t group; #ifdef CONFIG_LONGHELP const char *help; /* Help message (long) */ #endif } #ifdef __x86_64__ /* This is required because the linker will put symbols on a 64 bit alignment */ __attribute__((aligned(64))) #endif ; extern struct command __barebox_cmd_start; extern struct command __barebox_cmd_end; /* common/command.c */ struct command *find_cmd(const char *cmd); int execute_command(int argc, char **argv); void barebox_cmd_usage(struct command *cmdtp); #define COMMAND_SUCCESS 0 #define COMMAND_ERROR 1 #define COMMAND_ERROR_USAGE 2 /* Note: keep this list in sync with commands/help.c */ #define CMD_GRP_INFO 1 #define CMD_GRP_BOOT 2 #define CMD_GRP_ENV 3 #define CMD_GRP_FILE 4 #define CMD_GRP_PART 5 #define CMD_GRP_SCRIPT 6 #define CMD_GRP_NET 7 #define CMD_GRP_CONSOLE 8 #define CMD_GRP_MEM 9 #define CMD_GRP_HWMANIP 10 #define CMD_GRP_MISC 11 #endif /* __ASSEMBLY__ */ #define Struct_Section __attribute__ ((unused,section (".barebox_cmd"))) #define BAREBOX_CMD_START(_name) \ extern const struct command __barebox_cmd_##_name; \ const struct command __barebox_cmd_##_name \ __attribute__ ((unused,section (".barebox_cmd_" __stringify(_name)))) = { \ .name = #_name, #define BAREBOX_CMD_END \ }; #ifdef CONFIG_AUTO_COMPLETE #define BAREBOX_CMD_COMPLETE(_cpt) .complete = _cpt, #else #define BAREBOX_CMD_COMPLETE(_cpt) #endif #define BAREBOX_CMD_HELP_START(_name) \ static const __maybe_unused char cmd_##_name##_help[] = #define BAREBOX_CMD_HELP_OPT(_opt, _desc) "\t" _opt "\t" _desc "\n" #define BAREBOX_CMD_HELP_TEXT(_text) _text "\n" #define BAREBOX_CMD_HELP_END ; #ifdef CONFIG_LONGHELP #define BAREBOX_CMD_HELP(text) .help = text, #else #define BAREBOX_CMD_HELP(text) #endif #define BAREBOX_CMD_GROUP(grp) .group = grp, #define BAREBOX_CMD_DESC(text) .desc = text, #define BAREBOX_CMD_OPTS(text) .opts = text, int register_command(struct command *); #endif /* __COMMAND_H */
/* -*- c++ -*- */ /* * Copyright 2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_STREAMS_TO_STREAM_IMPL_H #define INCLUDED_STREAMS_TO_STREAM_IMPL_H #include <blocks/streams_to_stream.h> namespace gr { namespace blocks { class BLOCKS_API streams_to_stream_impl : public streams_to_stream { public: streams_to_stream_impl(size_t itemsize, size_t nstreams); int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); }; } /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_STREAMS_TO_STREAM_IMPL_H */
/* RetroArch - A frontend for libretro. * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch 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 Found- * ation, either version 3 of the License, or (at your option) any later version. * * RetroArch 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 RetroArch. * If not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H #include "../../config.h" #endif #ifdef HAVE_DBUS #include <dbus/dbus.h> static DBusConnection* dbus_connection = NULL; static unsigned int dbus_screensaver_cookie = 0; #endif #include "../../verbosity.h" void dbus_ensure_connection(void) { #ifdef HAVE_DBUS DBusError err; int ret; dbus_error_init(&err); dbus_connection = dbus_bus_get_private(DBUS_BUS_SESSION, &err); if (dbus_error_is_set(&err)) { RARCH_LOG("[DBus]: Failed to get DBus connection. Screensaver will not be suspended via DBus.\n"); dbus_error_free(&err); } if (dbus_connection) dbus_connection_set_exit_on_disconnect(dbus_connection, true); #endif } void dbus_close_connection(void) { #ifdef HAVE_DBUS if (!dbus_connection) return; dbus_connection_close(dbus_connection); dbus_connection_unref(dbus_connection); dbus_connection = NULL; #endif } bool dbus_screensaver_inhibit(void) { bool ret = false; #ifdef HAVE_DBUS const char *app = "RetroArch"; const char *reason = "Playing a game"; DBusMessage *msg = NULL; DBusMessage *reply = NULL; if (!dbus_connection) return false; /* DBus connection was not obtained */ if (dbus_screensaver_cookie > 0) return true; /* Already inhibited */ msg = dbus_message_new_method_call("org.freedesktop.ScreenSaver", "/org/freedesktop/ScreenSaver", "org.freedesktop.ScreenSaver", "Inhibit"); if (!msg) return false; if (!dbus_message_append_args(msg, DBUS_TYPE_STRING, &app, DBUS_TYPE_STRING, &reason, DBUS_TYPE_INVALID)) { dbus_message_unref(msg); return false; } reply = dbus_connection_send_with_reply_and_block(dbus_connection, msg, 300, NULL); if (reply != NULL) { if (!dbus_message_get_args(reply, NULL, DBUS_TYPE_UINT32, &dbus_screensaver_cookie, DBUS_TYPE_INVALID)) dbus_screensaver_cookie = 0; else ret = true; dbus_message_unref(reply); } dbus_message_unref(msg); if (dbus_screensaver_cookie == 0) { RARCH_ERR("[DBus]: Failed to suspend screensaver via DBus.\n"); } else { RARCH_LOG("[DBus]: Suspended screensaver via DBus.\n"); } #endif return ret; } void dbus_screensaver_uninhibit(void) { #ifdef HAVE_DBUS DBusMessage *msg = NULL; if (!dbus_connection) return; if (dbus_screensaver_cookie == 0) return; msg = dbus_message_new_method_call("org.freedesktop.ScreenSaver", "/org/freedesktop/ScreenSaver", "org.freedesktop.ScreenSaver", "UnInhibit"); if (!msg) return; dbus_message_append_args(msg, DBUS_TYPE_UINT32, &dbus_screensaver_cookie, DBUS_TYPE_INVALID); if (dbus_connection_send(dbus_connection, msg, NULL)) dbus_connection_flush(dbus_connection); dbus_message_unref(msg); dbus_screensaver_cookie = 0; #endif } /* Returns false when fallback should be attempted */ bool dbus_suspend_screensaver(bool enable) { #ifdef HAVE_DBUS if (enable) return dbus_screensaver_inhibit(); dbus_screensaver_uninhibit(); #endif return false; }
#ifndef EXIFPARSER_H #define EXIFPARSER_H #include <QGeoCoordinate> #include <QDebug> #include "GeoTagController.h" class ExifParser { public: ExifParser(); ~ExifParser(); double readTime(QByteArray& buf); bool write(QByteArray& buf, GeoTagWorker::cameraFeedbackPacket& geotag); }; #endif // EXIFPARSER_H
#ifndef ROOT_TKDTree #define ROOT_TKDTree #ifndef ROOT_TObject #include "TObject.h" #endif #include "TMath.h" #include <vector> template <typename Index, typename Value> class TKDTree : public TObject { public: TKDTree(); TKDTree(Index npoints, Index ndim, UInt_t bsize); TKDTree(Index npoints, Index ndim, UInt_t bsize, Value **data); ~TKDTree(); void Build(); // build the tree Double_t Distance(const Value *point, Index ind, Int_t type=2) const; void DistanceToNode(const Value *point, Index inode, Value &min, Value &max, Int_t type=2); // Get indexes of left and right daughter nodes Int_t GetLeft(Int_t inode) const {return inode*2+1;} Int_t GetRight(Int_t inode) const {return (inode+1)*2;} Int_t GetParent(Int_t inode) const {return (inode-1)/2;} // // Other getters Index* GetPointsIndexes(Int_t node) const; void GetNodePointsIndexes(Int_t node, Int_t &first1, Int_t &last1, Int_t &first2, Int_t &last2) const; UChar_t GetNodeAxis(Int_t id) const {return (id < 0 || id >= fNNodes) ? 0 : fAxis[id];} Value GetNodeValue(Int_t id) const {return (id < 0 || id >= fNNodes) ? 0 : fValue[id];} Int_t GetNNodes() const {return fNNodes;} Int_t GetTotalNodes() const {return fTotalNodes;} Value* GetBoundaries(); Value* GetBoundariesExact(); Value* GetBoundary(const Int_t node); Value* GetBoundaryExact(const Int_t node); Index GetNPoints() { return fNPoints; } Index GetNDim() { return fNDim; } Index GetNPointsNode(Int_t node) const; //Getters for internal variables. Int_t GetRowT0() {return fRowT0;} //! smallest terminal row Int_t GetCrossNode() {return fCrossNode;} //! cross node Int_t GetOffset() {return fOffset;} //! offset in fIndPoints Index* GetIndPoints() {return fIndPoints;} Index GetBucketSize() {return fBucketSize;} void FindNearestNeighbors(const Value *point, Int_t k, Index *ind, Value *dist); Index FindNode(const Value * point) const; void FindPoint(Value * point, Index &index, Int_t &iter); void FindInRange(Value *point, Value range, std::vector<Index> &res); void FindBNodeA(Value * point, Value * delta, Int_t &inode); Bool_t IsTerminal(Index inode) const {return (inode>=fNNodes);} Int_t IsOwner() { return fDataOwner; } Value KOrdStat(Index ntotal, Value *a, Index k, Index *index) const; void MakeBoundaries(Value *range = 0x0); void MakeBoundariesExact(); void SetData(Index npoints, Index ndim, UInt_t bsize, Value **data); Int_t SetData(Index idim, Value *data); void SetOwner(Int_t owner) { fDataOwner = owner; } void Spread(Index ntotal, Value *a, Index *index, Value &min, Value &max) const; private: TKDTree(const TKDTree &); // not implemented TKDTree<Index, Value>& operator=(const TKDTree<Index, Value>&); // not implemented void CookBoundaries(const Int_t node, Bool_t left); void UpdateNearestNeighbors(Index inode, const Value *point, Int_t kNN, Index *ind, Value *dist); void UpdateRange(Index inode, Value *point, Value range, std::vector<Index> &res); protected: Int_t fDataOwner; //! 0 - not owner, 2 - owner of the pointer array, 1 - owner of the whole 2-d array Int_t fNNodes; // size of node array Int_t fTotalNodes; // total number of nodes (fNNodes + terminal nodes) Index fNDim; // number of dimensions Index fNDimm; // dummy 2*fNDim Index fNPoints; // number of multidimensional points Index fBucketSize; // size of the terminal nodes UChar_t *fAxis; //[fNNodes] nodes cutting axis Value *fValue; //[fNNodes] nodes cutting value // Value *fRange; //[fNDimm] range of data for each dimension Value **fData; //! data points Value *fBoundaries;//! nodes boundaries Index *fIndPoints; //! array of points indexes Int_t fRowT0; //! smallest terminal row - first row that contains terminal nodes Int_t fCrossNode; //! cross node - node that begins the last row (with terminal nodes only) Int_t fOffset; //! offset in fIndPoints - if there are 2 rows, that contain terminal nodes // fOffset returns the index in the fIndPoints array of the first point // that belongs to the first node on the second row. ClassDef(TKDTree, 1) // KD tree }; typedef TKDTree<Int_t, Double_t> TKDTreeID; typedef TKDTree<Int_t, Float_t> TKDTreeIF; // Test functions: TKDTreeIF * TKDTreeTestBuild(); #endif
// // ______ _ _ _ _____ _____ _ __ // | ____| | | (_) | | / ____| __ \| |/ / // | |__ ___| |_ _ _ __ ___ ___ | |_ ___ | (___ | | | | ' / // | __| / __| __| | '_ ` _ \ / _ \| __/ _ \ \___ \| | | | < // | |____\__ \ |_| | | | | | | (_) | || __/ ____) | |__| | . \ // |______|___/\__|_|_| |_| |_|\___/ \__\___| |_____/|_____/|_|\_\ // // // Copyright (c) 2015 Estimote. All rights reserved. #import <Foundation/Foundation.h> #import "ESTEddystone.h" NS_ASSUME_NONNULL_BEGIN #define ESTIMOTE_EDDYSTONE_NAMESPACE_ID @"EDD1EBEAC04E5DEFA017" /** * ESTEddystoneUID represents Eddystone UID packet coming from `ESTEddystoneManager` class. */ @interface ESTEddystoneUID : ESTEddystone /** * Namespace ID required for device identification. * Value usually defined on the company level. */ @property (nonatomic, strong, readonly) NSString * _Nullable namespaceID; /** * Instance ID required for device identification. * Value defined per device. */ @property (nonatomic, strong, readonly) NSString * _Nullable instanceID; /** * Initialize Eddystone UUID object instance with Namespace ID only. * * @param namespaceID Eddystone Namespace ID. */ - (instancetype)initWithNamespaceID:(NSString *)namespaceID; /** * Initialize Eddystone UUID object instance with Namespace ID and Instance ID. * * @param namespaceID Eddystone Namespace ID. * @param instanceID Eddystone Instance ID. */ - (instancetype)initWithNamespaceID:(NSString *)namespaceID instanceID:(nullable NSString *)instanceID; @end NS_ASSUME_NONNULL_END
/* Implementation of the CHDIR intrinsic. Copyright (C) 2005 Free Software Foundation, Inc. Contributed by François-Xavier Coudert <coudert@clipper.ens.fr> This file is part of the GNU Fortran 95 runtime library (libgfortran). Libgfortran 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. In addition to the permissions in the GNU 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 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.) Libgfortran 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 libgfortran; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" #include "libgfortran.h" #include <errno.h> #ifdef HAVE_STRING_H #include <string.h> #endif #ifdef HAVE_UNISTD_H #include <unistd.h> #endif /* SUBROUTINE CHDIR(DIR, STATUS) CHARACTER(len=*), INTENT(IN) :: DIR INTEGER, INTENT(OUT), OPTIONAL :: STATUS */ #ifdef HAVE_CHDIR extern void chdir_i4_sub (char *, GFC_INTEGER_4 *, gfc_charlen_type); iexport_proto(chdir_i4_sub); void chdir_i4_sub (char *dir, GFC_INTEGER_4 *status, gfc_charlen_type dir_len) { int val; char *str; /* Trim trailing spaces from paths. */ while (dir_len > 0 && dir[dir_len - 1] == ' ') dir_len--; /* Make a null terminated copy of the strings. */ str = gfc_alloca (dir_len + 1); memcpy (str, dir, dir_len); str[dir_len] = '\0'; val = chdir (str); if (status != NULL) *status = (val == 0) ? 0 : errno; } iexport(chdir_i4_sub); extern void chdir_i8_sub (char *, GFC_INTEGER_8 *, gfc_charlen_type); iexport_proto(chdir_i8_sub); void chdir_i8_sub (char *dir, GFC_INTEGER_8 *status, gfc_charlen_type dir_len) { int val; char *str; /* Trim trailing spaces from paths. */ while (dir_len > 0 && dir[dir_len - 1] == ' ') dir_len--; /* Make a null terminated copy of the strings. */ str = gfc_alloca (dir_len + 1); memcpy (str, dir, dir_len); str[dir_len] = '\0'; val = chdir (str); if (status != NULL) *status = (val == 0) ? 0 : errno; } iexport(chdir_i8_sub); extern GFC_INTEGER_4 chdir_i4 (char *, gfc_charlen_type); export_proto(chdir_i4); GFC_INTEGER_4 chdir_i4 (char *dir, gfc_charlen_type dir_len) { GFC_INTEGER_4 val; chdir_i4_sub (dir, &val, dir_len); return val; } extern GFC_INTEGER_8 chdir_i8 (char *, gfc_charlen_type); export_proto(chdir_i8); GFC_INTEGER_8 chdir_i8 (char *dir, gfc_charlen_type dir_len) { GFC_INTEGER_8 val; chdir_i8_sub (dir, &val, dir_len); return val; } #endif
/* * This file is part of the coreboot project. * * Copyright (C) 2013 Google 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; version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc. */ #ifndef _BAYTRAIL_ROMSTAGE_H_ #define _BAYTRAIL_ROMSTAGE_H_ #if !defined(__PRE_RAM__) #error "Don't include romstage.h from a ramstage compilation unit!" #endif #include <stdint.h> #include <arch/cpu.h> #include <soc/mrc_wrapper.h> struct romstage_params { unsigned long bist; struct mrc_params *mrc_params; }; void mainboard_romstage_entry(struct romstage_params *params); void romstage_common(struct romstage_params *params); void * asmlinkage romstage_main(unsigned long bist, uint32_t tsc_lo, uint32_t tsc_high); void asmlinkage romstage_after_car(void); void raminit(struct mrc_params *mp, int prev_sleep_state); void gfx_init(void); void tco_disable(void); void punit_init(void); void set_max_freq(void); int early_spi_read_wpsr(u8 *sr); #if CONFIG_ENABLE_BUILTIN_COM1 void byt_config_com1_and_enable(void); #else static inline void byt_config_com1_and_enable(void) { } #endif #endif /* _BAYTRAIL_ROMSTAGE_H_ */
/* * Linux cfg80211 driver - Dongle Host Driver (DHD) related * * Copyright (C) 1999-2014, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you * under the terms of the GNU General Public License version 2 (the "GPL"), * available at http://www.broadcom.com/licenses/GPLv2.php, with the * following added to such license: * * As a special exception, the copyright holders of this software give you * permission to link this software with independent modules, and to copy and * distribute the resulting executable under terms of your choice, provided that * you also meet, for each linked independent module, the terms and conditions of * the license of that module. An independent module is a module which is not * derived from this software. The special exception does not apply to any * modifications of the software. * * Notwithstanding the above, under no circumstances may you combine this * software in any way with any other Broadcom software provided under a license * other than the GPL, without Broadcom's express prior written consent. * * $Id: wl_cfg80211.c,v 1.1.4.1.2.14 2011/02/09 01:40:07 Exp $ */ #ifndef __DHD_CFG80211__ #define __DHD_CFG80211__ #include <wl_cfg80211.h> #include <wl_cfgp2p.h> #ifndef WL_ERR #define WL_ERR CFG80211_ERR #endif #ifndef WL_TRACE #define WL_TRACE CFG80211_TRACE #endif s32 dhd_cfg80211_init(struct bcm_cfg80211 *cfg); s32 dhd_cfg80211_deinit(struct bcm_cfg80211 *cfg); s32 dhd_cfg80211_down(struct bcm_cfg80211 *cfg); s32 dhd_cfg80211_set_p2p_info(struct bcm_cfg80211 *cfg, int val); s32 dhd_cfg80211_clean_p2p_info(struct bcm_cfg80211 *cfg); s32 dhd_config_dongle(struct bcm_cfg80211 *cfg); #ifdef PCIE_FULL_DONGLE void wl_roam_flowring_cleanup(struct bcm_cfg80211 *cfg); #endif #endif /* __DHD_CFG80211__ */
/* * Copyright (c) 2012 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Obere Lagerstr. 30 * 82178 Puchheim * Germany * <rtems@embedded-brains.de> * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.org/license/LICENSE. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "tmacros.h" #include <sys/stat.h> #include <fcntl.h> #include <errno.h> #include <unistd.h> #include <stdio.h> #include <rtems/libio.h> #include <rtems/rtems-rfs-format.h> #include <rtems/ramdisk.h> const char rtems_test_name[] = "FSROFS 1"; static const rtems_rfs_format_config rfs_config; static const char rda [] = "/dev/rda"; static const char mnt [] = "/mnt"; static const char file [] = "/mnt/file"; static const char not_exist [] = "/mnt/not_exist"; static void test_mount(bool writeable) { int rv; const void *data = NULL; rv = mount( rda, mnt, RTEMS_FILESYSTEM_TYPE_RFS, writeable ? RTEMS_FILESYSTEM_READ_WRITE : 0, data ); rtems_test_assert(rv == 0); } static void test_create_file_system(void) { int rv; rv = mkdir(mnt, S_IRWXU | S_IRWXG | S_IRWXO); rtems_test_assert(rv == 0); rv = rtems_rfs_format(rda, &rfs_config); rtems_test_assert(rv == 0); test_mount(true); rv = mknod(file, S_IFREG | S_IRWXU | S_IRWXG | S_IRWXO, 0); rtems_test_assert(rv == 0); rv = unmount(mnt); rtems_test_assert(rv == 0); } static void test_rofs(void) { int rv; int fd; char buf [1]; ssize_t n; test_mount(false); fd = open(file, O_RDONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO); rtems_test_assert(fd >= 0); n = read(fd, buf, sizeof(buf)); rtems_test_assert(n == 0); errno = 0; n = write(fd, buf, sizeof(buf)); rtems_test_assert(n == -1); rtems_test_assert(errno == EBADF); errno = 0; rv = ftruncate(fd, 0); rtems_test_assert(rv == -1); rtems_test_assert(errno == EINVAL); errno = 0; rv = fchmod(fd, 0); rtems_test_assert(rv == -1); rtems_test_assert(errno == EROFS); errno = 0; rv = fchown(fd, 0, 0); rtems_test_assert(rv == -1); rtems_test_assert(errno == EROFS); rv = close(fd); rtems_test_assert(rv == 0); errno = 0; fd = open(not_exist, O_RDONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO); rtems_test_assert(fd == -1); rtems_test_assert(errno == EROFS); errno = 0; rv = mknod(not_exist, S_IFREG | S_IRWXU | S_IRWXG | S_IRWXO, 0); rtems_test_assert(rv == -1); rtems_test_assert(errno == EROFS); errno = 0; rv = mkdir(not_exist, S_IRWXU | S_IRWXG | S_IRWXO); rtems_test_assert(rv == -1); rtems_test_assert(errno == EROFS); errno = 0; rv = rename(file, not_exist); rtems_test_assert(rv == -1); rtems_test_assert(errno == EROFS); errno = 0; rv = link(file, not_exist); rtems_test_assert(rv == -1); rtems_test_assert(errno == EROFS); errno = 0; rv = unlink(file); rtems_test_assert(rv == -1); rtems_test_assert(errno == EROFS); errno = 0; rv = symlink(file, not_exist); rtems_test_assert(rv == -1); rtems_test_assert(errno == EROFS); rv = unmount(mnt); rtems_test_assert(rv == 0); } static void Init(rtems_task_argument arg) { TEST_BEGIN(): test_create_file_system(); test_rofs(); TEST_END(): rtems_test_exit(0); } rtems_ramdisk_config rtems_ramdisk_configuration [] = { { .block_size = 512, .block_num = 1024 } }; size_t rtems_ramdisk_configuration_size = 1; #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_EXTRA_DRIVERS RAMDISK_DRIVER_TABLE_ENTRY #define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 5 #define CONFIGURE_FILESYSTEM_RFS #define CONFIGURE_MAXIMUM_TASKS 2 #define CONFIGURE_EXTRA_TASK_STACKS (8 * 1024) #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE #define CONFIGURE_INIT #include <rtems/confdefs.h>
#ifndef __LINUX_NET_AFUNIX_H #define __LINUX_NET_AFUNIX_H #include <linux/socket.h> #include <linux/un.h> #include <linux/mutex.h> #include <net/sock.h> extern void unix_inflight(struct file *fp); extern void unix_notinflight(struct file *fp); extern void unix_gc(void); #define UNIX_HASH_SIZE 256 extern unsigned int unix_tot_inflight; struct unix_address { atomic_t refcnt; int len; unsigned hash; struct sockaddr_un name[0]; }; struct unix_skb_parms { struct ucred creds; /* Skb credentials */ struct scm_fp_list *fp; /* Passed files */ #ifdef CONFIG_SECURITY_NETWORK u32 secid; /* Security ID */ #endif }; #define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb)) #define UNIXCREDS(skb) (&UNIXCB((skb)).creds) #define UNIXSID(skb) (&UNIXCB((skb)).secid) #define unix_state_lock(s) spin_lock(&unix_sk(s)->lock) #define unix_state_unlock(s) spin_unlock(&unix_sk(s)->lock) #define unix_state_lock_nested(s) \ spin_lock_nested(&unix_sk(s)->lock, \ SINGLE_DEPTH_NESTING) #ifdef __KERNEL__ /* The AF_UNIX socket */ struct unix_sock { /* WARNING: sk has to be the first member */ struct sock sk; struct unix_address *addr; struct dentry *dentry; struct vfsmount *mnt; struct mutex readlock; struct sock *peer; struct sock *other; struct list_head link; atomic_t inflight; spinlock_t lock; unsigned int gc_candidate : 1; wait_queue_head_t peer_wait; }; #define unix_sk(__sk) ((struct unix_sock *)__sk) #ifdef CONFIG_SYSCTL extern int unix_sysctl_register(struct net *net); extern void unix_sysctl_unregister(struct net *net); #else static inline int unix_sysctl_register(struct net *net) { return 0; } static inline void unix_sysctl_unregister(struct net *net) {} #endif #endif #endif
#if defined(HEADER_WARNING_DUPLICATE) /* mips/csb350/rtems/score/cpu.h */ #warning "This header should not be included directly. (duplicate)" #endif #include <mips/csb350/rtems/score/cpu.h>
/* * Unix SMB/Netbios implementation. * SEC_DESC handling functions * Copyright (C) Andrew Tridgell 1992-1998, * Copyright (C) Jeremy R. Allison 1995-2003. * Copyright (C) Luke Kenneth Casson Leighton 1996-1998, * Copyright (C) Paul Ashton 1997-1998. * * 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/>. */ #ifndef _SECDESC_H_ #define _SECDESC_H_ /* The following definitions come from libcli/security/secdesc.c */ #include "librpc/gen_ndr/security.h" /******************************************************************* Given a security_descriptor return the sec_info. ********************************************************************/ uint32_t get_sec_info(const struct security_descriptor *sd); /******************************************************************* Merge part of security descriptor old_sec in to the empty sections of security descriptor new_sec. ********************************************************************/ struct sec_desc_buf *sec_desc_merge_buf(TALLOC_CTX *ctx, struct sec_desc_buf *new_sdb, struct sec_desc_buf *old_sdb); struct security_descriptor *sec_desc_merge(TALLOC_CTX *ctx, struct security_descriptor *new_sdb, struct security_descriptor *old_sdb); /******************************************************************* Creates a struct security_descriptor structure ********************************************************************/ struct security_descriptor *make_sec_desc(TALLOC_CTX *ctx, enum security_descriptor_revision revision, uint16_t type, const struct dom_sid *owner_sid, const struct dom_sid *grp_sid, struct security_acl *sacl, struct security_acl *dacl, size_t *sd_size); /******************************************************************* Convert a secdesc into a byte stream ********************************************************************/ NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx, const struct security_descriptor *secdesc, uint8_t **data, size_t *len); /******************************************************************* Convert a secdesc_buf into a byte stream ********************************************************************/ NTSTATUS marshall_sec_desc_buf(TALLOC_CTX *mem_ctx, const struct sec_desc_buf *secdesc_buf, uint8_t **data, size_t *len); /******************************************************************* Parse a byte stream into a secdesc ********************************************************************/ NTSTATUS unmarshall_sec_desc(TALLOC_CTX *mem_ctx, uint8_t *data, size_t len, struct security_descriptor **psecdesc); /******************************************************************* Parse a byte stream into a sec_desc_buf ********************************************************************/ NTSTATUS unmarshall_sec_desc_buf(TALLOC_CTX *mem_ctx, uint8_t *data, size_t len, struct sec_desc_buf **psecdesc_buf); /******************************************************************* Creates a struct security_descriptor structure with typical defaults. ********************************************************************/ struct security_descriptor *make_standard_sec_desc(TALLOC_CTX *ctx, const struct dom_sid *owner_sid, const struct dom_sid *grp_sid, struct security_acl *dacl, size_t *sd_size); /******************************************************************* Creates a struct sec_desc_buf structure. ********************************************************************/ struct sec_desc_buf *make_sec_desc_buf(TALLOC_CTX *ctx, size_t len, struct security_descriptor *sec_desc); /******************************************************************* Duplicates a struct sec_desc_buf structure. ********************************************************************/ struct sec_desc_buf *dup_sec_desc_buf(TALLOC_CTX *ctx, struct sec_desc_buf *src); /******************************************************************* Modify a SID's permissions in a struct security_descriptor. ********************************************************************/ NTSTATUS sec_desc_mod_sid(struct security_descriptor *sd, struct dom_sid *sid, uint32_t mask); bool sd_has_inheritable_components(const struct security_descriptor *parent_ctr, bool container); NTSTATUS se_create_child_secdesc(TALLOC_CTX *ctx, struct security_descriptor **ppsd, size_t *psize, const struct security_descriptor *parent_ctr, const struct dom_sid *owner_sid, const struct dom_sid *group_sid, bool container); NTSTATUS se_create_child_secdesc_buf(TALLOC_CTX *ctx, struct sec_desc_buf **ppsdb, const struct security_descriptor *parent_ctr, bool container); #endif /* _SECDESC_H_ */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #define fill_mask_width 32 #define fill_mask_height 32 #define fill_mask_x_hot 10 #define fill_mask_y_hot 22 static unsigned char fill_mask_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x80,0x03,0x00,0x00,0xdc,0x0f,0x00,0x00, 0xfe,0x1f,0x00,0x00,0xff,0x3f,0x00,0x00,0xff,0x7f,0x00,0x00,0xff,0xff,0x00, 0x00,0xe7,0xff,0x00,0x00,0xe7,0x7f,0x00,0x00,0xc7,0x3f,0x00,0x00,0x87,0x1f, 0x00,0x00,0x06,0x0f,0x00,0x00,0x06,0x06,0x00,0x00,0x04,0x00,0x00,0x00,0x04, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/** ****************************************************************************** * @file user_dynalib.h * @authors Matthew McGowan * @date 12 February 2015 ****************************************************************************** Copyright (c) 2015 Particle Industries, Inc. 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 3 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, see <http://www.gnu.org/licenses/>. ****************************************************************************** */ #ifndef USER_DYNALIB_H #define USER_DYNALIB_H #include "dynalib.h" DYNALIB_BEGIN(user) DYNALIB_FN(user, module_user_pre_init) DYNALIB_FN(user, module_user_init) DYNALIB_FN(user, module_user_setup) DYNALIB_FN(user, module_user_loop) DYNALIB_END(user) #endif /* USER_DYNALIB_H */
/****************************************************************/ /* DO NOT MODIFY THIS HEADER */ /* MOOSE - Multiphysics Object Oriented Simulation Environment */ /* */ /* (c) 2010 Battelle Energy Alliance, LLC */ /* ALL RIGHTS RESERVED */ /* */ /* Prepared by Battelle Energy Alliance, LLC */ /* Under Contract No. DE-AC07-05ID14517 */ /* With the U. S. Department of Energy */ /* */ /* See COPYRIGHT for full restrictions */ /****************************************************************/ #ifndef INTERNALSIDEUSEROBJECT_H #define INTERNALSIDEUSEROBJECT_H #include "UserObject.h" #include "BlockRestrictable.h" #include "NeighborCoupleable.h" #include "MaterialPropertyInterface.h" #include "MooseVariableDependencyInterface.h" #include "UserObjectInterface.h" #include "TransientInterface.h" #include "PostprocessorInterface.h" #include "ZeroInterface.h" class InternalSideUserObject; template<> InputParameters validParams<InternalSideUserObject>(); /** * */ class InternalSideUserObject : public UserObject, public BlockRestrictable, public MaterialPropertyInterface, public NeighborCoupleable, public MooseVariableDependencyInterface, public UserObjectInterface, public TransientInterface, public PostprocessorInterface, public ZeroInterface { public: InternalSideUserObject(const std::string & name, InputParameters parameters); virtual ~InternalSideUserObject(); /** * This function will get called on each geometric object this postprocessor acts on * (ie Elements, Sides or Nodes). This will most likely get called multiple times * before getValue() is called. * * Someone somewhere has to override this. */ virtual void execute() = 0; /** * Must override. * * @param uo The UserObject to be joined into _this_ object. Take the data from the uo object and "add" it into the data for this object. */ virtual void threadJoin(const UserObject & uo) = 0; protected: MooseMesh & _mesh; const MooseArray<Point> & _q_point; QBase * & _qrule; const MooseArray<Real> & _JxW; const MooseArray<Real> & _coord; const MooseArray<Point> & _normals; const Elem * & _current_elem; /// current side of the current element unsigned int & _current_side; const Elem * & _current_side_elem; const Real & _current_side_volume; /// The neighboring element const Elem * & _neighbor_elem; /// The volume (or length) of the current neighbor const Real & _neighbor_elem_volume; }; #endif /* INTERNALSIDEUSEROBJECT_H */
// RUN: %clang_cc1 -triple=x86_64-apple-darwin -fsyntax-only -verify %s typedef long long __m128i __attribute__((__vector_size__(16))); typedef float __m128 __attribute__((__vector_size__(16))); typedef double __m128d __attribute__((__vector_size__(16))); typedef float __m512 __attribute__((__vector_size__(64))); typedef double __m512d __attribute__((__vector_size__(64))); typedef unsigned char __mmask8; typedef unsigned short __mmask16; __m128 test__builtin_ia32_cmpps(__m128 __a, __m128 __b) { __builtin_ia32_cmpps(__a, __b, 32); // expected-error {{argument should be a value from 0 to 31}} } __m128d test__builtin_ia32_cmppd(__m128d __a, __m128d __b) { __builtin_ia32_cmppd(__a, __b, 32); // expected-error {{argument should be a value from 0 to 31}} } __m128 test__builtin_ia32_cmpss(__m128 __a, __m128 __b) { __builtin_ia32_cmpss(__a, __b, 32); // expected-error {{argument should be a value from 0 to 31}} } __m128d test__builtin_ia32_cmpsd(__m128d __a, __m128d __b) { __builtin_ia32_cmpsd(__a, __b, 32); // expected-error {{argument should be a value from 0 to 31}} } __mmask16 test__builtin_ia32_cmpps512_mask(__m512d __a, __m512d __b) { __builtin_ia32_cmpps512_mask(__a, __b, 32, -1, 0); // expected-error {{argument should be a value from 0 to 31}} } __mmask8 test__builtin_ia32_cmppd512_mask(__m512d __a, __m512d __b) { __builtin_ia32_cmppd512_mask(__a, __b, 32, -1, 0); // expected-error {{argument should be a value from 0 to 31}} } __m128i test__builtin_ia32_vpcomub(__m128i __a, __m128i __b) { __builtin_ia32_vpcomub(__a, __b, 8); // expected-error {{argument should be a value from 0 to 7}} } __m128i test__builtin_ia32_vpcomuw(__m128i __a, __m128i __b) { __builtin_ia32_vpcomuw(__a, __b, 8); // expected-error {{argument should be a value from 0 to 7}} } __m128i test__builtin_ia32_vpcomud(__m128i __a, __m128i __b) { __builtin_ia32_vpcomud(__a, __b, 8); // expected-error {{argument should be a value from 0 to 7}} } __m128i test__builtin_ia32_vpcomuq(__m128i __a, __m128i __b) { __builtin_ia32_vpcomuq(__a, __b, 8); // expected-error {{argument should be a value from 0 to 7}} } __m128i test__builtin_ia32_vpcomb(__m128i __a, __m128i __b) { __builtin_ia32_vpcomub(__a, __b, 8); // expected-error {{argument should be a value from 0 to 7}} } __m128i test__builtin_ia32_vpcomw(__m128i __a, __m128i __b) { __builtin_ia32_vpcomuw(__a, __b, 8); // expected-error {{argument should be a value from 0 to 7}} } __m128i test__builtin_ia32_vpcomd(__m128i __a, __m128i __b) { __builtin_ia32_vpcomud(__a, __b, 8); // expected-error {{argument should be a value from 0 to 7}} } __m128i test__builtin_ia32_vpcomq(__m128i __a, __m128i __b) { __builtin_ia32_vpcomuq(__a, __b, 8); // expected-error {{argument should be a value from 0 to 7}} }
#ifndef HEADER_CURL_POLARSSL_H #define HEADER_CURL_POLARSSL_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 2010, Hoi-Ho Chan, <hoiho.chan@gmail.com> * * 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 http://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. * * $Id: polarssl.h,v 1.10 2009-02-12 20:48:43 danf Exp $ ***************************************************************************/ #ifdef USE_POLARSSL CURLcode Curl_polarssl_connect(struct connectdata *conn, int sockindex); /* tell PolarSSL to close down all open information regarding connections (and thus session ID caching etc) */ void Curl_polarssl_close_all(struct SessionHandle *data); /* close a SSL connection */ void Curl_polarssl_close(struct connectdata *conn, int sockindex); void Curl_polarssl_session_free(void *ptr); size_t Curl_polarssl_version(char *buffer, size_t size); int Curl_polarssl_shutdown(struct connectdata *conn, int sockindex); /* API setup for PolarSSL */ #define curlssl_init() (1) #define curlssl_cleanup() #define curlssl_connect Curl_polarssl_connect #define curlssl_session_free(x) Curl_polarssl_session_free(x) #define curlssl_close_all Curl_polarssl_close_all #define curlssl_close Curl_polarssl_close #define curlssl_shutdown(x,y) 0 #define curlssl_set_engine(x,y) (x=x, y=y, CURLE_FAILED_INIT) #define curlssl_set_engine_default(x) (x=x, CURLE_FAILED_INIT) #define curlssl_engines_list(x) (x=x, (struct curl_slist *)NULL) #define curlssl_version Curl_polarssl_version #define curlssl_check_cxn(x) (x=x, -1) #define curlssl_data_pending(x,y) (x=x, y=y, 0) #endif /* USE_POLARSSL */ #endif /* HEADER_CURL_POLARSSL_H */