text
stringlengths
4
6.14k
#ifndef TYPES_H_ #define TYPES_H_ #include <stdint.h> #pragma pack(push) #pragma pack (1) /* Alinear las siguiente estructuras a 1 byte */ /* Descriptor de segmento */ // typedef struct { // word limit, // base_l; // byte base_m, // access, // attribs, // base_h; // } DESCR_SEG; /* Descriptor de interrupcion */ typedef struct { uint16_t offset_l; uint16_t selector; uint8_t zero1; uint8_t access; uint16_t offset_m; uint32_t offset_h; uint32_t zero2; } DESCR_INT; /* IDTR */ typedef struct { uint16_t limit; uint64_t base; } IDTR; #pragma pack(pop) #endif /* TYPES_H_ */
// // RHHorizontalSwipeViewController.h // RHHorizontalSwipe // // Created by Richard Heard on 24/01/12. // Copyright (c) 2012 Richard Heard. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // 3. The name of the author may not be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // /* vc takes an array of view controllers, forwards events to said controllers for rotation and adds them to its views subview scrollview also shows / hides the custom page indicator titles / buttons etc (collectively, overlay views) Uses iOS5 View Controller containment so as to be a good citizen. */ #import <UIKit/UIKit.h> #import "RHHorizontalSwipeView.h" #import "RHHorizontalSwipeViewControllerProtocols.h" @interface RHHorizontalSwipeViewController : UIViewController <RHHorizontalSwipeViewDelegate, UINavigationControllerDelegate> @property (readonly, nonatomic) RHHorizontalSwipeView *layoutScrollView; @property (retain, nonatomic) NSArray *orderedViewControllers; @property (readonly, nonatomic) UIViewController *currentViewController; @property (assign, nonatomic) NSUInteger currentIndex; -(void)setCurrentIndex:(NSUInteger)currentIndex animated:(BOOL)animated; -(void)swipeLeftAnimated:(BOOL)animated; //index++ -(void)swipeRightAnimated:(BOOL)animated; //index-- @property (assign, nonatomic, getter=isLocked) BOOL locked; //prevent swiping between view controllers @property (assign, nonatomic, getter=isAutoLockingEnabled) BOOL autoLockingEnabled; // if any top level nav controllers are not displaying their root view, locked, otherwise unlocked. (sets each nav controllers delegate if nil) //overlay views, regular views installed statically over the scrollview, if they implement the RHHorizontalSwipeViewControllerOverlayViewProtocol, will be updated with current index position etc -(void)addOverlayView:(UIView <RHHorizontalSwipeViewControllerOverlayViewProtocol> *)view; -(void)removeOverlayView:(UIView <RHHorizontalSwipeViewControllerOverlayViewProtocol> *)view; //status subscribers, subscribers are retained by the controller -(void)subscribeToStatusUpdates:(id <RHHorizontalSwipeViewControllerStatusUpdateProtocol>)subscriber; -(void)unsubscribeFromStatusUpdates:(id <RHHorizontalSwipeViewControllerStatusUpdateProtocol>)subscriber; -(void)setOverlayViewsHidden:(BOOL)hidden animated:(BOOL)animated; //hide overlay views, eg for when drilled down etc @property (assign, nonatomic, getter=isAutoHidingEnabled) BOOL autoHidingEnabled; // if any nav controllers are not showing root view, overlay views are hidden, otherwise not hidden @end
// // MoreViewController.h // zzuMap // // Created by 李鹏飞 on 14/10/22. // Copyright (c) 2014年 zzu. All rights reserved. // #import <UIKit/UIKit.h> @interface MoreViewController : UIViewController<UITableViewDelegate,UITableViewDataSource> { NSMutableArray *dataArray; NSMutableArray *section2Array; } @property(nonatomic,retain)UITableView *tableView; @end
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE129_large_18.c Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE129.label.xml Template File: sources-sinks-18.tmpl.c */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: large Large index value that is greater than 10-1 * GoodSource: Larger than zero but less than 10 * Sinks: * GoodSink: Ensure the array index is valid * BadSink : Improperly check the array index by not checking the upper bound * Flow Variant: 18 Control flow: goto statements * * */ #include "std_testcase.h" #ifndef OMITBAD void CWE122_Heap_Based_Buffer_Overflow__c_CWE129_large_18_bad() { int data; /* Initialize data */ data = -1; goto source; source: /* POTENTIAL FLAW: Use an invalid index */ data = 10; goto sink; sink: { int i; int * buffer = (int *)malloc(10 * sizeof(int)); if (buffer == NULL) {exit(-1);} /* initialize buffer */ for (i = 0; i < 10; i++) { buffer[i] = 0; } /* POTENTIAL FLAW: Attempt to write to an index of the array that is above the upper bound * This code does check to see if the array index is negative */ if (data >= 0) { buffer[data] = 1; /* Print the array values */ for(i = 0; i < 10; i++) { printIntLine(buffer[i]); } } else { printLine("ERROR: Array index is negative."); } free(buffer); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodB2G() - use badsource and goodsink by reversing the blocks on the second goto statement */ static void goodB2G() { int data; /* Initialize data */ data = -1; goto source; source: /* POTENTIAL FLAW: Use an invalid index */ data = 10; goto sink; sink: { int i; int * buffer = (int *)malloc(10 * sizeof(int)); if (buffer == NULL) {exit(-1);} /* initialize buffer */ for (i = 0; i < 10; i++) { buffer[i] = 0; } /* FIX: Properly validate the array index and prevent a buffer overflow */ if (data >= 0 && data < (10)) { buffer[data] = 1; /* Print the array values */ for(i = 0; i < 10; i++) { printIntLine(buffer[i]); } } else { printLine("ERROR: Array index is out-of-bounds"); } free(buffer); } } /* goodG2B() - use goodsource and badsink by reversing the blocks on the first goto statement */ static void goodG2B() { int data; /* Initialize data */ data = -1; goto source; source: /* FIX: Use a value greater than 0, but less than 10 to avoid attempting to * access an index of the array in the sink that is out-of-bounds */ data = 7; goto sink; sink: { int i; int * buffer = (int *)malloc(10 * sizeof(int)); if (buffer == NULL) {exit(-1);} /* initialize buffer */ for (i = 0; i < 10; i++) { buffer[i] = 0; } /* POTENTIAL FLAW: Attempt to write to an index of the array that is above the upper bound * This code does check to see if the array index is negative */ if (data >= 0) { buffer[data] = 1; /* Print the array values */ for(i = 0; i < 10; i++) { printIntLine(buffer[i]); } } else { printLine("ERROR: Array index is negative."); } free(buffer); } } void CWE122_Heap_Based_Buffer_Overflow__c_CWE129_large_18_good() { goodB2G(); goodG2B(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE122_Heap_Based_Buffer_Overflow__c_CWE129_large_18_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE122_Heap_Based_Buffer_Overflow__c_CWE129_large_18_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__char_console_system_05.c Label Definition File: CWE78_OS_Command_Injection.one_string.label.xml Template File: sources-sink-05.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: console Read input from the console * GoodSource: Fixed string * Sink: system * BadSink : Execute command in data using system() * Flow Variant: 05 Control flow: if(staticTrue) and if(staticFalse) * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define FULL_COMMAND "dir " #else #include <unistd.h> #define FULL_COMMAND "ls " #endif #ifdef _WIN32 #define SYSTEM system #else /* NOT _WIN32 */ #define SYSTEM system #endif /* The two variables below are not defined as "const", but are never * assigned any other value, so a tool should be able to identify that * reads of these will always return their initialized values. */ static int staticTrue = 1; /* true */ static int staticFalse = 0; /* false */ #ifndef OMITBAD void CWE78_OS_Command_Injection__char_console_system_05_bad() { char * data; char data_buf[100] = FULL_COMMAND; data = data_buf; if(staticTrue) { { /* Read input from the console */ size_t dataLen = strlen(data); /* if there is room in data, read into it from the console */ if (100-dataLen > 1) { /* POTENTIAL FLAW: Read data from the console */ if (fgets(data+dataLen, (int)(100-dataLen), stdin) != NULL) { /* The next few lines remove the carriage return from the string that is * inserted by fgets() */ dataLen = strlen(data); if (dataLen > 0 && data[dataLen-1] == '\n') { data[dataLen-1] = '\0'; } } else { printLine("fgets() failed"); /* Restore NUL terminator if fgets fails */ data[dataLen] = '\0'; } } } } /* POTENTIAL FLAW: Execute command in data possibly leading to command injection */ if (SYSTEM(data) != 0) { printLine("command execution failed!"); exit(1); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B1() - use goodsource and badsink by changing the staticTrue to staticFalse */ static void goodG2B1() { char * data; char data_buf[100] = FULL_COMMAND; data = data_buf; if(staticFalse) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Append a fixed string to data (not user / external input) */ strcat(data, "*.*"); } /* POTENTIAL FLAW: Execute command in data possibly leading to command injection */ if (SYSTEM(data) != 0) { printLine("command execution failed!"); exit(1); } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */ static void goodG2B2() { char * data; char data_buf[100] = FULL_COMMAND; data = data_buf; if(staticTrue) { /* FIX: Append a fixed string to data (not user / external input) */ strcat(data, "*.*"); } /* POTENTIAL FLAW: Execute command in data possibly leading to command injection */ if (SYSTEM(data) != 0) { printLine("command execution failed!"); exit(1); } } void CWE78_OS_Command_Injection__char_console_system_05_good() { goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE78_OS_Command_Injection__char_console_system_05_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE78_OS_Command_Injection__char_console_system_05_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/* * ChunkReader.h * ------------- * Purpose: An extended FileReader to read Iff-like chunk-based file structures. * Notes : (currently none) * Authors: OpenMPT Devs * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. */ #pragma once #include "FileReader.h" #include <vector> //=================================== class ChunkReader : public FileReader //=================================== { public: ChunkReader(const char *data, size_t length) : FileReader(data, length) { } ChunkReader(const FileReader &other) : FileReader(other) { } template<typename T> //================= class ChunkListItem //================= { private: T chunkHeader; FileReader chunkData; public: ChunkListItem(const T &header, const FileReader &data) : chunkHeader(header), chunkData(data) { } ChunkListItem<T> &operator= (const ChunkListItem<T> &other) { chunkHeader = other.chunkHeader; chunkData = other.chunkData; return *this; } const T &GetHeader() const { return chunkHeader; } const FileReader &GetData() const { return chunkData; } }; template<typename T> //===================================================== class ChunkList : public std::vector<ChunkListItem<T> > //===================================================== { public: // Check if the list contains a given chunk. bool ChunkExists(typename T::id_type id) const { for(typename std::vector<ChunkListItem<T> >::const_iterator iter = this->begin(); iter != this->end(); iter++) { if(iter->GetHeader().GetID() == id) { return true; } } return false; } // Retrieve the first chunk with a given ID. FileReader GetChunk(typename T::id_type id) const { for(typename std::vector<ChunkListItem<T> >::const_iterator iter = this->begin(); iter != this->end(); iter++) { if(iter->GetHeader().GetID() == id) { return iter->GetData(); } } return FileReader(); } // Retrieve all chunks with a given ID. std::vector<FileReader> GetAllChunks(typename T::id_type id) const { std::vector<FileReader> result; for(typename std::vector<ChunkListItem<T> >::const_iterator iter = this->begin(); iter != this->end(); iter++) { if(iter->GetHeader().GetID() == id) { result.push_back(iter->GetData()); } } return result; } }; // Read a series of "T" chunks until the end of file is reached. // T is required to have the methods GetID() and GetLength(), as well as an id_type typedef. // GetLength() should return the chunk size in bytes, and GetID() the chunk ID. // id_type must reflect the type that is returned by GetID(). template<typename T> ChunkList<T> ReadChunks(size_t padding) { ChunkList<T> result; while(AreBytesLeft()) { T chunkHeader; if(!Read(chunkHeader)) { break; } size_t dataSize = chunkHeader.GetLength(); ChunkListItem<T> resultItem(chunkHeader, GetChunk(dataSize)); result.push_back(resultItem); // Skip padding bytes if(padding != 0 && dataSize % padding != 0) { Skip(padding - (dataSize % padding)); } } return result; } };
/**************************************************************************************** Copyright (C) 2015 Autodesk, Inc. All rights reserved. Use of this software is subject to the terms of the Autodesk license agreement provided at the time of installation or download, or which otherwise accompanies this software in either electronic or hard copy form. ****************************************************************************************/ //! \file fbxfiletexture.h #ifndef _FBXSDK_SCENE_SHADING_TEXTURE_FILE_H_ #define _FBXSDK_SCENE_SHADING_TEXTURE_FILE_H_ #include <fbxsdk/fbxsdk_def.h> #include <fbxsdk/scene/shading/fbxtexture.h> #include <fbxsdk/fbxsdk_nsbegin.h> /** This class describes image mapping on top of geometry. * \note To apply a texture to geometry, first connect the * geometry to a FbxSurfaceMaterial object (e.g. FbxSurfaceLambert) * and then connect one of its properties (e.g. Diffuse) to the * FbxFileTexture object. * \see FbxSurfaceLambert * \see FbxSurfacePhong * \see FbxSurfaceMaterial * \note For some example code, see also the CreateTexture() function * in the ExportScene03 of FBX SDK examples. * \nosubgrouping */ class FBXSDK_DLL FbxFileTexture : public FbxTexture { FBXSDK_OBJECT_DECLARE(FbxFileTexture, FbxTexture); public: /** * \name Texture Properties */ //@{ /** This property handles the material use. * Default value is false. */ FbxPropertyT<FbxBool> UseMaterial; /** This property handles the Mipmap use. * Default value is false. */ FbxPropertyT<FbxBool> UseMipMap; /** Resets the default texture values. * \remarks The texture file name is not reset. */ void Reset(); /** Sets the associated texture file. * \param pName The absolute path of the texture file. * \return \c True if successful, returns \c false otherwise. * \remarks The texture file name must be valid, you cannot leave the name empty. */ bool SetFileName(const char* pName); /** Sets the associated texture file. * \param pName The relative path of the texture file. * \return \c True if successful, returns \c false otherwise. * \remarks The texture file name must be valid. */ bool SetRelativeFileName(const char* pName); /** Returns the absolute texture file path. * \return The absolute texture file path. * \remarks An empty string is returned if FbxFileTexture::SetFileName() has not been called before. */ const char* GetFileName() const; /** Returns the relative texture file path. * \return The relative texture file path. * \remarks An empty string is returned if FbxFileTexture::SetRelativeFileName() has not been called before. */ const char* GetRelativeFileName() const; /** \enum EMaterialUse Specify if texture uses model material. */ enum EMaterialUse { eModelMaterial, //! Texture uses model material. eDefaultMaterial //! Texture does not use model material. }; /** Sets the material use. * \param pMaterialUse Specify how texture uses model material. */ void SetMaterialUse(EMaterialUse pMaterialUse); /** Returns the material use. * \return How the texture uses model material. */ EMaterialUse GetMaterialUse() const; //@} /***************************************************************************************************************************** ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! ** *****************************************************************************************************************************/ #ifndef DOXYGEN_SHOULD_SKIP_THIS virtual FbxObject& Copy(const FbxObject& pObject); bool operator==(FbxFileTexture const& pTexture) const; FbxString& GetMediaName(); void SetMediaName(const char* pMediaName); protected: virtual void Construct(const FbxObject* pFrom); virtual void ConstructProperties(bool pForceSet); void Init(); void SyncVideoFileName(const char* pFileName); void SyncVideoRelativeFileName(const char* pFileName); FbxString mFileName; FbxString mRelativeFileName; FbxString mMediaName; // not a prop #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ }; #include <fbxsdk/fbxsdk_nsend.h> #endif /* _FBXSDK_SCENE_SHADING_TEXTURE_FILE_H_ */
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef ASH_METRICS_DEMO_SESSION_METRICS_RECORDER_H_ #define ASH_METRICS_DEMO_SESSION_METRICS_RECORDER_H_ #include <memory> #include <string> #include <vector> #include "ash/ash_export.h" #include "ash/constants/app_types.h" #include "base/containers/flat_set.h" #include "base/macros.h" #include "base/scoped_observation.h" #include "ui/aura/window_observer.h" #include "ui/base/user_activity/user_activity_detector.h" #include "ui/base/user_activity/user_activity_observer.h" #include "ui/wm/public/activation_change_observer.h" #include "ui/wm/public/activation_client.h" namespace base { class RepeatingTimer; } // namespace base namespace ash { // A metrics recorder for demo sessions that samples the active window's app or // window type. Only used when the device is in Demo Mode. class ASH_EXPORT DemoSessionMetricsRecorder : public ui::UserActivityObserver, public wm::ActivationChangeObserver { public: // These apps are preinstalled in Demo Mode. This list is not exhaustive, and // includes first- and third-party Chrome and ARC apps. // // These values are persisted to logs. Entries should not be renumbered and // numeric values should never be reused. enum class DemoModeApp { kBrowser = 0, kOtherChromeApp = 1, kOtherArcApp = 2, kOtherWindow = 3, kHighlights = 4, // Auto-launched Demo Mode app highlighting CrOS features. kAsphalt8 = 5, // Android racing game demo app. kCamera = 6, kFiles = 7, kGetHelp = 8, kGoogleKeepChromeApp = 9, kGooglePhotos = 10, kGoogleSheetsAndroidApp = 11, kGoogleSlidesAndroidApp = 12, kInfinitePainter = 13, // Android painting app. kMyScriptNebo = 14, // Android note-taking app. kPlayStore = 15, kSquid = 16, // Android note-taking app. kWebStore = 17, kYouTube = 18, kScreensaver = 19, // Demo Mode screensaver app. kAsphalt9 = 20, // Android racing game demo app. kStardewValley = 21, // Android farming game demo app. kKinemaster = 22, // Android video editing software demo app. nocheck kGoogleKeepAndroidApp = 23, kAutoCAD = 24, // Android 2D/3D drawing software demo app. kPixlr = 25, // Android photo editing software demo app. kCalculator = 26, // Essential apps calculator. kCalendar = 27, kGoogleDocsChromeApp = 28, kGoogleSheetsChromeApp = 29, kGoogleSlidesChromeApp = 30, kYoutubePwa = 31, kGoogleDocsPwa = 32, kGoogleMeetPwa = 33, kGoogleSheetsPwa = 34, kSpotify = 35, kBeFunky = 36, kClipchamp = 37, kGeForceNow = 38, kZoom = 39, // Add future entries above this comment, in sync with enums.xml. // Update kMaxValue to the last value. kMaxValue = kZoom, }; // The recorder will create a normal timer by default. Tests should provide a // mock timer to control sampling periods. explicit DemoSessionMetricsRecorder( std::unique_ptr<base::RepeatingTimer> timer = nullptr); DemoSessionMetricsRecorder(const DemoSessionMetricsRecorder&) = delete; DemoSessionMetricsRecorder& operator=(const DemoSessionMetricsRecorder&) = delete; ~DemoSessionMetricsRecorder() override; // ui::UserActivityObserver: void OnUserActivity(const ui::Event* event) override; // wm::ActivationChangeObserver: void OnWindowActivated(wm::ActivationChangeObserver::ActivationReason reason, aura::Window* gained_active, aura::Window* lost_active) override; private: // Starts the timer for periodic sampling. void StartRecording(); // Records the active window's app type or, if the user has been inactive for // too long, pauses sampling and wipes samples from the inactive period. void TakeSampleOrPause(); // Emits histograms for recorded samples. void ReportSamples(); // Records |app| as being seen while sampling all active apps. void RecordActiveAppSample(DemoModeApp app); // Indicates whether the specified app_id should be recorded for // the unique-apps-launched stat. bool ShouldRecordAppLaunch(const std::string& app_id); // Records the specified app's launch, subject to the // restrictions of ShouldRecordAppLaunch(). void RecordAppLaunch(const std::string& id, AppType app_type); // Emits various histograms for unique apps launched. void ReportUniqueAppsLaunched(); // Records the duration of time the user spent interacting with the current // demo session, measured from first user activity to last user activity. void ReportDwellTime(); // Stores samples as they are collected. Report to UMA if we see user // activity soon after. Guaranteed not to grow too large. std::vector<DemoModeApp> unreported_samples_; // Indicates whether the unique-app-launch stats recording has been enabled. bool unique_apps_launched_recording_enabled_ = false; // Tracks the ids of apps that have been launched in Demo Mode. base::flat_set<std::string> unique_apps_launched_; // Used for subscribing to window activation events. wm::ActivationClient* activation_client_ = nullptr; // How many periods have elapsed since the last user activity. int periods_since_activity_ = 0; base::TimeTicks first_user_activity_; base::TimeTicks last_user_activity_; std::unique_ptr<base::RepeatingTimer> timer_; base::ScopedObservation<ui::UserActivityDetector, ui::UserActivityObserver> observation_{this}; class ActiveAppArcPackageNameObserver; class UniqueAppsLaunchedArcPackageNameObserver; std::unique_ptr<UniqueAppsLaunchedArcPackageNameObserver> unique_apps_arc_package_name_observer_; std::unique_ptr<ActiveAppArcPackageNameObserver> active_app_arc_package_name_observer_; }; } // namespace ash #endif // ASH_METRICS_DEMO_SESSION_METRICS_RECORDER_H_
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROMEOS_NETWORK_MOCK_NETWORK_DEVICE_HANDLER_H_ #define CHROMEOS_NETWORK_MOCK_NETWORK_DEVICE_HANDLER_H_ #include <string> #include <vector> #include "base/callback.h" #include "base/component_export.h" #include "base/values.h" #include "chromeos/network/network_device_handler.h" #include "chromeos/network/network_handler_callbacks.h" #include "net/base/ip_endpoint.h" #include "testing/gmock/include/gmock/gmock.h" namespace chromeos { class COMPONENT_EXPORT(CHROMEOS_NETWORK) MockNetworkDeviceHandler : public NetworkDeviceHandler { public: MockNetworkDeviceHandler(); MockNetworkDeviceHandler(const MockNetworkDeviceHandler&) = delete; MockNetworkDeviceHandler& operator=(const MockNetworkDeviceHandler&) = delete; virtual ~MockNetworkDeviceHandler(); MOCK_CONST_METHOD2(GetDeviceProperties, void(const std::string& device_path, network_handler::ResultCallback callback)); MOCK_METHOD5(SetDeviceProperty, void(const std::string& device_path, const std::string& property_name, const base::Value& value, base::OnceClosure callback, network_handler::ErrorCallback error_callback)); MOCK_METHOD4(RegisterCellularNetwork, void(const std::string& device_path, const std::string& network_id, base::OnceClosure callback, network_handler::ErrorCallback error_callback)); MOCK_METHOD5(RequirePin, void(const std::string& device_path, bool require_pin, const std::string& pin, base::OnceClosure callback, network_handler::ErrorCallback error_callback)); MOCK_METHOD4(EnterPin, void(const std::string& device_path, const std::string& pin, base::OnceClosure callback, network_handler::ErrorCallback error_callback)); MOCK_METHOD5(UnblockPin, void(const std::string& device_path, const std::string& puk, const std::string& new_pin, base::OnceClosure callback, network_handler::ErrorCallback error_callback)); MOCK_METHOD5(ChangePin, void(const std::string& device_path, const std::string& old_pin, const std::string& new_pin, base::OnceClosure callback, network_handler::ErrorCallback error_callback)); MOCK_METHOD2(SetCellularAllowRoaming, void(bool allow_roaming, bool policy_allow_roaming)); MOCK_METHOD1(SetMACAddressRandomizationEnabled, void(bool enabled)); MOCK_METHOD1(SetUsbEthernetMacAddressSource, void(const std::string& enabled)); }; } // namespace chromeos #endif // CHROMEOS_NETWORK_MOCK_NETWORK_DEVICE_HANDLER_H_
// Copyright (c) 2009-2021 The Regents of the University of Michigan // This file is part of the HOOMD-blue project, released under the BSD 3-Clause License. // Maintainer: dnlebard #include "hoomd/BondedGroupData.h" #include "hoomd/ForceCompute.h" #include <memory> #include <vector> /*! \file HarmonicAngleForceCompute.h \brief Declares a class for computing harmonic angles */ #ifdef __HIPCC__ #error This header cannot be compiled by nvcc #endif #include <pybind11/pybind11.h> #ifndef __HARMONICANGLEFORCECOMPUTE_H__ #define __HARMONICANGLEFORCECOMPUTE_H__ struct angle_harmonic_params { Scalar k; Scalar t_0; #ifndef __HIPCC__ angle_harmonic_params() : k(0), t_0(0) { } angle_harmonic_params(pybind11::dict params) : k(params["k"].cast<Scalar>()), t_0(params["t0"].cast<Scalar>()) { } pybind11::dict asDict() { pybind11::dict v; v["k"] = k; v["t0"] = t_0; return v; } #endif } #ifdef SINGLE_PRECISION __attribute__((aligned(8))); #else __attribute__((aligned(16))); #endif //! Computes harmonic angle forces on each particle /*! Harmonic angle forces are computed on every particle in the simulation. The angles which forces are computed on are accessed from ParticleData::getAngleData \ingroup computes */ class PYBIND11_EXPORT HarmonicAngleForceCompute : public ForceCompute { public: //! Constructs the compute HarmonicAngleForceCompute(std::shared_ptr<SystemDefinition> sysdef); //! Destructor virtual ~HarmonicAngleForceCompute(); //! Set the parameters virtual void setParams(unsigned int type, Scalar K, Scalar t_0); virtual void setParamsPython(std::string type, pybind11::dict params); /// Get the parameters for a type pybind11::dict getParams(std::string type); #ifdef ENABLE_MPI //! Get ghost particle fields requested by this pair potential /*! \param timestep Current time step */ virtual CommFlags getRequestedCommFlags(uint64_t timestep) { CommFlags flags = CommFlags(0); flags[comm_flag::tag] = 1; flags |= ForceCompute::getRequestedCommFlags(timestep); return flags; } #endif protected: Scalar* m_K; //!< K parameter for multiple angle tyes Scalar* m_t_0; //!< r_0 parameter for multiple angle types std::shared_ptr<AngleData> m_angle_data; //!< Angle data to use in computing angles //! Actually compute the forces virtual void computeForces(uint64_t timestep); }; //! Exports the AngleForceCompute class to python void export_HarmonicAngleForceCompute(pybind11::module& m); #endif
/*********************************************************************************************************************** ** ** Copyright (c) 2011, 2014 ETH Zurich ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ** following conditions are met: ** ** * Redistributions of source code must retain the above copyright notice, this list of conditions and the ** following disclaimer. ** * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the ** following disclaimer in the documentation and/or other materials provided with the distribution. ** * Neither the name of the ETH Zurich 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. ** **********************************************************************************************************************/ #pragma once #include "../modelbase_api.h" #include "Core/src/InitializationRegistry.h" namespace TestNodes { MODELBASE_API Core::InitializationRegistry& nodeTypeInitializationRegistry(); } /* namespace TestNodes */
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_ANDROID_NET_NQE_NETWORK_QUALITY_PROVIDER_H_ #define CHROME_BROWSER_ANDROID_NET_NQE_NETWORK_QUALITY_PROVIDER_H_ #include "base/android/scoped_java_ref.h" #include "base/macros.h" #include "base/threading/thread_checker.h" #include "base/time/time.h" #include "net/nqe/effective_connection_type.h" #include "net/nqe/network_quality.h" #include "services/network/public/cpp/network_quality_tracker.h" // The native instance of the NetworkQualityProvider. This class is not // threadsafe and must only be used on the UI thread. class NetworkQualityProvider : public network::NetworkQualityTracker::EffectiveConnectionTypeObserver, public network::NetworkQualityTracker::RTTAndThroughputEstimatesObserver { public: NetworkQualityProvider(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); NetworkQualityProvider(const NetworkQualityProvider&) = delete; NetworkQualityProvider& operator=(const NetworkQualityProvider&) = delete; private: // Note that this destructor is currently dead code. This destructor is never // called as this object is owned by a java singleton that never goes away. ~NetworkQualityProvider() override; // net::EffectiveConnectionTypeObserver implementation: void OnEffectiveConnectionTypeChanged( net::EffectiveConnectionType type) override; // net::RTTAndThroughputEstimatesObserver implementation: void OnRTTOrThroughputEstimatesComputed( base::TimeDelta http_rtt, base::TimeDelta transport_rtt, int32_t downstream_throughput_kbps) override; base::android::ScopedJavaGlobalRef<jobject> j_obj_; THREAD_CHECKER(thread_checker_); }; #endif // CHROME_BROWSER_ANDROID_NET_NQE_NETWORK_QUALITY_PROVIDER_H_
// 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_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_CHROMEOS_H_ #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_CHROMEOS_H_ #include <memory> #include <string> #include "base/gtest_prod_util.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "build/chromeos_buildflags.h" #include "chrome/browser/chromeos/printing/print_servers_manager.h" #include "chrome/common/buildflags.h" #include "chromeos/crosapi/mojom/local_printer.mojom.h" #include "components/prefs/pref_service.h" #include "components/signin/public/identity_manager/identity_manager.h" #include "content/public/browser/web_ui_message_handler.h" #include "mojo/public/cpp/bindings/receiver.h" #include "printing/backend/print_backend.h" #include "printing/buildflags/buildflags.h" #include "printing/print_job_constants.h" namespace base { class DictionaryValue; } namespace printing { namespace mojom { enum class PrinterType; } class PrinterHandler; class PrintPreviewHandler; // The handler for Javascript messages related to the print preview dialog. class PrintPreviewHandlerChromeOS : public content::WebUIMessageHandler, public crosapi::mojom::PrintServerObserver { public: PrintPreviewHandlerChromeOS(); PrintPreviewHandlerChromeOS(const PrintPreviewHandlerChromeOS&) = delete; PrintPreviewHandlerChromeOS& operator=(const PrintPreviewHandlerChromeOS&) = delete; ~PrintPreviewHandlerChromeOS() override; // WebUIMessageHandler implementation. void RegisterMessages() override; void OnJavascriptDisallowed() override; void OnJavascriptAllowed() override; protected: // Protected so unit tests can override. virtual PrinterHandler* GetPrinterHandler(mojom::PrinterType printer_type); private: friend class PrintPreviewHandlerChromeOSTest; #if BUILDFLAG(IS_CHROMEOS_ASH) friend class TestPrintServersManager; #endif class AccessTokenService; PrintPreviewHandler* GetPrintPreviewHandler(); void MaybeAllowJavascript(); // Grants an extension access to a provisional printer. First element of // |args| is the provisional printer ID. void HandleGrantExtensionPrinterAccess(const base::ListValue* args); // Performs printer setup. First element of |args| is the printer name. void HandlePrinterSetup(const base::ListValue* args); // Generates new token and sends back to UI. void HandleGetAccessToken(const base::ListValue* args); // Gets the EULA URL. void HandleGetEulaUrl(const base::ListValue* args); // Send OAuth2 access token. void SendAccessToken(const std::string& callback_id, const std::string& access_token); // Send the EULA URL; void SendEulaUrl(const std::string& callback_id, const std::string& eula_url); // Send the result of performing printer setup. |settings_info| contains // printer capabilities. void SendPrinterSetup(const std::string& callback_id, const std::string& printer_name, base::Value settings_info); // Called when an extension reports information requested for a provisional // printer. // |callback_id|: The javascript callback to resolve or reject. // |printer_info|: The data reported by the extension. void OnGotExtensionPrinterInfo(const std::string& callback_id, const base::DictionaryValue& printer_info); // Called to initiate a status request for a printer. void HandleRequestPrinterStatusUpdate(const base::ListValue* args); // crosapi::mojom::PrintServerObserver Implementation void OnPrintServersChanged( crosapi::mojom::PrintServersConfigPtr ptr) override; void OnServerPrintersChanged() override; // Loads printers corresponding to the print server(s). First element of // |args| is the print server IDs. void HandleChoosePrintServers(const base::ListValue* args); // Gets the list of print servers and fetching mode. void HandleGetPrintServersConfig(const base::ListValue* args); // Holds token service to get OAuth2 access tokens. std::unique_ptr<AccessTokenService> token_service_; mojo::Receiver<crosapi::mojom::PrintServerObserver> receiver_{this}; // Used to transmit mojo interface method calls to ash chrome. // Null if the interface is unavailable. // Note that this is not propagated to LocalPrinterHandlerLacros. // The pointer is constant - if ash crashes and the mojo connection is lost, // lacros will automatically be restarted. crosapi::mojom::LocalPrinter* local_printer_ = nullptr; base::WeakPtrFactory<PrintPreviewHandlerChromeOS> weak_factory_{this}; }; } // namespace printing #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_CHROMEOS_H_
/* * Copyright (c) 2015, Simone Margaritelli <evilsocket at gmail dot com> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of ARM Inject 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 LINKER_H_ #define LINKER_H_ #include <elf.h> #define ANDROID_ARM_LINKER 1 #define SOINFO_NAME_LEN 128 #define FLAG_GNU_HASH 0x00000040 typedef Elf32_Half Elf32_Versym; struct link_map { uintptr_t l_addr; char * l_name; uintptr_t l_ld; struct link_map * l_next; struct link_map * l_prev; }; struct soinfo_list_t { void * head; void * tail; }; struct soinfo { const char name[SOINFO_NAME_LEN]; Elf32_Phdr *phdr; int phnum; unsigned entry; unsigned base; unsigned size; int unused; // DO NOT USE, maintained for compatibility. unsigned *dynamic; unsigned wrprotect_start; unsigned wrprotect_end; struct soinfo *next; unsigned flags; const char *strtab; Elf32_Sym *symtab; unsigned nbucket; unsigned nchain; unsigned *bucket; unsigned *chain; unsigned *plt_got; Elf32_Rel *plt_rel; unsigned plt_rel_count; Elf32_Rel *rel; unsigned rel_count; unsigned *preinit_array; unsigned preinit_array_count; unsigned *init_array; unsigned init_array_count; unsigned *fini_array; unsigned fini_array_count; void (*init_func)(void); void (*fini_func)(void); #ifdef ANDROID_ARM_LINKER /* ARM EABI section used for stack unwinding. */ unsigned *ARM_exidx; unsigned ARM_exidx_count; #endif unsigned refcount; struct link_map linkmap; int constructors_called; unsigned *load_bias; #if !defined(__LP64__) bool has_text_relocations; #endif bool has_DT_SYMBOLIC; // version >= 0 dev_t st_dev_; ino_t st_ino_; soinfo_list_t children_; soinfo_list_t parents_; // version >= 1 off64_t file_offset_; uint32_t rtld_flags_; uint32_t dt_flags_1_; size_t strtab_size_; // version >= 2 size_t gnu_nbucket_; uint32_t *gnu_bucket_; uint32_t *gnu_chain_; uint32_t gnu_maskwords_; uint32_t gnu_shift2_; unsigned *gnu_bloom_filter_; soinfo* local_group_root_; uint8_t* android_relocs_; size_t android_relocs_size_; const char* soname_; std::string realpath_; const Elf32_Versym* versym_; unsigned *verdef_ptr_; size_t verdef_cnt_; unsigned *verneed_ptr_; size_t verneed_cnt_; uint32_t target_sdk_version_; std::vector<std::string> dt_runpath_; }; #define R_ARM_ABS32 2 #define R_ARM_COPY 20 #define R_ARM_GLOB_DAT 21 #define R_ARM_JUMP_SLOT 22 #define R_ARM_RELATIVE 23 #endif
#ifndef LOGGING_H #define LOGGING_H #include <map> #include <string> namespace sf { namespace logging { //! Short-end for message variables. typedef std::map<std::string, std::string> Variables; enum LogLevel { LL_ERROR = 0, LL_WARNING = 1, LL_INFO = 2, LL_DEBUG = 3 }; //! Abstract logging interface. /*! * GCC has some interesting macros that could be used in formats. * https://gcc.gnu.org/onlinedocs/gcc-4.2.1/cpp/Common-Predefined-Macros.html */ class Logger { protected: //! Format of log messages. /*! * The format is a string that include variable place-holders defined * with the syntax ${variable}, where variable is the name of the variable * to lookup in the Variables argument. */ std::string format; //! Format a log messages. /*! * Helper method to format a log message based on the value of format and * the variables passed to the logging method. */ std::string formatMessage( const LogLevel level, const std::string message, Variables vars ); public: Logger(std::string format); virtual ~Logger(); virtual void log( const LogLevel level, const std::string message, Variables variables ) = 0; }; // Helper macros. #define STR(str) #str #define STR_(str) STR(str) //! Return the current line as a string. #define __STR_LINE__ STR_(__LINE__) //! Extend the given Variables instance with defaults and return it. #define LOG_ADD_VARS(variables) (variables["line"] = __STR_LINE__, \ variables["file"] = __FILE__, \ variables["function"] = __PRETTY_FUNCTION__, \ variables \ ) #define LOG(logger, level, message) { \ sf::logging::Variables _log_varaibles; \ LOG_ADD_VARS(_log_varaibles); \ logger->log(level, message, _log_varaibles); \ } #define LLERROR sf::logging::LogLevel::LL_ERROR #define LLWARNING sf::logging::LogLevel::LL_WARNING #define LLINFO sf::logging::LogLevel::LL_INFO #define LLDEBUG sf::logging::LogLevel::LL_DEBUG #define ERROR(logger, message) LOG(logger, LLERROR, message) #define WARNING(logger, message) LOG(logger, LLWARNING, message) #define INFO(logger, message) LOG(logger, LLINFO, message) #define DEBUG(logger, message) LOG(logger, LLDEBUG, message) #define LOGV(logger, level, message, variables) \ logger->log(level, message, LOG_ADD_VARS(variables)) #define ERRORV(log, msg, vars) LOGV(log, LLERROR, msg, vars) #define WARNINGV(log, msg, vars) LOGV(log, LLWARNING, msg, vars) #define INFOV(log, msg, vars) LOGV(log, LLINFO, msg, vars) #define DEBUGV(log, msg, vars) LOGV(log, LLDEBUG, msg, vars) } // namespace logging } // namespace sf #endif /* LOGGING_H */
/* $OpenBSD: ascii.h,v 1.3 1996/10/30 22:41:35 niklas Exp $ */ /* $NetBSD: ascii.h,v 1.1 1996/04/12 02:00:42 cgd Exp $ */ #define ASCII_BEL 0x07 /* bell */ #define ASCII_BS 0x08 /* backspace */ #define ASCII_HT 0x09 /* horizontal tab */ #define ASCII_LF 0x0a /* line feed */ #define ASCII_VT 0x0b /* vertical tab(?); up one line */ #define ASCII_NP 0x0c /* next page; form feed */ #define ASCII_CR 0x0d /* carriage return */ #define ASCII_ESC 0x1b /* escape */
/* * Copyright (c) 2009-2010, Bjoern Knafla * http://www.bjoernknafla.com/ * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Bjoern Knafla * Parallelization + AI + Gamedev Consulting 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. */ /** * @file * * Internal utility data structure for internal utility functions * to query Windows OSes for platform infos. */ #ifndef AMP_amp_internal_platform_win_info_H #define AMP_amp_internal_platform_win_info_H #include <stddef.h> typedef struct amp_internal_platform_win_info_s { size_t installed_core_count; size_t active_core_count; size_t installed_hwthread_count; size_t active_hwthread_count; } amp_internal_platform_win_info_s; #endif /* AMP_amp_internal_platform_win_info_H */
// 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 CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PROVIDER_H_ #define CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PROVIDER_H_ #pragma once #include <map> #include <vector> #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/threading/thread.h" #include "content/browser/geolocation/geolocation_observer.h" #include "content/common/content_export.h" #include "content/public/browser/geolocation.h" #include "content/public/common/geoposition.h" class GeolocationArbitrator; class GeolocationProviderTest; template<typename Type> struct DefaultSingletonTraits; // This is the main API to the geolocation subsystem. The application will hold // a single instance of this class and can register multiple clients to be // notified of location changes: // * Observers are registered by AddObserver() and will keep receiving updates // until unregistered by RemoveObserver(). // * Callbacks are registered by RequestCallback() and will be called exactly // once when the next update becomes available. // The application must instantiate the GeolocationProvider on the IO thread and // must communicate with it on the same thread. // The underlying location arbitrator will only be enabled whilst there is at // least one registered observer or pending callback. The arbitrator and the // location providers it uses run on a separate Geolocation thread. class CONTENT_EXPORT GeolocationProvider : public base::Thread, public GeolocationObserver { public: // The GeolocationObserverOptions passed are used as a 'hint' for the provider // preferences for this particular observer, however the observer could // receive updates for best available locations from any active provider // whilst it is registered. // If an existing observer is added a second time, its options are updated // but only a single call to RemoveObserver() is required to remove it. void AddObserver(GeolocationObserver* delegate, const GeolocationObserverOptions& update_options); // Remove a previously registered observer. No-op if not previously registered // via AddObserver(). Returns true if the observer was removed. bool RemoveObserver(GeolocationObserver* delegate); // Request a single callback when the next location update becomes available. // Callbacks must only be requested by code that is allowed to access the // location. No further permission checks will be made. void RequestCallback(const content::GeolocationUpdateCallback& callback); void OnPermissionGranted(); bool HasPermissionBeenGranted() const; // GeolocationObserver implementation. virtual void OnLocationUpdate(const content::Geoposition& position) OVERRIDE; // Overrides the location for automation/testing. Suppresses any further // updates from the actual providers and sends an update with the overridden // position to all registered clients. void OverrideLocationForTesting( const content::Geoposition& override_position); // Gets a pointer to the singleton instance of the location relayer, which // is in turn bound to the browser's global context objects. This must only be // called on the IO thread so that the GeolocationProvider is always // instantiated on the same thread. Ownership is NOT returned. static GeolocationProvider* GetInstance(); protected: friend struct DefaultSingletonTraits<GeolocationProvider>; GeolocationProvider(); virtual ~GeolocationProvider(); private: typedef std::map<GeolocationObserver*, GeolocationObserverOptions> ObserverMap; typedef std::vector<content::GeolocationUpdateCallback> CallbackList; bool OnGeolocationThread() const; // Start and stop providers as needed when clients are added or removed. void OnClientsChanged(); // Stops the providers when there are no more registered clients. Note that // once the Geolocation thread is started, it will stay alive (but sitting // idle without any pending messages). void StopProviders(); // Starts the geolocation providers or updates their options (delegates to // arbitrator). void StartProviders(const GeolocationObserverOptions& options); // Updates the providers on the geolocation thread, which must be running. void InformProvidersPermissionGranted(); // Notifies all registered clients that a position update is available. void NotifyClients(const content::Geoposition& position); // Thread virtual void Init() OVERRIDE; virtual void CleanUp() OVERRIDE; // Only used on the IO thread ObserverMap observers_; CallbackList callbacks_; bool is_permission_granted_; content::Geoposition position_; // True only in testing, where we want to use a custom position. bool ignore_location_updates_; // Only to be used on the geolocation thread. GeolocationArbitrator* arbitrator_; DISALLOW_COPY_AND_ASSIGN(GeolocationProvider); }; #endif // CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PROVIDER_H_
#include "def_lang/IVector_Type.h" #include "def_lang/ep/Symbol_EP.h" #include "def_lang/ep/Attribute_Container_EP.h" namespace ts { class Vector_Type final : virtual public IVector_Type, public Symbol_EP, public Attribute_Container_EP, public std::enable_shared_from_this<Vector_Type> { public: typedef IVector_Value value_type; Vector_Type(std::string const& name); Vector_Type(Vector_Type const& other, std::string const& name); Result<void> init(std::vector<std::shared_ptr<const ITemplate_Argument>> const& arguments) override; std::string const& get_ui_name() const override; Symbol_Path get_native_type() const override; std::shared_ptr<IType> clone(std::string const& name) const override; std::shared_ptr<IType> alias(std::string const& name) const override; std::shared_ptr<const IType> get_aliased_type() const override; std::shared_ptr<const IType> get_inner_type() const override; std::shared_ptr<IValue> create_value() const override; std::shared_ptr<value_type> create_specialized_value() const override; protected: Result<void> validate_attribute(IAttribute const& attribute) override; private: std::shared_ptr<const IType> m_inner_type; std::shared_ptr<const IType> m_aliased_type; std::string m_ui_name; Symbol_Path m_native_type; }; }
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef STORAGE_BROWSER_FILE_SYSTEM_QUOTA_OPEN_FILE_HANDLE_CONTEXT_H_ #define STORAGE_BROWSER_FILE_SYSTEM_QUOTA_OPEN_FILE_HANDLE_CONTEXT_H_ #include <stdint.h> #include "base/files/file_path.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "storage/common/file_system/file_system_types.h" #include "url/gurl.h" namespace storage { class QuotaReservationBuffer; // This class represents a underlying file of a managed FileSystem file. // The instance keeps alive while at least one consumer keeps an open file // handle. // This class is usually manipulated only via OpenFileHandle. class OpenFileHandleContext : public base::RefCounted<OpenFileHandleContext> { public: OpenFileHandleContext(const base::FilePath& platform_path, QuotaReservationBuffer* reservation_buffer); // Updates the max written offset and returns the amount of growth. int64_t UpdateMaxWrittenOffset(int64_t offset); void AddAppendModeWriteAmount(int64_t amount); const base::FilePath& platform_path() const { return platform_path_; } int64_t GetEstimatedFileSize() const; int64_t GetMaxWrittenOffset() const; private: friend class base::RefCounted<OpenFileHandleContext>; virtual ~OpenFileHandleContext(); int64_t initial_file_size_; int64_t maximum_written_offset_; int64_t append_mode_write_amount_; base::FilePath platform_path_; scoped_refptr<QuotaReservationBuffer> reservation_buffer_; base::SequenceChecker sequence_checker_; DISALLOW_COPY_AND_ASSIGN(OpenFileHandleContext); }; } // namespace storage #endif // STORAGE_BROWSER_FILE_SYSTEM_QUOTA_OPEN_FILE_HANDLE_CONTEXT_H_
main() { long a,b; scanf("%ld",&a); b=a/388; b=b%26; b+=97; printf("%c\n",b); return 0; }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__wchar_t_console_w32_spawnlp_52a.c Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-52a.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: console Read input from the console * GoodSource: Fixed string * Sink: w32_spawnlp * BadSink : execute command with wspawnlp * Flow Variant: 52 Data flow: data passed as an argument from one function to another to another in three different source files * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define COMMAND_INT_PATH L"%WINDIR%\\system32\\cmd.exe" #define COMMAND_INT L"cmd.exe" #define COMMAND_ARG1 L"/c" #define COMMAND_ARG2 L"dir " #define COMMAND_ARG3 data #else /* NOT _WIN32 */ #include <unistd.h> #define COMMAND_INT_PATH L"/bin/sh" #define COMMAND_INT L"sh" #define COMMAND_ARG1 L"-c" #define COMMAND_ARG2 L"ls " #define COMMAND_ARG3 data #endif #include <process.h> #ifndef OMITBAD /* bad function declaration */ void CWE78_OS_Command_Injection__wchar_t_console_w32_spawnlp_52b_badSink(wchar_t * data); void CWE78_OS_Command_Injection__wchar_t_console_w32_spawnlp_52_bad() { wchar_t * data; wchar_t dataBuffer[100] = COMMAND_ARG2; data = dataBuffer; { /* Read input from the console */ size_t dataLen = wcslen(data); /* if there is room in data, read into it from the console */ if (100-dataLen > 1) { /* POTENTIAL FLAW: Read data from the console */ if (fgetws(data+dataLen, (int)(100-dataLen), stdin) != NULL) { /* The next few lines remove the carriage return from the string that is * inserted by fgetws() */ dataLen = wcslen(data); if (dataLen > 0 && data[dataLen-1] == L'\n') { data[dataLen-1] = L'\0'; } } else { printLine("fgetws() failed"); /* Restore NUL terminator if fgetws fails */ data[dataLen] = L'\0'; } } } CWE78_OS_Command_Injection__wchar_t_console_w32_spawnlp_52b_badSink(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* good function declaration */ void CWE78_OS_Command_Injection__wchar_t_console_w32_spawnlp_52b_goodG2BSink(wchar_t * data); /* goodG2B uses the GoodSource with the BadSink */ static void goodG2B() { wchar_t * data; wchar_t dataBuffer[100] = COMMAND_ARG2; data = dataBuffer; /* FIX: Append a fixed string to data (not user / external input) */ wcscat(data, L"*.*"); CWE78_OS_Command_Injection__wchar_t_console_w32_spawnlp_52b_goodG2BSink(data); } void CWE78_OS_Command_Injection__wchar_t_console_w32_spawnlp_52_good() { goodG2B(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE78_OS_Command_Injection__wchar_t_console_w32_spawnlp_52_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE78_OS_Command_Injection__wchar_t_console_w32_spawnlp_52_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
// -*- C++ -*- #ifndef _writer_verilog_module_h_ #define _writer_verilog_module_h_ #include "writer/verilog/common.h" namespace iroha { namespace writer { namespace verilog { // For module. static const char kStateDeclSection[] = "state_decl"; static const char kEmbeddedInstanceSection[] = "embedded"; static const char kSharedWireSection[] = "shared"; static const char kSubModuleSection[] = "sub_modules"; // For each table (with table id). static const char kRegisterSection[] = "register"; static const char kResourceSection[] = "resource"; static const char kResourceValueSection[] = "resource_value"; static const char kInsnWireDeclSection[] = "insn_wire_decl"; static const char kInsnWireValueSection[] = "insn_wire_value"; static const char kInitialValueSection[] = "initial_value"; static const char kStateOutputSection[] = "state_output"; static const char kTaskEntrySection[] = "task_entry"; // For each state (with table and state id) static const char kStateBodySection[] = "state_body"; static const char kStateTransitionSection[] = "state_tr"; class Module { public: Module(const IModule *i_mod, const VerilogWriter *writer, const Connection &conn, EmbeddedModules *embed, Names *names); ~Module(); void Build(); void PrepareTables(); void Write(const string &prefix, ostream &os); bool GetResetPolarity() const; Module *GetParentModule() const; void SetParentModule(Module *parent); const IModule *GetIModule() const; PortSet *GetPortSet() const; ModuleTemplate *GetModuleTemplate() const; void BuildChildModuleInstSection(vector<Module *> &child_mods); const string &GetName() const; const Connection &GetConnection() const; Names *GetNames() const; ostream &ChildModuleInstSectionStream(Module *child) const; Module *GetByIModule(const IModule *mod) const; private: string ChildModuleInstSectionContents(Module *child, bool clear) const; const IModule *i_mod_; const VerilogWriter *writer_; const Connection &conn_; EmbeddedModules *embed_; Names *names_; Module *parent_; unique_ptr<ModuleTemplate> tmpl_; unique_ptr<PortSet> ports_; vector<Table *> tables_; vector<Module *> child_modules_; string name_; string reset_name_; }; } // namespace verilog } // namespace writer } // namespace iroha #endif // _writer_verilog_module_h_
/* * The olsr.org Optimized Link-State Routing daemon(olsrd) * Copyright (c) 2008, Bernd Petrovitsch <bernd-at-firmix.at> * Copyright (c) 2008, Sven-Ola Tuecke <sven-ola-at-gmx.de> * 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 olsr.org, olsrd 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. * * Visit http://www.olsr.org for more information. * * If you find this software useful feel free to make a donation * to the project. For more information see the website or contact * the copyright holders. * */ #ifndef COMMON_STRING_H_ #define COMMON_STRING_H_ #include "defs.h" #include <stdlib.h> char *EXPORT(strscpy) (char *dest, const char *src, size_t size); char *EXPORT(strscat) (char *dest, const char *src, size_t size); extern const char *EXPORT(OLSR_YES); extern const char *EXPORT(OLSR_NO); #endif /* * Local Variables: * c-basic-offset: 2 * indent-tabs-mode: nil * End: */
/* * This file is in the public domain. * $FreeBSD: src/sys/cam/scsi/scsi_message.h,v 1.6 2002/06/05 19:05:01 gibbs Exp $ */ /* Messages (1 byte) */ /* I/T (M)andatory or (O)ptional */ #define MSG_CMDCOMPLETE 0x00 /* M/M */ #define MSG_TASK_COMPLETE 0x00 /* M/M */ /* SPI3 Terminology */ #define MSG_EXTENDED 0x01 /* O/O */ #define MSG_SAVEDATAPOINTER 0x02 /* O/O */ #define MSG_RESTOREPOINTERS 0x03 /* O/O */ #define MSG_DISCONNECT 0x04 /* O/O */ #define MSG_INITIATOR_DET_ERR 0x05 /* M/M */ #define MSG_ABORT 0x06 /* O/M */ #define MSG_ABORT_TASK_SET 0x06 /* O/M */ /* SPI3 Terminology */ #define MSG_MESSAGE_REJECT 0x07 /* M/M */ #define MSG_NOOP 0x08 /* M/M */ #define MSG_PARITY_ERROR 0x09 /* M/M */ #define MSG_LINK_CMD_COMPLETE 0x0a /* O/O */ #define MSG_LINK_CMD_COMPLETEF 0x0b /* O/O */ /* Obsolete */ #define MSG_BUS_DEV_RESET 0x0c /* O/M */ #define MSG_TARGET_RESET 0x0c /* O/M */ /* SPI3 Terminology */ #define MSG_ABORT_TAG 0x0d /* O/O */ #define MSG_ABORT_TASK 0x0d /* O/O */ /* SPI3 Terminology */ #define MSG_CLEAR_QUEUE 0x0e /* O/O */ #define MSG_CLEAR_TASK_SET 0x0e /* O/O */ /* SPI3 Terminology */ #define MSG_INIT_RECOVERY 0x0f /* O/O */ /* Deprecated in SPI3 */ #define MSG_REL_RECOVERY 0x10 /* O/O */ /* Deprecated in SPI3 */ #define MSG_TERM_IO_PROC 0x11 /* O/O */ /* Deprecated in SPI3 */ #define MSG_CLEAR_ACA 0x16 /* O/O */ /* SPI3 */ #define MSG_LOGICAL_UNIT_RESET 0x17 /* O/O */ /* SPI3 */ #define MSG_QAS_REQUEST 0x55 /* O/O */ /* SPI3 */ /* Messages (2 byte) */ #define MSG_SIMPLE_Q_TAG 0x20 /* O/O */ #define MSG_SIMPLE_TASK 0x20 /* O/O */ /* SPI3 Terminology */ #define MSG_HEAD_OF_Q_TAG 0x21 /* O/O */ #define MSG_HEAD_OF_QUEUE_TASK 0x21 /* O/O */ /* SPI3 Terminology */ #define MSG_ORDERED_Q_TAG 0x22 /* O/O */ #define MSG_ORDERED_TASK 0x22 /* O/O */ /* SPI3 Terminology */ #define MSG_IGN_WIDE_RESIDUE 0x23 /* O/O */ #define MSG_ACA_TASK 0x24 /* 0/0 */ /* SPI3 */ /* Identify message */ /* M/M */ #define MSG_IDENTIFYFLAG 0x80 #define MSG_IDENTIFY_DISCFLAG 0x40 #define MSG_IDENTIFY(lun, disc) (((disc) ? 0xc0 : MSG_IDENTIFYFLAG) | (lun)) #define MSG_ISIDENTIFY(m) ((m) & MSG_IDENTIFYFLAG) #define MSG_IDENTIFY_LUNMASK 0x3F /* Extended messages (opcode and length) */ #define MSG_EXT_SDTR 0x01 #define MSG_EXT_SDTR_LEN 0x03 #define MSG_EXT_WDTR 0x03 #define MSG_EXT_WDTR_LEN 0x02 #define MSG_EXT_WDTR_BUS_8_BIT 0x00 #define MSG_EXT_WDTR_BUS_16_BIT 0x01 #define MSG_EXT_WDTR_BUS_32_BIT 0x02 /* Deprecated in SPI3 */ #define MSG_EXT_PPR 0x04 /* SPI3/SPI4 */ #define MSG_EXT_PPR_LEN 0x06 #define MSG_EXT_PPR_PCOMP_EN 0x80 #define MSG_EXT_PPR_RTI 0x40 #define MSG_EXT_PPR_RD_STRM 0x20 #define MSG_EXT_PPR_WR_FLOW 0x10 #define MSG_EXT_PPR_HOLD_MCS 0x08 #define MSG_EXT_PPR_QAS_REQ 0x04 #define MSG_EXT_PPR_DT_REQ 0x02 #define MSG_EXT_PPR_IU_REQ 0x01
/*********************************************************************** * _ooOoo_ * o8888888o * 88" . "88 * (| -_- |) * O\ = /O * ____/`---'\____ * . ' \\| |// `. * / \\||| : |||// \ * / _||||| -:- |||||- \ * | | \\\ - /// | | * | \_| ''\---/'' | | * \ .-\__ `-` ___/-. / * ___`. .' /--.--\ `. . __ * ."" '< `.___\_<|>_/___.' >'"". * | | : `- \`.;`\ _ /`;.`/ - ` : | | * \ \ `-. \_ __\ /__ _/ .-` / / * ======`-.____`-.___\_____/___.-`____.-'====== * `=---=' * ............................................. * 佛祖镇楼 BUG辟易 * 佛曰: * 写字楼里写字间,写字间里程序员; * 程序人员写程序,又拿程序换酒钱。 * 酒醒只在网上坐,酒醉还来网下眠; * 酒醉酒醒日复日,网上网下年复年。 * 但愿老死电脑间,不愿鞠躬老板前; * 奔驰宝马贵者趣,公交自行程序员。 * 别人笑我忒疯癫,我笑自己命太贱; * 不见满街漂亮妹,哪个归得程序员? * ========================================================================== * * this software or lib may be copied only under the terms of the gnu general * public license v3, which may be found in the source kit. * * Filename: spx_thread.h * Created: 2014/09/01 17时27分29秒 * Author: Seapeak.Xu (seapeak.cnblog.com), xvhfeng@gmail.com * Company: Tencent Literature * Remark: * ****************************************************************************/ #ifndef _SPX_THREAD_H_ #define _SPX_THREAD_H_ #ifdef __cplusplus extern "C" { #endif #include <stdlib.h> #include <stdio.h> #include <pthread.h> #include "spx_types.h" typedef void (SpxThreadCleanupDelegate)(void *arg); /** * this function alloc mutex-locker must use * spx_thread_mutex_free function to free the mutex locker */ pthread_mutex_t *spx_thread_mutex_new(SpxLogDelegate *log, err_t *err); void spx_thread_mutex_free(pthread_mutex_t **mlock); pthread_cond_t *spx_thread_cond_new(SpxLogDelegate *log, err_t *err); void spx_thread_cond_free(pthread_cond_t **clock); pthread_t spx_thread_new(SpxLogDelegate *log, size_t stacksize, void *(*start_routine)(void*), void *arg, err_t *err); pthread_t spx_detach_thread_new(SpxLogDelegate *log, size_t stacksize, void *(*start_routine)(void*), void *arg, err_t *err); pthread_t spx_thread_new_cancelability(SpxLogDelegate *log, size_t stacksize, void *(*start_routine)(void *), void *arg, err_t *err); #ifdef __cplusplus } #endif #endif
/*********************************************************************** * $Id$ * Copyright (c) 1997 by Fort Gunnison, Inc. * * ButtonApp.h: ButtonApp用のアプリケーションクラス * * Author: Shin'ya Koga (koga@ftgun.co.jp) * Created: Dec. 12, 1997 * Last update: Dec. 12, 1997 ************************************************************************ */ #ifndef _BUTTON_APP_H_ #define _BUTTON_APP_H_ /* ######################################################### */ /* # I N C L U D E F I L E S # */ /* ######################################################### */ #include <app/Application.h> /* ######################################################### */ /* # T Y P E D E F I N E S # */ /* ######################################################### */ /* ######################################################### */ /* # P U B L I C F U N C T I O N S # */ /* ######################################################### */ /* * ButtonAppクラスの定義 */ class ButtonApp : public BApplication { // メソッド public: // 初期化と解放 ButtonApp(void); ~ButtonApp(void); private: // 起動と終了 void ReadyToRun(void); }; #endif /* _BUTTON_APP_H_ */ /* * End of File */
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__char_listen_socket_system_63b.c Label Definition File: CWE78_OS_Command_Injection.one_string.label.xml Template File: sources-sink-63b.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: listen_socket Read data using a listen socket (server side) * GoodSource: Fixed string * Sinks: system * BadSink : Execute command in data using system() * Flow Variant: 63 Data flow: pointer to data passed from one function to another in different source files * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define FULL_COMMAND "dir " #else #include <unistd.h> #define FULL_COMMAND "ls " #endif #ifdef _WIN32 #include <winsock2.h> #include <windows.h> #include <direct.h> #pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */ #define CLOSE_SOCKET closesocket #else #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #define INVALID_SOCKET -1 #define SOCKET_ERROR -1 #define CLOSE_SOCKET close #define SOCKET int #endif #define TCP_PORT 27015 #define LISTEN_BACKLOG 5 #ifdef _WIN32 #define SYSTEM system #else /* NOT _WIN32 */ #define SYSTEM system #endif #ifndef OMITBAD void CWE78_OS_Command_Injection__char_listen_socket_system_63b_badSink(char * * dataPtr) { char * data = *dataPtr; /* POTENTIAL FLAW: Execute command in data possibly leading to command injection */ if (SYSTEM(data) != 0) { printLine("command execution failed!"); exit(1); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE78_OS_Command_Injection__char_listen_socket_system_63b_goodG2BSink(char * * dataPtr) { char * data = *dataPtr; /* POTENTIAL FLAW: Execute command in data possibly leading to command injection */ if (SYSTEM(data) != 0) { printLine("command execution failed!"); exit(1); } } #endif /* OMITGOOD */
// Copyright Paul Dardeau, SwampBits LLC 2015 // BSD License #ifndef CHAUDIERE_CHARBUFFER_H #define CHAUDIERE_CHARBUFFER_H #include <stdlib.h> #include <string.h> namespace chaudiere { /** * CharBuffer is a low-level class that manages a simple memory data buffer. */ class CharBuffer { public: /** */ CharBuffer() : m_buffer(NULL), m_bufferSize(0) { } /** * Constructs a new CharBuffer of the specified size * @param bufferSize the size needed for the buffer */ explicit CharBuffer(const std::size_t bufferSize) : m_buffer(NULL), m_bufferSize(bufferSize) { if (m_bufferSize > 0) { allocateBuffer(bufferSize); } } /** * Destructor */ ~CharBuffer() { if (m_buffer != NULL) { delete [] m_buffer; } } void nullAt(const std::size_t offset) { if (offset < m_bufferSize) { m_buffer[offset] = '\0'; } } void allocateBuffer(const std::size_t bufferSize) { if (bufferSize > 0) { m_buffer = new char[bufferSize]; memset(m_buffer, 0, bufferSize); m_bufferSize = bufferSize; } } void ensureCapacity(const std::size_t bufferSize) { if (NULL == m_buffer) { allocateBuffer(bufferSize); } else { if (bufferSize > m_bufferSize) { char* largerBuffer = new char[bufferSize]; memcpy(largerBuffer, m_buffer, m_bufferSize); delete [] m_buffer; m_buffer = largerBuffer; m_bufferSize = bufferSize; } } } /** * Retrieve pointer to raw data buffer * @return pointer to raw data buffer */ char* data() { return m_buffer; } /** * Retrieve size of data buffer * @return size of data buffer in bytes */ std::size_t size() const { return m_bufferSize; } private: char* m_buffer; std::size_t m_bufferSize; // disallow copies CharBuffer(const CharBuffer& copy); CharBuffer& operator=(const CharBuffer& copy); }; } #endif
#ifndef STACK_ALLOC_H #include "CustomAllocators.h" #define STACK_ALLOC_H namespace Ramble { /** * Allocates in a Last-in First-out manner. */ class StackAllocator : public IMemAllocator { public: StackAllocator(size_t totalSize, void* startLoc); //totalSize tells the allocator how much memory it has available ~StackAllocator(); void* Allocate(size_t amount, U8 alignment) override; //sets aside a size_t before the actual allocation, to store the actual allocation size. void Deallocate(void* memory) override; private: /** * An instance of the will be stored before every allocation. */ struct AllocHeader { void* pPreviousAlloc; //TODO: place #ifdefs around this so that it is not included in production builds. U8 alignAdjustment; //the amount that we had to move the allocation in order to keep it aligned. }; /** * Do not want to allow copying of the allocator. */ StackAllocator(const StackAllocator& source); StackAllocator& operator=(const StackAllocator& other); void* m_top; //the head of the stack void* m_lastAlloc; //TODO: place #ifdefs around this so that it is not included in production builds. }; } #endif
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_SESSION_PLUGIN_HANDLER_H_ #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_SESSION_PLUGIN_HANDLER_H_ #include <memory> #include <set> #include <vector> #include "base/macros.h" #include "base/timer/timer.h" #include "content/public/browser/web_contents_observer.h" namespace base { class FilePath; } namespace content { class WebContents; } namespace chromeos { class KioskSessionPluginHandlerDelegate; // A class to watch for plugin crash/hung in a kiosk session. Device will be // rebooted after the first crash/hung is detected. class KioskSessionPluginHandler { public: class Observer : public content::WebContentsObserver { public: Observer(content::WebContents* contents, KioskSessionPluginHandler* owner); Observer(const Observer&) = delete; Observer& operator=(const Observer&) = delete; ~Observer() override; std::set<int> GetHungPluginsForTesting() const; private: void OnHungWaitTimer(); // content::WebContentsObserver void PluginCrashed(const base::FilePath& plugin_path, base::ProcessId plugin_pid) override; void PluginHungStatusChanged(int plugin_child_id, const base::FilePath& plugin_path, bool is_hung) override; void WebContentsDestroyed() override; KioskSessionPluginHandler* const owner_; std::set<int> hung_plugins_; base::OneShotTimer hung_wait_timer_; }; explicit KioskSessionPluginHandler( KioskSessionPluginHandlerDelegate* delegate); KioskSessionPluginHandler(const KioskSessionPluginHandler&) = delete; KioskSessionPluginHandler& operator=(const KioskSessionPluginHandler&) = delete; ~KioskSessionPluginHandler(); void Observe(content::WebContents* contents); std::vector<Observer*> GetWatchersForTesting() const; private: void OnPluginCrashed(const base::FilePath& plugin_path); void OnPluginHung(const std::set<int>& hung_plugins); void OnWebContentsDestroyed(Observer* observer); KioskSessionPluginHandlerDelegate* const delegate_; std::vector<std::unique_ptr<Observer>> watchers_; }; } // namespace chromeos #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_SESSION_PLUGIN_HANDLER_H_
// Copyright 2017 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #ifndef CORE_FXCRT_CSS_CFX_CSSEXTTEXTBUF_H_ #define CORE_FXCRT_CSS_CFX_CSSEXTTEXTBUF_H_ #include "core/fxcrt/fx_string.h" class CFX_CSSExtTextBuf { public: explicit CFX_CSSExtTextBuf(WideStringView str); ~CFX_CSSExtTextBuf(); bool IsEOF() const { return m_iPos >= m_Buffer.GetLength(); } void MoveNext() { m_iPos++; } wchar_t GetChar() const { return m_Buffer[m_iPos]; } wchar_t GetNextChar() const { return m_iPos + 1 < m_Buffer.GetLength() ? m_Buffer[m_iPos + 1] : 0; } protected: const WideStringView m_Buffer; size_t m_iPos = 0; }; #endif // CORE_FXCRT_CSS_CFX_CSSEXTTEXTBUF_H_
#ifndef KEYPRESS_H #define KEYPRESS_H /** * @brief Processes a keyboard press; used for changing direction of naga, or to exit the program * * @param c The key which was pressed by the user */ void process_keypress(int c); #endif
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_INSPECTOR_HIGHLIGHT_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_INSPECTOR_HIGHLIGHT_H_ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/dom/pseudo_element.h" #include "third_party/blink/renderer/core/inspector/protocol/DOM.h" #include "third_party/blink/renderer/platform/geometry/float_quad.h" #include "third_party/blink/renderer/platform/geometry/layout_rect.h" #include "third_party/blink/renderer/platform/graphics/color.h" #include "third_party/blink/renderer/platform/heap/handle.h" namespace blink { class Color; enum class ColorFormat { RGB, HEX, HSL }; struct CORE_EXPORT InspectorGridHighlightConfig { USING_FAST_MALLOC(InspectorGridHighlightConfig); public: InspectorGridHighlightConfig(); Color grid_color; Color cell_color; Color row_gap_color; Color column_gap_color; Color row_hatch_color; Color column_hatch_color; bool show_grid_extension_lines; bool grid_border_dash; bool cell_border_dash; }; struct CORE_EXPORT InspectorHighlightConfig { USING_FAST_MALLOC(InspectorHighlightConfig); public: InspectorHighlightConfig(); Color content; Color content_outline; Color padding; Color border; Color margin; Color event_target; Color shape; Color shape_margin; Color css_grid; bool show_info; bool show_styles; bool show_rulers; bool show_extension_lines; String selector_list; ColorFormat color_format; std::unique_ptr<InspectorGridHighlightConfig> grid_highlight_config; }; struct InspectorHighlightContrastInfo { Color background_color; String font_size; String font_weight; }; class CORE_EXPORT InspectorHighlight { STACK_ALLOCATED(); public: InspectorHighlight(Node*, const InspectorHighlightConfig&, const InspectorHighlightContrastInfo&, bool append_element_info, bool append_distance_info, bool is_locked_ancestor); explicit InspectorHighlight(float scale); ~InspectorHighlight(); static bool GetBoxModel(Node*, std::unique_ptr<protocol::DOM::BoxModel>*, bool use_absolute_zoom); static bool GetContentQuads( Node*, std::unique_ptr<protocol::Array<protocol::Array<double>>>*); static InspectorHighlightConfig DefaultConfig(); static InspectorGridHighlightConfig DefaultGridConfig(); void AppendPath(std::unique_ptr<protocol::ListValue> path, const Color& fill_color, const Color& outline_color, const String& name = String()); void AppendQuad(const FloatQuad&, const Color& fill_color, const Color& outline_color = Color::kTransparent, const String& name = String()); void AppendEventTargetQuads(Node* event_target_node, const InspectorHighlightConfig&); std::unique_ptr<protocol::DictionaryValue> AsProtocolValue() const; private: static bool BuildSVGQuads(Node*, Vector<FloatQuad>& quads); static bool BuildNodeQuads(Node*, FloatQuad* content, FloatQuad* padding, FloatQuad* border, FloatQuad* margin); void AppendNodeHighlight(Node*, const InspectorHighlightConfig&); void AppendPathsForShapeOutside(Node*, const InspectorHighlightConfig&); void AppendDistanceInfo(Node* node); void VisitAndCollectDistanceInfo(Node* node); void VisitAndCollectDistanceInfo(PseudoId pseudo_id, LayoutObject* layout_object); void AddLayoutBoxToDistanceInfo(LayoutObject* layout_object); std::unique_ptr<protocol::Array<protocol::Array<double>>> boxes_; std::unique_ptr<protocol::DictionaryValue> computed_style_; std::unique_ptr<protocol::DOM::BoxModel> model_; std::unique_ptr<protocol::DictionaryValue> distance_info_; std::unique_ptr<protocol::DictionaryValue> element_info_; std::unique_ptr<protocol::ListValue> highlight_paths_; std::unique_ptr<protocol::ListValue> grid_info_; bool show_rulers_; bool show_extension_lines_; float scale_; ColorFormat color_format_; }; } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_INSPECTOR_HIGHLIGHT_H_
// // Created by juanfra on 18/11/16. // #ifndef ARQUI2016_DONPEPITO_H #define ARQUI2016_DONPEPITO_H int pepitoJose(); #endif //ARQUI2016_DONPEPITO_H
/*========================================================================= Program: Visualization Toolkit Module: vtkNearestNeighborGraphFilter.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm 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 vtkNearestNeighborGraphFilter - Creates a KNN graph on a vtkPointSet. // // .SECTION Description // vtkNearestNeighborGraphFilter derives from vtkPointGraphFilter and implements // the CreateEdgesOnPoints() function to create a graph with every point connected // to its K nearest neighbors. // // .SECTION See Also #ifndef __vtkNearestNeighborGraphFilter_h #define __vtkNearestNeighborGraphFilter_h #include "vtkPointGraphFilter.h" class vtkNearestNeighborGraphFilter : public vtkPointGraphFilter { public: static vtkNearestNeighborGraphFilter *New(); vtkTypeMacro(vtkNearestNeighborGraphFilter, vtkGraphAlgorithm); void PrintSelf(ostream &os, vtkIndent indent); // Description: // Determines which edges to how many neighbors to connect each point to. vtkSetMacro(KNeighbors, unsigned int); vtkGetMacro(KNeighbors, unsigned int); vtkNearestNeighborGraphFilter(); protected: // Description: // This is the function that the superclass requires that we implement. // It creates an edge between every vertex and its KNeighbors nearest // neighbors. void CreateEdgesOnPoints(); // Description: // Determines which edges to how many neighbors to connect each point to. unsigned int KNeighbors; private: vtkNearestNeighborGraphFilter(const vtkNearestNeighborGraphFilter&); // Not implemented. void operator=(const vtkNearestNeighborGraphFilter&); // Not implemented. }; #endif
/* * Copyright (C) 2014 Google Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef TreeScopeEventContext_h #define TreeScopeEventContext_h #include "core/CoreExport.h" #include "core/dom/Node.h" #include "core/dom/TreeScope.h" #include "core/events/EventTarget.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" namespace blink { class EventPath; class EventTarget; class Node; template <typename NodeType> class StaticNodeTypeList; using StaticNodeList = StaticNodeTypeList<Node>; class TouchEventContext; class TreeScope; class CORE_EXPORT TreeScopeEventContext final : public GarbageCollected<TreeScopeEventContext> { public: static TreeScopeEventContext* create(TreeScope&); DECLARE_TRACE(); TreeScope& treeScope() const { return *m_treeScope; } Node& rootNode() const { return *m_rootNode; } EventTarget* target() const { return m_target.get(); } void setTarget(EventTarget*); EventTarget* relatedTarget() const { return m_relatedTarget.get(); } void setRelatedTarget(EventTarget*); TouchEventContext* touchEventContext() const { return m_touchEventContext.get(); } TouchEventContext* ensureTouchEventContext(); HeapVector<Member<EventTarget>>& ensureEventPath(EventPath&); bool isInclusiveAncestorOf(const TreeScopeEventContext&) const; bool isDescendantOf(const TreeScopeEventContext&) const; #if ENABLE(ASSERT) bool isExclusivePartOf(const TreeScopeEventContext&) const; #endif void addChild(TreeScopeEventContext& child) { m_children.append(&child); } // For ancestor-descendant relationship check in O(1). // Preprocessing takes O(N). int calculateTreeOrderAndSetNearestAncestorClosedTree(int orderNumber, TreeScopeEventContext* nearestAncestorClosedTreeScopeEventContext); TreeScopeEventContext* containingClosedShadowTree() const { return m_containingClosedShadowTree.get(); } private: TreeScopeEventContext(TreeScope&); #if ENABLE(ASSERT) bool isUnreachableNode(EventTarget&); #endif bool isUnclosedTreeOf(const TreeScopeEventContext& other); Member<TreeScope> m_treeScope; Member<Node> m_rootNode; // Prevents TreeScope from being freed. TreeScope itself isn't RefCounted. Member<EventTarget> m_target; Member<EventTarget> m_relatedTarget; Member<HeapVector<Member<EventTarget>>> m_eventPath; Member<TouchEventContext> m_touchEventContext; Member<TreeScopeEventContext> m_containingClosedShadowTree; HeapVector<Member<TreeScopeEventContext>> m_children; int m_preOrder; int m_postOrder; }; #if ENABLE(ASSERT) inline bool TreeScopeEventContext::isUnreachableNode(EventTarget& target) { // FIXME: Checks also for SVG elements. return target.toNode() && !target.toNode()->isSVGElement() && !target.toNode()->treeScope().isInclusiveOlderSiblingShadowRootOrAncestorTreeScopeOf(treeScope()); } #endif inline void TreeScopeEventContext::setTarget(EventTarget* target) { ASSERT(target); ASSERT(!isUnreachableNode(*target)); m_target = target; } inline void TreeScopeEventContext::setRelatedTarget(EventTarget* relatedTarget) { ASSERT(relatedTarget); ASSERT(!isUnreachableNode(*relatedTarget)); m_relatedTarget = relatedTarget; } inline bool TreeScopeEventContext::isInclusiveAncestorOf(const TreeScopeEventContext& other) const { ASSERT(m_preOrder != -1 && m_postOrder != -1 && other.m_preOrder != -1 && other.m_postOrder != -1); return m_preOrder <= other.m_preOrder && other.m_postOrder <= m_postOrder; } inline bool TreeScopeEventContext::isDescendantOf(const TreeScopeEventContext& other) const { ASSERT(m_preOrder != -1 && m_postOrder != -1 && other.m_preOrder != -1 && other.m_postOrder != -1); return other.m_preOrder < m_preOrder && m_postOrder < other.m_postOrder; } #if ENABLE(ASSERT) inline bool TreeScopeEventContext::isExclusivePartOf(const TreeScopeEventContext& other) const { ASSERT(m_preOrder != -1 && m_postOrder != -1 && other.m_preOrder != -1 && other.m_postOrder != -1); return (m_preOrder < other.m_preOrder && m_postOrder < other.m_preOrder) || (m_preOrder > other.m_preOrder && m_preOrder > other.m_postOrder); } #endif } // namespace blink #endif // TreeScopeEventContext_h
/* * Copyright (C) 2010, 2011 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 AssociatedURLLoader_h #define AssociatedURLLoader_h #include "platform/heap/Handle.h" #include "public/platform/WebURLLoader.h" #include "public/web/WebURLLoaderOptions.h" #include "wtf/Noncopyable.h" #include "wtf/RefPtr.h" #include <memory> namespace blink { class DocumentThreadableLoader; class WebLocalFrameImpl; // This class is used to implement WebFrame::createAssociatedURLLoader. class AssociatedURLLoader final : public WebURLLoader { WTF_MAKE_NONCOPYABLE(AssociatedURLLoader); public: AssociatedURLLoader(WebLocalFrameImpl*, const WebURLLoaderOptions&); ~AssociatedURLLoader(); // WebURLLoader methods: void loadSynchronously(const WebURLRequest&, WebURLResponse&, WebURLError&, WebData&, int64_t& encodedDataLength) override; void loadAsynchronously(const WebURLRequest&, WebURLLoaderClient*) override; void cancel() override; void setDefersLoading(bool) override; void setLoadingTaskRunner(blink::WebTaskRunner*) override; // Called by |m_observer| to handle destruction of the Document associated // with the frame given to the constructor. void documentDestroyed(); // Called by ClientAdapter to handle completion of loading. void clientAdapterDone(); private: class ClientAdapter; class Observer; void cancelLoader(); void disposeObserver(); WebURLLoaderClient* releaseClient() { WebURLLoaderClient* client = m_client; m_client = nullptr; return client; } WebURLLoaderClient* m_client; WebURLLoaderOptions m_options; // An adapter which converts the DocumentThreadableLoaderClient method // calls into the WebURLLoaderClient method calls. std::unique_ptr<ClientAdapter> m_clientAdapter; std::unique_ptr<DocumentThreadableLoader> m_loader; // A ContextLifecycleObserver for cancelling |m_loader| when the Document // is detached. Persistent<Observer> m_observer; }; } // namespace blink #endif
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright 2015 Couchbase, 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. */ /* * memcached binary protocol packet validators */ #pragma once #include <array> #include <memcached/protocol_binary.h> #include "cookie.h" #include "function_chain.h" /* * The MCBP validator chains. * * Class stores a chain per opcode allowing a sequence of command validators to be * configured, stored and invoked. * */ class McbpValidatorChains { public: /* * Invoke the chain for the command */ protocol_binary_response_status invoke(protocol_binary_command command, const Cookie& cookie) { return commandChains[command].invoke(cookie); } /* * Silently ignores any attempt to push the same function onto the chain. */ void push_unique(protocol_binary_command command, protocol_binary_response_status(*f)(const Cookie&)) { commandChains[command].push_unique(makeFunction<protocol_binary_response_status, PROTOCOL_BINARY_RESPONSE_SUCCESS, const Cookie&>(f)); } /* * Initialize the memcached binary protocol validators */ static void initializeMcbpValidatorChains(McbpValidatorChains& chain); /* * Enable the collections functionality which adds extra validators to any * K/V command. */ static void enableCollections(McbpValidatorChains& chain); private: std::array<FunctionChain<protocol_binary_response_status, PROTOCOL_BINARY_RESPONSE_SUCCESS, const Cookie&>, 0x100> commandChains; };
/*ckwg +5 * Copyright 2013 by Kitware, Inc. All Rights Reserved. Please refer to * KITWARE_LICENSE.TXT for licensing information, or contact General Counsel, * Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065. */ #ifndef __vtkVgVideoModel_h #define __vtkVgVideoModel_h #include <vector> #include <vtkSmartPointer.h> #include <vgExport.h> #include <vtkVgVideoFrame.h> #include <vtkVgVideoSourceBase.h> #include "vtkVgModelBase.h" // Single entity that represents a video with optional child models. class VTKVG_MODELVIEW_EXPORT vtkVgVideoModel : public vtkVgModelBase { public: vtkVgClassMacro(vtkVgVideoModel); vtkTypeMacro(vtkVgVideoModel, vtkVgModelBase); // Description: // Use \c New() to create an instance of \c vtkVgVideoModel static vtkVgVideoModel* New(); virtual void PrintSelf(ostream& os, vtkIndent indent); // Description: // Set/Get \c vtkVgVideoSourceBase. void SetVideoSource(vtkVgVideoSourceBase* videoSource); vtkVgVideoSourceBase* GetVideoSource(); const vtkVgVideoSourceBase* GetVideoSource() const; // Description: // Seek video to the specified time stamp and update child models with the // result of the seek. virtual int Update(const vtkVgTimeStamp& timeStamp, const vtkVgTimeStamp* referenceFrameTimeStamp); using Superclass::Update; // Description: // Return current video frame. const vtkVgVideoFrame& GetCurrentVideoFrame() const; // Description: // Add a child model to this video model. The child model's time stamp will // be synchronized with the video. void AddChildModel(vtkVgModelBase* model); // Description: // Test if the specified model is a registered child model of this video // model. bool HasChildModel(vtkVgModelBase* model); // Description: // Return count of child models. size_t GetChildModelCount() const; // Description: // Return child model at specified index, or nullptr if index is not valid. vtkVgModelBase* GetChildModel(size_t index) const; // Description: // Remove specified child model. Return true if the model was removed, false // if the specified model is not a child of this video model. bool RemoveChildModel(vtkVgModelBase* model); // Description: // Remove child model at specified index. Return true if a model was removed, // false if the index is not valid. bool RemoveChildModel(size_t index); // Description: // Return the MTime for the last Update (that did something). virtual unsigned long GetUpdateTime(); protected: vtkVgVideoModel(); virtual ~vtkVgVideoModel(); void UpdateChildren(const vtkVgTimeStamp& timeStamp, const vtkVgTimeStamp* referenceFrameTimeStamp = 0); vtkSmartPointer<vtkVgVideoSourceBase> VideoSource; vtkVgVideoFrame CurrentVideoFrame; std::vector<vtkVgModelBase*> ChildModels; vtkTimeStamp UpdateTime; private: vtkVgVideoModel(const vtkVgVideoModel&); // Not implemented. void operator=(const vtkVgVideoModel&); // Not implemented. }; #endif // __vtkVgVideoModel_h
/*========================================================================= Program: Visualization Toolkit Module: vtkSmartPyObject.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm 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 vtkSmartPyObject // .SECTION Description // The vtkSmartPyObject class serves as a smart pointer for PyObjects. #ifndef vtkSmartPyObject_h #define vtkSmartPyObject_h // this must be included first #include "vtkPython.h" // PyObject can't be forward declared #include "vtkWrappingPythonCoreModule.h" class VTKWRAPPINGPYTHONCORE_EXPORT vtkSmartPyObject { public: // Description: // Creates a new vtkSmartPyObject managing the existing reference // to the object given vtkSmartPyObject(PyObject *obj = NULL); // Description: // Creates a new vtkSmartPyObject to the object in the other smart // pointer and increments the reference count to the object vtkSmartPyObject(const vtkSmartPyObject &other); // Description: // Decrements the reference count to the object ~vtkSmartPyObject(); // Description: // The internal pointer is copied from the other vtkSmartPyObject. // The reference count on the old object is decremented and the // reference count on the new object is incremented vtkSmartPyObject& operator=(const vtkSmartPyObject &other); // Description: // Sets the internal pointer to the given PyObject. The reference // count on the PyObject is incremented. To take a reference without // incrementing the reference count use TakeReference. vtkSmartPyObject& operator=(PyObject *obj); // Description: // Sets the internal pointer to the given PyObject without incrementing // the reference count void TakeReference(PyObject* obj); // Description: // Provides normal pointer target member access using operator ->. PyObject *operator->() const; // Description: // Get the contained pointer. operator PyObject*() const; // Description: // Returns true if the internal pointer is to a valid PyObject. operator bool() const; // Description: // Returns the pointer to a PyObject stored internally and clears the // internally stored pointer. The caller is responsible for calling // Py_DECREF on the returned object when finished with it as this // does not change the reference count. PyObject* ReleaseReference(); // Description: // Returns the internal pointer to a PyObject with no effect on its // reference count PyObject *GetPointer() const; // Description: // Returns the internal pointer to a PyObject and incrments its reference // count PyObject* GetAndIncreaseReferenceCount(); private: PyObject *Object; }; #endif
/** * @file test_sec6_1_1.c * @author Michal Vasko <mvasko@cesnet.cz> * @brief Cmocka test for RFC 6020 section 6.1.1. conformance. * * Copyright (c) 2016 CESNET, z.s.p.o. * * This source code is licensed under BSD 3-Clause License (the "License"). * You may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://opensource.org/licenses/BSD-3-Clause */ #include <stdio.h> #include <stdlib.h> #include <setjmp.h> #include <stdarg.h> #include <cmocka.h> #include "tests/config.h" #include "libyang.h" #define TEST_NAME test_sec6_1_1 #define TEST_SCHEMA "sec6_1_1/mod.yang" #define TEST_SCHEMA_FORMAT LYS_YANG #define TEST_SCHEMA_LOAD_FAIL 0 #define TEST_DATA "" #define TEST_DATA_LOAD_FAIL 0 struct state { struct ly_ctx *ctx; struct lyd_node *node; }; static int setup_f(void **state) { struct state *st; (*state) = st = calloc(1, sizeof *st); if (!st) { fprintf(stderr, "Memory allocation error"); return -1; } /* libyang context */ st->ctx = ly_ctx_new(NULL, 0); if (!st->ctx) { fprintf(stderr, "Failed to create context.\n"); return -1; } return 0; } static int teardown_f(void **state) { struct state *st = (*state); lyd_free(st->node); ly_ctx_destroy(st->ctx, NULL); free(st); (*state) = NULL; return 0; } static void TEST_NAME(void **state) { struct state *st = (*state); const struct lys_module *mod; mod = lys_parse_path(st->ctx, TESTS_DIR "/conformance/" TEST_SCHEMA, TEST_SCHEMA_FORMAT); if (TEST_SCHEMA_LOAD_FAIL) { assert_ptr_equal(mod, NULL); } else { assert_ptr_not_equal(mod, NULL); } if (TEST_DATA[0]) { st->node = lyd_parse_path(st->ctx, TESTS_DIR "/conformance/" TEST_DATA, LYD_XML, LYD_OPT_CONFIG); if (TEST_DATA_LOAD_FAIL) { assert_ptr_not_equal(st->node, NULL); } else { assert_ptr_equal(st->node, NULL); } } } int main(void) { const struct CMUnitTest tests[] = { cmocka_unit_test_setup_teardown(TEST_NAME, setup_f, teardown_f), }; return cmocka_run_group_tests(tests, NULL, NULL); }
/********************************************************************* * Software License Agreement (BSD License) * * Copyright (c) 2010, Rice University * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of the Rice 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 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. *********************************************************************/ /* Author: Ioan Sucan */ #ifndef OMPL_BASE_VALID_STATE_SAMPLER_ #define OMPL_BASE_VALID_STATE_SAMPLER_ #include "ompl/base/State.h" #include "ompl/util/ClassForward.h" #include "ompl/base/GenericParam.h" #include <boost/function.hpp> #include <boost/noncopyable.hpp> #include <string> namespace ompl { namespace base { /// @cond IGNORE OMPL_CLASS_FORWARD(SpaceInformation); /// @endcond /// @cond IGNORE /** \brief Forward declaration of ompl::base::ValidStateSampler */ OMPL_CLASS_FORWARD(ValidStateSampler); /// @endcond /** \class ompl::base::ValidStateSamplerPtr \brief A boost shared pointer wrapper for ompl::base::ValidStateSampler */ /** \brief Abstract definition of a state sampler. */ class ValidStateSampler : private boost::noncopyable { public: /** \brief Constructor */ ValidStateSampler(const SpaceInformation *si); virtual ~ValidStateSampler(); /** \brief Get the name of the sampler */ const std::string& getName() const { return name_; } /** \brief Set the name of the sampler */ void setName(const std::string &name) { name_ = name; } /** \brief Sample a state. Return false in case of failure */ virtual bool sample(State *state) = 0; /** \brief Sample a state near another, within specified distance. Return false, in case of failure. \note The memory for \e near must be disjoint from the memory for \e state */ virtual bool sampleNear(State *state, const State *near, const double distance) = 0; /** \brief Finding a valid sample usually requires performing multiple attempts. This call allows setting the number of such attempts. */ void setNrAttempts(unsigned int attempts) { attempts_ = attempts; } /** \brief Get the number of attempts to be performed by the sampling routine */ unsigned int getNrAttempts() const { return attempts_; } /** \brief Get the parameters for the valid state sampler */ ParamSet& params() { return params_; } /** \brief Get the parameters for the valid state sampler */ const ParamSet& params() const { return params_; } protected: /** \brief The state space this sampler samples */ const SpaceInformation *si_; /** \brief Number of attempts to find a valid sample */ unsigned int attempts_; /** \brief The name of the sampler */ std::string name_; /** \brief The parameters for this instance of the valid state sampler */ ParamSet params_; }; /** \brief Definition of a function that can allocate a valid state sampler */ typedef boost::function<ValidStateSamplerPtr(const SpaceInformation*)> ValidStateSamplerAllocator; } } #endif
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_CSS_INTERPOLATION_ENVIRONMENT_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_CSS_INTERPOLATION_ENVIRONMENT_H_ #include "third_party/blink/renderer/core/animation/interpolation_environment.h" #include "third_party/blink/renderer/core/css/resolver/style_resolver_state.h" namespace blink { class CascadeResolver; class ComputedStyle; class CSSVariableResolver; class StyleCascade; class CSSInterpolationEnvironment : public InterpolationEnvironment { public: explicit CSSInterpolationEnvironment(const InterpolationTypesMap& map, StyleResolverState& state, CSSVariableResolver* variable_resolver) : InterpolationEnvironment(map), state_(&state), style_(state.Style()), variable_resolver_(variable_resolver) {} explicit CSSInterpolationEnvironment(const InterpolationTypesMap& map, StyleResolverState& state, StyleCascade* cascade, CascadeResolver* cascade_resolver) : InterpolationEnvironment(map), state_(&state), style_(state.Style()), cascade_(cascade), cascade_resolver_(cascade_resolver) {} explicit CSSInterpolationEnvironment(const InterpolationTypesMap& map, const ComputedStyle& style) : InterpolationEnvironment(map), style_(&style) {} bool IsCSS() const final { return true; } StyleResolverState& GetState() { DCHECK(state_); return *state_; } const StyleResolverState& GetState() const { DCHECK(state_); return *state_; } const ComputedStyle& Style() const { DCHECK(style_); return *style_; } bool HasVariableResolver() const { DCHECK(!RuntimeEnabledFeatures::CSSCascadeEnabled()); return variable_resolver_; } // TODO(crbug.com/985023): This effective violates const. CSSVariableResolver& VariableResolver() const { DCHECK(!RuntimeEnabledFeatures::CSSCascadeEnabled()); DCHECK(HasVariableResolver()); return *variable_resolver_; } // TODO(crbug.com/985023): This effective violates const. const CSSValue* Resolve(const PropertyHandle&, const CSSValue*) const; private: StyleResolverState* state_ = nullptr; const ComputedStyle* style_ = nullptr; CSSVariableResolver* variable_resolver_ = nullptr; StyleCascade* cascade_ = nullptr; CascadeResolver* cascade_resolver_ = nullptr; }; template <> struct DowncastTraits<CSSInterpolationEnvironment> { static bool AllowFrom(const InterpolationEnvironment& value) { return value.IsCSS(); } }; } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_CSS_INTERPOLATION_ENVIRONMENT_H_
// 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 CONTENT_SHELL_COMMON_SHELL_CONTENT_CLIENT_H_ #define CONTENT_SHELL_COMMON_SHELL_CONTENT_CLIENT_H_ #include <string> #include <vector> #include "content/public/common/content_client.h" #include "content/shell/common/shell_origin_trial_policy.h" namespace content { class ShellContentClient : public ContentClient { public: ShellContentClient(); ~ShellContentClient() override; std::u16string GetLocalizedString(int message_id) override; base::StringPiece GetDataResource( int resource_id, ui::ResourceScaleFactor scale_factor) override; base::RefCountedMemory* GetDataResourceBytes(int resource_id) override; gfx::Image& GetNativeImageNamed(int resource_id) override; blink::OriginTrialPolicy* GetOriginTrialPolicy() override; void AddAdditionalSchemes(Schemes* schemes) override; private: ShellOriginTrialPolicy origin_trial_policy_; }; } // namespace content #endif // CONTENT_SHELL_COMMON_SHELL_CONTENT_CLIENT_H_
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MODE_INDICATOR_CONTROLLER_H_ #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MODE_INDICATOR_CONTROLLER_H_ #include "base/memory/scoped_ptr.h" #include "chromeos/ime/input_method_manager.h" namespace gfx { class Rect; } // namespace gfx namespace chromeos { namespace input_method { class ModeIndicatorWidget; // ModeIndicatorController is the controller of ModeIndicatiorWidget on the // MVC model. class ModeIndicatorController : public InputMethodManager::Observer { public: // This class takes the ownership of |mi_widget|. explicit ModeIndicatorController(ModeIndicatorWidget* mi_widget); virtual ~ModeIndicatorController(); // Set cursor location, which is the base point to display this indicator. // Bacisally this indicator is displayed underneath the cursor. void SetCursorLocation(const gfx::Rect& cursor_location); // Notify the focus state to the mode indicator. void FocusStateChanged(bool is_focused); private: // InputMethodManager::Observer implementation. virtual void InputMethodChanged(InputMethodManager* manager, bool show_message) OVERRIDE; virtual void InputMethodPropertyChanged(InputMethodManager* manager) OVERRIDE; // Show the mode inidicator with the current ime's short name if all // the conditions are cleared. void ShowModeIndicator(InputMethodManager* manager); scoped_ptr<ModeIndicatorWidget> mi_widget_; // True on a text field is focused. bool is_focused_; DISALLOW_COPY_AND_ASSIGN(ModeIndicatorController); }; } // namespace input_method } // namespace chromeos #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MODE_INDICATOR_CONTROLLER_H_
#pragma once // ======================================================================================= // ScoreRuleHelper // ======================================================================================= ///--------------------------------------------------------------------------------------- /// \brief This class is the embodiment of the score rules. A score to be set to a player /// can be calculated by this class based on scenario and module values. /// /// # ScoreRuleHelper /// Detailed description..... /// Created on: 22-2-2013 ///--------------------------------------------------------------------------------------- class ScoreRuleHelper { public: ScoreRuleHelper(); virtual ~ScoreRuleHelper(); ///----------------------------------------------------------------------------------- /// The score that the player gets by attaching a module. /// \param p_moduleValue /// \return int ///----------------------------------------------------------------------------------- static float scoreFromAttachModule(float p_moduleValue, bool p_moduleIsUnused); ///----------------------------------------------------------------------------------- /// The score that the player gets by hitting an enemy player with a weapon. /// \param p_opponentHitModuleValue /// \return int ///----------------------------------------------------------------------------------- static float scoreFromHittingOpponent(float p_opponentHitModuleValue); ///----------------------------------------------------------------------------------- /// Score that the player loses by detaching a module in edit mode /// \param p_moduleValue /// \return int ///----------------------------------------------------------------------------------- static float scoreFromLoseModuleOnDetach(float p_moduleValue); ///----------------------------------------------------------------------------------- /// The score that the player loses by losing a module when hit by an enemy weapon /// \param p_myHitModuleValue /// \return int ///----------------------------------------------------------------------------------- static float scoreFromLoseModuleOnEnemyHit(float p_myHitModuleValue); static float scoreFromDamagingOpponent(float p_damage); };
/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison interface for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ #ifndef YY_RE_YY_RE_GRAMMAR_H_INCLUDED # define YY_RE_YY_RE_GRAMMAR_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif #if YYDEBUG extern int re_yydebug; #endif /* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { _CHAR_ = 258, _ANY_ = 259, _RANGE_ = 260, _CLASS_ = 261, _WORD_CHAR_ = 262, _NON_WORD_CHAR_ = 263, _SPACE_ = 264, _NON_SPACE_ = 265, _DIGIT_ = 266, _NON_DIGIT_ = 267, _WORD_BOUNDARY_ = 268, _NON_WORD_BOUNDARY_ = 269 }; #endif /* Tokens. */ #define _CHAR_ 258 #define _ANY_ 259 #define _RANGE_ 260 #define _CLASS_ 261 #define _WORD_CHAR_ 262 #define _NON_WORD_CHAR_ 263 #define _SPACE_ 264 #define _NON_SPACE_ 265 #define _DIGIT_ 266 #define _NON_DIGIT_ 267 #define _WORD_BOUNDARY_ 268 #define _NON_WORD_BOUNDARY_ 269 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED union YYSTYPE { #line 70 "re_grammar.y" /* yacc.c:1909 */ int integer; uint32_t range; RE_NODE* re_node; uint8_t* class_vector; #line 89 "re_grammar.h" /* yacc.c:1909 */ }; typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif int re_yyparse (void *yyscanner, RE_LEX_ENVIRONMENT *lex_env); #endif /* !YY_RE_YY_RE_GRAMMAR_H_INCLUDED */
/* Copyright (c) 2011 Stanford University * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR(S) DISCLAIM ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL AUTHORS BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef RAMCLOUD_ATOMICINT_H #define RAMCLOUD_ATOMICINT_H namespace RAMCloud { /** * This class implements integers with atomic operations that are safe * for inter-thread synchronization. Note: these operations do not deal * with instruction reordering issues; they simply provide basic atomic * reading and writing. Proper synchronization also requires the use of * facilities such as those provided by the \c Fence class. * * As of 6/2011 this class is significantly faster than the C++ atomic_int * class, because the C++ facilities incorporate expensive fence operations. */ class AtomicInt { public: /** * Construct an AtomicInt. * * \param value * Initial value for the integer. */ explicit AtomicInt(int value = 0) : value(value) { } /** * Atomically add to the value of the integer. * * \param increment * How much to add to the value of the integer. */ void add(int increment) { __asm__ __volatile__("lock; addl %1,%0" : "=m" (value) : "r" (increment)); } /** * Atomically compare the value of the integer with a test value and, * if the values match, replace the value of the integer with a new * value. * * \param test * Replace the value only if its current value equals this. * \param newValue * This value will replace the current value of the integer. * \result * The previous value of the integer. */ int compareExchange(int test, int newValue) { __asm__ __volatile__("lock; cmpxchgl %0,%1" : "=r" (newValue), "=m" (value), "=a" (test) : "0" (newValue), "2" (test)); return test; } /** * Atomically replace the value of the integer while returning its * old value. * * \param newValue * This value will replace the current value of the integer. * \result * The previous value of the integer. */ int exchange(int newValue) { __asm__ __volatile__("xchg %0,%1" : "=r" (newValue), "=m" (value) : "0" (newValue)); return newValue; } /** * Atomically increment the value of the integer. */ void inc() { __asm__ __volatile__("lock; incl %0" : "=m" (value)); } /** * Return the current value of the integer. */ int load() { return value; } /** * Assign to an AtomicInt. * * \param newValue * This value will replace the current value of the integer. * \return * The new value. */ AtomicInt& operator=(int newValue) { store(newValue); return *this; } /** * Return the current value of the integer. */ operator int() { return load(); } /** * Increment the current value of the integer. */ AtomicInt& operator++() { inc(); return *this; } AtomicInt operator++(int) // NOLINT { inc(); return *this; } /** * Decrement the current value of the integer. */ AtomicInt& operator--() { add(-1); return *this; } AtomicInt operator--(int) // NOLINT { add(-1); return *this; } /** * Set the value of the integer. * * \param newValue * This value will replace the current value of the integer. */ void store(int newValue) { value = newValue; } PRIVATE: // The integer value on which the atomic operations operate. volatile int value; }; } // end RAMCloud #endif // RAMCLOUD_ATOMICINT_H
#pragma once #define LOG(...) APP_LOG(APP_LOG_LEVEL_DEBUG, __VA_ARGS__) typedef struct Simply Simply; struct Simply { struct SimplyAccel *accel; struct SimplySplash *splash; struct SimplyUi *ui; };
#if !BIT_IDENTICAL_FLOATING_POINT #include "ieee754names.h" #include "../../third-party/fdlibm/e_hypot.c" #endif
#include <string.h> #include "NiKomStr.h" #include "StringUtils.h" #include "CommandParser.h" extern struct System *Servermem; struct LangCommand *ChooseLangCommand(struct Kommando *cmd, int lang) { return cmd->langCmd[lang].name[0] ? &cmd->langCmd[lang] : &cmd->langCmd[0]; } /* * Parses the given str as a command line command for the given language. The * result array is populated with pointers to struct Kommando instances of the matching * commands. Up to 50 pointers may be populated so the array must be large enough to * hold this. The actual number of matched commands (and hence pointers populated in the * result array) is returned from the function. * * If a pointer to a user is provided commands that are secret will not be included if * the user doesn't have permission to execute them. * * If a argbuf pointer is provided and the number of matched commands is 1 the arguments * to the given command is copied from the commandline into the argbuf array and the global * "argument" variable is set to point to argbuf. * * Apart from the number of matched commands the following values can also be returned. * -1 - The input string is empty. * -2 - The input string is a number (which usually is interpreted as a text number) */ int ParseCommand(char *str, int lang, struct User *user, struct Kommando *result[], char *argbuf) { int argType, timeSinceFirstLogin, matchedCommands = 0; char *str2 = NULL, *word2, *argument; struct Kommando *cmd; struct LangCommand *langCmd; if(user != NULL) { timeSinceFirstLogin = time(NULL) - user->forst_in; } if(str[0] == 0) { return -1; } if(str[0] >= '0' && str[0] <= '9') { return -2; } str2 = FindNextWord(str); if(IzDigit(str2[0])) { argType = KOMARGNUM; } else if(!str2[0]) { argType = KOMARGINGET; } else { argType = KOMARGCHAR; } ITER_EL(cmd, Servermem->cfg->kom_list, kom_node, struct Kommando *) { if(cmd->secret && user != NULL) { if(cmd->status > user->status) continue; if(cmd->minlogg > user->loggin) continue; if(cmd->mindays * 86400 > timeSinceFirstLogin) continue; if(cmd->grupper && !(cmd->grupper & user->grupper)) continue; } langCmd = ChooseLangCommand(cmd, lang); if(langCmd->name[0] && InputMatchesWord(str, langCmd->name)) { word2 = FindNextWord(langCmd->name); if((langCmd->words == 2 && InputMatchesWord(str2, word2) && str2[0]) || langCmd->words == 1) { if(langCmd->words == 1) { if(cmd->argument == KOMARGNUM && argType == KOMARGCHAR) continue; if(cmd->argument == KOMARGINGET && argType != KOMARGINGET) continue; } result[matchedCommands++] = cmd; if(matchedCommands == 50) { break; } } } } if(matchedCommands == 1 && argbuf != NULL) { argument = FindNextWord(str); if(ChooseLangCommand(result[0], lang)->words == 2) { argument = FindNextWord(argument); } memset(argbuf, 0, 1081); strncpy(argbuf, argument, 1080); } return matchedCommands; } int HasUserCmdPermission(struct Kommando *cmd, struct User *user) { if(cmd->status > user->status || cmd->minlogg > user->loggin || cmd->mindays * 86400 > (time(NULL) - user->forst_in) || (cmd->grupper && !(cmd->grupper & user->grupper))) { return 0; } return 1; }
//%LICENSE//////////////////////////////////////////////////////////////// // // Licensed to The Open Group (TOG) under one or more contributor license // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with // this work for additional information regarding copyright ownership. // Each contributor licenses this file to you under the OpenPegasus Open // Source License; you may not use this file except in compliance with the // License. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // ////////////////////////////////////////////////////////////////////////// // //%///////////////////////////////////////////////////////////////////////// #ifndef __UNIX_QUERYCONDITION_H #define __UNIX_QUERYCONDITION_H #include "CIM_PolicyCondition.h" #include "UNIX_QueryConditionDeps.h" #define PROPERTY_QUERY_RESULT_NAME "QueryResultName" #define PROPERTY_QUERY "Query" #define PROPERTY_QUERY_LANGUAGE "QueryLanguage" #define PROPERTY_TRIGGER "Trigger" class UNIX_QueryCondition : public CIM_PolicyCondition { public: UNIX_QueryCondition(); ~UNIX_QueryCondition(); virtual Boolean initialize(); virtual Boolean load(int&); virtual Boolean finalize(); virtual Boolean find(Array<CIMKeyBinding>&); virtual Boolean validateKey(CIMKeyBinding&) const; virtual void setScope(CIMName); virtual Boolean getInstanceID(CIMProperty&) const; virtual String getInstanceID() const; virtual Boolean getCaption(CIMProperty&) const; virtual String getCaption() const; virtual Boolean getDescription(CIMProperty&) const; virtual String getDescription() const; virtual Boolean getElementName(CIMProperty&) const; virtual String getElementName() const; virtual Boolean getCommonName(CIMProperty&) const; virtual String getCommonName() const; virtual Boolean getPolicyKeywords(CIMProperty&) const; virtual Array<String> getPolicyKeywords() const; virtual Boolean getSystemCreationClassName(CIMProperty&) const; virtual String getSystemCreationClassName() const; virtual Boolean getSystemName(CIMProperty&) const; virtual String getSystemName() const; virtual Boolean getPolicyRuleCreationClassName(CIMProperty&) const; virtual String getPolicyRuleCreationClassName() const; virtual Boolean getPolicyRuleName(CIMProperty&) const; virtual String getPolicyRuleName() const; virtual Boolean getCreationClassName(CIMProperty&) const; virtual String getCreationClassName() const; virtual Boolean getPolicyConditionName(CIMProperty&) const; virtual String getPolicyConditionName() const; virtual Boolean getQueryResultName(CIMProperty&) const; virtual String getQueryResultName() const; virtual Boolean getQuery(CIMProperty&) const; virtual String getQuery() const; virtual Boolean getQueryLanguage(CIMProperty&) const; virtual Uint16 getQueryLanguage() const; virtual Boolean getTrigger(CIMProperty&) const; virtual Boolean getTrigger() const; private: CIMName currentScope; # include "UNIX_QueryConditionPrivate.h" }; #endif /* UNIX_QUERYCONDITION */
// This code contains NVIDIA Confidential Information and is disclosed to you // under a form of NVIDIA software license agreement provided separately to you. // // Notice // NVIDIA Corporation and its licensors retain all intellectual property and // proprietary rights in and to this software and related documentation and // any modifications thereto. Any use, reproduction, disclosure, or // distribution of this software and related documentation without an express // license agreement from NVIDIA Corporation is strictly prohibited. // // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. // // Information and code furnished is believed to be accurate and reliable. // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such // information or for any infringement of patents or other rights of third parties that may // result from its use. No license is granted by implication or otherwise under any patent // or patent rights of NVIDIA Corporation. Details are subject to change without notice. // This code supersedes and replaces all information previously supplied. // NVIDIA Corporation products are not authorized for use as critical // components in life support devices or systems without express written approval of // NVIDIA Corporation. // // Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved. #ifndef OGL_RENDERER_DIRECTIONAL_LIGHT_H #define OGL_RENDERER_DIRECTIONAL_LIGHT_H #include <RendererConfig.h> #if defined(RENDERER_ENABLE_OPENGL) #include <RendererDirectionalLight.h> #include "OGLRenderer.h" namespace SampleRenderer { class RendererDirectionalLightDesc; class OGLRendererDirectionalLight : public RendererDirectionalLight { public: OGLRendererDirectionalLight(const RendererDirectionalLightDesc &desc, OGLRenderer &renderer); virtual ~OGLRendererDirectionalLight(void); virtual void bind(void) const; private: #if defined(RENDERER_ENABLE_CG) const OGLRenderer::CGEnvironment &m_cgenv; #endif }; } // namespace SampleRenderer #endif // #if defined(RENDERER_ENABLE_OPENGL) #endif
#include "../intern.h" #ifdef __cplusplus extern "C" { #endif int __islower (int c) { return ((unsigned)c - 'a') < 26; } int islower (int c) \ _WEAK_ALIAS_OF("__islower"); #ifdef __cplusplus } #endif
#ifndef JV_ALLOC_H #define JV_ALLOC_H #include <stddef.h> #include "jv.h" #ifndef NDEBUG extern volatile char jv_mem_uninitialised; #endif static void jv_mem_invalidate(void* mem, size_t n) { #ifndef NDEBUG char* m = mem; while (n--) *m++ ^= jv_mem_uninitialised ^ jv_mem_uninitialised; #endif } void* jv_mem_alloc(size_t); void* jv_mem_alloc_unguarded(size_t); void* jv_mem_calloc(size_t, size_t); void* jv_mem_calloc_unguarded(size_t, size_t); char* jv_mem_strdup(const char *); char* jv_mem_strdup_unguarded(const char *); void jv_mem_free(void*); __attribute__((warn_unused_result)) void* jv_mem_realloc(void*, size_t); #endif
#ifndef _fundo #define _fundo #include <allegro.h> #include "tela.h" #include "pacman.h" #define TAM_TILE 8 #define MAX_TILE 35 #define TAM_LISTA 288 / TAM_TILE * 224 / TAM_TILE extern char mapaFundo[288 / TAM_TILE][224 / TAM_TILE]; extern char mapaAux[288 / TAM_TILE][224 / TAM_TILE]; extern BITMAP *tiles[MAX_TILE]; void inicia_fundo(); void inicia_tiles(); void le_fundo(); void desenha_fundo(); int bloqueado(int x, int y); void come_pilula(); #endif
// // CircularProgressView.h // CircularDotProgressDemo // // Created by 郭伟林 on 17/2/16. // Copyright © 2017年 SR. All rights reserved. // #import <UIKit/UIKit.h> @interface CircularDotProgressView : UIView @property (nonatomic, assign) CGFloat progress; @property (nonatomic, strong) UIColor *progressTintColor; - (void)setProgress:(CGFloat)progress animated:(BOOL)animated; @end
/* * Generated by class-dump 3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2012 by Steve Nygard. */ #import "NSView.h" @interface IDEWelcomeWindowLozengeView : NSView { } - (void)_updateTransientControlVisibility; - (void)drawRect:(struct CGRect)arg1; - (void)keyDown:(id)arg1; - (void)mouseEntered:(id)arg1; - (void)mouseExited:(id)arg1; @end
#include "f2c.h" #include "blaswrap.h" /* Table of constant values */ static integer c__1 = 1; /* Subroutine */ int zptcon_(integer *n, doublereal *d__, doublecomplex *e, doublereal *anorm, doublereal *rcond, doublereal *rwork, integer * info) { /* System generated locals */ integer i__1; doublereal d__1; /* Builtin functions */ double z_abs(doublecomplex *); /* Local variables */ integer i__, ix; extern integer idamax_(integer *, doublereal *, integer *); extern /* Subroutine */ int xerbla_(char *, integer *); doublereal ainvnm; /* -- LAPACK routine (version 3.1) -- */ /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ /* November 2006 */ /* .. Scalar Arguments .. */ /* .. */ /* .. Array Arguments .. */ /* .. */ /* Purpose */ /* ======= */ /* ZPTCON computes the reciprocal of the condition number (in the */ /* 1-norm) of a complex Hermitian positive definite tridiagonal matrix */ /* using the factorization A = L*D*L**H or A = U**H*D*U computed by */ /* ZPTTRF. */ /* Norm(inv(A)) is computed by a direct method, and the reciprocal of */ /* the condition number is computed as */ /* RCOND = 1 / (ANORM * norm(inv(A))). */ /* Arguments */ /* ========= */ /* N (input) INTEGER */ /* The order of the matrix A. N >= 0. */ /* D (input) DOUBLE PRECISION array, dimension (N) */ /* The n diagonal elements of the diagonal matrix D from the */ /* factorization of A, as computed by ZPTTRF. */ /* E (input) COMPLEX*16 array, dimension (N-1) */ /* The (n-1) off-diagonal elements of the unit bidiagonal factor */ /* U or L from the factorization of A, as computed by ZPTTRF. */ /* ANORM (input) DOUBLE PRECISION */ /* The 1-norm of the original matrix A. */ /* RCOND (output) DOUBLE PRECISION */ /* The reciprocal of the condition number of the matrix A, */ /* computed as RCOND = 1/(ANORM * AINVNM), where AINVNM is the */ /* 1-norm of inv(A) computed in this routine. */ /* RWORK (workspace) DOUBLE PRECISION array, dimension (N) */ /* INFO (output) INTEGER */ /* = 0: successful exit */ /* < 0: if INFO = -i, the i-th argument had an illegal value */ /* Further Details */ /* =============== */ /* The method used is described in Nicholas J. Higham, "Efficient */ /* Algorithms for Computing the Condition Number of a Tridiagonal */ /* Matrix", SIAM J. Sci. Stat. Comput., Vol. 7, No. 1, January 1986. */ /* ===================================================================== */ /* .. Parameters .. */ /* .. */ /* .. Local Scalars .. */ /* .. */ /* .. External Functions .. */ /* .. */ /* .. External Subroutines .. */ /* .. */ /* .. Intrinsic Functions .. */ /* .. */ /* .. Executable Statements .. */ /* Test the input arguments. */ /* Parameter adjustments */ --rwork; --e; --d__; /* Function Body */ *info = 0; if (*n < 0) { *info = -1; } else if (*anorm < 0.) { *info = -4; } if (*info != 0) { i__1 = -(*info); xerbla_("ZPTCON", &i__1); return 0; } /* Quick return if possible */ *rcond = 0.; if (*n == 0) { *rcond = 1.; return 0; } else if (*anorm == 0.) { return 0; } /* Check that D(1:N) is positive. */ i__1 = *n; for (i__ = 1; i__ <= i__1; ++i__) { if (d__[i__] <= 0.) { return 0; } /* L10: */ } /* Solve M(A) * x = e, where M(A) = (m(i,j)) is given by */ /* m(i,j) = abs(A(i,j)), i = j, */ /* m(i,j) = -abs(A(i,j)), i .ne. j, */ /* and e = [ 1, 1, ..., 1 ]'. Note M(A) = M(L)*D*M(L)'. */ /* Solve M(L) * x = e. */ rwork[1] = 1.; i__1 = *n; for (i__ = 2; i__ <= i__1; ++i__) { rwork[i__] = rwork[i__ - 1] * z_abs(&e[i__ - 1]) + 1.; /* L20: */ } /* Solve D * M(L)' * x = b. */ rwork[*n] /= d__[*n]; for (i__ = *n - 1; i__ >= 1; --i__) { rwork[i__] = rwork[i__] / d__[i__] + rwork[i__ + 1] * z_abs(&e[i__]); /* L30: */ } /* Compute AINVNM = max(x(i)), 1<=i<=n. */ ix = idamax_(n, &rwork[1], &c__1); ainvnm = (d__1 = rwork[ix], abs(d__1)); /* Compute the reciprocal condition number. */ if (ainvnm != 0.) { *rcond = 1. / ainvnm / *anorm; } return 0; /* End of ZPTCON */ } /* zptcon_ */
#include "includes.prl" #include <intuition/intuition.h> #include <graphics/gfxbase.h> #include <graphics/gfxmacros.h> #include <hardware/custom.h> extern struct GfxBase *GfxBase; extern struct ViewPort view_port1; extern struct ViewPort view_port2; extern struct ViewPort view_port3; UWORD mixRGB4Colors(UWORD A, UWORD B, UBYTE n) { UWORD r,g,b, x,y,z; if (n == 0) return A; if (n >= 15) return B; x = (B & 0x0f00) >> 8; y = (B & 0x00f0) >> 4; z = B & 0x000f; x *= n; y *= n; z *= n; n = 15 - n; r = (A & 0x0f00) >> 8; g = (A & 0x00f0) >> 4; b = A & 0x000f; r *= n; g *= n; b *= n; r += x; g += y; b += z; r >>= 4; g >>= 4; b >>= 4; if (r > 0xf) r = 0xf; if (g > 0xf) g = 0xf; if (b > 0xf) b = 0xf; r = r & 0xf; g = g & 0xf; b = b & 0xf; return (UWORD)((r << 8) | (g << 4) | b); } ULONG RGB4toRGB8(UWORD A) { ULONG r,g,b; r = ((ULONG)(A & 0x0f00)) << 12; g = (A & 0x00f0) << 8; b = (A & 0x000f) << 4; return (ULONG)(r|g|b); } UWORD RGB8toRGB4(ULONG A) { UWORD r,g,b; r = (A & 0xF00000) >> 12; // ((ULONG)(A & 0x0f00)) << 12; g = (A & 0x00F000) >> 8; b = (A & 0x00F0) >> 4; return (UWORD)(r|g|b); } ULONG addRGB8Colors(ULONG A, ULONG B) { ULONG r,g,b, x,y,z; x = (B & 0xff0000) >> 16; y = (B & 0x00ff00) >> 8; z = B & 0x000ff; r = (A & 0xff0000) >> 16; g = (A & 0x00ff00) >> 8; b = A & 0x0000ff; r += x; g += y; b += z; if (r > 0xFF) r = 0xFF; if (g > 0xFF) g = 0xFF; if (b > 0xFF) b = 0xFF; return (r << 16) | (g << 8) | b; } ULONG divideRGB8Color(ULONG A, UWORD n) { ULONG r,g,b; if (n == 0) return A; r = (A & 0xff0000) >> 16; g = (A & 0x00ff00) >> 8; b = A & 0x0000ff; r /= n; g /= n; b /= n; return (r << 16) | (g << 8) | b; } ULONG mixRGB8Colors(ULONG A, ULONG B, USHORT n) { ULONG r,g,b, x,y,z; if (n == 0) return A; if (n >= 255) return B; x = (B & 0xff0000) >> 16; y = (B & 0x00ff00) >> 8; z = B & 0x000ff; x *= n; y *= n; z *= n; n = 255 - n; r = (A & 0xff0000) >> 16; g = (A & 0x00ff00) >> 8; b = A & 0x0000ff; r *= n; g *= n; b *= n; r += x; g += y; b += z; r >>= 8; g >>= 8; b >>= 8; if (r > 0xff) r = 0xff; if (g > 0xff) g = 0xff; if (b > 0xff) b = 0xff; r = r & 0xff; g = g & 0xff; b = b & 0xff; return (r << 16) | (g << 8) | b; } void fadeRGB4Palette(struct ViewPort *vp, UWORD *pal, UWORD pal_size, UWORD fade) { UBYTE i; UWORD col; for(i = 0; i < pal_size; i++) { col = mixRGB4Colors(pal[i], 0x000, fade); SetRGB4(vp, i, (col & 0x0f00) >> 8, (col & 0x00f0) >> 4, col & 0x000f); } } void fadeRGB4PaletteToRGB8Color(struct ViewPort *vp, UWORD *pal, UWORD pal_size, ULONG rgb8color, UWORD fade) { UBYTE i; UWORD col; for(i = 0; i < pal_size; i++) { col = mixRGB8Colors(RGB4toRGB8(pal[i]), rgb8color, fade); col = RGB8toRGB4(col); SetRGB4(vp, i, (col & 0x0f00) >> 8, (col & 0x00f0) >> 4, col & 0x000f); } }
// This code is a part of 'Storage Processor' product. // Copyright (C) Scientific Software 2006 // All rights reserved. // File name: SerializeDataFactory.h // Description: The CSerializeDataFactory declaration. #ifndef SERIALIZEDATAFACTORY_H__PROCESSTOOL__INCLUDED_ #define SERIALIZEDATAFACTORY_H__PROCESSTOOL__INCLUDED_ class SerializeDataFactory { public: static result Serialize(const StringA& fileName, IDataFactory* piDataFactory, bool loading) { result resultCode = S_OK; if (loading) { FILEDev fileDev; result resultCode = fileDev.Open(fileName.c_str(), ModeRead); if (FAILED(resultCode)) return resultCode; resultCode = Load(fileDev, piDataFactory); fileDev.Close(); } else { FILEDev fileDev; result resultCode = fileDev.Open(fileName.c_str(), ModeWrite); if (FAILED(resultCode)) return resultCode; resultCode = Store(fileDev, piDataFactory); fileDev.Close(); } return resultCode; } private: // Internal serialization helpers static result Store(FILEDev& fileDev, IDataFactory* piDataFactory) { fprintf(fileDev, "%d\n", piDataFactory->GetDataLength()); for (uint i = 0;i < piDataFactory->GetDataLength();i++) fprintf(fileDev, "%f ", piDataFactory->GetItemData(i)); return S_OK; } static result Load(FILEDev& fileDev, IDataFactory* piDataFactory) { uint dataLength = 0; fscanf(fileDev, "%d", &dataLength); piDataFactory->CreateFactory(dataLength); for (uint i = 0;i < piDataFactory->GetDataLength();i++) { float dataItem = 0.0f; fscanf(fileDev, "%f", &dataItem); piDataFactory->SetItemData(i, dataItem); } return S_OK; } }; #endif // !SERIALIZEDATAFACTORY_H__PROCESSTOOL__INCLUDED_
// // Created by Dani Postigo on 6/19/14. // #import <Foundation/Foundation.h> @interface NSObject (Delay) - (void)performBlock:(void (^)())block withDelay:(double)delay; @end
//---------------------------------------------------------------------------- // 프로그램명 : // // 만든이 : Cho Han Cheol // // 날 짜 : 2013. 1. 21. // // 최종 수정 : // // MPU_Type : // // 파일명 : Hw_VCom_Q.c //---------------------------------------------------------------------------- //----- 헤더파일 열기 // #define HW_VCOM_Q_LOCAL #include "drv_vcom_q.h" /*--------------------------------------------------------------------------- TITLE : Hw_VCom_Q_Init WORK : ARG : void RET : void ---------------------------------------------------------------------------*/ void Hw_VCom_Q_Init( void ) { u8 i; for( i=0; i<HW_VCOM_Q_CH_MAX; i++ ) { Hw_VCom_Q_Start[i] = Hw_VCom_Q_End[i] = 0; } } /*--------------------------------------------------------------------------- TITLE : HW_VCOM_Q_SIZE WORK : ARG : void RET : void ---------------------------------------------------------------------------*/ u32 HW_VCOM_Q_SIZE( u8 Ch ) { return (Hw_VCom_Q_Start[Ch] - Hw_VCom_Q_End[Ch] + HW_VCOM_Q_BUFFER_MAX) % HW_VCOM_Q_BUFFER_MAX; } /*--------------------------------------------------------------------------- TITLE : HW_VCOM_Q_VAILD WORK : ARG : void RET : void ---------------------------------------------------------------------------*/ u32 HW_VCOM_Q_VAILD( u8 Ch ) { return HW_VCOM_Q_SIZE(Ch); } /*--------------------------------------------------------------------------- TITLE : Hw_VCom_Q_PushReady WORK : ARG : void RET : void ---------------------------------------------------------------------------*/ u32 Hw_VCom_Q_PushReady( u8 Ch ) { if( Hw_VCom_Q_Size[Ch] < HW_VCOM_Q_BUFFER_MAX ) return TRUE; else return FALSE; } /*--------------------------------------------------------------------------- TITLE : Hw_VCom_Q_Push WORK : ARG : void RET : void ---------------------------------------------------------------------------*/ u8 Hw_VCom_Q_Push( u8 Ch, u8 *PushData ) { if (HW_VCOM_Q_SIZE(Ch) == (HW_VCOM_Q_BUFFER_MAX-1)) return FALSE; Hw_VCom_Q_Buffer[Ch][Hw_VCom_Q_Start[Ch]++] = *PushData; Hw_VCom_Q_Start[Ch] %= HW_VCOM_Q_BUFFER_MAX; return TRUE; } /*--------------------------------------------------------------------------- TITLE : Hw_VCom_Q_Push WORK : ARG : void RET : void ---------------------------------------------------------------------------*/ u8 Hw_VCom_Q_Pop( u8 Ch, u8 *pData ) { if (HW_VCOM_Q_SIZE(Ch) == 0) return FALSE; *pData = Hw_VCom_Q_Buffer[Ch][Hw_VCom_Q_End[Ch]++]; Hw_VCom_Q_End[Ch] %= HW_VCOM_Q_BUFFER_MAX; return TRUE; }
/*----------------------------------------------------------------------------- | Copyright (c) 2013, Nucleic Development Team. | | Distributed under the terms of the Modified BSD License. | | The full license is in the file COPYING.txt, distributed with this software. |----------------------------------------------------------------------------*/ #pragma once #define KIWI_MAJOR_VERSION 0 #define KIWI_MINOR_VERSION 1 #define KIWI_MICRO_VERSION 1 #define KIWI_VERSION_HEX 0x000101 #define KIWI_VERSION "0.1.1"
// // TPDWazeMapsApp.h // TPDMapsAppTest // // Created by Mark Ferlatte on 9/11/13. // Copyright © 2013 Tetherpad. All rights reserved. // #import "TPDMapsApp.h" /** The TPDMapsApp representing the Waze application. */ @interface TPDWazeMapsApp : TPDMapsApp @end
// Copyright (c) 2015 RAMBLER&Co // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #import <Nimbus/NimbusModels.h> @class EventPlainObject; @interface EventInfoTableViewCellObject : NSObject <NICellObject> @property (nonatomic, strong, readonly) NSString *date; @property (nonatomic, strong, readonly) NSString *eventTitle; @property (nonatomic, strong, readonly) NSString *eventSubTitle; + (instancetype)objectWithEvent:(EventPlainObject *)event andDate:(NSString *)date; @end
#include <stdio.h> #include <unistd.h> #include <assert.h> #include <fcntl.h> #include "bam.h" #ifdef _USE_KNETFILE #include "knetfile.h" #endif int bam_taf2baf(int argc, char *argv[]); int bam_mpileup(int argc, char *argv[]); int bam_merge(int argc, char *argv[]); int bam_index(int argc, char *argv[]); int bam_sort(int argc, char *argv[]); int bam_tview_main(int argc, char *argv[]); int bam_mating(int argc, char *argv[]); int bam_rmdup(int argc, char *argv[]); int bam_flagstat(int argc, char *argv[]); int bam_fillmd(int argc, char *argv[]); int bam_idxstats(int argc, char *argv[]); int main_samview(int argc, char *argv[]); int main_import(int argc, char *argv[]); int main_reheader(int argc, char *argv[]); int main_cut_target(int argc, char *argv[]); int main_phase(int argc, char *argv[]); int main_cat(int argc, char *argv[]); int main_depth(int argc, char *argv[]); int main_qa(int argc, char* argv[]); int main_bam2fq(int argc, char *argv[]); int main_pad2unpad(int argc, char *argv[]); int faidx_main(int argc, char *argv[]); static int usage() { fprintf(stderr, "\n"); fprintf(stderr, "Program: samtools (Tools for alignments in the SAM format)\n"); fprintf(stderr, "Version: %s\n\n", BAM_VERSION); fprintf(stderr, "Usage: samtools <command> [options]\n\n"); fprintf(stderr, "Command: view SAM<->BAM conversion\n"); fprintf(stderr, " sort sort alignment file\n"); fprintf(stderr, " mpileup multi-way pileup\n"); fprintf(stderr, " depth compute the depth\n"); fprintf(stderr, " faidx index/extract FASTA\n"); #if _CURSES_LIB != 0 fprintf(stderr, " tview text alignment viewer\n"); #endif fprintf(stderr, " index index alignment\n"); fprintf(stderr, " idxstats BAM index stats (r595 or later)\n"); fprintf(stderr, " fixmate fix mate information\n"); fprintf(stderr, " flagstat simple stats\n"); fprintf(stderr, " calmd recalculate MD/NM tags and '=' bases\n"); fprintf(stderr, " merge merge sorted alignments\n"); fprintf(stderr, " rmdup remove PCR duplicates\n"); fprintf(stderr, " reheader replace BAM header\n"); fprintf(stderr, " qa quality control\n"); fprintf(stderr, " cat concatenate BAMs\n"); fprintf(stderr, " targetcut cut fosmid regions (for fosmid pool only)\n"); fprintf(stderr, " phase phase heterozygotes\n"); // fprintf(stderr, " depad convert padded BAM to unpadded BAM\n"); // not stable fprintf(stderr, "\n"); #ifdef _WIN32 fprintf(stderr, "\ Note: The Windows version of SAMtools is mainly designed for read-only\n\ operations, such as viewing the alignments and generating the pileup.\n\ Binary files generated by the Windows version may be buggy.\n\n"); #endif return 1; } int main(int argc, char *argv[]) { #ifdef _WIN32 setmode(fileno(stdout), O_BINARY); setmode(fileno(stdin), O_BINARY); #ifdef _USE_KNETFILE knet_win32_init(); #endif #endif if (argc < 2) return usage(); if (strcmp(argv[1], "view") == 0) return main_samview(argc-1, argv+1); else if (strcmp(argv[1], "import") == 0) return main_import(argc-1, argv+1); else if (strcmp(argv[1], "mpileup") == 0) return bam_mpileup(argc-1, argv+1); else if (strcmp(argv[1], "merge") == 0) return bam_merge(argc-1, argv+1); else if (strcmp(argv[1], "sort") == 0) return bam_sort(argc-1, argv+1); else if (strcmp(argv[1], "index") == 0) return bam_index(argc-1, argv+1); else if (strcmp(argv[1], "idxstats") == 0) return bam_idxstats(argc-1, argv+1); else if (strcmp(argv[1], "faidx") == 0) return faidx_main(argc-1, argv+1); else if (strcmp(argv[1], "fixmate") == 0) return bam_mating(argc-1, argv+1); else if (strcmp(argv[1], "rmdup") == 0) return bam_rmdup(argc-1, argv+1); else if (strcmp(argv[1], "flagstat") == 0) return bam_flagstat(argc-1, argv+1); else if (strcmp(argv[1], "calmd") == 0) return bam_fillmd(argc-1, argv+1); else if (strcmp(argv[1], "fillmd") == 0) return bam_fillmd(argc-1, argv+1); else if (strcmp(argv[1], "reheader") == 0) return main_reheader(argc-1, argv+1); else if (strcmp(argv[1], "cat") == 0) return main_cat(argc-1, argv+1); else if (strcmp(argv[1], "targetcut") == 0) return main_cut_target(argc-1, argv+1); else if (strcmp(argv[1], "phase") == 0) return main_phase(argc-1, argv+1); else if (strcmp(argv[1], "depth") == 0) return main_depth(argc-1, argv+1); else if (strcmp(argv[1], "bam2fq") == 0) return main_bam2fq(argc-1, argv+1); else if (strcmp(argv[1], "pad2unpad") == 0) return main_pad2unpad(argc-1, argv+1); else if (strcmp(argv[1], "depad") == 0) return main_pad2unpad(argc-1, argv+1); else if (strcmp(argv[1], "pileup") == 0) { fprintf(stderr, "[main] The `pileup' command has been removed. Please use `mpileup' instead.\n"); return 1; } #if _CURSES_LIB != 0 else if (strcmp(argv[1], "tview") == 0) return bam_tview_main(argc-1, argv+1); #endif else if (strcmp(argv[1], "qa") == 0) return main_qa(argc-1, argv+1); else { fprintf(stderr, "[main] unrecognized command '%s'\n", argv[1]); return 1; } return 0; }
// ----------------------------------------------------------------------- INCLUDES // ----------------------------------------------------------------------- SYNOPSIS #include "utils/src/debug/rdodebug.h" #include "utils/src/smart_ptr/intrusive_ptr/intrusive_ptr.h" // -------------------------------------------------------------------------------- namespace rdo { template<class T> inline interface_ptr<T>::interface_ptr() : m_pInterface(NULL) , m_pCounter (NULL) {} template<class T> inline interface_ptr<T>::interface_ptr(T* pInterface, LPIRefCounter pCounter) : m_pInterface(pInterface) , m_pCounter (pCounter ) { if (m_pInterface) m_pCounter->addref(); } template<class T> inline interface_ptr<T>::interface_ptr(const this_type& sptr) : m_pInterface(sptr.m_pInterface) , m_pCounter (sptr.m_pCounter ) { if (m_pInterface) m_pCounter->addref(); } template<class T> inline interface_ptr<T>::~interface_ptr() { if (m_pInterface) m_pCounter->release(); } template<class T> inline typename interface_ptr<T>::this_type& interface_ptr<T>::operator= (const this_type& sptr) { if (m_pInterface) m_pCounter->release(); m_pInterface = sptr.m_pInterface; m_pCounter = sptr.m_pCounter; if (m_pInterface) m_pCounter->addref(); return *this; } template<class T> inline interface_ptr<T>::operator bool() const { return m_pInterface != NULL; } template<class T> inline const T* interface_ptr<T>::operator->() const { return m_pInterface; } template<class T> inline T* interface_ptr<T>::operator-> () { return m_pInterface; } } // namespace rdo
/* Generated by CIL v. 1.7.0 */ /* print_CIL_Input is false */ struct _IO_FILE; struct timeval; extern void signal(int sig , void *func ) ; extern float strtof(char const *str , char const *endptr ) ; typedef struct _IO_FILE FILE; extern int atoi(char const *s ) ; extern double strtod(char const *str , char const *endptr ) ; extern int fclose(void *stream ) ; extern void *fopen(char const *filename , char const *mode ) ; extern void abort() ; extern void exit(int status ) ; extern int raise(int sig ) ; extern int fprintf(struct _IO_FILE *stream , char const *format , ...) ; extern int strcmp(char const *a , char const *b ) ; extern int rand() ; extern unsigned long strtoul(char const *str , char const *endptr , int base ) ; void RandomFunc(unsigned short input[1] , unsigned short output[1] ) ; extern int strncmp(char const *s1 , char const *s2 , unsigned long maxlen ) ; extern int gettimeofday(struct timeval *tv , void *tz , ...) ; extern int printf(char const *format , ...) ; int main(int argc , char *argv[] ) ; void megaInit(void) ; extern unsigned long strlen(char const *s ) ; extern long strtol(char const *str , char const *endptr , int base ) ; extern unsigned long strnlen(char const *s , unsigned long maxlen ) ; extern void *memcpy(void *s1 , void const *s2 , unsigned long size ) ; struct timeval { long tv_sec ; long tv_usec ; }; extern void *malloc(unsigned long size ) ; extern int scanf(char const *format , ...) ; void megaInit(void) { { } } void RandomFunc(unsigned short input[1] , unsigned short output[1] ) { unsigned short state[1] ; { state[0UL] = (input[0UL] + 51238316UL) + (unsigned short)8426; if ((state[0UL] >> (unsigned short)4) & (unsigned short)1) { state[0UL] += state[0UL]; } else { state[0UL] += state[0UL]; } output[0UL] = (state[0UL] + 119333056UL) - (unsigned short)11438; } } int main(int argc , char *argv[] ) { unsigned short input[1] ; unsigned short output[1] ; int randomFuns_i5 ; unsigned short randomFuns_value6 ; int randomFuns_main_i7 ; { megaInit(); if (argc != 2) { printf("Call this program with %i arguments\n", 1); exit(-1); } else { } randomFuns_i5 = 0; while (randomFuns_i5 < 1) { randomFuns_value6 = (unsigned short )strtoul(argv[randomFuns_i5 + 1], 0, 10); input[randomFuns_i5] = randomFuns_value6; randomFuns_i5 ++; } RandomFunc(input, output); if (output[0] == (unsigned short)31026) { printf("You win!\n"); } else { } randomFuns_main_i7 = 0; while (randomFuns_main_i7 < 1) { printf("%u\n", output[randomFuns_main_i7]); randomFuns_main_i7 ++; } } }
int printf(const char *, ...); typedef int x; void f1(int(x)); /* void f(int (*)(int)) */ int f2(int(y)); /* int f(int) */ void f3(int((*))); /* void f(int *) */ void f4(int((*x))); /* void f(int *) */ void f5(int((x))); /* void f(int (*)(int)) */ void f6(int(int)); /* void f(int (*)(int)) */ int id(int a) { return a; } int main(void) { int a = 42; void (*c1)(int(x)) = f6; int (*c2)(int(y)) = id; void (*c3)(int((*))) = f4; void (*c4)(int((*x))) = f3; void (*c5)(int((x))) = f1; void (*c6)(int(int)) = f5; c1(id); c3(&a); c4(&a); c5(c2); c6(id); return 0; } void f1(int (*f)(int)) { printf("f1: %d\n", f(1)); } void f3(int *a) { printf("f3: %d\n", *a); } void f4(int *a) { printf("f4: %d\n", *a); } void f5(int (*f)(int)) { printf("f5: %d\n", f(5)); } void f6(int (*f)(int)) { printf("f6: %d\n", f(6)); }
void request_io_access_permission(void); void map_io_ports(void); void a_d_init(void); double analog_to_digital(void); int scale_converted_signal(double voltage_post_conversion); void output_to_stm(int scaled_signal);
/* * The copyright in this software is being made available under the 2-clauses * BSD License, included below. This software may be subject to other third * party and contributor rights, including patent rights, and no such rights * are granted under this license. * * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium * Copyright (c) 2002-2014, Professor Benoit Macq * Copyright (c) 2001-2003, David Janssens * Copyright (c) 2002-2003, Yannick Verschueren * Copyright (c) 2003-2007, Francois-Olivier Devaux * Copyright (c) 2003-2014, Antonin Descampe * Copyright (c) 2005, Herve Drolon, FreeImage Team * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE 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 __BIO_H #define __BIO_H #include <stddef.h> /* ptrdiff_t */ /** @file bio.h @brief Implementation of an individual bit input-output (BIO) The functions in BIO.C have for goal to realize an individual bit input - output. */ /** @defgroup BIO BIO - Individual bit input-output stream */ /*@{*/ /** Individual bit input-output stream (BIO) */ typedef struct opj_bio { /** pointer to the start of the buffer */ OPJ_BYTE *start; /** pointer to the end of the buffer */ OPJ_BYTE *end; /** pointer to the present position in the buffer */ OPJ_BYTE *bp; /** temporary place where each byte is read or written */ OPJ_UINT32 buf; /** coder : number of bits free to write. decoder : number of bits read */ OPJ_UINT32 ct; } opj_bio_t; /** @name Exported functions */ /*@{*/ /* ----------------------------------------------------------------------- */ /** Create a new BIO handle @return Returns a new BIO handle if successful, returns NULL otherwise */ opj_bio_t* opj_bio_create(void); /** Destroy a previously created BIO handle @param bio BIO handle to destroy */ void opj_bio_destroy(opj_bio_t *bio); /** Number of bytes written. @param bio BIO handle @return Returns the number of bytes written */ ptrdiff_t opj_bio_numbytes(opj_bio_t *bio); /** Init encoder @param bio BIO handle @param bp Output buffer @param len Output buffer length */ void opj_bio_init_enc(opj_bio_t *bio, OPJ_BYTE *bp, OPJ_UINT32 len); /** Init decoder @param bio BIO handle @param bp Input buffer @param len Input buffer length */ void opj_bio_init_dec(opj_bio_t *bio, OPJ_BYTE *bp, OPJ_UINT32 len); /** Write bits @param bio BIO handle @param v Value of bits @param n Number of bits to write */ void opj_bio_write(opj_bio_t *bio, OPJ_UINT32 v, OPJ_UINT32 n); /** Read bits @param bio BIO handle @param n Number of bits to read @return Returns the corresponding read number */ OPJ_UINT32 opj_bio_read(opj_bio_t *bio, OPJ_UINT32 n); /** Flush bits @param bio BIO handle @return Returns OPJ_TRUE if successful, returns OPJ_FALSE otherwise */ OPJ_BOOL opj_bio_flush(opj_bio_t *bio); /** Passes the ending bits (coming from flushing) @param bio BIO handle @return Returns OPJ_TRUE if successful, returns OPJ_FALSE otherwise */ OPJ_BOOL opj_bio_inalign(opj_bio_t *bio); /* ----------------------------------------------------------------------- */ /*@}*/ /*@}*/ #endif /* __BIO_H */
// Generated by Apple Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42) #pragma clang diagnostic push #if defined(__has_include) && __has_include(<swift/objc-prologue.h>) # include <swift/objc-prologue.h> #endif #pragma clang diagnostic ignored "-Wauto-import" #include <objc/NSObject.h> #include <stdint.h> #include <stddef.h> #include <stdbool.h> #if !defined(SWIFT_TYPEDEFS) # define SWIFT_TYPEDEFS 1 # if defined(__has_include) && __has_include(<uchar.h>) # include <uchar.h> # elif !defined(__cplusplus) || __cplusplus < 201103L typedef uint_least16_t char16_t; typedef uint_least32_t char32_t; # endif typedef float swift_float2 __attribute__((__ext_vector_type__(2))); typedef float swift_float3 __attribute__((__ext_vector_type__(3))); typedef float swift_float4 __attribute__((__ext_vector_type__(4))); typedef double swift_double2 __attribute__((__ext_vector_type__(2))); typedef double swift_double3 __attribute__((__ext_vector_type__(3))); typedef double swift_double4 __attribute__((__ext_vector_type__(4))); typedef int swift_int2 __attribute__((__ext_vector_type__(2))); typedef int swift_int3 __attribute__((__ext_vector_type__(3))); typedef int swift_int4 __attribute__((__ext_vector_type__(4))); typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2))); typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3))); typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4))); #endif #if !defined(SWIFT_PASTE) # define SWIFT_PASTE_HELPER(x, y) x##y # define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y) #endif #if !defined(SWIFT_METATYPE) # define SWIFT_METATYPE(X) Class #endif #if !defined(SWIFT_CLASS_PROPERTY) # if __has_feature(objc_class_property) # define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__ # else # define SWIFT_CLASS_PROPERTY(...) # endif #endif #if defined(__has_attribute) && __has_attribute(objc_runtime_name) # define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X))) #else # define SWIFT_RUNTIME_NAME(X) #endif #if defined(__has_attribute) && __has_attribute(swift_name) # define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X))) #else # define SWIFT_COMPILE_NAME(X) #endif #if defined(__has_attribute) && __has_attribute(objc_method_family) # define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X))) #else # define SWIFT_METHOD_FAMILY(X) #endif #if defined(__has_attribute) && __has_attribute(noescape) # define SWIFT_NOESCAPE __attribute__((noescape)) #else # define SWIFT_NOESCAPE #endif #if defined(__has_attribute) && __has_attribute(warn_unused_result) # define SWIFT_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) #else # define SWIFT_WARN_UNUSED_RESULT #endif #if !defined(SWIFT_CLASS_EXTRA) # define SWIFT_CLASS_EXTRA #endif #if !defined(SWIFT_PROTOCOL_EXTRA) # define SWIFT_PROTOCOL_EXTRA #endif #if !defined(SWIFT_ENUM_EXTRA) # define SWIFT_ENUM_EXTRA #endif #if !defined(SWIFT_CLASS) # if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted) # define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA # define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA # else # define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA # define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA # endif #endif #if !defined(SWIFT_PROTOCOL) # define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA # define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA #endif #if !defined(SWIFT_EXTENSION) # define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__) #endif #if !defined(OBJC_DESIGNATED_INITIALIZER) # if defined(__has_attribute) && __has_attribute(objc_designated_initializer) # define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer)) # else # define OBJC_DESIGNATED_INITIALIZER # endif #endif #if !defined(SWIFT_ENUM) # define SWIFT_ENUM(_type, _name) enum _name : _type _name; enum SWIFT_ENUM_EXTRA _name : _type # if defined(__has_feature) && __has_feature(generalized_swift_name) # define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_EXTRA _name : _type # else # define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME) SWIFT_ENUM(_type, _name) # endif #endif #if !defined(SWIFT_UNAVAILABLE) # define SWIFT_UNAVAILABLE __attribute__((unavailable)) #endif #if !defined(SWIFT_UNAVAILABLE_MSG) # define SWIFT_UNAVAILABLE_MSG(msg) __attribute__((unavailable(msg))) #endif #if !defined(SWIFT_AVAILABILITY) # define SWIFT_AVAILABILITY(plat, ...) __attribute__((availability(plat, __VA_ARGS__))) #endif #if !defined(SWIFT_DEPRECATED) # define SWIFT_DEPRECATED __attribute__((deprecated)) #endif #if !defined(SWIFT_DEPRECATED_MSG) # define SWIFT_DEPRECATED_MSG(...) __attribute__((deprecated(__VA_ARGS__))) #endif #if defined(__has_feature) && __has_feature(modules) @import UIKit; #endif #pragma clang diagnostic ignored "-Wproperty-attribute-mismatch" #pragma clang diagnostic ignored "-Wduplicate-method-arg" @interface UICollectionView (SWIFT_EXTENSION(DataSourceKit)) @end #pragma clang diagnostic pop
/* * charset conversion utils * * Copyright (c) 2017 Rob Clark * * SPDX-License-Identifier: GPL-2.0+ */ #ifndef __CHARSET_H_ #define __CHARSET_H_ #include <linux/types.h> #define MAX_UTF8_PER_UTF16 3 /** * utf16_strlen() - Get the length of an utf16 string * * Returns the number of 16 bit characters in an utf16 string, not * including the terminating NULL character. * * @in the string to measure * @return the string length */ size_t utf16_strlen(const uint16_t *in); /** * utf16_strnlen() - Get the length of a fixed-size utf16 string. * * Returns the number of 16 bit characters in an utf16 string, * not including the terminating NULL character, but at most * 'count' number of characters. In doing this, utf16_strnlen() * looks at only the first 'count' characters. * * @in the string to measure * @count the maximum number of characters to count * @return the string length, up to a maximum of 'count' */ size_t utf16_strnlen(const uint16_t *in, size_t count); /** * utf16_strcpy() - UTF16 equivalent of strcpy() */ uint16_t *utf16_strcpy(uint16_t *dest, const uint16_t *src); /** * utf16_strdup() - UTF16 equivalent of strdup() */ uint16_t *utf16_strdup(const uint16_t *s); /** * utf16_to_utf8() - Convert an utf16 string to utf8 * * Converts 'size' characters of the utf16 string 'src' to utf8 * written to the 'dest' buffer. * * NOTE that a single utf16 character can generate up to 3 utf8 * characters. See MAX_UTF8_PER_UTF16. * * @dest the destination buffer to write the utf8 characters * @src the source utf16 string * @size the number of utf16 characters to convert * @return the pointer to the first unwritten byte in 'dest' */ uint8_t *utf16_to_utf8(uint8_t *dest, const uint16_t *src, size_t size); /** * utf8_to_utf16() - Convert an utf8 string to utf16 * * Converts up to 'size' characters of the utf16 string 'src' to utf8 * written to the 'dest' buffer. Stops at 0x00. * * @dest the destination buffer to write the utf8 characters * @src the source utf16 string * @size maximum number of utf16 characters to convert * @return the pointer to the first unwritten byte in 'dest' */ uint16_t *utf8_to_utf16(uint16_t *dest, const uint8_t *src, size_t size); #endif /* __CHARSET_H_ */
// // Copyright (c) SRG. All rights reserved. // // License information is available from the LICENSE file. // #import "BaseTableViewController.h" @interface VideosTimeshiftTableViewController : BaseTableViewController @end
#import <Foundation/Foundation.h> #import "MGLGeometry.h" #import "MGLLight.h" #import "MGLOfflinePack.h" #import "MGLTypes.h" NS_ASSUME_NONNULL_BEGIN /** Methods for round-tripping values for Mapbox-defined types. */ @interface NSValue (MGLAdditions) #pragma mark Working with Geographic Coordinate Values /** Creates a new value object containing the specified Core Location geographic coordinate structure. @param coordinate The value for the new object. @return A new value object that contains the geographic coordinate information. */ + (instancetype)valueWithMGLCoordinate:(CLLocationCoordinate2D)coordinate; /** The Core Location geographic coordinate structure representation of the value. */ @property (readonly) CLLocationCoordinate2D MGLCoordinateValue; /** Creates a new value object containing the specified Mapbox coordinate span structure. @param span The value for the new object. @return A new value object that contains the coordinate span information. */ + (instancetype)valueWithMGLCoordinateSpan:(MGLCoordinateSpan)span; /** The Mapbox coordinate span structure representation of the value. */ @property (readonly) MGLCoordinateSpan MGLCoordinateSpanValue; /** Creates a new value object containing the specified Mapbox coordinate bounds structure. @param bounds The value for the new object. @return A new value object that contains the coordinate bounds information. */ + (instancetype)valueWithMGLCoordinateBounds:(MGLCoordinateBounds)bounds; /** The Mapbox coordinate bounds structure representation of the value. */ @property (readonly) MGLCoordinateBounds MGLCoordinateBoundsValue; /** Creates a new value object containing the specified Mapbox coordinate quad structure. @param quad The value for the new object. @return A new value object that contains the coordinate quad information. */ + (instancetype)valueWithMGLCoordinateQuad:(MGLCoordinateQuad)quad; /** The Mapbox coordinate quad structure representation of the value. */ - (MGLCoordinateQuad)MGLCoordinateQuadValue; #pragma mark Working with Offline Map Values /** Creates a new value object containing the given `MGLOfflinePackProgress` structure. @param progress The value for the new object. @return A new value object that contains the offline pack progress information. */ + (NSValue *)valueWithMGLOfflinePackProgress:(MGLOfflinePackProgress)progress; /** The `MGLOfflinePackProgress` structure representation of the value. */ @property (readonly) MGLOfflinePackProgress MGLOfflinePackProgressValue; #pragma mark Working with Transition Values /** Creates a new value object containing the given `MGLTransition` structure. @param transition The value for the new object. @return A new value object that contains the transition information. */ + (NSValue *)valueWithMGLTransition:(MGLTransition)transition; /** The `MGLTransition` structure representation of the value. */ @property (readonly) MGLTransition MGLTransitionValue; /** Creates a new value object containing the given `MGLSphericalPosition` structure. @param lightPosition The value for the new object. @return A new value object that contains the light position information. */ + (instancetype)valueWithMGLSphericalPosition:(MGLSphericalPosition)lightPosition; /** The `MGLSphericalPosition` structure representation of the value. */ @property (readonly) MGLSphericalPosition MGLSphericalPositionValue; /** Creates a new value object containing the given `MGLLightAnchor` enum. @param lightAnchor The value for the new object. @return A new value object that contains the light anchor information. */ + (NSValue *)valueWithMGLLightAnchor:(MGLLightAnchor)lightAnchor; /** The `MGLLightAnchor` enum representation of the value. */ @property (readonly) MGLLightAnchor MGLLightAnchorValue; @end NS_ASSUME_NONNULL_END
/* Masks for grpf in GrpfStillTracking */ #define FSTILLTRACKING 1 #define FESCAPE 2 #define FTOP 4 #define FBOTTOM 8 #define FKEYBOARD 16
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef __cplusplus # error This header can only be compiled as C++. #endif #ifndef __INCLUDED_PROTOCOL_H__ #define __INCLUDED_PROTOCOL_H__ #include "serialize.h" #include "netbase.h" #include <string> #include "uint256.h" extern bool fTestNet; static inline unsigned short GetDefaultPort(const bool testnet = fTestNet) { return testnet ? 32748 : 32749; } extern unsigned char pchMessageStart[4]; /** Message header. * (4) message start. * (12) command. * (4) size. * (4) checksum. */ class CMessageHeader { public: CMessageHeader(); CMessageHeader(const char* pszCommand, unsigned int nMessageSizeIn); std::string GetCommand() const; bool IsValid() const; IMPLEMENT_SERIALIZE ( READWRITE(FLATDATA(pchMessageStart)); READWRITE(FLATDATA(pchCommand)); READWRITE(nMessageSize); READWRITE(nChecksum); ) // TODO: make private (improves encapsulation) public: enum { MESSAGE_START_SIZE=sizeof(::pchMessageStart), COMMAND_SIZE=12, MESSAGE_SIZE_SIZE=sizeof(int), CHECKSUM_SIZE=sizeof(int), MESSAGE_SIZE_OFFSET=MESSAGE_START_SIZE+COMMAND_SIZE, CHECKSUM_OFFSET=MESSAGE_SIZE_OFFSET+MESSAGE_SIZE_SIZE, HEADER_SIZE=MESSAGE_START_SIZE+COMMAND_SIZE+MESSAGE_SIZE_SIZE+CHECKSUM_SIZE }; char pchMessageStart[MESSAGE_START_SIZE]; char pchCommand[COMMAND_SIZE]; unsigned int nMessageSize; unsigned int nChecksum; }; /** nServices flags */ enum { NODE_NETWORK = (1 << 0), }; /** A CService with information about it as peer */ class CAddress : public CService { public: CAddress(); explicit CAddress(CService ipIn, uint64_t nServicesIn=NODE_NETWORK); void Init(); IMPLEMENT_SERIALIZE ( CAddress* pthis = const_cast<CAddress*>(this); CService* pip = (CService*)pthis; if (fRead) pthis->Init(); if (nType & SER_DISK) READWRITE(nVersion); if ((nType & SER_DISK) || (nVersion >= CADDR_TIME_VERSION && !(nType & SER_GETHASH))) READWRITE(nTime); READWRITE(nServices); READWRITE(*pip); ) void print() const; // TODO: make private (improves encapsulation) public: uint64_t nServices; // disk and network only unsigned int nTime; // memory only int64_t nLastTry; }; /** inv message data */ class CInv { public: CInv(); CInv(int typeIn, const uint256& hashIn); CInv(const std::string& strType, const uint256& hashIn); IMPLEMENT_SERIALIZE ( READWRITE(type); READWRITE(hash); ) friend bool operator<(const CInv& a, const CInv& b); bool IsKnownType() const; const char* GetCommand() const; std::string ToString() const; void print() const; // TODO: make private (improves encapsulation) public: int type; uint256 hash; }; #endif // __INCLUDED_PROTOCOL_H__
// // FMDatabase+LongLong.h // fmkit // // Extracted from FMDatabaseAdditions.m // Created by August Mueller on 10/30/05. // Copyright 2005 Flying Meat Inc.. All rights reserved. // // LongLong feature added by Jens Alfke // https://github.com/couchbaselabs/fmdb/commit/1a3cf0f872b9d017eb1eb977df85cfeedce45156 // #import <Foundation/Foundation.h> #import "FMDatabase.h" @interface FMDatabase (LongLong) - (long long)longLongForQuery:(NSString*)objs, ...; @end
#pragma once #include "Entity.h" #include "../item/ItemInstance.h" class ItemEntity : public Entity { public: /* 0xCAC */ ItemInstance item; /* 0xCC0 */ int unknown1; /* 0xCC4 */ int unknown2; /* 0xCC8 */ int unknown3; /* 0xCCC */ float unknown4; /* 0xCD0 */ int unknown5; /* 0xCD4 */ int unknown6; /* 0xCD8 */ bool unknown7; /* size = 0xCDC */ // virtual virtual void reloadHardcoded(Entity::InitializationMethod, VariantParameterList const&); virtual ~ItemEntity(); virtual void* getAddPacket(); virtual void normalTick(); virtual void playerTouch(Player&); virtual bool isPushable() const; virtual bool isInvulnerableTo(EntityDamageSource const&) const; virtual EntityType getEntityTypeId() const; virtual void getSourceUniqueID() const; virtual void* getHandleWaterAABB() const; virtual void _hurt(EntityDamageSource const&, int, bool, bool); virtual void readAdditionalSaveData(CompoundTag const&); virtual void addAdditionalSaveData(CompoundTag&); // non virtual ItemEntity(EntityDefinitionGroup&, EntityDefinitionIdentifier const&); ItemEntity(BlockSource&); ItemEntity(BlockSource&, Vec3 const&, ItemInstance const&, int, float, bool); void setSourceEntity(Entity const*); void _defineEntityData(); void _validateItem(); };
#pragma once #include "AbstractObjectNameImplementation.h" namespace globjects { class ObjectNameImplementation_Legacy : public AbstractObjectNameImplementation { public: ObjectNameImplementation_Legacy(); virtual ~ObjectNameImplementation_Legacy(); virtual std::string getLabel(const Object * object) const override; virtual std::string getLabel(const Sync * sync) const override; virtual bool hasLabel(const Object * object) const override; virtual bool hasLabel(const Sync * sync) const override; virtual void setLabel(const Object * object, const std::string & label) const override; virtual void setLabel(const Sync * sync, const std::string & label) const override; }; } // namespace globjects
#include "telehash.h" #include "unit_test.h" int main(int argc, char **argv) { hashname_t hn; fail_unless(e3x_init(NULL) == 0); hn = hashname_vchar("uvabrvfqacyvgcu8kbrrmk9apjbvgvn2wjechqr3vf9c1zm3hv7g"); fail_unless(!hn); hn = hashname_vchar("jvdoio6kjvf3yqnxfvck43twaibbg4pmb7y3mqnvxafb26rqllwa"); fail_unless(hn); fail_unless(strlen(hashname_char(hn)) == 52); hashname_free(hn); // create intermediate fixture lob_t im = lob_new(); lob_set(im,"1a","ym7p66flpzyncnwkzxv2qk5dtosgnnstgfhw6xj2wvbvm7oz5oaq"); lob_set(im,"3a","bmxelsxgecormqjlnati6chxqua7wzipxliw5le35ifwxlge2zva"); hn = hashname_vkey(im, 0); fail_unless(hn); fail_unless(util_cmp(hashname_char(hn),"jvdoio6kjvf3yqnxfvck43twaibbg4pmb7y3mqnvxafb26rqllwa") == 0); lob_t keys = lob_new(); lob_set(keys,"1a","vgjz3yjb6cevxjomdleilmzasbj6lcc7"); lob_set(keys,"3a","hp6yglmmqwcbw5hno37uauh6fn6dx5oj7s5vtapaifrur2jv6zha"); hn = hashname_vkeys(keys); fail_unless(hn); fail_unless(util_cmp(hashname_char(hn),"jvdoio6kjvf3yqnxfvck43twaibbg4pmb7y3mqnvxafb26rqllwa") == 0); fail_unless(hashname_id(NULL,NULL) == 0); fail_unless(hashname_id(im,keys) == 0x3a); lob_t test = lob_new(); lob_set(test,"1a","test"); lob_set(test,"2a","test"); fail_unless(hashname_id(keys,test) == 0x1a); // check short utils hn = hashname_schar("uvabrvfq"); fail_unless(hn); fail_unless(hashname_isshort(hn)); fail_unless(util_cmp(hashname_short(hn),"uvabrvfq") == 0); return 0; }
/* Copyright (c) 2008 Christopher J. W. Lloyd Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #import <Foundation/NSObject.h> #import <Onyx2D/O2Geometry.h> @class O2Font,O2Encoding; typedef O2Font *O2FontRef; typedef uint16_t O2Glyph; #import <Onyx2D/O2Context.h> #import <Onyx2D/O2DataProvider.h> //#import <Onyx2D/O2Image.h> @class NSData; typedef enum { O2FontPlatformTypeGDI, O2FontPlatformTypeFreeType, } O2FontPlatformType; @interface O2Font : NSObject { O2FontPlatformType _platformType; NSString *_name; O2DataProviderRef _provider; int _unitsPerEm; int _ascent; int _descent; int _leading; int _capHeight; int _xHeight; O2Float _italicAngle; O2Float _stemV; O2Rect _bbox; int _numberOfGlyphs; int *_advances; O2Glyph *_MacRomanEncoding; } -initWithFontName:(NSString *)name; -initWithDataProvider:(O2DataProviderRef)provider; -(NSData *)copyTableForTag:(uint32_t)tag; -(O2Glyph)glyphWithGlyphName:(NSString *)name; -(NSString *)copyGlyphNameForGlyph:(O2Glyph)glyph; -(void)fetchAdvances; -(O2Encoding *)createEncodingForTextEncoding:(O2TextEncoding)encoding; O2FontRef O2FontCreateWithFontName(NSString *name); O2FontRef O2FontCreateWithDataProvider(O2DataProviderRef provider); O2FontRef O2FontRetain(O2FontRef self); void O2FontRelease(O2FontRef self); O2FontPlatformType O2FontGetPlatformType(O2Font *self); CFStringRef O2FontCopyFullName(O2FontRef self); int O2FontGetUnitsPerEm(O2FontRef self); int O2FontGetAscent(O2FontRef self); int O2FontGetDescent(O2FontRef self); int O2FontGetLeading(O2FontRef self); int O2FontGetCapHeight(O2FontRef self); int O2FontGetXHeight(O2FontRef self); O2Float O2FontGetItalicAngle(O2FontRef self); O2Float O2FontGetStemV(O2FontRef self); O2Rect O2FontGetFontBBox(O2FontRef self); size_t O2FontGetNumberOfGlyphs(O2FontRef self); BOOL O2FontGetGlyphAdvances(O2FontRef self,const O2Glyph *glyphs,size_t count,int *advances); O2Glyph O2FontGetGlyphWithGlyphName(O2FontRef self,NSString *name); NSString *O2FontCopyGlyphNameForGlyph(O2FontRef self,O2Glyph glyph); NSData *O2FontCopyTableForTag(O2FontRef self,uint32_t tag); uint16_t O2FontUnicodeForGlyphName(NSString *name); @end
// // Created by bentoo on 10/14/16. // #ifndef GAME_RENDERINGSYSTEM_H #define GAME_RENDERINGSYSTEM_H #include <Utils/Container.h> #include "RenderingComponent.h" #include "Core/Logic/System.h" namespace Gfx { class Renderer; } namespace Memory { class IMemoryBlock; } namespace Core { class Engine; struct GameTime; } namespace Logic { class World; class RenderingSystem : public System<RenderingSystem, Requires<RenderingComponent>> { friend class RenderingComponent; Core::Engine& _engine; Memory::IMemoryBlock& _memory; World& _world; Utils::List<RenderingComponent::handle_t> _dirtyComponents; void refreshDirtyComponents(); void refreshDirtyComponent(RenderingComponent&); void createVAO(RenderingComponent&); struct SceneInfo { SceneInfo(Scene* ptr, Memory::IMemoryBlock& memory, Entity::handle_t handle) : scene(ptr), entities(memory) { entities.add(handle); } Scene* scene; Utils::List<Entity::handle_t> entities; }; Utils::List<SceneInfo> _sceneEntities; public: explicit RenderingSystem(Core::Engine& engine, Memory::IMemoryBlock& memory, World& world); auto setDirty(RenderingComponent& comp) -> void; void update(const Core::GameTime& time) override; void addEntity(entity_handle_t handle) override; }; } #endif //GAME_RENDERINGSYSTEM_H
//----------------------------------------------------------------------------- // MurmurHash3 was written by Austin Appleby, and is placed in the public // domain. The author hereby disclaims copyright to this source code. #ifndef _MURMURHASH3_H_ #define _MURMURHASH3_H_ #include <cstdint> //----------------------------------------------------------------------------- void MurmurHash3_x86_32 ( const void * key, int len, uint32_t seed, void * out ); void MurmurHash3_x86_128 ( const void * key, int len, uint32_t seed, void * out ); void MurmurHash3_x64_128 ( const void * key, int len, uint32_t seed, void * out ); //----------------------------------------------------------------------------- #endif // _MURMURHASH3_H_
#define MICROPY_HW_BOARD_NAME "ESP module" #define MICROPY_HW_MCU_NAME "ESP8266" #define MICROPY_PERSISTENT_CODE_LOAD (1) #define MICROPY_EMIT_XTENSA (1) #define MICROPY_EMIT_INLINE_XTENSA (1) #define MICROPY_DEBUG_PRINTERS (1) #define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL) #define MICROPY_READER_VFS (MICROPY_VFS) #define MICROPY_VFS (1) #define MICROPY_PY_BUILTINS_SLICE_ATTRS (1) #define MICROPY_PY_ALL_SPECIAL_METHODS (1) #define MICROPY_PY_IO_FILEIO (1) #define MICROPY_PY_SYS_STDIO_BUFFER (1) #define MICROPY_PY_URE_SUB (1) #define MICROPY_PY_UCRYPTOLIB (1) #define MICROPY_PY_FRAMEBUF (1)
#include<string> #include<vector> #include<stack> int evalRPN(std::vector<std::string> &tokens); void evalRPN_Test();
// csabase_abstractvisitor.h -*-C++-*- #ifndef INCLUDED_CSABASE_ABSTRACTVISITOR #define INCLUDED_CSABASE_ABSTRACTVISITOR #include <clang/AST/DeclVisitor.h> #include <clang/AST/StmtVisitor.h> namespace clang { class Decl; } namespace clang { class DeclContext; } namespace clang { class Stmt; } namespace clang { struct StmtRange; } // ----------------------------------------------------------------------------- namespace csabase { class AbstractVisitor: public clang::DeclVisitor<AbstractVisitor>, public clang::StmtVisitor<AbstractVisitor> { public: virtual ~AbstractVisitor(); void visit(clang::Decl const*); void visit(clang::Stmt const*); #define DECL(CLASS, BASE) \ virtual void do_visit(clang::CLASS##Decl const*); \ void process_decl(clang::CLASS##Decl*, bool nest = false); \ void Visit##CLASS##Decl (clang::CLASS##Decl*); DECL(,void) #include "clang/AST/DeclNodes.inc" // IWYU pragma: keep #define STMT(CLASS, BASE) \ virtual void do_visit(clang::CLASS const*); \ void process_stmt(clang::CLASS*, bool nest = false); \ void Visit##CLASS(clang::CLASS*); STMT(Stmt,void) #include "clang/AST/StmtNodes.inc" // IWYU pragma: keep void visit_decl(clang::Decl const*); void visit_stmt(clang::Stmt const*); void visit_context(void const*); void visit_context(clang::DeclContext const*); void visit_children(clang::StmtRange const&); template <typename Children> void visit_children(Children const&); }; } #endif // ---------------------------------------------------------------------------- // Copyright (C) 2014 Bloomberg Finance L.P. // // 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. // ----------------------------- END-OF-FILE ----------------------------------
// // QRCodeViewController.h // LiveManager // // Created by LI LIN on 14/11/8. // Copyright (c) 2014年 Alphabets. All rights reserved. // #import <UIKit/UIKit.h> #import <AVFoundation/AVFoundation.h> typedef void (^QRCodeViewControllerComplet)(id); @interface QRCodeViewController : UIViewController<AVCaptureMetadataOutputObjectsDelegate> @property (weak, nonatomic) IBOutlet UIView *preview; - (IBAction)onCancelTouched:(id)sender; @property (strong, nonatomic) QRCodeViewControllerComplet onComplet; + (QRCodeViewController *)loadController; @end
/**HEADER******************************************************************** * * Copyright (c) 2010 Freescale Semiconductor * All Rights Reserved * *************************************************************************** * * THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESSED 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 FREESCALE OR ITS 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. * ************************************************************************** * * $FileName: stack_de.c$ * $Version : 3.7.3.0$ * $Date : Feb-7-2011$ * * Comments: * This file contains the functions for manipulating the user * context on the stack. * *END************************************************************************/ #include "mqx_inc.h" /*FUNCTION*------------------------------------------------------------------- * * Function Name : _psp_destroy_stack_frame * Returned Value : none * Comments : * * This function performs any PSP specific destruction for a task * context * *END*----------------------------------------------------------------------*/ void _psp_destroy_stack_frame ( /* [IN] the task descriptor whose stack needs to be destroyed */ TD_STRUCT_PTR td_ptr ) {/* Body */ /* Nothing to do for this CPU */ }/* Endbody */ /* EOF */
/*-----------------------------------------------------------------*/ /* Main control for CP energy routines */ void energy_control_elec(CLASS *,BONDED *,GENERAL_DATA *,CP *); void control_init_dual_maps(CPSCR *,CELL *,double , PARA_FFT_PKG3D *,PARA_FFT_PKG3D *, int ); void control_init_dual_maps_pme(double ,int, int ,PARA_FFT_PKG3D *, PARA_FFT_PKG3D *,CPSCR *, CELL *); /*-----------------------------------------------------------------*/
/*************************************************************************/ /*! @Title RGX Config BVNC 1.V.4.8 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved @License Dual MIT/GPLv2 The contents of this file are subject to the MIT license as set out below. 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. Alternatively, the contents of this file may be used under the terms of the GNU General Public License Version 2 ("GPL") in which case the provisions of GPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of GPL, and not to allow others to use your version of this file under the terms of the MIT license, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by GPL as set out in the file called "GPL-COPYING" included in this distribution. If you do not delete the provisions above, a recipient may use your version of this file under the terms of either the MIT license or GPL. This License is also included in this distribution in the file called "MIT-COPYING". EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) 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; AND (B) 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 _RGXCONFIG_KM_1_V_4_8_H_ #define _RGXCONFIG_KM_1_V_4_8_H_ /***** Automatically generated file (11/6/2013 4:15:58 PM): Do not edit manually ********************/ /***** Timestamp: (11/6/2013 4:15:58 PM)************************************************************/ #define RGX_BNC_KM_B 1 #define RGX_BNC_KM_N 4 #define RGX_BNC_KM_C 8 /****************************************************************************** * DDK Defines *****************************************************************************/ #define RGX_FEATURE_NUM_CLUSTERS (4) #define RGX_FEATURE_SLC_SIZE_IN_BYTES (128*1024) #define RGX_FEATURE_PHYS_BUS_WIDTH (40) #define RGX_FEATURE_SLC_CACHE_LINE_SIZE_BITS (512) #define RGX_FEATURE_VIRTUAL_ADDRESS_SPACE_BITS (40) #define RGX_FEATURE_META (MTP218) #endif /* _RGXCONFIG_1_V_4_8_H_ */
/* Copyright 2013 David Axmark 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. */ /* * TCPListener.h * * Created on: Nov 18, 2011 * Author: emma tresanszki */ #ifndef TCPLISTENER_H_ #define TCPLISTENER_H_ class TCPListener { public: virtual void ConnectionEstablished()=0; }; #endif /* TCPLISTENER_H_ */
/* * pkghash.h * * Copyright (c) 2011-2014 Pacman Development Team <pacman-dev@archlinux.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _ALPM_PKGHASH_H #define _ALPM_PKGHASH_H #include <stdlib.h> #include "alpm.h" #include "alpm_list.h" /** * @brief A hash table for holding alpm_pkg_t objects. * * A combination of a hash table and a list, allowing for fast look-up * by package name but also iteration over the packages. */ struct __alpm_pkghash_t { /** data held by the hash table */ alpm_list_t **hash_table; /** head node of the hash table data in normal list format */ alpm_list_t *list; /** number of buckets in hash table */ unsigned int buckets; /** number of entries in hash table */ unsigned int entries; /** max number of entries before a resize is needed */ unsigned int limit; }; typedef struct __alpm_pkghash_t alpm_pkghash_t; alpm_pkghash_t *_alpm_pkghash_create(unsigned int size); alpm_pkghash_t *_alpm_pkghash_add(alpm_pkghash_t *hash, alpm_pkg_t *pkg); alpm_pkghash_t *_alpm_pkghash_add_sorted(alpm_pkghash_t *hash, alpm_pkg_t *pkg); alpm_pkghash_t *_alpm_pkghash_remove(alpm_pkghash_t *hash, alpm_pkg_t *pkg, alpm_pkg_t **data); void _alpm_pkghash_free(alpm_pkghash_t *hash); alpm_pkg_t *_alpm_pkghash_find(alpm_pkghash_t *hash, const char *name); #endif /* _ALPM_PKGHASH_H */
/* * \brief DOpE pool module * \date 2002-11-13 * \author Norman Feske <nf2@inf.tu-dresden.de> * * Pool is the component provider of DOpE. Each * component can register at Pool by specifying * an identifier string and a pointer to the its * service structure. * After that, the component's service structure * can be requested by other components via the * associated identifier. */ /* * Copyright (C) 2002-2004 Norman Feske <nf2@os.inf.tu-dresden.de> * Technische Universitaet Dresden, Operating Systems Research Group * * This file is part of the DOpE package, which is distributed under * the terms of the GNU General Public Licence 2. Please see the * COPYING file for details. */ #include "dopestd.h" #define MAX_POOL_ENTRIES 100 struct pool_entry { char *name; /* id of system module */ void *structure; /* system module structure */ }; static struct pool_entry pool[MAX_POOL_ENTRIES]; static long pool_size=0; /*** PROTOTYPES ***/ long pool_add(char *name,void *structure); void pool_remove(char *name); void *pool_get(char *name); /*** ADD NEW POOL ENTRY ***/ long pool_add(char *name,void *structure) { long i; if (pool_size>=100) return 0; else { for (i=0;pool[i].name!=NULL;i++) {}; pool[i].name=name; pool[i].structure=structure; pool_size++; INFO(printf("Pool(add): %s\n",name)); return 1; } } /*** REMOVE POOLENTRY FROM POOL ***/ void pool_remove(char *name) { long i; char *s; for (i=0;i<100;i++) { s=pool[i].name; if (s!=NULL) { if (dope_streq(name,pool[i].name,255)) { pool[i].name=NULL; pool[i].structure=NULL; pool_size--; return; } } } } /*** GET STRUCTURE OF A SPECIFIED POOL ENTRY ***/ void *pool_get(char *name) { long i; char *s; for (i=0;i<MAX_POOL_ENTRIES;i++) { s=pool[i].name; if (s!=NULL) { if (dope_streq(name,pool[i].name,255)) { INFO(printf("Pool(get): module matched: %s\n",name)); return pool[i].structure; } } } ERROR(printf("Pool(get): module not found: %s\n",name)); // l4_sleep(10000); return NULL; }
/* Copyright (c) 2010-2011, Code Aurora Forum. 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 and * only 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. */ /* The MSM Hardware supports multiple flavors of physical memory. * This file captures hardware specific information of these types. */ #ifndef __ASM_ARCH_MSM_MEMTYPES_H #define __ASM_ARCH_MSM_MEMTYPES_H #include <mach/memory.h> #include <linux/init.h> int __init meminfo_init(unsigned int, unsigned int); /* Redundant check to prevent this from being included outside of 7x30 */ #if defined(CONFIG_ARCH_MSM7X30) unsigned int get_num_populated_chipselects(void); #endif // QCT PATCH START void adjust_memory_overflow(void); // QCT PATCH END unsigned int get_num_memory_banks(void); unsigned int get_memory_bank_size(unsigned int); unsigned int get_memory_bank_start(unsigned int); int soc_change_memory_power(u64, u64, int); enum { MEMTYPE_NONE = -1, MEMTYPE_SMI_KERNEL = 0, MEMTYPE_SMI, MEMTYPE_EBI0, MEMTYPE_EBI1, MEMTYPE_MAX, }; void msm_reserve(void); #define MEMTYPE_FLAGS_FIXED 0x1 #define MEMTYPE_FLAGS_1M_ALIGN 0x2 struct memtype_reserve { unsigned long start; unsigned long size; unsigned long limit; int flags; }; struct reserve_info { struct memtype_reserve *memtype_reserve_table; void (*calculate_reserve_sizes)(void); void (*reserve_fixed_area)(unsigned long); int (*paddr_to_memtype)(unsigned int); unsigned long low_unstable_address; unsigned long max_unstable_size; unsigned long bank_size; unsigned long fixed_area_start; unsigned long fixed_area_size; }; extern struct reserve_info *reserve_info; unsigned long __init reserve_memory_for_fmem(unsigned long); #endif
/**************************************************************************** ** *W stats.h GAP source Martin Schönert ** ** *Y Copyright (C) 1996, Lehrstuhl D für Mathematik, RWTH Aachen, Germany *Y (C) 1998 School Math and Comp. Sci., University of St Andrews, Scotland *Y Copyright (C) 2002 The GAP Group ** ** This file declares the functions of the statements package. ** ** The statements package is the part of the interpreter that executes ** statements for their effects and prints statements. */ #ifndef GAP_STATS_H #define GAP_STATS_H /**************************************************************************** ** *V ExecStatFuncs[<type>] . . . . . . executor for statements of type <type> ** ** 'ExecStatFuncs' is the dispatch table that contains for every type of ** statements a pointer to the executor for statements of this type, i.e., ** the function that should be called if a statement of that type is ** executed. */ extern UInt (* ExecStatFuncs[256]) ( Stat stat ); /**************************************************************************** ** *F EXEC_STAT(<stat>) . . . . . . . . . . . . . . . . . . execute a statement ** ** 'EXEC_STAT' executes the statement <stat>. ** ** If this causes the execution of a return-value-statement, then ** 'EXEC_STAT' returns 1, and the return value is stored in 'ReturnObjStat'. ** If this causes the execution of a return-void-statement, then 'EXEC_STAT' ** returns 2. If this causes execution of a break-statement (which cannot ** happen if <stat> is the body of a function), then 'EXEC_STAT' returns 4. ** Otherwise 'EXEC_STAT' returns 0. ** ** 'EXEC_STAT' causes the execution of <stat> by dispatching to the ** executor, i.e., to the function that executes statements of the type of ** <stat>. */ #include <stdio.h> static inline UInt EXEC_STAT(Stat stat) { return ( (*ExecStatFuncs[ TNUM_STAT(stat) ]) ( stat ) ); } //#define EXEC_STAT(stat) ( (*ExecStatFuncs[ TNUM_STAT(stat) ]) ( stat ) ) /**************************************************************************** ** *V CurrStat . . . . . . . . . . . . . . . . . currently executed statement ** ** 'CurrStat' is the statement that is currently being executed. The sole ** purpose of 'CurrStat' is to make it possible to point to the location in ** case an error is signalled. */ extern Stat CurrStat; /**************************************************************************** ** *F SET_BRK_CURR_STAT(<stat>) . . . . . . . set currently executing statement *F OLD_BRK_CURR_STAT . . . . . . . . . define variable to remember CurrStat *F REM_BRK_CURR_STAT() . . . . . . . remember currently executing statement *F RES_BRK_CURR_STAT() . . . . . . . . restore currently executing statement */ #ifndef NO_BRK_CURR_STAT #define SET_BRK_CURR_STAT(stat) (CurrStat = (stat)) #define OLD_BRK_CURR_STAT Stat oldStat; #define REM_BRK_CURR_STAT() (oldStat = CurrStat) #define RES_BRK_CURR_STAT() (CurrStat = oldStat) #endif #ifdef NO_BRK_CURR_STAT #define SET_BRK_CURR_STAT(stat) /* do nothing */ #define OLD_BRK_CURR_STAT /* do nothing */ #define REM_BRK_CURR_STAT() /* do nothing */ #define RES_BRK_CURR_STAT() /* do nothing */ #endif /**************************************************************************** ** *V ReturnObjStat . . . . . . . . . . . . . . . . result of return-statement ** ** 'ReturnObjStat' is the result of the return-statement that was last ** executed. It is set in 'ExecReturnObj' and used in the handlers that ** interpret functions. */ extern Obj ReturnObjStat; extern UInt TakeInterrupt(); /**************************************************************************** ** *F InterruptExecStat() . . . . . . . . interrupt the execution of statements ** ** 'InterruptExecStat' interrupts the execution of statements at the next ** possible moment. It is called from 'SyAnsIntr' if an interrupt signal is ** received. It is never called on systems that do not support signals. On ** those systems the executors test 'SyIsIntr' at regular intervals. */ extern void InterruptExecStat ( ); /**************************************************************************** ** *F PrintStat(<stat>) . . . . . . . . . . . . . . . . . . . print a statement ** ** 'PrintStat' prints the statements <stat>. ** ** 'PrintStat' simply dispatches through the table 'PrintStatFuncs' to the ** appropriate printer. */ extern void PrintStat ( Stat stat ); /**************************************************************************** ** *V PrintStatFuncs[<type>] . . print function for statements of type <type> ** ** 'PrintStatFuncs' is the dispatching table that contains for every type of ** statements a pointer to the printer for statements of this type, i.e., ** the function that should be called to print statements of this type. */ extern void (* PrintStatFuncs[256] ) ( Stat stat ); /**************************************************************************** ** *F * * * * * * * * * * * * * initialize package * * * * * * * * * * * * * * * */ /**************************************************************************** ** *F InitInfoStats() . . . . . . . . . . . . . . . . . table of init functions */ StructInitInfo * InitInfoStats ( void ); #endif // GAP_STATS_H /**************************************************************************** ** *E stats.c . . . . . . . . . . . . . . . . . . . . . . . . . . . . ends here */
/*************************************************************************** * Copyright (C) 2011 by Peter Penz <peter.penz19@gmail.com> * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ***************************************************************************/ #ifndef KFILEITEMLISTVIEW_H #define KFILEITEMLISTVIEW_H #include <libdolphin_export.h> #include <kitemviews/kstandarditemlistview.h> class KFileItemModelRolesUpdater; class QTimer; /** * @brief View that allows to show the content of file-items. * * The corresponding model set by the controller must be an instance * of KFileItemModel. Per default KFileItemListWidget is set as widget creator * value and KItemListGroupHeader as group-header creator value. Use * KItemListView::setWidgetCreator() and KItemListView::setGroupHeaderCreator() * to apply customized generators. */ class LIBDOLPHINPRIVATE_EXPORT KFileItemListView : public KStandardItemListView { Q_OBJECT public: KFileItemListView(QGraphicsWidget* parent = 0); virtual ~KFileItemListView(); void setPreviewsShown(bool show); bool previewsShown() const; /** * If enabled a small preview gets upscaled to the icon size in case where * the icon size is larger than the preview. Per default enlarging is * enabled. */ void setEnlargeSmallPreviews(bool enlarge); bool enlargeSmallPreviews() const; /** * Sets the list of enabled thumbnail plugins that are used for previews. * Per default all plugins enabled in the KConfigGroup "PreviewSettings" * are used. * * For a list of available plugins, call KServiceTypeTrader::self()->query("ThumbCreator"). * * @see enabledPlugins */ void setEnabledPlugins(const QStringList& list); /** * Returns the list of enabled thumbnail plugins. * @see setEnabledPlugins */ QStringList enabledPlugins() const; /** @reimp */ virtual QPixmap createDragPixmap(const QSet<int>& indexes) const; protected: virtual KItemListWidgetCreatorBase* defaultWidgetCreator() const; virtual void initializeItemListWidget(KItemListWidget* item); virtual void onPreviewsShownChanged(bool shown); virtual void onItemLayoutChanged(ItemLayout current, ItemLayout previous); virtual void onModelChanged(KItemModelBase* current, KItemModelBase* previous); virtual void onScrollOrientationChanged(Qt::Orientation current, Qt::Orientation previous); virtual void onItemSizeChanged(const QSizeF& current, const QSizeF& previous); virtual void onScrollOffsetChanged(qreal current, qreal previous); virtual void onVisibleRolesChanged(const QList<QByteArray>& current, const QList<QByteArray>& previous); virtual void onStyleOptionChanged(const KItemListStyleOption& current, const KItemListStyleOption& previous); virtual void onSupportsItemExpandingChanged(bool supportsExpanding); virtual void onTransactionBegin(); virtual void onTransactionEnd(); virtual void resizeEvent(QGraphicsSceneResizeEvent* event); protected slots: virtual void slotItemsRemoved(const KItemRangeList& itemRanges); virtual void slotSortRoleChanged(const QByteArray& current, const QByteArray& previous); private slots: void triggerVisibleIndexRangeUpdate(); void updateVisibleIndexRange(); void triggerIconSizeUpdate(); void updateIconSize(); private: /** * Applies the roles defined by KItemListView::visibleRoles() to the * KFileItemModel and KFileItemModelRolesUpdater. As the model does not * distinct between visible and invisible roles also internal roles * are applied that are mandatory for having a working KFileItemModel. */ void applyRolesToModel(); /** * @return Size that is available for the icons. The size might be larger than specified by * KItemListStyleOption::iconSize: With the IconsLayout also the empty left area left * and right of an icon will be included. */ QSize availableIconSize() const; private: KFileItemModelRolesUpdater* m_modelRolesUpdater; QTimer* m_updateVisibleIndexRangeTimer; QTimer* m_updateIconSizeTimer; friend class KFileItemListViewTest; // For unit testing }; #endif
/* ************************************************************************************* * eBsp * Operation System Adapter Layer * * (c) Copyright 2006-2010, All winners Co,Ld. * All Rights Reserved * * File Name : OSAL_Thread.h * * Author : javen * * Description : 线程操作 * * History : * <author> <time> <version > <desc> * javen 2010-09-07 1.0 create this word * ************************************************************************************* */