text
stringlengths
4
6.14k
// UGQuadGridSet.h: interface for the UGQuadTileGrid class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_UGQUADTILEGRID_H__504F4C12_5DDB_4816_A901_3A197F2383F7__INCLUDED_) #define AFX_UGQUADTILEGRID_H__504F4C12_5DDB_4816_A901_3A197F2383F7__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "Scene/UGPrerequisites.h" #include "Scene/UGRenderable.h" #include "Base/UGThread.h" #include "Scene/UGQuadGrid.h" #include "Base/UGDict.h" #include "Scene/UGVectorDatasetAtr.h" namespace UGC { class UGDataset; //! \brief ¹ÜÀíËIJæÊ÷µÚ0²ã¸ù½ÚµãµÄÀà //! \remarks ±¸×¢ÐÅÏ¢ class SCENE_API SyncTopGridMap { public: SyncTopGridMap(){}; virtual ~SyncTopGridMap(){}; void inline Lock(){m_mutex.lock();} void inline Unlock(){m_mutex.unlock();} public: UGDict<UGlong,UGQuadGrid*> m_Dict; protected: UGMutex m_mutex; }; //! \brief ¹ÜÀíËIJæÊ÷µÄÀà //! \remarks class SCENE_API UGQuadGridSet:public UGRenderable, public UGMovableObject { public: //! \brief ¹¹Ô캯Êý UGQuadGridSet(); virtual ~UGQuadGridSet(); public: //! \brief µÃµ½¼ÆËãLODµÄ²ÎÊýÒò×ÓTileDrawDistance UGfloat GetTileDrawDistance(); //! \brief ÉèÖüÆËãLODµÄ²ÎÊýÒò×ÓTileDrawDistance void SetTileDrawDistance(UGfloat value); //! \brief µÃµ½¼ÆËãLODµÄ²ÎÊýÒò×ÓTileDrawSpread UGfloat GetTileDrawSpread(); //! \brief ÉèÖüÆËãLODµÄ²ÎÊýÒò×ÓTileDrawSpread void SetTileDrawSpread(UGfloat value); //! \brief µÃµ½È«Çòͳһ¸ñÍøËùʹÓõÄÇòÌå°ë¾¶ UGdouble GetGlobalRadius(); //! \brief ÉèÖÃÈ«Çòͳһ¸ñÍøËùʹÓõÄÇòÌå°ë¾¶ void SetGlobalRadius(UGdouble dRadius); //! \brief µÃµ½È«Çòͳһ¸ñÍøµÄ×î´ó²ãÊý UGint GetMaxLevel(); //! \brief ÉèÖÃÈ«Çòͳһ¸ñÍøµÄ×î´ó²ãÊý void SetMaxLevel(UGint nMaxLevel); UGList<UGVectorDatasetAtr>& GetDatasetList(); void AddDataset(const UGVectorDatasetAtr& pDataset); UGbool IsDatasetExist(const UGString& strName); void RemoveDataset(const UGString& strName); UGbool GetDataset(const UGString& strName,UGVectorDatasetAtr& atr); //! \brief µÃµ½ËIJæÊ÷ԭʼÊý¾Ý¿éµÄ±±±ß½ç UGReal GetNorth(); //! \brief µÃµ½ËIJæÊ÷ԭʼÊý¾Ý¿éµÄ¶«±ß½ç UGReal GetEast(); //! \brief µÃµ½ËIJæÊ÷ԭʼÊý¾Ý¿éµÄÄϱ߽ç UGReal GetSouth(); //! \brief µÃµ½ËIJæÊ÷ԭʼÊý¾Ý¿éµÄÎ÷±ß½ç UGReal GetWest(); //! \brief ¼Ì³Ð×Ô¿ÉäÖȾ¶ÔÏóµÄº¯Êý virtual void Initialize(); //! \brief ¼Ì³Ð×Ô¿ÉäÖȾ¶ÔÏóµÄº¯Êý£¬¸ºÔðÊý¾ÝµÄÑ¡Ôñ virtual UGbool PerformSelectionAction(); //! \brief ¼Ì³Ð×Ô¿ÉäÖȾ¶ÔÏóµÄº¯Êý£¬¸ºÔð¿éÊý¾ÝµÄ¸üРvirtual void Update(); //! \brief ¼Ì³Ð×Ô¿ÉäÖȾ¶ÔÏóµÄº¯Êý£¬¸ºÔðÊý¾ÝµÄäÖȾ virtual void Render(); //! \brief ¼Ì³Ð×Ô¿ÉäÖȾ¶ÔÏóµÄº¯Êý£¬¸ºÔðÊý¾ÝµÄÊÍ·Å virtual void Release(); virtual void ResetCacheForCurrentView(UGMomentumCamera* pCamera); //! \brief ½«ËIJæÊ÷¶¥²ã²»¿É¼û¿ì´ÓäÖȾ¶ÓÁÐÖÐɾ³ý void RemoveInvisibleTiles(UGMomentumCamera* pCamera); protected: //! \brief ËIJæÊ÷µÚ0²ãÿ¿é¾­Î³¶È¼ä¸ô UGdouble m_dL0TileSizeDeg; //! \brief ËIJæÊ÷LOD¼ÆËãÒò×ÓTileDrawDistance UGfloat m_fTileDrawDistance; //! \brief ËIJæÊ÷LOD¼ÆËãÒò×ÓTileDrawSpread UGfloat m_fTileDrawSpread; //! \brief ËIJæÊ÷µÚ0²ã¸ù½ÚµãµÄ¹ÜÀí¶ÔÏó SyncTopGridMap m_TopmostTiles; //! \brief UGlong m_lLastRenderTime; //! \brief È«Çòͳһ¸ñÍø×î´ó²ãÊý UGint m_nMaxLevel; //! °ë¾¶ UGdouble m_dGlobalRadius; UGList<UGVectorDatasetAtr>m_DatasetList; }; } #endif // !defined(AFX_UGQUADTILEGRID_H__504F4C12_5DDB_4816_A901_3A197F2383F7__INCLUDED_)
/* ** vars_del.c for 42sh in /media/data/all/projects/42sh-v1/src ** ** Made by kevin labbe ** Login <labbe_k@epitech.net> ** ** Started on Thu Apr 25 18:22:44 2013 kevin labbe ** Last update Mon May 6 12:23:25 2013 kevin labbe */ #include "proto.h" int vars_del_var(t_list *list, char *name) { t_list *tmp; t_vars *elt; if (!list) return (-1); tmp = list->next; while (tmp != list) { elt = tmp->data; if (!strcmp(elt->name, name)) return (list_del_elt(tmp, &vars_del_elt)); tmp = tmp->next; } return (0); } void vars_del_elt(t_list *elt) { if (((t_vars *)elt->data)->free) { free(((t_vars *)elt->data)->name); free(((t_vars *)elt->data)->val); } free(elt->data); } void vars_free(t_list *list) { list_del(list, &vars_del_elt); free(list); }
/*!A cross-platform build utility based on Lua * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Copyright (C) 2015-2020, TBOOX Open Source Group. * * @author ruki * @file filelock_trylock.c * */ /* ////////////////////////////////////////////////////////////////////////////////////// * trace */ #define TB_TRACE_MODULE_NAME "filelock_trylock" #define TB_TRACE_MODULE_DEBUG (0) /* ////////////////////////////////////////////////////////////////////////////////////// * includes */ #include "prefix.h" /* ////////////////////////////////////////////////////////////////////////////////////// * implementation */ /* try to lock file * * exclusive lock: io.filelock_trylock("/xxxx/filelock") * shared lock: io.filelock_trylock("/xxxx/filelock", {shared = true}) */ tb_int_t xm_io_filelock_trylock(lua_State* lua) { // check tb_assert_and_check_return_val(lua, 0); // get option argument tb_bool_t is_shared = tb_false; if (lua_istable(lua, 2)) { // is shared lock? lua_pushstring(lua, "shared"); lua_gettable(lua, 2); is_shared = (tb_bool_t)lua_toboolean(lua, -1); lua_pop(lua, 1); } // check lock? if (!xm_lua_ispointer(lua, 1)) return 0; // get lock tb_filelock_ref_t lock = (tb_filelock_ref_t)xm_lua_topointer(lua, 1); tb_check_return_val(lock, 0); // try to lock it tb_bool_t ok = tb_filelock_enter_try(lock, is_shared? TB_FILELOCK_MODE_SH : TB_FILELOCK_MODE_EX); lua_pushboolean(lua, ok); return 1; }
/* * Copyright (c) 2015 Cossack Labs Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @file themis/themis_error.h * @brief return type, return codes and check macros */ #ifndef THEMIS_ERROR_H #define THEMIS_ERROR_H #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <soter/soter_error.h> /** @brief return type */ typedef int32_t themis_status_t; /** * @addtogroup THEMIS * @{ * @defgroup SOTER_ERROR_CODES status codes * @{ */ // #define THEMIS_SUCCESS SOTER_SUCCESS #define THEMIS_SSESSION_SEND_OUTPUT_TO_PEER 1 //errors #define THEMIS_FAIL SOTER_FAIL #define THEMIS_INVALID_PARAMETER SOTER_INVALID_PARAMETER #define THEMIS_NO_MEMORY SOTER_NO_MEMORY #define THEMIS_BUFFER_TOO_SMALL SOTER_BUFFER_TOO_SMALL #define THEMIS_DATA_CORRUPT SOTER_DATA_CORRUPT #define THEMIS_INVALID_SIGNATURE SOTER_INVALID_SIGNATURE #define THEMIS_NOT_SUPPORTED SOTER_NOT_SUPPORTED #define THEMIS_SSESSION_KA_NOT_FINISHED 19 #define THEMIS_SSESSION_TRANSPORT_ERROR 20 #define THEMIS_SSESSION_GET_PUB_FOR_ID_CALLBACK_ERROR 21 #define THEMIS_SCOMPARE_SEND_OUTPUT_TO_PEER THEMIS_SSESSION_SEND_OUTPUT_TO_PEER /** @} */ /** * @defgroup THEMIS_ERROR_OUT routines for error and debug output * @{ */ #ifdef DEBUG #define THEMIS_ERROR_OUT(message) SOTER_ERROR_OUT(message) #define THEMIS_DEBUG_OUT(message) SOTER_DEBUG_OUT(message) #else #define THEMIS_ERROR_OUT(message) #define THEMIS_DEBUG_OUT(message) #endif /**@}*/ /** * @defgroup SOTER_CHECK_ROUTINES routines for parameters and variables checking * @{ */ #define THEMIS_CHECK(x) SOTER_CHECK(x) #define THEMIS_CHECK_(x) SOTER_CHECK_(x) #define THEMIS_CHECK_PARAM(x) SOTER_CHECK_PARAM(x) #define THEMIS_CHECK_PARAM_(x) SOTER_CHECK_PARAM_(x) #define THEMIS_CHECK_MALLOC(x,y) SOTER_CHECK_MALLOC(x,y) #define THEMIS_CHECK_MALLOC_(x) SOTER_CHECK_MALLOC_(x) #define THEMIS_CHECK_FREE(x,y) SOTER_CHECK_FREE(x,y) #define THEMIS_IF_FAIL(x,y) SOTER_IF_FAIL(x,y) #define THEMIS_IF_FAIL_(x,y) SOTER_IF_FAIL_(x,y) #define THEMIS_STATUS_CHECK(x,y) SOTER_STATUS_CHECK(x,y) #define THEMIS_STATUS_CHECK_FREE(x,y,z) SOTER_STATUS_CHECK_FREE(x,y,z) #define THEMIS_CHECK__(cond, on_fail_call) do{if(!(cond)){on_fail_call;}}while(0) /** @} * @} */ #endif /* THEMIS_ERROR_H */
/* * #%L * %% * Copyright (C) 2011 - 2017 BMW Car IT GmbH * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ #ifndef WEBSOCKETSETTINGS_H #define WEBSOCKETSETTINGS_H #include <chrono> #include <string> #include "joynr/Logger.h" namespace joynr { class Settings; namespace system { namespace RoutingTypes { class WebSocketAddress; } // namespace RoutingTypes } // namespace system class WebSocketSettings { public: static const std::string& SETTING_CC_MESSAGING_URL(); static const std::string& SETTING_RECONNECT_SLEEP_TIME_MS(); static const std::string& SETTING_CERTIFICATE_AUTHORITY_PEM_FILENAME(); static const std::string& SETTING_CERTIFICATE_PEM_FILENAME(); static const std::string& SETTING_PRIVATE_KEY_PEM_FILENAME(); static const std::string& DEFAULT_WEBSOCKET_SETTINGS_FILENAME(); explicit WebSocketSettings(Settings& settings); WebSocketSettings(const WebSocketSettings&) = default; WebSocketSettings(WebSocketSettings&&) = default; ~WebSocketSettings() = default; std::string getClusterControllerMessagingUrl() const; void setClusterControllerMessagingUrl(const std::string& url); system::RoutingTypes::WebSocketAddress createClusterControllerMessagingAddress() const; std::chrono::milliseconds getReconnectSleepTimeMs() const; void setReconnectSleepTimeMs(const std::chrono::milliseconds reconnectSleepTimeMs); /************************************************************************************* * The certificate / key properties are only used internally and may be removed later *************************************************************************************/ void setCertificateAuthorityPemFilename(const std::string& filename); std::string getCertificateAuthorityPemFilename() const; void setCertificatePemFilename(const std::string& filename); std::string getCertificatePemFilename() const; void setPrivateKeyPemFilename(const std::string& filename); std::string getPrivateKeyPemFilename() const; void printSettings() const; bool contains(const std::string& key) const; private: void operator=(const WebSocketSettings& other); Settings& settings; ADD_LOGGER(WebSocketSettings); void checkSettings() const; }; } // namespace joynr #endif // WEBSOCKETSETTINGS_H
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* CMetrics * ======== * Copyright 2021 Eduardo Silva <eduardo@calyptia.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CMT_DECODE_OPENTELEMETRY_H #define CMT_DECODE_OPENTELEMETRY_H #include <cmetrics/cmetrics.h> #include <opentelemetry/metrics.pb-c.h> #include <opentelemetry/metrics_service.pb-c.h> #define CMT_DECODE_OPENTELEMETRY_SUCCESS 0 #define CMT_DECODE_OPENTELEMETRY_ALLOCATION_ERROR 1 #define CMT_DECODE_OPENTELEMETRY_INVALID_ARGUMENT_ERROR 2 #define CMT_DECODE_OPENTELEMETRY_KVLIST_ACCESS_ERROR 3 #define CMT_DECODE_OPENTELEMETRY_ARRAY_ACCESS_ERROR 4 struct cmt_opentelemetry_decode_context { struct cmt *cmt; struct cmt_map *map; struct cmt_metric *metric; char **namespace_identifiers; char **subsystem_identifiers; }; int cmt_decode_opentelemetry_create(struct cmt **out_cmt, char *in_buf, size_t in_size, size_t *offset); void cmt_decode_opentelemetry_destroy(struct cmt *cmt); #endif
/* * DO NOT EDIT. THIS FILE IS GENERATED FROM /builds/slave/rel-m-rel-xr-osx64-bld/build/netwerk/base/public/nsINetworkLinkService.idl */ #ifndef __gen_nsINetworkLinkService_h__ #define __gen_nsINetworkLinkService_h__ #ifndef __gen_nsISupports_h__ #include "nsISupports.h" #endif /* For IDL files that don't want to include root IDL files. */ #ifndef NS_NO_VTABLE #define NS_NO_VTABLE #endif /* starting interface: nsINetworkLinkService */ #define NS_INETWORKLINKSERVICE_IID_STR "f7d3be87-7403-4a1e-b89f-2797776e9b08" #define NS_INETWORKLINKSERVICE_IID \ {0xf7d3be87, 0x7403, 0x4a1e, \ { 0xb8, 0x9f, 0x27, 0x97, 0x77, 0x6e, 0x9b, 0x08 }} class NS_NO_VTABLE NS_SCRIPTABLE nsINetworkLinkService : public nsISupports { public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_INETWORKLINKSERVICE_IID) enum { LINK_TYPE_UNKNOWN = 0U }; enum { LINK_TYPE_ETHERNET = 1U }; enum { LINK_TYPE_USB = 2U }; enum { LINK_TYPE_WIFI = 3U }; enum { LINK_TYPE_WIMAX = 4U }; enum { LINK_TYPE_2G = 5U }; enum { LINK_TYPE_3G = 6U }; enum { LINK_TYPE_4G = 7U }; /* readonly attribute boolean isLinkUp; */ NS_SCRIPTABLE NS_IMETHOD GetIsLinkUp(PRBool *aIsLinkUp) = 0; /* readonly attribute boolean linkStatusKnown; */ NS_SCRIPTABLE NS_IMETHOD GetLinkStatusKnown(PRBool *aLinkStatusKnown) = 0; /* readonly attribute unsigned long linkType; */ NS_SCRIPTABLE NS_IMETHOD GetLinkType(PRUint32 *aLinkType) = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsINetworkLinkService, NS_INETWORKLINKSERVICE_IID) /* Use this macro when declaring classes that implement this interface. */ #define NS_DECL_NSINETWORKLINKSERVICE \ NS_SCRIPTABLE NS_IMETHOD GetIsLinkUp(PRBool *aIsLinkUp); \ NS_SCRIPTABLE NS_IMETHOD GetLinkStatusKnown(PRBool *aLinkStatusKnown); \ NS_SCRIPTABLE NS_IMETHOD GetLinkType(PRUint32 *aLinkType); /* Use this macro to declare functions that forward the behavior of this interface to another object. */ #define NS_FORWARD_NSINETWORKLINKSERVICE(_to) \ NS_SCRIPTABLE NS_IMETHOD GetIsLinkUp(PRBool *aIsLinkUp) { return _to GetIsLinkUp(aIsLinkUp); } \ NS_SCRIPTABLE NS_IMETHOD GetLinkStatusKnown(PRBool *aLinkStatusKnown) { return _to GetLinkStatusKnown(aLinkStatusKnown); } \ NS_SCRIPTABLE NS_IMETHOD GetLinkType(PRUint32 *aLinkType) { return _to GetLinkType(aLinkType); } /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */ #define NS_FORWARD_SAFE_NSINETWORKLINKSERVICE(_to) \ NS_SCRIPTABLE NS_IMETHOD GetIsLinkUp(PRBool *aIsLinkUp) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetIsLinkUp(aIsLinkUp); } \ NS_SCRIPTABLE NS_IMETHOD GetLinkStatusKnown(PRBool *aLinkStatusKnown) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLinkStatusKnown(aLinkStatusKnown); } \ NS_SCRIPTABLE NS_IMETHOD GetLinkType(PRUint32 *aLinkType) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLinkType(aLinkType); } #if 0 /* Use the code below as a template for the implementation class for this interface. */ /* Header file */ class nsNetworkLinkService : public nsINetworkLinkService { public: NS_DECL_ISUPPORTS NS_DECL_NSINETWORKLINKSERVICE nsNetworkLinkService(); private: ~nsNetworkLinkService(); protected: /* additional members */ }; /* Implementation file */ NS_IMPL_ISUPPORTS1(nsNetworkLinkService, nsINetworkLinkService) nsNetworkLinkService::nsNetworkLinkService() { /* member initializers and constructor code */ } nsNetworkLinkService::~nsNetworkLinkService() { /* destructor code */ } /* readonly attribute boolean isLinkUp; */ NS_IMETHODIMP nsNetworkLinkService::GetIsLinkUp(PRBool *aIsLinkUp) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute boolean linkStatusKnown; */ NS_IMETHODIMP nsNetworkLinkService::GetLinkStatusKnown(PRBool *aLinkStatusKnown) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute unsigned long linkType; */ NS_IMETHODIMP nsNetworkLinkService::GetLinkType(PRUint32 *aLinkType) { return NS_ERROR_NOT_IMPLEMENTED; } /* End of implementation class template. */ #endif /** * We send notifications through nsIObserverService with topic * NS_NETWORK_LINK_TOPIC whenever one of isLinkUp or linkStatusKnown * changes. We pass one of the NS_NETWORK_LINK_DATA_ constants below * as the aData parameter of the notification. */ #define NS_NETWORK_LINK_TOPIC "network:link-status-changed" /** * isLinkUp is now true, linkStatusKnown is true. */ #define NS_NETWORK_LINK_DATA_UP "up" /** * isLinkUp is now false, linkStatusKnown is true. */ #define NS_NETWORK_LINK_DATA_DOWN "down" /** * linkStatusKnown is now false. */ #define NS_NETWORK_LINK_DATA_UNKNOWN "unknown" /** * We send notifications through nsIObserverService with topic * NS_NETWORK_LINK_TYPE_TOPIC whenever the network connection type * changes. We pass one of the valid connection type constants * below as the aData parameter of the notification. */ #define NS_NETWORK_LINK_TYPE_TOPIC "network:link-type-changed" /** We were unable to determine the network connection type */ #define NS_NETWORK_LINK_TYPE_UNKNOWN "unknown" /** A standard wired ethernet connection */ #define NS_NETWORK_LINK_TYPE_ETHERNET "ethernet" /** A connection via a USB port */ #define NS_NETWORK_LINK_TYPE_USB "usb" /** A connection via a WiFi access point (IEEE802.11) */ #define NS_NETWORK_LINK_TYPE_WIFI "wifi" /** A connection via WiMax (IEEE802.16) */ #define NS_NETWORK_LINK_TYPE_WIMAX "wimax" /** A '2G' mobile connection (e.g. GSM, GPRS, EDGE) */ #define NS_NETWORK_LINK_TYPE_2G "2g" /** A '3G' mobile connection (e.g. UMTS, CDMA) */ #define NS_NETWORK_LINK_TYPE_3G "3g" /** A '4G' mobile connection (e.g. LTE, UMB) */ #define NS_NETWORK_LINK_TYPE_4G "4g" #endif /* __gen_nsINetworkLinkService_h__ */
/*- * Copyright 2011 os-cillation GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #import <UIKit/UIKit.h> @protocol ReturnDateSelectViewControllerDelegate; @interface ReturnDateSelectViewController : UIViewController { id <ReturnDateSelectViewControllerDelegate> delegate; IBOutlet UIDatePicker *datePicker; IBOutlet UILabel *labelPush; IBOutlet UISwitch *switchPush; NSDate *date; NSDate *minDate; NSDate *pushAlarm; } @property (nonatomic, assign) id <ReturnDateSelectViewControllerDelegate> delegate; @property (nonatomic, retain) IBOutlet UIDatePicker *datePicker; @property (nonatomic, retain) IBOutlet UISwitch *switchPush; @property (nonatomic, retain) NSDate *date; @property (nonatomic, retain) NSDate *minDate; @property (nonatomic, retain) NSDate *pushAlarm; - (IBAction)done; - (IBAction)cancel; - (IBAction)handlePushNotificationsChanged; @end @protocol ReturnDateSelectViewControllerDelegate - (void)returnDateSelectViewControllerDidFinish:(ReturnDateSelectViewController *)controller; @end
// // REIRestaurantController.h // Bread2Where // // Created by FEI on 15/6/11. // Copyright (c) 2015年 FEI. All rights reserved. // #import <UIKit/UIKit.h> #import "REINearbyRootController.h" @interface REIRestaurantController : REINearbyRootController @end
#if !defined(AFX_QUOTES_H__8573C03F_5C45_11D2_B3E8_006097A8F69A__INCLUDED_) #define AFX_QUOTES_H__8573C03F_5C45_11D2_B3E8_006097A8F69A__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // Quotes.h : Header-Datei // ///////////////////////////////////////////////////////////////////////////// // DAO Satzgruppe CQuotes class CQuotes : public CDaoRecordset { public: CQuotes(CDaoDatabase* pDatabase = NULL); DECLARE_DYNAMIC(CQuotes) // Feld-/Parameterdaten //{{AFX_FIELD(CQuotes, CDaoRecordset) long m_Aktiennummer; CString m_Aktienname; long m_WKN; CString m_Tickersymbol; long m_Aktiennummer2; COleDateTime m_Datum; COleCurrency m_Kurs; //}}AFX_FIELD // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CQuotes) public: virtual CString GetDefaultDBName(); // Standard-Datenbankname virtual CString GetDefaultSQL(); // Standard-SQL für Satzgruppe virtual void DoFieldExchange(CDaoFieldExchange* pFX); // RFX-Unterstützung //}}AFX_VIRTUAL // Implementierung #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ fügt unmittelbar vor der vorhergehenden Zeile zusätzliche Deklarationen ein. #endif // AFX_QUOTES_H__8573C03F_5C45_11D2_B3E8_006097A8F69A__INCLUDED_
// // TTPlayerFrame.h // TTPlayerExample // // Created by liang on 2/16/16. // Copyright © 2016 tina. All rights reserved. // #import <Foundation/Foundation.h> #include <CoreVideo/CoreVideo.h> #import "avformat.h" typedef enum : NSUInteger { kTTPlayerFrameRGB, kTTPlayerFrameYUV, } TTPlayerFrameType; @interface TTPlayerFrame : NSObject @property (nonatomic, assign) TTPlayerFrameType type; @property (nonatomic, assign) CVPixelBufferRef buffer; @property (nonatomic, assign) AVFrame *avframe; @property (nonatomic, assign) double pts; - (instancetype)initWithAVFrame:(AVFrame *)avframe andType:(TTPlayerFrameType)type; - (instancetype)initWithCVBuffer:(CVPixelBufferRef)buffer andType:(TTPlayerFrameType)type; @end
// // HashTable.h // LibLevity // // Created by 褚晓敏 on 11/1/15. // Copyright © 2015 褚晓敏. All rights reserved. // #ifndef HashTable_h #define HashTable_h #include "BlockNames.h" typedef struct HashElement_ { void *data; char key[31]; struct HashElement_ *next; } HashElement; typedef struct HashTable_ { HashElement **table; UInt32 tableSize; VoidBlockWithVoidPtrInput dataDestroy; } HashTable; HashTable *NewHashTable(UInt32 tableSize, VoidBlockWithVoidPtrInput dataDestroy); void DestroyHashTable(HashTable *self); Int8 HashTableInsert(HashTable *self, void *data, const char *key); Void *HashTableLookUp(HashTable *self, const char *key); #endif /* HashTable_h */
// Copyright 2017 The Crashpad Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef CRASHPAD_UTIL_PROCESS_PROCESS_MEMORY_LINUX_H_ #define CRASHPAD_UTIL_PROCESS_PROCESS_MEMORY_LINUX_H_ #include <sys/types.h> #include <string> #include "base/files/scoped_file.h" #include "base/macros.h" #include "util/misc/address_types.h" #include "util/process/process_memory.h" namespace crashpad { //! \brief Accesses the memory of another Linux process. class ProcessMemoryLinux final : public ProcessMemory { public: ProcessMemoryLinux(); ~ProcessMemoryLinux(); //! \brief Initializes this object to read the memory of a process whose ID //! is \a pid. //! //! This method must be called successfully prior to calling any other method //! in this class. //! //! \param[in] pid The process ID of a target process. //! //! \return `true` on success, `false` on failure with a message logged. bool Initialize(pid_t pid); bool Read(VMAddress address, size_t size, void* buffer) const override; private: bool ReadCStringInternal(VMAddress address, bool has_size, size_t size, std::string* string) const override; base::ScopedFD mem_fd_; pid_t pid_; DISALLOW_COPY_AND_ASSIGN(ProcessMemoryLinux); }; } // namespace crashpad #endif // CRASHPAD_UTIL_PROCESS_PROCESS_MEMORY_LINUX_H_
#include "interrupt.h" #define DURATION 5 struct k_timer timer; /* This tests uses two IRQ lines, selected within the range of IRQ lines * available on the target SOC the test executes on (and starting from * the maximum available IRQ line index) */ #define IRQ_LINE(offset) (CONFIG_NUM_IRQS - ((offset) + 1)) #define ISR0_OFFSET 1 #define ISR1_OFFSET 2 /* Keeping isr0 to be lowest priority than system timer * so that it can be interrupted by timer triggered. * In NRF5, RTC system timer is of priority 1 and * in all other architectures, system timer is considered * to be in priority 0. */ #if defined(CONFIG_ARM) #define ISR0_PRIO 2 #define ISR1_PRIO 1 #else #define ISR0_PRIO 1 #define ISR1_PRIO 0 #endif #define MS_TO_US(ms) (K_MSEC(ms) * USEC_PER_MSEC) volatile u32_t new_val; u32_t old_val = 0xDEAD; volatile u32_t check_lock_new; u32_t check_lock_old = 0xBEEF; void isr1(void *param) { ARG_UNUSED(param); new_val = 0xDEAD; printk("%s ran !!\n", __func__); } /** * * triggering interrupt from the timer expiry function while isr0 * is in busy wait */ #ifndef NO_TRIGGER_FROM_SW static void handler(struct k_timer *timer) { ARG_UNUSED(timer); irq_enable(IRQ_LINE(ISR1_OFFSET)); trigger_irq(IRQ_LINE(ISR1_OFFSET)); } #else void handler(void) { ztest_test_skip(); } #endif void isr0(void *param) { ARG_UNUSED(param); printk("%s running !!\n", __func__); k_busy_wait(MS_TO_US(10)); printk("%s execution completed !!\n", __func__); zassert_equal(new_val, old_val, "Nested interrupt is not working\n"); } /** * * Interrupt nesting feature allows an ISR to be preempted in mid-execution * if a higher priority interrupt is signaled. The lower priority ISR resumes * execution once the higher priority ISR has completed its processing. * The expected control flow should be isr0 -> handler -> isr1 -> isr0 */ #ifndef NO_TRIGGER_FROM_SW void test_nested_isr(void) { IRQ_CONNECT(IRQ_LINE(ISR0_OFFSET), ISR0_PRIO, isr0, NULL, 0); IRQ_CONNECT(IRQ_LINE(ISR1_OFFSET), ISR1_PRIO, isr1, NULL, 0); k_timer_init(&timer, handler, NULL); k_timer_start(&timer, DURATION, 0); irq_enable(IRQ_LINE(ISR0_OFFSET)); trigger_irq(IRQ_LINE(ISR0_OFFSET)); } #else void test_nested_isr(void) { ztest_test_skip(); } #endif static void timer_handler(struct k_timer *timer) { ARG_UNUSED(timer); check_lock_new = 0xBEEF; } static void offload_function(void *param) { ARG_UNUSED(param); zassert_true(_is_in_isr(), "Not in IRQ context!"); k_timer_init(&timer, timer_handler, NULL); k_busy_wait(MS_TO_US(1)); k_timer_start(&timer, DURATION, 0); zassert_not_equal(check_lock_new, check_lock_old, "Interrupt locking didn't work properly"); } void test_prevent_interruption(void) { irq_offload(offload_function, NULL); k_timer_stop(&timer); }
/** ****************************************************************************** * @file FLASH/FLASH_EraseProgram/Src/stm32f4xx_hal_msp.c * @author MCD Application Team * @version V1.2.1 * @date 13-March-2015 * @brief HAL MSP module. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "main.h" /** @addtogroup STM32F4xx_HAL_Examples * @{ */ /** @defgroup FLASH_EraseProgram * @{ */ /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /** @defgroup HAL_MSP_Private_Functions * @{ */ /** * @} */ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
// // Created by Valdir Jr on 03/05/2017. // #include "../inc/PriorityQueue.h" #include <limits.h> struct PriorityQueue { int size; struct Node * head; }; struct Node{ int data; int priority; Node * next; }; PQueue * NewPQueue() { PQueue * newPQueue= (PQueue*)malloc(sizeof(PQueue)); newPQueue->size=0; newPQueue->head=NULL; } Node * NewNode(int data, int priority) { Node * newNode = (Node *)malloc(sizeof(Node)); newNode->next = NULL; newNode->data = data; newNode->priority= priority; } int Dequeue(PQueue * pq) { if (pq->size==0) { return INT_MIN; } int data = pq->head->data; pq->head = pq->head->next; (pq->size)--; return data; } int Enqueue(PQueue * pq , int data, int priority) { int comparacoes=0; Node * new = NewNode(data,priority); if (pq->size==0) { pq->head = new; (pq->size)++; return comparacoes; } comparacoes++; if (pq->head->priority < priority) { new->next=pq->head; pq->head=new; (pq->size)++; return comparacoes; } else { Node * atual = pq->head; while(atual!=NULL) { comparacoes++; if (atual->next==NULL){comparacoes--;} if ((atual->next==NULL) || ( atual->next->priority < priority)) { new->next= atual->next; atual->next= new; (pq->size)++; return comparacoes; } atual=atual->next; } } } int GetPQueueSize(PQueue * pq) { return pq->size; } void CleanPQueue(PQueue * pq) { while(pq->size!=0) { Dequeue(pq); } }
// // HSFHelpWebVC.h // SportsLotteryTicket // // Created by 胡双飞 on 15/8/31. // Copyright (c) 2015年 HSF. All rights reserved. // #import <UIKit/UIKit.h> @class HSFHelpModel; @interface HSFHelpWebVC : UIViewController /** * 接受数据 */ @property(nonatomic,strong)HSFHelpModel *helpModel; @end
/* * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ #import <Foundation/Foundation.h> #import "AmazonServiceResponseUnmarshaller.h" @interface EC2ResponseUnmarshaller:AmazonServiceResponseUnmarshaller { } @end
/* * Copyright 2017 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef NDASH_UPSTREAM_DATA_SOURCE_H_ #define NDASH_UPSTREAM_DATA_SOURCE_H_ #include <cstdlib> #include "base/synchronization/cancellation_flag.h" #include "upstream/constants.h" namespace ndash { namespace upstream { class DataSpec; // A component that provides media data. class DataSourceInterface { public: virtual ~DataSourceInterface() {} // Opens the DataSource to read the specified data. Only one DataSpec can be // open at a time (call Close() before opening another). If Open() returns // failure (or is canceled), Close() is still required before calling Open() // again. // // Returns the number of bytes that can be read from the opened source. For // unbounded requests (where data_spec.length() equals LENGTH_UNBOUNDED) this // value is the resolved length of the request, or LENGTH_UNBOUNDED if the // length is still unresolved. For all other requests, the value returned // will be equal to the request's data_spec.length(). // // If |cancel| is not null, then the underlying implementation should check // cancel->IsSet() periodically and abort in a clean fashion as soon as // reasonably possible. There is no guarantee that a cancel request is // actually honored. // // This call may block while the request is made. // // Upon failure (or a cancel that results in an early return), returns // RESULT_IO_ERROR virtual ssize_t Open(const DataSpec& data_spec, const base::CancellationFlag* cancel = nullptr) = 0; // Closes the DataSource. virtual void Close() = 0; // Reads up to length bytes of data and stores them into buffer. // This method blocks until at least one byte of data can be read, the end of // the opened range is detected, or an error is returned. // // The buffer will not be null terminated and may contain nulls. This is // roughly equivalent to fread(). // // Returns one of: // - The number of bytes read (>= 0); 0 is not an error. // - RESULT_END_OF_INPUT, if the end of the opened range is reached // - RESULT_IO_ERROR, if there was an error virtual ssize_t Read(void* buffer, size_t read_length) = 0; protected: DataSourceInterface() {} }; } // namespace upstream } // namespace ndash #endif // NDASH_UPSTREAM_DATA_SOURCE_H_
// // XYMainViewController.h // PandaTVHome-iOS // // Created by mofeini on 16/12/9. // Copyright © 2016年 com.test.demo. All rights reserved. // #import <UIKit/UIKit.h> @interface XYMainViewController : UITabBarController @end
// // WGBindThirdPartyViewController.h // WeygoIPhone // // Created by muma on 2017/2/7. // Copyright © 2017年 weygo.com. All rights reserved. // #import "WGViewController.h" #import "WGImageVerificationCodeResponse.h" #import "PooCodeView.h" #import "WGVerificationCodeView.h" @interface WGBindThirdPartyViewController : WGViewController { WGImageVerificationCodeResponse *_verificationCodeResponse; JHView *_registerView; JHTextField *_usernameTextField; JHTextField *_passwordTextField; JHTextField *_codeTextField; PooCodeView *_verificationCodeBtn; JHView *_unRegisterView; JHTextField *_mobileTextField; JHTextField *_unRegisterCodeTextField; JHTextField *_surnameTextField; JHTextField *_nameTextField; JHTextField *_emailTextField; JHTextField *_unRegisterPasswordTextField; JHTextField *_confirmPasswordTextField; WGVerificationCodeView *_unRegisterVerificationCodeBtn; } @property (nonatomic, strong) NSString *uniqueId; @property (nonatomic, assign) WGThirdPartyLoginType type; @end
/* * MAC_Header_Parser.c * * Created on: 24 апр. 2016 г. * Author: evgeniyMorozov */ #include "MAC_Header_Parser.h" #include <string.h> void MAC_Parse_Header(MAC_HeaderTypeDef * mach, uint8_t frame[], uint8_t frame_length) { /* Some basic error handling */ if (!mach || !frame || frame_length < 2) return MAC_HEADER_RES_ERR; /* Position in frame */ uint8_t pos = 0; /* First we parse frame control field like described in 802.15.4 data sheet */ mach->frame_control.frame_type = frame[pos] & 0b11; mach->frame_control.security_enabled = (frame[pos] & 0b100) >> 2; mach->frame_control.frame_pending = (frame[pos] & 0b1000) >> 3; mach->frame_control.ack_request = (frame[pos] & 0b10000) >> 4; mach->frame_control.panID_compression = (frame[pos] & 0b100000) >> 5; mach->frame_control.dst_addr_mode = (frame[++pos] & 0b1100) >> 2; mach->frame_control.frame_ver = (frame[pos] & 0b110000) >> 4; mach->frame_control.src_addr_mode = (frame[pos] & 0b11000000) >> 6; /* Then we parse a sequence number */ mach->sequence_number = frame[++pos]; /* A bit more complicated - find out which MAC address or PAN ID is * presented and store them in correct mach field. As described in * data sheet - if MAC address is presented then PANID has to be presented * too. For more information please refer to 802.15.4 data sheet */ if (MAC_DST_ADDR_PRESENTED(mach->frame_control)) { /* If DST MAC is presented, we should read PAN ID first */ if (memcpy(&mach->dest_panID, frame + (++pos), 2) != &mach->dest_panID) { return MAC_HEADER_RES_ERR; } /* If MAC is presented, then we should determine how long it is */ uint8_t bytesToCopy = 2 * (mach->frame_control.dst_addr_mode == MAC_ADDR_SHORT ) + 8 * (mach->frame_control.dst_addr_mode == MAC_ADDR_LONG ); if (memcpy(&mach->dest_address, frame + (++pos), bytesToCopy) != &mach->dest_address) { return MAC_HEADER_RES_ERR; } } /* The same thing for source address */ if (MAC_SRC_ADDR_PRESENTED(mach->frame_control)) { /* If PANID compression is enabled, then source PAN ID assumed to be * the same as destination PAN ID */ if (mach->frame_control.panID_compression) mach->src_panID = mach->dest_panID; else { if (memcpy(&mach->src_panID, frame + (++pos), 2) != &mach->src_panID) { return MAC_HEADER_RES_ERR; } } uint8_t bytesToCopy = 2 * (mach->frame_control.src_addr_mode == MAC_ADDR_SHORT ) + 8 * (mach->frame_control.src_addr_mode == MAC_ADDR_LONG ); if (memcpy(&mach->src_address, frame + (++pos), bytesToCopy) != &mach->src_address) { return MAC_HEADER_RES_ERR; } } return MAC_HEADER_RES_OK; }
#include <stdarg.h> #include <pthread.h> #include <utils.h> #include <unistd.h> #include "statistic_tracker_impl.h" struct statistic_tracker { hash_map_pt statServices; pthread_rwlock_t statLock; bool running; }; unsigned int threadHash(void * thread) { return *((unsigned int*) thread); } int threadEqual(void* thread1, void* thread2) { return pthread_equal(*((pthread_t*) thread1), *((pthread_t*) thread2)); } static void msg(int lvl, char *fmsg, ...) { if (lvl <= VERBOSE) { char msg[512]; va_list listPointer; va_start(listPointer, fmsg); vsprintf(msg, fmsg, listPointer); printf("[%d] : %s\n", lvl, msg); } } void* statPoller(void* handle) { statistic_tracker_pt statTracker = (statistic_tracker_pt) handle; celix_status_t status = CELIX_SUCCESS; statTracker->running = true; while (statTracker->running && status == CELIX_SUCCESS) { struct stats_provider_service* statService = NULL; char* type = NULL; double statVal = 0.0f; char* mUnit = NULL; char* name = NULL; pthread_rwlock_rdlock(&statTracker->statLock); pthread_t self = pthread_self(); statService = (struct stats_provider_service*) hashMap_get(statTracker->statServices, &self); if (statService != NULL) { statService->getName(statService->statsProvider, &name); statService->getType(statService->statsProvider, &type); statService->getValue(statService->statsProvider, &statVal); statService->getMeasurementUnit(statService->statsProvider, &mUnit); msg(1, "STAT_TRACKER: Statistic for %s (type %s): %f %s ", name, type, statVal, mUnit); } else { status = CELIX_BUNDLE_EXCEPTION; } pthread_rwlock_unlock(&statTracker->statLock); if (mUnit != NULL) { free(mUnit); } if (type != NULL) { free(type); } if (name != NULL) { free(name); } sleep(WAIT_TIME_SECONDS); } return NULL; } celix_status_t statistic_tracker_create(statistic_tracker_pt* statTracker) { celix_status_t status = CELIX_SUCCESS; statistic_tracker_pt lclStatTracker = calloc(1, sizeof(*lclStatTracker)); if (lclStatTracker != NULL) { pthread_rwlockattr_t statLockAttr; lclStatTracker->running = false; pthread_rwlockattr_init(&statLockAttr); pthread_rwlockattr_setkind_np(&statLockAttr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); pthread_rwlock_init(&lclStatTracker->statLock, &statLockAttr); lclStatTracker->statServices = hashMap_create(threadHash, NULL, threadEqual, NULL); (*statTracker) = lclStatTracker; } else { status = CELIX_ENOMEM; } return status; } celix_status_t statistic_tracker_stop(statistic_tracker_pt statTracker) { celix_status_t status = CELIX_SUCCESS; printf("STAT_TRACKER: Stopping StatTracker.\n"); statTracker->running = false; return status; } celix_status_t statistic_tracker_destroy(statistic_tracker_pt statTracker) { celix_status_t status = CELIX_SUCCESS; pthread_rwlock_wrlock(&statTracker->statLock); hashMap_destroy(statTracker->statServices, false, false); pthread_rwlock_unlock(&statTracker->statLock); pthread_rwlock_destroy(&statTracker->statLock); return status; } celix_status_t statistic_tracker_statServiceAdded(void *handle, service_reference_pt reference, void *service) { struct stats_provider_service* statService = (struct stats_provider_service*) service; statistic_tracker_pt statTracker = (statistic_tracker_pt) handle; pthread_t* thread_pt = calloc(1, sizeof(*thread_pt)); char* name = NULL; // check whether we can send/receive if (statService->getName(statService->statsProvider, &name) == 0) { pthread_rwlock_wrlock(&statTracker->statLock); pthread_create(thread_pt, NULL, statPoller, statTracker); hashMap_put(statTracker->statServices, thread_pt, service); pthread_rwlock_unlock(&statTracker->statLock); msg(1, "STAT_TRACKER: Service %s Added (handled by thread %lu)", name, (unsigned long) *thread_pt); free(name); } else { msg(1, "STAT_TRACKER: Could not receive name - Wire set up correctly?"); } return CELIX_SUCCESS; } celix_status_t statistic_tracker_statServiceRemoved(void *handle, service_reference_pt reference, void *service) { celix_status_t status = CELIX_BUNDLE_EXCEPTION; statistic_tracker_pt statTracker = (statistic_tracker_pt) handle; pthread_t* thread_pt = NULL; pthread_rwlock_wrlock(&statTracker->statLock); hash_map_iterator_pt iter = hashMapIterator_create(statTracker->statServices); while (hashMapIterator_hasNext(iter) && thread_pt == NULL) { hash_map_entry_pt entry = hashMapIterator_nextEntry(iter); if (service == hashMapEntry_getValue(entry)) { struct stats_provider_service* statService = (struct stats_provider_service*) service; char* name = NULL; statService->getName(statService->statsProvider, &name); thread_pt = hashMapEntry_getKey(entry); msg(1, "STAT_TRACKER: Service %s Removed. ", name); hashMap_remove(statTracker->statServices, thread_pt); free(name); } } hashMapIterator_destroy(iter); pthread_rwlock_unlock(&statTracker->statLock); if (thread_pt != NULL) { pthread_join(*thread_pt, NULL); msg(1, "STAT_TRACKER: Service Removed. Thread %lu stopped.", (unsigned long) *thread_pt); free(thread_pt); status = CELIX_SUCCESS; } return status; }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % CCCC OOO N N JJJJJ U U RRRR EEEEE % % C O O NN N J U U R R E % % C O O N N N J U U RRRR EEE % % C O O N NN J J U U R R E % % CCCC OOO N N JJJ UUU R R EEEEE % % % % % % Interpret Magick Scripting Language. % % % % Software Design % % Cristy % % December 2001 % % % % % % Copyright 1999-2014 ImageMagick Studio LLC, a non-profit organization % % dedicated to making software imaging solutions freely available. % % % % You may not use this file except in compliance with the License. You may % % obtain a copy of the License at % % % % http://www.imagemagick.org/script/license.php % % % % 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. % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Conjure interprets and executes scripts in the Magick Scripting Language % (MSL). The Magick scripting language (MSL) will primarily benefit those % that want to accomplish custom image processing tasks but do not wish % to program, or those that do not have access to a Perl interpreter or a % compiler. The interpreter is called conjure and here is an example script: % % <?xml version="1.0" encoding="UTF-8"?> % <image size="400x400" > % <read filename="image.gif" /> % <get width="base-width" height="base-height" /> % <resize geometry="%[dimensions]" /> % <get width="width" height="height" /> % <print output="Image sized from %[base-width]x%[base-height] % to %[width]x%[height].\n" /> % <write filename="image.png" /> % </image> % % */ /* Include declarations. */ /* Include declarations. */ #include "wand/studio.h" #include "wand/MagickWand.h" /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % M a i n % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % */ static int ConjureMain(int argc,char **argv) { ExceptionInfo *exception; ImageInfo *image_info; MagickBooleanType status; MagickCoreGenesis(*argv,MagickTrue); exception=AcquireExceptionInfo(); image_info=AcquireImageInfo(); status=MagickCommandGenesis(image_info,ConjureImageCommand,argc,argv, (char **) NULL,exception); image_info=DestroyImageInfo(image_info); exception=DestroyExceptionInfo(exception); MagickCoreTerminus(); return(status != MagickFalse ? 0 : 1); } #if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) int main(int argc,char **argv) { return(ConjureMain(argc,argv)); } #else int wmain(int argc,wchar_t *argv[]) { char **utf8; int status; register int i; utf8=NTArgvToUTF8(argc,argv); status=ConjureMain(argc,utf8); for (i=0; i < argc; i++) utf8[i]=DestroyString(utf8[i]); utf8=(char **) RelinquishMagickMemory(utf8); return(status); } #endif
/* * Copyright (c) 2015 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #ifndef __FIREHOSE_INTERNAL__ #define __FIREHOSE_INTERNAL__ #if OS_FIREHOSE_SPI // make sure this is defined so that we get MIG_SERVER_DIED when a send once // notification is sent back because of a crashed server #ifndef __MigTypeCheck #define __MigTypeCheck 1 #endif #include <limits.h> #include <machine/endian.h> #include <mach/mach_types.h> #include <mach/std_types.h> #include <os/object.h> #include <firehose/private.h> #include <mach/mach_types.h> #include <mach/std_types.h> #include <sys/qos.h> #include "os/firehose_server_private.h" #include "firehose_buffer_internal.h" #ifdef FIREHOSE_SERVER #include "firehose_server_internal.h" #endif #include "firehose_inline_internal.h" #endif // OS_FIREHOSE_SPI #endif // __FIREHOSE_INTERNAL__
#pragma once // small helper for getting texture from CMSampleBuffer typedef struct CMVideoSampling { void* cvTextureCache; void* cvTextureCacheTexture; void* cvImageBuffer; } CMVideoSampling; void CMVideoSampling_Initialize(CMVideoSampling* sampling); void CMVideoSampling_Uninitialize(CMVideoSampling* sampling); intptr_t CMVideoSampling_ImageBuffer(CMVideoSampling* sampling, CVImageBufferRef buffer, size_t* w, size_t* h); intptr_t CMVideoSampling_SampleBuffer(CMVideoSampling* sampling, void* buffer, size_t* w, size_t* h); // buffer is CMSampleBufferRef intptr_t CMVideoSampling_LastSampledTexture(CMVideoSampling* sampling);
/***************************************************************************** * Copyright (C) 2014 Visualink * * Authors: Adrien Maglo <adrien@visualink.io> * * This file is part of Pastec. * * Pastec is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Pastec 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 Pastec. If not, see <http://www.gnu.org/licenses/>. *****************************************************************************/ #ifndef PASTEC_HIT_H #define PASTEC_HIT_H #include <sys/types.h> struct Hit { u_int32_t i_imageId; u_int16_t i_angle; u_int16_t x; u_int16_t y; }; struct HitForward { u_int32_t i_wordId; const char * str_imageId; u_int16_t i_angle; u_int16_t i_distance; float x; float y; }; #endif // PASTEC_HIT_H
/* * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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. */ #pragma once #include <aws/snowball/Snowball_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> namespace Aws { namespace Utils { namespace Json { class JsonValue; } // namespace Json } // namespace Utils namespace Snowball { namespace Model { /** * <p>Contains a key range. For export jobs, a <code>S3Resource</code> object can * have an optional <code>KeyRange</code> value. The length of the range is defined * at job creation, and has either an inclusive <code>BeginMarker</code>, an * inclusive <code>EndMarker</code>, or both. Ranges are UTF-8 binary sorted.</p> */ class AWS_SNOWBALL_API KeyRange { public: KeyRange(); KeyRange(const Aws::Utils::Json::JsonValue& jsonValue); KeyRange& operator=(const Aws::Utils::Json::JsonValue& jsonValue); Aws::Utils::Json::JsonValue Jsonize() const; /** * <p>The key that starts an optional key range for an export job. Ranges are * inclusive and UTF-8 binary sorted.</p> */ inline const Aws::String& GetBeginMarker() const{ return m_beginMarker; } /** * <p>The key that starts an optional key range for an export job. Ranges are * inclusive and UTF-8 binary sorted.</p> */ inline void SetBeginMarker(const Aws::String& value) { m_beginMarkerHasBeenSet = true; m_beginMarker = value; } /** * <p>The key that starts an optional key range for an export job. Ranges are * inclusive and UTF-8 binary sorted.</p> */ inline void SetBeginMarker(Aws::String&& value) { m_beginMarkerHasBeenSet = true; m_beginMarker = value; } /** * <p>The key that starts an optional key range for an export job. Ranges are * inclusive and UTF-8 binary sorted.</p> */ inline void SetBeginMarker(const char* value) { m_beginMarkerHasBeenSet = true; m_beginMarker.assign(value); } /** * <p>The key that starts an optional key range for an export job. Ranges are * inclusive and UTF-8 binary sorted.</p> */ inline KeyRange& WithBeginMarker(const Aws::String& value) { SetBeginMarker(value); return *this;} /** * <p>The key that starts an optional key range for an export job. Ranges are * inclusive and UTF-8 binary sorted.</p> */ inline KeyRange& WithBeginMarker(Aws::String&& value) { SetBeginMarker(value); return *this;} /** * <p>The key that starts an optional key range for an export job. Ranges are * inclusive and UTF-8 binary sorted.</p> */ inline KeyRange& WithBeginMarker(const char* value) { SetBeginMarker(value); return *this;} /** * <p>The key that ends an optional key range for an export job. Ranges are * inclusive and UTF-8 binary sorted.</p> */ inline const Aws::String& GetEndMarker() const{ return m_endMarker; } /** * <p>The key that ends an optional key range for an export job. Ranges are * inclusive and UTF-8 binary sorted.</p> */ inline void SetEndMarker(const Aws::String& value) { m_endMarkerHasBeenSet = true; m_endMarker = value; } /** * <p>The key that ends an optional key range for an export job. Ranges are * inclusive and UTF-8 binary sorted.</p> */ inline void SetEndMarker(Aws::String&& value) { m_endMarkerHasBeenSet = true; m_endMarker = value; } /** * <p>The key that ends an optional key range for an export job. Ranges are * inclusive and UTF-8 binary sorted.</p> */ inline void SetEndMarker(const char* value) { m_endMarkerHasBeenSet = true; m_endMarker.assign(value); } /** * <p>The key that ends an optional key range for an export job. Ranges are * inclusive and UTF-8 binary sorted.</p> */ inline KeyRange& WithEndMarker(const Aws::String& value) { SetEndMarker(value); return *this;} /** * <p>The key that ends an optional key range for an export job. Ranges are * inclusive and UTF-8 binary sorted.</p> */ inline KeyRange& WithEndMarker(Aws::String&& value) { SetEndMarker(value); return *this;} /** * <p>The key that ends an optional key range for an export job. Ranges are * inclusive and UTF-8 binary sorted.</p> */ inline KeyRange& WithEndMarker(const char* value) { SetEndMarker(value); return *this;} private: Aws::String m_beginMarker; bool m_beginMarkerHasBeenSet; Aws::String m_endMarker; bool m_endMarkerHasBeenSet; }; } // namespace Model } // namespace Snowball } // namespace Aws
// // AppDelegate+memory.h // // Created by Ed Parsons on 09/29/15. // // #import "AppDelegate.h" @interface AppDelegate (memory) - (void)applicationDidReceiveMemoryWarning:(UIApplication*)application; @end
/* * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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. */ #pragma once #include <aws/inspector/Inspector_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <utility> namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace Inspector { namespace Model { /** * <p>Used in the exception error that is thrown if you start an assessment run for * an assessment target that includes an EC2 instance that is already participating * in another started assessment run.</p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/AgentAlreadyRunningAssessment">AWS * API Reference</a></p> */ class AWS_INSPECTOR_API AgentAlreadyRunningAssessment { public: AgentAlreadyRunningAssessment(); AgentAlreadyRunningAssessment(Aws::Utils::Json::JsonView jsonValue); AgentAlreadyRunningAssessment& operator=(Aws::Utils::Json::JsonView jsonValue); Aws::Utils::Json::JsonValue Jsonize() const; /** * <p>ID of the agent that is running on an EC2 instance that is already * participating in another started assessment run.</p> */ inline const Aws::String& GetAgentId() const{ return m_agentId; } /** * <p>ID of the agent that is running on an EC2 instance that is already * participating in another started assessment run.</p> */ inline void SetAgentId(const Aws::String& value) { m_agentIdHasBeenSet = true; m_agentId = value; } /** * <p>ID of the agent that is running on an EC2 instance that is already * participating in another started assessment run.</p> */ inline void SetAgentId(Aws::String&& value) { m_agentIdHasBeenSet = true; m_agentId = std::move(value); } /** * <p>ID of the agent that is running on an EC2 instance that is already * participating in another started assessment run.</p> */ inline void SetAgentId(const char* value) { m_agentIdHasBeenSet = true; m_agentId.assign(value); } /** * <p>ID of the agent that is running on an EC2 instance that is already * participating in another started assessment run.</p> */ inline AgentAlreadyRunningAssessment& WithAgentId(const Aws::String& value) { SetAgentId(value); return *this;} /** * <p>ID of the agent that is running on an EC2 instance that is already * participating in another started assessment run.</p> */ inline AgentAlreadyRunningAssessment& WithAgentId(Aws::String&& value) { SetAgentId(std::move(value)); return *this;} /** * <p>ID of the agent that is running on an EC2 instance that is already * participating in another started assessment run.</p> */ inline AgentAlreadyRunningAssessment& WithAgentId(const char* value) { SetAgentId(value); return *this;} /** * <p>The ARN of the assessment run that has already been started.</p> */ inline const Aws::String& GetAssessmentRunArn() const{ return m_assessmentRunArn; } /** * <p>The ARN of the assessment run that has already been started.</p> */ inline void SetAssessmentRunArn(const Aws::String& value) { m_assessmentRunArnHasBeenSet = true; m_assessmentRunArn = value; } /** * <p>The ARN of the assessment run that has already been started.</p> */ inline void SetAssessmentRunArn(Aws::String&& value) { m_assessmentRunArnHasBeenSet = true; m_assessmentRunArn = std::move(value); } /** * <p>The ARN of the assessment run that has already been started.</p> */ inline void SetAssessmentRunArn(const char* value) { m_assessmentRunArnHasBeenSet = true; m_assessmentRunArn.assign(value); } /** * <p>The ARN of the assessment run that has already been started.</p> */ inline AgentAlreadyRunningAssessment& WithAssessmentRunArn(const Aws::String& value) { SetAssessmentRunArn(value); return *this;} /** * <p>The ARN of the assessment run that has already been started.</p> */ inline AgentAlreadyRunningAssessment& WithAssessmentRunArn(Aws::String&& value) { SetAssessmentRunArn(std::move(value)); return *this;} /** * <p>The ARN of the assessment run that has already been started.</p> */ inline AgentAlreadyRunningAssessment& WithAssessmentRunArn(const char* value) { SetAssessmentRunArn(value); return *this;} private: Aws::String m_agentId; bool m_agentIdHasBeenSet; Aws::String m_assessmentRunArn; bool m_assessmentRunArnHasBeenSet; }; } // namespace Model } // namespace Inspector } // namespace Aws
// // LHHRacArticleCellViewModel.h // WYPlatformoc // // Created by seaphy on 16/9/12. // Copyright © 2016年 seaphy. All rights reserved. // #import "LHHRacBaseViewModel.h" #import "LHHRacArticleModel.h" // cell的vm // 无需网络请求,所以继承BaseViewModel即可 @interface LHHRacArticleCellViewModel : LHHRacBaseViewModel @property (nonatomic, strong) LHHRacArticleModel *articleModel; @property (nonatomic, copy, readonly) NSString *titleText; @property (nonatomic, copy, readonly) NSString *authorText; @property (nonatomic, copy, readonly) NSString *categoryText; - (id)initWithArticleModel:(LHHRacArticleModel *)articleModel; @end
// Minecart.h // Declares the cMinecart class representing a minecart in the world #pragma once #include "Entity.h" #include "World.h" #include "../UI/WindowOwner.h" class cMinecart : public cEntity { typedef cEntity super; public: CLASS_PROTODEF(cMinecart) /** Minecart payload, values correspond to packet subtype */ enum ePayload { mpNone = 0, // Empty minecart, ridable by player or mobs mpChest = 1, // Minecart-with-chest, can store a grid of 3 * 8 items mpFurnace = 2, // Minecart-with-furnace, can be powered mpTNT = 3, // Minecart-with-TNT, can be blown up with activator rail mpHopper = 5, // Minecart-with-hopper, can be hopper // TODO: Spawner minecarts, (and possibly any block in a minecart with NBT editing) } ; // cEntity overrides: virtual void SpawnOn(cClientHandle & a_ClientHandle) override; virtual void HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; virtual bool DoTakeDamage(TakeDamageInfo & TDI) override; virtual void Destroyed() override; int LastDamage(void) const { return m_LastDamage; } ePayload GetPayload(void) const { return m_Payload; } protected: ePayload m_Payload; int m_LastDamage; Vector3i m_DetectorRailPosition; bool m_bIsOnDetectorRail; cMinecart(ePayload a_Payload, double a_X, double a_Y, double a_Z); /** Handles physics on normal rails For each tick, slow down on flat rails, speed up or slow down on ascending / descending rails (depending on direction), and turn on curved rails. */ void HandleRailPhysics(NIBBLETYPE a_RailMeta, std::chrono::milliseconds a_Dt); /** Handles powered rail physics Each tick, speed up or slow down cart, depending on metadata of rail (powered or not) */ void HandlePoweredRailPhysics(NIBBLETYPE a_RailMeta); /** Handles detector rail activation Activates detector rails when a minecart is on them. Calls HandleRailPhysics() for physics simulations */ void HandleDetectorRailPhysics(NIBBLETYPE a_RailMeta, std::chrono::milliseconds a_Dt); /** Handles activator rails - placeholder for future implementation */ void HandleActivatorRailPhysics(NIBBLETYPE a_RailMeta, std::chrono::milliseconds a_Dt); /** Snaps a mincecart to a rail's axis, resetting its speed For curved rails, it changes the cart's direction as well as snapping it to axis */ void SnapToRail(NIBBLETYPE a_RailMeta); /** Tests if a solid block is in front of a cart, and stops the cart (and returns true) if so; returns false if no obstruction */ bool TestBlockCollision(NIBBLETYPE a_RailMeta); /** Tests if this mincecart's bounding box is intersecting another entity's bounding box (collision) and pushes mincecart away if necessary */ bool TestEntityCollision(NIBBLETYPE a_RailMeta); } ; class cRideableMinecart : public cMinecart { typedef cMinecart super; public: CLASS_PROTODEF(cRideableMinecart) cRideableMinecart(double a_X, double a_Y, double a_Z, const cItem & a_Content, int a_Height); const cItem & GetContent(void) const {return m_Content;} int GetBlockHeight(void) const {return m_Height;} // cEntity overrides: virtual void OnRightClicked(cPlayer & a_Player) override; protected: cItem m_Content; int m_Height; } ; class cMinecartWithChest : public cMinecart, public cItemGrid::cListener, public cEntityWindowOwner { typedef cMinecart super; public: CLASS_PROTODEF(cMinecartWithChest) cMinecartWithChest(double a_X, double a_Y, double a_Z); enum { ContentsHeight = 3, ContentsWidth = 9, }; const cItem & GetSlot(int a_Idx) const { return m_Contents.GetSlot(a_Idx); } void SetSlot(int a_Idx, const cItem & a_Item) { m_Contents.SetSlot(a_Idx, a_Item); } protected: cItemGrid m_Contents; void OpenNewWindow(void); virtual void Destroyed() override; // cItemGrid::cListener overrides: virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum) override { UNUSED(a_SlotNum); ASSERT(a_Grid == &m_Contents); if (m_World != nullptr) { if (GetWindow() != nullptr) { GetWindow()->BroadcastWholeWindow(); } m_World->MarkChunkDirty(GetChunkX(), GetChunkZ()); } } // cEntity overrides: virtual void OnRightClicked(cPlayer & a_Player) override; } ; class cMinecartWithFurnace : public cMinecart { typedef cMinecart super; public: CLASS_PROTODEF(cMinecartWithFurnace) cMinecartWithFurnace(double a_X, double a_Y, double a_Z); // cEntity overrides: virtual void OnRightClicked(cPlayer & a_Player) override; virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; // Set functions. void SetIsFueled(bool a_IsFueled, int a_FueledTimeLeft = -1) {m_IsFueled = a_IsFueled; m_FueledTimeLeft = a_FueledTimeLeft;} // Get functions. int GetFueledTimeLeft(void) const {return m_FueledTimeLeft; } bool IsFueled (void) const {return m_IsFueled;} private: int m_FueledTimeLeft; bool m_IsFueled; } ; class cMinecartWithTNT : public cMinecart { typedef cMinecart super; public: CLASS_PROTODEF(cMinecartWithTNT) cMinecartWithTNT(double a_X, double a_Y, double a_Z); } ; class cMinecartWithHopper : public cMinecart { typedef cMinecart super; public: CLASS_PROTODEF(cMinecartWithHopper) cMinecartWithHopper(double a_X, double a_Y, double a_Z); } ;
#ifndef BABYLON_MATERIALS_NODE_BLOCKS_LERP_BLOCK_H #define BABYLON_MATERIALS_NODE_BLOCKS_LERP_BLOCK_H #include <babylon/babylon_api.h> #include <babylon/materials/node/node_material_block.h> namespace BABYLON { class LerpBlock; using LerpBlockPtr = std::shared_ptr<LerpBlock>; /** * @brief Block used to lerp between 2 values. */ class BABYLON_SHARED_EXPORT LerpBlock : public NodeMaterialBlock { public: template <typename... Ts> static LerpBlockPtr New(Ts&&... args) { return std::shared_ptr<LerpBlock>(new LerpBlock(std::forward<Ts>(args)...)); } ~LerpBlock() override; /** * @brief Gets the current class name. * @returns the class name */ std::string getClassName() const override; protected: /** * @brief Creates a new LerpBlock. * @param name defines the block name */ LerpBlock(const std::string& name); /** * @brief Gets the left operand input component. */ NodeMaterialConnectionPointPtr& get_left(); /** * @brief Gets the right operand input component. */ NodeMaterialConnectionPointPtr& get_right(); /** * @brief Gets the right operand input component. */ NodeMaterialConnectionPointPtr& get_gradient(); /** * @brief Gets the output component. */ NodeMaterialConnectionPointPtr& get_output(); /** * @brief Hidden */ LerpBlock& _buildBlock(NodeMaterialBuildState& state) override; public: /** * Gets the left operand input component */ ReadOnlyProperty<LerpBlock, NodeMaterialConnectionPointPtr> left; /** * Gets the right operand input component */ ReadOnlyProperty<LerpBlock, NodeMaterialConnectionPointPtr> right; /** * Gets the gradient operand input component */ ReadOnlyProperty<LerpBlock, NodeMaterialConnectionPointPtr> gradient; /** * Gets the output component */ ReadOnlyProperty<LerpBlock, NodeMaterialConnectionPointPtr> output; }; // end of class LerpBlock } // end of namespace BABYLON #endif // end of BABYLON_MATERIALS_NODE_BLOCKS_LERP_BLOCK_H
// // NSArray+FSIExtensions.h // // Copyright (c) 2013 Tom Baranes // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import <Foundation/Foundation.h> /** A delightful NSArray category */ @interface NSArray (FSIExtensions) /** Extract all numbers found in a NSString @param string the string to parse @returns array whith all numbers found */ + (NSArray *)extractNumbersFromString:(NSString *)string; - (NSArray *)arrayByRemovingObject:(id)object; - (NSArray *)arrayByInsertingObject:(id)object atIndex:(NSInteger)idx; - (NSArray *)arrayByAddingObject:(id)object; - (NSArray *)arrayByRemovingObjectAtIndex:(NSInteger)idx; - (NSArray *)arrayByReplacingObjectAtIndex:(NSInteger)idx withObject:(id)object; - (NSArray *)arrayByMovingObjectAtIndex:(NSInteger)atIndex toIndex:(NSInteger)toIndex; @end
/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // // MainViewController.h // Solareff // // Created by ___FULLUSERNAME___ on ___DATE___. // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. // #import <Cordova/CDVViewController.h> #import <Cordova/CDVCommandDelegateImpl.h> #import <Cordova/CDVCommandQueue.h> @interface MainViewController : CDVViewController @end @interface MainCommandDelegate : CDVCommandDelegateImpl @end @interface MainCommandQueue : CDVCommandQueue @end
// Copyright 2015 Heidelberg University Copyright and related rights are // licensed under the Solderpad Hardware License, Version 0.51 (the "License"); // you may not use this file except in compliance with the License. You may obtain // a copy of the License at http://solderpad.org/licenses/SHL-0.51. Unless // required by applicable law or agreed to in writing, software, hardware and // materials distributed under this 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. // enable inhibition after 1 ms if( (cur_t - t_start) > 400*MS ) { dest_row[8] = NO_FORWARD; dest_row[9] = NO_FORWARD; dest_row[10] = NO_FORWARD; }
// Copyright (c) 2015-present, Qihoo, Inc. All rights reserved. // This source code is licensed under the BSD-style license found in the // LICENSE file in the root directory of this source tree. An additional grant // of patent rights can be found in the PATENTS file in the same directory. /* * Copyright (c) 2009-2012, Salvatore Sanfilippo <antirez at gmail dot com> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Redis nor the names of its contributors may be used * to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef __SLASH_STRING_H #define __SLASH_STRING_H #include <string> #include <vector> namespace slash { int stringmatchlen(const char *p, int plen, const char *s, int slen, int nocase); int stringmatch(const char *p, const char *s, int nocase); long long memtoll(const char *p, int *err); int ll2string(char *s, size_t len, long long value); int string2ll(const char *s, size_t slen, long long *value); int string2l(const char *s, size_t slen, long *value); int d2string(char *buf, size_t len, double value); int string2d(const char *buf, size_t len, double *value); std::vector<std::string> &StringSplit(const std::string &s, char delim, std::vector<std::string> &elems); std::string StringConcat(const std::vector<std::string> &elems, char delim); std::string& StringToLower(std::string& ori); std::string IpPortString(const std::string& ip, int port); std::string ToRead(const std::string& str); bool ParseIpPortString(const std::string& ip_port, std::string& ip, int &port); std::string StringTrim(const std::string& ori, const std::string& charlist = " "); } // namespace slash #endif // __SLASH_STRING_H
#pragma once #include <QThread> #include <qmutex.h> #include "XData.h" #include <list> class XDataThread:public QThread { public: //(»º³åÁбí´óС)Áбí×î´óÖµ£¬³¬³öɾ³ý×î¾ÉµÄÊý¾Ý int maxList = 100; //ÔÚÁбí½áβ²åÈë virtual void Push(XData d); //¶ÁÈ¡ÁбíÖÐ×îÔçµÄÊý¾Ý,·µ»ØµÄÊý¾ÝÐèÒªµ÷ÓÃXData.DropÇåÀí virtual XData Pop(); //Æô¶¯Ïß³Ì virtual bool Start(); //Í˳öỊ̈߳¬²¢µÈ´ýÏß³ÌÍ˳ö(×èÈûµÄº¯Êý) virtual void Stop(); virtual void Clear(); XDataThread(); virtual ~XDataThread(); protected: //´æ·Å½»»¥Êý¾Ý;Êý¾Ý²åÈë²ßÂÔ£ºÏȽøÏȳö std::list<XData> datas; //½»»¥Êý¾ÝÁбí´óС int dataCount = 0; //»¥³â·ÃÎÊdatas QMutex mutex; //´¦ÀíÏß³ÌÍ˳ö bool isExit = false; };
/* vim: set sw=8 ts=8 sts=8 noexpandtab: */ #ifndef EWL_VIEW_H #define EWL_VIEW_H /** * @addtogroup Ewl_View Ewl_View: A data view * @brief Defines the callbacks for setting up the widgets based on the data * returned from the Model. Create widgets, set data on widgets, calculate * sizing, minimize number of widgets. * * @{ */ /** * @def EWL_VIEW_WIDGET_FETCH(f) * View callback for the constructor for a data row */ #define EWL_VIEW_WIDGET_FETCH(f) ((Ewl_View_Widget_Fetch)f) /** * A typedef to shorten the definition of the view_widget_fetch callbacks. */ typedef Ewl_Widget *(*Ewl_View_Widget_Fetch)(void *data, unsigned int row, unsigned int col); /** * @def EWL_VIEW_HEADER_GET(f) * View callback to get the header for a given column */ #define EWL_VIEW_HEADER_GET(f) ((Ewl_View_Header_Fetch)f) /** * A typedef to shorten the definition of the view_header_fetch callbacks. */ typedef Ewl_Widget *(*Ewl_View_Header_Fetch)(void *data, unsigned int column); /** * @def EWL_VIEW(view) * Typecasts a pointer to an Ewl_View pointer. */ #define EWL_VIEW(view) ((Ewl_View *)view) /** * The Ewl_View type */ typedef struct Ewl_View Ewl_View; /** * @def EWL_VIEW_EXPANSION_VIEW_FETCH_GET(f) * View callback to get a view for expanded data on a row */ #define EWL_VIEW_EXPANSION_VIEW_FETCH_GET(f) ((Ewl_View_Expansion_View_Fetch)f) /** * A typedef to shorten the definition of the view_expansion_view_fetch * callbacks. */ typedef Ewl_View *(*Ewl_View_Expansion_View_Fetch)(void *data, unsigned int row); /** * @brief The view function pointers */ struct Ewl_View { Ewl_View_Widget_Fetch fetch; /**< Get a new widget for display */ Ewl_View_Header_Fetch header_fetch; /**< Get the header for the given column */ Ewl_View_Expansion_View_Fetch expansion; /**< Get a view for displaying expansion data */ }; Ewl_View *ewl_view_new(void); int ewl_view_init(Ewl_View *view); Ewl_View *ewl_view_clone(Ewl_View *src); void ewl_view_widget_fetch_set(Ewl_View *view, Ewl_View_Widget_Fetch construct); Ewl_View_Widget_Fetch ewl_view_widget_fetch_get(Ewl_View *view); void ewl_view_header_fetch_set(Ewl_View *v, Ewl_View_Header_Fetch f); Ewl_View_Header_Fetch ewl_view_header_fetch_get(Ewl_View *v); void ewl_view_expansion_view_fetch_set(Ewl_View *v, Ewl_View_Expansion_View_Fetch f); Ewl_View_Expansion_View_Fetch ewl_view_expansion_view_fetch_get(Ewl_View *v); /** * @} */ #endif
// // CCTweetMedia.h // TweetRoll // // Created by Cameron Cooke on 21/03/2015. // Copyright (c) 2015 Cameron Cooke. All rights reserved. // #import <Foundation/Foundation.h> @interface CCTweetMedia : NSObject @property (strong, nonatomic) NSString *url; @end
/* * Logwarn - Utility for finding interesting messages in log files * * Copyright (C) 2010-2011 Archie L. Cobbs. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Maximum line length #define MAX_LINE_LENGTH 100000 // Pattern repeat state struct repeat { unsigned int hash; // xor of hashes of pattern string(s) unsigned int num; // number required in interval unsigned int secs; // interval duration in seconds unsigned long *occurrences; // timestamps of up to `num' occurrences, most recent first }; // Log scan state struct scan_state { ino_t inode; // file inode number unsigned long line; // # lines read + 1 long pos; // seek position in file unsigned char matching; // within matching entry unsigned int num_repeats; // number of repeats struct repeat *repeats; // repeat state }; // Exit values #define EXIT_OK 0 #define EXIT_MATCHES 1 #define EXIT_ERROR 2 // Global variables extern const char *const logwarn_version; // Global functions extern void reset_state(struct scan_state *state); extern int load_state(const char *state_file, struct scan_state *state); extern void save_state(const char *state_file, const char *logfile, const struct scan_state *state); extern void dump_state(FILE *fp, const char *logfile, const struct scan_state *state); extern void init_state_from_logfile(const char *logfile, struct scan_state *state); extern void state_file_name(const char *state_dir, const char *logfile, char *buf, size_t max); extern struct repeat *find_repeat(struct scan_state *state, unsigned int hash);
/* * Copyright 2014 Nippon Telegraph and Telephone Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @file ofp_table_handler.h */ #ifndef __OFP_TABLE_HANDLER_H__ #define __OFP_TABLE_HANDLER_H__ #include "ofp_common.h" #include "channel.h" #include "lagopus/ofp_handler.h" /** * ofp_table_stats_request handler. * * @param[in] channel A pointer to \e channel structure. * @param[in] pbuf A pointer to \e pbuf structure. * @param[in] xid_header A pointer to \e ofp_header structure in request. * @param[out] error A pointer to \e ofp_error structure. * If errors occur, set filed values. * * @retval LAGOPUS_RESULT_OK Succeeded. * @retval LAGOPUS_RESULT_OFP_ERROR Failed, ofp_error. * @retval LAGOPUS_RESULT_ANY_FAILURES Failed. */ lagopus_result_t ofp_table_stats_request_handle(struct channel *channel, struct pbuf *pbuf, struct ofp_header *xid_header, struct ofp_error *error); /** * Free table_stats_list elements. * * @param[in] table_stats_list A pointer to list of * \e table_stats structure. * * @retval void */ void table_stats_list_elem_free(struct table_stats_list *table_stats_list); #ifdef __UNIT_TESTING__ /** * Create ofp_table_stats_reply. * * @param[in] channel A pointer to \e channel structure. * @param[out] pbuf_list A pointer to list of \e pbuf structures. * @param[in] table_stats_list A pointer to list of * \e table_stats structure. * @param[in] xid_header A pointer to \e ofp_header structure. * * @retval LAGOPUS_RESULT_OK Succeeded. * @retval LAGOPUS_RESULT_ANY_FAILURES Failed. */ lagopus_result_t ofp_table_stats_reply_create(struct channel *channel, struct pbuf_list **pbuf_list, struct table_stats_list *table_stats_list, struct ofp_header *xid_header); #endif /* __UNIT_TESTING__ */ #endif /* __OFP_TABLE_HANDLER_H__ */
// // MYTool.h // 魔颜 // // Created by 杨锐 on 15/10/29. // Copyright © 2015年 abc. All rights reserved. // #import <Foundation/Foundation.h> @class doctorListModel; @interface MYDoctorListTool : NSObject //返回请求的医生列表数据 +(NSMutableArray *)doctorLists; //保存请求的医生列表 +(void)saveDoctorList:(doctorListModel *)doctorListModel; + (void)deleteDoctorList:(doctorListModel *)doctorListModel; + (void)deleteDoctorLists:(NSArray *)doctorLists; @end
// // TYDPError.h // myShopping // // Created by Wangye on 16/6/30. // Copyright © 2016年 泰洋冻品. All rights reserved. // #import <Foundation/Foundation.h> /** * @brief 接口返回码 */ typedef int TYDPReturnCode; /** * @brief 返回成功 */ extern TYDPReturnCode const KODReturnSuccess; /** * @brief 返回失败 */ extern TYDPReturnCode const KODReturnFailure; @interface TYDPError : NSObject -(instancetype)initWithErrorCode:(TYDPReturnCode)code errorMsg:(NSString *)msg; +(instancetype)errorWithErrorCode:(TYDPReturnCode)code errorMsg:(NSString *)msg; @property (assign, nonatomic) TYDPReturnCode code; @property (copy, nonatomic) NSString *msg; @end
/** * Profile APSHTTPClient Library * Copyright (c) 2009-2015 by Appcelerator, Inc. All Rights Reserved. * Licensed under the terms of the Apache Public License * Please see the LICENSE included with this distribution for details. * * WARNING: This is generated code. Modify at your own risk and without support. */ #import <Foundation/Foundation.h> @interface APSHTTPPostForm : NSObject @property(nonatomic, readonly) NSData *requestData; @property(nonatomic, readonly) NSDictionary *requestHeaders; @property(nonatomic, readonly) NSString *contentType; -(void)setJSONData:(id)json; -(void)setStringData:(NSString*)str; -(void)appendData:(NSData*)data withContentType:(NSString*)contentType; -(void)addDictionay:(NSDictionary*)dict; -(void)addFormKey:(NSString*)key andValue:(NSString*)value; -(void)addFormFile:(NSString*)path; -(void)addFormFile:(NSString*)path fieldName:(NSString*)name; -(void)addFormFile:(NSString*)path fieldName:(NSString*)name contentType:(NSString*)contentType; -(void)addFormData:(NSData*)data; -(void)addFormData:(NSData*)data fileName:(NSString*)fileName; -(void)addFormData:(NSData*)data fileName:(NSString*)fileName fieldName:(NSString*)fieldName; -(void)addFormData:(NSData*)data fileName:(NSString*)fileName fieldName:(NSString*)fieldName contentType:(NSString*)contentType; -(void)addHeaderKey:(NSString*)key andHeaderValue:(NSString*)value; @end
/* This file was generated by upbc (the upb compiler) from the input * file: * * google/api/expr/v1alpha1/eval.proto * * Do not edit -- your changes will be discarded when the file is * regenerated. */ #include "upb/def.h" #include "google/api/expr/v1alpha1/eval.upbdefs.h" #include "google/api/expr/v1alpha1/eval.upb.h" extern upb_def_init google_api_expr_v1alpha1_value_proto_upbdefinit; extern upb_def_init google_rpc_status_proto_upbdefinit; static const char descriptor[738] = {'\n', '#', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'a', 'p', 'i', '/', 'e', 'x', 'p', 'r', '/', 'v', '1', 'a', 'l', 'p', 'h', 'a', '1', '/', 'e', 'v', 'a', 'l', '.', 'p', 'r', 'o', 't', 'o', '\022', '\030', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'a', 'p', 'i', '.', 'e', 'x', 'p', 'r', '.', 'v', '1', 'a', 'l', 'p', 'h', 'a', '1', '\032', '$', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'a', 'p', 'i', '/', 'e', 'x', 'p', 'r', '/', 'v', '1', 'a', 'l', 'p', 'h', 'a', '1', '/', 'v', 'a', 'l', 'u', 'e', '.', 'p', 'r', 'o', 't', 'o', '\032', '\027', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'r', 'p', 'c', '/', 's', 't', 'a', 't', 'u', 's', '.', 'p', 'r', 'o', 't', 'o', '\"', '\302', '\001', '\n', '\t', 'E', 'v', 'a', 'l', 'S', 't', 'a', 't', 'e', '\022', ';', '\n', '\006', 'v', 'a', 'l', 'u', 'e', 's', '\030', '\001', ' ', '\003', '(', '\013', '2', '#', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'a', 'p', 'i', '.', 'e', 'x', 'p', 'r', '.', 'v', '1', 'a', 'l', 'p', 'h', 'a', '1', '.', 'E', 'x', 'p', 'r', 'V', 'a', 'l', 'u', 'e', 'R', '\006', 'v', 'a', 'l', 'u', 'e', 's', '\022', 'D', '\n', '\007', 'r', 'e', 's', 'u', 'l', 't', 's', '\030', '\003', ' ', '\003', '(', '\013', '2', '*', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'a', 'p', 'i', '.', 'e', 'x', 'p', 'r', '.', 'v', '1', 'a', 'l', 'p', 'h', 'a', '1', '.', 'E', 'v', 'a', 'l', 'S', 't', 'a', 't', 'e', '.', 'R', 'e', 's', 'u', 'l', 't', 'R', '\007', 'r', 'e', 's', 'u', 'l', 't', 's', '\032', '2', '\n', '\006', 'R', 'e', 's', 'u', 'l', 't', '\022', '\022', '\n', '\004', 'e', 'x', 'p', 'r', '\030', '\001', ' ', '\001', '(', '\003', 'R', '\004', 'e', 'x', 'p', 'r', '\022', '\024', '\n', '\005', 'v', 'a', 'l', 'u', 'e', '\030', '\002', ' ', '\001', '(', '\003', 'R', '\005', 'v', 'a', 'l', 'u', 'e', '\"', '\312', '\001', '\n', '\t', 'E', 'x', 'p', 'r', 'V', 'a', 'l', 'u', 'e', '\022', '7', '\n', '\005', 'v', 'a', 'l', 'u', 'e', '\030', '\001', ' ', '\001', '(', '\013', '2', '\037', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'a', 'p', 'i', '.', 'e', 'x', 'p', 'r', '.', 'v', '1', 'a', 'l', 'p', 'h', 'a', '1', '.', 'V', 'a', 'l', 'u', 'e', 'H', '\000', 'R', '\005', 'v', 'a', 'l', 'u', 'e', '\022', ':', '\n', '\005', 'e', 'r', 'r', 'o', 'r', '\030', '\002', ' ', '\001', '(', '\013', '2', '\"', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'a', 'p', 'i', '.', 'e', 'x', 'p', 'r', '.', 'v', '1', 'a', 'l', 'p', 'h', 'a', '1', '.', 'E', 'r', 'r', 'o', 'r', 'S', 'e', 't', 'H', '\000', 'R', '\005', 'e', 'r', 'r', 'o', 'r', '\022', '@', '\n', '\007', 'u', 'n', 'k', 'n', 'o', 'w', 'n', '\030', '\003', ' ', '\001', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'a', 'p', 'i', '.', 'e', 'x', 'p', 'r', '.', 'v', '1', 'a', 'l', 'p', 'h', 'a', '1', '.', 'U', 'n', 'k', 'n', 'o', 'w', 'n', 'S', 'e', 't', 'H', '\000', 'R', '\007', 'u', 'n', 'k', 'n', 'o', 'w', 'n', 'B', '\006', '\n', '\004', 'k', 'i', 'n', 'd', '\"', '6', '\n', '\010', 'E', 'r', 'r', 'o', 'r', 'S', 'e', 't', '\022', '*', '\n', '\006', 'e', 'r', 'r', 'o', 'r', 's', '\030', '\001', ' ', '\003', '(', '\013', '2', '\022', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'r', 'p', 'c', '.', 'S', 't', 'a', 't', 'u', 's', 'R', '\006', 'e', 'r', 'r', 'o', 'r', 's', '\"', '\"', '\n', '\n', 'U', 'n', 'k', 'n', 'o', 'w', 'n', 'S', 'e', 't', '\022', '\024', '\n', '\005', 'e', 'x', 'p', 'r', 's', '\030', '\001', ' ', '\003', '(', '\003', 'R', '\005', 'e', 'x', 'p', 'r', 's', 'B', 'l', '\n', '\034', 'c', 'o', 'm', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'a', 'p', 'i', '.', 'e', 'x', 'p', 'r', '.', 'v', '1', 'a', 'l', 'p', 'h', 'a', '1', 'B', '\t', 'E', 'v', 'a', 'l', 'P', 'r', 'o', 't', 'o', 'P', '\001', 'Z', '<', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'g', 'o', 'l', 'a', 'n', 'g', '.', 'o', 'r', 'g', '/', 'g', 'e', 'n', 'p', 'r', 'o', 't', 'o', '/', 'g', 'o', 'o', 'g', 'l', 'e', 'a', 'p', 'i', 's', '/', 'a', 'p', 'i', '/', 'e', 'x', 'p', 'r', '/', 'v', '1', 'a', 'l', 'p', 'h', 'a', '1', ';', 'e', 'x', 'p', 'r', '\370', '\001', '\001', 'b', '\006', 'p', 'r', 'o', 't', 'o', '3', }; static upb_def_init *deps[3] = { &google_api_expr_v1alpha1_value_proto_upbdefinit, &google_rpc_status_proto_upbdefinit, NULL }; upb_def_init google_api_expr_v1alpha1_eval_proto_upbdefinit = { deps, &google_api_expr_v1alpha1_eval_proto_upb_file_layout, "google/api/expr/v1alpha1/eval.proto", UPB_STRVIEW_INIT(descriptor, 738) };
/*******************************************ÉêÃ÷*************************************** ±¾Ç¶Èëʽ²Ù×÷ϵͳδ¾­ÊÚȨ£¬½ûÖ¹Ó¦ÓÃÓÚÈκÎÉÌÒµÓÃ; °æÈ¨ËùÓУ¬ÇÖȨ±Ø¾¿ http://www.trtos.com/ **************************************************************************************/ #include <Include.h> #include <AppConfig.h> #include <CheakOut.h> /************************************************************************************** ÉùÃ÷:ÔÚÒýÓÃÓ¦ÓÃÅäÖÃÎļþʱÐèÒªÔÚÓ¦ÓòÎÊý½á¹¹ÌåÍ·²¿·ÅÖÃConfigHeadStructʵÌå **************************************************************************************/ extern void IAP_Lock(void); extern void IAP_Unlock(void); extern void IAP_ProgramHalfWord(uint32 Address, uint16 Data); extern void IAP_ErasePage(uint32 Page_Address); /************************************************************************************** Func:µ¥Æ¬»úÄÚ²¿flash±à³Ì Time:2015-07-25 Ver.1.0 http://www.trtos.com/ By:ͯ½ðÂÀ Note: SizeΪÊý¾Ý³¤¶ÈÓÃsizeof£¨ÊµÌ壩 **************************************************************************************/ void Flash_WriteData(uint32 Addr,void *Data,uint16 Size) { #define SmallPageSize 512 uint16 i,c=0; uint16 *P; P=(uint16 *)Data; IAP_Unlock(); c=Size/SmallPageSize; if(Size%SmallPageSize)c++; for(i=0;i<c;i++)IAP_ErasePage(Addr+SmallPageSize*i); i=0; while(Size--)IAP_ProgramHalfWord(Addr+i++*2,*P++); IAP_Lock(); } /************************************************************************************** Func:FlashÄÚ²¿falshÊý¾Ý Time:2015-07-25 Ver.1.0 http://www.trtos.com/ By:ͯ½ðÂÀ Note: SizeΪÊý¾Ý³¤¶ÈÓÃsizeof£¨ÊµÌ壩 **************************************************************************************/ void Flash_ReadData(uint32 Addr,void *Data,uint16 Size) { uint8 *P,*S; P=(uint8 *)Data; S=(uint8 *)(Addr); while(Size--)*P++=*S++; } /************************************************************************************** Func:·ºÐÍ´æ´¢ÅäÖà Time:2015-09-5 Ver.1.0 http://www.trtos.com/ By:ͯ½ðÂÀ Note: Sector´æ´¢ÉÈÇø **************************************************************************************/ void Save_VoidConfig(void(*Save)(uint32 Addr,void *Data,uint16 Size),uint32 Addr,void *Data,uint16 Sector) { uint16 *S; ConfigHeadStruct *CHS; S=(uint16 *)Data; CHS=(ConfigHeadStruct *)S; CHS->CrcValue=Tools_GetCRC16((uint8*)(uint32)((uint32)Data+sizeof(ConfigHeadStruct)),CHS->Size-sizeof(ConfigHeadStruct)); Save(Addr+Sector*CONFIG_SECTOR_SPACE,S,CHS->Size); } /************************************************************************************** Func:´æ´¢Ó¦ÓóÌÐòµôµçÊý¾Ý Time:2015-09-5 Ver.1.0 http://www.trtos.com/ By:ͯ½ðÂÀ Note: Sector´æ´¢ÉÈÇø **************************************************************************************/ void Save_AppConfig(void *Data,uint16 Sector) { assert_param(Sector<2);//¶ÔÓÚ±¾µØÅäÖÃÖ»ÔÊÐíʹÓÃÁ½¸öÅäÖõ¥Î» Save_VoidConfig(Flash_WriteData,CONFIGS_ADDR_BASE,Data,Sector); } /************************************************************************************** Func:»ñÈ¡·ºÐÍÅäÖà Time:2015-09-5 Ver.1.0 http://www.trtos.com/ By:ͯ½ðÂÀ Note: **************************************************************************************/ BOOL Load_VoidConfig(void(*Load)(uint32 Addr,void *Data,uint16 Size),uint32 Addr,void *Data,uint16 Sector) { uint8 *P; uint16 CrcValue; ConfigHeadStruct *CHS; assert_param(Sector<2); P=(uint8 *)Data; Load(Addr+Sector*CONFIG_SECTOR_SPACE,Data,4 );//»ñȡͷ²¿ CHS=(ConfigHeadStruct *)P; if(CHS->Size>2048|CHS->Size<4)goto Error; Load(Addr+Sector*CONFIG_SECTOR_SPACE,Data,CHS->Size); CrcValue=Tools_GetCRC16((uint8*)(uint32)((uint32)P+sizeof(ConfigHeadStruct)),CHS->Size-sizeof(ConfigHeadStruct)); if(CrcValue!=CHS->CrcValue)goto Error; return True; Error: return False; } /************************************************************************************** Func:»ñÈ¡±¾µØÅäÖà Time:2015-09-5 Ver.1.0 http://www.trtos.com/ By:ͯ½ðÂÀ Note: **************************************************************************************/ BOOL Load_AppConfig(void *Data,uint16 Sector) { assert_param(Sector<2);//¶ÔÓÚ±¾µØÅäÖÃÖ»ÔÊÐíʹÓÃÁ½¸öÅäÖõ¥Î» return Load_VoidConfig(Flash_ReadData,CONFIGS_ADDR_BASE,Data,Sector); } /************************************************************************************** Func:´´½¨·¢ËÍÏûÏ¢ Time:2015-09-5 Ver.1.0 http://www.trtos.com/ By:ͯ½ðÂÀ Note: **************************************************************************************/ void Create_Message(void *Buf,uint8 Length) { ConfigHeadStruct *CHS; CHS=(ConfigHeadStruct *)Buf; CHS->Size=Length; CHS->CrcValue=Tools_GetCRC16((uint8*)(uint32)((uint32)Buf+sizeof(ConfigHeadStruct)),CHS->Size-sizeof(ConfigHeadStruct)); } /************************************************************************************** Func:½âÎöÏûÏ¢ Time:2015-09-5 Ver.1.0 http://www.trtos.com/ By:ͯ½ðÂÀ Note: **************************************************************************************/ BOOL Export_Message(void *Buf,uint8 Length) { uint16 CrcValue; ConfigHeadStruct *CHS; if(Length<sizeof(ConfigHeadStruct))return False; CHS=(ConfigHeadStruct *)Buf; if(CHS->Size!=Length)return False; CrcValue=Tools_GetCRC16((uint8*)(uint32)((uint32)Buf+sizeof(ConfigHeadStruct)),CHS->Size-sizeof(ConfigHeadStruct)); if(CrcValue!=CHS->CrcValue)return False; return True; }
// // DataBaseSingleton.h // // // Created by wanglei on 16/1/23. // Copyright © 2016年 lit. All rights reserved. // #import <Foundation/Foundation.h> @class RecipeDetailModel; @interface DataBaseSingleton : NSObject + (instancetype)sharedManager; - (BOOL)insertDataFrom:(RecipeDetailModel *)recipe; - (NSMutableArray *)selectAll; - (BOOL)deleteRecipeById:(NSString *)recipeId; @end
// Copyright (c) 2016-2017 Anyar, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #pragma once #include "ascent/Utility.h" namespace asc { /// Fourth order, four pass Runge Kutta integrator. /// /// Designed for optimum speed and minimal memory load. We use one additional multiplication to reduce memory cost by 25%. /// \tparam state_t The state type of the system to be integrated. I.e. a std::vector or std::deque. template <typename state_t> struct RK4T { using value_t = typename state_t::value_type; /// \brief Integration step operation /// /// Steps the system a single time step (dt), internally advances time (t) /// /// \tparam System The system object or function type. The system to be stepped must have a function syntax that takes \c (state_t, state_t, value_t) \c (x, xd, t). /// The system can be a function, functor, or lambda expression. Taken as an rvalue reference. /// \param[in, out] system The \c System instance. /// \param[in, out] x The system's state vector. /// \param[in, out] t The current time, which will be advanced by c\ dt. /// \param[in] dt The time step for the input system to be advanced. template <typename System> void operator()(System&& system, state_t& x, value_t& t, const value_t dt) { const value_t t0 = t; const value_t dt_2 = 0.5_v*dt; const value_t dt_6 = cx(1.0 / 6.0)*dt; const size_t n = x.size(); if (xd.size() < n) { xd.resize(n); xd_temp.resize(n); } x0 = x; system(x0, xd, t); size_t i{}; for (; i < n; ++i) x[i] = dt_2 * xd[i] + x0[i]; t += dt_2; system(x, xd_temp, t); for (i = 0; i < n; ++i) { xd[i] += 2 * xd_temp[i]; x[i] = dt_2 * xd_temp[i] + x0[i]; } system(x, xd_temp, t); for (i = 0; i < n; ++i) { xd[i] += 2 * xd_temp[i]; x[i] = dt * xd_temp[i] + x0[i]; } t = t0 + dt; system(x, xd_temp, t); for (i = 0; i < n; ++i) x[i] = dt_6 * (xd[i] + xd_temp[i]) + x0[i]; } state_t xd; private: state_t x0, xd_temp; }; }
/* +----------------------------------------------------------------------+ | Swoole | +----------------------------------------------------------------------+ | This source file is subject to version 2.0 of the Apache license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.apache.org/licenses/LICENSE-2.0.html | | If you did not receive a copy of the Apache2.0 license and are unable| | to obtain it through the world-wide-web, please send a note to | | license@swoole.com so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: xinhua.guo <woshiguo35@gmail.com> | +----------------------------------------------------------------------+ */ #ifndef SERIALIZE_H #define SERIALIZE_H #ifdef __cplusplus extern "C" { #endif #if PHP_MAJOR_VERSION >= 7 #define SERIA_SIZE 1024 #define FILTER_SIZE 1024 typedef struct _seriaString { size_t offset; size_t total; void * buffer; //zend_string } seriaString; typedef struct _SBucketType { zend_uchar key_type : 1; zend_uchar key_len : 2; zend_uchar data_len : 2; zend_uchar data_type : 3; //IS_UNDEF means object now } SBucketType; struct _swMinFilter { uint32_t mini_fillter_find_cnt; uint32_t mini_fillter_miss_cnt; uint32_t bigger_fillter_size; }; struct _swSeriaG { zval sleep_fname; zval weekup_fname; zend_uchar pack_string; struct _swMinFilter filter; }; #pragma pack (4) typedef struct _swPoolstr { zend_string *str; uint32_t offset; } swPoolstr; #pragma pack () struct _swSeriaG swSeriaG; static void *unser_start = 0; static swPoolstr mini_filter[FILTER_SIZE]; static swPoolstr *bigger_filter = NULL; #define SERIA_SET_ENTRY_TYPE_WITH_MINUS(buffer,type) swoole_check_size(buffer, 1);\ *(char*) (buffer->buffer + buffer->offset) = *((char*) & type);\ buffer->offset += 1; #define SERIA_SET_ENTRY_SHORT_WITH_MINUS(buffer,data) swoole_check_size(buffer, 2);\ *(short*) (buffer->buffer + buffer->offset) = data;\ buffer->offset += 2; #define SERIA_SET_ENTRY_SIZE4_WITH_MINUS(buffer,data) swoole_check_size(buffer, 4);\ *(int32_t*) (buffer->buffer + buffer->offset) = data;\ buffer->offset += 4; #define SERIA_SET_ENTRY_TYPE(buffer,type) swoole_check_size(buffer, 1);\ *(zend_uchar*) (buffer->buffer + buffer->offset) = *((zend_uchar*) & type);\ buffer->offset += 1; #define SERIA_GET_ENTRY_TYPE(buffer) *(zend_uchar*) (buffer->buffer + buffer->offset) = *((zend_uchar*) & type);\ buffer->offset += 1; #define SERIA_SET_ENTRY_SHORT(buffer,data) swoole_check_size(buffer, 2);\ *(unsigned short*) (buffer->buffer + buffer->offset) = data;\ buffer->offset += 2; #define SERIA_SET_ENTRY_SIZE4(buffer,data) swoole_check_size(buffer, 4);\ *(uint32_t*) (buffer->buffer + buffer->offset) = data;\ buffer->offset += 4; #define SERIA_SET_ENTRY_ULONG(buffer,data) swoole_check_size(buffer, sizeof(zend_ulong));\ *(zend_ulong *) (buffer->buffer + buffer->offset) = data;\ buffer->offset += sizeof(zend_ulong); #define KEY_TYPE_STRING 1 #define KEY_TYPE_INDEX 0 #define SW_FAST_PACK 1 #endif #ifdef __cplusplus } #endif #endif /* SERIALIZE_H */
/* * (C) Copyright 2017 Edson (http://edsonaraujosoares.com) and others. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Contributors: * Edson Araújo Soares */ #ifndef GOF_OBSERVER_TOUCH_EVENT_H #define GOF_OBSERVER_TOUCH_EVENT_H #include "Event.h" namespace GoF { namespace Observer { namespace Event { class TouchEvent : public Event { public: TouchEvent(); }; } } } #endif
/* Copyright © 2015 Hilko Bengen <bengen@hilluzination.de>. All rights reserved. Use of this source code is governed by the license that can be found in the LICENSE file. */ #include <stddef.h> #include <yara/stream.h> #include "_cgo_export.h" size_t stream_read(void* ptr, size_t size, size_t nmemb, void* user_data) { return streamRead(ptr, size, nmemb, user_data); } size_t stream_write(void* ptr, size_t size, size_t nmemb, void* user_data) { return streamWrite(ptr, size, nmemb, user_data); }
#ifndef CLFLAGPAIR_H #define CLFLAGPAIR_H #include <QColor> #include <QGraphicsItemGroup> #include "clflag.h" #include "cltimeline.h" class CLFlagPair : public QGraphicsItemGroup, public CLSelectableObject { public: CLFlagPair(long id, const QDateTime& minDate, const QDateTime& maxDate, const QColor& color, CLTimeLine* timeLine, QObject* eventReceiver); virtual ~CLFlagPair(); void setPosByDates(const QRect& r); QDateTime minDate(); QDateTime maxDate(); void setMinDate(const QDateTime& minDate); void setMaxDate(const QDateTime& maxDate); void setColor(const QColor& color); long id(); virtual bool matchDate(const QDateTime& d); ChronoLineFlagType matchedFlag(const QDateTime& d); public: // need because manuall call from other flag void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); protected: CLFlag *begFlag, *endFlag; long _id; bool begFlagPossiblySelected; // defined only if flag pair selected }; #endif // CLFLAGPAIR_H
/* * Copyright (c) 2013 Ambroz Bizjak * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef AMBROLIB_LINEAR_PLANNER_H #define AMBROLIB_LINEAR_PLANNER_H #include <aprinter/base/Assert.h> #include <aprinter/math/FloatTools.h> #include <aprinter/BeginNamespace.h> template <typename FpType> struct LinearPlanner { struct SegmentData { FpType a_x; FpType max_v; FpType max_start_v; FpType a_x_rec; }; class SegmentState { friend LinearPlanner; FpType end_v; }; struct SegmentResult { FpType const_start; FpType const_end; FpType const_v; }; static void initSegment (SegmentData *segment, FpType prev_max_v, FpType max_start_v, FpType max_v, FpType a_x) { AMBRO_ASSERT(FloatIsPosOrPosZero(prev_max_v)) AMBRO_ASSERT(FloatIsPosOrPosZero(max_start_v)) AMBRO_ASSERT(FloatIsPosOrPosZero(max_v)) AMBRO_ASSERT(FloatIsPosOrPosZero(a_x)) segment->max_v = max_v; segment->max_start_v = FloatMin(prev_max_v, FloatMin(max_start_v, max_v)); segment->a_x = a_x; segment->a_x_rec = 1.0f / a_x; } static FpType push (SegmentData *segment, SegmentState *s, FpType end_v) { AMBRO_ASSERT(FloatIsPosOrPosZero(segment->a_x)) AMBRO_ASSERT(FloatIsPosOrPosZero(segment->max_v)) AMBRO_ASSERT(FloatIsPosOrPosZero(segment->max_start_v)) AMBRO_ASSERT(segment->max_start_v <= segment->max_v) AMBRO_ASSERT(FloatIsPosOrPosZero(end_v)) AMBRO_ASSERT(end_v <= segment->max_v) s->end_v = end_v; return FloatMin(segment->max_start_v, end_v + segment->a_x); } static FpType pull (SegmentData *segment, SegmentState *s, FpType start_v, SegmentResult *result) { AMBRO_ASSERT(s->end_v <= segment->max_v) AMBRO_ASSERT(FloatIsPosOrPosZero(start_v)) AMBRO_ASSERT(start_v <= segment->max_start_v) AMBRO_ASSERT(start_v <= s->end_v + segment->a_x) FpType end_v = s->end_v; FpType start_v_plus_a_x = start_v + segment->a_x; if (end_v > start_v_plus_a_x) { end_v = start_v_plus_a_x; result->const_start = 1.0f; result->const_end = 0.0f; result->const_v = end_v; } else { FpType half_start_v_plus_a_x_plus_end_v = FloatLdexp(start_v_plus_a_x + end_v, -1); if (half_start_v_plus_a_x_plus_end_v > segment->max_v) { result->const_start = (segment->max_v - start_v) * segment->a_x_rec; result->const_end = (segment->max_v - end_v) * segment->a_x_rec; result->const_v = segment->max_v; } else { result->const_start = (half_start_v_plus_a_x_plus_end_v - start_v) * segment->a_x_rec; result->const_end = 1.0f - result->const_start; result->const_v = half_start_v_plus_a_x_plus_end_v; } } AMBRO_ASSERT(FloatIsPosOrPosZero(start_v)) AMBRO_ASSERT(FloatIsPosOrPosZero(end_v)) AMBRO_ASSERT(FloatIsPosOrPosZero(result->const_v)) return end_v; } }; #include <aprinter/EndNamespace.h> #endif
// // InputAccessoryHidingAppDelegate.h // UIWebViewInputAccessoryHidingDemo // // Created by dhf on 14-7-14. // Copyright (c) 2014年 dhf. All rights reserved. // #import <UIKit/UIKit.h> @interface InputAccessoryHidingAppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
#include <stdio.h> int main (int argc, char **argv) { int i; printf ("I got %d command-line arguments:\n", argc); for (i = 0; i < argc; i++) { printf ("\targument %d is: (%s).\n", i, argv[i]); } return 0; }
/********************************************************************************* * * Inviwo - Interactive Visualization Workshop * * Copyright (c) 2016-2019 Inviwo Foundation * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *********************************************************************************/ #ifndef IVW_GLFWEXCEPTION_H #define IVW_GLFWEXCEPTION_H #include <modules/glfw/glfwmoduledefine.h> #include <inviwo/core/common/inviwo.h> #include <inviwo/core/util/exception.h> namespace inviwo { /** * \class GLFWException */ class IVW_MODULE_GLFW_API GLFWException : public Exception { public: GLFWException(const std::string& message = "", ExceptionContext context = ExceptionContext()); virtual ~GLFWException() throw() {} }; class IVW_MODULE_GLFW_API GLFWInitException : public ModuleInitException { public: GLFWInitException(const std::string& message = "", ExceptionContext context = ExceptionContext()); virtual ~GLFWInitException() throw() {} }; } // namespace inviwo #endif // IVW_GLFWEXCEPTION_H
//ROOT: src/lib/parser/parser.c ANNA_VM_NATIVE(anna_node_dummy_wrapper_i_get_payload, 1) { anna_object_t *this = anna_as_obj_fast(param[0]); anna_node_dummy_t *node = (anna_node_dummy_t *)anna_node_unwrap(this); return anna_from_obj(node->payload); } ANNA_VM_NATIVE(anna_node_dummy_wrapper_i_init, 3) { anna_object_t *this = anna_as_obj_fast(param[0]); anna_node_t *source = anna_node_unwrap(anna_as_obj(param[1])); *(anna_node_dummy_t **)anna_entry_get_addr(this,ANNA_MID_NODE_PAYLOAD)= anna_node_create_dummy( source?&source->location:0, anna_as_obj(param[2])); return param[0]; } static anna_type_t *anna_node_create_dummy_type(anna_stack_template_t *stack) { wchar_t *argn[] = { L"this", L"source", L"payload" } ; anna_type_t *argv[] = { node_dummy_type, node_type, any_type } ; anna_member_create_native_method( node_dummy_type, anna_mid_get(L"__init__"), 0, &anna_node_dummy_wrapper_i_init, null_type, 3, argv, argn, 0, 0); anna_member_create_native_property( node_dummy_type, anna_mid_get(L"payload"), any_type, &anna_node_dummy_wrapper_i_get_payload, 0, L"The payload of this node."); anna_type_document( node_type, L"An AST node that wraps an arbitrary Object."); anna_type_document( node_type, L"When a Dummy node is evaluated, it will return it's payload. It can be used as a short circut when you know the exact value a node should evaluate to."); return node_dummy_type; }
#include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "runner_internal.h" #include "testmethod_internal.h" struct PT_TestMethod { FILE *output; jmp_buf jmp; int ignore; int expectCrash; }; SOLOCAL PT_TestMethod *PT_TestMethod_create(FILE *output) { PT_TestMethod* self = malloc(sizeof(PT_TestMethod)); self->output = output; self->ignore = 0; self->expectCrash = 0; return self; } SOLOCAL void PT_TestMethod_destroy(PT_TestMethod *self) { free(self); } SOLOCAL jmp_buf *PT_TestMethod_jmp(PT_TestMethod *self) { return &(self->jmp); } static void i_Test__stopIfNotIgnored(PT_TestMethod *self) { if (self->ignore) { if (self->ignore > 0) --self->ignore; } else { longjmp(self->jmp, 1); } } SOEXPORT void i_Test__assertNotNull(PT_TestMethod *self, const char *file, unsigned line, const char *pointerName, const void *pointer, const char *message) { if (!pointer) { if (message) { fprintf(self->output, "0%s (%s was NULL) at %s:%u\n", message, pointerName, file, line); } else { fprintf(self->output, "0%s was NULL at %s:%u\n", pointerName, file, line); } i_Test__stopIfNotIgnored(self); } } SOEXPORT void i_Test__assertRefEqual(PT_TestMethod *self, const char *file, unsigned line, const char *actualName, const void *expected, const void *actual, const char *message) { if (expected != actual) { if (message) { fprintf(self->output, "0%s (%s expected: 0x%"PRIxPTR", actual: 0x%"PRIxPTR") at %s:%u\n", message, actualName, (uintptr_t)expected, (uintptr_t)actual, file, line); } else { fprintf(self->output, "0%s expected: 0x%"PRIxPTR", actual: 0x%"PRIxPTR" at %s:%u\n", actualName, (uintptr_t)expected, (uintptr_t)actual, file, line); } i_Test__stopIfNotIgnored(self); } } SOEXPORT void i_Test__assertStrEqual(PT_TestMethod *self, const char *file, unsigned line, const char *actualName, const char *expected, const char *actual, const char *message) { if (!expected) expected = "(null)"; if (!actual) actual = "(null)"; if (strcmp(expected,actual)) { if (message) { fprintf(self->output, "0%s (%s expected: \"%s\", actual: \"%s\") at %s:%u\n", message, actualName, expected, actual, file, line); } else { fprintf(self->output, "0%s expected: \"%s\", actual: \"%s\" at %s:%u\n", actualName, expected, actual, file, line); } i_Test__stopIfNotIgnored(self); } } SOEXPORT void i_Test__assertIntEqual(PT_TestMethod *self, const char *file, unsigned line, const char *actualName, long expected, long actual, const char *message) { if (expected != actual) { if (message) { fprintf(self->output, "0%s (%s expected: %ld, actual: %ld) at %s:%u\n", message, actualName, expected, actual, file, line); } else { fprintf(self->output, "0%s expected: %ld, actual: %ld at %s:%u\n", actualName, expected, actual, file, line); } i_Test__stopIfNotIgnored(self); } } SOEXPORT void i_Test__fail(PT_TestMethod *self, const char *file, unsigned line, const char *message) { if (message) { fprintf(self->output, "0%s at %s:%u\n", message, file, line); } else { fprintf(self->output, "0at %s:%u\n", file, line); } i_Test__stopIfNotIgnored(self); } SOEXPORT void i_Test__pass(PT_TestMethod *self) { fputs("1\n", self->output); longjmp(self->jmp, 1); } SOEXPORT void i_Test__default(PT_TestMethod *self, PT_TestResultCode result) { (void)self; fprintf(self->output, "2%d\n", result); } SOEXPORT void i_Test__ignore(PT_TestMethod *self, int num) { self->ignore = num; fprintf(self->output, "3%d\n", num); } SOEXPORT void i_Test__expectCrash(PT_TestMethod *self) { self->expectCrash = 1; fputs("4\n", self->output); }
/* * Copyright (C) 2011 by Comm5 Tecnologia Ltda. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holders nor the names of * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY COMM5 TECNOLOGIA LTDA AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE * SOFTWARE GMBH 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. * * For additional information see http://www.ethernut.de/ * */ #if !defined ( __NUTENUMMODEL_H__ ) #define __NUTENUMMODEL_H__ #include <QAbstractTableModel> #include <QString> #include <QHostAddress> #include <QUdpSocket> class NutEnumModel : public QAbstractTableModel { Q_OBJECT public: NutEnumModel( QObject* parent = 0 ); int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount ( const QModelIndex & parent = QModelIndex() ) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; void changeDeviceSettings( const QString& mac, const QHostAddress& ip_addr, const QHostAddress& ip_mask, const QHostAddress& gateway ); public slots: void refresh(); private slots: void processPendingDatagrams(); void broadcast(); private: struct NutDiscoveryData { int version; QString mac; QHostAddress last_ip_addr; QHostAddress ip_mask; QHostAddress gateway; QHostAddress ip_addr; QString hostname; QString custom; bool operator==( const NutDiscoveryData& other ) { return mac == other.mac; } bool operator!=( const NutDiscoveryData& other ) { return ( mac != other.mac || ip_addr != other.ip_addr || ip_mask != other.ip_mask || gateway != other.gateway || hostname != other.hostname ); } }; QList<NutDiscoveryData> entries; QUdpSocket socket; }; #endif // __NUTENUMMODEL_H__
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ // Processes.c // Mark Tully // ??/??/95 // ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ /* ***** BEGIN LICENSE BLOCK ***** * * Copyright (c) 1995, Mark Tully and John Treece-Birch * 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. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ #include "Marks Routines.h" #define timeOut 120L // time out in 60th sec long GetProcessCreator(ProcessSerialNumber *process) { ProcessInfoRec poo; OSErr err; poo.processInfoLength=sizeof(ProcessInfoRec); poo.processName=0L; // Don't care poo.processAppSpec=0L; // Don't care err=GetProcessInformation(process,&poo); if(err!=noErr) // error return(0L); else return(poo.processSignature); } Boolean ProcessExists(ProcessSerialNumber *process) { ProcessInfoRec poo; OSErr err; poo.processInfoLength=sizeof(ProcessInfoRec); poo.processName=0L; // Don't care poo.processAppSpec=0L; // Don't care err=GetProcessInformation(process,&poo); if(err!=noErr) // error return false; else return true; } // pass in the process signiture to switch to Boolean SwitchToProcess(long process,Boolean wait) { ProcessSerialNumber testProcess,tempProcess; ProcessInfoRecPtr info; ProcessInfoRec poo; Boolean done=false; EventRecord theEvent; long startProcess; OSErr err; unsigned long until; info=&poo; // First, get the current process so we know when we've done a complete circle... GetCurrentProcess(&testProcess); info->processInfoLength=sizeof(ProcessInfoRec); info->processName=0L; // Don't care info->processAppSpec=0L; // Don't care err=GetProcessInformation(&testProcess,info); if(err!=noErr) // error return(false); startProcess=info->processSignature; //err=GetNextProcess(&testProcess); // skip our process //if(err!=noErr) // error // return(false); while (!done) { err=GetNextProcess(&testProcess); if(err!=noErr) // error { if (err==-600) // ours was last in list { // as it failed the PSN is set to 0 meaning start from beginning of list err=GetNextProcess(&testProcess); if(err!=noErr) return(false); } else return(false); } info->processInfoLength=sizeof(ProcessInfoRec); info->processName=0L; // Don't care info->processAppSpec=0L; // Don't care err=GetProcessInformation(&testProcess,info); if(err!=noErr) // error return(false); if (info->processSignature==process) { // found it! err=SetFrontProcess(&testProcess); if(err!=noErr) // error return(false); until=TickCount()+timeOut; if (wait) { done=false; while((!done) && (until>TickCount())) { err=GetFrontProcess(&tempProcess); if(err!=noErr) // error return(false); err=SameProcess(&testProcess,&tempProcess,&done); if(err!=noErr) // error return(false); WaitNextEvent(everyEvent,&theEvent,10L,0); // Give some cpu time out } if (until>TickCount()) return(false); // timeout occurred, failed else return(true); // no time out occurred } else return true; // switch ok } else if (info->processSignature==startProcess) { // Complete circle return(false); // switch failed } } return false; } // Returns true if this process is frontmost Boolean IsFrontProcess() { OSErr err; Boolean same; ProcessSerialNumber thisProcess,frontProcess; if (err=GetCurrentProcess(&thisProcess)) return true; // default to true on error if (err=GetFrontProcess(&frontProcess)) return true; // default to true on error if (err=SameProcess(&frontProcess,&thisProcess,&same)) return true; // default to true on error return same; } Boolean WaitForFrontProcess(long process,unsigned long waitFor) { ProcessSerialNumber current,tempProcess; unsigned long until; ProcessInfoRec info; OSErr err; EventRecord theEvent; GetCurrentProcess(&current); until=TickCount()+waitFor; while(until>TickCount()) { if(GetFrontProcess(&tempProcess)) return false; info.processInfoLength=sizeof(ProcessInfoRec); info.processName=0L; // Don't care info.processAppSpec=0L; // Don't care if(GetProcessInformation(&tempProcess,&info)) return false; if (info.processSignature==process) // done return true; WaitNextEvent(everyEvent,&theEvent,10L,0); // Give some cpu time out } return false; // timeout occurred, failed } Boolean WaitResumeEvent() { EventRecord theEvent; unsigned long wait=timeOut+TickCount(); while(!WaitNextEvent(osMask,&theEvent,0L,0L)) { if (TickCount()>=wait) return false; // timeout occurred } return true; }
/* Five bilinear patches */ #include <fclaw2d_map.h> #ifdef __cplusplus extern "C" { #if 0 } #endif #endif static int fclaw2d_map_query_pillowsphere5(fclaw2d_map_context_t * cont, int query_identifier) { switch (query_identifier) { case FCLAW2D_MAP_QUERY_IS_USED: return 1; case FCLAW2D_MAP_QUERY_IS_SCALEDSHIFT: return 0; case FCLAW2D_MAP_QUERY_IS_AFFINE: return 0; case FCLAW2D_MAP_QUERY_IS_NONLINEAR: return 1; case FCLAW2D_MAP_QUERY_IS_GRAPH: return 0; case FCLAW2D_MAP_QUERY_IS_PLANAR: return 0; case FCLAW2D_MAP_QUERY_IS_ALIGNED: return 0; case FCLAW2D_MAP_QUERY_IS_FLAT: return 0; case FCLAW2D_MAP_QUERY_IS_DISK: return 0; case FCLAW2D_MAP_QUERY_IS_SPHERE: return 1; case FCLAW2D_MAP_QUERY_IS_PILLOWDISK: return 0; case FCLAW2D_MAP_QUERY_IS_SQUAREDDISK: return 0; case FCLAW2D_MAP_QUERY_IS_PILLOWSPHERE: return 0; case FCLAW2D_MAP_QUERY_IS_CUBEDSPHERE: return 0; case FCLAW2D_MAP_QUERY_IS_FIVEPATCH: return 0; case FCLAW2D_MAP_QUERY_IS_HEMISPHERE: return 1; case FCLAW2D_MAP_QUERY_IS_BRICK: return 0; default: printf("\n"); printf("fclaw2d_map_query_fivepatch (fclaw2d_map_query_defs.h) : " \ "Query id not identified; Maybe the query is not up to "\ "date?\nSee fclaw2d_map_query_defs.h.\n"); printf("Requested query id : %d\n",query_identifier); SC_ABORT_NOT_REACHED (); } return 0; } static void fclaw2d_map_c2m_pillowsphere5(fclaw2d_map_context_t * cont, int blockno, double xc, double yc, double *xp, double *yp, double *zp) { double xp1, yp1, zp1; double alpha = cont->user_double[0]; MAPC2M_FIVEPATCH(&blockno,&xc,&yc,&xp1,&yp1,&zp1,&alpha); xp1 = (xp1 + 1)/2.0; yp1 = (yp1 + 1)/2.0; MAPC2M_PILLOWSPHERE(&blockno,&xp1,&yp1,xp,yp,zp); /* These can probably be replaced by C functions at some point. */ scale_map(cont,xp,yp,zp); rotate_map(cont,xp,yp,zp); } fclaw2d_map_context_t* fclaw2d_map_new_pillowsphere5(const double scale[], const double rotate[], const double alpha) { fclaw2d_map_context_t *cont; cont = FCLAW_ALLOC_ZERO (fclaw2d_map_context_t, 1); cont->query = fclaw2d_map_query_pillowsphere5; cont->mapc2m = fclaw2d_map_c2m_pillowsphere5; cont->user_double[0] = alpha; set_scale(cont,scale); set_rotate(cont,rotate); return cont; } #ifdef __cplusplus #if 0 { #endif } #endif
#include "konoha3.h" #ifndef APACHE_GLUE_H #define APACHE_GLUE_H #define kmodapache ((KModuleApache *)kctx->runtimeModels[MOD_APACHE]) #define KClass_Request kmodapache->cRequest #define KClass_AprTable kmodapache->cAprTable #define KClass_AprTableEntry kmodapache->cAprTableEntry #define KClass_Apache kmodapache->cApache typedef struct kRequest { kObjectHeader h; request_rec *r; } kRequest; typedef struct kAprTable { kObjectHeader h; apr_table_t *tbl; } kAprTable; typedef struct kAprTableEntry { kObjectHeader h; apr_table_entry_t *entry; } kAprTableEntry; typedef struct kApache { kObjectHeader h; } kApache; typedef struct { KRuntimeModel h; KClass *cRequest; KClass *cAprTable; KClass *cAprTableEntry; KClass *cApache; } KModuleApache; typedef struct { KModelContext h; //kRequest *req; } ctxapache_t; #endif /* end of include guard */
/*- * BSD LICENSE * * Copyright (c) Intel 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 Intel 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 AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "nvme_common.h" #include "nvme_pci.h" /* * Initialize PCI subsystem. */ int nvme_pci_init(void) { int ret; ret = pci_system_init(); if (ret) { fprintf(stderr, "pci_system_init failed %d\n", ret); return ret; } return 0; } /* * Check if a device has a driver binded. */ static int nvme_pci_device_has_kernel_driver(struct pci_device *dev) { char linkname[NVME_PCI_PATH_MAX]; char driver[NVME_PCI_PATH_MAX]; char *driver_name; ssize_t driver_len; snprintf(linkname, sizeof(linkname), "/sys/bus/pci/devices/%04x:%02x:%02x.%1u/driver", dev->domain, dev->bus, dev->dev, dev->func); memset(driver, 0, sizeof(driver)); driver_len = readlink(linkname, driver, sizeof(driver)); if ((driver_len <= 0) || (driver_len >= NVME_PCI_PATH_MAX)) return 0; driver_name = basename(driver); nvme_info("Kernel driver %s attached to NVME controller %04x:%02x:%02x.%1u\n", driver_name, dev->domain, dev->bus, dev->dev, dev->func); /* Those are OK, we can ignore */ if (strcmp(driver_name, "uio_pci_generic") == 0 || strcmp(driver_name, "vfio-pci") == 0) return 0; nvme_err("Device in use\n"); return 1; } /* * Search a PCI device and grab it if found. */ struct pci_device *nvme_pci_device_probe(const struct pci_slot_match *slot) { struct pci_device_iterator *pci_dev_iter; struct pci_device *pci_dev = NULL; int ret = -ENODEV; pci_dev_iter = pci_slot_match_iterator_create(slot); pci_dev = pci_device_next(pci_dev_iter); if (pci_dev) ret = pci_device_probe(pci_dev); pci_iterator_destroy(pci_dev_iter); if (ret != 0) return NULL; if (pci_dev->device_class != NVME_PCI_CLASS) { nvme_err("Device PCI class is not NVME\n"); pci_dev = NULL; } if (nvme_pci_device_has_kernel_driver(pci_dev)) return NULL; return pci_dev; } /* * Get a device serial number. */ int nvme_pci_device_get_serial_number(struct pci_device *dev, char *sn, size_t len) { uint32_t pos, header = 0; uint32_t i, buf[2]; int ret; if (len < 17) return -1; ret = nvme_pcicfg_read32(dev, &header, NVME_PCI_CFG_SIZE); if (ret || !header) return -1; pos = NVME_PCI_CFG_SIZE; while (1) { if ((header & 0x0000ffff) == NVME_PCI_EXT_CAP_ID_SN && pos != 0) { for (i = 0; i < 2; i++) { /* skip the header */ pos += 4; ret = nvme_pcicfg_read32(dev, &buf[i], pos); if (ret) return -1; } sprintf(sn, "%08x%08x", buf[1], buf[0]); return 0; } pos = (header >> 20) & 0xffc; /* 0 if no other items exist */ if (pos < NVME_PCI_CFG_SIZE) return -1; ret = nvme_pcicfg_read32(dev, &header, pos); if (ret) return -1; } return -1; } /* * Reset a PCI device. */ int nvme_pci_device_reset(struct pci_device *dev) { char filename[NVME_PCI_PATH_MAX]; char *buf = "1"; FILE *fd; int ret; snprintf(filename, sizeof(filename), "/sys/bus/pci/devices/%04x:%02x:%02x.%1u/reset", dev->domain, dev->bus, dev->dev, dev->func); nvme_debug("Resetting PCI device (%s)\n", filename); fd = fopen(filename, "w"); if (!fd) return -1; if (fwrite(buf, strlen(buf), 1, fd) != strlen(buf)) ret = -1; else ret = 0; fclose(fd); return ret; }
/*************************************************************************** * gnomegadu_ui_accounts_pref.c * * Tue Aug 8 22:05:56 2006 * Copyright 2006 Marcin Krzyżanowski * krzak@hakore.com ****************************************************************************/ #include "config.h" #include "gnomegadu_ui_account_chooser.h" #include "gnomegadu_conf.h" #include <string.h> #include <gtk/gtk.h> #include <glade/glade.h> void on_ChooseAccountDialog_response (GtkDialog * dialog, gint response, gpointer user_data) { gchar *account_name; GtkComboBox *combo; if (response == GTK_RESPONSE_OK) { combo = GTK_COMBO_BOX (glade_xml_get_widget (gladexml_account_chooser, "AccountsCombo")); account_name = gtk_combo_box_get_active_text (combo); gnomegadu_conf_set_profile (account_name); gtk_widget_destroy (GTK_WIDGET (dialog)); g_free (account_name); } } void on_ChooseAccountDialog_close (GtkDialog * dialog, gpointer user_data) { on_ChooseAccountDialog_response(dialog,GTK_RESPONSE_OK,NULL); } void gnomegadu_ui_account_chooser_activate () { GtkComboBox *combo; GSList *accounts, *accounts_start; gchar *account_name, *account_dir, *account_dir_name; gladexml_account_chooser = glade_xml_new (PACKAGE_DATA_DIR "/gnomegadu.glade", "ChooseAccountDialog", NULL); accounts = gnomegadu_conf_get_accounts (); accounts_start = accounts; if (accounts) { combo = GTK_COMBO_BOX (glade_xml_get_widget (gladexml_account_chooser, "AccountsCombo")); while (accounts) { account_dir = accounts->data; account_dir_name = g_strconcat (account_dir, "/name", NULL); account_name = gconf_client_get_string (gconf, account_dir_name, NULL); g_free (account_dir); g_free (account_dir_name); gtk_combo_box_append_text (combo, g_strdup (account_name)); accounts = accounts->next; } } gtk_combo_box_set_active (combo, 0); g_slist_free (accounts_start); //g_slist_foreach (accounts_start, gnomegadu_conf_free_list_of_string, NULL); glade_xml_signal_autoconnect (gladexml_account_chooser); }
#pragma once #include <string> #include <unordered_map> #include <vector> #include "TinyXml2\tinyxml2.h" class LanguageTranslator { public: LanguageTranslator(); LanguageTranslator(std::wstring langFileName); void LoadTranslations(); /// <summary> /// Translates the provided string to the current locale. If no translation /// is available, the original string is returned. /// </summary> const std::wstring &Translate(const std::wstring &str); const std::wstring TranslateAndReplace( const std::wstring &str, const std::wstring &arg); /// <summary> /// Replaces the placeholder(s) in str with args, but does not perform a /// translation lookup. /// </summary> const std::wstring Replace( const std::wstring &str, const std::wstring &arg); const std::wstring &LanguageName(); const std::wstring &Author(); public: static std::vector<std::wstring> CurrentLocale(); private: tinyxml2::XMLDocument _xml; tinyxml2::XMLElement *_root; std::unordered_map<std::wstring, std::wstring> _translations; std::wstring _author; std::wstring _name; std::wstring _id; std::vector<std::wstring> _regions; };
// // UIView+AccessViewController.h // MSCellAccessory // // Created by SHIM MIN SEOK on 13. 7. 22.. // // Software License Agreement (BSD License) // // Copyright (c) 2013 SHIM MIN SEOK. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in // the documentation and/or other materials provided with the // distribution. // // 3. Neither the name of Infrae nor the names of its contributors may // be used to endorse or promote products derived from this software // without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INFRAE OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // #import <UIKit/UIKit.h> @interface UIView (AccessViewController) - (UIViewController *)viewController DEPRECATED_ATTRIBUTE; - (id)ms_traverseResponderChainForUIViewController; - (UITableView *)ms_firstTableViewHierarchyFromView:(UIView *)view; - (UITableViewCell *)ms_firstTableViewCellInHierarchyFromView:(UIView *)view; @end
/* * * Copyright (c) 2014, weizhenwei * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * * Neither the name of the {organization} nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * File: signal_handler.h * * Brief: include file of dmd_signal.c, signal handler of the project * * Date: 2014.05.22 * * Author: weizhenwei <weizhenwei1988@gmail.com> * * ***************************************************************************** */ #ifndef SRC_SIGNAL_HANDLER_H_ #define SRC_SIGNAL_HANDLER_H_ // for controlling server running; extern int client_running; extern int server_running; extern void signal_init(); extern void signal_register(int sig, void (*sighandler)(int)); #endif // SRC_SIGNAL_HANDLER_H_
// // AttrMap.h // // $Id$ // // Library: XML // Package: DOM // Module: DOM // // Definition of the AttrMap class. // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. // // Permission is hereby granted, free of charge, to any person or organization // obtaining a copy of the software and accompanying documentation covered by // this license (the "Software") to use, reproduce, display, distribute, // execute, and transmit the Software, and to prepare derivative works of the // Software, and to permit third-parties to whom the Software is furnished to // do so, all subject to the following: // // The copyright notices in the Software and this entire statement, including // the above license grant, this restriction and the following disclaimer, // must be included in all copies of the Software, in whole or in part, and // all derivative works of the Software, unless such copies or derivative // works are solely in the form of machine-executable object code generated by // a source language processor. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. // #ifndef DOM_AttrMap_INCLUDED #define DOM_AttrMap_INCLUDED #include "Poco/XML/XML.h" #include "Poco/DOM/NamedNodeMap.h" namespace Poco { namespace XML { class Element; class XML_API AttrMap: public NamedNodeMap // This implementation of NamedNodeMap is // returned by Element::attributes() { public: Node* getNamedItem(const XMLString& name) const; Node* setNamedItem(Node* arg); Node* removeNamedItem(const XMLString& name); Node* item(unsigned long index) const; unsigned long length() const; Node* getNamedItemNS(const XMLString& namespaceURI, const XMLString& localName) const; Node* setNamedItemNS(Node* arg); Node* removeNamedItemNS(const XMLString& namespaceURI, const XMLString& localName); void autoRelease(); protected: AttrMap(Element* pElement); ~AttrMap(); private: AttrMap(); Element* _pElement; friend class Element; }; } } // namespace Poco::XML #endif // DOM_AttrMap_INCLUDED
/* * Copyright (c) 2006 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * 3. Neither the name of the Institute 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 INSTITUTE AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE 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. */ /* * $Id$ */ #ifndef _HEIM_ENGINE_H #define _HEIM_ENGINE_H 1 /* symbol renaming */ #define ENGINE_add_conf_module hc_ENGINE_add_conf_module #define ENGINE_by_dso hc_ENGINE_by_dso #define ENGINE_by_id hc_ENGINE_by_id #define ENGINE_finish hc_ENGINE_finish #define ENGINE_get_DH hc_ENGINE_get_DH #define ENGINE_get_RSA hc_ENGINE_get_RSA #define ENGINE_get_RAND hc_ENGINE_get_RAND #define ENGINE_get_id hc_ENGINE_get_id #define ENGINE_get_name hc_ENGINE_get_name #define ENGINE_load_builtin_engines hc_ENGINE_load_builtin_engines #define ENGINE_set_DH hc_ENGINE_set_DH #define ENGINE_set_RSA hc_ENGINE_set_RSA #define ENGINE_set_id hc_ENGINE_set_id #define ENGINE_set_name hc_ENGINE_set_name #define ENGINE_set_destroy_function hc_ENGINE_set_destroy_function #define ENGINE_new hc_ENGINE_new #define ENGINE_free hc_ENGINE_free #define ENGINE_up_ref hc_ENGINE_up_ref #define ENGINE_get_default_DH hc_ENGINE_get_default_DH #define ENGINE_get_default_RSA hc_ENGINE_get_default_RSA #define ENGINE_set_default_DH hc_ENGINE_set_default_DH #define ENGINE_set_default_RSA hc_ENGINE_set_default_RSA /* * */ typedef struct hc_engine ENGINE; #include <hcrypto/rsa.h> #include <hcrypto/dsa.h> #include <hcrypto/dh.h> #include <hcrypto/rand.h> #define OPENSSL_DYNAMIC_VERSION (unsigned long)0x00020000 typedef int (*openssl_bind_engine)(ENGINE *, const char *, const void *); typedef unsigned long (*openssl_v_check)(unsigned long); ENGINE * ENGINE_new(void); int ENGINE_free(ENGINE *); void ENGINE_add_conf_module(void); void ENGINE_load_builtin_engines(void); ENGINE *ENGINE_by_id(const char *); ENGINE *ENGINE_by_dso(const char *, const char *); int ENGINE_finish(ENGINE *); int ENGINE_up_ref(ENGINE *); int ENGINE_set_id(ENGINE *, const char *); int ENGINE_set_name(ENGINE *, const char *); int ENGINE_set_RSA(ENGINE *, const RSA_METHOD *); int ENGINE_set_DH(ENGINE *, const DH_METHOD *); int ENGINE_set_destroy_function(ENGINE *, void (*)(ENGINE *)); const char * ENGINE_get_id(const ENGINE *); const char * ENGINE_get_name(const ENGINE *); const RSA_METHOD * ENGINE_get_RSA(const ENGINE *); const DH_METHOD * ENGINE_get_DH(const ENGINE *); const RAND_METHOD * ENGINE_get_RAND(const ENGINE *); int ENGINE_set_default_RSA(ENGINE *); ENGINE * ENGINE_get_default_RSA(void); int ENGINE_set_default_DH(ENGINE *); ENGINE * ENGINE_get_default_DH(void); #endif /* _HEIM_ENGINE_H */
#ifndef _PROPERTY_UTILS_H_ #define _PROPERTY_UTILS_H_ #include "Property.h" #include "PropertyBag.h" namespace gubi { template<class T> bool InsertProperty( gubi::PropertyBag* pPropertyBag, const gubi::Identifier& ePropertyId, const T& eValue ) { bool bReturn = false; if (pPropertyBag != NULL) { bReturn = pPropertyBag->Insert(ePropertyId, new gubi::Property<T>(eValue)); } return bReturn; } template<class T> bool UpdateProperty( gubi::PropertyBag* pPropertyBag, const gubi::Identifier& ePropertyId, const T& eValue ) { bool bReturn = false; if (pPropertyBag != NULL) { gubi::IProperty* pProperty = NULL; if (pPropertyBag->Find(ePropertyId, &pProperty) && pProperty->Size() == sizeof(T)) { bReturn = pProperty->WriteData(sizeof(T), (const void*)&eValue, NULL); } } return bReturn; } } #endif // _PROPERTY_UTILS_H_
/* Copyright (c) 2006, NIF File Format Library and Tools All rights reserved. Please see niflib.h for license. */ //-----------------------------------NOTICE----------------------------------// // Some of this file is automatically filled in by a Python script. Only // // add custom code in the designated areas or it will be overwritten during // // the next update. // //-----------------------------------NOTICE----------------------------------// #ifndef _NIPSYSGROWFADEMODIFIER_H_ #define _NIPSYSGROWFADEMODIFIER_H_ //--BEGIN FILE HEAD CUSTOM CODE--// //--END CUSTOM CODE--// #include "NiPSysModifier.h" namespace Niflib { class NiPSysGrowFadeModifier; typedef Ref<NiPSysGrowFadeModifier> NiPSysGrowFadeModifierRef; /*! * Particle modifier that controls the time it takes to grow a particle from Size=0 * to the specified Size in the emitter, and then back to 0. This modifer has no * control over alpha settings. */ class NiPSysGrowFadeModifier : public NiPSysModifier { public: /*! Constructor */ NIFLIB_API NiPSysGrowFadeModifier(); /*! Destructor */ NIFLIB_API virtual ~NiPSysGrowFadeModifier(); /*! * A constant value which uniquly identifies objects of this type. */ NIFLIB_API static const Type TYPE; /*! * A factory function used during file reading to create an instance of this type of object. * \return A pointer to a newly allocated instance of this type of object. */ NIFLIB_API static NiObject * Create(); /*! * Summarizes the information contained in this object in English. * \param[in] verbose Determines whether or not detailed information about large areas of data will be printed out. * \return A string containing a summary of the information within the object in English. This is the function that Niflyze calls to generate its analysis, so the output is the same. */ NIFLIB_API virtual string asString( bool verbose = false ) const; /*! * Used to determine the type of a particular instance of this object. * \return The type constant for the actual type of the object. */ NIFLIB_API virtual const Type & GetType() const; /***Begin Example Naive Implementation**** // Time in seconds to fade in. // \return The current value. float GetGrowTime() const; // Time in seconds to fade in. // \param[in] value The new value. void SetGrowTime( float value ); // Unknown. // \return The current value. unsigned short GetGrowGeneration() const; // Unknown. // \param[in] value The new value. void SetGrowGeneration( unsigned short value ); // Time in seconds to fade out. // \return The current value. float GetFadeTime() const; // Time in seconds to fade out. // \param[in] value The new value. void SetFadeTime( float value ); // Unknown. // \return The current value. unsigned short GetFadeGeneration() const; // Unknown. // \param[in] value The new value. void SetFadeGeneration( unsigned short value ); // Unknown // \return The current value. float GetBaseScale() const; // Unknown // \param[in] value The new value. void SetBaseScale( float value ); ****End Example Naive Implementation***/ //--BEGIN MISC CUSTOM CODE--// //--END CUSTOM CODE--// protected: /*! Time in seconds to fade in. */ float growTime; /*! Unknown. */ unsigned short growGeneration; /*! Time in seconds to fade out. */ float fadeTime; /*! Unknown. */ unsigned short fadeGeneration; /*! Unknown */ float baseScale; public: /*! NIFLIB_HIDDEN function. For internal use only. */ NIFLIB_HIDDEN virtual void Read( istream& in, list<unsigned int> & link_stack, const NifInfo & info ); /*! NIFLIB_HIDDEN function. For internal use only. */ NIFLIB_HIDDEN virtual void Write( ostream& out, const map<NiObjectRef,unsigned int> & link_map, list<NiObject *> & missing_link_stack, const NifInfo & info ) const; /*! NIFLIB_HIDDEN function. For internal use only. */ NIFLIB_HIDDEN virtual void FixLinks( const map<unsigned int,NiObjectRef> & objects, list<unsigned int> & link_stack, list<NiObjectRef> & missing_link_stack, const NifInfo & info ); /*! NIFLIB_HIDDEN function. For internal use only. */ NIFLIB_HIDDEN virtual list<NiObjectRef> GetRefs() const; /*! NIFLIB_HIDDEN function. For internal use only. */ NIFLIB_HIDDEN virtual list<NiObject *> GetPtrs() const; }; //--BEGIN FILE FOOT CUSTOM CODE--// //--END CUSTOM CODE--// } //End Niflib namespace #endif
/* * Copyright (C) Research In Motion Limited 2010. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_SVG_SVG_RESOURCES_CACHE_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_SVG_SVG_RESOURCES_CACHE_H_ #include <memory> #include "base/macros.h" #include "third_party/blink/renderer/core/style/style_difference.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" namespace blink { class LayoutObject; class ComputedStyle; class SVGResources; class SVGResourcesCache { USING_FAST_MALLOC(SVGResourcesCache); public: SVGResourcesCache(); ~SVGResourcesCache(); static SVGResources* CachedResourcesForLayoutObject(const LayoutObject&); // Called from all SVG layoutObjects addChild() methods. static void ClientWasAddedToTree(LayoutObject&); // Called from all SVG layoutObjects removeChild() methods. static void ClientWillBeRemovedFromTree(LayoutObject&); // Called from all SVG layoutObjects destroy() methods - except for // LayoutSVGResourceContainer. static void ClientDestroyed(LayoutObject&); // Called from all SVG layoutObjects layout() methods. static void ClientLayoutChanged(LayoutObject&); // Called from all SVG layoutObjects styleDidChange() methods. static void ClientStyleChanged(LayoutObject&, StyleDifference, const ComputedStyle& new_style); // Called when the target element of a resource referenced by the // LayoutObject may have changed. static void ResourceReferenceChanged(LayoutObject&); class TemporaryStyleScope { STACK_ALLOCATED(); public: TemporaryStyleScope(LayoutObject&, const ComputedStyle& original_style, const ComputedStyle& temporary_style); ~TemporaryStyleScope(); private: void SwitchTo(const ComputedStyle&); LayoutObject& layout_object_; const ComputedStyle& original_style_; const ComputedStyle& temporary_style_; const bool styles_are_equal_; DISALLOW_COPY_AND_ASSIGN(TemporaryStyleScope); }; private: struct ResourceUpdateInfo { bool changed; bool needs_layout; explicit operator bool() const { return changed; } }; SVGResources* AddResourcesFromLayoutObject(LayoutObject&, const ComputedStyle&); bool RemoveResourcesFromLayoutObject(LayoutObject&); ResourceUpdateInfo UpdateResourcesFromLayoutObject(LayoutObject&, const ComputedStyle&); typedef HashMap<const LayoutObject*, std::unique_ptr<SVGResources>> CacheMap; CacheMap cache_; DISALLOW_COPY_AND_ASSIGN(SVGResourcesCache); }; } // namespace blink #endif
/* libgvps === Copyright (c) 2015, Kanru Hua All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "gvps.h" #include <stdlib.h> #include <math.h> #define max(a, b) ((a) > (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b)) #define abs(x) ((x) > 0 ? (x) : (- (x))) #define nprestore 15 #define SAMPLED #undef STATIC #include "gvps_sampled.hc" #define STATIC #include "gvps_sampled.hc"
/* * Copyright 2020 Couchbase, Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include "clustertest.h" namespace cb::test { /// The UpgradeTest class create a 3 node cluster and a bucket without /// replication set up to allow for mocking that class UpgradeTest : public ClusterTest { public: static void SetUpTestCase(); static void TearDownTestCase() { bucket.reset(); ClusterTest::TearDownTestCase(); } protected: static std::shared_ptr<Bucket> bucket; }; } // namespace cb::test
/* $NetBSD: db_output.h,v 1.10.8.2 1999/04/12 21:27:08 pk Exp $ */ /* * Mach Operating System * Copyright (c) 1991,1990 Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. * * Carnegie Mellon requests users of this software to return to * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * * Author: David B. Golub, Carnegie Mellon University * Date: 8/90 */ /* * Printing routines for kernel debugger. */ void db_force_whitespace __P((void)); void db_putchar __P((int)); int db_print_position __P((void)); void db_printf __P((const char *, ...)) __kprintf_attribute__((__format__(__kprintf__,1,2))); void db_end_line __P((void));
// // Created by salmon on 16-12-31. // #ifndef SIMPLA_DATA_ALL_H #define SIMPLA_DATA_ALL_H #include "DataBlock.h" #include "DataEntity.h" #include "DataLight.h" #include "DataEntry.h" #include "DataTraits.h" namespace simpla { namespace data { /** * @addtogroup data Data * @brief Unified data/metadata model. * @details * ## Summary * ### Internal interface * - @ref DataEntity * - @ref DataLight * - @ref DataHeavy * - @ref DataType * - @ref DataSpace * - @ref DataSet * ### External interface * - @ref MPIDataType * - @ref HDF5DataTable * - @ref LuaDataTable * * @brief a @ref DataEntity tree, a key-value table of @ref DataEntity, which is similar as Group * in HDF5, all node/table are DataEntity. * @design_pattern * - Proxy for DataBackend * * PUT and POST are both unsafe methods. However, PUT is idempotent, while POST is not. * * HTTP/1.1 SPEC * @quota * The POST method is used to request that the origin server accept the entity enclosed in * the request as a new subordinate of the resource identified by the Request-URI in the Request-Line * * @quota * The PUT method requests that the enclosed entity be stored under the supplied Request-URI. * If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a * modified version of the one residing on the origin server. If the Request-URI does not point to an existing * resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin * server can create the resource with that URI." * */ } } #endif // SIMPLA_DATA_ALL_H
/***************************************************************************** Copyright (c) 2011, Intel Corp. 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 Intel 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 AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***************************************************************************** * Contents: Native middle-level C interface to LAPACK function dgecon * Author: Intel Corporation * Generated November, 2011 *****************************************************************************/ #include "lapacke.h" #include "lapacke_utils.h" lapack_int LAPACKE_dgecon_work( int matrix_order, char norm, lapack_int n, const double* a, lapack_int lda, double anorm, double* rcond, double* work, lapack_int* iwork ) { lapack_int info = 0; if( matrix_order == LAPACK_COL_MAJOR ) { /* Call LAPACK function and adjust info */ LAPACK_dgecon( &norm, &n, a, &lda, &anorm, rcond, work, iwork, &info ); if( info < 0 ) { info = info - 1; } } else if( matrix_order == LAPACK_ROW_MAJOR ) { lapack_int lda_t = MAX(1,n); double* a_t = NULL; /* Check leading dimension(s) */ if( lda < n ) { info = -5; LAPACKE_xerbla( "LAPACKE_dgecon_work", info ); return info; } /* Allocate memory for temporary array(s) */ a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,n) ); if( a_t == NULL ) { info = LAPACK_TRANSPOSE_MEMORY_ERROR; goto exit_level_0; } /* Transpose input matrices */ LAPACKE_dge_trans( matrix_order, n, n, a, lda, a_t, lda_t ); /* Call LAPACK function and adjust info */ LAPACK_dgecon( &norm, &n, a_t, &lda_t, &anorm, rcond, work, iwork, &info ); if( info < 0 ) { info = info - 1; } /* Release memory and exit */ LAPACKE_free( a_t ); exit_level_0: if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_dgecon_work", info ); } } else { info = -1; LAPACKE_xerbla( "LAPACKE_dgecon_work", info ); } return info; }
/***************************************************************************** Copyright (c) 2011, Intel Corp. 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 Intel 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 AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***************************************************************************** * Contents: Native middle-level C interface to LAPACK function zhpevx * Author: Intel Corporation * Generated November, 2011 *****************************************************************************/ #include "lapacke.h" #include "lapacke_utils.h" lapack_int LAPACKE_zhpevx_work( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_complex_double* ap, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int ldz, lapack_complex_double* work, double* rwork, lapack_int* iwork, lapack_int* ifail ) { lapack_int info = 0; if( matrix_order == LAPACK_COL_MAJOR ) { /* Call LAPACK function and adjust info */ LAPACK_zhpevx( &jobz, &range, &uplo, &n, ap, &vl, &vu, &il, &iu, &abstol, m, w, z, &ldz, work, rwork, iwork, ifail, &info ); if( info < 0 ) { info = info - 1; } } else if( matrix_order == LAPACK_ROW_MAJOR ) { lapack_int ncols_z = ( LAPACKE_lsame( range, 'a' ) || LAPACKE_lsame( range, 'v' ) ) ? n : ( LAPACKE_lsame( range, 'i' ) ? (iu-il+1) : 1); lapack_int ldz_t = MAX(1,n); lapack_complex_double* z_t = NULL; lapack_complex_double* ap_t = NULL; /* Check leading dimension(s) */ if( ldz < ncols_z ) { info = -15; LAPACKE_xerbla( "LAPACKE_zhpevx_work", info ); return info; } /* Allocate memory for temporary array(s) */ if( LAPACKE_lsame( jobz, 'v' ) ) { z_t = (lapack_complex_double*) LAPACKE_malloc( sizeof(lapack_complex_double) * ldz_t * MAX(1,ncols_z) ); if( z_t == NULL ) { info = LAPACK_TRANSPOSE_MEMORY_ERROR; goto exit_level_0; } } ap_t = (lapack_complex_double*) LAPACKE_malloc( sizeof(lapack_complex_double) * ( MAX(1,n) * MAX(2,n+1) ) / 2 ); if( ap_t == NULL ) { info = LAPACK_TRANSPOSE_MEMORY_ERROR; goto exit_level_1; } /* Transpose input matrices */ LAPACKE_zhp_trans( matrix_order, uplo, n, ap, ap_t ); /* Call LAPACK function and adjust info */ LAPACK_zhpevx( &jobz, &range, &uplo, &n, ap_t, &vl, &vu, &il, &iu, &abstol, m, w, z_t, &ldz_t, work, rwork, iwork, ifail, &info ); if( info < 0 ) { info = info - 1; } /* Transpose output matrices */ if( LAPACKE_lsame( jobz, 'v' ) ) { LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, ncols_z, z_t, ldz_t, z, ldz ); } LAPACKE_zhp_trans( LAPACK_COL_MAJOR, uplo, n, ap_t, ap ); /* Release memory and exit */ LAPACKE_free( ap_t ); exit_level_1: if( LAPACKE_lsame( jobz, 'v' ) ) { LAPACKE_free( z_t ); } exit_level_0: if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_zhpevx_work", info ); } } else { info = -1; LAPACKE_xerbla( "LAPACKE_zhpevx_work", info ); } return info; }
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_RENDERER_EXTENSIONS_FILE_BROWSER_HANDLER_CUSTOM_BINDINGS_H_ #define CHROME_RENDERER_EXTENSIONS_FILE_BROWSER_HANDLER_CUSTOM_BINDINGS_H_ #include "base/compiler_specific.h" #include "base/macros.h" #include "extensions/renderer/object_backed_native_handler.h" namespace extensions { // Custom bindings for the fileBrowserHandler API. class FileBrowserHandlerCustomBindings : public ObjectBackedNativeHandler { public: explicit FileBrowserHandlerCustomBindings(ScriptContext* context); FileBrowserHandlerCustomBindings(const FileBrowserHandlerCustomBindings&) = delete; FileBrowserHandlerCustomBindings& operator=( const FileBrowserHandlerCustomBindings&) = delete; // ObjectBackedNativeHandler: void AddRoutes() override; // Public static implementation of GetExternalFileEntry() for use by // FileManagerPrivate native handler. static void GetExternalFileEntry( const v8::FunctionCallbackInfo<v8::Value>& args, ScriptContext* context); private: void GetExternalFileEntryCallback( const v8::FunctionCallbackInfo<v8::Value>& args); }; } // namespace extensions #endif // CHROME_RENDERER_EXTENSIONS_FILE_BROWSER_HANDLER_CUSTOM_BINDINGS_H_
#ifndef OPENGLAPI_GFX_GLBLENDCONTROLLER_H #define OPENGLAPI_GFX_GLBLENDCONTROLLER_H #include <GL/glew.h> #include "pbge/gfx/BlendController.h" namespace pbge { class GLBlendController : public BlendController { public: GLBlendController(); void enableBlending(); void disableBlending(); void useBlendFunc(BlendFunc srcFunc, BlendFunc dstFunc); void useBlendFuncSeparate(BlendFunc srcFunc, BlendFunc dstFunc, BlendFunc srcFuncAlpha, BlendFunc dstFuncAlpha); void useBlendEquation(BlendEquation equation); private: bool blendEnabled; GLenum translateBlendFunc(BlendController::BlendFunc func); BlendController::BlendFunc srcFunc; BlendController::BlendFunc dstFunc; BlendController::BlendFunc srcFuncAlpha; BlendController::BlendFunc dstFuncAlpha; BlendController::BlendEquation equation; }; } #endif
// -*- C++ -*- //============================================================================= /** * @file ParserContext.h * * @author Krishnakumar B <kitty@cs.wustl.edu> */ //============================================================================= #ifndef ACEXML_PARSER_CONTEXT_H #define ACEXML_PARSER_CONTEXT_H #include /**/ "ace/pre.h" #include "ACEXML/parser/parser/Parser_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/XML_Types.h" #include "ACEXML/common/InputSource.h" #include "ACEXML/common/Locator.h" #include "ACEXML/common/LocatorImpl.h" #include "ace/Functor.h" #include "ace/Containers_T.h" class ACEXML_PARSER_Export ACEXML_Parser_Context { public: /// Default constructor ACEXML_Parser_Context(); /// Constructor which initializes the context ACEXML_Parser_Context (ACEXML_InputSource* instream, ACEXML_LocatorImpl* locator); /// Comparison operator bool operator!= (const ACEXML_Parser_Context& src); /// Destructor virtual ~ACEXML_Parser_Context(); /// Reset the parser context. This does not free up the memory. Only sets /// it to zero. Meant to be called after a context is pushed on to a /// stack. void reset (void); /// Get the underlying input source. virtual ACEXML_InputSource* getInputSource(void); /// Get the underlying locator. virtual ACEXML_LocatorImpl* getLocator(void); /// Set the underlying input source. virtual void setInputSource(ACEXML_InputSource* ip); /// Set the underlying locator. virtual void setLocator(ACEXML_LocatorImpl* locator); private: /// Copy constructor ACEXML_Parser_Context (const ACEXML_Parser_Context& src); /// Assignment operator ACEXML_Parser_Context& operator= (const ACEXML_Parser_Context& src); /// Current input char stream. ACEXML_InputSource *instream_; /// Current Locator which provides line no., column no. systemId and publicId ACEXML_LocatorImpl* locator_; }; #if defined (__ACEXML_INLINE__) # include "ACEXML/parser/parser/ParserContext.inl" #endif /* __ACEXML_INLINE__ */ #include /**/ "ace/post.h" #endif /* ACEXML_PARSER_CONTEXT_H */
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef MOJO_EDK_SYSTEM_WAITER_TEST_UTILS_H_ #define MOJO_EDK_SYSTEM_WAITER_TEST_UTILS_H_ #include <stdint.h> #include "base/memory/ref_counted.h" #include "base/threading/simple_thread.h" #include "mojo/edk/system/dispatcher.h" #include "mojo/edk/system/handle_signals_state.h" #include "mojo/edk/system/waiter.h" #include "mojo/public/c/system/types.h" #include "mojo/public/cpp/system/macros.h" namespace mojo { namespace edk { namespace test { // This is a very simple thread that has a |Waiter|, on which it waits // indefinitely (and records the result). It will create and initialize the // |Waiter| on creation, but the caller must start the thread with |Start()|. It // will join the thread on destruction. // // One usually uses it like: // // MojoResult result; // { // AwakableList awakable_list; // test::SimpleWaiterThread thread(&result); // awakable_list.Add(thread.waiter(), ...); // thread.Start(); // ... some stuff to wake the waiter ... // awakable_list.Remove(thread.waiter()); // } // Join |thread|. // EXPECT_EQ(..., result); // // There's a bit of unrealism in its use: In this sort of usage, calls such as // |Waiter::Init()|, |AddAwakable()|, and |RemoveAwakable()| are done in the // main (test) thread, not the waiter thread (as would actually happen in real // code). (We accept this unrealism for simplicity, since |AwakableList| is // thread-unsafe so making it more realistic would require adding nontrivial // synchronization machinery.) class SimpleWaiterThread : public base::SimpleThread { public: // For the duration of the lifetime of this object, |*result| belongs to it // (in the sense that it will write to it whenever it wants). SimpleWaiterThread(MojoResult* result, uintptr_t* context); ~SimpleWaiterThread() override; // Joins the thread. Waiter* waiter() { return &waiter_; } private: void Run() override; MojoResult* const result_; uintptr_t* const context_; Waiter waiter_; DISALLOW_COPY_AND_ASSIGN(SimpleWaiterThread); }; // This is a more complex and realistic thread that has a |Waiter|, on which it // waits for the given deadline (with the given flags). Unlike // |SimpleWaiterThread|, it requires the machinery of |Dispatcher|. class WaiterThread : public base::SimpleThread { public: // Note: |*did_wait_out|, |*result_out|, |*context_out| and // |*signals_state_out| "belong" to this object (i.e., may be modified by, on // some other thread) while it's alive. WaiterThread(scoped_refptr<Dispatcher> dispatcher, MojoHandleSignals handle_signals, MojoDeadline deadline, uintptr_t context, bool* did_wait_out, MojoResult* result_out, uintptr_t* context_out, HandleSignalsState* signals_state_out); ~WaiterThread() override; private: void Run() override; const scoped_refptr<Dispatcher> dispatcher_; const MojoHandleSignals handle_signals_; const MojoDeadline deadline_; const uint32_t context_; bool* const did_wait_out_; MojoResult* const result_out_; uintptr_t* const context_out_; HandleSignalsState* const signals_state_out_; Waiter waiter_; DISALLOW_COPY_AND_ASSIGN(WaiterThread); }; } // namespace test } // namespace edk } // namespace mojo #endif // MOJO_EDK_SYSTEM_WAITER_TEST_UTILS_H_
/* $OpenBSD: ncr5380var.h,v 1.1 1996/05/26 19:02:08 briggs Exp $ */ /* $NetBSD: ncr5380var.h,v 1.2 1996/05/25 16:42:31 briggs Exp $ */ /* * Copyright (c) 1995 Allen Briggs. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Allen Briggs. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ static volatile u_char *scsi_enable = NULL; static volatile u_char *scsi_flag = NULL; static __inline__ void scsi_clear_drq __P((void)) { int s; s = splhigh(); *scsi_flag = 0x80 | V2IF_SCSIDRQ; splx(s); } static __inline__ void scsi_clear_irq __P((void)) { int s; s = splhigh(); *scsi_flag = 0x80 | V2IF_SCSIIRQ; splx(s); } static __inline__ void scsi_ienable __P((void)) { int s; s = splhigh(); *scsi_enable = 0x80 | (V2IF_SCSIIRQ | V2IF_SCSIDRQ); splx(s); } static __inline__ void scsi_idisable __P((void)) { int s; s = splhigh(); *scsi_enable = V2IF_SCSIIRQ | V2IF_SCSIDRQ; splx(s); } void pdma_stat __P((void)); void pdma_cleanup __P((void)); void scsi_show __P((void));
#pragma once #include <map> #include <string> #include <cstdint> #include <vector> #include <memory> #include "Array.h" // This is an immutable "shared string" class which if very memory-efficient to represent many // copies of the same strings. Copying a CompactString only creates a few extra bytes to track // the internal shared string data. Even constructing a new CompactString that matches existing // ones will not allocate a duplicate copy of the string's bytes, since an internal hash map is // used to eliminate all string duplication. Bonus feature: A SharedString also stores the string's // hash, so getting the hash of a SharedString is very fast constant time. class PooledString { public: PooledString(const std::string& val = ""); PooledString(const char* cstr); std::string get() { return *m_str; } const std::string& get() const { return *m_str; } ArrayView<uint8_t> getBytes() const { return ArrayView<uint8_t>( (const uint8_t*)m_str->data(), int(m_str->size() * sizeof((*m_str)[0])) ); } uint64_t getHash() const { return m_hash; } bool operator< (const PooledString& other) const { return *m_str < *other.m_str; } bool operator<= (const PooledString& other) const { return *m_str <= *other.m_str; } bool operator>= (const PooledString& other) const { return *m_str >= *other.m_str; } bool operator>(const PooledString& other) const { return *m_str > *other.m_str; } bool operator== (const PooledString& other) const { return getHash() == other.getHash() && *m_str == *other.m_str; } bool operator!= (const PooledString& other) const { return getHash() != other.getHash() || *m_str != *other.m_str; } private: std::shared_ptr<std::string> m_str; uint64_t m_hash; }; // Implement std::hash for SharedString so it can be used in hash maps, sets, etc namespace std { template <> struct hash<PooledString> { size_t operator()(const PooledString& x) const { return x.getHash(); } }; }
/** * Copyright (c) 2015-present, Horcrux. * All rights reserved. * * This source code is licensed under the MIT-style license found in the * LICENSE file in the root directory of this source tree. */ #import <CoreGraphics/CoreGraphics.h> #import <Foundation/Foundation.h> #import "ABI39_0_0RNSVGPainter.h" @interface ABI39_0_0RNSVGBrush : NSObject @property (nonatomic, strong) NSString* brushRef; /* @abstract */ - (instancetype)initWithArray:(NSArray *)data; /** * @abstract * For certain brushes we can fast path a combined fill and stroke. * For those brushes we override applyFillColor which sets the fill * color to be used by those batch paints. Those return YES. * We can't batch gradient painting in CoreGraphics, so those will * return NO and paint gets called instead. */ - (BOOL)applyFillColor:(CGContextRef)context opacity:(CGFloat)opacity; - (BOOL)applyStrokeColor:(CGContextRef)context opacity:(CGFloat)opacity; - (CGColorRef)getColorWithOpacity:(CGFloat)opacity; /** * @abstract * paint fills the context with a brush. The context is assumed to * be clipped. */ - (void)paint:(CGContextRef)context opacity:(CGFloat)opacity painter:(ABI39_0_0RNSVGPainter *)painter bounds:(CGRect)bounds; @end
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE789_Uncontrolled_Mem_Alloc__malloc_char_fgets_65b.c Label Definition File: CWE789_Uncontrolled_Mem_Alloc__malloc.label.xml Template File: sources-sinks-65b.tmpl.c */ /* * @description * CWE: 789 Uncontrolled Memory Allocation * BadSource: fgets Read data from the console using fgets() * GoodSource: Small number greater than zero * Sinks: * GoodSink: Allocate memory with malloc() and check the size of the memory to be allocated * BadSink : Allocate memory with malloc(), but incorrectly check the size of the memory to be allocated * Flow Variant: 65 Data/control flow: data passed as an argument from one function to a function in a different source file called via a function pointer * * */ #include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #define CHAR_ARRAY_SIZE (3 * sizeof(data) + 2) #define HELLO_STRING "hello" #ifndef OMITBAD void CWE789_Uncontrolled_Mem_Alloc__malloc_char_fgets_65b_badSink(size_t data) { { char * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the strcpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > strlen(HELLO_STRING)) { myString = (char *)malloc(data*sizeof(char)); if (myString == NULL) {exit(-1);} /* Copy a small string into myString */ strcpy(myString, HELLO_STRING); printLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE789_Uncontrolled_Mem_Alloc__malloc_char_fgets_65b_goodG2BSink(size_t data) { { char * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the strcpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > strlen(HELLO_STRING)) { myString = (char *)malloc(data*sizeof(char)); if (myString == NULL) {exit(-1);} /* Copy a small string into myString */ strcpy(myString, HELLO_STRING); printLine(myString); free(myString); } else { printLine("Input is less than the length of the source string"); } } } /* goodB2G uses the BadSource with the GoodSink */ void CWE789_Uncontrolled_Mem_Alloc__malloc_char_fgets_65b_goodB2GSink(size_t data) { { char * myString; /* FIX: Include a MAXIMUM limitation for memory allocation and a check to ensure data is large enough * for the strcpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > strlen(HELLO_STRING) && data < 100) { myString = (char *)malloc(data*sizeof(char)); if (myString == NULL) {exit(-1);} /* Copy a small string into myString */ strcpy(myString, HELLO_STRING); printLine(myString); free(myString); } else { printLine("Input is less than the length of the source string or too large"); } } } #endif /* OMITGOOD */
/* * AbstractParameterGroupWidget.h * * Copyright (C) 2021 by Universitaet Stuttgart (VIS). * Alle Rechte vorbehalten. */ #ifndef MEGAMOL_GUI_ABSTARCTPARAMETERGROUPWIDGET_INCLUDED #define MEGAMOL_GUI_ABSTARCTPARAMETERGROUPWIDGET_INCLUDED #pragma once #include "graph/Parameter.h" #include "mmcore/utility/Picking.h" namespace megamol { namespace gui { /** ************************************************************************ * Animation widget for parameter group */ class AbstractParameterGroupWidget : public megamol::core::param::AbstractParamPresentation { public: typedef std::vector<megamol::gui::Parameter*> ParamPtrVector_t; ~AbstractParameterGroupWidget() override = default; virtual bool Check(bool only_check, ParamPtrVector_t& params) = 0; virtual bool Draw(ParamPtrVector_t params, const std::string& in_search, megamol::gui::Parameter::WidgetScope in_scope, megamol::core::utility::PickingBuffer* inout_picking_buffer, ImGuiID in_override_header_state) = 0; bool IsActive() const { return this->active; } void SetActive(bool a) { this->active = a; } std::string GetName() const { return this->name; }; protected: // VARIABLES ---------------------------------------------------------- bool active; std::string name; const ImGuiID uid; // FUNCTIONS ---------------------------------------------------------- explicit AbstractParameterGroupWidget(ImGuiID uid) : megamol::core::param::AbstractParamPresentation() , active(false) , name() , uid(uid){}; }; } // namespace gui } // namespace megamol #endif // MEGAMOL_GUI_ABSTARCTPARAMETERGROUPWIDGET_INCLUDED
#pragma once #ifndef VECTORIZER_SWATCH_H #define VECTORIZER_SWATCH_H // Toonz includes #include "tthread.h" #include "timage.h" #include "toonz/tcenterlinevectorizer.h" #include "toonzqt/planeviewer.h" // Qt includes #include <QFrame> #include <memory> //***************************************************************************** // VectorizerSwatchArea declaration //***************************************************************************** class VectorizerSwatchArea : public QFrame { Q_OBJECT public: class Swatch; private: Swatch *m_leftSwatch, *m_rightSwatch; public: VectorizerSwatchArea(QWidget *parent = 0); void updateView(const TAffine &viewAff); void resetView(); const Swatch *leftSwatch() const { return m_leftSwatch; } Swatch *leftSwatch() { return m_leftSwatch; } const Swatch *rightSwatch() const { return m_rightSwatch; } Swatch *rightSwatch() { return m_rightSwatch; } protected: void connectUpdates(); void disconnectUpdates(); void showEvent(QShowEvent *se); // { connectUpdates(); } void hideEvent(QHideEvent *he); // { disconnectUpdates(); } public slots: void updateContents(); void invalidateContents(); void enablePreview(bool enable); void enableDrawCenterlines(bool enable); }; //***************************************************************************** // VectorizerSwatchArea::Swatch declaration //***************************************************************************** class VectorizerSwatchArea::Swatch : public PlaneViewer { TImageP m_img; VectorizerSwatchArea *m_area; bool m_drawVectors; bool m_drawInProgress; public: Swatch(VectorizerSwatchArea *area); const TImageP &image() const { return m_img; } TImageP &image() { return m_img; } void setDrawVectors(bool draw) { m_drawVectors = draw; } void setDrawInProgress(bool draw) { m_drawInProgress = draw; } protected: bool event(QEvent *e) override; void paintGL() override; void drawVectors(); void drawInProgress(); }; //***************************************************************************** // VectorizationSwatchTask declaration - Private class //***************************************************************************** class VectorizationSwatchTask : public TThread::Runnable { Q_OBJECT int m_row, m_col; TImageP m_image; std::auto_ptr<VectorizerConfiguration> m_config; public: VectorizationSwatchTask(int row, int col); void run(); void onStarted(TThread::RunnableP task); void onFinished(TThread::RunnableP task); signals: void myStarted(TThread::RunnableP task); private: // Not copyable VectorizationSwatchTask(const VectorizationSwatchTask &); VectorizationSwatchTask &operator=(const VectorizationSwatchTask &); }; #endif // VECTORIZER_SWATCH_H
/* This file is part of fotix * Copyright (c) 2013 Fotis Koutoulakis * * isr.c -- High level interrupt service routines and * interrupt request handlers. */ #include "include/common.h" #include "include/isr.h" #include "include/monitor.h" isr_t interrupt_handlers[256]; void register_interrupt_handler (u8int num, isr_t handler) { interrupt_handlers[num] = handler; } /* This get's called from our ASM interrupt handler stub. */ void isr_handler (registers_t regs) { /** * This line is important. When the processor extends the 8-bit interrupt number * to a 32bit value, it sign-extends, not zero extends. So if the most significant * bit (0x80) is set, regs.int_no will be very large (about 0xffffff80). */ u8int int_no = regs.int_no & 0xFF; if (interrupt_handlers[int_no] != 0) { isr_t handler = interrupt_handlers[int_no]; handler (&regs); } else { monitor_write ("unhandled interrupt:\n"); monitor_write (" hex: "); monitor_write_hex (int_no); monitor_put ('\n'); monitor_write (" dec: "); monitor_write_dec (int_no); monitor_put ('\n'); PANIC ("UNABLE TO FIND HANDLER FOR INTERRUPT"); } } /* This get's called from our ASM interrupt handler stub. */ void irq_handler (registers_t regs) { /* Send an EOI (end of interrupt) signal to the PICS. if the IRQ was > 7 (interrupt number > 40), send a signal to the slave. In either way send one to the master too. */ if (regs.int_no >= 40) { /* Send reset signal to slave */ outb (0xA0, 0x20); } /* Send reset signal to master */ outb (0x20, 0x20); if (interrupt_handlers[regs.int_no] != 0) { isr_t handler = interrupt_handlers[regs.int_no]; handler (&regs); } }
/* Copyright (c) 2011, The Mineserver Project All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the The Mineserver Project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 MINESERVER_NETWORK_PACKET_0x2B_H #define MINESERVER_NETWORK_PACKET_0x2B_H #include <mineserver/byteorder.h> #include <mineserver/network/message.h> namespace Mineserver { struct Network_Message_0x2B : public Mineserver::Network_Message { int8_t currentExperience; int8_t level; int16_t totalExperience; }; } #endif
// Copyright 2018-present 650 Industries. All rights reserved. #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BEGIN @protocol ABI38_0_0EXPushTokenListener - (void)onDidRegisterWithDeviceToken:(NSData *)token; - (void)onDidFailToRegisterWithError:(NSError *)error; @end NS_ASSUME_NONNULL_END
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_POLICY_CORE_COMMON_REMOTE_COMMANDS_REMOTE_COMMANDS_FACTORY_H_ #define COMPONENTS_POLICY_CORE_COMMON_REMOTE_COMMANDS_REMOTE_COMMANDS_FACTORY_H_ #include <memory> #include "base/macros.h" #include "components/policy/policy_export.h" #include "components/policy/proto/device_management_backend.pb.h" namespace policy { class RemoteCommandJob; class RemoteCommandsService; // An interface class for creating remote commands based on command type. class POLICY_EXPORT RemoteCommandsFactory { public: RemoteCommandsFactory& operator=(const RemoteCommandsFactory&) = delete; virtual ~RemoteCommandsFactory(); virtual std::unique_ptr<RemoteCommandJob> BuildJobForType( enterprise_management::RemoteCommand_Type type, RemoteCommandsService* service) = 0; }; } // namespace policy #endif // COMPONENTS_POLICY_CORE_COMMON_REMOTE_COMMANDS_REMOTE_COMMANDS_FACTORY_H_
/* `NAN' constant for IEEE 754 machines. Copyright (C) 1992,1996,1997,1999,2004,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef _MATH_H # error "Never use <bits/nan.h> directly; include <math.h> instead." #endif /* IEEE Not A Number. */ #if __GNUC_PREREQ(3,3) # define NAN (__builtin_nanf ("")) #elif defined __GNUC__ # define NAN \ (__extension__ \ ((union { unsigned __l __attribute__ ((__mode__ (__SI__))); float __d; }) \ { __l: 0x7fc00000UL }).__d) #else # include <endian.h> # if __BYTE_ORDER == __BIG_ENDIAN # define __nan_bytes { 0x7f, 0xc0, 0, 0 } # endif # if __BYTE_ORDER == __LITTLE_ENDIAN # define __nan_bytes { 0, 0, 0xc0, 0x7f } # endif //static union { unsigned char __c[4]; float __d; } __nan_union // 02/05/10, RD. // __attribute_used__ = { __nan_bytes }; // 02/05/10, RD. # define NAN (__nan_union.__d) #endif /* GCC. */
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #import <UIKit/UIKit.h> #import <ABI41_0_0React/ABI41_0_0RCTDefines.h> #import <ABI41_0_0yoga/ABI41_0_0Yoga.h> NS_ASSUME_NONNULL_BEGIN @class ABI41_0_0RCTShadowView; typedef NS_ENUM(NSInteger, ABI41_0_0RCTDisplayType) { ABI41_0_0RCTDisplayTypeNone, ABI41_0_0RCTDisplayTypeFlex, ABI41_0_0RCTDisplayTypeInline, }; struct ABI41_0_0RCTLayoutMetrics { CGRect frame; CGRect contentFrame; UIEdgeInsets borderWidth; ABI41_0_0RCTDisplayType displayType; UIUserInterfaceLayoutDirection layoutDirection; }; typedef struct CG_BOXABLE ABI41_0_0RCTLayoutMetrics ABI41_0_0RCTLayoutMetrics; struct ABI41_0_0RCTLayoutContext { CGPoint absolutePosition; __unsafe_unretained NSHashTable<ABI41_0_0RCTShadowView *> *_Nonnull affectedShadowViews; __unsafe_unretained NSHashTable<NSString *> *_Nonnull other; }; typedef struct CG_BOXABLE ABI41_0_0RCTLayoutContext ABI41_0_0RCTLayoutContext; static inline BOOL ABI41_0_0RCTLayoutMetricsEqualToLayoutMetrics(ABI41_0_0RCTLayoutMetrics a, ABI41_0_0RCTLayoutMetrics b) { return CGRectEqualToRect(a.frame, b.frame) && CGRectEqualToRect(a.contentFrame, b.contentFrame) && UIEdgeInsetsEqualToEdgeInsets(a.borderWidth, b.borderWidth) && a.displayType == b.displayType && a.layoutDirection == b.layoutDirection; } ABI41_0_0RCT_EXTERN ABI41_0_0RCTLayoutMetrics ABI41_0_0RCTLayoutMetricsFromYogaNode(ABI41_0_0YGNodeRef yogaNode); /** * Converts float values between Yoga and CoreGraphics representations, * especially in terms of edge cases. */ ABI41_0_0RCT_EXTERN float ABI41_0_0RCTYogaFloatFromCoreGraphicsFloat(CGFloat value); ABI41_0_0RCT_EXTERN CGFloat ABI41_0_0RCTCoreGraphicsFloatFromYogaFloat(float value); /** * Converts compound `ABI41_0_0YGValue` to simple `CGFloat` value. */ ABI41_0_0RCT_EXTERN CGFloat ABI41_0_0RCTCoreGraphicsFloatFromYogaValue(ABI41_0_0YGValue value, CGFloat baseFloatValue); /** * Converts `ABI41_0_0YGDirection` to `UIUserInterfaceLayoutDirection` and vise versa. */ ABI41_0_0RCT_EXTERN ABI41_0_0YGDirection ABI41_0_0RCTYogaLayoutDirectionFromUIKitLayoutDirection(UIUserInterfaceLayoutDirection direction); ABI41_0_0RCT_EXTERN UIUserInterfaceLayoutDirection ABI41_0_0RCTUIKitLayoutDirectionFromYogaLayoutDirection(ABI41_0_0YGDirection direction); /** * Converts `ABI41_0_0YGDisplay` to `ABI41_0_0RCTDisplayType` and vise versa. */ ABI41_0_0RCT_EXTERN ABI41_0_0YGDisplay ABI41_0_0RCTYogaDisplayTypeFromABI41_0_0ReactDisplayType(ABI41_0_0RCTDisplayType displayType); ABI41_0_0RCT_EXTERN ABI41_0_0RCTDisplayType ABI41_0_0RCTABI41_0_0ReactDisplayTypeFromYogaDisplayType(ABI41_0_0YGDisplay displayType); NS_ASSUME_NONNULL_END
/* * FreeRTOS Kernel V10.1.1 * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 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. * * http://www.FreeRTOS.org * http://aws.amazon.com/freertos * * 1 tab == 4 spaces! */ #ifndef FREERTOS_CONFIG_H #define FREERTOS_CONFIG_H /* only include in C files */ #ifdef __IAR_SYSTEMS_ICC__ #pragma language=extended #pragma system_include #include <intrinsics.h> #endif /* __IAR_SYSTEMS_ICC__ */ /* V850ES/Fx3 Memory Model * 1 = Tiny data model * 0 = Small/Large data model */ #define configDATA_MODE 0 /* * Application specific definitions. * * These definitions should be adjusted for your particular hardware and * application requirements. * * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. */ #define configUSE_PREEMPTION 1 /* only include in C files */ #ifdef __IAR_SYSTEMS_ICC__ #define configUSE_IDLE_HOOK 0 #define configUSE_TICK_HOOK 0 #define configTICK_RATE_HZ ( ( TickType_t ) 1000 ) #define configMAX_PRIORITIES ( 4 ) #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 85 ) #define configMAX_TASK_NAME_LEN ( 10 ) #define configUSE_TRACE_FACILITY 0 #define configUSE_16_BIT_TICKS 0 #define configIDLE_SHOULD_YIELD 0 #define configUSE_CO_ROUTINES 0 #define configUSE_MUTEXES 1 #define configCHECK_FOR_STACK_OVERFLOW 2 #define configUSE_RECURSIVE_MUTEXES 1 #define configQUEUE_REGISTRY_SIZE 0 #define configUSE_COUNTING_SEMAPHORES 0 /* Co-routine definitions. */ #define configUSE_CO_ROUTINES 0 #define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) /* Set the following definitions to 1 to include the API function, or zero to exclude the API function. */ #define INCLUDE_vTaskPrioritySet 1 #define INCLUDE_uxTaskPriorityGet 1 #define INCLUDE_vTaskDelete 1 #define INCLUDE_vTaskCleanUpResources 0 #define INCLUDE_vTaskSuspend 1 #define INCLUDE_vTaskDelayUntil 1 #define INCLUDE_vTaskDelay 1 /* This IAR workspace contains several different projects - each of which is targeted at a different device variant. The definitions past this point are dependent on the variant being used. */ #ifdef __IAR_V850ES_Fx3__ #include "io70f3385.h" #define configTOTAL_HEAP_SIZE ( (size_t ) ( 20000 ) ) #define configCPU_CLOCK_HZ ( ( unsigned long ) 48000000 ) #endif #ifdef __IAR_V850ES_Jx3__ #include "io70f3746.h" #define configTOTAL_HEAP_SIZE ( (size_t ) ( 9000 ) ) #define configCPU_CLOCK_HZ ( ( unsigned long ) 16000000 ) #endif #ifdef __IAR_V850ES_Jx3_L__ #include "io70f3738.h" #define configTOTAL_HEAP_SIZE ( (size_t ) ( 9000 ) ) #define configCPU_CLOCK_HZ ( ( unsigned long ) 20000000 ) #endif #ifdef __IAR_V850ES_Jx2__ #include "io70f3717.h" #define configTOTAL_HEAP_SIZE ( (size_t ) ( 9000 ) ) #define configCPU_CLOCK_HZ ( ( unsigned long ) 20000000 ) #endif #ifdef __IAR_V850ES_Hx2__ #include "io70f3707.h" #define configTOTAL_HEAP_SIZE ( (size_t ) ( 9000 ) ) #define configCPU_CLOCK_HZ ( ( unsigned long ) 20000000 ) #endif #endif /* __IAR_SYSTEMS_ICC__ */ #endif /* FREERTOS_CONFIG_H */
/* * shamelessly ripped from http://locklessinc.com/articles/mandelbrot/ * * THANKS A MILLION to the original authors. ;) */ #include <math.h> #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <pthread.h> #include <err.h> #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xutil.h> /* X11 data */ static Display *dpy; static Window win; static XImage *bitmap; static Atom wmDeleteMessage; static GC gc; static void exit_x11(void) { XDestroyImage(bitmap); XDestroyWindow(dpy, win); XCloseDisplay(dpy); } static void init_x11(int size) { int bytes_per_pixel; /* Attempt to open the display */ dpy = XOpenDisplay(NULL); /* Failure */ if (!dpy) exit(0); unsigned long white = WhitePixel(dpy,DefaultScreen(dpy)); unsigned long black = BlackPixel(dpy,DefaultScreen(dpy)); win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, size, size, 0, black, white); /* We want to be notified when the window appears */ XSelectInput(dpy, win, StructureNotifyMask); /* Make it appear */ XMapWindow(dpy, win); while (1) { XEvent e; XNextEvent(dpy, &e); if (e.type == MapNotify) break; } XTextProperty tp; char name[128] = "Mandelbrot"; char *n = name; Status st = XStringListToTextProperty(&n, 1, &tp); if (st) XSetWMName(dpy, win, &tp); /* Wait for the MapNotify event */ XFlush(dpy); int ii, jj; int depth = DefaultDepth(dpy, DefaultScreen(dpy)); Visual *visual = DefaultVisual(dpy, DefaultScreen(dpy)); int total; /* Determine total bytes needed for image */ ii = 1; jj = (depth - 1) >> 2; while (jj >>= 1) ii <<= 1; /* Pad the scanline to a multiple of 4 bytes */ total = size * ii; total = (total + 3) & ~3; total *= size; bytes_per_pixel = ii; if (bytes_per_pixel != 4) { printf("Need 32bit colour screen!"); } /* Make bitmap */ bitmap = XCreateImage(dpy, visual, depth, ZPixmap, 0, malloc(total), size, size, 32, 0); /* Init GC */ gc = XCreateGC(dpy, win, 0, NULL); XSetForeground(dpy, gc, black); if (bytes_per_pixel != 4) { printf("Need 32bit colour screen!\n"); exit_x11(); exit(0); } XSelectInput(dpy, win, ExposureMask | KeyPressMask | StructureNotifyMask); wmDeleteMessage = XInternAtom(dpy, "WM_DELETE_WINDOW", False); XSetWMProtocols(dpy, win, &wmDeleteMessage, 1); } #define MAX_ITER (1 << 14) static unsigned cols[MAX_ITER + 1]; static void init_colours(void) { int i; for (i = 0; i < MAX_ITER; i++) { char r = (rand() & 0xff) * MAX_ITER / (i + MAX_ITER + 1); char g = (rand() & 0xff) * MAX_ITER / (i + MAX_ITER + 1); char b = (rand() & 0xff) * MAX_ITER / (i + MAX_ITER + 1); cols[i] = b + 256 * g + 256 * 256 * r; } cols[MAX_ITER] = 0; } static unsigned mandel_float(float cr, float ci) { float zr = cr, zi = ci; float tmp; unsigned i; for (i = 0; i < MAX_ITER; i++) { tmp = zr * zr - zi * zi + cr; zi *= 2 * zr; zi += ci; zr = tmp; if (zr * zr + zi * zi > 4.0) break; } return i; } /* For each point, evaluate its colour */ static void display_float(int size, float xmin, float xmax, float ymin, float ymax) { int x, y; float cr, ci; float xscal = (xmax - xmin) / size; float yscal = (ymax - ymin) / size; unsigned counts; for (y = 0; y < size; y++) { for (x = 0; x < size; x++) { cr = xmin + x * xscal; ci = ymin + y * yscal; counts = mandel_float(cr, ci); ((unsigned *) bitmap->data)[x + y*size] = cols[counts]; } /* Display it line-by-line for speed */ XPutImage(dpy, win, gc, bitmap, 0, y, 0, y, size, 1); } XFlush(dpy); } /* Image size */ #define ASIZE 1000 /* Comment out this for benchmarking */ #define WAIT_EXIT int main(void) { float xmin = -2; float xmax = 1.0; float ymin = -1.5; float ymax = 1.5; /* Make a window! */ init_x11(ASIZE); init_colours(); display_float(ASIZE, xmin, xmax, ymin, ymax); #ifdef WAIT_EXIT while(1) { XEvent event; KeySym key; char text[255]; XNextEvent(dpy, &event); /* Just redraw everything on expose */ if ((event.type == Expose) && !event.xexpose.count) { XPutImage(dpy, win, gc, bitmap, 0, 0, 0, 0, ASIZE, ASIZE); } /* Press 'q' to quit */ if ((event.type == KeyPress) && XLookupString(&event.xkey, text, 255, &key, 0) == 1) { if (text[0] == 'q') break; } /* Or simply close the window */ if ((event.type == ClientMessage) && ((Atom) event.xclient.data.l[0] == wmDeleteMessage)) { break; } } #endif /* Done! */ exit_x11(); return 0; }
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef EXTENSIONS_BROWSER_EXTENSIONS_BROWSER_API_PROVIDER_H_ #define EXTENSIONS_BROWSER_EXTENSIONS_BROWSER_API_PROVIDER_H_ #include "base/macros.h" class ExtensionFunctionRegistry; namespace extensions { // A class to provide browser-side, API-specific knowledge to the extensions // system. This allows for composition of multiple providers, so that we can // easily add or subtract features in different configurations. class ExtensionsBrowserAPIProvider { public: ExtensionsBrowserAPIProvider() {} virtual ~ExtensionsBrowserAPIProvider() {} // Registers any API functions in the given |registry|. virtual void RegisterExtensionFunctions( ExtensionFunctionRegistry* registry) = 0; private: DISALLOW_COPY_AND_ASSIGN(ExtensionsBrowserAPIProvider); }; } // namespace extensions #endif // EXTENSIONS_BROWSER_EXTENSIONS_BROWSER_API_PROVIDER_H_
/************************************************************* Copyright (C) 1990, 1991, 1993 Andy C. Hung, all rights reserved. PUBLIC DOMAIN LICENSE: Stanford University Portable Video Research Group. If you use this software, you agree to the following: This program package is purely experimental, and is licensed "as is". Permission is granted to use, modify, and distribute this program without charge for any purpose, provided this license/ disclaimer notice appears in the copies. No warranty or maintenance is given, either expressed or implied. In no event shall the author(s) be liable to you or a third party for any special, incidental, consequential, or other damages, arising out of the use or inability to use the program for any purpose (or the loss of data), even if we have been advised of such possibilities. Any public reference or advertisement of this source code should refer to it as the Portable Video Research Group (PVRG) code, and not by any author(s) (or Stanford University) name. *************************************************************/ /* ************************************************************ system.h io definitions. ************************************************************ */ #ifndef SYSTEM_DONE #define SYSTEM_DONE #include <sys/file.h> #define IOBUF struct io_buffer_list IOBUF { int hpos; int vpos; int hor; int ver; int width; int height; int flag; MEM *mem; }; #endif
/*========================================================================= Program: Visualization Toolkit Module: vtkRenderLargeImage.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkRenderLargeImage - Use tiling to generate a large rendering // .SECTION Description // vtkRenderLargeImage provides methods needed to read a region from a file. #ifndef __vtkRenderLargeImage_h #define __vtkRenderLargeImage_h #include "vtkAlgorithm.h" #include "vtkImageData.h" // makes things a bit easier class vtkRenderer; class vtkActor2DCollection; class vtkCollection; class vtkRenderLargeImage2DHelperClass; class VTK_HYBRID_EXPORT vtkRenderLargeImage : public vtkAlgorithm { public: static vtkRenderLargeImage *New(); vtkTypeRevisionMacro(vtkRenderLargeImage,vtkAlgorithm); void PrintSelf(ostream& os, vtkIndent indent); // Description: // The magnification of the current render window vtkSetMacro(Magnification,int); vtkGetMacro(Magnification,int); // Description: // Indicates what renderer to get the pixel data from. virtual void SetInput(vtkRenderer*); // Description: // Returns which renderer is being used as the source for the pixel data. vtkGetObjectMacro(Input,vtkRenderer); // Description: // Get the output data object for a port on this algorithm. vtkImageData* GetOutput(); // Description: // see vtkAlgorithm for details virtual int ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*); protected: vtkRenderLargeImage(); ~vtkRenderLargeImage(); int Magnification; vtkRenderer *Input; void RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); void RequestInformation (vtkInformation *, vtkInformationVector **, vtkInformationVector *); // see algorithm for more info virtual int FillOutputPortInformation(int port, vtkInformation* info); // Adjust the coordinates of all 2D actors to fit new window size void Rescale2DActors(); // Shift each actor according to the tile we are rendering void Shift2DActors(int x, int y); // put them all back to their previous state when finished. void Restore2DActors(); // 2D Actors need to be rescaled and shifted about for each tile // use this helper class to make life easier. vtkRenderLargeImage2DHelperClass *storedData; private: vtkRenderLargeImage(const vtkRenderLargeImage&); // Not implemented. void operator=(const vtkRenderLargeImage&); // Not implemented. }; #endif