text
stringlengths
4
6.14k
#include <rte_config.h> #include <rte_common.h> #include <rte_ring.h> #include <rte_mbuf.h> #include "queue.h" int mg_queue_enqueue_export(struct rte_ring *r, void *obj){ struct rte_mbuf* buf = (struct rte_mbuf*)obj; // FIXME: remove this debugging output, as soon, as it does not occur anymore if(obj == NULL){ printf("enqAHHH NULLLLL\n"); exit(0); } //printf("enq len = %u\n", buf->pkt.data_len); int result = rte_ring_mp_enqueue_bulk(r, &obj, 1); //printf("f"); return result; } int mg_queue_dequeue_export(struct rte_ring *r, void **obj_p){ //printf("a\n"); int result = rte_ring_mc_dequeue_bulk(r, obj_p, 1); //printf("b\n"); if(result == 0){ struct rte_mbuf* buf = (struct rte_mbuf*)(*obj_p); // FIXME: remove this debugging output, as soon, as it does not occur anymore if(buf == NULL){ printf("deqAHHH NULLLLL\n"); exit(0); } //printf("deq len = %u\n", buf->pkt.data_len); } //printf("c\n"); return result; } unsigned mg_queue_count_export(const struct rte_ring *r) { uint32_t prod_tail = r->prod.tail; uint32_t cons_tail = r->cons.tail; return ((prod_tail - cons_tail) & r->prod.mask); }
/** ****************************************************************************** * @file FLASH_Program/stm32f0xx_it.c * @author MCD Application Team * @version V1.0.0 * @date 23-March-2012 * @brief Main Interrupt Service Routines. * This file provides template for all exceptions handler and * peripherals interrupt service routine. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2> * * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); * You may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.st.com/software_license_agreement_liberty_v2 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "stm32f0xx_it.h" /** @addtogroup STM32F0_Discovery_Peripheral_Examples * @{ */ /** @addtogroup FLASH_Program * @{ */ /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /******************************************************************************/ /* Cortex-M0 Processor Exceptions Handlers */ /******************************************************************************/ /** * @brief This function handles NMI exception. * @param None * @retval None */ void NMI_Handler(void) { } /** * @brief This function handles Hard Fault exception. * @param None * @retval None */ void HardFault_Handler(void) { /* Go to infinite loop when Hard Fault exception occurs */ while (1) { } } /** * @brief This function handles SVCall exception. * @param None * @retval None */ void SVC_Handler(void) { } /** * @brief This function handles PendSVC exception. * @param None * @retval None */ void PendSV_Handler(void) { } /** * @brief This function handles SysTick Handler. * @param None * @retval None */ void SysTick_Handler(void) { } /******************************************************************************/ /* STM32F0xx Peripherals Interrupt Handlers */ /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */ /* available peripheral interrupt handler's name please refer to the startup */ /* file (startup_stm32f0xx.s). */ /******************************************************************************/ /** * @brief This function handles PPP interrupt request. * @param None * @retval None */ /*void PPP_IRQHandler(void) { }*/ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
// // TTTracker.h // TTTracker // // Created by fengyadong on 2017-3-14. // Copyright (c) 2017 toutiao. All rights reserved. // #import <Foundation/Foundation.h> //+----------------+----------+----------+---------+--------------------------+ //| Key | Type | Required | Default | Meaning | //+----------------+----------+----------+---------+--------------------------+ //| need_encrypt | BOOL | NO | YES | whether encrypt | //| user_unique_id | String | NO | NULL | unique_id for login user | //+----------------+----------+----------+---------+--------------------------+ typedef NSDictionary *_Nullable(^TTTrackerConfigParamsBlock)(void); /** 捕获一个即将被缓存的log */ typedef void(^TTTrackerLogHookBlock)(NSDictionary * _Nonnull hookedLog); /** 自定义Header中的扩展字段,在header中独立的custom结构中 */ typedef NSDictionary<NSString*, id> *_Nullable(^TTCustomHeaderBlock)(void); @interface TTTracker : NSObject @property (nonatomic, copy, readonly) NSString * _Nonnull appID;/** 应用唯一标示 */ @property (nonatomic, copy, readonly) NSString * _Nonnull channel;/** 应用发布的渠道名 */ //可选配置 @property (nonatomic, copy) TTTrackerConfigParamsBlock _Nullable configParamsBlock;/** 外部使用方配置是否加密等参数 */ @property (nonatomic, copy) TTCustomHeaderBlock _Nullable customHeaderBlock;/** 使用方自定义Header参数 */ @property (nonatomic, copy, readonly) NSDictionary<NSString*, id> *_Nullable configParams;/** 配置信息参数 */ @property (atomic, copy, readonly) NSDictionary<NSString*, TTTrackerLogHookBlock> *_Nullable logHookDict; //==================================单例方法====================================== + (instancetype _Nonnull)sharedInstance; //==================================初始化方法==================================== /** 启动tracker服务 @param appID 应用标示,由头条数据仓库组统一分配 @param channel 渠道名称,建议正式版App Store 内测版local_test 灰度版用发布的渠道名,如pp */ + (void)startWithAppID:(NSString *_Nonnull)appID channel:(NSString *_Nonnull)channel; /** 用户登录状态发生变更的时候需要调用此接口,传入当前的用户的user_unique_id @param uniqueID 用户当前的user_unique_id */ - (void)setCurrentUserUniqueID:(NSString *_Nullable)uniqueID; //=============================== V3 Interface =================================== /** v3格式日志打点 @param event 事件名称 @param params 额外参数 */ + (void)eventV3:(NSString *_Nonnull)event params:(NSDictionary *_Nullable)params; //================================== 钩子方法 ====================================== /** 捕获一条即将被缓存的埋点日志,做一些额外的事情,比如监控等 @param serviceID 本业务标示建议公司名.产品线.具体业务 比如bytedance.toutiao.ad @param logHookBlock 一条即将被缓存的埋点日志 */ - (void)registerWithServiceID:(NSString *_Nonnull)serviceID willCacheOneLogBlock:(TTTrackerLogHookBlock _Nullable)logHookBlock; //=============================== Debug模式配置 ==================================== /** 设置当前环境是否为内测版本 @param isInHouseVersion 是否为内测版本 */ - (void)setIsInHouseVersion:(BOOL)isInHouseVersion; /** 设置debug阶段埋点验证工具的域名和端口号,一般在应用的高级调试中设置 @param hostName 返回当前验证工具所在的pc主机的ip和端口号,形如:10.2.201.7:10304 */ - (void)setDebugLogServerHost:(NSString *_Nonnull)hostName; /** 设置debug阶段埋点验证工具的完整url地址,一般在二维码扫描回调里调用此方法 @param serverAddress 返回能连接到当前验证工具的完整url地址 */ - (void)setDebugLogServerAddress:(NSString *_Nonnull)serverAddress; @end
#ifndef _ALVISION_BASE_H_ #define _ALVISION_BASE_H_ #include "../alvision.h" class base : public overres::ObjectWrap{ public: static void Init(Handle<Object> target, std::shared_ptr<overload_resolution> overload); }; #endif
/* * Find how many reduced proper fractions a/b exist for b less than or equal to N */ #include <stdio.h> #include <stdlib.h> #include "math_utils.h" int main (int argc, char ** argv) { if (argc != 2) { fprintf (stderr, "usage: %s <N>\n", argv[0]); return 1; } int N = atoi (argv[1]); if (N <= 0) return 1; // For each denominator, except 1, there is exactly Totient (denominator) reduced proper fractions long count = totient_sum (N) - 1; printf ("%ld\n", count); return 0; }
// // Copyright (c) 2008-2018 the Urho3D project. // // 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. // #pragma once #include "../UI/BorderImage.h" namespace Urho3D { /// %UI element that can be toggled between unchecked and checked state. class URHO3D_API CheckBox : public BorderImage { URHO3D_OBJECT(CheckBox, BorderImage); public: /// Construct. explicit CheckBox(Context* context); /// Destruct. ~CheckBox() override; /// Register object factory. static void RegisterObject(Context* context); /// Return UI rendering batches. void GetBatches(PODVector<UIBatch>& batches, PODVector<float>& vertexData, const IntRect& currentScissor) override; /// React to mouse click begin. void OnClickBegin (const IntVector2& position, const IntVector2& screenPosition, int button, int buttons, int qualifiers, Cursor* cursor) override; /// React to a key press. void OnKey(Key key, MouseButtonFlags buttons, QualifierFlags qualifiers) override; /// Set checked state. void SetChecked(bool enable); /// Set checked image offset. void SetCheckedOffset(const IntVector2& offset); /// Set checked image offset. void SetCheckedOffset(int x, int y); /// Return whether is checked. bool IsChecked() const { return checked_; } /// Return checked image offset. const IntVector2& GetCheckedOffset() const { return checkedOffset_; } protected: /// Checked image offset. IntVector2 checkedOffset_; /// Current checked state. bool checked_; }; }
// // OLAlbumViewController.h // FacebookImagePicker // // Created by Deon Botha on 16/12/2013. // Copyright (c) 2013 Deon Botha. All rights reserved. // #import <UIKit/UIKit.h> @class OLAlbumViewController; @protocol OLAlbumViewControllerDelegate <NSObject> @optional - (void)albumViewController:(OLAlbumViewController *)albumController didSelectImage:(UIImage *)image; - (void)albumViewController:(OLAlbumViewController *)albumController didFailWithError:(NSError *)error; - (void)albumViewControllerDidCancelPickingImages:(OLAlbumViewController *)albumController; @end @interface OLAlbumViewController : UIViewController @property (nonatomic, weak) id<OLAlbumViewControllerDelegate> delegate; - (void)closeDown; @end
#ifndef SETUP_H #define SETUP_H void setup_init(); #endif
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import <iCalendar/ICSClassificationValue.h> @interface ICSClassificationValue (ICSWriter) - (void)_ICSStringWithOptions:(unsigned long long)arg1 appendingToString:(id)arg2; @end
// (C) 2015 #pragma once #include "Components/ActorComponent.h" #include "Cargo.generated.h" UENUM(BlueprintType) enum class ECargoType : uint8 { CE_Food UMETA(DisplayName = "Food"), CE_Ore UMETA(DisplayName = "Ore"), CE_Machinery UMETA(DisplayName = "Machinery"), Count }; UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) ) class AAPA2_API UCargo : public UActorComponent { GENERATED_BODY() public: // Sets default values for this component's properties UCargo(); // Called when the game starts virtual void InitializeComponent() override; // Called every frame virtual void TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction ) override; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Cargo) int32 Food; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Cargo) int32 Ore; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Cargo) int32 Machinery; UFUNCTION(BlueprintCallable, Category = Cargo) int32 GetCargo(ECargoType CargoType); UFUNCTION(BlueprintCallable, Category = Cargo) int32 SetCargo(ECargoType CargoType, int32 Amount); UFUNCTION(BlueprintCallable, Category = Cargo) int32 AddCargo(ECargoType CargoType, int32 Amount); UFUNCTION(BlueprintCallable, Category = Cargo) bool RemoveCargo(ECargoType CargoType, int32 Amount); UFUNCTION(BlueprintCallable, Category = Cargo) bool HasCargo(ECargoType CargoType, int32 Amount); };
#include <stdio.h> int main(){ int troca, vetor[20], c, i=19, e=19; for(c=0;c<=19;c++){ printf("digite o %d numero",c); scanf("%d", &vetor[c]); } for (c=0;c<=9;c++){ troca = vetor[c]; vetor[c] = vetor[i--]; vetor[e--] = troca; } for (c=0;c<=19;c++){ printf("numero %d posicao %d\n", vetor[c], c); } return 0; }
#ifndef REMOVABLEDEVICE_H #define REMOVABLEDEVICE_H #include <QString> #include <QObject> #ifdef WIN32 #define NOMINMAX #include <Windows.h> #endif #ifdef Q_OS_MAC #endif class RemovableDevice { protected: #ifdef WIN32 HANDLE hDisk; #endif public: RemovableDevice(); QString name; QString path; QString label; QString mount; QString fs; qint32 bytesPerSector; qint32 sectorsCount; qint64 size; QString getItemString(); bool isAvailable(); bool isMounted(); bool open(); bool close(); void dump(QString &fname, qint64 begin, qint64 size); }; #endif // REMOVABLEDEVICE_H
#ifndef BIO_TSS_DATA_H_ #define BIO_TSS_DATA_H #include "bio/defs.h" #include <boost/filesystem/path.hpp> #include <map> #include <string> BIO_NS_START enum CloneType { RIKEN_CLONE, TIGR_CLONE, NO_CLONE, NO_CONCLUSION_CLONE }; struct Clone { std::string transcript; CloneType type; std::string id; std::string chromosome; bool strand; int rel_tss_pos; int tss_pos; typedef std::vector<Clone> vec_t; }; struct TSS { Clone::vec_t clones; typedef std::map<std::string, TSS> map_t; /**< Maps gene ids to TSSs. */ static void parse_files( boost::filesystem::path tss_file, boost::filesystem::path clone_file, map_t & map); }; BIO_NS_END #endif //BIO_TSS_DATA_H
#include "preempt.h" #include <sys/time.h> #include <signal.h> #include "rbtree.h" #include "lock.h" #include "alloc.h" #include "timer.h" #include <stdio.h> #include "atomic.h" #include "config.h" #if YARNS_SYNERGY == YARNS_SYNERGY_PREEMPTIVE static volatile unsigned long preempt_disable_count = 0; preempt_handler preempt_handle = 0; static unsigned long preempt_initial = 0; static void preempt_signal ( int sig ); void preempt_disable () { atomic_add(&preempt_disable_count, 1); } void preempt_enable () { atomic_add(&preempt_disable_count, -1); } static unsigned long preempt_param; static lock_t preempt_lock; static rbtree* preempt_schedule; void preempt_init ( void ) { struct timeval tv; gettimeofday(&tv, NULL); preempt_initial = (tv.tv_usec / 1000) + (tv.tv_sec * 1000); preempt_schedule = rbtree_new(); lock_init(&preempt_lock); } static inline void convert ( struct timeval* tv, unsigned long t ) { tv->tv_sec = t / 1000; tv->tv_usec = (t * 1000) % 1000000; } static void reconfigure_timer ( void ) { yarns_time_t t, timestamp; struct itimerval value; convert(&value.it_interval, 0); if (rbtree_size(preempt_schedule) > 0) { timestamp = rbtree_min(preempt_schedule); t = yarns_time(); if (timestamp < t) t = 0; else t = timestamp - t; printf("preempting in %lu microseconds for target time = %lu (current time = %lu)\n", t, timestamp, yarns_time()); convert(&value.it_value, t); rbtree_search(preempt_schedule, timestamp, (void**)&preempt_param); signal(SIGVTALRM, preempt_signal); setitimer(ITIMER_VIRTUAL, &value, 0); rbtree_remove(preempt_schedule, t); } else { convert(&value.it_value, 0); setitimer(ITIMER_VIRTUAL, &value, 0); } } static void preempt_signal ( int sig ) { printf("got preempt signal\n"); bool lockOK = lock_trylock(&preempt_lock); if (lockOK && preempt_handle && !preempt_disable_count) { unsigned long min = rbtree_min(preempt_schedule); unsigned long param; rbtree_search(preempt_schedule, min, (void**)&param); reconfigure_timer(); lock_unlock(&preempt_lock); preempt_handle(param); } else { // either we're locked or we've been told not to preempt, wait 5ms struct itimerval value; convert(&value.it_interval, 0); convert(&value.it_value, 5); setitimer(ITIMER_VIRTUAL, &value, 0); if (lockOK) lock_unlock(&preempt_lock); } } void preempt ( unsigned long timestamp, unsigned long param ) { printf("preempt(%lu, %lu)\n", timestamp, param); lock_lock(&preempt_lock); rbtree_insert(preempt_schedule, timestamp, (void*)param); reconfigure_timer(); lock_unlock(&preempt_lock); } void preempt_cancel ( unsigned long timestamp ) { lock_lock(&preempt_lock); rbtree_remove(preempt_schedule, timestamp); reconfigure_timer(); lock_unlock(&preempt_lock); } #endif
// This file was generated based on 'C:\ProgramData\Uno\Packages\UnoCore\0.13.2\Source\Uno\UX\$.uno'. // WARNING: Changes might be lost if you edit this file directly. #ifndef __APP_UNO_U_X_VALUE_CHANGED_ARGS__FUSE_NAVIGATION_SWIPE_ENDS_H__ #define __APP_UNO_U_X_VALUE_CHANGED_ARGS__FUSE_NAVIGATION_SWIPE_ENDS_H__ #include <app/Uno.EventArgs.h> #include <Uno.h> namespace app { namespace Uno { namespace UX { struct ValueChangedArgs__Fuse_Navigation_SwipeEnds; struct ValueChangedArgs__Fuse_Navigation_SwipeEnds__uType : ::app::Uno::EventArgs__uType { }; ValueChangedArgs__Fuse_Navigation_SwipeEnds__uType* ValueChangedArgs__Fuse_Navigation_SwipeEnds__typeof(); void ValueChangedArgs__Fuse_Navigation_SwipeEnds___ObjInit_1(ValueChangedArgs__Fuse_Navigation_SwipeEnds* __this, int value, ::uObject* origin); ::uObject* ValueChangedArgs__Fuse_Navigation_SwipeEnds__get_Origin(ValueChangedArgs__Fuse_Navigation_SwipeEnds* __this); int ValueChangedArgs__Fuse_Navigation_SwipeEnds__get_Value(ValueChangedArgs__Fuse_Navigation_SwipeEnds* __this); ValueChangedArgs__Fuse_Navigation_SwipeEnds* ValueChangedArgs__Fuse_Navigation_SwipeEnds__New_2(::uStatic* __this, int value, ::uObject* origin); void ValueChangedArgs__Fuse_Navigation_SwipeEnds__set_Origin(ValueChangedArgs__Fuse_Navigation_SwipeEnds* __this, ::uObject* value); void ValueChangedArgs__Fuse_Navigation_SwipeEnds__set_Value(ValueChangedArgs__Fuse_Navigation_SwipeEnds* __this, int value); struct ValueChangedArgs__Fuse_Navigation_SwipeEnds : ::app::Uno::EventArgs { int _Value; ::uStrong< ::uObject*> _Origin; void _ObjInit_1(int value, ::uObject* origin) { ValueChangedArgs__Fuse_Navigation_SwipeEnds___ObjInit_1(this, value, origin); } ::uObject* Origin() { return ValueChangedArgs__Fuse_Navigation_SwipeEnds__get_Origin(this); } int Value() { return ValueChangedArgs__Fuse_Navigation_SwipeEnds__get_Value(this); } void Origin(::uObject* value) { ValueChangedArgs__Fuse_Navigation_SwipeEnds__set_Origin(this, value); } void Value(int value) { ValueChangedArgs__Fuse_Navigation_SwipeEnds__set_Value(this, value); } }; }}} #endif
// // HTTPUrlManager.h // HotLibApp // // Created by weiying on 16/9/14. // Copyright © 2016年 amoby. All rights reserved. // #import <Foundation/Foundation.h> @interface HTTPUrlManager : NSObject @end
#include "../tests.h" #include "util/list.h" int main(int argc, char** argv) { list_t* a = mk_list_node(1); list_t* b = mk_list_node(2); list_t* c = mk_list_node(3); assert(list_append(NULL, a) == a); assert(list_prepend(NULL, a) == a); assert(list_size(a) == 1); assert(list_size(b) == 1); list_t* nd = list_prepend(a, b); assert(nd == b); assert(list_size(a) == 1); assert(list_size(b) == 2); nd = list_append(a, c); assert(nd == a); assert(list_size(b) == 3); assert(list_size(a) == 2); assert(list_size(c) == 1); assert(list_head(a) == list_head(b)); assert(list_head(c) == list_head(b)); assert(b == list_head(b)); assert(list_tail(a) == list_tail(b)); assert(list_tail(c) == list_tail(b)); assert(c == list_tail(b)); list_destroy_node(a); assert(list_size(b) == 2); assert(list_size(c) == 1); list_destroy_node(c); assert(list_size(b) == 1); list_destroy_node(b); a = mk_list_node(1); b = mk_list_node(2); c = mk_list_node(3); list_prepend(a, b); list_append(a, c); list_destroy(b); return 0; }
#ifndef SIMILARITYGRAPHBUILDER_H #define SIMILARITYGRAPHBUILDER_H /** * @file SimilarityGraphBuilder.h * Header file defining the SimilarityGraphBuilder interface. */ #include "Drawable.h" /** * The Similarity Graph builder interface. * Classes derived from this interface are intended to create the similiarity graph buffer. * @see PixelArtRenderer * @see Drawable */ class SimilarityGraphBuilder : public Drawable { public: /** * Use this function to compute the Similaritygraph. * This will be called if you call the Drawable::Draw(int, int) member. * Viewport dimensions are not relevant for SimilarityGraph construction. */ virtual void draw() = 0 ; /** * Returns the Texture ID containing the resulting Similarity Graph * @return texture ID */ virtual GLuint getTexID() = 0 ; /** * Returns the Texture Unit associated with resulting the Similarity Graph * @return texture Unit */ virtual GLuint getTexUnit() = 0 ; }; #endif
#ifndef _GAMESTATE_H_ #define _GAMESTATE_H_ #include "s3eTypes.h" //------------------------------------------------------------------------------------- // GameState - base class for gamestates //------------------------------------------------------------------------------------- class GameState { public: static const int k_state_none = 0; static const int k_state_gameplay = 1; static const int k_state_loading = 2; static const int k_state_menu = 3; public: // game states stack static const int k_statesStackLen = 10; public: GameState(); virtual ~GameState(); // Resume state virtual void ResumeState() = 0; // Update state virtual void UpdateState( const s3e_uint64_t frameTime ) = 0; // Render state virtual void RenderState() = 0; // Init states stack static void InitStatesStack(); // Release states stack static void ReleaseStatesStack(); // Set state static void SetState( GameState* newState ); // Set state and reset stack static void SetStateAndResetStack( GameState* newState ); // Pop state static void PopState(); // Update current state static void UpdateCurrentState( const s3e_uint64_t frameTime ); // Render current state static void RenderCurrentState(); // Set sub state static void SetSubState( const int state ); // Get sub state ID static int GetSubStateID(); // Get state ID static int GetStateID(); // Returns current state static GameState* GetCurrentState(); // Returns previous sub state id static int GetPrevSubStateID(); protected: // states management static vars static int s_statesStackHead; static GameState* s_statesStack[k_statesStackLen]; static GameState* s_currentState; static GameState* s_stateToPop; static bool s_resetStack; static int s_stateID; static int s_subState; static int s_prevSubState; }; #endif // _GAMESTATE_H_
// // Generated by class-dump 3.4 (64 bit) (Debug version compiled Mar 6 2013 16:24:16). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2012 by Steve Nygard. // #import "BRHorizontalSegmentedWidget.h" __attribute__((visibility("hidden"))) @interface BRPasscodeSelectionWidget : BRHorizontalSegmentedWidget { } - (id)init; @end
@interface ARGeneViewController : UIViewController - (instancetype)initWithGeneID:(NSString *)geneID; - (instancetype)initWithGene:(Gene *)gene; @property (nonatomic, strong, readonly) Gene *gene; @end
// // ViewController.h // MUPersistenceExample // // Created by Muer on 16/4/11. // Copyright © 2016年 Muer. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UITableViewController @end
// This file is part of Wintermute Engine // For conditions of distribution and use, see copyright notice in license.txt // http://dead-code.org/redir.php?target=wme #if !defined(AFX_ADSCENEGEOMETRY_H__6043ACFC_3844_4218_BFA9_805F2E690AEB__INCLUDED_) #define AFX_ADSCENEGEOMETRY_H__6043ACFC_3844_4218_BFA9_805F2E690AEB__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "BBase.h" class CAdSceneGeometry : public CBObject { public: bool m_MaxLightsWarning; HRESULT DropWaypoints(); HRESULT SetLightColor(char* LightName, DWORD Color); DWORD GetLightColor(char* LightName); D3DXVECTOR3 GetLightPos(char* LightName); HRESULT EnableNode(char* NodeName, bool Enable=true); bool IsNodeEnabled(char* NodeName); HRESULT EnableLight(char* LightName, bool Enable=true); bool IsLightEnabled(char* LightName); DECLARE_PERSISTENT(CAdSceneGeometry, CBObject); HRESULT CorrectTargetPoint(D3DXVECTOR3 Source, D3DXVECTOR3* Target); bool m_LastValuesInitialized; D3DXMATRIX m_LastWorldMat; D3DXMATRIX m_LastViewMat; D3DXMATRIX m_LastProjMat; int m_LastOffsetX; int m_LastOffsetY; D3DVIEWPORT m_DrawingViewport; int m_LastScrollX; int m_LastScrollY; HRESULT CreateLights(); HRESULT EnableLights(D3DXVECTOR3 Point, CBArray<char*, char*>& IgnoreLights); static int CompareLights(const void* Obj1, const void* Obj2); HRESULT InitLoop(); float GetPointsDist(D3DXVECTOR3 p1, D3DXVECTOR3 p2); void PathFinderStep(); bool GetPath(D3DXVECTOR3 source, D3DXVECTOR3 target, CAdPath3D* path, bool Rerun=false); bool Convert2Dto3D(int X, int Y, D3DXVECTOR3* Pos); bool Convert2Dto3DTolerant(int X, int Y, D3DXVECTOR3 *Pos); bool Convert3Dto2D(D3DXVECTOR3* Pos, int* X, int* Y); CBSprite* m_WptMarker; float m_WaypointHeight; bool DirectPathExists(D3DXVECTOR3* p1, D3DXVECTOR3* p2); float GetHeightAt(D3DXVECTOR3 Pos, float Tolerance=0.0f, bool* IntFound=NULL); HRESULT StoreDrawingParams(); HRESULT Render(bool Render); HRESULT RenderShadowGeometry(); D3DXMATRIX* GetViewMatrix(); D3DXMATRIX m_ViewMatrix; HRESULT SetActiveCamera(char* Camera, float FOV, float NearClipPlane, float FarClipPlane); HRESULT SetActiveCamera(int Camera, float FOV, float NearClipPlane, float FarClipPlane); //HRESULT SetActiveCameraTwin(char* Camera); //HRESULT SetActiveCameraTwin(int Camera); C3DCamera* GetActiveCamera(); int m_ActiveCamera; HRESULT SetActiveLight(char* Light); HRESULT SetActiveLight(int Light); int m_ActiveLight; void Cleanup(); CAdSceneGeometry(CBGame* inGame); virtual ~CAdSceneGeometry(); HRESULT CAdSceneGeometry::LoadFile(char* Filename); CBArray<CAdWalkplane*, CAdWalkplane*> m_Planes; CBArray<CAdBlock*, CAdBlock*> m_Blocks; CBArray<CAdGeneric*, CAdGeneric*> m_Generics; CBArray<C3DCamera*, C3DCamera*> m_Cameras; CBArray<C3DLight*, C3DLight*> m_Lights; CBArray<CAdWaypointGroup3D*, CAdWaypointGroup3D*> m_WaypointGroups; DWORD m_PFMaxTime; private: CAdGeomExt* GetGeometryExtension(char* Filename); D3DXVECTOR3 GetBlockIntersection(D3DXVECTOR3* p1, D3DXVECTOR3* p2); bool m_PFReady; D3DXVECTOR3 m_PFSource; D3DXVECTOR3 m_PFTarget; CAdPath3D* m_PFTargetPath; D3DXVECTOR3 m_PFAlternateTarget; float m_PFAlternateDist; bool m_PFRerun; CBArray<CAdPathPoint3D*, CAdPathPoint3D*> m_PFPath; }; #endif // !defined(AFX_ADSCENEGEOMETRY_H__6043ACFC_3844_4218_BFA9_805F2E690AEB__INCLUDED_)
#pragma once #include "Core/Renderer/Sampling/SamplingRenderer.h" #include "Core/Renderer/Region/Region.h" #include "Common/primitive_type.h" #include "Core/Renderer/Region/DammertzDispatcher.h" #include "Core/Renderer/Region/GridScheduler.h" #include "Core/Renderer/Sampling/CameraSamplingWork.h" #include "Frame/TFrame.h" #include "Core/Renderer/Sampling/TStepperCameraMeasurementEstimator.h" #include "Core/Renderer/Sampling/MetaRecordingProcessor.h" #include "Core/Quantity/SpectralStrength.h" #include <memory> #include <queue> #include <cstddef> #include <vector> #include <functional> namespace ph { class FixedSizeThreadPool; class AdaptiveSamplingRenderer : public SamplingRenderer, public TCommandInterface<AdaptiveSamplingRenderer> { public: void doUpdate(const SdlResourcePack& data) override; void doRender() override; void retrieveFrame(std::size_t layerIndex, HdrRgbFrame& out_frame) override; ERegionStatus asyncPollUpdatedRegion(Region* out_region) override; RenderState asyncQueryRenderState() override; RenderProgress asyncQueryRenderProgress() override; void asyncPeekFrame( std::size_t layerIndex, const Region& region, HdrRgbFrame& out_frame) override; ObservableRenderData getObservableData() const override; private: using FilmEstimator = TStepperCameraMeasurementEstimator<HdrRgbFilm, SpectralStrength>; constexpr static auto REFINE_MODE = DammertzDispatcher::ERefineMode::MIN_ERROR_DIFFERENCE; //constexpr static auto REFINE_MODE = DammertzDispatcher::ERefineMode::MIDPOINT; const Scene* m_scene; const Camera* m_camera; SampleGenerator* m_sampleGenerator; SampleFilter m_filter; HdrRgbFilm m_allEffortFilm; HdrRgbFilm m_halfEffortFilm; std::unique_ptr<FullRayEnergyEstimator> m_estimator; std::vector<CameraSamplingWork> m_renderWorks; std::vector<FilmEstimator> m_filmEstimators; std::vector<MetaRecordingProcessor> m_metaRecorders; HdrRgbFrame m_metaFrame; DammertzDispatcher m_dispatcher; std::vector<uint32> m_freeWorkerIds; real m_precisionStandard; std::size_t m_minSamplesPerRegion; HdrRgbFrame m_allEffortFrame; HdrRgbFrame m_halfEffortFrame; struct UpdatedRegion { Region region; bool isFinished; }; std::deque<UpdatedRegion> m_updatedRegions; std::mutex m_rendererMutex; std::atomic_uint64_t m_totalPaths; std::atomic_uint32_t m_suppliedFractionBits; std::atomic_uint32_t m_submittedFractionBits; std::atomic_uint32_t m_numNoisyRegions; void addUpdatedRegion(const Region& region, bool isUpdating); std::function<void()> createWork(FixedSizeThreadPool& workers, uint32 workerId); // command interface public: explicit AdaptiveSamplingRenderer(const InputPacket& packet); static SdlTypeInfo ciTypeInfo(); static void ciRegister(CommandRegister& cmdRegister); }; }// end namespace ph
// includes standard header files #include <stdint.h> #include <string> #include <vector> #include <array> #include <map> #include <unordered_map> using namespace std;
/** * Notes.CC * * MIT/X11 License * Copyright (c) 2014 Qball Cow <qball@gmpclient.org> * * 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 __ID_STORAGE_H__ #define __ID_STORAGE_H__ // This class should provide stable id's for notes per pc. // IDs should not be stored in the note itself as it can lead to // conflicts when editing notes on multiple pc's. // Path is used as uid. class IDStorage { private: std::string cache_path; std::map <std::string, unsigned int> idmap; bool changed = false; // Format: // <id> <path> void read (); void write (); public: IDStorage ( const std::string &repo_path ); ~IDStorage (); /** * @param path The path to get an id for. * * Returns an ID for a given note path. * Creates a new id when not found. */ unsigned int get_id ( const std::string &path ); /** * @param id The id that is moved. * @param path_new The new path. * * Move the id to new path. */ void move_id ( const std::string &path_old, const std::string &path_new ); /** * @param id The id that is released. * * Release the id back for re-use. */ void delete_id ( const std::string &path_old ); /** * @param notes List of notes. * * Clears the list and refills it. * Helper function. * TODO: Would be nice if this class did not need the knowledge about * notes; */ void gc ( std::vector<Note *> notes ); }; #endif // __ID_STORAGE_H__
/* * $QNXLicenseC: * Copyright 2008, QNX Software Systems. * * Licensed under the Apache License, Version 2.0 (the "License"). You * may not reproduce, modify or distribute this software 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 OF ANY KIND, either express or implied. * * This file may contain contributions from others, either as * contributors under the License or as licensors under other terms. * Please review this entire file for other proprietary rights or license * notices, as well as the QNX Development Suite License Guide at * http://licensing.qnx.com/license-guide/ for other information. * $ */ #include "startup.h" /******************************************************************************* * hwitag_add_irq_range * * add the irqrange tag to device <hwi_off> and and set the tag fields as * specified in <start_vector> and <num>. * * Note that the <hwi_off> parameter is ignored because there is currently no * way to add tags to an existing item. The API provides for the removal of this * restriction in the future * * Returns: -1 on error or the vector tag index that was set (base 0) * */ void hwitag_add_irqrange(unsigned hwi_off, unsigned start_vector, unsigned num) { hwi_tag *tag; tag = hwi_alloc_tag(HWI_TAG_INFO(irqrange)); tag->irqrange.irq = start_vector; tag->irqrange.num = num; } __SRCVERSION("hwitag_add_irqrange.c $Rev: 169805 $");
// // Created by fanshiliang on 2017/6/23. // #ifndef ZION_HEADER_H #define ZION_HEADER_H #include <string> namespace zion { struct header { std::string key; std::string value; }; } //namespace zion #endif //ZION_HEADER_H
#ifndef _HL1BSPINSTANCE_H_ #define _HL1BSPINSTANCE_H_ #include "hl1bspasset.h" #include <set> #include <string> #include <glm/glm.hpp> typedef struct { bool allsolid; /* if true, plane is not valid */ bool startsolid; /* if true, the initial point was in a solid area */ float fraction; /* time completed, 1.0 = didn't hit anything */ glm::vec3 hitpos; /* surface hit position (in solid) */ glm::vec3 endpos; /* final position (not in solid) */ int contents; /* contents of endpos */ } botman_trace_t; namespace valve { namespace hl1 { class BspInstance : public AssetInstance { public: BspInstance(BspAsset* asset); virtual ~BspInstance(); virtual void Update(float dt) { } virtual void Render(const glm::mat4& proj, const glm::mat4& view); void Unload(); private: BspAsset* _asset; Shader* _shader; std::set<unsigned short> _visibleFaces; std::set<unsigned short> FindVisibleFaces(const glm::vec3& pos, int headNode); int TracePointInLeaf(const glm::vec3& point, int startNode); void BotmanTraceLine (glm::vec3 start, glm::vec3 end, botman_trace_t *trace); }; } } #endif /* _HL1BSPINSTANCE_H_ */
#ifndef __COMMON_H__ #define __COMMON_H__ #include <algorithm> #define NOMINMAX #include <Windows.h> #pragma warning(disable: 4512 4244 4100) #include "avisynth.h" #pragma warning(default: 4512 4244 4100) #include <smmintrin.h> typedef unsigned char Byte; #define RG_FORCEINLINE __forceinline #define USE_MOVPS enum InstructionSet { SSE2, SSE3 }; template<typename T> static RG_FORCEINLINE Byte clip(T val, T minimum, T maximum) { return std::max(std::min(val, maximum), minimum); } static RG_FORCEINLINE bool is_16byte_aligned(const void *ptr) { return (((unsigned long)ptr) & 15) == 0; } static RG_FORCEINLINE __m128i simd_clip(const __m128i &val, const __m128i &minimum, const __m128i &maximum) { return _mm_max_epu8(_mm_min_epu8(val, maximum), minimum); } static RG_FORCEINLINE void sort_pair(__m128i &a1, __m128i &a2) { const __m128i tmp = _mm_min_epu8 (a1, a2); a2 = _mm_max_epu8 (a1, a2); a1 = tmp; } template<InstructionSet optLevel> static RG_FORCEINLINE __m128i simd_loadu_si128(const Byte* ptr) { if (optLevel == SSE2) { #ifdef USE_MOVPS return _mm_castps_si128(_mm_loadu_ps(reinterpret_cast<const float*>(ptr))); #else return _mm_loadu_si128(reinterpret_cast<const __m128i*>(ptr)); #endif } return _mm_lddqu_si128(reinterpret_cast<const __m128i*>(ptr)); } //mask ? a : b static RG_FORCEINLINE __m128i blend(__m128i const &mask, __m128i const &desired, __m128i const &otherwise) { //return _mm_blendv_epi8 (otherwise, desired, mask); auto andop = _mm_and_si128(mask , desired); auto andnop = _mm_andnot_si128(mask, otherwise); return _mm_or_si128(andop, andnop); } static RG_FORCEINLINE __m128i abs_diff(__m128i a, __m128i b) { auto positive = _mm_subs_epu8(a, b); auto negative = _mm_subs_epu8(b, a); return _mm_or_si128(positive, negative); } static RG_FORCEINLINE __m128i select_on_equal(const __m128i &cmp1, const __m128i &cmp2, const __m128i &current, const __m128i &desired) { auto eq = _mm_cmpeq_epi8(cmp1, cmp2); return blend(eq, desired, current); } #define LOAD_SQUARE_SSE(optLevel, ptr, pitch) \ __m128i a1 = simd_loadu_si128<optLevel>((ptr) - (pitch) - 1); \ __m128i a2 = simd_loadu_si128<optLevel>((ptr) - (pitch)); \ __m128i a3 = simd_loadu_si128<optLevel>((ptr) - (pitch) + 1); \ __m128i a4 = simd_loadu_si128<optLevel>((ptr) - 1); \ __m128i c = simd_loadu_si128<optLevel>((ptr) ); \ __m128i a5 = simd_loadu_si128<optLevel>((ptr) + 1); \ __m128i a6 = simd_loadu_si128<optLevel>((ptr) + (pitch) - 1); \ __m128i a7 = simd_loadu_si128<optLevel>((ptr) + (pitch)); \ __m128i a8 = simd_loadu_si128<optLevel>((ptr) + (pitch) + 1); #define LOAD_SQUARE_CPP(ptr, pitch) \ Byte a1 = *((ptr) - (pitch) - 1); \ Byte a2 = *((ptr) - (pitch)); \ Byte a3 = *((ptr) - (pitch) + 1); \ Byte a4 = *((ptr) - 1); \ Byte c = *((ptr) ); \ Byte a5 = *((ptr) + 1); \ Byte a6 = *((ptr) + (pitch) - 1); \ Byte a7 = *((ptr) + (pitch)); \ Byte a8 = *((ptr) + (pitch) + 1); #endif
// // HMISearchingBox.h // Hide My iPhone // // Created by John Yorke on 17/11/2013. // Copyright (c) 2013 John Yorke. All rights reserved. // #import <UIKit/UIKit.h> @interface HMISearchingBox : UIView @end
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__wchar_t_connect_socket_popen_81.h Label Definition File: CWE78_OS_Command_Injection.one_string.label.xml Template File: sources-sink-81.tmpl.h */ /* * @description * CWE: 78 OS Command Injection * BadSource: connect_socket Read data using a connect socket (client side) * GoodSource: Fixed string * Sinks: popen * BadSink : Execute command in data using popen() * Flow Variant: 81 Data flow: data passed in a parameter to an virtual method called via a reference * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define FULL_COMMAND L"%WINDIR%\\system32\\cmd.exe /c dir " #else #include <unistd.h> #define FULL_COMMAND L"/bin/sh ls -la " #endif namespace CWE78_OS_Command_Injection__wchar_t_connect_socket_popen_81 { class CWE78_OS_Command_Injection__wchar_t_connect_socket_popen_81_base { public: /* pure virtual function */ virtual void action(wchar_t * data) const = 0; }; #ifndef OMITBAD class CWE78_OS_Command_Injection__wchar_t_connect_socket_popen_81_bad : public CWE78_OS_Command_Injection__wchar_t_connect_socket_popen_81_base { public: void action(wchar_t * data) const; }; #endif /* OMITBAD */ #ifndef OMITGOOD class CWE78_OS_Command_Injection__wchar_t_connect_socket_popen_81_goodG2B : public CWE78_OS_Command_Injection__wchar_t_connect_socket_popen_81_base { public: void action(wchar_t * data) const; }; #endif /* OMITGOOD */ }
#ifndef PACKER_H #define PACKER_H #include <vector> class Packer { public: /** * Packer constructor. A new constructor should be implemented by the deriving class which sets the length of the domain in ijk and the spacing between particles. * @param len Size of the domain in Cartesian coordinate system * @param offset Vector used to shift the particles in this pack */ Packer(std::vector<double> len, std::vector<double> offset=std::vector<double>()); ~Packer(); /** * Converts an ijk index to Cartesian coordinates * @param i i index (along X) * @param j j index (along Y) * @param k k index (along Z) * @param posOut Cartesian coordinate output, array of length 3 */ virtual void IDX2Pos(long i, long j, long k, double *posOut)=0; /** * Converts a Cartesian coordinate to an IJK position * @param posIn Cartesian coordinate input, array of length 3 * @param idxOut ijk coordinate output, array of length 3 * @param doFloor Returns the lower-left point in relation to the Cartesian point if true. Returns the upper-right point if false */ virtual void Pos2IDX(double *posIn, long *idxOut, bool doFloor)=0; /** * Get a domain extent which represents a periodic domain. For a domain boundary to be periodic, particles must be packed all the way to the boundary. * @return Periodic domain extent */ virtual std::vector<double> GetPeriodicExtent()=0; /** * Applies the packers offset to a set of coordinates * @param Coordinates to apply the offset to */ void ApplyOffset(double *coord); /** * Removes the packers offset to a set of coordinates * @param Coordinates to remove the offset from */ void RemoveOffset(double *coord); /** * Get particle volume * @return The approximate volume of a single particle, computed as domain volume / number of particles. */ double GetParticleVolume(); double dx; /**< Spacing between particle */ long len[3]; /**< Size of the domain in ijk system */ double lend[3]; /**< Size of the domain in Cartesian coordinate system*/ double offset[3]; /**< Vector used to shift the particles in this pack */ }; #endif
// 功能:初始化串口 #include "uart.h" #define ULCON0 (*((volatile unsigned long *)0x7F005000)) #define UCON0 (*((volatile unsigned long *)0x7F005004)) #define UFCON0 (*((volatile unsigned long *)0x7F005008)) #define UMCON0 (*((volatile unsigned long *)0x7F00500C)) #define UTRSTAT0 (*((volatile unsigned long *)0x7F005010)) #define UFSTAT0 (*((volatile unsigned long *)0x7F005018)) #define UTXH0 (*((volatile unsigned char *)0x7F005020)) #define URXH0 (*((volatile unsigned char *)0x7F005024)) #define UBRDIV0 (*((volatile unsigned short *)0x7F005028)) #define UDIVSLOT0 (*((volatile unsigned short *)0x7F00502C)) #define GPACON (*((volatile unsigned long *)0x7F008000)) void init_uart(void) { /* 1. 配置引脚 */ GPACON &= ~0xff; GPACON |= 0x22; /* 2. 设置数据格式等 */ ULCON0 = 0x3; // 数据位:8, 无校验, 停止位: 1, 8n1 UCON0 = 0x5; // 时钟:PCLK,禁止中断,使能UART发送、接收 UFCON0 = 0x01; // FIFO ENABLE UMCON0 = 0; // 无流控 /* 3. 设置波特率 */ // DIV_VAL = (PCLK / (bps x 16 ) ) - 1 = (66500000/(115200x16))-1 = 35.08 // DIV_VAL = 35.08 = UBRDIVn + (num of 1’s in UDIVSLOTn)/16 UBRDIV0 = 35; UDIVSLOT0 = 0x1; } /* 接收一个字符 */ char getchar(void) { while ((UFSTAT0 & 0x7f) == 0); // 如果RX FIFO空,等待 return URXH0; // 取数据 } /* 发送一个字符 */ void putchar(char c) { while (UFSTAT0 & (1<<14)); // 如果TX FIFO满,等待 UTXH0 = c; // 写数据 }
#pragma once #include <utils.h> #include <string> #include "WindowMapping.h" #include "Vector3d.h" #include "ViewPort.h" #include "LayerManager.h" class Viewer2d: public ViewPort { public: //please call this first. virtual void SetViewportSize(int w, int h); virtual void SetLightingAndCamera(); void Translate(float delta_x, float delta_y); void Scale(float scale_x, float scale_y); virtual void PanMouse(float dx, float dy); virtual void ZoomMouse(float dx, float dy); void GetWorldCoordinates(float &x, float &y); void ChangeParameter(float newParameter); void IncrementParameter(int variable, float delta); virtual void Update(bool force = false); virtual void Render(); Viewer2d(void); private: void UpdateWindowMapper(); LayerManager *m_LayerManager; };
/* LUFA Library Copyright (C) Dean Camera, 2009. dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ /* Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that the copyright notice and this permission notice and warranty disclaimer appear in supporting documentation, and that the name of the author not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall the author be liable for any special, 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. */ /** \file * * Header file for ISPProtocol.c. */ #ifndef _ISP_PROTOCOL_ #define _ISP_PROTOCOL_ /* Includes: */ #include <avr/io.h> #include "V2Protocol.h" /* Preprocessor Checks: */ #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1)) #undef ENABLE_ISP_PROTOCOL #if !defined(ENABLE_PDI_PROTOCOL) #define ENABLE_PDI_PROTOCOL #endif #endif /* Macros: */ /** Mask for the reading or writing of the high byte in a FLASH word when issuing a low-level programming command */ #define READ_WRITE_HIGH_BYTE_MASK (1 << 3) #define PROG_MODE_PAGED_WRITES_MASK (1 << 0) #define PROG_MODE_WORD_TIMEDELAY_MASK (1 << 1) #define PROG_MODE_WORD_VALUE_MASK (1 << 2) #define PROG_MODE_WORD_READYBUSY_MASK (1 << 3) #define PROG_MODE_PAGED_TIMEDELAY_MASK (1 << 4) #define PROG_MODE_PAGED_VALUE_MASK (1 << 5) #define PROG_MODE_PAGED_READYBUSY_MASK (1 << 6) #define PROG_MODE_COMMIT_PAGE_MASK (1 << 7) /* Function Prototypes: */ void ISPProtocol_EnterISPMode(void); void ISPProtocol_LeaveISPMode(void); void ISPProtocol_ProgramMemory(const uint8_t V2Command); void ISPProtocol_ReadMemory(const uint8_t V2Command); void ISPProtocol_ChipErase(void); void ISPProtocol_ReadFuseLockSigOSCCAL(const uint8_t V2Command); void ISPProtocol_WriteFuseLock(const uint8_t V2Command); void ISPProtocol_SPIMulti(void); #endif
// // GHUIImageView.h // GHUIKit // // Created by Gabriel Handford on 11/1/13. // Copyright (c) 2013 Gabriel Handford. All rights reserved. // #import "GHUIView.h" @interface GHUIImageView : GHUIView @property CGFloat cornerRadius UI_APPEARANCE_SELECTOR; @property CGFloat cornerRadiusRatio UI_APPEARANCE_SELECTOR; @property UIColor *overlayColor UI_APPEARANCE_SELECTOR; @property UIColor *shadowColor UI_APPEARANCE_SELECTOR; @property CGFloat shadowBlur UI_APPEARANCE_SELECTOR; @property UIColor *fillColor UI_APPEARANCE_SELECTOR; @property (readonly) UIImageView *imageView; @property (nonatomic) UIImage *image; - (void)setImageWithURL:(NSURL *)URL; @end @interface UIImageView (GHUIImageViewStub) - (void)setImageWithURL:(NSURL *)URL; @end
// // BHEmblemView.h // CollectionViewTutorial // // Created by Bryan Hansen on 11/6/12. // Copyright (c) 2012 Bryan Hansen. All rights reserved. // #import <UIKit/UIKit.h> @interface BHEmblemView : UICollectionReusableView + (CGSize)defaultSize; @end
/* ** Copyright (C) 1996, 1997 Microsoft Corporation. All Rights Reserved. ** ** File: warpIGC.h ** ** Author: ** ** Description: ** Header for the CwarpIGC class. This file was initially created by ** the ATL wizard. ** ** History: */ // warpIGC.h : Declaration of the CwarpIGC #ifndef __WARPIGC_H_ #define __WARPIGC_H_ #include "modelIGC.h" class CwarpIGC : public TmodelIGC<IwarpIGC> { public: CwarpIGC(void) : m_destination(NULL), m_bFixedPosition(false) // KG- added { } ~CwarpIGC(void) { } // IbaseIGC virtual HRESULT Initialize(ImissionIGC* pMission, Time now, const void* data, int length); virtual void Terminate(void) { AddRef(); GetMyMission()->DeleteWarp(this); TmodelIGC<IwarpIGC>::Terminate(); if (m_destination) { m_destination->Release(); m_destination = NULL; } m_bombs.purge(); Release(); } virtual void Update(Time now) { WarpBombLink* plink; while ((plink = m_bombs.first()) && //Intentional = (plink->data().timeExplosion <= now)) { ImissileTypeIGC* pmt = plink->data().pmt; assert(pmt); assert(pmt->GetObjectType() == OT_missileType); DamageTypeID dtid = pmt->GetDamageType(); float p = pmt->GetPower(); float r = pmt->GetBlastRadius(); IclusterIGC* pcluster = GetCluster(); if (pmt->HasCapability(c_eabmWarpBombDual)) // KGJV- only Dual explode this side pcluster->CreateExplosion(dtid, p, r, c_etBigShip, plink->data().timeExplosion, GetPosition(), NULL); IwarpIGC* pwarp = GetDestination(); pcluster = pwarp->GetCluster(); pcluster->CreateExplosion(dtid, p, r, c_etBigShip, plink->data().timeExplosion, pwarp->GetPosition(), NULL); delete plink; } TmodelIGC<IwarpIGC>::Update(now); } virtual int Export(void* data) const; virtual ObjectType GetObjectType(void) const { return OT_warp; } virtual ObjectID GetObjectID(void) const { return m_warpDef.warpID; } // ImodelIGC virtual void SetCluster(IclusterIGC* cluster) { AddRef(); //Overrride the model's cluster method so that we can maintain the cluster's warp list //(as well as letting the model maintain its model list) { IclusterIGC* c = GetCluster(); if (c) c->DeleteWarp(this); } TmodelIGC<IwarpIGC>::SetCluster(cluster); if (cluster) cluster->AddWarp(this); Release(); } // IwarpIGC virtual IwarpIGC* GetDestination(void) { if (!m_destination) { //Do a lazy evaluation of the destination so that all warps do not //need to be defined before defining any warps m_destination = GetMyMission()->GetWarp(m_warpDef.destinationID); if (m_destination) m_destination->AddRef(); } return m_destination; } virtual void AddBomb(Time timeExplosion, ImissileTypeIGC* pmt) { WarpBombLink* p = new WarpBombLink; p->data().timeExplosion = timeExplosion; p->data().pmt = pmt; // add the pulse effects Color blastColor(0.6f, 0.8f, 1.0f); float fExplodeTime = timeExplosion - Time::Now(); GetCluster()->GetClusterSite()->AddPulse(fExplodeTime, GetPosition(), pmt->GetBlastRadius(), blastColor); IwarpIGC* pDestination = GetDestination(); pDestination->GetCluster()->GetClusterSite()->AddPulse(fExplodeTime, m_destination->GetPosition(), pmt->GetBlastRadius(), blastColor); // this should tell the aleph rendering site about the pulse ThingSite* pThingSite = GetThingSite(); pThingSite->AddPulse(fExplodeTime, GetPosition(), pmt->GetBlastRadius(), blastColor); pThingSite = pDestination->GetThingSite(); pThingSite->AddPulse(fExplodeTime, GetPosition(), pmt->GetBlastRadius(), blastColor); m_bombs.last(p); } virtual const WarpBombList* GetBombs(void) const { return &m_bombs; } // KG - added virtual bool IsFixedPosition() { return m_bFixedPosition; } //Andon: Added for aleph mass limits virtual double MassLimit() { return m_MassLimit; } private: IwarpIGC* m_destination; WarpDef m_warpDef; WarpBombList m_bombs; bool m_bFixedPosition; // KG - added to prevent randomization double m_MassLimit; //Andon: Added for aleph mass limts }; #endif //__WARPIGC_H_
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import "NSObject.h" #import "FudConnection-Protocol.h" @class NSObject<OS_dispatch_queue>, NSObject<OS_xpc_object>, NSString; @interface FudXPCConnection : NSObject <FudConnection> { NSString *clientIdentifier; NSObject<OS_xpc_object> *connection; NSObject<OS_dispatch_queue> *connectionQueue; NSObject<OS_dispatch_queue> *sessionQueue; NSObject<OS_dispatch_queue> *replyQueue; id messageHandler; int notifyToken; _Bool didStop; } - (void)sendMessageToFud:(id)arg1 reply:(id)arg2; - (void)sendMessageToFud:(id)arg1; - (void)stop; - (_Bool)createSession; - (void)createConnection; - (_Bool)registerForBSDNotifications; - (void)dealloc; - (id)initWithClientName:(id)arg1 replyHandlerQueue:(id)arg2 messageHandler:(id)arg3; @end
#include <kstring.h> static const char BASECHR[17] = "0123456789abcdef"; static void * __memcpy1(void * dest, const void * src, size_t num); static void * __memcpy2(void * dest, const void * src, size_t num); char * itoa(int value, int base) { static char buffer[16]; char * p; int negative = 0; p = buffer + 14; p[1] = '\0'; if (base < 2 || base > 16) return NULL; if (value < 0) { negative = 1; value *= -1; } if (value == 0) *p = '0'; else { while (value > 0) { *p = BASECHR[value % base]; value /= base; p--; } if (negative) *p = '-'; else p++; } return p; } void * memcpy(void * dest, const void * src, size_t num) { return __memcpy2(dest, src, num); } void * memmove(void * dest, const void * src, size_t num) { if (dest > src) return __memcpy2(dest, src, num); else if (src > dest) return __memcpy1(dest, src, num); else return dest; } void * memset(void * dest, int value, size_t num) { unsigned char *p; for (p = dest; num--; p++) *p = (unsigned char) value; return dest; } char * strcpy(char * dest, const char * src) { char * p; const char * q; for (p = dest, q = src; *q; p++, q++) *p = *q; *p = '\0'; return dest; } char * strncpy(char * dest, const char * src, size_t n) { char * p; const char * q; for (p = dest, q = src; n-- && *q; p++, q++) *p = *q; *p = '\0'; // FIXME: should this happen? return dest; } size_t strlen(const char * str) { size_t len = 0; while (str[len++]) ; return len; } /* LOCAL FUNCTIONS */ static void * __memcpy1(void * dest, const void * src, size_t num) { char *p; const char *q; for (p = dest, q = src; num--; p++, q++) *p = *q; return dest; } static void * __memcpy2(void * dest, const void * src, size_t num) { char *p; const char *q; for (p = dest + num - 1, q = src + num - 1; num--; p--, q--) *p = *q; return dest; }
#pragma once #include <glbinding/nogl.h> #include <glbinding/gl/types.h> namespace gl10ext { using gl::GLextension; using gl::GLenum; using gl::GLboolean; using gl::GLbitfield; using gl::GLvoid; using gl::GLbyte; using gl::GLshort; using gl::GLint; using gl::GLclampx; using gl::GLubyte; using gl::GLushort; using gl::GLuint; using gl::GLsizei; using gl::GLfloat; using gl::GLclampf; using gl::GLdouble; using gl::GLclampd; using gl::GLeglClientBufferEXT; using gl::GLeglImageOES; using gl::GLchar; using gl::GLcharARB; using gl::GLhandleARB; using gl::GLhalfARB; using gl::GLhalf; using gl::GLfixed; using gl::GLintptr; using gl::GLsizeiptr; using gl::GLint64; using gl::GLuint64; using gl::GLintptrARB; using gl::GLsizeiptrARB; using gl::GLint64EXT; using gl::GLuint64EXT; using gl::GLsync; using gl::_cl_context; using gl::_cl_event; using gl::GLDEBUGPROC; using gl::GLDEBUGPROCARB; using gl::GLDEBUGPROCKHR; using gl::GLDEBUGPROCAMD; using gl::GLhalfNV; using gl::GLvdpauSurfaceNV; using gl::GLVULKANPROCNV; using gl::GLuint_array_2; using gl::AttribMask; using gl::ClearBufferMask; using gl::ClientAttribMask; using gl::ContextFlagMask; using gl::ContextProfileMask; using gl::FfdMaskSGIX; using gl::FragmentShaderColorModMaskATI; using gl::FragmentShaderDestMaskATI; using gl::FragmentShaderDestModMaskATI; using gl::MapBufferUsageMask; using gl::MemoryBarrierMask; using gl::PathFontStyle; using gl::PathMetricMask; using gl::PathRenderingMaskNV; using gl::PerformanceQueryCapsMaskINTEL; using gl::SyncObjectMask; using gl::TextureStorageMaskAMD; using gl::UseProgramStageMask; using gl::VertexHintsMaskPGI; using gl::UnusedMask; using gl::BufferAccessMask; using gl::BufferStorageMask; } // namespace gl10ext
/* LUFA Library Copyright (C) Dean Camera, 2009. dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ /* Copyright 2009 Denver Gingerich (denver [at] ossguy [dot] com) Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that the copyright notice and this permission notice and warranty disclaimer appear in supporting documentation, and that the name of the author not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall the author be liable for any special, 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. */ /** Circular bit buffer library. This will allow for individual bits * to be stored in packed form inside circular buffers, to reduce * overall RAM usage. */ #include "CircularBitBuffer.h" /** Function to initialize or reset a bit buffer, ready for data to be stored into it. */ void BitBuffer_Init(BitBuffer_t* const Buffer) { /* Reset the number of stored bits in the buffer */ Buffer->Elements = 0; /* Reset the data in and out pointer structures in the buffer to the first buffer bit */ Buffer->In.CurrentByte = Buffer->Data; Buffer->In.ByteMask = (1 << 0); Buffer->Out.CurrentByte = Buffer->Data; Buffer->Out.ByteMask = (1 << 0); } /** Function to store the given bit into the given bit buffer. */ void BitBuffer_StoreNextBit(BitBuffer_t* const Buffer, const bool Bit) { /* If the bit to store is true, set the next bit in the buffer */ if (Bit) *Buffer->In.CurrentByte |= Buffer->In.ByteMask; /* Increment the number of stored bits in the buffer counter */ Buffer->Elements++; /* Check if the current buffer byte is full of stored bits */ if (Buffer->In.ByteMask == (1 << 7)) { /* Check if the end of the buffer has been reached, if so reset to start of buffer, otherwise advance to next bit */ if (Buffer->In.CurrentByte != &Buffer->Data[sizeof(Buffer->Data) - 1]) Buffer->In.CurrentByte++; else Buffer->In.CurrentByte = Buffer->Data; /* Reset the storage bit mask in the current buffer byte to the first bit */ Buffer->In.ByteMask = (1 << 0); } else { /* Shift the current storage bit mask to the next bit in the current byte */ Buffer->In.ByteMask <<= 1; } } /** Function to retrieve the next bit stored in the given bit buffer. */ bool BitBuffer_GetNextBit(BitBuffer_t* const Buffer) { /* Retrieve the value of the next bit stored in the buffer */ bool Bit = ((*Buffer->Out.CurrentByte & Buffer->Out.ByteMask) != 0); /* Clear the buffer bit */ *Buffer->Out.CurrentByte &= ~Buffer->Out.ByteMask; /* Decrement the number of stored bits in the buffer counter */ Buffer->Elements--; /* Check if the current buffer byte is empty of stored bits */ if (Buffer->Out.ByteMask == (1 << 7)) { /* Check if the end of the buffer has been reached, if so reset to start of buffer, otherwise advance to next bit */ if (Buffer->Out.CurrentByte != &Buffer->Data[sizeof(Buffer->Data) - 1]) Buffer->Out.CurrentByte++; else Buffer->Out.CurrentByte = Buffer->Data; /* Reset the retrieval bit mask in the current buffer byte to the first bit */ Buffer->Out.ByteMask = (1 << 0); } else { /* Shift the current retrieval bit mask to the next bit in the current byte */ Buffer->Out.ByteMask <<= 1; } /* Return the retrieved bit from the buffer */ return Bit; }
/* * sgui_d3d9.h * This file is part of sgui * * Copyright (C) 2012 - David Oberhollenzer * * 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. */ /** * \file sgui_d3d9.h * * \brief Contains the Direct3D 9 context implementation. */ #ifndef SGUI_D3D9_H #define SGUI_D3D9_H #include "sgui_context.h" #include "sgui_window.h" #ifndef SGUI_DOXYGEN #define WIN32_LEAN_AND_MEAN #endif #include <windows.h> #include <d3d9.h> /** * \struct sgui_d3d9_context * * \implements sgui_context * * \brief A Direct3D 9 context implementation */ typedef struct { #ifndef SGUI_DOXYGEN sgui_context super; #endif sgui_window* wnd; /** \brief A pointer to the Direct3D device structure */ IDirect3DDevice9* device; /** \brief The present parameters used */ D3DPRESENT_PARAMETERS present; } sgui_d3d9_context; #endif /* SGUI_D3D9_H */
/* * Auto generated Run-Time-Environment Component Configuration File * *** Do not modify ! *** * * Project: 'ble_app_hrs_rscs_relay_pca10028_s130' * Target: 'nrf51422_xxac' */ #ifndef RTE_COMPONENTS_H #define RTE_COMPONENTS_H /* * Define the Device Header File: */ #define CMSIS_device_header "nrf.h" #endif /* RTE_COMPONENTS_H */
/*numPass=7, numTotal=7 Verdict:ACCEPTED, Visibility:1, Input:"1.2 2.3 2.7 5.3 7.6", ExpOutput:"Point is outside the Circle.", Output:"Point is outside the Circle." Verdict:ACCEPTED, Visibility:1, Input:"0.0 0.0 5.0 3.0 7.0", ExpOutput:"Point is outside the Circle.", Output:"Point is outside the Circle." Verdict:ACCEPTED, Visibility:1, Input:"3.0 4.0 5.0 7.0 7.0", ExpOutput:"Point is on the Circle.", Output:"Point is on the Circle." Verdict:ACCEPTED, Visibility:1, Input:"3.0 4.0 5.0 5.6 6.2", ExpOutput:"Point is inside the Circle.", Output:"Point is inside the Circle." Verdict:ACCEPTED, Visibility:0, Input:"-1.0 -2.0 5.0 1.5 2.0", ExpOutput:"Point is inside the Circle.", Output:"Point is inside the Circle." Verdict:ACCEPTED, Visibility:0, Input:"0.0 0.0 5.0 3.0 4.0", ExpOutput:"Point is on the Circle.", Output:"Point is on the Circle." Verdict:ACCEPTED, Visibility:0, Input:"0.0 0.0 5.0 3.0 5.0", ExpOutput:"Point is outside the Circle.", Output:"Point is outside the Circle." */ #include<stdio.h> int main() { float x, y, r, x1, y1; scanf ("%f %f %f %f %f",&x,&y,&r,&x1,&y1); { if ((x1-x)*(x1-x)+(y1-y)*(y1-y)==r*r) { printf ("Point is on the Circle."); } else if ((x1-x)*(x1-x)+(y1-y)*(y1-y)>r*r) { printf ("Point is outside the Circle."); } else { printf ("Point is inside the Circle."); } } return 0; }
// // RRChannelCell.h // Streams // // Created by James Reichley on 3/3/14. // Copyright (c) 2014 RadReichley Inc. All rights reserved. // // Note that the cell is circular, so it assumes a square frame @class RRChannel; @interface RRChannelCell : UICollectionViewCell @property (nonatomic, strong) RRChannel *channel; @end
// // XKMyDiaryCalendarView.h // MyDiary // // Created by 浪漫恋星空 on 2017/3/25. // Copyright © 2017年 浪漫恋星空. All rights reserved. // #import <UIKit/UIKit.h> #import "XKCalendarView.h" #import "XKDiaryModel.h" typedef void(^DidClickCellBlock)(UITableView *tableView, NSIndexPath *indexPath); @interface XKMyDiaryCalendarView : UIView @property (nonatomic, strong) XKCalendarView *calendarView; @property (nonatomic, strong) XKDiaryModel *model; @property (nonatomic, copy) DidClickCellBlock block; @end
#pragma once #include "core/vec3.h" #include "core/angle.h" #include "core/quat.h" #include "core/key.h" namespace euphoria::core { struct FpsController { FpsController(); void look(float delta_rot, float delta_look); void move_left(bool down); void move_right(bool down); void move_forward(bool down); void move_backward(bool down); void move_up(bool down); void move_down(bool down); void on_key(Key key, bool down); void update(float delta); [[nodiscard]] Quatf get_rotation() const; Angle rotation_angle; Angle look_angle; bool is_left_down = false; bool is_right_down = false; bool is_forward_down = false; bool is_backward_down = false; bool is_up_down = false; bool is_down_down = false; Vec3f position; float move_speed = 3.0f; float look_sensitivity = 0.10f; }; }
// // DCHImageCollectionViewCell.h // Kaleidoscope-of-500px // // Created by Derek Chen on 5/12/15. // Copyright (c) 2015 Derek Chen. All rights reserved. // #import <UIKit/UIKit.h> @class DCHPhotoModel; @interface DCHImageCollectionViewCell : UICollectionViewCell + (NSString *)cellIdentifier; - (void)refreshWithPhotoModel:(DCHPhotoModel *)photoModel imageSize:(CGSize)imageSize; - (void)refreshWithPhotoModel:(DCHPhotoModel *)photoModel imageSize:(CGSize)imageSize onScrollView:(UIScrollView *)scrollView scrollOnView:(UIView *)view; - (UIImage *)image; @end
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import "IBDropTargetResolverDelegate-Protocol.h" @protocol IBNSStackViewDropTargetResolverDelegate <IBDropTargetResolverDelegate> - (void)dropTargetResolver:(id)arg1 dropGravity:(long long)arg2 insertionIndexDidChange:(long long)arg3; - (void)dropTargetResolver:(id)arg1 dropGravity:(long long)arg2 insertionIndexWillChange:(long long)arg3; @end
/** * @file json-rpc.h * @date 02.08.2011 * @author Peter Spiess-Knafl * @brief json-rpc.h * * This file is meant to include all necessary .h files of this framework. */ #ifndef JSONRPCCPP_H_ #define JSONRPCCPP_H_ #include "server.h" #include "client.h" //For error handling and catching Exceptions. #include "exception.h" #ifdef HTTP_CONNECTOR #include "connectors/httpserver.h" #include "connectors/httpclient.h" #endif #include "specificationparser.h" #include "specificationwriter.h" #endif /* JSONRPCCPP_H_ */
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #pragma once #include <condition_variable> #include <memory> #include <thread> #include <unordered_map> #include <boost/filesystem.hpp> #include <folly/SharedMutex.h> #include <folly/Singleton.h> #include <folly/Synchronized.h> #include "mcrouter/lib/debug/Fifo.h" namespace facebook { namespace memcache { /** * Manager of fifos. */ class FifoManager { public: ~FifoManager(); /** * Fetches (creates if not found) a fifo by its full base path + threadId. * The final path of the returned fifo will have the following format: * "{fifoBasePath}.{threadId}". * At any given point in time, this instance manages at most one fifo per * basePath/threadId pair. * * @param fifoBasePath Base path of the fifo. * @return The "thread_local" fifo, or nullptr if fifoBasePath * is empty. */ std::shared_ptr<Fifo> fetchThreadLocal(const std::string& fifoBasePath); /** * Removes all elements from the fifo manager. */ void clear(); /** * Returns the singleton instance of FifoManager. * Note: Keep FifoManager's shared pointer for as little as possible. */ static std::shared_ptr<FifoManager> getInstance(); private: FifoManager(); folly::Synchronized< std::unordered_map<std::string, std::shared_ptr<Fifo>>, folly::SharedMutex> fifos_; // Thread that connects to fifos std::thread thread_; bool running_{true}; std::mutex mutex_; std::condition_variable cv_; /** * Fetches a fifo by its full path. If the fifo does not * exist yet, creates it and returns it to the caller. * * @param fifoPath Full path of the fifo. * @return The fifo. */ std::shared_ptr<Fifo> fetch(const std::string& fifoPath); /** * Finds a fifo by its full path. If not found, returns null. * * @param fifoPath Full path of the fifo. * @return The fifo or null if not found. */ std::shared_ptr<Fifo> find(const std::string& fifoPath); /** * Creates a fifo and stores it into the map. * * @param fifoPath Full path of the fifo. * @return The newly created fifo. */ std::shared_ptr<Fifo> createAndStore(const std::string& fifoPath); friend class folly::Singleton<FifoManager>; }; } // namespace memcache } // namespace facebook
/* Copyright (c) 2015 Mathias Panzenböck * * 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 MEDIAEXTRACT_MOD_H__ #define MEDIAEXTRACT_MOD_H__ #pragma once #include "mediaextract.h" #define MOD_4CH_MAGIC1 MAGIC("M.K.") #define MOD_4CH_MAGIC2 MAGIC("M!K!") #define MOD_4CH_MAGIC3 MAGIC("M&K!") #define MOD_4CH_MAGIC4 MAGIC("N.T.") #define MOD_4CH_MAGIC5 MAGIC("FLT4") #define MOD_8CH_MAGIC1 MAGIC("FLT8") #define MOD_8CH_MAGIC2 MAGIC("CD81") #define MOD_8CH_MAGIC3 MAGIC("OKTA") #define IS_MOD_TDZX_MAGIC(magic) \ (magic[0] == 'T' && \ magic[1] == 'D' && \ magic[2] == 'Z' && \ magic[3] > '0' && magic[3] <= '9') #define IS_MOD_XCHN_MAGIC(magic) \ (magic[0] > '0' && magic[0] <= '9' && \ magic[1] == 'C' && \ magic[2] == 'H' && \ magic[3] == 'N') #define IS_MOD_XXCH_MAGIC(magic) \ (magic[0] >= '0' && magic[0] <= '9' && \ magic[1] >= '0' && magic[1] <= '9' && \ magic[2] == 'C' && magic[3] == 'H') #define IS_MOD_XXCN_MAGIC(magic) \ (magic[0] >= '0' && magic[0] <= '9' && \ magic[1] >= '0' && magic[1] <= '9' && \ magic[2] == 'C' && magic[3] == 'N') #define IS_MOD_MAGIC(magic) \ (IS_MOD_4CH_MAGIC(magic) || \ IS_MOD_8CH_MAGIC(magic) || \ IS_MOD_XCHN_MAGIC(magic) || \ IS_MOD_XXCH_MAGIC(magic) || \ IS_MOD_XXCN_MAGIC(magic) || \ IS_MOD_TDZX_MAGIC(magic)) #define IS_MOD_4CH_MAGIC(magic) \ ((MAGIC(magic) == MOD_4CH_MAGIC1) || \ (MAGIC(magic) == MOD_4CH_MAGIC2) || \ (MAGIC(magic) == MOD_4CH_MAGIC3) || \ (MAGIC(magic) == MOD_4CH_MAGIC4) || \ (MAGIC(magic) == MOD_4CH_MAGIC5)) #define IS_MOD_8CH_MAGIC(magic) \ ((MAGIC(magic) == MOD_8CH_MAGIC1) || \ (MAGIC(magic) == MOD_8CH_MAGIC2) || \ (MAGIC(magic) == MOD_8CH_MAGIC3)) #define MOD_MAGIC_OFFSET 1080 int mod_isfile(const uint8_t *data, size_t input_len, size_t *lengthptr); #endif /* MEDIAEXTRACT_MOD_H__ */
// // PHAsset+MQExtension.h // MQExtensionKit // // Created by 冯明庆 on 2018/5/20. // Copyright © 2018 冯明庆. All rights reserved. // #import <Photos/Photos.h> @import UIKit; #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_8_0 /* typedef NS_ENUM(NSInteger , MQPHAssetCacheType) { MQPHAssetCacheType_default = 0, MQPHAssetCacheType_Normal , MQPHAssetCacheType_High_Quality , MQPHAssetCacheType_Fast }; */ typedef NSString * MQPHAssetType; FOUNDATION_EXPORT MQPHAssetType MQPHAssetType_Unknow ; FOUNDATION_EXPORT MQPHAssetType MQPHAssetType_Video ; FOUNDATION_EXPORT MQPHAssetType MQPHAssetType_Photo ; FOUNDATION_EXPORT MQPHAssetType MQPHAssetType_Audio ; FOUNDATION_EXPORT MQPHAssetType MQPHAssetType_Live_Photo ; @interface PHAsset (MQExtension) @property (readonly) MQPHAssetType type_asset; /* @property (nonatomic , strong , readonly) NSMutableDictionary *mq_phasset_dict_normal_cache ; @property (nonatomic , strong , readonly) NSMutableDictionary *mq_phasset_dict_high_quality_cache ; @property (nonatomic , strong , readonly) NSMutableDictionary *mq_phasset_dict_fast_cache ; - (void) mq_cache_image_size : (CGSize) size type : (MQPHAssetCacheType) type complete : (void (^)(UIImage * image , PHAsset * asset , NSDictionary *dict_info)) mq_complete_block ; - (void) mq_destory_cache : (MQPHAssetCacheType) type ; - (void) mq_destory_all_cache ; */ @end #endif @interface UIImage (MQExtension_Orientation) // borrowed from : http://www.cnblogs.com/jiangyazhou/archive/2012/03/22/2412343.html ; /// fix image orientation . for which EXIF info can be lost . // 修复 图片的方向 . 因为 图片的 EXIF 可能丢失 . - (UIImage *) mq_fix_orientation ; - (UIImage *) mq_fix_orientation : (UIImageOrientation) orientation ; @end
/*************************************************************************/ /* editor_help.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ /* "Software"), to deal in the Software without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of the Software, and to */ /* permit persons to whom the Software is furnished to do so, subject to */ /* the following conditions: */ /* */ /* The above copyright notice and this permission notice shall be */ /* included in all copies or substantial portions of the Software. */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #ifndef EDITOR_HELP_H #define EDITOR_HELP_H #include "editor/editor_plugin.h" #include "scene/gui/menu_button.h" #include "scene/gui/panel_container.h" #include "scene/gui/rich_text_label.h" #include "scene/gui/split_container.h" #include "scene/gui/tab_container.h" #include "scene/gui/text_edit.h" #include "scene/gui/tree.h" #include "editor/code_editor.h" #include "editor/doc/doc_data.h" #include "scene/main/timer.h" class EditorNode; class EditorHelpSearch : public ConfirmationDialog { OBJ_TYPE(EditorHelpSearch, ConfirmationDialog) EditorNode *editor; LineEdit *search_box; Tree *search_options; String base_type; void _update_search(); void _sbox_input(const InputEvent &p_ie); void _confirmed(); void _text_changed(const String &p_newtext); protected: void _notification(int p_what); static void _bind_methods(); public: void popup(); void popup(const String &p_term); EditorHelpSearch(); }; class EditorHelpIndex : public ConfirmationDialog { OBJ_TYPE(EditorHelpIndex, ConfirmationDialog); LineEdit *search_box; Tree *class_list; HashMap<String, TreeItem *> tree_item_map; void _tree_item_selected(); void _text_changed(const String &p_text); void _sbox_input(const InputEvent &p_ie); void _update_class_list(); void add_type(const String &p_type, HashMap<String, TreeItem *> &p_types, TreeItem *p_root); protected: void _notification(int p_what); static void _bind_methods(); public: void select_class(const String &p_class); void popup(); EditorHelpIndex(); }; class EditorHelp : public VBoxContainer { OBJ_TYPE(EditorHelp, VBoxContainer); enum Page { PAGE_CLASS_LIST, PAGE_CLASS_DESC, PAGE_CLASS_PREV, PAGE_CLASS_NEXT, PAGE_SEARCH, CLASS_SEARCH, }; bool select_locked; String prev_search; String edited_class; EditorNode *editor; Map<String, int> method_line; Map<String, int> signal_line; Map<String, int> property_line; Map<String, int> theme_property_line; Map<String, int> constant_line; int description_line; RichTextLabel *class_desc; HSplitContainer *h_split; static DocData *doc; ConfirmationDialog *search_dialog; LineEdit *search; String base_path; void _help_callback(const String &p_topic); void _add_text(const String &p_text); bool scroll_locked; //void _button_pressed(int p_idx); void _add_type(const String &p_type); void _scroll_changed(double p_scroll); void _class_list_select(const String &p_select); void _class_desc_select(const String &p_select); void _class_desc_input(const InputEvent &p_input); Error _goto_desc(const String &p_class, int p_vscr = -1); //void _update_history_buttons(); void _update_doc(); void _request_help(const String &p_string); void _search(const String &p_str); void _search_cbk(); void _unhandled_key_input(const InputEvent &p_ev); protected: void _notification(int p_what); static void _bind_methods(); public: static void generate_doc(); static DocData *get_doc_data() { return doc; } void go_to_help(const String &p_help); void go_to_class(const String &p_class, int p_scroll = 0); void popup_search(); void search_again(); String get_class_name(); void set_focused() { class_desc->grab_focus(); } int get_scroll() const; void set_scroll(int p_scroll); EditorHelp(); ~EditorHelp(); }; class EditorHelpBit : public Panel { OBJ_TYPE(EditorHelpBit, Panel); RichTextLabel *rich_text; void _go_to_help(String p_what); void _meta_clicked(String p_what); protected: static void _bind_methods(); void _notification(int p_what); public: void set_text(const String &p_text); EditorHelpBit(); }; #endif // EDITOR_HELP_H
#ifndef CQSVGFeDiffuseLighting_H #define CQSVGFeDiffuseLighting_H #include <CQSVGObject.h> #include <CSVGFeDiffuseLighting.h> class CQSVG; class CQSVGFeDiffuseLighting : public CQSVGObject, public CSVGFeDiffuseLighting { Q_OBJECT Q_PROPERTY(QColor lightingColor READ getLightingColor WRITE setLightingColor ) Q_PROPERTY(double surfaceScale READ getSurfaceScale WRITE setSurfaceScale ) Q_PROPERTY(double diffuseConstant READ getDiffuseConstant WRITE setDiffuseConstant) public: using Color = CSVGInheritValT<CSVGColor>; public: CQSVGFeDiffuseLighting(CQSVG *svg); QColor getLightingColor() const; void setLightingColor(const QColor &c); void addProperties(CQPropertyTree *tree, const std::string &name) override; }; #endif
/* * Copyright (C) the libgit2 contributors. All rights reserved. * * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ #include BLIK_LIBGIT2_U_common_h //original-code:"common.h" #include BLIK_LIBGIT2_U_git2__types_h //original-code:"git2/types.h" #include BLIK_LIBGIT2_U_git2__remote_h //original-code:"git2/remote.h" #include BLIK_LIBGIT2_U_git2__net_h //original-code:"git2/net.h" #include BLIK_LIBGIT2_U_git2__transport_h //original-code:"git2/transport.h" #include BLIK_LIBGIT2_U_git2__sys__transport_h //original-code:"git2/sys/transport.h" #include BLIK_LIBGIT2_U_path_h //original-code:"path.h" typedef struct transport_definition { char *prefix; git_transport_cb fn; void *param; } transport_definition; static git_smart_subtransport_definition http_subtransport_definition = { git_smart_subtransport_http, 1 }; static git_smart_subtransport_definition git_subtransport_definition = { git_smart_subtransport_git, 0 }; #ifdef GIT_SSH static git_smart_subtransport_definition ssh_subtransport_definition = { git_smart_subtransport_ssh, 0 }; #endif static transport_definition local_transport_definition = { "file://", git_transport_local, NULL }; static transport_definition transports[] = { { "git://", git_transport_smart, &git_subtransport_definition }, { "http://", git_transport_smart, &http_subtransport_definition }, #if defined(GIT_SSL) || defined(GIT_WINHTTP) { "https://", git_transport_smart, &http_subtransport_definition }, #endif { "file://", git_transport_local, NULL }, #ifdef GIT_SSH { "ssh://", git_transport_smart, &ssh_subtransport_definition }, #endif { NULL, 0, 0 } }; static git_vector custom_transports = GIT_VECTOR_INIT; #define GIT_TRANSPORT_COUNT (sizeof(transports)/sizeof(transports[0])) - 1 static transport_definition * transport_find_by_url(const char *url) { size_t i = 0; transport_definition *d; /* Find a user transport who wants to deal with this URI */ git_vector_foreach(&custom_transports, i, d) { if (strncasecmp(url, d->prefix, strlen(d->prefix)) == 0) { return d; } } /* Find a system transport for this URI */ for (i = 0; i < GIT_TRANSPORT_COUNT; ++i) { d = &transports[i]; if (strncasecmp(url, d->prefix, strlen(d->prefix)) == 0) { return d; } } return NULL; } static int transport_find_fn( git_transport_cb *out, const char *url, void **param) { transport_definition *definition = transport_find_by_url(url); #ifdef GIT_WIN32 /* On Windows, it might not be possible to discern between absolute local * and ssh paths - first check if this is a valid local path that points * to a directory and if so assume local path, else assume SSH */ /* Check to see if the path points to a file on the local file system */ if (!definition && git_path_exists(url) && git_path_isdir(url)) definition = &local_transport_definition; #endif /* For other systems, perform the SSH check first, to avoid going to the * filesystem if it is not necessary */ /* It could be a SSH remote path. Check to see if there's a : * SSH is an unsupported transport mechanism in this version of libgit2 */ if (!definition && strrchr(url, ':')) { // re-search transports again with ssh:// as url so that we can find a third party ssh transport definition = transport_find_by_url("ssh://"); } #ifndef GIT_WIN32 /* Check to see if the path points to a file on the local file system */ if (!definition && git_path_exists(url) && git_path_isdir(url)) definition = &local_transport_definition; #endif if (!definition) return GIT_ENOTFOUND; *out = definition->fn; *param = definition->param; return 0; } /************** * Public API * **************/ int git_transport_new(git_transport **out, git_remote *owner, const char *url) { git_transport_cb fn; git_transport *transport; void *param; int error; if ((error = transport_find_fn(&fn, url, &param)) == GIT_ENOTFOUND) { giterr_set(GITERR_NET, "Unsupported URL protocol"); return -1; } else if (error < 0) return error; if ((error = fn(&transport, owner, param)) < 0) return error; GITERR_CHECK_VERSION(transport, GIT_TRANSPORT_VERSION, "git_transport"); *out = transport; return 0; } int git_transport_register( const char *scheme, git_transport_cb cb, void *param) { git_buf prefix = GIT_BUF_INIT; transport_definition *d, *definition = NULL; size_t i; int error = 0; assert(scheme); assert(cb); if ((error = git_buf_printf(&prefix, "%s://", scheme)) < 0) goto on_error; git_vector_foreach(&custom_transports, i, d) { if (strcasecmp(d->prefix, prefix.ptr) == 0) { error = GIT_EEXISTS; goto on_error; } } definition = git__calloc(1, sizeof(transport_definition)); GITERR_CHECK_ALLOC(definition); definition->prefix = git_buf_detach(&prefix); definition->fn = cb; definition->param = param; if (git_vector_insert(&custom_transports, definition) < 0) goto on_error; return 0; on_error: git_buf_free(&prefix); git__free(definition); return error; } int git_transport_unregister(const char *scheme) { git_buf prefix = GIT_BUF_INIT; transport_definition *d; size_t i; int error = 0; assert(scheme); if ((error = git_buf_printf(&prefix, "%s://", scheme)) < 0) goto done; git_vector_foreach(&custom_transports, i, d) { if (strcasecmp(d->prefix, prefix.ptr) == 0) { if ((error = git_vector_remove(&custom_transports, i)) < 0) goto done; git__free(d->prefix); git__free(d); if (!custom_transports.length) git_vector_free(&custom_transports); error = 0; goto done; } } error = GIT_ENOTFOUND; done: git_buf_free(&prefix); return error; } int git_transport_init(git_transport *opts, unsigned int version) { GIT_INIT_STRUCTURE_FROM_TEMPLATE( opts, version, git_transport, GIT_TRANSPORT_INIT); return 0; }
// // NSThread+JORunLoop.h // JOKit // // Created by 刘维 on 16/11/9. // Copyright © 2016年 Joshua. All rights reserved. // #import <Foundation/Foundation.h> @interface NSThread(JORunLoop) /** 返回单例的Thread,并默认开启了Runloop. 建议使用这个,你可以在任何线程里面调用它. @return NSThread. */ + (NSThread *)joRunLoopThread; /** 返回新的的Thread,并默认开启了Runloop. @return NSThread. */ + (NSThread *)joNewRunLoopThread; @end
#ifndef _CONVERT_H_ #define _CONVERT_H_ #include <string> class Convert { public: Convert() = default; ~Convert() = default; Convert(const Convert &) = delete; Convert& operator=(const Convert &) = delete; public: static std::string BoolToStr(bool); static std::string IntToStr(int); static std::string UIntToStr(unsigned); static std::string LongToStr(long); static std::string ULongToStr(unsigned long); static std::string LLToStr(long long); static std::string ULLToStr(unsigned long long); static std::string FloatToStr(float); static std::string DoubleToStr(double); static std::string LDoubleToStr(long double); static bool StrToBool(const std::string &, bool &); static bool StrToInt(const std::string &, int &); static bool StrToUInt(const std::string &, unsigned &); static bool StrToLong(const std::string &, long &); static bool StrToULong(const std::string &, unsigned long &); static bool StrToLL(const std::string &, long long &); static bool StrToULL(const std::string &, unsigned long long &); static bool StrToFloat(const std::string &, float &); static bool StrToDouble(const std::string &, double &); static bool StrToLDouble(const std::string &, long double &); }; #endif
#ifndef PROGRESSDIALOG_H #define PROGRESSDIALOG_H #include <QDialog> #include <QtConcurrentRun> #include "../FATX/FATX/StaticInformation.h" #include "../FATX/IO/xDeviceFileStream.h" #include "../FATX/FATX/stfspackage.h" #include <qgraphicsscene.h> enum Operations { OperationCopyToDisk }; namespace Ui { class ProgressDialog; } class ProgressDialog : public QDialog { Q_OBJECT public: ProgressDialog(QWidget *parent, Operations Operation, std::vector<std::string> Paths, std::string OutPath, std::vector<Drive*>& Drives); ~ProgressDialog(); void PerformOperation( Operations Operation, std::vector<std::string> Paths, std::string OutPath, std::vector<Drive*>& Drives); private: Ui::ProgressDialog *ui; void CopyFileToLocalDisk( std::vector<std::string> Paths, std::string OutPath, std::vector<Drive*>& Drives ); Operations operation; QGraphicsScene *scene; int PathCount; int FilesTotal; int FilesCompleted; QFuture<void> WorkerThread; public slots: void OnFileProgressChanged(const Progress &p); }; #endif // PROGRESSDIALOG_H
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__c_dest_char_cat_21.c Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_dest.label.xml Template File: sources-sink-21.tmpl.c */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: Allocate using malloc() and set data pointer to a small buffer * GoodSource: Allocate using malloc() and set data pointer to a large buffer * Sink: cat * BadSink : Copy string to data using strcat * Flow Variant: 21 Control flow: Flow controlled by value of a static global variable. All functions contained in one file. * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD /* The static variable below is used to drive control flow in the source function */ static int badStatic = 0; static char * badSource(char * data) { if(badStatic) { /* FLAW: Allocate and point data to a small buffer that is smaller than the large buffer used in the sinks */ data = (char *)malloc(50*sizeof(char)); data[0] = '\0'; /* null terminate */ } return data; } void CWE122_Heap_Based_Buffer_Overflow__c_dest_char_cat_21_bad() { char * data; data = NULL; badStatic = 1; /* true */ data = badSource(data); { char source[100]; memset(source, 'C', 100-1); /* fill with 'C's */ source[100-1] = '\0'; /* null terminate */ /* POTENTIAL FLAW: Possible buffer overflow if source is larger than sizeof(data)-strlen(data) */ strcat(data, source); printLine(data); free(data); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* The static variables below are used to drive control flow in the source functions. */ static int goodG2B1Static = 0; static int goodG2B2Static = 0; /* goodG2B1() - use goodsource and badsink by setting the static variable to false instead of true */ static char * goodG2B1Source(char * data) { if(goodG2B1Static) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Allocate and point data to a large buffer that is at least as large as the large buffer used in the sink */ data = (char *)malloc(100*sizeof(char)); data[0] = '\0'; /* null terminate */ } return data; } static void goodG2B1() { char * data; data = NULL; goodG2B1Static = 0; /* false */ data = goodG2B1Source(data); { char source[100]; memset(source, 'C', 100-1); /* fill with 'C's */ source[100-1] = '\0'; /* null terminate */ /* POTENTIAL FLAW: Possible buffer overflow if source is larger than sizeof(data)-strlen(data) */ strcat(data, source); printLine(data); free(data); } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the if in the source function */ static char * goodG2B2Source(char * data) { if(goodG2B2Static) { /* FIX: Allocate and point data to a large buffer that is at least as large as the large buffer used in the sink */ data = (char *)malloc(100*sizeof(char)); data[0] = '\0'; /* null terminate */ } return data; } static void goodG2B2() { char * data; data = NULL; goodG2B2Static = 1; /* true */ data = goodG2B2Source(data); { char source[100]; memset(source, 'C', 100-1); /* fill with 'C's */ source[100-1] = '\0'; /* null terminate */ /* POTENTIAL FLAW: Possible buffer overflow if source is larger than sizeof(data)-strlen(data) */ strcat(data, source); printLine(data); free(data); } } void CWE122_Heap_Based_Buffer_Overflow__c_dest_char_cat_21_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()..."); CWE122_Heap_Based_Buffer_Overflow__c_dest_char_cat_21_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE122_Heap_Based_Buffer_Overflow__c_dest_char_cat_21_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
#ifdef __OBJC__ #import <UIKit/UIKit.h> #else #ifndef FOUNDATION_EXPORT #if defined(__cplusplus) #define FOUNDATION_EXPORT extern "C" #else #define FOUNDATION_EXPORT extern #endif #endif #endif FOUNDATION_EXPORT double Pods_HackProductARHVersionNumber; FOUNDATION_EXPORT const unsigned char Pods_HackProductARHVersionString[];
/* * file: odometer.c * created: 20160807 * author(s): mr-augustine * * Defines the functions used to operate the odometer. This library counts * the number rotations performed by the robot's drive gear; and stores the * value in a statevars variable. * * The rotations are detected by a hall effect sensor which observes a magnet * affixed to the drive gear. */ #include <avr/interrupt.h> #include <avr/io.h> #include "odometer.h" #include "statevars.h" #include "uwrite.h" static volatile uint32_t fwd_count; static volatile uint32_t rev_count; static volatile uint32_t tick_time; static Wheel_Direction wheel_turn_direction; static void initialize_odometer_statevars(void); ISR(ODOMETER_ISR_VECT) { // TODO Decide if we should also grab a timestamp during this event. // Taking a timestamp reading closer to the source should be more accurate. // Though I'm not sure by how much. ISRs really should be lean. // Update: according to data collected in a previous test, you can expect // to see anywhere from zero up to four ticks in a single iteration. // Increment the approriate count variable (fwd_count or rev_count) if (wheel_turn_direction == Direction_Forward) { fwd_count++; //uwrite_println_long(&fwd_count); } else { rev_count++; } // The micros() function doesn't appear to produce meaningful results. Many // times, the micros value is repeated between iterations, and those values // are unexpectedly low. This time we'll try using the main loop timer (TCNT1) // to get timing information. Each tick represents 4 microseconds. And we can // expect up to 25,000 microseconds in an iteration. //tick_time = micros(); tick_time = TCNT1; } static void initialize_odometer_statevars(void) { statevars.odometer_ticks = 0.0; statevars.odometer_timestamp = 0; statevars.odometer_ticks_are_fwd = 1; return; } uint8_t odometer_init(void) { // Turn on the pull-up resistor for the odometer pin ODOMETER_PORT |= (1 << ODOMETER_PIN); // Set the odometer pin as an input ODOMETER_DDR &= ~(1 << ODOMETER_PIN); // Set the External Interrupt to Falling Edge // The odometer pin is normally high when the magnet is not present, and then // becomes low when the magnet passes in front of it. // See Table 15-1 in the Atmel specs EICRA &= ~(1 << ISC20); EICRA |= (1 << ISC21); // Enable interrupts on odometer pin EIMSK |= (1 << ODOMETER_INTERRUPT_MASK_PIN); odometer_reset(); odometer_set_direction(Direction_Forward); return 1; } void odometer_reset(void) { fwd_count = 0; rev_count = 0; tick_time = 0; return; } void odometer_set_direction(Wheel_Direction wd) { wheel_turn_direction = wd; return; } uint32_t odometer_get_fwd_count(void) { return fwd_count; } uint32_t odometer_get_rev_count(void) { return rev_count; } uint32_t odometer_get_tick_time(void) { return tick_time; } void odometer_update(void) { // TODO consider copying the timestamp that was (will be) set by the ISR // The ISR will probably write to a volatile variable; just copy that value // into the statevars.timestamp field. This will represent the final timestamp // of the final tick during the current iteration. if (wheel_turn_direction == Direction_Forward) { statevars.odometer_ticks = fwd_count; statevars.odometer_ticks_are_fwd = 1; } else { statevars.odometer_ticks = rev_count; statevars.odometer_ticks_are_fwd = 0; } statevars.odometer_timestamp = tick_time; return; }
#pragma once #include <CEGUI\CEGUI.h> #include <CEGUI\RendererModules\OpenGL\GL3Renderer.h> #include <glm\glm.hpp> #include <SDL\SDL_events.h> namespace GameEngine { class GUI { public: GUI() {}; ~GUI() { if (!m_freed) DestroyGUI(); }; //initialize the gui void Init(const std::string& _resourceDirectory); //destroy the gui void DestroyGUI(); //draw the gui void Draw(); //update the gui void Update(); //sets the mouse cursor to a custom image void SetMouseCursor(const std::string& _imageFile); //shows teh mouse cursor void ShowMouseCursor(); //hides the mouse cursor void HideMouseCursor(); //handles SDL events void OnSDLEvent(SDL_Event& _evnt); //Loads a scheme file void LoadScheme(const std::string& _schemeFile); //Sets the font the gui uses void SetFont(const std::string& _fontFile); //create a widget CEGUI::Window* CreateWidget(const std::string& type, const glm::vec4& destRectPerc, const glm::vec4& destRectPix, const std::string& name = ""); //create a child widget (has a parent) CEGUI::Window* CreateWidget(CEGUI::Window* parent, const std::string& type, const glm::vec4& destRectPerc, const glm::vec4& destRectPix, const std::string& name = ""); //sets the widget destination rectangle static void SetWidgetDestRect(CEGUI::Window* widget, const glm::vec4& destRectPerc, const glm::vec4& destRectPix); //Getters static CEGUI::OpenGL3Renderer* GetRenderer() noexcept { return m_renderer; } const CEGUI::GUIContext* GetContext() const noexcept { return m_context; } private: static CEGUI::OpenGL3Renderer* m_renderer; CEGUI::GUIContext* m_context{ nullptr }; CEGUI::Window* m_root{ nullptr }; unsigned int m_lastTime{ 0 }; bool m_freed{ false }; }; }
// // AppDelegate.h // Urge // // Created by cx on 15/7/23. // Copyright (c) 2015年 cx. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
#pragma once #include "animation.h" namespace anim { class MotionMap; namespace filter { class Base : public boost::noncopyable { public: virtual ~Base() = 0; protected: virtual void init(const MotionMap& mmap); virtual float eval(const MotionMap& mmap, std::size_t x, std::size_t y) const = 0; private: friend class ::anim::MotionMap; }; class LinearTransition : public Base { public: LinearTransition(const std::size_t transitionLength); protected: virtual float eval(const MotionMap& mmap, std::size_t x, std::size_t y) const override; private: int m_halfWindowWidth; }; class IgnoreIdentity : public Base { public: IgnoreIdentity(const std::size_t transitionLength); protected: virtual float eval(const MotionMap& mmap, std::size_t x, std::size_t y) const override; private: std::size_t m_halfWindowWidth; }; } // namespace filter } // namespace anim
// // Address.h // Maishoku // // Created by Jonathan Sweemer on 11/1/11. // Copyright (c) 2011 Dynaptico LLC. All rights reserved. // #import <Foundation/Foundation.h> @interface Address : NSObject @property (nonatomic, strong) NSString *address; @property (nonatomic, strong) NSString *buildingName; @property (nonatomic, strong) NSDate *lastDate; @property (nonatomic, strong) NSDate *firstDate; @property (nonatomic, strong) NSNumber *identifier; @property (nonatomic, strong) NSNumber *frequency; @property (nonatomic, assign) double lat; @property (nonatomic, assign) double lon; @end
#include <stdlib.h> #include <stdio.h> #include <signal.h> #include <getopt.h> #include <ctype.h> #include <unistd.h> #include <string.h> #include <errno.h> #include <pthread.h> #include "measurement.h" #include "publish.h" static bool running = true; static unsigned int reflections; static pthread_mutex_t lock; static const unsigned int PUBLISH_INTERVAL_YIELD_S = 1; static const unsigned int DEFAULT_INTERVAL_S = 15 * 60; static void onReflection(void){ fprintf(stdout, "Reflection detected\n"); pthread_mutex_lock(&lock); ++reflections; pthread_mutex_unlock(&lock); } static void sigHandler(int signum){ switch (signum){ case SIGINT: case SIGTERM: running = 0; fprintf(stderr, "signal %d results in running = %d\r\n", signum, running); break; case SIGHUP: fprintf(stderr, "signal SIGHUP does nothing\r\n"); break; default: fprintf(stderr, "signal %d not handled\r\n", signum); } } static bool parseOptions(int argc, char **argv, measurementConfig_t *measurementConfig, publishConfig_t *publishConfig, unsigned int *interval, bool *daemon, bool *fake){ int opt; while (-1 != (opt = getopt(argc, argv, "fdh:p:a:k:c:t:i"))) { switch (opt) { case 'i':{ int tmp = atoi(optarg); if (tmp > 10){ *interval = tmp; } else { fprintf(stderr, "Invalid interval\n"); } break; } case 'd': *daemon = true; break; case 'f': *fake = true; break; case 'h': publishConfig->hostAddress = optarg; break; case 'p': publishConfig->port = atoi(optarg); break; case 'a': publishConfig->caFilename = optarg; break; case 'k': publishConfig->clientKeyFilename = optarg; break; case 'c': publishConfig->clientCertFilename = optarg; break; case 't': measurementConfig->reflectionMeterThreshold = atoi(optarg); measurementConfig->reflectionMeterPort = atoi(optarg); break; case '?': if (isprint(optopt)) { fprintf(stderr,"Unknown option `-%c'.", optopt); } else { fprintf(stderr, "Unknown option character `\\x%x'.", optopt); } return false; default: fprintf(stderr, "Error in command line argument parsing"); return false; } } return true; } int main(int argc, char **argv){ unsigned int lastCount = 0; bool daemonize = false; bool fake = false; unsigned int interval = DEFAULT_INTERVAL_S; struct sigaction sa = { .sa_handler = sigHandler }; time_t lastPublish = (time_t)0; setvbuf(stdout, NULL, _IONBF, 0); publishConfig_t publishConfig; publishConfigDefault(&publishConfig); measurementConfig_t measurementConfig; measurementConfigDefault(&measurementConfig); measurementConfig.onReflection = onReflection; if (parseOptions(argc, argv, &measurementConfig, &publishConfig, &interval, &daemonize, &fake) == false){ fprintf(stderr, "Could not parse options\r\n"); return EXIT_FAILURE; } if (daemonize == true){ if (daemon(1, 1) < 0){ fprintf(stderr, "Could not daemonize (%s)\r\n", strerror(errno)); } } if (publishInit(&publishConfig) == false){ fprintf(stderr, "Could not init publish\r\n"); return EXIT_FAILURE; } if (measurementInit(&measurementConfig) == false){ fprintf(stderr, "Could not init measure\r\n"); if (fake == false){ return EXIT_FAILURE; } } sigaction(SIGHUP, &sa, NULL); sigaction(SIGINT, &sa, NULL); sigaction(SIGTERM, &sa, NULL); while (running){ time_t now; pthread_mutex_lock(&lock); unsigned int count = reflections; pthread_mutex_unlock(&lock); if (difftime(time(&now), lastPublish) > (double)interval){ lastPublish = now; if (publishReflections(count - lastCount) == false){ fprintf(stderr, "Could not publish single reflection\r\n"); } lastCount = count; } if (fake == true){ onReflection(); } publishProcess(PUBLISH_INTERVAL_YIELD_S); } measurementDestroy(); publishDestroy(); return 0; }
#ifndef dplyr__Quosure_h #define dplyr__Quosure_h #include <tools/SymbolString.h> #include "SymbolVector.h" namespace dplyr { inline SEXP quosure(SEXP expr, SEXP env) { Language quo("~", expr); quo.attr(".Environment") = env; quo.attr("class") = CharacterVector("formula"); return quo; } class NamedQuosure { public: NamedQuosure(SEXP data_, SymbolString name__ = "") : data(data_), name_(name__) {} NamedQuosure(const Formula& data_, SymbolString name__ = "") : data(data_), name_(name__) {} NamedQuosure(const NamedQuosure& other) : data(other.data), name_(other.name_) {} SEXP expr() const { return Rf_duplicate(CADR(data)); } SEXP env() const { static SEXP sym_dotenv = Rf_install(".Environment"); return Rf_getAttrib(data, sym_dotenv); } SymbolString name() const { return name_; } private: Formula data; SymbolString name_; }; } // namespace dplyr namespace Rcpp { using namespace dplyr; template <> inline bool is<NamedQuosure>(SEXP x) { bool is_tilde = TYPEOF(x) == LANGSXP && Rf_length(x) == 2 && CAR(x) == Rf_install("~"); SEXP env = Rf_getAttrib(x, Rf_install(".Environment")); bool has_env = TYPEOF(env) == ENVSXP; return is_tilde && has_env; } } // namespace Rcpp namespace dplyr { class QuosureList { public: QuosureList(const List& data_) : data() { int n = data_.size(); if (n == 0) return; CharacterVector names = data_.names(); for (int i = 0; i < n; i++) { SEXP x = data_[i]; if (!is<NamedQuosure>(x)) { stop("corrupt tidy quote"); } data.push_back(NamedQuosure(x, SymbolString(names[i]))); } } const NamedQuosure& operator[](int i) const { return data[i]; } int size() const { return data.size(); } bool single_env() const { if (data.size() <= 1) return true; SEXP env = data[0].env(); for (size_t i = 1; i < data.size(); i++) { if (data[i].env() != env) return false; } return true; } SymbolVector names() const { CharacterVector out(data.size()); for (size_t i = 0; i < data.size(); ++i) { out[i] = data[i].name().get_string(); } return SymbolVector(out); } private: std::vector<NamedQuosure> data; }; } // namespace dplyr #endif
/* MAlib * Copyright (C) 1999-2003 Kazuo HIYANE, Jun IIO, and Tomoyuki YATABE * Copyright (C) 2003 Akira SAITO * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "holographic.h" #define MALIB_HOLOGRAPHIC_NOISEPATTERN_NUM 256 const static int malib_holographic_noisepattern[MALIB_HOLOGRAPHIC_NOISEPATTERN_NUM] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 17, 17, 18, 18, 19, 20, 20, 21, 22, 22, 23, 24, 25, 26, 26, 27, 28, 29, 30, 31, 32, 32, 34, 35, 36, 37, 38, 39, 40, 41, 43, 43, 45, 46, 47, 49, 50, 51, 53, 54, 56, 57, 58, 60, 62, 63, 65, 67, 68, 70, 72, 73, 75, 77, 79, 81, 83, 85, 87, 89, 90, 93, 95, 97, 99, 101, 104, 106, 109, 111, 114, 116, 119, 121, 124, 126, 129, 132, 134, 137, 140, 143, 146, 150, 153, 156, 159, 162, 165, 168, 172, 175, 178, 182, 186, 189, 192, 197, 200, 204, 208, 211, 216, 220, 224, 228, 232, 236, 241, 245, 249, 254, 258, 263, 268, 273, 277, 282, 287, 292, 297, 302, 307, 313, 318, 323, 328, 334, 339, 345, 351, 357, 362, 369, 374, 380, 387, 393, 399, 405, 412}; /* private function prototypes **************************************/ static void malib_holographic_write_frame_data (MalibHolographic* filter, MalibFrame* frame); /* virtual function table *******************************************/ static MalibHolographicClass malib_holographic_class = { (void (*)(MalibObject*)) malib_bgdiff_delete, (void (*)(MalibSource*, MalibFrame*)) malib_holographic_write_frame_data }; /* public functions *************************************************/ MalibHolographic* malib_holographic_new () { MalibHolographic *retptr; MALIB_FILTER_GENERIC_NEW_0 ( MalibHolographic, &malib_holographic_class, MALIB_FRAME_COLORMODEL_RGB, &retptr ); malib_bgdiff_init ((MalibBgDiff*) retptr); retptr->phase = 0; srandom(time(NULL)); return retptr; } MalibHolographic* malib_holographic_new_with_buf (MalibBuffer* buf) { MALIB_FILTER_GENERIC_NEW_WITH_BUF ( MalibHolographic, malib_holographic_new, malib_bgdiff_set_buffer, buf ); } MalibHolographic* malib_holographic_new_with_threshold (MalibBuffer* buf, int threshold) { MalibHolographic *retptr; g_return_if_fail (buf); retptr = malib_holographic_new_with_buf (buf); malib_bgdiff_set_threshold ((MalibBgDiff *) retptr, threshold); return retptr; } /* private functions ************************************************/ static void malib_holographic_write_frame_data (MalibHolographic* filter, MalibFrame* frame) { g_return_if_fail (filter && frame); g_return_if_fail (((MalibFilter*)filter)->buf && frame->data); malib_filter_preprocess ((MalibFilter*) filter, frame); { MalibBuffer* input = ((MalibFilter*)filter)->buf; MalibFrame* srcframe = malib_buffer_get_current_frame (input); int* src = srcframe -> data; int* dst = frame -> data; unsigned int image_size = malib_filter_calc_output_image_size ((MalibFilter*) filter); /* If this is the first frame, the frame is copied to filter->super->bg as the background image. */ if (!malib_bgdiff_is_background_set ((MalibBgDiff*) filter)) { malib_bgdiff_set_background ((MalibBgDiff*) filter, srcframe); memcpy(dst, src, image_size * sizeof(int)); } else { int tmp, k; unsigned int *diff, *bg; int r, g, b; unsigned int i, j; malib_bgdiff_calc_diff ((MalibBgDiff*) filter, srcframe); malib_bgdiff_diff_filter ((MalibBgDiff*) filter, srcframe); diff = ((MalibBgDiff*) filter)->diff; bg = ((MalibBgDiff*) filter)->bg; for (i = 0; i < frame->height; i++) for (j = 0; j < frame->width; j++) if (*diff++) { if (((i + filter->phase) & 0x7f) < 0x58) { r = *src++; g = *src++; b = *src++; tmp = r + g * 2 + b; tmp += malib_holographic_noisepattern[random() % MALIB_HOLOGRAPHIC_NOISEPATTERN_NUM]; r = (r / 2) + tmp; g += tmp; b += tmp; r = r / 2 - 100; g = g / 2 - 100; b /= 4; if (r < 20) r = 20; if (g < 20) g = 20; r += *bg++ / 2; g += *bg++ / 2; b += *bg++ / 2 + 40; *dst++ = (r > 255) ? 255 : r; *dst++ = (g > 255) ? 255 : g; *dst++ = (b > 255) ? 255 : b; } else { r = *src++; g = *src++; b = *src++; tmp = r + g * 4 + b; tmp += malib_holographic_noisepattern[random() % MALIB_HOLOGRAPHIC_NOISEPATTERN_NUM]; r += tmp; g += tmp; b += tmp; r = r / 2 - 100; g = g / 2 - 100; b /= 4; if (r < 0) r = 0; if (g < 0) g = 0; r += *bg++ / 2 + 10; g += *bg++ / 2 + 10; b += *bg++ / 2 + 40; *dst++ = (r > 255) ? 255 : r; *dst++ = (g > 255) ? 255 : g; *dst++ = (b > 255) ? 255 : b; } } else { for (k = 0; k < 3; k++) *dst++ = *src++; } filter->phase -= 37; } } } /** * $Id: holographic.c,v 1.4 2003/04/15 02:17:13 iiojun Exp $ * @file holographic.c * @author Akira SAITO * @brief Holographic effect filter from EffecTV. */
/** * The Forgotten Server - a free and open-source MMORPG server emulator * Copyright (C) 2014 Mark Samman <mark.samman@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 FS_DATABASE_H_A484B0CDFDE542838F506DCE3D40C693 #define FS_DATABASE_H_A484B0CDFDE542838F506DCE3D40C693 #include <boost/lexical_cast.hpp> #include <mysql.h> class DBResult; typedef std::shared_ptr<DBResult> DBResult_ptr; class Database { public: /** * Singleton implementation. * * Retruns instance of database handler. Don't create database (or drivers) instances in your code - instead of it use Database::instance(). This method stores static instance of connection class internaly to make sure exacly one instance of connection is created for entire system. * * @return database connection handler singletor */ static Database* getInstance() { static Database instance; return &instance; } /** * Connects to the database * * @return true on successful connection, false on error */ bool connect(); /** * Executes command. * * Executes query which doesn't generates results (eg. INSERT, UPDATE, DELETE...). * * @param std::string query command * @return true on success, false on error */ bool executeQuery(const std::string& query); /** * Queries database. * * Executes query which generates results (mostly SELECT). * * @param std::string query * @return results object (nullptr on error) */ DBResult_ptr storeQuery(const std::string& query); /** * Escapes string for query. * * Prepares string to fit SQL queries including quoting it. * * @param std::string string to be escaped * @return quoted string */ std::string escapeString(const std::string& s) const; /** * Escapes binary stream for query. * * Prepares binary stream to fit SQL queries. * * @param char* binary stream * @param long stream length * @return quoted string */ std::string escapeBlob(const char* s, uint32_t length) const; /** * Retrieve id of last inserted row * * @return id on success, 0 if last query did not result on any rows with auto_increment keys */ uint64_t getLastInsertId() { return static_cast<uint64_t>(mysql_insert_id(m_handle)); } /** * Get database engine version * * @return the database engine version */ static const char* getClientVersion() { return mysql_get_client_info(); } protected: /** * Transaction related methods. * * Methods for starting, commiting and rolling back transaction. Each of the returns boolean value. * * @return true on success, false on error */ bool beginTransaction(); bool rollback(); bool commit(); private: Database(); ~Database(); DBResult_ptr verifyResult(DBResult_ptr result); MYSQL* m_handle; std::recursive_mutex database_lock; friend class DBTransaction; }; class DBResult { public: ~DBResult(); template<typename T> T getNumber(const std::string& s) const { auto it = m_listNames.find(s); if (it == m_listNames.end()) { std::cout << "[Error - DBResult::getData] Column '" << s << "' does not exist in result set." << std::endl; return static_cast<T>(0); } if (m_row[it->second] == nullptr) { return static_cast<T>(0); } T data; try { data = boost::lexical_cast<T>(m_row[it->second]); } catch (boost::bad_lexical_cast&) { data = 0; } return data; } int32_t getDataInt(const std::string& s) const; std::string getDataString(const std::string& s) const; const char* getDataStream(const std::string& s, unsigned long& size) const; bool next(); protected: DBResult(MYSQL_RES* res); private: MYSQL_RES* m_handle; MYSQL_ROW m_row; std::map<std::string, uint32_t> m_listNames; friend class Database; }; /** * INSERT statement. */ class DBInsert { public: /** * Sets query prototype. * * @param std::string& INSERT query */ void setQuery(const std::string& query); /** * Adds new row to INSERT statement * @param std::string& row data */ bool addRow(const std::string& row); /** * Allows to use addRow() with stringstream as parameter. */ bool addRow(std::ostringstream& row); /** * Executes current buffer. */ bool execute(); protected: std::string m_query; std::string m_buf; }; class DBTransaction { public: DBTransaction() { m_state = STATE_NO_START; } ~DBTransaction() { if (m_state == STATE_START) { Database::getInstance()->rollback(); } } bool begin() { m_state = STATE_START; return Database::getInstance()->beginTransaction(); } bool commit() { if (m_state != STATE_START) { return false; } m_state = STEATE_COMMIT; return Database::getInstance()->commit(); } private: enum TransactionStates_t { STATE_NO_START, STATE_START, STEATE_COMMIT }; TransactionStates_t m_state; }; #endif
/* Game description: This game is a text-based simulation of the daily: - White-collar worker - Data entry monkey - Spreadsheet-making employee */ #include <stdio.h> #include "../tools.h" void mainWorkplaceSimLoop(char *username); void workplaceSim(char *username){ int cont; puts("Welcome to Workplace Simulator 2015!"); cont = inputYOrN(0); lineBreak(); while( cont ){ mainWorkplaceSimLoop(username); lineBreak(); cont = inputYOrN(0); } } void mainWorkplaceSimLoop(char *username){ char choice; printf("Welcome to your first day, %s! What do you want to do?", username); choice = charInput(); //remove this section once game is complete puts("Game is currently being built. Please come back later."); //end section switch(choice){ case '0': break; case 'e': break; case 'h': break; } }
/* * Purpose: Test retrieving compute rows * Functions: dbaltbind dbaltcolid dbaltop dbalttype dbnumalts */ #include "common.h" #include <assert.h> static int failed = 0; static int got_error = 0; static int compute_supported = 1; static int compute_msg_handler(DBPROCESS * dbproc, DBINT msgno, int state, int severity, char *text, char *server, char *proc, int line) { if (strstr(text, "compute")) compute_supported = 0; else got_error = 1; return 0; } int main(int argc, char *argv[]) { LOGINREC *login; DBPROCESS *dbproc; int i; DBINT rowint; DBCHAR rowchar[2]; DBCHAR rowdate[32]; DBINT rowtype; DBINT computeint; DBCHAR computedate[32]; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); /* Fortify_EnterScope(); */ dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0023"); printf("About to open\n"); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); sql_cmd(dbproc); dbmsghandle(compute_msg_handler); i = dbsqlexec(dbproc); dbmsghandle(syb_msg_handler); if (!compute_supported) { printf("compute clause not supported, skip test!\n"); dbexit(); return 0; } if (got_error) { failed = 1; fprintf(stderr, "Unexpected error from query.\n"); exit(1); } while ((i=dbresults(dbproc)) != NO_MORE_RESULTS) { while (dbnextrow(dbproc) != NO_MORE_ROWS) continue; } printf("creating table\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } printf("insert\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } printf("select\n"); sql_cmd(dbproc); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { failed = 1; printf("Was expecting a result set.\n"); exit(1); } for (i = 1; i <= dbnumcols(dbproc); i++) printf("col %d is %s\n", i, dbcolname(dbproc, i)); printf("binding row columns\n"); if (SUCCEED != dbbind(dbproc, 1, INTBIND, 0, (BYTE *) & rowint)) { failed = 1; fprintf(stderr, "Had problem with bind col1\n"); abort(); } if (SUCCEED != dbbind(dbproc, 2, STRINGBIND, 0, (BYTE *) rowchar)) { failed = 1; fprintf(stderr, "Had problem with bind col2\n"); abort(); } if (SUCCEED != dbbind(dbproc, 3, STRINGBIND, 0, (BYTE *) rowdate)) { failed = 1; fprintf(stderr, "Had problem with bind col3\n"); abort(); } printf("testing compute clause 1\n"); if (dbnumalts(dbproc, 1) != 1) { failed = 1; fprintf(stderr, "Had problem with dbnumalts 1\n"); abort(); } if (dbalttype(dbproc, 1, 1) != SYBINT4) { failed = 1; fprintf(stderr, "Had problem with dbalttype 1, 1\n"); abort(); } if (dbaltcolid(dbproc, 1, 1) != 1) { failed = 1; fprintf(stderr, "Had problem with dbaltcolid 1, 1\n"); abort(); } if (dbaltop(dbproc, 1, 1) != SYBAOPSUM) { failed = 1; fprintf(stderr, "Had problem with dbaltop 1, 1\n"); abort(); } if (SUCCEED != dbaltbind(dbproc, 1, 1, INTBIND, 0, (BYTE *) & computeint)) { failed = 1; fprintf(stderr, "Had problem with dbaltbind 1, 1\n"); abort(); } printf("testing compute clause 2\n"); if (dbnumalts(dbproc, 2) != 1) { failed = 1; fprintf(stderr, "Had problem with dbnumalts 2\n"); abort(); } if (dbalttype(dbproc, 2, 1) != SYBDATETIME) { failed = 1; fprintf(stderr, "Had problem with dbalttype 2, 1\n"); abort(); } if (dbaltcolid(dbproc, 2, 1) != 3) { failed = 1; fprintf(stderr, "Had problem with dbaltcolid 2, 1\n"); abort(); } if (dbaltop(dbproc, 2, 1) != SYBAOPMAX) { failed = 1; fprintf(stderr, "Had problem with dbaltop 2, 1\n"); abort(); } if (SUCCEED != dbaltbind(dbproc, 2, 1, STRINGBIND, -1, (BYTE *) computedate)) { failed = 1; fprintf(stderr, "Had problem with dbaltbind 2, 1\n"); abort(); } while ((rowtype = dbnextrow(dbproc)) != NO_MORE_ROWS) { if (rowtype == REG_ROW) { printf("gotten a regular row\n"); } if (rowtype == 1) { printf("gotten a compute row for clause 1\n"); printf("value of sum(col1) = %d\n", computeint); } if (rowtype == 2) { printf("gotten a compute row for clause 2\n"); printf("value of max(col3) = %s\n", computedate); } } dbexit(); printf("%s %s\n", __FILE__, (failed ? "failed!" : "OK")); return failed ? 1 : 0; }
/* Copyright (c) 2012-2013, The Linux Foundation. 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. */ #include <linux/err.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/platform_device.h> #include <linux/io.h> #include <linux/gpio.h> #include <linux/irq.h> #include <linux/irqdomain.h> #include <linux/of.h> #include <linux/of_address.h> #include <linux/of_platform.h> #include <linux/of_fdt.h> #include <linux/of_irq.h> #include <linux/memory.h> #include <linux/regulator/qpnp-regulator.h> #include <linux/msm_tsens.h> #include <asm/mach/map.h> #include <asm/hardware/gic.h> #include <asm/mach/arch.h> #include <asm/mach/time.h> #include <mach/board.h> #include <mach/gpiomux.h> #include <mach/msm_iomap.h> #include <mach/restart.h> #ifdef CONFIG_ION_MSM #include <mach/ion.h> #endif #include <mach/msm_memtypes.h> #include <mach/socinfo.h> #include <mach/board.h> #include <mach/clk-provider.h> #include <mach/msm_smd.h> #include <mach/rpm-smd.h> #include <mach/rpm-regulator-smd.h> #include <mach/msm_smem.h> #include <linux/msm_thermal.h> #include "board-dt.h" #include "clock.h" #include "platsmp.h" #include "spm.h" #include "pm.h" #include "modem_notifier.h" static struct memtype_reserve msm8226_reserve_table[] __initdata = { [MEMTYPE_SMI] = { }, [MEMTYPE_EBI0] = { .flags = MEMTYPE_FLAGS_1M_ALIGN, }, [MEMTYPE_EBI1] = { .flags = MEMTYPE_FLAGS_1M_ALIGN, }, }; static int msm8226_paddr_to_memtype(unsigned int paddr) { return MEMTYPE_EBI1; } static struct of_dev_auxdata msm8226_auxdata_lookup[] __initdata = { OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9824000, \ "msm_sdcc.1", NULL), OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98A4000, \ "msm_sdcc.2", NULL), OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9864000, \ "msm_sdcc.3", NULL), OF_DEV_AUXDATA("qcom,sdhci-msm", 0xF9824900, \ "msm_sdcc.1", NULL), OF_DEV_AUXDATA("qcom,sdhci-msm", 0xF98A4900, \ "msm_sdcc.2", NULL), OF_DEV_AUXDATA("qcom,sdhci-msm", 0xF9864900, \ "msm_sdcc.3", NULL), OF_DEV_AUXDATA("qcom,hsic-host", 0xF9A00000, "msm_hsic_host", NULL), {} }; static struct reserve_info msm8226_reserve_info __initdata = { .memtype_reserve_table = msm8226_reserve_table, .paddr_to_memtype = msm8226_paddr_to_memtype, }; static void __init msm8226_early_memory(void) { reserve_info = &msm8226_reserve_info; of_scan_flat_dt(dt_scan_for_memory_hole, msm8226_reserve_table); } static void __init msm8226_reserve(void) { reserve_info = &msm8226_reserve_info; of_scan_flat_dt(dt_scan_for_memory_reserve, msm8226_reserve_table); msm_reserve(); } /* * Used to satisfy dependencies for devices that need to be * run early or in a particular order. Most likely your device doesn't fall * into this category, and thus the driver should not be added here. The * EPROBE_DEFER can satisfy most dependency problems. */ void __init msm8226_add_drivers(void) { msm_smem_init(); msm_init_modem_notifier_list(); msm_smd_init(); msm_rpm_driver_init(); msm_spm_device_init(); msm_pm_sleep_status_init(); rpm_regulator_smd_driver_init(); qpnp_regulator_init(); if (of_board_is_rumi()) msm_clock_init(&msm8226_rumi_clock_init_data); else msm_clock_init(&msm8226_clock_init_data); tsens_tm_init_driver(); msm_thermal_device_init(); } void __init msm8226_init(void) { struct of_dev_auxdata *adata = msm8226_auxdata_lookup; if (socinfo_init() < 0) pr_err("%s: socinfo_init() failed\n", __func__); msm8226_init_gpiomux(); board_dt_populate(adata); msm8226_add_drivers(); #ifdef CONFIG_HUAWEI_MMC hw_extern_sdcard_add_device(); #endif } #ifdef CONFIG_HUAWEI_MMC static struct resource hw_extern_sdcard_resources[] = { { .flags = IORESOURCE_MEM, }, }; /* * Define the 'hw_extern_sdcard' device node for MMI sdcard test to * judge if the sd card inserted. */ static struct platform_device hw_extern_sdcard_device = { .name = "hw_extern_sdcard", .id = -1, .num_resources = ARRAY_SIZE(hw_extern_sdcard_resources), .resource = hw_extern_sdcard_resources, }; static struct resource hw_extern_sdcardMounted_resources[] = { { .flags = IORESOURCE_MEM, }, }; /* * Define the 'hw_extern_sdcardMounted' device node for MMI sdcard test to * judge if the sd card mounted. */ static struct platform_device hw_extern_sdcardMounted_device = { .name = "hw_extern_sdcardMounted", .id = -1, .num_resources = ARRAY_SIZE(hw_extern_sdcardMounted_resources), .resource = hw_extern_sdcardMounted_resources, }; /* * Add the device nodes 'hw_extern_sdcard' and 'hw_extern_sdcardMounted' in /dev. * It is used by MMI sdcard test. */ int __init hw_extern_sdcard_add_device(void) { platform_device_register(&hw_extern_sdcard_device); platform_device_register(&hw_extern_sdcardMounted_device); return 0; } #endif static const char *msm8226_dt_match[] __initconst = { "qcom,msm8226", "qcom,msm8926", "qcom,apq8026", NULL }; #ifdef CONFIG_HUAWEI_KERNEL DT_MACHINE_START(MSM8226_DT, "Qualcomm MSM 8926 (Flattened Device Tree)") #else DT_MACHINE_START(MSM8226_DT, "Qualcomm MSM 8226 (Flattened Device Tree)") #endif .map_io = msm_map_msm8226_io, .init_irq = msm_dt_init_irq, .init_machine = msm8226_init, .handle_irq = gic_handle_irq, .timer = &msm_dt_timer, .dt_compat = msm8226_dt_match, .reserve = msm8226_reserve, .init_very_early = msm8226_early_memory, .restart = msm_restart, .smp = &arm_smp_ops, MACHINE_END
// ------------------------------------------------------------------------- // sg_local.h // Definicje struktur danych i metod dla procesu EDP postument // // Ostatnia modyfikacja: 2006 // ------------------------------------------------------------------------- #ifndef __SG_IRP6P_TFG_H #define __SG_IRP6P_TFG_H #include "base/edp/edp_typedefs.h" #include "base/edp/servo_gr.h" namespace mrrocpp { namespace edp { namespace irp6p_tfg { class effector; class servo_buffer : public common::servo_buffer { // Bufor polecen przysylanych z EDP_MASTER dla SERVO // Obiekt z algorytmem regulacji public: // output_buffer void get_all_positions(void); effector &master; void load_hardware_interface(void); servo_buffer(effector &_master); // konstruktor // obliczenie nastepnej wartosci zadanej dla wszystkich napedow }; } // namespace common } // namespace edp } // namespace mrrocpp #endif
/* * Copyright (C) 2006 Voice Sistem SRL * * This file is part of Open SIP Server (opensips). * * opensips 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. * * opensips 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. * * History: * --------- * 2006-11-30 first version (lavinia) * 2007-10-05 support for libxmlrpc-c3 version 1.x.x added (dragos) */ #include <string.h> #include <stdlib.h> #include "../../dprint.h" #include "../../mem/mem.h" #include "xr_parser.h" #include "xr_parser_lib.h" #include "mi_xmlrpc.h" /* * Convert in argument string each LFLF to CRLF and return length of * the string not including the terminating `\0' character. * This is a hack that is needed as long as Abyss XML-RPC server "normalizes" * CRLF to LF in XML-RPC strings. */ int lflf_to_crlf_hack(char *s) { unsigned int len; len = 0; while (*s) { if (*(s + 1) && (*s == '\n') && *(s + 1) == '\n') { *s = '\r'; s = s + 2; len = len + 2; } else { s++; len++; } } return len; } struct mi_root * xr_parse_tree( xmlrpc_env * env, xmlrpc_value * paramArray ) { struct mi_root * mi_root; int size, i; size_t length; xmlrpc_int32 intValue; xmlrpc_bool boolValue; #ifdef XMLRPC_OLD_VERSION double doubleValue; char * contents; #else xmlrpc_double doubleValue; #endif char * stringValue = 0; char * byteStringValue =0; xmlrpc_value * item; mi_root = init_mi_tree(0, 0, 0); if ( !mi_root ) { LM_ERR("the MI tree cannot be initialized!\n"); goto error; } size = xmlrpc_array_size(env, paramArray); for (i=0 ; i< size ; i++) { item = xmlrpc_array_get_item(env, paramArray, i); if ( env->fault_occurred ) { LM_ERR("failed to get array item: %s\n", env->fault_string); goto error; } switch ( xmlrpc_value_type(item) ) { case (XMLRPC_TYPE_INT): #ifdef XMLRPC_OLD_VERSION intValue = item->_value.i; #else xmlrpc_read_int(env,item,&intValue); #endif if (addf_mi_node_child(&mi_root->node,0,0,0,"%d",intValue)==NULL) { LM_ERR("failed to add node to the MI tree.\n"); goto error; } break; case (XMLRPC_TYPE_BOOL): #ifdef XMLRPC_OLD_VERSION boolValue = item->_value.b; #else xmlrpc_read_bool(env,item,&boolValue); #endif if (addf_mi_node_child(&mi_root->node,0,0,0,"%u",boolValue)==NULL){ LM_ERR("failed to add node to the MI tree.\n"); goto error; } break; case (XMLRPC_TYPE_DOUBLE): #ifdef XMLRPC_OLD_VERSION doubleValue = item->_value.d; #else xmlrpc_read_double(env,item,&doubleValue); #endif if ( addf_mi_node_child(&mi_root->node, 0, 0, 0, "%lf", doubleValue) == NULL ) { LM_ERR("failed to add node to the MI tree.\n"); goto error; } break; case (XMLRPC_TYPE_STRING): #if HAVE_UNICODE_WCHAR #ifdef XMLRPC_OLD_VERSION xmlrpc_read_string_w(env, item, &stringValue); #else xmlrpc_read_string_w(env, item , (const char **)&stringValue); #endif #else #ifdef XMLRPC_OLD_VERSION xmlrpc_read_string(env, item, &stringValue); #else xmlrpc_read_string(env, item, (const char **)&stringValue); #endif #endif if ( env->fault_occurred ) { LM_ERR("failed to read stringValue: %s!\n", env->fault_string); goto error; } if ( add_mi_node_child(&mi_root->node, 0, 0, 0, stringValue, lflf_to_crlf_hack(stringValue)) == NULL ) { LM_ERR("failed to add node to the MI tree.\n"); goto error; } break; case (XMLRPC_TYPE_BASE64): #ifdef XMLRPC_OLD_VERSION length = XMLRPC_TYPED_MEM_BLOCK_SIZE(char, &item->_block); contents = XMLRPC_TYPED_MEM_BLOCK_CONTENTS(char, &item->_block); byteStringValue = pkg_malloc(length); if ( !byteStringValue ){ xmlrpc_env_set_fault_formatted(env, XMLRPC_INTERNAL_ERROR, "Unable to allocate %u bytes for byte string.", length); LM_ERR("pkg_malloc cannot allocate any more memory!\n"); goto error; } else memcpy(byteStringValue, contents, length); if ( add_mi_node_child(&mi_root->node, 0, 0, 0, byteStringValue, length) == NULL ) { LM_ERR("failed to add node to the MI tree.\n"); goto error; } #else xmlrpc_read_base64(env, item, &length, (const unsigned char **)(void*)&byteStringValue); if ( env->fault_occurred ) { LM_ERR("failed to read byteStringValue: %s!\n", env->fault_string); goto error; } if ( add_mi_node_child(&mi_root->node, MI_DUP_VALUE, 0, 0, byteStringValue, length) == NULL ) { LM_ERR("failed to add node to the MI tree.\n"); goto error; } free(byteStringValue); #endif break; default : LM_ERR("unsupported node type %d\n", xmlrpc_value_type(item) ); xmlrpc_env_set_fault_formatted( env, XMLRPC_TYPE_ERROR, "Unsupported value of type %d supplied", xmlrpc_value_type(item)); goto error; } } return mi_root; error: if ( mi_root ) free_mi_tree(mi_root); if ( byteStringValue ) pkg_free(byteStringValue); return 0; }
#include <common.h> #include <sizes.h> #include <asm/barebox-arm-head.h> #include <asm/barebox-arm.h> extern char __dtb_imx6q_sabrelite_start[]; ENTRY_FUNCTION(start_imx6q_sabrelite, r0, r1, r2) { uint32_t fdt; arm_cpu_lowlevel_init(); fdt = (uint32_t)__dtb_imx6q_sabrelite_start - get_runtime_offset(); barebox_arm_entry(0x10000000, SZ_1G, fdt); } extern char __dtb_imx6dl_sabrelite_start[]; ENTRY_FUNCTION(start_imx6dl_sabrelite, r0, r1, r2) { uint32_t fdt; arm_cpu_lowlevel_init(); fdt = (uint32_t)__dtb_imx6dl_sabrelite_start - get_runtime_offset(); barebox_arm_entry(0x10000000, SZ_1G, fdt); }
// ************************************************************************* // // Copyright 2004-2010 Bruno PAGES . // // This file is part of the BOUML Uml Toolkit. // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // // e-mail : bouml@free.fr // home : http://bouml.free.fr // // ************************************************************************* #ifndef UMLEXTRACLASSMEMBER_H #define UMLEXTRACLASSMEMBER_H #include "UmlBaseExtraClassMember.h" // This class allows to manage extra class member, mainly defined for C++ // it allows to insert C++ pre-processor directive (even they may be placed // in the other member definition/declaration), to declare friend // operation/function etc... // You can modify it as you want (except the constructor) class UmlExtraClassMember : public UmlBaseExtraClassMember { public: UmlExtraClassMember(void * id, const QCString & n) : UmlBaseExtraClassMember(id, n) {}; virtual void generate(QTextOStream & f, const QCString & cl_stereotype, QCString indent, BooL & indent_needed, int &, const QCString &); }; #endif
#ifndef __FOCALTECH_CTL_H__ #define __FOCALTECH_CTL_H__ #define FT_RW_IIC_DRV "ft_rw_iic_drv" #define FT_RW_IIC_DRV_MAJOR 210 #define FT_I2C_RDWR_MAX_QUEUE 36 #define FT_I2C_SLAVEADDR 11 #define FT_I2C_RW 12 #define FT_RESET_TP 13 typedef struct ft_rw_i2c { u8 *buf; u8 flag; __u16 length; }*pft_rw_i2c; typedef struct ft_rw_i2c_queue { struct ft_rw_i2c __user *i2c_queue; int queuenum; }*pft_rw_i2c_queue; int ft_rw_iic_drv_init(struct i2c_client *client); void ft_rw_iic_drv_exit(void); #endif
#import <QuartzCore/CALayer.h> @import QuartzCore; @import JavaScriptCore; @protocol JSBNSObject; @protocol JSBCAEmitterCell <JSExport, JSBNSObject> #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" @property CGFloat emissionRange; @property (copy) NSDictionary *style; @property float lifetime, lifetimeRange; @property CGFloat velocity, velocityRange; @property CGFloat xAcceleration, yAcceleration, zAcceleration; @property CGFloat scale, scaleRange, scaleSpeed; @property (copy) NSArray *emitterCells; @property float redSpeed, greenSpeed, blueSpeed, alphaSpeed; @property CGRect contentsRect; @property CGColorRef color; @property CGFloat spin, spinRange; @property float redRange, greenRange, blueRange, alphaRange; @property CGFloat emissionLatitude, emissionLongitude; @property (getter = isEnabled) BOOL enabled; @property (copy) NSString *minificationFilter, *magnificationFilter; @property float minificationFilterBias; @property (retain) id contents; @property float birthRate; @property (copy) NSString *name; + (id)emitterCell; + (id)defaultValueForKey:(NSString *)key; - (BOOL)shouldArchiveValueForKey:(NSString *)key; #pragma clang diagnostic pop @end
// ============================================================================ // Copyright Jean-Charles LAMBERT - 2007-2015 // e-mail: Jean-Charles.Lambert@lam.fr // address: Centre de donneeS Astrophysique de Marseille (CeSAM) // Laboratoire d'Astrophysique de Marseille // Pôle de l'Etoile, site de Château-Gombert // 38, rue Frédéric Joliot-Curie // 13388 Marseille cedex 13 France // CNRS U.M.R 7326 // ============================================================================ // See the complete license in LICENSE and/or "http://www.cecill.info". // ============================================================================ #ifndef CATMULL_ROM_SPLINE_H #define CATMULL_ROM_SPLINE_H #include "vec3d.h" #include <vector> namespace glnemo { class CRSpline { public: // Constructors and destructor CRSpline(); CRSpline(const CRSpline&); ~CRSpline(); // Operations void AddSplinePoint(const Vec3D& v); Vec3D GetInterpolatedSplinePoint(float t); // t = 0...1; 0=vp[0] ... 1=vp[max] int GetNumPoints(); Vec3D& GetNthPoint(int n); // Static method for computing the Catmull-Rom parametric equation // given a time (t) and a vector quadruple (p1,p2,p3,p4). static Vec3D Eq(float t, const Vec3D& p1, const Vec3D& p2, const Vec3D& p3, const Vec3D& p4); // Clear ctrl points void clearCPoints() { vp.clear();} private: std::vector<Vec3D> vp; float delta_t; }; } #endif
/* * Copyright (c) 1999-2005 Hewlett-Packard Development Company, L.P. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ #ifndef GC_TINY_FL_H #define GC_TINY_FL_H /* * Constants and data structures for "tiny" free lists. * These are used for thread-local allocation or in-lined allocators. * Each global free list also essentially starts with one of these. * However, global free lists are known to the GC. "Tiny" free lists * are basically private to the client. Their contents are viewed as * "in use" and marked accordingly by the core of the GC. * * Note that inlined code might know about the layout of these and the constants * involved. Thus any change here may invalidate clients, and such changes should * be avoided. Hence we keep this as simple as possible. */ /* * We always set GC_GRANULE_BYTES to twice the length of a pointer. * This means that all allocation requests are rounded up to the next * multiple of 16 on 64-bit architectures or 8 on 32-bit architectures. * This appears to be a reasonable compromise between fragmentation overhead * and space usage for mark bits (usually mark bytes). * On many 64-bit architectures some memory references require 16-byte * alignment, making this necessary anyway. * For a few 32-bit architecture (e.g. x86), we may also need 16-byte alignment * for certain memory references. But currently that does not seem to be the * default for all conventional malloc implementations, so we ignore that * problem. * It would always be safe, and often useful, to be able to allocate very * small objects with smaller alignment. But that would cost us mark bit * space, so we no longer do so. */ #ifndef GC_GRANULE_BYTES /* GC_GRANULE_BYTES should not be overridden in any instances of the GC */ /* library that may be shared between applications, since it affects */ /* the binary interface to the library. */ # if defined(__LP64__) || defined (_LP64) || defined(_WIN64) \ || defined(__s390x__) \ || (defined(__x86_64__) && !defined(__ILP32__)) \ || defined(__alpha__) || defined(__powerpc64__) \ || defined(__arch64__) # define GC_GRANULE_BYTES 16 # define GC_GRANULE_WORDS 2 # else # define GC_GRANULE_BYTES 8 # define GC_GRANULE_WORDS 2 # endif #endif /* !GC_GRANULE_BYTES */ #if GC_GRANULE_WORDS == 2 # define GC_WORDS_TO_GRANULES(n) ((n)>>1) #else # define GC_WORDS_TO_GRANULES(n) ((n)*sizeof(void *)/GC_GRANULE_BYTES) #endif /* A "tiny" free list header contains TINY_FREELISTS pointers to */ /* singly linked lists of objects of different sizes, the ith one */ /* containing objects i granules in size. Note that there is a list */ /* of size zero objects. */ #ifndef GC_TINY_FREELISTS # if GC_GRANULE_BYTES == 16 # define GC_TINY_FREELISTS 25 # else # define GC_TINY_FREELISTS 33 /* Up to and including 256 bytes */ # endif #endif /* !GC_TINY_FREELISTS */ /* The ith free list corresponds to size i*GC_GRANULE_BYTES */ /* Internally to the collector, the index can be computed with */ /* ROUNDED_UP_GRANULES. Externally, we don't know whether */ /* DONT_ADD_BYTE_AT_END is set, but the client should know. */ /* Convert a free list index to the actual size of objects */ /* on that list, including extra space we added. Not an */ /* inverse of the above. */ #define GC_RAW_BYTES_FROM_INDEX(i) ((i) * GC_GRANULE_BYTES) #endif /* GC_TINY_FL_H */
#pragma once //================================================================================ class DlgSelectFile : public CFileDialog { public: DlgSelectFile(BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL) ; private: FCObjImage m_imgPreview ; virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult); // Generated message map functions //{{AFX_MSG(DlgSelectFile) afx_msg void OnPaint(); //}}AFX_MSG DECLARE_MESSAGE_MAP() };
/* * Gridbrain * Copyright (C) 2007 Telmo Menezes. * telmo@telmomenezes.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the version 2 of the GNU General Public License * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _INCLUDE_GRIDBRAIN_COMPONENT_MIN_H #define _INCLUDE_GRIDBRAIN_COMPONENT_MIN_H #include "Component.h" namespace gb { class CompMIN : public Component { public: CompMIN(); virtual ~CompMIN(); virtual Component* clone(); virtual void reset(int pass, unsigned int entity); virtual void input(float value, int pin); virtual float output(); virtual string getName(){return "MIN";} virtual ConnType getConnectorType(){return CONN_INOUT;} virtual bool isUnique(){return false;} virtual bool compare(Component* comp){return true;} protected: bool mInputFlag; float mState; bool mCycleFlag; unsigned int mPass; bool mTriggered; }; static CompMIN COMP_MIN; } #endif
/* * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.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 DEF_RAZORFEN_DOWNS_H #define DEF_RAZORFEN_DOWNS_H enum Data { BOSS_TUTEN_KASH, DATA_GONG_WAVES }; enum Data64 { DATA_GONG }; enum GameObjectIds { GO_GONG = 148917 }; enum CreatureId { NPC_TOMB_FIEND = 7349, NPC_TOMB_REAVER = 7351, NPC_TUTEN_KASH = 7355 }; #endif
/* Emacs style mode select -*- C++ -*- *----------------------------------------------------------------------------- * * * PrBoom: a Doom port merged with LxDoom and LSDLDoom * based on BOOM, a modified and improved DOOM engine * Copyright (C) 1999 by * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman * Copyright (C) 1999-2006 by * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze * Copyright 2005, 2006 by * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. * * DESCRIPTION: * Simple basic typedefs, isolated here to make it easier * separating modules. * *-----------------------------------------------------------------------------*/ #ifndef __DOOMTYPE__ #define __DOOMTYPE__ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifndef __BYTEBOOL__ #define __BYTEBOOL__ typedef int boolean; #ifndef true #define true 1 #endif #ifndef false #define false 0 #endif typedef unsigned char byte; #endif //e6y #ifndef MAX #define MAX(a,b) ((a)>(b)?(a):(b)) #endif #ifndef MIN #define MIN(a,b) ((a)<(b)?(a):(b)) #endif /* cph - Wrapper for the long long type, as Win32 used a different name. * Except I don't know what to test as it's compiler specific * Proff - I fixed it */ #ifndef _MSC_VER typedef signed long long int_64_t; typedef unsigned long long uint_64_t; // define compiled-specific long-long contstant notation here #define LONGLONG(num) (uint_64_t)num ## ll #else typedef __int64 int_64_t; typedef unsigned __int64 uint_64_t; // define compiled-specific long-long contstant notation here #define LONGLONG(num) (uint_64_t)num #undef PATH_MAX #define PATH_MAX 1024 #define strcasecmp _stricmp #define strncasecmp _strnicmp #define S_ISDIR(x) (((sbuf.st_mode & S_IFDIR)==S_IFDIR)?1:0) #endif #ifdef __GNUC__ #define CONSTFUNC __attribute__((const)) #define PUREFUNC __attribute__((pure)) #define NORETURN __attribute__ ((noreturn)) #else #define CONSTFUNC #define PUREFUNC #define NORETURN #endif /* CPhipps - use limits.h instead of depreciated values.h */ #include <limits.h> /* cph - move compatibility levels here so we can use them in d_server.c */ typedef enum { doom_12_compatibility, /* Doom v1.2 */ doom_1666_compatibility, /* Doom v1.666 */ doom2_19_compatibility, /* Doom & Doom 2 v1.9 */ ultdoom_compatibility, /* Doom 2 v1.9 */ finaldoom_compatibility, /* Final & Ultimate Doom v1.9, and Doom95 */ dosdoom_compatibility, /* Early dosdoom & tasdoom */ tasdoom_compatibility, /* Early dosdoom & tasdoom */ boom_compatibility_compatibility, /* Boom's compatibility mode */ boom_201_compatibility, /* Compatible with Boom v2.01 */ boom_202_compatibility, /* Compatible with Boom v2.01 */ lxdoom_1_compatibility, /* LxDoom v1.3.2+ */ mbf_compatibility, /* MBF */ prboom_1_compatibility, /* PrBoom 2.03beta? */ prboom_2_compatibility, /* PrBoom 2.1.0-2.1.1 */ prboom_3_compatibility, /* PrBoom 2.2.x */ prboom_4_compatibility, /* PrBoom 2.3.x */ prboom_5_compatibility, /* PrBoom 2.4.0 */ prboom_6_compatibility, /* Latest PrBoom */ MAX_COMPATIBILITY_LEVEL, /* Must be last entry */ /* Aliases follow */ boom_compatibility = boom_201_compatibility, /* Alias used by G_Compatibility */ best_compatibility = prboom_6_compatibility, } complevel_t; /* cph - from v_video.h, needed by gl_struct.h */ enum patch_translation_e { VPT_NONE = 0, // Normal VPT_FLIP = 1, // Flip image horizontally VPT_TRANS = 2, // Translate image via a translation table VPT_STRETCH = 4, // Stretch to compensate for high-res }; #endif
/* * $Id: StoreFSufs.h,v 1.5 2006/09/14 00:51:12 robertc Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- * * Squid is the result of efforts by numerous individuals from * the Internet community; see the CONTRIBUTORS file for full * details. Many organizations have provided support for Squid's * development; see the SPONSORS file for full details. Squid is * Copyrighted (C) 2001 by the Regents of the University of * California; see the COPYRIGHT file for full details. Squid * incorporates software developed and/or copyrighted by other * sources; see the CREDITS file for full details. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. * * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org> */ #ifndef SQUID_STOREFSUFS_H #define SQUID_STOREFSUFS_H #include "squid.h" #include "ufscommon.h" #include "DiskIO/DiskIOModule.h" /* core UFS class. This template provides compile time aliases for * ufs/aufs/diskd to ease configuration conversion - each becomes a * StoreFS module whose createSwapDir method parameterises the common * UFSSwapDir with an IO module instance. */ template <class TheSwapDir> class StoreFSufs : public StoreFileSystem { public: static StoreFileSystem &GetInstance(); StoreFSufs(char const *DefaultModuleType, char const *label); virtual ~StoreFSufs() {} virtual char const *type() const; virtual SwapDir *createSwapDir(); virtual void done(); virtual void setup(); /* Not implemented */ StoreFSufs (StoreFSufs const &); StoreFSufs &operator=(StoreFSufs const &); protected: DiskIOModule *IO; char const *moduleName; char const *label; }; template <class C> StoreFSufs<C>::StoreFSufs(char const *defaultModuleName, char const *aLabel) : IO(NULL), moduleName(defaultModuleName), label(aLabel) { FsAdd(*this); } template <class C> char const * StoreFSufs<C>::type() const { return label; } template <class C> SwapDir * StoreFSufs<C>::createSwapDir() { C *result = new C(type(), moduleName); return result; } template <class C> void StoreFSufs<C>::done() { initialised = false; } template <class C> void StoreFSufs<C>::setup() { assert(!initialised); initialised = true; } #endif /* SQUID_STOREFSUFS_H */
/* * ircd-ratbox: A slightly useful ircd. * fileio.h: The file input/output header. * * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center * Copyright (C) 1996-2002 Hybrid Development Team * Copyright (C) 2002-2004 ircd-ratbox development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ #ifdef NEED_FILEIO_C /* Sun has a buggy implementation of FILE functions ** (they do not work when fds 0-255 are already used). ** ircd-ratbox 1.5-3 had a nice reimplementation, so I took it. --B. */ #define FILE FBFILE #define fclose fbclose #define fdopen fdbopen #define fgets fbgets #define fopen fbopen #if !defined(HAVE_STRLCPY) #define strlcpy(x, y, N) strncpyzt((x), (y), (N)) #endif #ifndef INCLUDED_fileio_h #define INCLUDED_fileio_h #define FB_EOF 0x01 #define FB_FAIL 0x02 struct FileBuf { int fd; /* file descriptor */ char *endp; /* one past the end */ char *ptr; /* current read pos */ char *pbptr; /* pointer to push back char */ int flags; /* file state */ char buf[BUFSIZ]; /* buffer */ char pbuf[BUFSIZ + 1]; /* push back buffer */ }; /* XXX This shouldn't be here */ struct Client; /* * FileBuf is a mirror of the ANSI FILE struct, but it works for any * file descriptor. FileBufs are allocated when a file is opened with * fbopen, and they are freed when the file is closed using fbclose. */ typedef struct FileBuf FBFILE; /* * open a file and return a FBFILE*, see fopen(3) */ extern FBFILE *fbopen(const char *filename, const char *mode); /* * associate a file descriptor with a FBFILE* * if a FBFILE* is associated here it MUST be closed using fbclose * see fdopen(3) */ extern FBFILE *fdbopen(int fd, const char *mode); /* * close a file opened with fbopen, see fclose(3) */ extern int fbclose(FBFILE * fb); /* * return the next character from the file, EOF on end of file * see fgetc(3) */ extern int fbgetc(FBFILE * fb); /* * return next string in a file up to and including the newline character * see fgets(3) */ extern char *fbgets(char *buf, size_t len, FBFILE * fb); /* * ungets c to fb see ungetc(3) */ extern void fbungetc(char c, FBFILE * fb); /* * write a null terminated string to a file, see fputs(3) */ extern int fbputs(const char *str, FBFILE * fb); /* * return the status of the file associated with fb, see fstat(3) */ extern int fbstat(struct stat *sb, FBFILE * fb); /* * popen a file. */ extern FBFILE *fbpopen(const char *, const char *); #endif /* INCLUDED_fileio_h */ #endif /* #ifdef NEED_FILEIO_C */
/* ***** BEGIN LICENSE BLOCK ***** * This file is part of Natron <http://www.natron.fr/>, * Copyright (C) 2013-2017 INRIA and Alexandre Gauthier-Foichat * * Natron 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. * * Natron 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 Natron. If not, see <http://www.gnu.org/licenses/gpl-2.0.html> * ***** END LICENSE BLOCK ***** */ #ifndef Engine_RotoStrokeItemSerialization_h #define Engine_RotoStrokeItemSerialization_h // ***** BEGIN PYTHON BLOCK ***** // from <https://docs.python.org/3/c-api/intro.html#include-files>: // "Since Python may define some pre-processor definitions which affect the standard headers on some systems, you must include Python.h before any standard headers are included." #include <Python.h> // ***** END PYTHON BLOCK ***** #include "Serialization/KnobTableItemSerialization.h" #include "Serialization/SerializationFwd.h" SERIALIZATION_NAMESPACE_ENTER; class RotoStrokeItemSerialization : public KnobTableItemSerialization { public: struct PointCurves { CurveSerializationPtr x,y,pressure; }; std::list<PointCurves> _subStrokes; RotoStrokeItemSerialization() : KnobTableItemSerialization() , _subStrokes() { _emitMap = false; } virtual ~RotoStrokeItemSerialization() { } virtual void encode(YAML::Emitter& em) const OVERRIDE; virtual void decode(const YAML::Node& node) OVERRIDE; }; SERIALIZATION_NAMESPACE_EXIT; #endif // Engine_RotoStrokeItemSerialization_h
GtkWidget* create_fr (void);
/** * @file ChargeCtl.c * * Charge Control * * * @version $Revision$ * @author JLJuang <juangjl@csie.nctu.edu.tw> * @note Copyright (c) 2010, JSoftLab, all rights reserved. * @note */ #ifdef __cplusplus extern "C" { #endif ///< for __cplusplus #include "UpiDef.h" /** * @brief CHGCheckFullChargedIn * * Check Full Charged * * @return NULL * */ GVOID CHGCheckFCClear(GVOID) { ///------------------------------/// /// 1. Check if FC is set ///------------------------------/// if(!(SBS->wBS & FC_BS)) { return; } ///------------------------------/// /// 2. Leave when under charging ///------------------------------/// if(GGIsDischarging() == GFALSE) { return; } ///------------------------------/// /// 3. If RSOC < FC_CLEAR_RSOC, /// then clear FC ///------------------------------/// if(SBS->wBS & FC_BS) { if(SBS->wRSOC < FC_CLEAR_RSOC) { SBS->wBS &=~ (FC_BS | TCA_BS); } } } /** * @brief CHGCheckFC * * Check Primary Charge Termination * * @return NULL * */ GBOOL CHGCheckFC(GVOID) { ///-----------------------------------------------------------/// /// 1. Leave when battery voltage less than taper voltage ///-----------------------------------------------------------/// if(CurMeas->wVCell1 < GGB->cChargeControl.scTerminationCfg.wTPVoltage) { UpiGauge.chgCtrl.iTaperTimer = GGB->cChargeControl.scTerminationCfg.wTPTime * 1000; return GFALSE; } ///-----------------------------------------------------------/// /// 2. Leave when battery current more than taper current ///-----------------------------------------------------------/// if(CurMeas->sCurr > GGB->cChargeControl.scTerminationCfg.wTPCurrent ) { UpiGauge.chgCtrl.iTaperTimer = GGB->cChargeControl.scTerminationCfg.wTPTime * 1000; return GFALSE; } ///-----------------------------------------------------------/// /// 3. Leave when under discharging ///-----------------------------------------------------------/// UpiGauge.chgCtrl.iTaperTimer = UpiGauge.chgCtrl.iTaperTimer - (GSHORT)(CurMeas->iDeltaTime); if(UpiGauge.chgCtrl.iTaperTimer > 0) { return GFALSE; } return GTRUE; } #ifdef __cplusplus } #endif ///< for __cplusplus
/* * glights - A GTK Light Controller * Copyright 2006-2008 Stefan Ott * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include "support.h" #include "glights.h" #include <tgmath.h> #include <gtk/gtk.h> gboolean quit (GtkWidget *widget, gpointer nothing) { gtk_main_quit (); return FALSE; } void on_button_play_pressed (GtkButton *button) { glights_data_start (glights_data); } void on_button_pause_pressed (GtkButton *button) { glights_data_pause (glights_data); } void on_button_stop_pressed (GtkButton *button) { glights_data_stop (glights_data); } void on_speed_changed (GtkButton *button) { double percentage, value; GtkAdjustment* adj; adj = gtk_range_get_adjustment ((GtkRange*) button); value = adj->value; percentage = value / (adj->upper - adj->lower); glights_data->speed = percentage; glights_data_pause (glights_data); glights_data_start (glights_data); } void on_lightall_pressed (GtkButton *button) { glights_data_light_all (glights_data); } void on_invert_toggled (GtkToggleButton *button) { gboolean invert = gtk_toggle_button_get_active (button); glights_data_invert (glights_data, invert); } void on_reverse_toggled (GtkToggleButton *button) { gboolean reverse = gtk_toggle_button_get_active (button); glights_data_reverse (glights_data, reverse); } void on_pattern_changed (GtkComboBox *box) { gchar* selected_text = gtk_combo_box_get_active_text (box); if (selected_text == NULL) return; glights_data_set_pattern (glights_data, selected_text); } void on_flash_pressed (GtkButton *button) { glights_data_pause (glights_data); glights_data_set_state (glights_data, 0xff); } void on_flash_released (GtkButton *button) { glights_data_set_state (glights_data, 0); glights_data_start (glights_data); } void on_autoswitch_toggled (GtkToggleButton *button) { glights_data->auto_switch = gtk_toggle_button_get_active (button); } void on_autoswitch_change_value (GtkSpinButton *button) { GtkAdjustment *adj = gtk_spin_button_get_adjustment (button); g_assert (adj->value > 0); glights_data->auto_switch_steps = (unsigned char) adj->value; } void on_autoinvert_toggled (GtkToggleButton *button) { glights_data->auto_invert = gtk_toggle_button_get_active(button); } void on_autoinvert_change_value (GtkSpinButton *button) { GtkAdjustment *adj = gtk_spin_button_get_adjustment (button); g_assert (adj->value > 0); glights_data->auto_invert_steps = (unsigned char) adj->value; } void on_autoreverse_toggled (GtkToggleButton *button) { glights_data->auto_reverse = gtk_toggle_button_get_active (button); } void on_autoreverse_change_value (GtkSpinButton *button) { GtkAdjustment *adj = gtk_spin_button_get_adjustment (button); g_assert (adj->value > 0); glights_data->auto_reverse_steps = (unsigned char) adj->value; } void on_open_activate (GtkWidget *widget) {} void on_quit_activate (GtkWidget *widget) {} void on_preferences_activate (GtkWidget *widget) {} void hide_preferences (GtkWidget *widget) {} void hide_fileBrowser (GtkWidget *widget) {} void show_about_window (GtkWidget *widget) { static const gchar copyright[] = "Copyright \xc2\xa9 2006-2008 Stefan Ott"; static const gchar * const authors[] = { "Stefan Ott <stefan@ott.net>" }; GtkWidget *root = gtk_widget_get_toplevel (widget); gtk_show_about_dialog (GTK_WINDOW (root), "name", g_get_application_name (), "logo-icon-name", "glights", "authors", authors, "comments", _("It controls lights!"), "copyright", copyright, "version", VERSION, "website", "http://glights.googlecode.com/", NULL); } void on_led_pressed (int led) { unsigned char mask = pow (2, led); glights_data_set_mask (glights_data, glights_data->mask ^ mask); } #define mk_led_button_handler(num) \ void \ on_led_button_##num##_clicked (GtkWidget *widget) \ { \ on_led_pressed ( num-1 ); \ } mk_led_button_handler (1); mk_led_button_handler (2); mk_led_button_handler (3); mk_led_button_handler (4); mk_led_button_handler (5); mk_led_button_handler (6); mk_led_button_handler (7); mk_led_button_handler (8);
#ifndef CYGONCE_HAL_PLF_REGS_H #define CYGONCE_HAL_PLF_REGS_H //========================================================================== // // plf_regs.h // // Generic platform CPU definitions // //========================================================================== // ####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- // This file is part of eCos, the Embedded Configurable Operating System. // Copyright (C) 2002 Free Software Foundation, Inc. // // eCos is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free // Software Foundation; either version 2 or (at your option) any later // version. // // eCos is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License // for more details. // // You should have received a copy of the GNU General Public License // along with eCos; if not, write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // // As a special exception, if other files instantiate templates or use // macros or inline functions from this file, or you compile this file // and link it with other works to produce a work based on this file, // this file does not by itself cause the resulting work to be covered by // the GNU General Public License. However the source code for this file // must still be made available in accordance with section (3) of the GNU // General Public License v2. // // This exception does not invalidate any other reasons why a work based // on this file might be covered by the GNU General Public License. // ------------------------------------------- // ####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // // Author(s): Michal Pfeifer // Original data: PowerPC // Date: 2002-06-27 // Purpose: // Description: Possibly override any platform assumptions // // Usage: Included via the variant+architecture register headers: // ... // // //####DESCRIPTIONEND#### // //========================================================================== #endif // CYGONCE_HAL_PLF_REGS_H
/* mkvmerge -- utility for splicing together matroska files from component media subtypes Distributed under the GPL v2 see the file COPYING for details or visit http://www.gnu.org/copyleft/gpl.html class definition for the generic reader and packetizer Written by Moritz Bunkus <moritz@bunkus.org>. */ #ifndef MTX_MERGE_GENERIC_READER_H #define MTX_MERGE_GENERIC_READER_H #include "common/common_pch.h" #include <boost/optional.hpp> #include "common/file_types.h" #include "common/chapters/chapters.h" #include "common/translation.h" #include "merge/file_status.h" #include "merge/id_result.h" #include "common/math.h" #include "merge/packet.h" #include "merge/timestamp_factory.h" #include "merge/track_info.h" #include "merge/webm.h" using namespace libmatroska; class generic_packetizer_c; #define DEFTRACK_TYPE_AUDIO 0 #define DEFTRACK_TYPE_VIDEO 1 #define DEFTRACK_TYPE_SUBS 2 #define PTZR(i) m_reader_packetizers[i] #define PTZR0 PTZR(0) #define NPTZR() m_reader_packetizers.size() #define show_demuxer_info() \ if (verbose) \ mxinfo_fn(m_ti.m_fname, boost::format(Y("Using the demultiplexer for the format '%1%'.\n")) % get_format_name()); #define show_packetizer_info(track_id, packetizer) \ mxinfo_tid(m_ti.m_fname, track_id, boost::format(Y("Using the output module for the format '%1%'.\n")) % packetizer->get_format_name()); class generic_reader_c { public: track_info_c m_ti; mm_io_cptr m_in; uint64_t m_size; std::vector<generic_packetizer_c *> m_reader_packetizers; generic_packetizer_c *m_ptzr_first_packet; std::vector<int64_t> m_requested_track_ids, m_available_track_ids, m_used_track_ids; int64_t m_max_timecode_seen; kax_chapters_cptr m_chapters; bool m_appending; int m_num_video_tracks, m_num_audio_tracks, m_num_subtitle_tracks; int64_t m_reference_timecode_tolerance; protected: id_result_t m_id_results_container; std::vector<id_result_t> m_id_results_tracks, m_id_results_attachments, m_id_results_chapters, m_id_results_tags; timestamp_c m_restricted_timecodes_min, m_restricted_timecodes_max; public: generic_reader_c(const track_info_c &ti, const mm_io_cptr &in); virtual ~generic_reader_c(); virtual file_type_e get_format_type() const = 0; virtual translatable_string_c get_format_name() const; virtual bool is_providing_timecodes() const { return true; } virtual void set_timecode_restrictions(timestamp_c const &min, timestamp_c const &max); virtual timestamp_c const &get_timecode_restriction_min() const; virtual timestamp_c const &get_timecode_restriction_max() const; virtual void read_headers() = 0; virtual file_status_e read(generic_packetizer_c *ptzr, bool force = false) = 0; virtual void read_all(); virtual int get_progress(); virtual void set_headers(); virtual void set_headers_for_track(int64_t tid); virtual void identify() = 0; virtual void create_packetizer(int64_t tid) = 0; virtual void create_packetizers() { create_packetizer(0); } virtual int add_packetizer(generic_packetizer_c *ptzr); virtual size_t get_num_packetizers() const; virtual generic_packetizer_c *find_packetizer_by_id(int64_t id) const; virtual void set_timecode_offset(int64_t offset); virtual void check_track_ids_and_packetizers(); virtual void add_requested_track_id(int64_t id); virtual void add_available_track_id(int64_t id); virtual void add_available_track_ids(); virtual void add_available_track_id_range(int64_t start, int64_t end); virtual void add_available_track_id_range(int64_t num) { add_available_track_id_range(0, num - 1); } virtual int64_t get_file_size() { return m_in->get_size(); } virtual int64_t get_queued_bytes() const; virtual bool is_simple_subtitle_container() { return false; } virtual file_status_e flush_packetizer(int num); virtual file_status_e flush_packetizer(generic_packetizer_c *ptzr); virtual file_status_e flush_packetizers(); virtual attach_mode_e attachment_requested(int64_t id); virtual void display_identification_results(); virtual int64_t calculate_probe_range(int64_t file_size, int64_t fixed_minimum) const; public: static void set_probe_range_percentage(int64_rational_c const &probe_range_percentage); protected: virtual bool demuxing_requested(char type, int64_t id, std::string const &language = ""); virtual void id_result_container(mtx::id::verbose_info_t const &verbose_info = mtx::id::verbose_info_t{}); virtual void id_result_track(int64_t track_id, const std::string &type, const std::string &info, mtx::id::verbose_info_t const &verbose_info = mtx::id::verbose_info_t{}); virtual void id_result_attachment(int64_t attachment_id, const std::string &type, int size, const std::string &file_name = empty_string, const std::string &description = empty_string, boost::optional<uint64_t> id = boost::optional<uint64_t>{}); virtual void id_result_chapters(int num_entries); virtual void id_result_tags(int64_t track_id, int num_entries); virtual std::string id_escape_string(const std::string &s); virtual mm_io_c *get_underlying_input() const; virtual void display_identification_results_as_json(); virtual void display_identification_results_as_text(); }; #endif // MTX_MERGE_GENERIC_READER_H
/* * os_netbsd.h * * Home page of code is: http://www.smartmontools.org * * Copyright (C) 2003-8 Sergey Svishchev * * SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef OS_NETBSD_H_ #define OS_NETBSD_H_ #define OS_NETBSD_H_CVSID "$Id$\n" #include <sys/device.h> #include <sys/param.h> #include <sys/sysctl.h> #include <sys/scsiio.h> #include <sys/ataio.h> #define ata_smart_selftestlog __netbsd_ata_smart_selftestlog #include <dev/ata/atareg.h> #if HAVE_DEV_ATA_ATAVAR_H #include <dev/ata/atavar.h> #endif #include <dev/ic/wdcreg.h> #undef ata_smart_selftestlog #include <err.h> #include <fcntl.h> #include <util.h> #ifndef WDSM_RD_THRESHOLDS /* pre-1.6.2 system */ #define WDSM_RD_THRESHOLDS 0xd1 #endif #ifndef WDSMART_CYL #define WDSMART_CYL 0xc24f #endif #endif /* OS_NETBSD_H_ */
#ifndef CONTACTDELEGATE_H #define CONTACTDELEGATE_H #include <QStyledItemDelegate> class ContactDelegate : public QStyledItemDelegate { public: explicit ContactDelegate(QWidget* parent = 0) : QStyledItemDelegate(parent){} protected: void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const; QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const; }; #endif // CONTACTDELEGATE_H
/* ** $Id: newtoolbar_impl.h 7338 2007-08-16 03:46:09Z xgwang $ ** ** newtoolbar.h: the head file of NewToolBar control module. ** ** Copyright (C) 2003 ~ 2007 Feynman Software. ** ** Create date: 2003/04/24 */ #ifndef __NEWTOOLBAR_IMPL_H_ #define __NEWTOOLBAR_IMPL_H_ #ifdef __cplusplus extern "C" { #endif #define WIDTH_SEPARATOR 5 #define GAP_BMP_TEXT_HORZ 2 #define GAP_BMP_TEXT_VERT 2 #define GAP_ITEM_ITEM_HORZ 2 #define GAP_ITEM_ITEM_VERT 2 #define MARGIN_HORZ 9 #ifdef _FLAT_WINDOW_STYLE #define MARGIN_VERT 2 #else #define MARGIN_VERT 3 #endif #ifdef _FLAT_WINDOW_STYLE #define MARGIN_V_HORZ 2 #else #define MARGIN_V_HORZ 3 #endif #define MARGIN_V_VERT 9 typedef struct ntbItem { struct ntbItem *next; struct ntbItem *prev; DWORD flags; int id; int bmp_cell; char text[NTB_TEXT_LEN + 1]; char tip[NTB_TIP_LEN + 1]; RECT rc_item; RECT rc_text; RECT rc_hotspot; HOTSPOTPROC hotspot_proc; DWORD add_data; } NTBITEM; typedef NTBITEM* PNTBITEM; typedef struct ntbCtrlData { NTBITEM* head; NTBITEM* tail; DWORD style; BITMAP* image; int nr_cells; int nr_cols; int w_cell; int h_cell; int nr_items; NTBITEM* sel_item; BOOL btn_down; } NTBCTRLDATA; typedef NTBCTRLDATA* PNTBCTRLDATA; BOOL RegisterNewToolbarControl (void); void NewToolbarControlCleanup (void); #ifdef __cplusplus } #endif #endif /* __NEWTOOLBAR_IMPL_H_ */
/* * Copyright (C) 2011, 2012, NVIDIA CORPORATION * 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 NVIDIA CORPORATION 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 ``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 EGLImageLayer_h #define EGLImageLayer_h #if USE(ACCELERATED_COMPOSITING) #include "EGLImageSurface.h" #include "LayerAndroid.h" #include <wtf/RefPtr.h> namespace WTF { template<unsigned Capacity> class DelegateThread; } namespace WebCore { class FPSTimer; template <typename TimerFiredClass> class Timer; class EGLImageLayer : public LayerAndroid { typedef WTF::DelegateThread<4> FenceWaitThread; public: EGLImageLayer(RefPtr<EGLImageSurface>, const char* name); EGLImageLayer(const EGLImageLayer&); ~EGLImageLayer(); virtual LayerAndroid* copy() const { return new EGLImageLayer(*this); } virtual SubclassType subclassType() const { return LayerAndroid::EGLImageLayer; } virtual bool needsIsolatedSurface() { return true; } virtual bool drawGL(bool layerTilesDisabled); virtual void didAttachToView(android::WebViewCore*); virtual void didDetachFromView(); virtual bool handleNeedsDisplay(); virtual void syncContents(); bool needsBlendingLayer(float opacity) const; protected: virtual void onDraw(SkCanvas* canvas, SkScalar opacity, android::DrawExtra* extra, PaintStyle style); private: void commitBackBuffer(Timer<EGLImageLayer>*); void submitBufferForComposition(PassRefPtr<EGLImageBufferRing>, PassOwnPtr<EGLImageBuffer>); RefPtr<EGLImageSurface> m_surface; RefPtr<EGLImageBufferRing> m_bufferRing; OwnPtr<Timer<EGLImageLayer> > m_syncTimer; OwnPtr<FenceWaitThread> m_fenceWaitThread; SkRefPtr<android::WebViewCore> m_webViewCore; OwnPtr<FPSTimer> m_fpsTimer; bool m_isInverted; bool m_hasAlpha; bool m_hasPremultipliedAlpha; }; } // namespace WebCore #endif // USE(ACCELERATED_COMPOSITING) #endif // EGLImageLayer_h
#define CONFIG_FEATURE_EDITING_ASK_TERMINAL 1