text
stringlengths
4
6.14k
/* * * Copyright (c) 2014-2017 Nest Labs, Inc. * 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. */ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. * * Author: Adam Dunkels <adam@sics.se> * */ #ifndef __ARCH_SYS_ARCH_H__ #define __ARCH_SYS_ARCH_H__ #include <errno.h> #define SYS_MBOX_NULL NULL #define SYS_SEM_NULL NULL typedef u32_t sys_prot_t; struct sys_sem; typedef struct sys_sem * sys_sem_t; #define sys_sem_valid(sem) (((sem) != NULL) && (*(sem) != NULL)) #define sys_sem_set_invalid(sem) do { if((sem) != NULL) { *(sem) = NULL; }}while(0) struct sys_mbox; typedef struct sys_mbox *sys_mbox_t; #define sys_mbox_valid(mbox) (((mbox) != NULL) && (*(mbox) != NULL)) #define sys_mbox_set_invalid(mbox) do { if((mbox) != NULL) { *(mbox) = NULL; }}while(0) struct sys_thread; typedef struct sys_thread * sys_thread_t; #endif /* __ARCH_SYS_ARCH_H__ */
// // OJNIArrayInfo.h // Zdravcity-iOS // // Created by Alexander Shitikov on 16.03.16. // Copyright © 2016 A. All rights reserved. // #import <Foundation/Foundation.h> #import "OJNIEnv.h" @interface OJNIArrayInfo : NSObject @property (nonatomic) BOOL isPrimitive; @property (nonatomic) Class componentType; @property (nonatomic) NSUInteger dimensions; + (instancetype)arrayInfoFromJavaArray:(jarray)array environment:(OJNIEnv *)env prefix:(NSString *)prefix; @end
#ifndef MUTEX_H_ #define MUTEX_H_ #include <pthread.h> namespace PThread { /** * @brief Clase para manejar los mutex de POSIX threads. Tiene una interfaz muy * simple, con los métodos básicos y solo se manejan mutex creados con los * atributos por defecto */ class Mutex { public: /** * @brief Instancia un mutex con los atributos por defecto */ Mutex(); /** * @brief Método para bloquear el mutex e impedir a otros threads acceder a * código salvaguardado por el mismo mutex hasta que sea liberado * @pre El hilo actual no está en posesión del mutex (no lo bloqueó) * @post Si el mutex se encuentra liberado, el hilo actual se apropia del * mismo y lo bloquea. Si ya se encontraba bloqueado, el hilo queda a la * espera de que se le pueda asignar el mutex * @return <tt>true</tt> si no hay errores al intentar tomar el mutex * @return <tt>false</tt> si el hilo ya está en posesión del mutex antes * del llamado al método */ bool bloquear(); /** * @brief Método para intentar bloquear el mutex e impedir a otros threads * acceder a código salvaguardado por el mismo mutex hasta que sea liberado * @post Si el mutex se encuentra liberado, el hilo actual se apropia del * mismo y lo bloquea. Si ya se encontraba bloqueado, se retorna false y * el hilo actual sigue su ejecución * @return <tt>true</tt> si se logra bloquear el mutex * @return <tt>false</tt> si el mutex se encontraba ya bloqueado */ bool intentarBloquear(); /** * @brief Método para liberar el mutex por parte del hilo en ejecución * @pre El hilo actual debe estar en posesión del mutex * @post Si el mutex se encuentra bloqueado por el hilo en ejecución, se * libera * @return <tt>true</tt> si se libera mutex * @return <tt>false</tt> si el hilo no estaba en posesión del mutex o el * mutex ya estaba liberado */ bool desbloquear(); /** * @brief Hace esperar al thread en ejecución hasta que reciba la señal * enviada por Mutex::signal * @post El thread en ejecución se bloquea hasta recibir la señal de * desbloqueo */ void wait(); /** * @brief Método que envía una señal al los threads que están bloqueados * por el método Mutex::wait, avisándoles que se desbloqueen * @post Los threads que se encuentran en espera por el método Mutex::wait * se desbloquean y continuan su ejecución */ void signal(); /** * @brief Libera los recursos * @pre Mutex no se encuentra bloqueado */ ~Mutex(); private: pthread_mutex_t mutex; pthread_cond_t condVar; public: /** * @brief Clase que implementa el patrón RAII para la clase Mutex */ class Lock { public: /** * @brief Construye un Lock bloqueando el mutex * @param mutex Mutex a bloquear */ explicit Lock(Mutex &mutex); /** * @brief Destruye el Lock desbloqueando el mutex */ ~Lock(); private: Mutex &_mutex; }; }; } #endif
//////////////////////////////////////////////////////////////////////////// // Module : alife_space.h // Created : 08.01.2002 // Modified : 08.01.2003 // Author : Dmitriy Iassenev // Description : ALife space //////////////////////////////////////////////////////////////////////////// #ifndef XRAY_ALIFE_SPACE #define XRAY_ALIFE_SPACE //#include "../xrcore/_std_extensions.h" // ALife objects, events and tasks #define ALIFE_VERSION 0x0006 #define ALIFE_CHUNK_DATA 0x0000 #define SPAWN_CHUNK_DATA 0x0001 #define OBJECT_CHUNK_DATA 0x0002 #define GAME_TIME_CHUNK_DATA 0x0005 #define REGISTRY_CHUNK_DATA 0x0009 #define SECTION_HEADER "location_" #define SAVE_EXTENSION ".scop" #define SPAWN_NAME "game.spawn" // inventory rukzak size #define MAX_ITEM_VOLUME 100 #define INVALID_STORY_ID ALife::_STORY_ID(-1) #define INVALID_SPAWN_STORY_ID ALife::_SPAWN_STORY_ID(-1) class CSE_ALifeDynamicObject; class CSE_ALifeMonsterAbstract; class CSE_ALifeTrader; class CSE_ALifeInventoryItem; class CSE_ALifeItemWeapon; class CSE_ALifeSchedulable; class CGameGraph; namespace ALife { typedef u64 _CLASS_ID; // Class ID typedef u16 _OBJECT_ID; // Object ID typedef u64 _TIME_ID; // Time ID typedef u32 _EVENT_ID; // Event ID typedef u32 _TASK_ID; // Event ID typedef u16 _SPAWN_ID; // Spawn ID typedef u16 _TERRAIN_ID; // Terrain ID typedef u32 _STORY_ID; // Story ID typedef u32 _SPAWN_STORY_ID; // Spawn Story ID struct SSumStackCell { int i1; int i2; int iCurrentSum; }; enum ECombatResult { eCombatResultRetreat1 = u32(0), eCombatResultRetreat2, eCombatResultRetreat12, eCombatResult1Kill2, eCombatResult2Kill1, eCombatResultBothKilled, eCombatDummy = u32(-1), }; enum ECombatAction { eCombatActionAttack = u32(0), eCombatActionRetreat, eCombatActionDummy = u32(-1), }; enum EMeetActionType { eMeetActionTypeAttack = u32(0), eMeetActionTypeInteract, eMeetActionTypeIgnore, eMeetActionSmartTerrain, eMeetActionTypeDummy = u32(-1), }; enum ERelationType { eRelationTypeFriend = u32(0), eRelationTypeNeutral, eRelationTypeEnemy, eRelationTypeWorstEnemy, eRelationTypeLast, eRelationTypeDummy = u32(-1), }; enum EHitType { eHitTypeBurn = u32(0), eHitTypeShock, eHitTypeChemicalBurn, eHitTypeRadiation, eHitTypeTelepatic, eHitTypeWound, eHitTypeFireWound, eHitTypeStrike, eHitTypeExplosion, eHitTypeWound_2, // knife's alternative fire // eHitTypePhysicStrike, eHitTypeLightBurn, eHitTypeMax, }; enum EInfluenceType { infl_rad = u32(0), infl_fire, infl_acid, infl_psi, infl_electra, infl_max_count }; enum EConditionRestoreType { eHealthRestoreSpeed = u32(0), eSatietyRestoreSpeed, ePowerRestoreSpeed, eBleedingRestoreSpeed, eRadiationRestoreSpeed, eRestoreTypeMax, }; enum ETakeType { eTakeTypeAll, eTakeTypeMin, eTakeTypeRest, }; enum EWeaponPriorityType { eWeaponPriorityTypeKnife = u32(0), eWeaponPriorityTypeSecondary, eWeaponPriorityTypePrimary, eWeaponPriorityTypeGrenade, eWeaponPriorityTypeDummy = u32(-1), }; enum ECombatType { eCombatTypeMonsterMonster = u32(0), eCombatTypeMonsterAnomaly, eCombatTypeAnomalyMonster, eCombatTypeSmartTerrain, eCombatTypeDummy = u32(-1), }; //âîçìîæíîñòü ïîäêëþ÷åíèÿ àääîíîâ enum EWeaponAddonStatus { eAddonDisabled = 0, //íåëüçÿ ïðèñîåäåíèòü eAddonPermanent = 1, //ïîñòîÿííî ïîäêëþ÷åíî ïî óìîë÷àíèþ eAddonAttachable = 2 //ìîæíî ïðèñîåäèíÿòü }; IC EHitType g_tfString2HitType(LPCSTR caHitType) { if (!_stricmp(caHitType, "burn")) return (eHitTypeBurn); else if (!_stricmp(caHitType, "light_burn")) return (eHitTypeLightBurn); else if (!_stricmp(caHitType, "shock")) return (eHitTypeShock); else if (!_stricmp(caHitType, "strike")) return (eHitTypeStrike); else if (!_stricmp(caHitType, "wound")) return (eHitTypeWound); else if (!_stricmp(caHitType, "radiation")) return (eHitTypeRadiation); else if (!_stricmp(caHitType, "telepatic")) return (eHitTypeTelepatic); else if (!_stricmp(caHitType, "fire_wound")) return (eHitTypeFireWound); else if (!_stricmp(caHitType, "chemical_burn")) return (eHitTypeChemicalBurn); else if (!_stricmp(caHitType, "explosion")) return (eHitTypeExplosion); else if (!_stricmp(caHitType, "wound_2")) return (eHitTypeWound_2); else FATAL("Unsupported hit type!"); NODEFAULT; #ifdef DEBUG return (eHitTypeMax); #endif } #ifndef _EDITOR xr_token hit_types_token[]; IC LPCSTR g_cafHitType2String(EHitType tHitType) { return get_token_name(hit_types_token, tHitType); } #endif using INT_VECTOR = xr_vector<int>; using OBJECT_VECTOR = xr_vector<_OBJECT_ID>; using OBJECT_IT = OBJECT_VECTOR::iterator; using ITEM_P_VECTOR = xr_vector<CSE_ALifeInventoryItem*>; using WEAPON_P_VECTOR = xr_vector<CSE_ALifeItemWeapon*>; using SCHEDULE_P_VECTOR = xr_vector<CSE_ALifeSchedulable*>; using D_OBJECT_P_MAP = xr_map<_OBJECT_ID, CSE_ALifeDynamicObject*>; using STORY_P_MAP = xr_map<_STORY_ID, CSE_ALifeDynamicObject*>; }; // namespace ALife #endif // XRAY_ALIFE_SPACE
/* * 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/cloudfront/CloudFront_EXPORTS.h> #include <aws/cloudfront/model/OriginProtocolPolicy.h> #include <aws/cloudfront/model/OriginSslProtocols.h> namespace Aws { namespace Utils { namespace Xml { class XmlNode; } // namespace Xml } // namespace Utils namespace CloudFront { namespace Model { /** * A customer origin. */ class AWS_CLOUDFRONT_API CustomOriginConfig { public: CustomOriginConfig(); CustomOriginConfig(const Aws::Utils::Xml::XmlNode& xmlNode); CustomOriginConfig& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; /** * The HTTP port the custom origin listens on. */ inline int GetHTTPPort() const{ return m_hTTPPort; } /** * The HTTP port the custom origin listens on. */ inline void SetHTTPPort(int value) { m_hTTPPortHasBeenSet = true; m_hTTPPort = value; } /** * The HTTP port the custom origin listens on. */ inline CustomOriginConfig& WithHTTPPort(int value) { SetHTTPPort(value); return *this;} /** * The HTTPS port the custom origin listens on. */ inline int GetHTTPSPort() const{ return m_hTTPSPort; } /** * The HTTPS port the custom origin listens on. */ inline void SetHTTPSPort(int value) { m_hTTPSPortHasBeenSet = true; m_hTTPSPort = value; } /** * The HTTPS port the custom origin listens on. */ inline CustomOriginConfig& WithHTTPSPort(int value) { SetHTTPSPort(value); return *this;} /** * The origin protocol policy to apply to your origin. */ inline const OriginProtocolPolicy& GetOriginProtocolPolicy() const{ return m_originProtocolPolicy; } /** * The origin protocol policy to apply to your origin. */ inline void SetOriginProtocolPolicy(const OriginProtocolPolicy& value) { m_originProtocolPolicyHasBeenSet = true; m_originProtocolPolicy = value; } /** * The origin protocol policy to apply to your origin. */ inline void SetOriginProtocolPolicy(OriginProtocolPolicy&& value) { m_originProtocolPolicyHasBeenSet = true; m_originProtocolPolicy = value; } /** * The origin protocol policy to apply to your origin. */ inline CustomOriginConfig& WithOriginProtocolPolicy(const OriginProtocolPolicy& value) { SetOriginProtocolPolicy(value); return *this;} /** * The origin protocol policy to apply to your origin. */ inline CustomOriginConfig& WithOriginProtocolPolicy(OriginProtocolPolicy&& value) { SetOriginProtocolPolicy(value); return *this;} /** * The SSL/TLS protocols that you want CloudFront to use when communicating with * your origin over HTTPS. */ inline const OriginSslProtocols& GetOriginSslProtocols() const{ return m_originSslProtocols; } /** * The SSL/TLS protocols that you want CloudFront to use when communicating with * your origin over HTTPS. */ inline void SetOriginSslProtocols(const OriginSslProtocols& value) { m_originSslProtocolsHasBeenSet = true; m_originSslProtocols = value; } /** * The SSL/TLS protocols that you want CloudFront to use when communicating with * your origin over HTTPS. */ inline void SetOriginSslProtocols(OriginSslProtocols&& value) { m_originSslProtocolsHasBeenSet = true; m_originSslProtocols = value; } /** * The SSL/TLS protocols that you want CloudFront to use when communicating with * your origin over HTTPS. */ inline CustomOriginConfig& WithOriginSslProtocols(const OriginSslProtocols& value) { SetOriginSslProtocols(value); return *this;} /** * The SSL/TLS protocols that you want CloudFront to use when communicating with * your origin over HTTPS. */ inline CustomOriginConfig& WithOriginSslProtocols(OriginSslProtocols&& value) { SetOriginSslProtocols(value); return *this;} private: int m_hTTPPort; bool m_hTTPPortHasBeenSet; int m_hTTPSPort; bool m_hTTPSPortHasBeenSet; OriginProtocolPolicy m_originProtocolPolicy; bool m_originProtocolPolicyHasBeenSet; OriginSslProtocols m_originSslProtocols; bool m_originSslProtocolsHasBeenSet; }; } // namespace Model } // namespace CloudFront } // namespace Aws
/* ChibiOS/RT - Copyright (C) 2006-2014 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #include "hal.h" /** * @brief PAL setup. * @details Digital I/O ports static configuration as defined in @p board.h. * This variable is used by the HAL when initializing the PAL driver. */ #if HAL_USE_PAL || defined(__DOXYGEN__) const PALConfig pal_default_config = { {VAL_GPIOAODR, VAL_GPIOACRL, VAL_GPIOACRH}, {VAL_GPIOBODR, VAL_GPIOBCRL, VAL_GPIOBCRH}, {VAL_GPIOCODR, VAL_GPIOCCRL, VAL_GPIOCCRH}, {VAL_GPIODODR, VAL_GPIODCRL, VAL_GPIODCRH}, {VAL_GPIOEODR, VAL_GPIOECRL, VAL_GPIOECRH}, {VAL_GPIOFODR, VAL_GPIOFCRL, VAL_GPIOFCRH}, {VAL_GPIOGODR, VAL_GPIOGCRL, VAL_GPIOGCRH}, }; #endif /* * Early initialization code. * This initialization must be performed just after stack setup and before * any other initialization. */ void __early_init(void) { stm32_clock_init(); } #if HAL_USE_SDC /* Board-related functions related to the SDC driver.*/ bool sdc_lld_is_card_inserted(SDCDriver *sdcp) { (void)sdcp; return !palReadPad(GPIOF, GPIOF_SD_DETECT); } bool sdc_lld_is_write_protected(SDCDriver *sdcp) { (void)sdcp; return FALSE; } #endif /* * Board-specific initialization code. */ void boardInit(void) { }
/* * 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/application-autoscaling/ApplicationAutoScaling_EXPORTS.h> #include <aws/core/AmazonSerializableWebServiceRequest.h> #include <aws/core/utils/UnreferencedParam.h> #include <aws/core/http/HttpRequest.h> namespace Aws { namespace ApplicationAutoScaling { class AWS_APPLICATIONAUTOSCALING_API ApplicationAutoScalingRequest : public Aws::AmazonSerializableWebServiceRequest { public: virtual ~ApplicationAutoScalingRequest () {} void AddParametersToRequest(Aws::Http::HttpRequest& httpRequest) const { AWS_UNREFERENCED_PARAM(httpRequest); } inline Aws::Http::HeaderValueCollection GetHeaders() const override { auto headers = GetRequestSpecificHeaders(); if(headers.size() == 0 || (headers.size() > 0 && headers.count(Aws::Http::CONTENT_TYPE_HEADER) == 0)) { headers.emplace(Aws::Http::HeaderValuePair(Aws::Http::CONTENT_TYPE_HEADER, Aws::AMZN_JSON_CONTENT_TYPE_1_1 )); } headers.emplace(Aws::Http::HeaderValuePair(Aws::Http::API_VERSION_HEADER, "2016-02-06")); return headers; } protected: virtual Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const { return Aws::Http::HeaderValueCollection(); } }; } // namespace ApplicationAutoScaling } // namespace Aws
#pragma once #include <string> #include "envoy/server/filter_config.h" #include "common/config/well_known_names.h" namespace Envoy { namespace Server { namespace Configuration { /** * Config registration for the cors filter. @see NamedHttpFilterConfigFactory. */ class CorsFilterConfig : public NamedHttpFilterConfigFactory { public: HttpFilterFactoryCb createFilterFactory(const Json::Object& json_config, const std::string& stats_prefix, FactoryContext& context) override; std::string name() override { return Config::HttpFilterNames::get().CORS; } }; } // namespace Configuration } // namespace Server } // namespace Envoy
// // KeyboardBar.h // IB Checker // // Created by Thanh on 5/18/15. // Copyright (c) 2015 Puganda_Mac. All rights reserved. // #import <UIKit/UIKit.h> @interface KeyboardBar : UIView @property (strong, nonatomic) UITextView *textView; @end
// // WebApiClient-Core.h // WebApiClient // // Created by Matt on 21/07/15. // Copyright (c) 2015 Blue Rocket. Distributable under the terms of the Apache License, Version 2.0. // #import <WebApiClient/DataWebApiResource.h> #import <WebApiClient/FileWebApiResource.h> #import <WebApiClient/NSDictionary+WebApiClient.h> #import <WebApiClient/RoutingWebApiClient.h> #import <WebApiClient/WebApiAuthorizationProvider.h> #import <WebApiClient/WebApiClient.h> #import <WebApiClient/WebApiClientDigestUtils.h> #import <WebApiClient/WebApiClientEnvironment.h> #import <WebApiClient/WebApiClientSupport.h> #import <WebApiClient/WebApiDataMapper.h> #import <WebApiClient/WebApiResource.h> #import <WebApiClient/WebApiResponse.h> #import <WebApiClient/WebApiRoute.h>
// // Aircraft.h // Strategy // // Created by btw on 15/3/9. // Copyright (c) 2015年 Nihility. All rights reserved. // #import <Foundation/Foundation.h> @class Flight; @protocol Flight; @class TakeOff; @protocol TakeOff; @interface Aircraft : NSObject @property (strong, nonatomic) Flight<Flight> *flight; @property (strong, nonatomic) TakeOff<TakeOff> *takeOff; - (instancetype)initWithFlight:(Flight<Flight> *)flight takeOff:(TakeOff<TakeOff> *)takeOff; - (void)print; @end
// // AppDelegate.h // kalestenika // // Created by Gian Marco Sibilla on 29/07/15. // Copyright (c) 2015 Gian Marco Sibilla. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
/* * Copyright (c) 2018 <Carlos Chacón> * 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. */ #pragma once #ifndef _PHYSIC_COLLIDER_BOX_H #define _PHYSIC_COLLIDER_BOX_H /********************** * System Includes * ***********************/ /************************* * 3rd Party Includes * **************************/ /*************************** * Game Engine Includes * ****************************/ #include "PhysicsDefs.h" #include "PhysicCollider.h" /******************** * Forward Decls * *********************/ class Object3D; class PhysicsManager; /***************** * Class Decl * ******************/ class PhysicColliderBox sealed : public PhysicCollider { private: /************************ * Private Variables * *************************/ #pragma region Private Variables physx::PxBoxGeometry m_PxBoxGeometry; #pragma endregion /********************** * Private Methods * ***********************/ #pragma region Private Methods glm::vec3 m_Size = AEMathHelpers::Vec3fOne; physx::PxGeometry& CreateGeomtry(physx::PxPhysics* pxPhysics); #pragma endregion public: /*************************************** * Constructor & Destructor Methods * ****************************************/ #pragma region Constructor & Destructor Methods /// <summary> /// Default PhysicColliderBox Constructor /// </summary> PhysicColliderBox(); /// <summary> /// Default PhysicColliderBox Destructor /// </summary> virtual ~PhysicColliderBox(); #pragma endregion /****************** * Get Methods * *******************/ #pragma region Get Methods inline const glm::vec3& GetSize() const { return m_Size; } #pragma endregion /****************** * Set Methods * *******************/ #pragma region Set Methods void SetSize(const glm::vec3& size); void SetScale(const glm::vec3& scale) override; #pragma endregion /************************ * Framework Methods * *************************/ #pragma region Framework Methods #pragma endregion }; #endif
#ifndef OPENSIM_PSIM_CONCRETE_PARAMETERS_H_ #define OPENSIM_PSIM_CONCRETE_PARAMETERS_H_ /* -------------------------------------------------------------------------- * * OpenSim: ConcreteParameters.h * * -------------------------------------------------------------------------- * * The OpenSim API is a toolkit for musculoskeletal modeling and simulation. * * See http://opensim.stanford.edu and the NOTICE file for more information. * * OpenSim is developed at Stanford University and supported by the US * * National Institutes of Health (U54 GM072970, R24 HD065690) and by DARPA * * through the Warrior Web program. * * * * Copyright (c) 2005-2014 Stanford University and the Authors * * Author(s): Chris Dembia * * * * Licensed under the Apache License, Version 2.0 (the "License"); you may * * not use this file except in compliance with the License. You may obtain a * * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * -------------------------------------------------------------------------- */ #include "PSimParameter.h" #include "osimPSimDLL.h" namespace OpenSim { /** The value of a coordinate (translation or rotation) at the start * of the motion. */ class OSIMPSIM_API PSimCoordInitialValueParameter : public PSimParameter { OpenSim_DECLARE_CONCRETE_OBJECT(PSimCoordInitialValueParameter, PSimParameter); public: /// @name Property declarations /// @{ OpenSim_DECLARE_PROPERTY(coordinate_name, std::string, "Name of the coordinate."); /// @} PSimCoordInitialValueParameter() { constructProperties(); } void extendApplyToInitialState(const double param, const Model& model, SimTK::State& initState) const override { model.getCoordinateSet().get(get_coordinate_name()). setValue(initState, param); } private: void constructProperties() { constructProperty_coordinate_name(""); } }; /** The speed for a coordinate at the start of a motion. */ class OSIMPSIM_API PSimCoordInitialSpeedParameter : public PSimParameter { OpenSim_DECLARE_CONCRETE_OBJECT(PSimCoordInitialSpeedParameter, PSimParameter); public: /// @name Property declarations /// @{ OpenSim_DECLARE_PROPERTY(coordinate_name, std::string, "Name of the coordinate."); /// @} PSimCoordInitialSpeedParameter() { constructProperties(); } void extendApplyToInitialState(const double param, const Model& model, SimTK::State& initState) const override { model.getCoordinateSet().get(get_coordinate_name()). setSpeedValue(initState, param); } private: void constructProperties() { constructProperty_coordinate_name(""); } }; } // namespace OpenSim #endif // OPENSIM_PSIM_CONCRETE_PARAMETERS_H_
// // ArticleListView.h // Vienna // // Created by Steve on 8/27/05. // Copyright (c) 2004-2014 Steve Palmer and Vienna contributors. 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. // #import <Cocoa/Cocoa.h> #import "Database.h" #import "ArticleBaseView.h" #import "BrowserView.h" #import "PopupButton.h" #import "StdEnclosureView.h" #import <WebKit/WebKit.h> @class AppController; @class ArticleController; @class MessageListView; @class ArticleView; @class FoldersTree; @interface ArticleListView : NSView<BaseView, ArticleBaseView, NSSplitViewDelegate, NSTableViewDelegate, NSTableViewDataSource, WebUIDelegate, WebFrameLoadDelegate> { IBOutlet AppController * controller; IBOutlet ArticleController * articleController; IBOutlet MessageListView * articleList; IBOutlet ArticleView * articleText; IBOutlet NSSplitView * splitView2; IBOutlet FoldersTree * foldersTree; IBOutlet StdEnclosureView * stdEnclosureView; int currentSelectedRow; int tableLayout; BOOL isAppInitialising; BOOL isChangingOrientation; BOOL isInTableInit; BOOL blockSelectionHandler; BOOL blockMarkRead; NSTimer * markReadTimer; NSString * guidOfArticleToSelect; NSFont * articleListFont; NSFont * articleListUnreadFont; NSMutableDictionary * reportCellDict; NSMutableDictionary * unreadReportCellDict; NSMutableDictionary * selectionDict; NSMutableDictionary * topLineDict; NSMutableDictionary * linkLineDict; NSMutableDictionary * middleLineDict; NSMutableDictionary * bottomLineDict; NSMutableDictionary * unreadTopLineDict; NSMutableDictionary * unreadTopLineSelectionDict; NSURL * currentURL; BOOL isCurrentPageFullHTML; BOOL isLoadingHTMLArticle; NSError * lastError; } // Public functions -(void)updateAlternateMenuTitle; -(void)updateVisibleColumns; -(void)saveTableSettings; -(int)tableLayout; -(NSArray *)markedArticleRange; -(BOOL)canDeleteMessageAtRow:(int)row; -(void)loadArticleLink:(NSString *) articleLink; -(NSURL *)url; -(void)webViewLoadFinished:(NSNotification *)notification; @end
#include<stdio.h> // Andrew was here int main() { int save1=5,save2=2; //Set the integers and name the save float average; // Average variable int total; // set total for integer total=save1+save2; // Set total given the variables average=total/2.0; // Divide printf("Total of %d and %d = %d",save1,save2,total); // Print numerical as total printf("\nAverage of %d and %d = %.1f",save1,save2,average); // Show the average return 0; // Otherwise return 0 "undefined" }
#define PARROT_IN_EXTENSION #include "parrot/parrot.h" #include "parrot/extend.h" #include "../sixmodelobject.h" #include "VMIter.h" /* This representation's function pointer table. */ static REPROps *this_repr; /* Creates a new type object of this representation, and associates it with * the given HOW. */ static PMC * type_object_for(PARROT_INTERP, PMC *HOW) { /* Create new object instance. */ VMIterInstance *obj = mem_allocate_zeroed_typed(VMIterInstance); /* Build an STable. */ PMC *st_pmc = create_stable(interp, this_repr, HOW); STable *st = STABLE_STRUCT(st_pmc); /* Create type object and point it back at the STable. */ obj->common.stable = st_pmc; st->WHAT = wrap_object(interp, obj); PARROT_GC_WRITE_BARRIER(interp, st_pmc); /* Flag it as a type object. */ MARK_AS_TYPE_OBJECT(st->WHAT); return st->WHAT; } /* Composes the representation. */ static void compose(PARROT_INTERP, STable *st, PMC *repr_info) { /* Nothing to do yet, but should handle type in the future. */ } /* Creates a new instance based on the type object. */ static PMC * allocate(PARROT_INTERP, STable *st) { VMIterInstance *obj = mem_allocate_zeroed_typed(VMIterInstance); obj->common.stable = st->stable_pmc; return wrap_object(interp, obj); } /* Initialize a new instance. */ static void initialize(PARROT_INTERP, STable *st, void *data) { /* Nothing to do here. */ } /* Copies to the body of one object to another. */ static void copy_to(PARROT_INTERP, STable *st, void *src, void *dest) { VMIterBody *src_body = (VMIterBody *)src; VMIterBody *dest_body = (VMIterBody *)dest; /* Nothing to do yet. */ } /* This Parrot-specific addition to the API is used to free an object. */ static void gc_free(PARROT_INTERP, PMC *obj) { mem_sys_free(PMC_data(obj)); PMC_data(obj) = NULL; } /* Gets the storage specification for this representation. */ static storage_spec get_storage_spec(PARROT_INTERP, STable *st) { storage_spec spec; spec.inlineable = STORAGE_SPEC_REFERENCE; spec.boxed_primitive = STORAGE_SPEC_BP_NONE; spec.can_box = 0; spec.bits = sizeof(void *) * 8; spec.align = ALIGNOF1(void *); return spec; } /* Initializes the VMIter representation. */ REPROps * VMIter_initialize(PARROT_INTERP) { /* Allocate and populate the representation function table. */ this_repr = mem_allocate_zeroed_typed(REPROps); this_repr->type_object_for = type_object_for; this_repr->compose = compose; this_repr->allocate = allocate; this_repr->initialize = initialize; this_repr->copy_to = copy_to; this_repr->gc_free = gc_free; this_repr->get_storage_spec = get_storage_spec; return this_repr; }
int xmodem_recv(int usecrc); int xmodem_send(int send1k);
/* * vsnprintf() * * Poor substitute for a real vsnprintf() function for systems * that don't have them... */ #include "compiler.h" #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <string.h> #include "nasmlib.h" #define BUFFER_SIZE 65536 /* Bigger than any string we might print... */ static char snprintf_buffer[BUFFER_SIZE]; int vsnprintf(char *str, size_t size, const char *format, va_list ap) { int rv, bytes; if (size > BUFFER_SIZE) { nasm_error(ERR_PANIC|ERR_NOFILE, "vsnprintf: size (%d) > BUFFER_SIZE (%d)", size, BUFFER_SIZE); size = BUFFER_SIZE; } rv = vsprintf(snprintf_buffer, format, ap); if (rv >= BUFFER_SIZE) nasm_error(ERR_PANIC|ERR_NOFILE, "vsnprintf buffer overflow"); if (size > 0) { if ((size_t)rv < size-1) bytes = rv; else bytes = size-1; memcpy(str, snprintf_buffer, bytes); str[bytes] = '\0'; } return rv; }
#ifndef SD_SNAPSHOTITER_H_ #define SD_SNAPSHOTITER_H_ /* * sophia database * sphia.org * * Copyright (c) Dmitry Simonenko * BSD License */ typedef struct sdsnapshotiter sdsnapshotiter; struct sdsnapshotiter { sdsnapshot *s; sdsnapshotnode *n; uint32_t npos; } sspacked; static inline int sd_snapshotiter_open(ssiter *i, sr *r, sdsnapshot *s) { sdsnapshotiter *si = (sdsnapshotiter*)i->priv; si->s = s; si->n = NULL; si->npos = 0; if (ssunlikely(ss_bufused(&s->buf) < (int)sizeof(sdsnapshotheader))) goto error; sdsnapshotheader *h = (sdsnapshotheader*)s->buf.s; uint32_t crc = ss_crcs(r->crc, h, sizeof(*h), 0); if (h->crc != crc) goto error; if (ssunlikely((int)h->size != ss_bufused(&s->buf))) goto error; si->n = (sdsnapshotnode*)(s->buf.s + sizeof(sdsnapshotheader)); return 0; error: sr_malfunction(r->e, "%s", "snapshot file corrupted"); return -1; } static inline void sd_snapshotiter_close(ssiter *i ssunused) { } static inline int sd_snapshotiter_has(ssiter *i) { sdsnapshotiter *si = (sdsnapshotiter*)i->priv; return si->n != NULL; } static inline void* sd_snapshotiter_of(ssiter *i) { sdsnapshotiter *si = (sdsnapshotiter*)i->priv; if (ssunlikely(si->n == NULL)) return NULL; return si->n; } static inline void sd_snapshotiter_next(ssiter *i) { sdsnapshotiter *si = (sdsnapshotiter*)i->priv; if (ssunlikely(si->n == NULL)) return; si->npos++; sdsnapshotheader *h = (sdsnapshotheader*)si->s->buf.s; if (si->npos < h->nodes) { si->n = (sdsnapshotnode*)((char*)si->n + sizeof(sdsnapshotnode) + si->n->size); return; } si->n = NULL; } extern ssiterif sd_snapshotiter; #endif
/* * Copyright (c) 2014, Linaro Limited * 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 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. */ #ifndef IO_H #define IO_H static inline void write8(uint8_t val, vaddr_t addr) { *(volatile uint8_t *)addr = val; } static inline void write16(uint16_t val, vaddr_t addr) { *(volatile uint16_t *)addr = val; } static inline void write32(uint32_t val, vaddr_t addr) { *(volatile uint32_t *)addr = val; } static inline uint8_t read8(vaddr_t addr) { return *(volatile uint8_t *)addr; } static inline uint16_t read16(vaddr_t addr) { return *(volatile uint16_t *)addr; } static inline uint32_t read32(vaddr_t addr) { return *(volatile uint32_t *)addr; } #endif /*IO_H*/
/* Public domain */ #ifndef _AGAR_CORE_NET_SERVER_H_ #define _AGAR_CORE_NET_SERVER_H_ #include <agar/core/begin.h> #define NS_HOSTNAME_MAX 256 struct ns_server; struct ns_client; struct ns_cmd; enum ns_log_lvl { NS_DEBUG, NS_INFO, NS_NOTICE, NS_WARNING, NS_ERR, NS_CRIT, NS_ALERT, NS_EMERG }; typedef int (*NS_LoginFn)(struct ns_server *, void *); typedef void (*NS_LogoutFn)(struct ns_server *, void *); typedef void (*NS_SigCheckFn)(struct ns_server *); typedef int (*NS_ErrorFn)(struct ns_server *); typedef int (*NS_AuthFn)(struct ns_server *, void *); typedef int (*NS_CommandFn)(struct ns_server *, NS_Command *, void *); typedef struct ns_cmd { const char *name; NS_CommandFn fn; void *arg; } NS_Cmd; typedef struct ns_auth { const char *name; NS_AuthFn fn; void *arg; } NS_Auth; typedef struct ns_server { struct ag_object obj; Uint flags; const char *protoName; /* Daemon name / protocol signature */ const char *protoVer; /* Protocol version string */ const char *host; /* Hostname for bind(), or NULL */ const char *port; /* Port number or name */ pid_t listenProc; /* PID of listening process */ NS_Cmd *cmds; /* Implemented commands */ Uint ncmds; NS_Auth *authModes; /* Authentication methods */ Uint nAuthModes; NS_ErrorFn errorFn; /* Call when any command fails, instead of returning error to client. */ NS_SigCheckFn sigCheckFn; /* Call upon signal interruptions */ NS_LoginFn loginFn; /* Call after basic auth */ NS_LogoutFn logoutFn; /* Call on disconnection */ void **listItems; /* For list functions */ size_t *listItemSize; Uint listItemCount; AG_TAILQ_HEAD_(ns_client) clients; /* Connected clients */ } NS_Server; typedef struct ns_client { struct ag_object obj; char host[NS_HOSTNAME_MAX]; /* Remote host */ } NS_Client; __BEGIN_DECLS extern AG_ObjectClass nsServerClass; extern AG_ObjectClass nsClientClass; void NS_InitSubsystem(Uint); NS_Server *NS_ServerNew(void *, Uint, const char *, const char *, const char *, const char *); void NS_ServerSetProtocol(NS_Server *, const char *, const char *); void NS_ServerBind(NS_Server *, const char *, const char *); void NS_Log(enum ns_log_lvl, const char *, ...); void NS_RegErrorFn(NS_Server *, NS_ErrorFn); void NS_RegSigCheckFn(NS_Server *, NS_SigCheckFn); void NS_RegCmd(NS_Server *, const char *, NS_CommandFn, void *); void NS_RegAuthMode(NS_Server *, const char *, NS_AuthFn, void *); void NS_RegLoginFn(NS_Server *, NS_LoginFn); void NS_RegLogoutFn(NS_Server *, NS_LogoutFn); int NS_ServerLoop(NS_Server *); void NS_Logout(NS_Server *, int, const char *, ...); void NS_Message(NS_Server *, int, const char *, ...); void NS_BeginData(NS_Server *, size_t); size_t NS_Data(NS_Server *, char *, size_t); void NS_EndData(NS_Server *); void NS_BeginList(NS_Server *); void NS_EndList(NS_Server *); void NS_ListItem(NS_Server *, void *, size_t); void NS_ListString(NS_Server *, const char *, ...); int NS_Write(NS_Server *, int, const void *, size_t); int NS_Read(NS_Server *, int, void *, size_t); __END_DECLS #include <agar/core/close.h> #endif /* _AGAR_CORE_NET_SERVER_H_ */
/* * Copyright 2014 Nutiteq Llc. All rights reserved. * Copying and using this code is allowed only according * to license terms, as given in https://www.nutiteq.com/license/ */ #ifndef _NUTI_TORQUETILEDECODER_H_ #define _NUTI_TORQUETILEDECODER_H_ #include "VectorTileDecoder.h" #include "MapnikVT/Value.h" #include <memory> #include <mutex> #include <map> #include <string> #include <cglib/mat.h> namespace Nuti { namespace MapnikVT { class TorqueMap; class SymbolizerContext; } class CartoCSSStyleSet; /** * A decoder for Torque layer that accepts json-based Torque tiles. */ class TorqueTileDecoder : public VectorTileDecoder { public: /** * Constructs a new TorqueTileDecoder given style. * @param styleSet The style set used by decoder. */ TorqueTileDecoder(const std::shared_ptr<CartoCSSStyleSet>& styleSet); virtual ~TorqueTileDecoder(); /** * Returns the frame count defined in the Torque style. * @return The frame count in the animation. */ int getFrameCount() const; /** * Returns the current style set used by the decoder. * @return The current style set. */ const std::shared_ptr<CartoCSSStyleSet>& getStyleSet() const; /** * Sets the current style set used by the decoder. * @param styleSet The new style set to use. */ void setStyleSet(const std::shared_ptr<CartoCSSStyleSet>& styleSet); /** * Returns the tile resolution, in pixels. Default is 256. * @return The tile resolution in pixels. */ int getResolution() const; /** * Sets the tile resolution in pixels. Default is 256. * @param resolution The new resolution value. */ void setResolution(int resolution); virtual Color getBackgroundColor() const; virtual std::shared_ptr<const VT::BitmapPattern> getBackgroundPattern() const; virtual int getMinZoom() const; virtual int getMaxZoom() const; virtual std::shared_ptr<TileMap> decodeTile(const VT::TileId& tile, const VT::TileId& targetTile, const std::shared_ptr<TileData>& data) const; protected: static const int DEFAULT_TILE_SIZE; static const int GLYPHMAP_SIZE; int _resolution; std::shared_ptr<MapnikVT::TorqueMap> _map; std::shared_ptr<MapnikVT::SymbolizerContext> _symbolizerContext; std::shared_ptr<CartoCSSStyleSet> _styleSet; mutable std::mutex _mutex; }; } #endif
/* * Part of DNS zone file validator `validns`. * * Copyright 2011-2014 Anton Berezin <tobez@tobez.org> * Modified BSD license. * (See LICENSE file in the distribution.) * */ #include <sys/types.h> #include <stdio.h> #include <netinet/in.h> #include <arpa/inet.h> #include "common.h" #include "textparse.h" #include "mempool.h" #include "carp.h" #include "rr.h" static struct rr* sshfp_parse(char *name, long ttl, int type, char *s) { struct rr_sshfp *rr = getmem(sizeof(*rr)); int algorithm, fp_type; algorithm = extract_integer(&s, "algorithm"); if (algorithm < 0) return NULL; if (algorithm != 1 && algorithm != 2 && algorithm != 3 && algorithm != 4) return bitch("unsupported algorithm"); rr->algorithm = algorithm; fp_type = extract_integer(&s, "fp type"); if (fp_type < 0) return NULL; if (fp_type != 1 && fp_type != 2) return bitch("unsupported fp_type"); rr->fp_type = fp_type; rr->fingerprint = extract_hex_binary_data(&s, "fingerprint", EXTRACT_EAT_WHITESPACE); if (rr->fingerprint.length < 0) return NULL; if (rr->fp_type == 1 && rr->fingerprint.length != SHA1_BYTES) { return bitch("wrong SHA-1 fingerprint length: %d bytes found, %d bytes expected", rr->fingerprint.length, SHA1_BYTES); } if (rr->fp_type == 2 && rr->fingerprint.length != SHA256_BYTES) { return bitch("wrong SHA-256 fingerprint length: %d bytes found, %d bytes expected", rr->fingerprint.length, SHA256_BYTES); } if (*s) { return bitch("garbage after valid SSHFP data"); } return store_record(type, name, ttl, rr); } static char* sshfp_human(struct rr *rrv) { RRCAST(sshfp); char ss[4096]; char *s = ss; int l; int i; l = snprintf(s, 4096, "%u %u ", rr->algorithm, rr->fp_type); s += l; for (i = 0; i < rr->fingerprint.length; i++) { l = snprintf(s, 4096-(s-ss), "%02X", (unsigned char)rr->fingerprint.data[i]); s += l; } return quickstrdup_temp(ss); } static struct binary_data sshfp_wirerdata(struct rr *rrv) { RRCAST(sshfp); return compose_binary_data("11d", 1, rr->algorithm, rr->fp_type, rr->fingerprint); } struct rr_methods sshfp_methods = { sshfp_parse, sshfp_human, sshfp_wirerdata, NULL, NULL };
/* * THE CHRONOTEXT-PLAYGROUND: https://github.com/arielm/chronotext-playground * COPYRIGHT (C) 2014-2015, ARIEL MALKA ALL RIGHTS RESERVED. * * THE FOLLOWING SOURCE-CODE IS DISTRIBUTED UNDER THE SIMPLIFIED BSD LICENSE: * https://github.com/arielm/chronotext-playground/blob/master/LICENSE */ /* * SEE COMMENTS IN TestingMemory1::setup() * * MORE CONTEXT: * - https://github.com/arielm/new-chronotext-toolkit/blob/develop/src/chronotext/cocoa/system/MemoryManager.mm * - https://github.com/arielm/new-chronotext-toolkit/blob/develop/src/chronotext/android/system/MemoryManager.cpp */ #pragma once #include "Testing/TestingBase.h" #include "chronotext/system/MemoryInfo.h" class Unit { public: Unit(size_t size); ~Unit(); size_t size() const; uint8_t* data() const; const std::string write() const; protected: size_t _size; uint8_t *_data; }; class Measure { public: chr::MemoryInfo before; chr::MemoryInfo after; int64_t balance = -1; void begin(); void end(); const std::string write() const; protected: bool began = false; }; class TestingMemory1 : public TestingBase { public: void setup() final; void shutdown() final; /* * PASSING VIA update() IS (CURRENTLY) NECESSARY, IN ORDER TO BE PROPERLY NOTIFIED UPON "MEMORY WARNING" */ void update() final; protected: std::vector<std::shared_ptr<Unit>> units; bool adding; bool removing; bool done; size_t unitDataSize; size_t unitCount; };
/* * Copyright 2008-2017 Katherine Flavel * * See LICENCE for the full copyright terms. */ #include <assert.h> #include <limits.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <re/re.h> static int re_fprint(FILE *f, enum re_dialect dialect, const char *s) { char start, end; assert(f != NULL); assert(s != NULL); if (dialect & RE_GROUP) { start = '['; end = ']'; } else { dialect &= ~RE_GROUP; switch (dialect) { case RE_LITERAL: start = '\''; end = start; break; case RE_GLOB: start = '\"'; end = start; break; default: start = '/'; end = start; break; } } /* TODO: escape per surrounding delim */ return fprintf(f, "%c%s%c", start, s, end); } void re_ferror(FILE *f, enum re_dialect dialect, const struct re_err *err, const char *file, const char *s) { assert(f != NULL); assert(err != NULL); if (file != NULL) { fprintf(f, "%s", file); } if (s != NULL) { if (file != NULL) { fprintf(f, ": "); } re_fprint(f, dialect, s); } if (err->e & RE_MARK) { assert(err->end.byte >= err->start.byte); if (file != NULL || s != NULL) { fprintf(f, ":"); } if (err->end.byte == err->start.byte) { fprintf(f, "%u", err->start.byte + 1); } else { fprintf(f, "%u-%u", err->start.byte + 1, err->end.byte + 1); } } switch (err->e) { case RE_EHEXRANGE: fprintf(f, ": Hex escape %s out of range", err->esc); break; case RE_EOCTRANGE: fprintf(f, ": Octal escape %s out of range", err->esc); break; case RE_ECOUNTRANGE: fprintf(f, ": Count %s out of range", err->esc); break; default: fprintf(f, ": %s", re_strerror(err->e)); break; } switch (err->e) { case RE_EHEXRANGE: fprintf(f, ": expected \\0..\\x%X inclusive", UCHAR_MAX); break; case RE_EOCTRANGE: fprintf(f, ": expected \\0..\\%o inclusive", UCHAR_MAX); break; case RE_ECOUNTRANGE: fprintf(f, ": expected 1..%u inclusive", UINT_MAX); break; case RE_EXESC: fprintf(f, " \\0..\\x%X inclusive", UCHAR_MAX); break; case RE_EXCOUNT: fprintf(f, " 1..%u inclusive", UINT_MAX); break; case RE_ENEGCOUNT: fprintf(f, " {%u,%u}", err->m, err->n); break; case RE_EBADCP: fprintf(f, ": U+%06lX", err->cp); break; default: ; } /* TODO: escape */ switch (err->e) { case RE_ENEGRANGE: fprintf(f, " [%s]", err->set); break; default: ; } fprintf(f, "\n"); } void re_perror(enum re_dialect dialect, const struct re_err *err, const char *file, const char *s) { re_ferror(stderr, dialect, err, file, s); }
/********************************************************************************* * * Inviwo - Interactive Visualization Workshop * * Copyright (c) 2018-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_MESHCONVERTER_H #define IVW_MESHCONVERTER_H #include <modules/base/basemoduledefine.h> #include <inviwo/core/common/inviwo.h> #include <inviwo/core/datastructures/geometry/mesh.h> namespace inviwo { namespace meshutil { /** * Will construct a new mesh out of the given mesh with its position and color buffer, if existing, * and all index buffers but with the DrawMode set to Points */ std::unique_ptr<Mesh> toPointMesh(const Mesh& mesh); /** * Will construct a new mesh out of the given mesh with its position and color buffer, if existing. * It will discard all IndexBuffes with DrawType equal to Points, copy all IndexBuffers with * DrawType equal to Lines, and construct IndexBuffers with lines out of all IndexBuffers with * DrawType equal to Triangles. */ std::unique_ptr<Mesh> toLineMesh(const Mesh& mesh); } // namespace meshutil } // namespace inviwo #endif // IVW_MESHCONVERTER_H
/* * Copywrite 2014-2015 Krzysztof Stasik. All rights reserved. */ #pragma once #include "base/core/types.h" #include "rush/punch/server.h" #include "../common/punch_message.h" #include "base/network/url.h" #include "base/network/socket.h" #include <vector> namespace Rush { namespace Punch { static const s32 kPunchCommandTimeoutMs = 10 * 1000; static const s32 kPunchCommandRetryMs = 1000; struct PunchOperation { // kRequest means a_url is the originator. enum Type { kRequest, kExternal } type; Base::Socket::Address a_public; Base::Socket::Address a_private; Base::Socket::Address b_public; Base::Socket::Address b_private; s32 punch_resend; s32 timeout; Rush::Punch::RequestId request_id; Rush::Punch::RequestId connect_id; }; class PunchServer { public: PunchServer(); ~PunchServer(); bool Open(const Base::Url &url, u16 *port); void Update(u32 dt); private: void UpdatePunchOperations(u32 dt); private: Base::Socket::Handle m_socket; Base::Url m_url; std::vector<PunchOperation> m_punch_ops; Rush::Punch::RequestId m_generator; }; } // namespace Punch } // namespace Rush
/*- * Copyright (c) 2010 Redpill Linpro AS * All rights reserved. * * Author: Poul-Henning Kamp <phk@phk.freebsd.dk> * * 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 AUTHOR 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 AUTHOR 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. * * Memory barriers * * XXX: It is utterly braindamaged, that no standard facility for this * XXX: is available. The "just use pthreads locking" excuse does not * XXX: make sense, and does not apply to two unthreaded programs sharing * XXX: a memory segment. */ #ifndef VMB_H_INCLUDED #define VMB_H_INCLUDED #if defined(__FreeBSD__) #include <sys/param.h> #endif #if defined(__FreeBSD__) && __FreeBSD_version >= 800058 #include <sys/types.h> #include <machine/atomic.h> #define VMB() mb() #define VWMB() wmb() #define VRMB() rmb() #elif defined(__amd64__) && defined(__GNUC__) #define VMB() __asm __volatile("mfence;" : : : "memory") #define VWMB() __asm __volatile("sfence;" : : : "memory") #define VRMB() __asm __volatile("lfence;" : : : "memory") #elif defined(__arm__) #define VMB() #define VWMB() #define VRMB() #elif defined(__i386__) && defined(__GNUC__) #define VMB() __asm __volatile("lock; addl $0,(%%esp)" : : : "memory") #define VWMB() __asm __volatile("lock; addl $0,(%%esp)" : : : "memory") #define VRMB() __asm __volatile("lock; addl $0,(%%esp)" : : : "memory") #elif defined(__sparc64__) && defined(__GNUC__) #define VMB() __asm__ __volatile__ ("membar #MemIssue": : :"memory") #define VWMB() VMB() #define VRMB() VMB() #else #define VMB_NEEDS_PTHREAD_WORKAROUND_THIS_IS_BAD_FOR_PERFORMANCE 1 void vmb_pthread(void); #define VMB() vmb_pthread() #define VWMB() vmb_pthread() #define VRMB() vmb_pthread() #endif #endif /* VMB_H_INCLUDED */
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once #include "BlueprintFieldNodeSpawner.h" #include "BlueprintDelegateNodeSpawner.generated.h" // Forward declarations class UK2Node_BaseMCDelegate; /** * Takes care of spawning various nodes associated with delegates. Serves as the * "action" portion for certain FBlueprintActionMenuItems. Evolved from * FEdGraphSchemaAction_K2Delegate, FEdGraphSchemaAction_K2AssignDelegate, etc. */ UCLASS(Transient) class BLUEPRINTGRAPH_API UBlueprintDelegateNodeSpawner : public UBlueprintFieldNodeSpawner { GENERATED_UCLASS_BODY() public: /** * Creates a new UBlueprintDelegateNodeSpawner for the specified property. * Does not do any compatibility checking to ensure that the property is * accessible from blueprints (do that before calling this). * * @param NodeClass The node type that you want the spawner to spawn. * @param Property The property you want assigned to spawned nodes. * @param Outer Optional outer for the new spawner (if left null, the transient package will be used). * @return A newly allocated instance of this class. */ static UBlueprintDelegateNodeSpawner* Create(TSubclassOf<UK2Node_BaseMCDelegate> NodeClass, UMulticastDelegateProperty const* const Property, UObject* Outer = nullptr); /** * Accessor to the delegate property that this spawner wraps (the delegate * that this will assign spawned nodes with). * * @return The delegate property that this was initialized with. */ UMulticastDelegateProperty const* GetDelegateProperty() const; };
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once #include "Core.h" #include "ISourceControlProvider.h" class SOURCECONTROLWINDOWS_API FSourceControlWindows { public: /** Opens a dialog to choose packages to submit */ static void ChoosePackagesToCheckIn(); /** Determines whether we can choose packages to check in (we cant if an operation is already in progress) */ static bool CanChoosePackagesToCheckIn(); /** * Display check in dialog for the specified packages * * @param bUseSourceControlStateCache Whether to use the cached source control status, or force the status to be updated * @param InPackageNames Names of packages to check in * @param InPendingDeletePaths Directories to check for files marked 'pending delete' * @param InConfigFiles Config filenames to check in */ static bool PromptForCheckin(bool bUseSourceControlStateCache, const TArray<FString>& InPackageNames, const TArray<FString>& InPendingDeletePaths = TArray<FString>(), const TArray<FString>& InConfigFiles = TArray<FString>()); /** * Display file revision history for the provided packages * * @param InPackageNames Names of packages to display file revision history for */ static void DisplayRevisionHistory( const TArray<FString>& InPackagesNames ); /** * Prompt the user with a revert files dialog, allowing them to specify which packages, if any, should be reverted. * * @param InPackageNames Names of the packages to consider for reverting * * @return true if the files were reverted; false if the user canceled out of the dialog */ static bool PromptForRevert(const TArray<FString>& InPackageNames ); protected: /** Callback for ChoosePackagesToCheckIn(), continues to bring up UI once source control operations are complete */ static void ChoosePackagesToCheckInCallback(const FSourceControlOperationRef& InOperation, ECommandResult::Type InResult); /** Called when the process has completed and we have packages to check in */ static void ChoosePackagesToCheckInCompleted(const TArray<UPackage*>& LoadedPackages, const TArray<FString>& PackageNames, const TArray<FString>& ConfigFiles); /** Delegate called when the user has decided to cancel the check in process */ static void ChoosePackagesToCheckInCancelled(FSourceControlOperationRef InOperation); private: /** The notification in place while we choose packages to check in */ static TWeakPtr<class SNotificationItem> ChoosePackagesToCheckInNotification; };
#pragma once #include "afxwin.h" // CRegisterInsterface ¶Ô»°¿ò class CRegisterInsterface : public CDialogEx { DECLARE_DYNAMIC(CRegisterInsterface) public: CRegisterInsterface(CWnd* pParent = NULL); // ±ê×¼¹¹Ô캯Êý virtual ~CRegisterInsterface(); // ¶Ô»°¿òÊý¾Ý enum { IDD = IDD_DIALOG_REGISTER }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV Ö§³Ö DECLARE_MESSAGE_MAP() private: CEdit editusername; CEdit editkey; CEdit editrekey; public: afx_msg void OnBnClickedButton2(); };
/*++ Copyright (C) 2018 3MF Consortium 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 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. Abstract: NMR_ModelReaderNode100_Components.h defines the Model Components Reader Node Class. --*/ #ifndef __NMR_MODELREADERNODE100_COMPONENTS #define __NMR_MODELREADERNODE100_COMPONENTS #include "Model/Reader/NMR_ModelReaderNode.h" #include "Model/Classes/NMR_ModelComponentsObject.h" namespace NMR { class CModelReaderNode093_Components : public CModelReaderNode { private: protected: CModelComponentsObject * m_pComponentsObject; virtual void OnAttribute(_In_z_ const nfChar * pAttributeName, _In_z_ const nfChar * pAttributeValue); virtual void OnNSChildElement(_In_z_ const nfChar * pChildName, _In_z_ const nfChar * pNameSpace, _In_ CXmlReader * pXMLReader); public: CModelReaderNode093_Components() = delete; CModelReaderNode093_Components(_In_ CModelComponentsObject * pComponentsObject, _In_ PModelWarnings pWarnings); virtual void parseXML(_In_ CXmlReader * pXMLReader); }; } #endif // __NMR_MODELREADERNODE093_COMPONENTS
/**************************************************************************** * include/nuttx/regex.h * Non-standard, pattern-matching APIs available in lib/. * * Copyright (C) 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * 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 NuttX 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 __INCLUDE_NUTTX_REGEX_H #define __INCLUDE_NUTTX_REGEX_H /**************************************************************************** * Included Files ****************************************************************************/ #include <nuttx/config.h> #include <nuttx/fs/fs.h> /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** * Public Function Prototypes ****************************************************************************/ #ifdef __cplusplus #define EXTERN extern "C" extern "C" { #else #define EXTERN extern #endif /**************************************************************************** * Name: match * * Description: * Simple shell-style filename pattern matcher written by Jef Poskanzer * (See copyright notice in lib/lib_match.c). This pattern matcher only * handles '?', '*' and '**', and multiple patterns separated by '|'. * * Returned Value: * Returns 1 (match) or 0 (no-match). * ****************************************************************************/ int match(const char *pattern, const char *string); #undef EXTERN #ifdef __cplusplus } #endif #endif /* __INCLUDE_NUTTX_REGEX_H */
/* * POK header * * The following file is a part of the POK project. Any modification should * be made according to the POK licence. You CANNOT use this file or a part * of a file for your own project. * * For more information on the POK licence, please see our LICENCE FILE * * Please follow the coding guidelines described in doc/CODING_GUIDELINES * * Copyright (c) 2007-2021 POK team */ #include <core/dependencies.h> #ifdef POK_NEEDS_PORTS_SAMPLING #include <core/syscall.h> #include <errno.h> #include <middleware/port.h> #include <types.h> pok_ret_t pok_port_sampling_read(const pok_port_id_t id, void *data, pok_port_size_t *len, bool_t *valid) { return (pok_syscall4(POK_SYSCALL_MIDDLEWARE_SAMPLING_READ, (uint32_t)id, (uint32_t)data, (uint32_t)len, (uint32_t)valid)); } #endif
/* * Copyright 2014, NICTA * * This software may be distributed and modified according to the terms of * the BSD 2-Clause license. Note that NO WARRANTY is provided. * See "LICENSE_BSD2.txt" for details. * * @TAG(NICTA_BSD) */ #ifndef __API_CONSTANTS_H #define __API_CONSTANTS_H #define BIT(n) (1ul<<(n)) enum priorityConstants { seL4_InvalidPrio = -1, seL4_MinPrio = 0, seL4_MaxPrio = 255 }; /* message_info_t defined in api/types.bf */ enum seL4_MsgLimits { seL4_MsgLengthBits = 7, seL4_MsgExtraCapBits = 2 }; #define seL4_MsgMaxLength 120 #define seL4_MsgMaxExtraCaps (BIT(seL4_MsgExtraCapBits)-1) #endif /* __API_CONSTANTS_H */
/** * RayFoundation.h * A ray of light in the realm of darkness. * Some additions to C. * If You don't like it, You can preprocess files, to get pure-C code. * Author Kucheruavyu Ilya (kojiba@protonmail.com) * 2014 Ukraine Kharkiv * _ _ _ _ * | | (_|_) | * | | _____ _ _| |__ __ _ * | |/ / _ \| | | '_ \ / _` | * | " (_) | | | |_) | (_| | * |_|\_\___/| |_|_.__/ \__,_| * _/ | * |__/ **/ #ifndef __RAY_FOUNDATION__ #define __RAY_FOUNDATION__ #ifdef __cplusplus extern "C" { #endif // Workers #include "RSystem.h" #include "RSyntax.h" #include "RColors.h" #include "RBasics/RBasics.h" #include "RClassTable/RClassTable.h" // Containers #include "RContainers/RArray.h" #include "RContainers/RArray_Blocks.h" #include "RContainers/RArray_Parallel.h" #include "RContainers/RList.h" #include "RContainers/RBuffer.h" #include "RContainers/RDictionary.h" // Strings #include "RString/RString.h" #include "RString/RString_Char.h" #include "RString/RString_Numbers.h" #include "RString/RString_UTF8.h" #include "RString/RString_Consts.h" #include "RString/RString_File.h" // Memory operations #include "RMemoryOperations/RByteOperations.h" #include "RMemoryOperations/RData.h" #include "RMemoryOperations/RSandBox.h" #include "RMemoryOperations/RAutoPool.h" // Encoding #include "REncoding/RBase64.h" #include "REncoding/PurgeEvasionUtilsRay.h" // Networking #include "RNetwork/RSocket.h" #include "RNetwork/RTCPHandler.h" // Threads #include "RThread/RThread.h" #include "RThread/RThreadPool.h" // Others #include "Utils/Utils.h" #include "Utils/PurgeEvasionConnection.h" #include "Utils/PurgeEvasionParallel.h" #include "Utils/PurgeEvasionTCPHandler.h" #ifdef RAY_BLOCKS_ON #define endRay() deleter(stringConstantsTable(), RDictionary);\ deleter(RCTSingleton, RClassTable); \ deleter(singleBlockPool(), RAutoPool); \ p(RAutoPool)(RPool); \ deleter(RPool, RAutoPool); \ stopConsole();\ return 0 #else #define endRay() deleter(stringConstantsTable(), RDictionary);\ deleter(RCTSingleton, RClassTable); \ p(RAutoPool)(RPool); \ deleter(RPool, RAutoPool); \ stopConsole();\ return 0 #endif #ifdef __cplusplus }; #endif #endif /*__RAY_FOUNDATION__*/
#ifndef xt_case_dumpster_h #define xt_case_dumpster_h #include "xt/case/array.h" #include "xt/case/list.h" #include "xt/case/set.h" #include "xt/core/iobject.h" struct xt_case_dumpster_t; typedef struct xt_case_dumpster_t xt_case_dumpster_t; xt_core_bool_t xt_case_dumpster_add(xt_case_dumpster_t *dumpster, void *object); xt_case_dumpster_t *xt_case_dumpster_create(xt_core_iobject_t *iobject); void xt_case_dumpster_destroy(xt_case_dumpster_t *dumpster); xt_core_bool_t xt_case_dumpster_take_objects_from_list (xt_case_dumpster_t *dumpster, xt_case_list_t *list); #endif
// // http_core_header_map.h // vClientTemplateLib // // Created by Virendra Shakya on 5/17/14. // Copyright (c) 2014 Virendra Shakya. All rights reserved. // #ifndef __vClientTemplateLib__http_core_header_group__ #define __vClientTemplateLib__http_core_header_group__ #include <string> #include "base/thread/thread_un_safe.h" #include "memory/ref/rc_thread_safe.h" #include "base/collect/map_thread_safe.h" namespace vctl { namespace net { namespace http { class THeader; //must be thread safe class CHttpHeadersMap : public vctl::CReferenceThreadSafe<CHttpHeadersMap> { public: static CHttpHeadersMap* New(); void Add(const THeader& aHeader); int Size() const; bool GetHeader(int aIndex, THeader& aHeaderReturn); protected: void Construct(); CHttpHeadersMap(); virtual ~CHttpHeadersMap(); friend class vctl::CReferenceThreadSafe<CHttpHeadersMap>; private: vbase::CMapThreadSafe<int, THeader> iMap; int iHeaderId; }; } //namespace http } //namespace net } //namespace vctl #endif /* defined(__vClientTemplateLib__http_core_header_group__) */
#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #ifdef FORTIFY #include "fortify/fortify.h" #endif #include "base/result.h" #include "datastruct/bitfifo.h" #include "test/all-tests.h" #define MAXSIZE 32 static const struct { int length; /* in bits */ unsigned int after_dequeue; } expected[] = { { 1, 0x00000001 }, { 2, 0x00000003 }, { 3, 0x00000007 }, { 4, 0x0000000F }, { 31, 0x7FFFFFFF }, { 32, 0xFFFFFFFF }, }; #define NELEMS(a) (int)(sizeof(a) / sizeof((a)[0])) /* shows changes from previous stats */ static void dump(const bitfifo_t *fifo) { static size_t previous_used = (size_t) -1; /* aka SIZE_MAX */ static int previous_full = INT_MAX; static int previous_empty = INT_MAX; size_t used; int full; int empty; used = bitfifo_used(fifo); full = bitfifo_full(fifo); empty = bitfifo_empty(fifo); printf("{"); if (used != previous_used) printf("used=%zu ", used); if (full != previous_full) printf("full=%d ", full); if (empty != previous_empty) printf("empty=%d ", empty); printf("}\n"); previous_used = used; previous_full = full; previous_empty = empty; } result_t bitfifo_test(const char *resources) { const unsigned int all_ones = ~0; result_t err; bitfifo_t *fifo; int i; unsigned int outbits; fifo = bitfifo_create(MAXSIZE); if (fifo == NULL) return result_OOM; dump(fifo); printf("test: enqueue/dequeue...\n"); for (i = 0; i < NELEMS(expected); i++) { int length; length = expected[i].length; printf("%d bits\n", length); /* put 'size_to_try' 1 bits into the queue */ err = bitfifo_enqueue(fifo, &all_ones, 0, length); if (err) goto Failure; dump(fifo); /* pull the bits back out */ outbits = 0; err = bitfifo_dequeue(fifo, &outbits, length); if (err) goto Failure; dump(fifo); if (outbits != expected[i].after_dequeue) printf("*** difference: %.8x <> %.8x\n", outbits, expected[i].after_dequeue); } printf("...done\n"); printf("test: completely fill up the fifo\n"); err = bitfifo_enqueue(fifo, &all_ones, 0, MAXSIZE); if (err) goto Failure; dump(fifo); printf("test: enqueue another bit (should error)\n"); err = bitfifo_enqueue(fifo, &all_ones, 0, 1); if (err != result_BITFIFO_FULL) goto Failure; dump(fifo); printf("test: do 32 dequeue-enqueue ops...\n"); for (i = 0; i < MAXSIZE; i++) { printf("dequeue a single bit\n"); err = bitfifo_dequeue(fifo, &outbits, 1); if (err) goto Failure; dump(fifo); printf("enqueue a single bit\n"); err = bitfifo_enqueue(fifo, &all_ones, 0, 1); if (err) goto Failure; dump(fifo); } printf("...done\n"); bitfifo_destroy(fifo); return result_TEST_PASSED; Failure: return result_TEST_FAILED; }
// // PolitiekAppDelegate.h // Politiek // // Created by Wolfgang Schreurs on 11/6/11. // Copyright 2012 Wolfgang Schreurs. All rights reserved. // #import <UIKit/UIKit.h> #import "AudioPlayerViewController.h" #import "FBConnect.h" @class Reachability; @interface OnsNieuwsAppDelegate : UIResponder <UIApplicationDelegate, FBSessionDelegate> @property (nonatomic, strong) UIWindow *window; @property (nonatomic, strong) Facebook *facebook; @property (nonatomic, strong) AudioPlayerViewController *audioPlayer; @end
/* @LICENSE(MUSLC_MIT) */ #include <sys/io.h> #include "internal/syscall.h" #ifdef SYS_iopl int iopl(int level) { return syscall(SYS_iopl, level); } #endif
/* * Show the TPM capability information * * Copyright (c) 2016, Wind River Systems, Inc. * All rights reserved. * * See "LICENSE" for license terms. * * Author: * Jia Zhang <zhang.jia@linux.alibaba.com> */ #include <efi.h> #include <efilib.h> #include <tcg2.h> EFI_STATUS efi_main(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *Systab) { InitializeLib(ImageHandle, Systab); UINT8 TpmCapabilitySize = 0; EFI_STATUS Status; Status = Tcg2GetCapability(NULL, &TpmCapabilitySize); if (EFI_ERROR(Status)) return Status; EFI_TCG2_BOOT_SERVICE_CAPABILITY *TpmCapability; TpmCapability = AllocatePool(TpmCapabilitySize); if (!TpmCapability) return Status; Status = Tcg2GetCapability(TpmCapability, &TpmCapabilitySize); if (EFI_ERROR(Status)) goto out; if (TpmCapability->StructureVersion.Major == 1 && TpmCapability->StructureVersion.Minor == 0) { TREE_BOOT_SERVICE_CAPABILITY *TrEECapability; TrEECapability = (TREE_BOOT_SERVICE_CAPABILITY *)TpmCapability; Print(L"Structure Size: %d-byte\n", (UINT8)TrEECapability->Size); Print(L"Structure Version: %d.%d\n", (UINT8)TrEECapability->StructureVersion.Major, (UINT8)TrEECapability->StructureVersion.Minor); Print(L"Protocol Version: %d.%d\n", (UINT8)TrEECapability->ProtocolVersion.Major, (UINT8)TrEECapability->ProtocolVersion.Minor); UINT32 Hash = TrEECapability->HashAlgorithmBitmap; Print(L"Supported Hash Algorithm: 0x%x (%s%s%s%s%s)\n", Hash, Hash & TREE_BOOT_HASH_ALG_SHA1 ? L"SHA-1" : L"", Hash & TREE_BOOT_HASH_ALG_SHA256 ? L" SHA-256" : L"", Hash & TREE_BOOT_HASH_ALG_SHA384 ? L" SHA-384" : L"", Hash & TREE_BOOT_HASH_ALG_SHA512 ? L" SHA-512" : L"", (Hash & ~TREE_BOOT_HASH_ALG_MASK) || !Hash ? L" dirty" : L""); EFI_TCG2_EVENT_LOG_BITMAP Format = TrEECapability->SupportedEventLogs; Print(L"Supported Event Log Format: 0x%x (%s%s%s)\n", Format, Format & TREE_EVENT_LOG_FORMAT_TCG_1_2 ? L"TCG1.2" : L"", (Format & ~TREE_EVENT_LOG_FORMAT_MASK) || !Format ? L" dirty" : L""); Print(L"TrEE Present: %s\n", TrEECapability->TrEEPresentFlag ? L"True" : L"False"); Print(L"Max Command Size: %d-byte\n", TrEECapability->MaxCommandSize); Print(L"Max Response Size: %d-byte\n", TrEECapability->MaxResponseSize); Print(L"Manufacturer ID: 0x%x\n", TrEECapability->ManufacturerID); } else if (TpmCapability->StructureVersion.Major == 1 && TpmCapability->StructureVersion.Minor == 1) { Print(L"Structure Size: %d-byte\n", TpmCapability->Size); Print(L"Structure Version: %d.%d\n", TpmCapability->StructureVersion.Major, TpmCapability->StructureVersion.Minor); Print(L"Protocol Version: %d.%d\n", TpmCapability->ProtocolVersion.Major, TpmCapability->ProtocolVersion.Minor); UINT8 Hash = TpmCapability->HashAlgorithmBitmap; Print(L"Supported Hash Algorithm: 0x%x (%s%s%s%s%s%s)\n", Hash, Hash & EFI_TCG2_BOOT_HASH_ALG_SHA1 ? L"SHA-1" : L"", Hash & EFI_TCG2_BOOT_HASH_ALG_SHA256 ? L" SHA-256" : L"", Hash & EFI_TCG2_BOOT_HASH_ALG_SHA384 ? L" SHA-384" : L"", Hash & EFI_TCG2_BOOT_HASH_ALG_SHA512 ? L" SHA-512" : L"", Hash & EFI_TCG2_BOOT_HASH_ALG_SM3_256 ? L" SM3-256" : L"", (Hash & ~EFI_TCG2_BOOT_HASH_ALG_MASK) || !Hash ? L" dirty" : L""); EFI_TCG2_EVENT_LOG_BITMAP Format = TpmCapability->SupportedEventLogs; Print(L"Supported Event Log Format: 0x%x (%s%s%s)\n", Format, Format & EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2 ? L"TCG1.2" : L"", Format & EFI_TCG2_EVENT_LOG_FORMAT_TCG_2 ? L" TCG2.0" : L"", (Format & ~EFI_TCG2_EVENT_LOG_FORMAT_MASK) || !Format ? L" dirty" : L""); Print(L"TPM Present: %s\n", TpmCapability->TPMPresentFlag ? L"True" : L"False"); Print(L"Max Command Size: %d-byte\n", TpmCapability->MaxCommandSize); Print(L"Max Response Size: %d-byte\n", TpmCapability->MaxResponseSize); Print(L"Manufacturer ID: 0x%x\n", TpmCapability->ManufacturerID); Print(L"Number of PCR Banks: %d%s\n", TpmCapability->NumberOfPcrBanks, !TpmCapability->NumberOfPcrBanks ? L"(dirty)" : L""); EFI_TCG2_EVENT_ALGORITHM_BITMAP Bank = TpmCapability->ActivePcrBanks; Print(L"Active PCR Banks: 0x%x (%s%s%s%s%s%s)\n", Bank, Bank & EFI_TCG2_BOOT_HASH_ALG_SHA1 ? L"SHA-1" : L"", Bank & EFI_TCG2_BOOT_HASH_ALG_SHA256 ? L" SHA-256" : L"", Bank & EFI_TCG2_BOOT_HASH_ALG_SHA384 ? L" SHA-384" : L"", Bank & EFI_TCG2_BOOT_HASH_ALG_SHA512 ? L" SHA-512" : L"", Bank & EFI_TCG2_BOOT_HASH_ALG_SM3_256 ? L" SM3-256" : L"", (Bank & ~EFI_TCG2_BOOT_HASH_ALG_MASK) || !Bank ? L" dirty" : L""); } else { Print(L"Unsupported structure version: %d.%d\n", TpmCapability->StructureVersion.Major, TpmCapability->StructureVersion.Minor); Status = EFI_UNSUPPORTED; } out: FreePool(TpmCapability); return Status; }
/* * Copyright 2019 Shannon F. Stewman * * See LICENCE for the full copyright terms. */ #ifndef ADT_EDGESET_H #define ADT_EDGESET_H #include <stdint.h> struct bm; struct set; struct fsm_alloc; struct fsm_edge; struct edge_set; struct state_set; struct edge_iter { size_t i, j; const struct edge_set *set; }; struct edge_ordered_iter { const struct edge_set *set; size_t pos; size_t steps; unsigned char symbol; uint64_t symbols_used[4]; }; enum edge_group_iter_type { EDGE_GROUP_ITER_ALL, EDGE_GROUP_ITER_UNIQUE }; struct edge_group_iter { const struct edge_set *set; unsigned flag; size_t i; uint64_t internal[256/64]; }; /* TODO: symbols: macros for bit flags, first, count, etc. */ struct edge_group_iter_info { int unique; fsm_state_t to; uint64_t symbols[256/64]; }; /* Reset an iterator for groups of edges. * If iter_type is set to EDGE_GROUP_ITER_UNIQUE, * edges with labels that only appear once will be * yielded with unique set to 1, all others set to 0. * If iter_type is EDGE_GROUP_ITER_ALL, they will not * be separated, and unique will not be set. */ void edge_set_group_iter_reset(const struct edge_set *s, enum edge_group_iter_type iter_type, struct edge_group_iter *egi); int edge_set_group_iter_next(struct edge_group_iter *egi, struct edge_group_iter_info *eg); /* Opaque struct type for edge iterator, * which does extra processing upfront to iterate over * edges in lexicographically ascending order; the * edge_iter iterator is unordered. */ struct edge_iter_ordered; /* Create an empty edge set. * This currently returns a NULL pointer. */ struct edge_set * edge_set_new(void); void edge_set_free(const struct fsm_alloc *a, struct edge_set *set); int edge_set_add(struct edge_set **set, const struct fsm_alloc *alloc, unsigned char symbol, fsm_state_t state); int edge_set_add_bulk(struct edge_set **pset, const struct fsm_alloc *alloc, uint64_t symbols[256/64], fsm_state_t state); /* Notify the data structure that it wis likely to soon need to grow * to fit N more bulk edge groups. This can avoid resizing multiple times * in smaller increments. */ int edge_set_advise_growth(struct edge_set **pset, const struct fsm_alloc *alloc, size_t count); int edge_set_add_state_set(struct edge_set **setp, const struct fsm_alloc *alloc, unsigned char symbol, const struct state_set *state_set); int edge_set_find(const struct edge_set *set, unsigned char symbol, struct fsm_edge *e); int edge_set_contains(const struct edge_set *set, unsigned char symbol); int edge_set_hasnondeterminism(const struct edge_set *set, struct bm *bm); int edge_set_transition(const struct edge_set *set, unsigned char symbol, fsm_state_t *state); size_t edge_set_count(const struct edge_set *set); /* Note: this should actually union src into *dst, if *dst already * exists, not replace it. */ int edge_set_copy(struct edge_set **dst, const struct fsm_alloc *alloc, const struct edge_set *src); void edge_set_remove(struct edge_set **set, unsigned char symbol); void edge_set_remove_state(struct edge_set **set, fsm_state_t state); int edge_set_compact(struct edge_set **set, const struct fsm_alloc *alloc, fsm_state_remap_fun *remap, const void *opaque); void edge_set_reset(const struct edge_set *set, struct edge_iter *it); int edge_set_next(struct edge_iter *it, struct fsm_edge *e); void edge_set_rebase(struct edge_set **setp, fsm_state_t base); int edge_set_replace_state(struct edge_set **setp, const struct fsm_alloc *alloc, fsm_state_t old, fsm_state_t new); int edge_set_empty(const struct edge_set *s); /* Initialize an ordered edge_set iterator, positioning it at the first * edge with a particular symbol. edge_set_ordered_iter_next will get * successive edges with that symbol, then lexicographically following * symbols (if any). */ void edge_set_ordered_iter_reset_to(const struct edge_set *set, struct edge_ordered_iter *eoi, unsigned char symbol); /* Reset an ordered iterator, equivalent to * edge_set_ordered_iter_reset_to(set, eoi, '\0'). */ void edge_set_ordered_iter_reset(const struct edge_set *set, struct edge_ordered_iter *eoi); /* Get the next edge from an ordered iterator and return 1, * or return 0 when no more are available. */ int edge_set_ordered_iter_next(struct edge_ordered_iter *eoi, struct fsm_edge *e); #endif
// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_SYNC_NOTIFIER_BASE_SSL_ADAPTER_H_ #define CHROME_BROWSER_SYNC_NOTIFIER_BASE_SSL_ADAPTER_H_ namespace talk_base { class AsyncSocket; class SSLAdapter; } // namespace talk_base namespace notifier { // Wraps the given socket in a platform-dependent SSLAdapter // implementation. talk_base::SSLAdapter* CreateSSLAdapter(talk_base::AsyncSocket* socket); // Utility template class that overrides CreateSSLAdapter() to use the // above function. template <class SocketFactory> class SSLAdapterSocketFactory : public SocketFactory { public: virtual talk_base::SSLAdapter* CreateSSLAdapter( talk_base::AsyncSocket* socket) { return ::notifier::CreateSSLAdapter(socket); } }; } // namespace notifier #endif // CHROME_BROWSER_SYNC_NOTIFIER_BASE_SSL_ADAPTER_H_
#ifndef __LULESH_TYPES_H__ #define __LULESH_TYPES_H__ #include <math.h> // Allow flexibility for arithmetic representations // Could also support fixed point and interval arithmetic types typedef float real4; typedef double real8; typedef long double real10; // 10 bytes on x86 typedef int Index_t; // array subscript and loop index typedef real8 Real_t; // floating point representation typedef int Int_t; // integer representation inline real4 SQRT(real4 arg) { return sqrtf(arg); } inline real8 SQRT(real8 arg) { return sqrt(arg); } inline real10 SQRT(real10 arg) { return sqrtl(arg); } inline real4 CBRT(real4 arg) { return cbrtf(arg); } inline real8 CBRT(real8 arg) { return cbrt(arg); } inline real10 CBRT(real10 arg) { return cbrtl(arg); } inline real4 FABS(real4 arg) { return fabsf(arg); } inline real8 FABS(real8 arg) { return fabs(arg); } inline real10 FABS(real10 arg) { return fabsl(arg); } struct Dom { // Simulation Time Real_t deltaTime; Real_t totalTime; // Ghosts std::vector<Real_t> ng_front; std::vector<Real_t> ng_back; std::vector<Real_t> ng_right; std::vector<Real_t> ng_left; std::vector<Real_t> ng_up; std::vector<Real_t> ng_down; // Node centered persistent std::vector<Real_t> m_x; std::vector<Real_t> m_y; std::vector<Real_t> m_z; std::vector<Real_t> m_xd; std::vector<Real_t> m_yd; std::vector<Real_t> m_zd; std::vector<Real_t> m_xdd; std::vector<Real_t> m_ydd; std::vector<Real_t> m_zdd; std::vector<Real_t> m_fx; std::vector<Real_t> m_fy; std::vector<Real_t> m_fz; std::vector<Real_t> m_nodalMass; // Node centered nodesets std::vector<Index_t> m_symmX; std::vector<Index_t> m_symmY; std::vector<Index_t> m_symmZ; // Elem centered persistent std::vector<Index_t> m_matElemlist; std::vector<Index_t> m_nodelist; std::vector<Index_t> m_lxim; std::vector<Index_t> m_lxip; std::vector<Index_t> m_letam; std::vector<Index_t> m_letap; std::vector<Index_t> m_lzetam; std::vector<Index_t> m_lzetap; std::vector<Int_t> m_elemBC; std::vector<Real_t> m_e; std::vector<Real_t> m_p; std::vector<Real_t> m_q; std::vector<Real_t> m_ql; std::vector<Real_t> m_qq; std::vector<Real_t> m_v; std::vector<Real_t> m_volo; std::vector<Real_t> m_delv; std::vector<Real_t> m_vdov; std::vector<Real_t> m_arealg; std::vector<Real_t> m_ss; std::vector<Real_t> m_elemMass; // Elem centered temporary std::vector<Real_t> m_dxx; std::vector<Real_t> m_dyy; std::vector<Real_t> m_dzz; std::vector<Real_t> m_delv_xi; std::vector<Real_t> m_delv_eta; std::vector<Real_t> m_delv_zeta; std::vector<Real_t> m_delx_xi; std::vector<Real_t> m_delx_eta; std::vector<Real_t> m_delx_zeta; std::vector<Real_t> m_vnew; std::vector<Real_t> m_determ; // Parameters Real_t u_cut; Real_t hgcoef; Real_t qstop; Real_t monoq_max_slope; Real_t monoq_limiter_mult; Real_t e_cut; Real_t p_cut; Real_t ss4o3; Real_t q_cut; Real_t v_cut; Real_t qlc_monoq; Real_t qqc_monoq; Real_t qqc; Real_t eosvmax; Real_t eosvmin; Real_t pmin; Real_t emin; Real_t dvovmax; Real_t refdens; Real_t m_dtcourant; Real_t m_dthydro; }; #endif //__LULESH_TYPES_H__
// // IDPAppDelegate.h // OSX // // Created by Oleksa Korin on 10/1/15. // Copyright (c) 2015 IDAP Group. All rights reserved. // #import <Cocoa/Cocoa.h> @interface IDPAppDelegate : NSObject <NSApplicationDelegate> @property (assign) IBOutlet NSWindow *window; @end
// // AppDelegate.h // GiottoDataViewer // // Created by Eiji Hayashi on 3/20/16. // Copyright © 2016 Eiji Hayashi. All rights reserved. // #import <UIKit/UIKit.h> #import "GVLocationManager.h" @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) GVLocationManager* locationManager; @end
// // CachetHQIncidents.h // CachetHQIncidents // // Created by Yoann Gini on 12/09/2018. // Copyright © 2018 Yoann Gini (Open Source Project). All rights reserved. // #import <HITDevKit/HITDevKit.h> @interface CachetHQIncidents : HITPeriodicPlugin @end
// Copyright 2015 The Cobalt 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 COBALT_BINDINGS_TESTING_CONSTRUCTOR_WITH_ARGUMENTS_INTERFACE_H_ #define COBALT_BINDINGS_TESTING_CONSTRUCTOR_WITH_ARGUMENTS_INTERFACE_H_ #include <string> #include "cobalt/script/wrappable.h" namespace cobalt { namespace bindings { namespace testing { class ConstructorWithArgumentsInterface : public script::Wrappable { public: ConstructorWithArgumentsInterface() {} ConstructorWithArgumentsInterface(int32_t arg1, bool arg2, const std::string& arg3) : arg1_(arg1), arg2_(arg2), arg3_(arg3) {} int32_t long_arg() { return arg1_; } bool boolean_arg() { return arg2_; } std::string string_arg() { return arg3_; } DEFINE_WRAPPABLE_TYPE(ConstructorWithArgumentsInterface); private: int32_t arg1_; bool arg2_; std::string arg3_; }; } // namespace testing } // namespace bindings } // namespace cobalt #endif // COBALT_BINDINGS_TESTING_CONSTRUCTOR_WITH_ARGUMENTS_INTERFACE_H_
// Copyright 2010-2016, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef MOZC_RENDERER_MAC_INFOLIST_VIEW_H_ #define MOZC_RENDERER_MAC_INFOLIST_VIEW_H_ #import <Cocoa/Cocoa.h> #include "protocol/renderer_command.pb.h" namespace mozc { namespace renderer { class RendererStyle; } // namespace mozc::renderer } // namespace mozc // InfolistView is an NSView subclass to draw the infolist window // according to the current candidates. @interface InfolistView : NSView { @private mozc::commands::Candidates candidates_; const mozc::renderer::RendererStyle *style_; // The row which has focused background. int focusedRow_; } // setCandidates: sets the candidates to be rendered. - (void)setCandidates:(const mozc::commands::Candidates *)candidates; // Checks the |candidates_| and recalculates the layout. // It also returns the size which is necessary to draw all GUI elements. - (NSSize)updateLayout; @end #endif // MOZC_RENDERER_MAC_INFOLIST_VIEW_H_
#include <ncurses.h> int main() { initscr(); printw("Hello, nCurses World"); refresh(); getch(); endwin(); return 0; }
// SDLHmiZoneCapabilities.h // #import "SDLEnum.h" /** * Specifies HMI Zones in the vehicle. Used in RegisterAppInterfaceResponse * * @since SDL 1.0 */ typedef SDLEnum SDLHMIZoneCapabilities NS_TYPED_ENUM; /** * Indicates HMI available for front seat passengers. */ extern SDLHMIZoneCapabilities const SDLHMIZoneCapabilitiesFront; /** * Indicates HMI available for rear seat passengers. */ extern SDLHMIZoneCapabilities const SDLHMIZoneCapabilitiesBack;
#ifndef TASK_ADD #define TASK_ADD extern struct Mmutex MutexA; #endif // TASK_ADD
/*************************************************************************** # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the name of NVIDIA CORPORATION nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. **************************************************************************/ #pragma once #pragma warning(push) #pragma warning(disable : 4244 4267) #include <nanovdb/NanoVDB.h> #include <nanovdb/util/GridHandle.h> #include <nanovdb/util/HostBuffer.h> #pragma warning(pop) #include "BrickedGrid.h" namespace Falcor { /** Voxel grid based on NanoVDB. */ class FALCOR_API Grid { public: using SharedPtr = std::shared_ptr<Grid>; /** Create a sphere voxel grid. \param[in] radius Radius of the sphere in world units. \param[in] voxelSize Size of a voxel in world units. \param[in] blendRange Range in voxels to blend from 0 to 1 (starting at surface inwards). \return A new grid. */ static SharedPtr createSphere(float radius, float voxelSize, float blendRange = 2.f); /** Create a box voxel grid. \param[in] width Width of the box in world units. \param[in] height Height of the box in world units. \param[in] depth Depth of the box in world units. \param[in] voxelSize Size of a voxel in world units. \param[in] blendRange Range in voxels to blend from 0 to 1 (starting at surface inwards). \return A new grid. */ static SharedPtr createBox(float width, float height, float depth, float voxelSize, float blendRange = 2.f); /** Create a grid from a file. Currently only OpenVDB and NanoVDB grids of type float are supported. \param[in] filename Filename of the grid. Can also include a full path or relative path from a data directory. \param[in] gridname Name of the grid to load. \return A new grid, or nullptr if the grid failed to load. */ static SharedPtr createFromFile(const std::string& filename, const std::string& gridname); /** Render the UI. */ void renderUI(Gui::Widgets& widget); /** Bind the grid to a given shader var. \param[in] var The shader variable to set the data into. */ void setShaderData(const ShaderVar& var); /** Get the minimum index stored in the grid. */ int3 getMinIndex() const; /** Get the maximum index stored in the grid. */ int3 getMaxIndex() const; /** Get the minimum value stored in the grid. */ float getMinValue() const; /** Get the maximum value stored in the grid. */ float getMaxValue() const; /** Get the total number of active voxels in the grid. */ uint64_t getVoxelCount() const; /** Get the size of the grid in bytes as allocated in GPU memory. */ uint64_t getGridSizeInBytes() const; /** Get the grid's bounds in world space. */ AABB getWorldBounds() const; /** Get a value stored in the grid. Note: This function is not safe for access from multiple threads. \param[in] ijk The index-space position to access the data from. */ float getValue(const int3& ijk) const; /** Get the raw NanoVDB grid handle. */ const nanovdb::GridHandle<nanovdb::HostBuffer>& getGridHandle() const; /** Get the (affine) NanoVDB transformation matrix. */ glm::mat4 getTransform() const; /** Get the inverse (affine) NanoVDB transformation matrix. */ glm::mat4 getInvTransform() const; private: Grid(nanovdb::GridHandle<nanovdb::HostBuffer> gridHandle); static SharedPtr createFromNanoVDBFile(const std::string& path, const std::string& gridname); static SharedPtr createFromOpenVDBFile(const std::string& path, const std::string& gridname); // Host data. nanovdb::GridHandle<nanovdb::HostBuffer> mGridHandle; nanovdb::FloatGrid* mpFloatGrid; nanovdb::FloatGrid::AccessorType mAccessor; // Device data. Buffer::SharedPtr mpBuffer; BrickedGrid mBrickedGrid; friend class SceneCache; }; }
#pragma once #include <folly/MPMCQueue.h> #include <memory> #include <string> #include <thread> namespace comm { using taskType = std::function<void()>; class WorkerThread { std::unique_ptr<std::thread> thread; folly::MPMCQueue<std::unique_ptr<taskType>> tasks; const std::string name; public: WorkerThread(const std::string name); void scheduleTask(const taskType task); ~WorkerThread(); }; } // namespace comm
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE126_Buffer_Overread__malloc_wchar_t_memcpy_53a.c Label Definition File: CWE126_Buffer_Overread__malloc.label.xml Template File: sources-sink-53a.tmpl.c */ /* * @description * CWE: 126 Buffer Over-read * BadSource: Use a small buffer * GoodSource: Use a large buffer * Sink: memcpy * BadSink : Copy data to string using memcpy * Flow Variant: 53 Data flow: data passed as an argument from one function through two others to a fourth; all four functions are in different source files * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD /* bad function declaration */ void CWE126_Buffer_Overread__malloc_wchar_t_memcpy_53b_badSink(wchar_t * data); void CWE126_Buffer_Overread__malloc_wchar_t_memcpy_53_bad() { wchar_t * data; data = NULL; /* FLAW: Use a small buffer */ data = (wchar_t *)malloc(50*sizeof(wchar_t)); if (data == NULL) {exit(-1);} wmemset(data, L'A', 50-1); /* fill with 'A's */ data[50-1] = L'\0'; /* null terminate */ CWE126_Buffer_Overread__malloc_wchar_t_memcpy_53b_badSink(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* good function declaration */ void CWE126_Buffer_Overread__malloc_wchar_t_memcpy_53b_goodG2BSink(wchar_t * data); /* goodG2B uses the GoodSource with the BadSink */ static void goodG2B() { wchar_t * data; data = NULL; /* FIX: Use a large buffer */ data = (wchar_t *)malloc(100*sizeof(wchar_t)); if (data == NULL) {exit(-1);} wmemset(data, L'A', 100-1); /* fill with 'A's */ data[100-1] = L'\0'; /* null terminate */ CWE126_Buffer_Overread__malloc_wchar_t_memcpy_53b_goodG2BSink(data); } void CWE126_Buffer_Overread__malloc_wchar_t_memcpy_53_good() { goodG2B(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE126_Buffer_Overread__malloc_wchar_t_memcpy_53_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE126_Buffer_Overread__malloc_wchar_t_memcpy_53_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
// Copyright 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CC_RESOURCE_UPDATE_CONTROLLER_H_ #define CC_RESOURCE_UPDATE_CONTROLLER_H_ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/time.h" #include "cc/cc_export.h" #include "cc/resource_update_queue.h" namespace cc { class ResourceProvider; class Thread; class ResourceUpdateControllerClient { public: virtual void readyToFinalizeTextureUpdates() = 0; protected: virtual ~ResourceUpdateControllerClient() { } }; class CC_EXPORT ResourceUpdateController { public: static scoped_ptr<ResourceUpdateController> create(ResourceUpdateControllerClient* client, Thread* thread, scoped_ptr<ResourceUpdateQueue> queue, ResourceProvider* resourceProvider) { return make_scoped_ptr(new ResourceUpdateController(client, thread, queue.Pass(), resourceProvider)); } static size_t maxPartialTextureUpdates(); virtual ~ResourceUpdateController(); // Discard uploads to textures that were evicted on the impl thread. void discardUploadsToEvictedResources(); void performMoreUpdates(base::TimeTicks timeLimit); void finalize(); // Virtual for testing. virtual base::TimeTicks now() const; virtual base::TimeDelta updateMoreTexturesTime() const; virtual size_t updateMoreTexturesSize() const; protected: ResourceUpdateController(ResourceUpdateControllerClient*, Thread*, scoped_ptr<ResourceUpdateQueue>, ResourceProvider*); private: static size_t maxFullUpdatesPerTick(ResourceProvider*); size_t maxBlockingUpdates() const; base::TimeDelta pendingUpdateTime() const; void updateTexture(ResourceUpdate); // This returns true when there were textures left to update. bool updateMoreTexturesIfEnoughTimeRemaining(); void updateMoreTexturesNow(); void onTimerFired(); ResourceUpdateControllerClient* m_client; scoped_ptr<ResourceUpdateQueue> m_queue; bool m_contentsTexturesPurged; ResourceProvider* m_resourceProvider; base::TimeTicks m_timeLimit; size_t m_textureUpdatesPerTick; bool m_firstUpdateAttempt; Thread* m_thread; base::WeakPtrFactory<ResourceUpdateController> m_weakFactory; bool m_taskPosted; DISALLOW_COPY_AND_ASSIGN(ResourceUpdateController); }; } // namespace cc #endif // CC_RESOURCE_UPDATE_CONTROLLER_H_
/* * Copyright (C) 2002, 2003 The Karbon Developers * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org> * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. * 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 SVGPathParser_h #define SVGPathParser_h #include "core/CoreExport.h" #include "core/svg/SVGPathData.h" #include "platform/heap/Handle.h" namespace blink { enum PathParsingMode { NormalizedParsing, UnalteredParsing }; class SVGPathConsumer; class SVGPathSource; class CORE_EXPORT SVGPathParser final { WTF_MAKE_NONCOPYABLE(SVGPathParser); STACK_ALLOCATED(); public: SVGPathParser(SVGPathSource* source, SVGPathConsumer* consumer) : m_source(source) , m_consumer(consumer) { ASSERT(m_source); ASSERT(m_consumer); } bool parsePathDataFromSource(PathParsingMode pathParsingMode, bool checkForInitialMoveTo = true) { ASSERT(m_source); ASSERT(m_consumer); if (checkForInitialMoveTo && !initialCommandIsMoveTo()) return false; if (pathParsingMode == NormalizedParsing) return parseAndNormalizePath(); return parsePath(); } private: bool initialCommandIsMoveTo(); bool parsePath(); bool parseAndNormalizePath(); SVGPathSource* m_source; SVGPathConsumer* m_consumer; }; } // namespace blink #endif // SVGPathParser_h
/************************************************************************/ /* */ /* PmodR2R.c -- Template driver for a Pmod which uses GPIO */ /* */ /************************************************************************/ /* Author: Thomas Kappenman, Arthur Brown */ /* Copyright 2015, Digilent Inc. */ /************************************************************************/ /* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /************************************************************************/ /* File Description: */ /* */ /* This file contains a template that you can use to create a library */ /* for the PmodR2R (insert name, duh). */ /* */ /************************************************************************/ /* Revision History: */ /* */ /* 04/19/2016(TommyK): Created /* 06/13/2016(ArtVVB): Edited for PmodR2R */ /* */ /************************************************************************/ #ifndef PmodR2R_H #define PmodR2R_H /****************** Include Files ********************/ #include "xil_types.h" #include "xstatus.h" /* ------------------------------------------------------------ */ /* Definitions */ /* ------------------------------------------------------------ */ #define bool u8 #define true 1 #define false 0 typedef struct PmodR2R{ u32 GPIO_addr; }PmodR2R; void R2R_begin(PmodR2R* InstancePtr, u32 GPIO_Address); void R2R_writeVoltage(PmodR2R* InstancePtr, double voltage); void R2R_delay(int millis); #endif // PmodR2R_H
// Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #ifndef XFA_FWL_CFX_BARCODE_H_ #define XFA_FWL_CFX_BARCODE_H_ #include <memory> #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" #include "core/fxge/fx_dib.h" #include "xfa/fxbarcode/BC_Library.h" class CBC_CodeBase; class CFX_Font; class CFX_RenderDevice; class CFX_Matrix; class CFX_Barcode { public: CFX_Barcode(); ~CFX_Barcode(); bool Create(BC_TYPE type); BC_TYPE GetType(); bool Encode(const CFX_WideStringC& contents, bool isDevice, int32_t& e); bool RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matrix, int32_t& e); bool SetCharEncoding(BC_CHAR_ENCODING encoding); bool SetModuleHeight(int32_t moduleHeight); bool SetModuleWidth(int32_t moduleWidth); bool SetHeight(int32_t height); bool SetWidth(int32_t width); bool SetPrintChecksum(bool checksum); bool SetDataLength(int32_t length); bool SetCalChecksum(bool state); bool SetFont(CFX_Font* pFont); bool SetFontSize(FX_FLOAT size); bool SetFontColor(FX_ARGB color); bool SetTextLocation(BC_TEXT_LOC location); bool SetWideNarrowRatio(int32_t ratio); bool SetStartChar(FX_CHAR start); bool SetEndChar(FX_CHAR end); bool SetVersion(int32_t version); bool SetErrorCorrectionLevel(int32_t level); bool SetTruncated(bool truncated); private: std::unique_ptr<CBC_CodeBase> m_pBCEngine; }; #endif // XFA_FWL_CFX_BARCODE_H_
/* $NetBSD: bootconfig.h,v 1.2 2002/04/12 18:01:17 bjh21 Exp $ */ /* * Copyright (c) 1994 Mark Brinicombe. * Copyright (c) 1994 Brini. * All rights reserved. * * This code is derived from software written for Brini by Mark Brinicombe * * 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 Mark Brinicombe * for the NetBSD Project. * 4. The name of the company nor the name of the author may 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 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. * * boot configuration structures * * Created : 12/09/94 * * Based on kate/boot/bootconfig.h */ typedef struct _PhysMem { u_int address; u_int pages; } PhysMem; #define DRAM_BLOCKS 1 typedef struct _BootConfig { PhysMem dram[DRAM_BLOCKS]; u_int dramblocks; } BootConfig; extern BootConfig bootconfig; #define MAX_BOOT_STRING 255 #ifdef _KERNEL #define BOOTOPT_TYPE_BOOLEAN 0 #define BOOTOPT_TYPE_STRING 1 #define BOOTOPT_TYPE_INT 2 #define BOOTOPT_TYPE_BININT 3 #define BOOTOPT_TYPE_HEXINT 4 #define BOOTOPT_TYPE_MASK 7 int get_bootconf_option __P((char *string, char *option, int type, void *result)); extern char *boot_args; extern char *boot_file; #endif /* _KERNEL */ /* End of bootconfig.h */
#ifndef CONSTRAINT_CHECKER_H #define CONSTRAINT_CHECKER_H #include <Klampt/Modeling/Robot.h> #include <Klampt/Modeling/Terrain.h> #include <Klampt/Contact/Stance.h> namespace Klampt { /** @ingroup Planning * @brief Checks for static constraints for a robot at a given stance. */ struct ConstraintChecker { static Real ContactDistance(const RobotModel& robot,const Stance& stance); static bool HasContact(const RobotModel& robot,const Stance& stance,Real maxDist); static bool HasContactVelocity(const RobotModel& robot,const Stance& stance,Real maxErr); static bool HasJointLimits(const RobotModel& robot); static bool HasVelocityLimits(const RobotModel& robot); static bool HasSupportPolygon(const RobotModel& robot,const Stance& stance,const Vector3& gravity,int numFCEdges=4); static bool HasSupportPolygon_Robust(const RobotModel& robot,const Stance& stance,const Vector3& gravity,Real robustnessFactor,int numFCEdges=4); static bool HasEnvCollision(RobotModel& robot,TerrainModel& env); //same as above, but ignores fixed links static bool HasEnvCollision(RobotModel& robot,TerrainModel& env,const Stance& stance, const vector<int>& ignoreList); static bool HasEnvCollision(RobotModel& robot,TerrainModel& env,const vector<IKGoal>& fixedLinks, const vector<int>& ignoreList); static bool HasEnvCollision(RobotModel& robot,TerrainModel& env,const vector<IKGoal>& fixedLinks); static bool HasSelfCollision(RobotModel& robot); static bool HasTorqueLimits(RobotModel& robot,const Stance& stance,const Vector3& gravity,int numFCEdges=4); }; } //namespace Klampt #endif
/* Provide support for both ANSI and non-ANSI environments. */ /* Some ANSI environments are "broken" in the sense that __STDC__ cannot be relied upon to have it's intended meaning. Therefore we must use our own concoction: _HAVE_STDC. Always use _HAVE_STDC instead of __STDC__ in newlib sources! To get a strict ANSI C environment, define macro __STRICT_ANSI__. This will "comment out" the non-ANSI parts of the ANSI header files (non-ANSI header files aren't affected). */ #ifndef _ANSIDECL_H_ #define _ANSIDECL_H_ #include <sdk/newlib.h> #include <sdk/sys/config.h> /* First try to figure out whether we really are in an ANSI C environment. */ /* FIXME: This probably needs some work. Perhaps sys/config.h can be prevailed upon to give us a clue. */ #ifdef __STDC__ #define _HAVE_STDC #endif /* ISO C++. */ #ifdef __cplusplus #if !(defined(_BEGIN_STD_C) && defined(_END_STD_C)) #ifdef _HAVE_STD_CXX #define _BEGIN_STD_C namespace std { extern "C" { #define _END_STD_C } } #else #define _BEGIN_STD_C extern "C" { #define _END_STD_C } #endif #if defined(__GNUC__) && \ ( (__GNUC__ >= 4) || \ ( (__GNUC__ >= 3) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 3) ) ) #define _NOTHROW __attribute__ ((nothrow)) #else #define _NOTHROW throw() #endif #endif #else #define _BEGIN_STD_C #define _END_STD_C #define _NOTHROW #endif #ifdef _HAVE_STDC #define _PTR void * #define _AND , #define _NOARGS void #define _CONST const #define _VOLATILE volatile #define _SIGNED signed #define _DOTS , ... #define _VOID void #ifdef __CYGWIN__ #define _EXFUN_NOTHROW(name, proto) __cdecl name proto _NOTHROW #define _EXFUN(name, proto) __cdecl name proto #define _EXPARM(name, proto) (* __cdecl name) proto #define _EXFNPTR(name, proto) (__cdecl * name) proto #else #define _EXFUN_NOTHROW(name, proto) name proto _NOTHROW #define _EXFUN(name, proto) name proto #define _EXPARM(name, proto) (* name) proto #define _EXFNPTR(name, proto) (* name) proto #endif #define _DEFUN(name, arglist, args) name(args) #define _DEFUN_VOID(name) name(_NOARGS) #define _CAST_VOID (void) #ifndef _LONG_DOUBLE #define _LONG_DOUBLE long double #endif #ifndef _LONG_LONG_TYPE #define _LONG_LONG_TYPE long long #endif #ifndef _PARAMS #define _PARAMS(paramlist) paramlist #endif #else #define _PTR char * #define _AND ; #define _NOARGS #define _CONST #define _VOLATILE #define _SIGNED #define _DOTS #define _VOID void #define _EXFUN(name, proto) name() #define _EXFUN_NOTHROW(name, proto) name() #define _DEFUN(name, arglist, args) name arglist args; #define _DEFUN_VOID(name) name() #define _CAST_VOID #define _LONG_DOUBLE double #define _LONG_LONG_TYPE long #ifndef _PARAMS #define _PARAMS(paramlist) () #endif #endif /* Support gcc's __attribute__ facility. */ #ifdef __GNUC__ #define _ATTRIBUTE(attrs) __attribute__ (attrs) #else #define _ATTRIBUTE(attrs) #endif /* The traditional meaning of 'extern inline' for GCC is not to emit the function body unless the address is explicitly taken. However this behaviour is changing to match the C99 standard, which uses 'extern inline' to indicate that the function body *must* be emitted. If we are using GCC, but do not have the new behaviour, we need to use extern inline; if we are using a new GCC with the C99-compatible behaviour, or a non-GCC compiler (which we will have to hope is C99, since there is no other way to achieve the effect of omitting the function if it isn't referenced) we just use plain 'inline', which c99 defines to mean more-or-less the same as the Gnu C 'extern inline'. */ #if defined(__GNUC__) && !defined(__GNUC_STDC_INLINE__) /* We're using GCC, but without the new C99-compatible behaviour. */ #define _ELIDABLE_INLINE extern __inline__ _ATTRIBUTE ((__always_inline__)) #else /* We're using GCC in C99 mode, or an unknown compiler which we just have to hope obeys the C99 semantics of inline. */ #define _ELIDABLE_INLINE __inline__ #endif #endif /* _ANSIDECL_H_ */
#define args_t <%=name%>_args_t typedef struct { enum CBLAS_ORDER order; enum CBLAS_UPLO uplo; enum CBLAS_TRANSPOSE trans; dtype alpha, beta; blasint n, k; } args_t; #define func_p <%=func_name%>_p static <%=func_name%>_t func_p = 0; static void <%=c_iter%>(na_loop_t *const lp) { dtype *a, *b, *c; blasint lda, ldb, ldc; args_t *g; a = (dtype*)NDL_PTR(lp,0); b = (dtype*)NDL_PTR(lp,1); c = (dtype*)NDL_PTR(lp,2); g = (args_t*)(lp->opt_ptr); lda = NDL_STEP(lp,0) / sizeof(dtype); ldb = NDL_STEP(lp,1) / sizeof(dtype); ldc = NDL_STEP(lp,2) / sizeof(dtype); (*func_p)(g->order, g->uplo, g->trans, g->n, g->k, DP(g->alpha), a, lda, b, ldb, DP(g->beta), c, ldc); } /*<% params = [ mat("a","n-by-k"), mat("b","n-by-k"), mat("c","n-by-n, optional",:inpace), opt("alpha"), opt("beta"), opt("uplo"), opt("trans"), opt("order") ].select{|x| x}.join("\n ") %> @overload <%=name%>( a, b, [c, alpha:1, beta:0, uplo:'U', trans:'N', order:'R'] ) <%=params%> @return [<%=class_name%>] returns c. <%=description%> */ static VALUE <%=c_func(-1)%>(int argc, VALUE const argv[], VALUE UNUSED(mod)) { VALUE ans; VALUE a, b, c=Qnil, alpha, beta; narray_t *na1, *na2, *na3; blasint na, ka, kb, nb, nc, tmp; size_t shape[2]; ndfunc_arg_in_t ain[4] = {{cT,2},{cT,2},{OVERWRITE,2},{sym_init,0}}; ndfunc_arg_out_t aout[1] = {{cT,2,shape}}; ndfunc_t ndf = {<%=c_iter%>, NO_LOOP, 3, 0, ain, aout}; args_t g; VALUE kw_hash = Qnil; ID kw_table[5] = {id_alpha,id_beta,id_order,id_uplo,id_trans}; VALUE opts[5] = {Qundef,Qundef,Qundef,Qundef,Qundef}; CHECK_FUNC(func_p,"<%=func_name%>"); rb_scan_args(argc, argv, "21:", &a, &b, &c, &kw_hash); rb_get_kwargs(kw_hash, kw_table, 0, 5, opts); alpha = option_value(opts[0],Qnil); g.alpha = RTEST(alpha) ? m_num_to_data(alpha) : m_one; beta = option_value(opts[1],Qnil); g.beta = RTEST(beta) ? m_num_to_data(beta) : m_zero; g.order = option_order(opts[2]); g.uplo = option_uplo(opts[3]); g.trans = option_trans(opts[4]); GetNArray(a,na1); GetNArray(b,na2); CHECK_DIM_GE(na1,2); CHECK_DIM_GE(na2,2); na = ROW_SIZE(na1); // n ka = COL_SIZE(na1); // k (lda) SWAP_IFCOLTR(g.order, g.trans, na, ka, tmp); nb = ROW_SIZE(na2); // n kb = COL_SIZE(na2); // k (ldb) SWAP_IFCOLTR(g.order, g.trans, kb, nb, tmp); CHECK_INT_EQ("na",na,"nb",nb); CHECK_INT_EQ("ka",ka,"kb",kb); g.n = nb; g.k = kb; SWAP_IFROW(g.order, na, nb, tmp); if (c == Qnil) { // c is not given. ndf.nout = 1; ain[2] = ain[3]; c = INT2FIX(0); shape[0] = nb; shape[1] = na; } else { COPY_OR_CAST_TO(c,cT); GetNArray(c,na3); CHECK_DIM_GE(na3,2); nc = ROW_SIZE(na3); // n if (nc < nb) { rb_raise(nary_eShapeError,"nc=%d must be >= nb=%d",nc,nb); } //CHECK_LEADING_GE("ldc",g.ldc,"n",na); } ans = na_ndloop3(&ndf, &g, 3, a, b, c); if (ndf.nout = 1) { // c is not given. return ans; } else { return c; } } #undef func_p #undef args_t
/* * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_H_ #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_H_ #include <sstream> #include "webrtc/modules/remote_bitrate_estimator/test/packet.h" #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" namespace webrtc { namespace testing { namespace bwe { const int kMinBitrateKbps = 150; const int kMaxBitrateKbps = 2000; class BweSender : public Module { public: BweSender() {} virtual ~BweSender() {} virtual int GetFeedbackIntervalMs() const = 0; virtual void GiveFeedback(const FeedbackPacket& feedback) = 0; virtual void OnPacketsSent(const Packets& packets) = 0; private: DISALLOW_COPY_AND_ASSIGN(BweSender); }; class BweReceiver { public: explicit BweReceiver(int flow_id) : flow_id_(flow_id) {} virtual ~BweReceiver() {} virtual void ReceivePacket(int64_t arrival_time_ms, const MediaPacket& media_packet) {} virtual FeedbackPacket* GetFeedback(int64_t now_ms) { return NULL; } protected: int flow_id_; }; enum BandwidthEstimatorType { kNullEstimator, kNadaEstimator, kRembEstimator, kFullSendSideEstimator }; int64_t GetAbsSendTimeInMs(uint32_t abs_send_time); BweSender* CreateBweSender(BandwidthEstimatorType estimator, int kbps, BitrateObserver* observer, Clock* clock); BweReceiver* CreateBweReceiver(BandwidthEstimatorType type, int flow_id, bool plot); } // namespace bwe } // namespace testing } // namespace webrtc #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_H_
/********************************************************************* * Software License Agreement (BSD License) * * Copyright (c) 2013, Willow Garage, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of Willow Garage nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. *********************************************************************/ /* Author: Acorn Pooley, Ioan Sucan */ #pragma once #include <moveit/collision_detection/collision_env.h> #include <moveit/macros/class_forward.h> namespace collision_detection { MOVEIT_CLASS_FORWARD(CollisionDetectorAllocator); // Defines CollisionDetectorAllocatorPtr, ConstPtr, WeakPtr... etc /** \brief An allocator for a compatible CollisionWorld/CollisionRobot pair. */ class CollisionDetectorAllocator { public: virtual ~CollisionDetectorAllocator() { } /** A unique name identifying the CollisionWorld/CollisionRobot pairing. */ virtual const std::string& getName() const = 0; /** create a new CollisionWorld for checking collisions with the supplied world. */ virtual CollisionEnvPtr allocateEnv(const WorldPtr& world, const moveit::core::RobotModelConstPtr& robot_model) const = 0; /** create a new CollisionWorld by copying an existing CollisionWorld of the same type.s * The world must be either the same world as used by \orig or a copy of that world which has not yet been modified. */ virtual CollisionEnvPtr allocateEnv(const CollisionEnvConstPtr& orig, const WorldPtr& world) const = 0; /** create a new CollisionEnv given a robot_model with a new empty world */ virtual CollisionEnvPtr allocateEnv(const moveit::core::RobotModelConstPtr& robot_model) const = 0; }; /** \brief Template class to make it easy to create an allocator for a specific CollisionWorld/CollisionRobot pair. */ template <class CollisionEnvType, class CollisionDetectorAllocatorType> class CollisionDetectorAllocatorTemplate : public CollisionDetectorAllocator { public: CollisionEnvPtr allocateEnv(const WorldPtr& world, const moveit::core::RobotModelConstPtr& robot_model) const override { return CollisionEnvPtr(new CollisionEnvType(robot_model, world)); } CollisionEnvPtr allocateEnv(const CollisionEnvConstPtr& orig, const WorldPtr& world) const override { return CollisionEnvPtr(new CollisionEnvType(dynamic_cast<const CollisionEnvType&>(*orig), world)); } CollisionEnvPtr allocateEnv(const moveit::core::RobotModelConstPtr& robot_model) const override { return CollisionEnvPtr(new CollisionEnvType(robot_model)); } /** Create an allocator for collision detectors. */ static CollisionDetectorAllocatorPtr create() { return CollisionDetectorAllocatorPtr(new CollisionDetectorAllocatorType()); } }; } // namespace collision_detection
// ============================================================================ #ifndef OSTAP_GSL_UTILS_H #define OSTAP_GSL_UTILS_H 1 // ============================================================================ // Include files // ============================================================================ // STD&STL // ============================================================================ #include <ostream> // ============================================================================ // GSL // ============================================================================ #include "gsl/gsl_vector.h" #include "gsl/gsl_matrix.h" // ============================================================================= /** @file Ostap/GSL_utils.h * utilities for GSL */ // ============================================================================= namespace Ostap { // ========================================================================== namespace Utils { // ======================================================================== /** print GSL-vector to the stream * @param v the vector * @param s the stream * @return the stream * @author Vanya BELYAEV Ivan.Belyaev@itep.ru * @date 2012-05-28 */ std::ostream& toStream ( const gsl_vector& v , std::ostream& s ) ; // ======================================================================== /** print GSL-matrix to the stream * @param m the matrix * @param s the stream * @return the stream * @author Vanya BELYAEV Ivan.Belyaev@itep.ru * @date 2012-05-28 */ std::ostream& toStream ( const gsl_matrix& m , std::ostream& s ) ; // ======================================================================== } // end of namespace Ostap::Utils // ========================================================================== } // end of namespace Ostap // ============================================================================ /// print operator inline std::ostream& operator<<( std::ostream& s , const gsl_vector& v ) { return Ostap::Utils::toStream ( v , s ) ; } // ============================================================================ /// print operator inline std::ostream& operator<<( std::ostream& s , const gsl_matrix& m ) { return Ostap::Utils::toStream ( m , s ) ; } // ============================================================================ // The END // ============================================================================ #endif // OSTAP_GSL_UTILS_H // ============================================================================
// Copyright 2021 The Cobalt 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 STARBOARD_STUB_FONT_H_ #define STARBOARD_STUB_FONT_H_ namespace starboard { namespace stub { const void* GetFontApi(); } // namespace stub } // namespace starboard #endif // STARBOARD_STUB_FONT_H_
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. struct NormalStruct1 { char a; }; /// Should not be packed. struct StructWithAttr { int *a; int *b; } __attribute__((annotate("Attr is not __packed__"))); /// Should be packed with 1. struct PackedAttr{ int a; } __attribute__((__packed__)); /// Should be packed with 8. struct PackedAttrAlign8{ int a; } __attribute__((__packed__, aligned(8))); #pragma pack(push, 2) /// Should be packed with 2. struct Pack2WithPragma{ int a; }; #pragma pack(4) /// Should be packed with 4. struct Pack4WithPragma{ long long a; }; #pragma pack(pop) struct NormalStruct2 { char a; };
/*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef __itkImportMitkImageContainer_h #define __itkImportMitkImageContainer_h #include <itkImportImageContainer.h> #include <mitkImageDataItem.h> #include <mitkImageAccessorBase.h> namespace itk { /** \class ImportMitkImageContainer * Defines an itk::Image front-end to an mitk::Image. This container * conforms to the ImageContainerInterface. This is a full-fleged Object, * so there is modification time, debug, and reference count information. * * Template parameters for ImportMitkImageContainer: * * TElementIdentifier = * An INTEGRAL type for use in indexing the imported buffer. * * TElement = * The element type stored in the container. */ template <typename TElementIdentifier, typename TElement> class ImportMitkImageContainer: public ImportImageContainer<TElementIdentifier, TElement> { public: /** Standard class typedefs. */ typedef ImportMitkImageContainer Self; typedef Object Superclass; typedef SmartPointer<Self> Pointer; typedef SmartPointer<const Self> ConstPointer; /** Save the template parameters. */ typedef TElementIdentifier ElementIdentifier; typedef TElement Element; /** Method for creation through the object factory. */ itkFactorylessNewMacro(Self) itkCloneMacro(Self) /** Standard part of every itk Object. */ itkTypeMacro(ImportMitkImageContainer, ImportImageContainer); ///** Get the pointer from which the image data is imported. */ //TElement *GetImportPointer() {return m_ImportPointer;}; /** \brief Set the mitk::ImageDataItem to be imported */ //void SetImageDataItem(mitk::ImageDataItem* imageDataItem); void SetImageAccessor(mitk::ImageAccessorBase* imageAccess, size_t noBytes); protected: ImportMitkImageContainer(); virtual ~ImportMitkImageContainer(); /** PrintSelf routine. Normally this is a protected internal method. It is * made public here so that Image can call this method. Users should not * call this method but should call Print() instead. */ void PrintSelf(std::ostream& os, Indent indent) const; private: ImportMitkImageContainer(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented //mitk::ImageDataItem::Pointer m_ImageDataItem; mitk::ImageAccessorBase* m_imageAccess; }; } // end namespace itk // Define instantiation macro for this template. #define ITK_TEMPLATE_ImportMitkImageContainer(_, EXPORT, x, y) namespace itk { \ _(2(class EXPORT ImportMitkImageContainer< ITK_TEMPLATE_2 x >)) \ namespace Templates { typedef ImportMitkImageContainer< ITK_TEMPLATE_2 x > ImportMitkImageContainer##y; } \ } //#if ITK_TEMPLATE_EXPLICIT //# include "Templates/itkImportMitkImageContainer+-.h" //#endif #if ITK_TEMPLATE_TXX # include "itkImportMitkImageContainer.txx" #endif #endif
// // FLEXDetectViewsTableViewController.h // UICatalog // // Created by viczxwang on 15/12/20. // Copyright © 2015年 f. All rights reserved. // #import <UIKit/UIKit.h> @interface FLEXDetectViewsTableViewController : UITableViewController @end
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_SHARED_SETTINGS_LOCALIZED_STRINGS_PROVIDER_H_ #define CHROME_BROWSER_UI_WEBUI_SETTINGS_SHARED_SETTINGS_LOCALIZED_STRINGS_PROVIDER_H_ namespace content { class WebUIDataSource; } // namespace content namespace settings { // Adds strings used by the <settings-captions> element. void AddCaptionSubpageStrings(content::WebUIDataSource* html_source); // Adds strings used by the <settings-personalization-options> element. void AddPersonalizationOptionsStrings(content::WebUIDataSource* html_source); // Adds strings used by the <settings-sync-controls> element. void AddSyncControlsStrings(content::WebUIDataSource* html_source); // Adds strings used by the <settings-sync-account-control> element. void AddSyncAccountControlStrings(content::WebUIDataSource* html_source); #if defined(OS_CHROMEOS) // Adds strings used by the <settings-password-prompt-dialog> element. void AddPasswordPromptDialogStrings(content::WebUIDataSource* html_source); #endif // Adds strings used by the <settings-sync-page> element. void AddSyncPageStrings(content::WebUIDataSource* html_source); } // namespace settings #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SHARED_SETTINGS_LOCALIZED_STRINGS_PROVIDER_H_
/* # This file is part of the Astrometry.net suite. # Licensed under a 3-clause BSD style license - see LICENSE */ #include <stdio.h> #include <stdlib.h> #include "codekd.h" #include "kdtree_fits_io.h" #include "starutil.h" #include "errors.h" static codetree_t* codetree_alloc() { codetree_t* s = calloc(1, sizeof(codetree_t)); if (!s) { fprintf(stderr, "Failed to allocate a code kdtree struct.\n"); return NULL; } return s; } int codetree_append_to(codetree_t* s, FILE* fid) { return kdtree_fits_append_tree_to(s->tree, s->header, fid); } int codetree_N(codetree_t* s) { return s->tree->ndata; } int codetree_nodes(codetree_t* s) { return s->tree->nnodes; } int codetree_D(codetree_t* s) { return s->tree->ndim; } qfits_header* codetree_header(codetree_t* s) { return s->header; } int codetree_get_permuted(codetree_t* s, int index) { if (s->tree->perm) return s->tree->perm[index]; else return index; } static codetree_t* my_open(const char* fn, anqfits_t* fits) { codetree_t* s; kdtree_fits_t* io; char* treename = CODETREE_NAME; s = codetree_alloc(); if (!s) return s; if (fits) { io = kdtree_fits_open_fits(fits); fn = fits->filename; } else io = kdtree_fits_open(fn); if (!io) { ERROR("Failed to open FITS file \"%s\"", fn); goto bailout; } if (!kdtree_fits_contains_tree(io, treename)) treename = NULL; s->tree = kdtree_fits_read_tree(io, treename, &s->header); if (!s->tree) { ERROR("Failed to read code kdtree from file %s\n", fn); goto bailout; } // kdtree_fits_t is a typedef of fitsbin_t fitsbin_close_fd(io); return s; bailout: free(s); return NULL; } codetree_t* codetree_open_fits(anqfits_t* fits) { return my_open(NULL, fits); } codetree_t* codetree_open(const char* fn) { return my_open(fn, NULL); } int codetree_close(codetree_t* s) { if (!s) return 0; if (s->inverse_perm) free(s->inverse_perm); if (s->header) qfits_header_destroy(s->header); if (s->tree) kdtree_fits_close(s->tree); free(s); return 0; } static int Ndata(codetree_t* s) { return s->tree->ndata; } void codetree_compute_inverse_perm(codetree_t* s) { // compute inverse permutation vector. s->inverse_perm = malloc(Ndata(s) * sizeof(int)); if (!s->inverse_perm) { fprintf(stderr, "Failed to allocate code kdtree inverse permutation vector.\n"); return; } kdtree_inverse_permutation(s->tree, s->inverse_perm); } int codetree_get(codetree_t* s, unsigned int codeid, double* code) { if (s->tree->perm && !s->inverse_perm) { codetree_compute_inverse_perm(s); if (!s->inverse_perm) return -1; } if (codeid >= Ndata(s)) { fprintf(stderr, "Invalid code ID: %u >= %u.\n", codeid, Ndata(s)); return -1; } if (s->inverse_perm) kdtree_copy_data_double(s->tree, s->inverse_perm[codeid], 1, code); else kdtree_copy_data_double(s->tree, codeid, 1, code); return 0; } codetree_t* codetree_new() { codetree_t* s = codetree_alloc(); s->header = qfits_header_default(); if (!s->header) { fprintf(stderr, "Failed to create a qfits header for code kdtree.\n"); free(s); return NULL; } qfits_header_add(s->header, "AN_FILE", AN_FILETYPE_CODETREE, "This file is a code kdtree.", NULL); return s; } int codetree_write_to_file(codetree_t* s, const char* fn) { return kdtree_fits_write(s->tree, fn, s->header); } int codetree_write_to_file_flipped(codetree_t* s, const char* fn) { return kdtree_fits_write_flipped(s->tree, fn, s->header); }
/* # This file is part of the Astrometry.net suite. # Licensed under a 3-clause BSD style license - see LICENSE */ #ifndef PLOTXY_H #define PLOTXY_H #include "astrometry/plotstuff.h" struct plotxy_args { char* fn; int ext; char* xcol; char* ycol; double xoff, yoff; int firstobj; int nobjs; double scale; // coordinates added with xy_val <x> <y> dl* xyvals; // if WCS is set, x,y are treated as FITS pixel coords; // that is, this are pushed through the WCS unmodified, then the resulting // RA,Dec is pushed through the plot WCS, producing FITS coords, from which // 1,1 is subtracted to yield 0-indexed image coords. anwcs_t* wcs; }; typedef struct plotxy_args plotxy_t; plotxy_t* plot_xy_get(plot_args_t* pargs); // Called prior to cairo surface initialization. void* plot_xy_init(plot_args_t* args); // Set the plot size based on IMAGEW,IMAGEH in the xylist header. int plot_xy_setsize(plot_args_t* args, plotxy_t* xyargs); // Clears the list of points. void plot_xy_clear_list(plotxy_t* args); void plot_xy_set_xcol(plotxy_t* args, const char* col); void plot_xy_set_ycol(plotxy_t* args, const char* col); void plot_xy_set_filename(plotxy_t* args, const char* fn); int plot_xy_set_wcs_filename(plotxy_t* args, const char* fn, int ext); int plot_xy_set_offsets(plotxy_t* args, double xo, double yo); int plot_xy_command(const char* command, const char* cmdargs, plot_args_t* args, void* baton); int plot_xy_plot(const char* command, cairo_t* cairo, plot_args_t* plotargs, void* baton); void plot_xy_free(plot_args_t* args, void* baton); void plot_xy_vals(plotxy_t* args, double x, double y); DECLARE_PLOTTER(xy); #endif
/*========================================================================= Program: Visualization Toolkit Module: vtkQuadraticEdge.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 vtkQuadraticEdge - cell represents a parabolic, isoparametric edge // .SECTION Description // vtkQuadraticEdge is a concrete implementation of vtkNonLinearCell to // represent a one-dimensional, 3-nodes, isoparametric parabolic line. The // interpolation is the standard finite element, quadratic isoparametric // shape function. The cell includes a mid-edge node. The ordering of the // three points defining the cell is point ids (0,1,2) where id #2 is the // midedge node. // .SECTION See Also // vtkQuadraticTriangle vtkQuadraticTetra vtkQuadraticWedge // vtkQuadraticQuad vtkQuadraticHexahedron vtkQuadraticPyramid #ifndef __vtkQuadraticEdge_h #define __vtkQuadraticEdge_h #include "vtkNonLinearCell.h" class vtkLine; class VTK_FILTERING_EXPORT vtkQuadraticEdge : public vtkNonLinearCell { public: static vtkQuadraticEdge *New(); vtkTypeRevisionMacro(vtkQuadraticEdge,vtkNonLinearCell); void PrintSelf(ostream& os, vtkIndent indent); // Description: // Implement the vtkCell API. See the vtkCell API for descriptions // of these methods. int GetCellType() {return VTK_QUADRATIC_EDGE;}; int GetCellDimension() {return 1;} int GetNumberOfEdges() {return 0;} int GetNumberOfFaces() {return 0;} vtkCell *GetEdge(int) {return 0;} vtkCell *GetFace(int) {return 0;} int CellBoundary(int subId, double pcoords[3], vtkIdList *pts); void Contour(double value, vtkDataArray *cellScalars, vtkPointLocator *locator, vtkCellArray *verts, vtkCellArray *lines, vtkCellArray *polys, vtkPointData *inPd, vtkPointData *outPd, vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd); int EvaluatePosition(double x[3], double* closestPoint, int& subId, double pcoords[3], double& dist2, double *weights); void EvaluateLocation(int& subId, double pcoords[3], double x[3], double *weights); int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts); void Derivatives(int subId, double pcoords[3], double *values, int dim, double *derivs); virtual double *GetParametricCoords(); // Description: // Clip this edge using scalar value provided. Like contouring, except // that it cuts the edge to produce linear line segments. void Clip(double value, vtkDataArray *cellScalars, vtkPointLocator *locator, vtkCellArray *lines, vtkPointData *inPd, vtkPointData *outPd, vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd, int insideOut); // Description: // Line-edge intersection. Intersection has to occur within [0,1] parametric // coordinates and with specified tolerance. int IntersectWithLine(double p1[3], double p2[3], double tol, double& t, double x[3], double pcoords[3], int& subId); // Description: // Return the center of the quadratic tetra in parametric coordinates. int GetParametricCenter(double pcoords[3]); // Description: // Quadratic edge specific methods. static void InterpolationFunctions(double pcoords[3], double weights[3]); static void InterpolationDerivs(double pcoords[3], double derivs[3]); protected: vtkQuadraticEdge(); ~vtkQuadraticEdge(); vtkLine *Line; vtkDoubleArray *Scalars; //used to avoid New/Delete in contouring/clipping private: vtkQuadraticEdge(const vtkQuadraticEdge&); // Not implemented. void operator=(const vtkQuadraticEdge&); // Not implemented. }; //---------------------------------------------------------------------------- inline int vtkQuadraticEdge::GetParametricCenter(double pcoords[3]) { pcoords[0] = 0.5; pcoords[1] = pcoords[2] = 0.; return 0; } #endif
/*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef _mitkSurfaceToImageFilter_h__ #define _mitkSurfaceToImageFilter_h__ #include "MitkCoreExports.h" #include "mitkCommon.h" #include "mitkImageSource.h" #include "mitkSurface.h" class vtkPolyData; namespace mitk { /** * * @brief Converts surface data to pixel data. Requires a surface and an * image, which header information defines the output image. * * The resulting image has the same dimension, size, and Geometry3D * as the input image. The image is cut using a vtkStencil. * The user can decide if he wants to keep the original values or create a * binary image by setting MakeBinaryOutputOn (default is \a false). If * set to \a true all voxels inside the surface are set to one and all * outside voxel are set to zero. * * NOTE: Since the reference input image is passed to the vtkStencil in * any case, the image needs to be initialized with pixel values greater than * the numerical minimum of the used pixel type (e.g. at least -127 for * unsigned char images, etc.) to produce a correct binary image * representation of the surface in MakeOutputBinary mode. * * @ingroup SurfaceFilters * @ingroup Process */ class MITKCORE_EXPORT SurfaceToImageFilter : public ImageSource { public: mitkClassMacro(SurfaceToImageFilter, ImageSource); itkFactorylessNewMacro(Self); itkCloneMacro(Self); itkSetMacro(MakeOutputBinary, bool); itkGetMacro(MakeOutputBinary, bool); itkBooleanMacro(MakeOutputBinary); itkSetMacro(UShortBinaryPixelType, bool); itkGetMacro(UShortBinaryPixelType, bool); itkBooleanMacro(UShortBinaryPixelType); itkGetConstMacro(BackgroundValue, float); itkSetMacro(BackgroundValue, float); itkGetConstMacro(Tolerance, double); itkSetMacro(Tolerance, double); void GenerateInputRequestedRegion() override; void GenerateOutputInformation() override; void GenerateData() override; const mitk::Surface *GetInput(void); using itk::ProcessObject::SetInput; virtual void SetInput(const mitk::Surface *surface); void SetImage(const mitk::Image *source); const mitk::Image *GetImage(void); protected: SurfaceToImageFilter(); ~SurfaceToImageFilter() override; void Stencil3DImage(int time = 0); bool m_MakeOutputBinary; bool m_UShortBinaryPixelType; float m_BackgroundValue; double m_Tolerance; }; } // namespace mitk #endif /* MITKCOONSPATCHFILTER_H_HEADER_INCLUDED_C10B22CD */
/* * Copyright (c) 1994, 1995, 1996 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that: (1) source code distributions * retain the above copyright notice and this paragraph in its entirety, (2) * distributions including binary code include the above copyright notice and * this paragraph in its entirety in the documentation or other materials * provided with the distribution, and (3) all advertising materials mentioning * features or use of this software display the following acknowledgement: * ``This product includes software developed by the University of California, * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of * the University nor the names of its contributors may be used to endorse * or promote products derived from this software without specific prior * written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ #ifndef lint static const char rcsid[] = "@(#) $Header: /usr/home/sumikawa/kame/kame/kame/kame/libpcap/pcap-null.c,v 1.1 1999/08/08 23:30:17 itojun Exp $ (LBL)"; #endif #include <sys/param.h> /* optionally get BSD define */ #include <string.h> #include "gnuc.h" #ifdef HAVE_OS_PROTO_H #include "os-proto.h" #endif #include "pcap-int.h" static char nosup[] = "live packet capture not supported on this system"; int pcap_stats(pcap_t *p, struct pcap_stat *ps) { (void)sprintf(p->errbuf, "pcap_stats: %s", nosup); return (-1); } int pcap_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) { (void)sprintf(p->errbuf, "pcap_read: %s", nosup); return (-1); } pcap_t * pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) { (void)strcpy(ebuf, nosup); return (NULL); } int pcap_setfilter(pcap_t *p, struct bpf_program *fp) { if (p->sf.rfile == NULL) { (void)sprintf(p->errbuf, "pcap_setfilter: %s", nosup); return (-1); } p->fcode = *fp; return (0); }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execv_68b.c Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-68b.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: connect_socket Read data using a connect socket (client side) * GoodSource: Fixed string * Sink: w32_execv * BadSink : execute command with wexecv * Flow Variant: 68 Data flow: data passed as a global variable from one function to another in different source files * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define COMMAND_INT_PATH L"%WINDIR%\\system32\\cmd.exe" #define COMMAND_INT L"cmd.exe" #define COMMAND_ARG1 L"/c" #define COMMAND_ARG2 L"dir " #define COMMAND_ARG3 data #else /* NOT _WIN32 */ #include <unistd.h> #define COMMAND_INT_PATH L"/bin/sh" #define COMMAND_INT L"sh" #define COMMAND_ARG1 L"-c" #define COMMAND_ARG2 L"ls " #define COMMAND_ARG3 data #endif #ifdef _WIN32 #include <winsock2.h> #include <windows.h> #include <direct.h> #pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */ #define CLOSE_SOCKET closesocket #else /* NOT _WIN32 */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #define INVALID_SOCKET -1 #define SOCKET_ERROR -1 #define CLOSE_SOCKET close #define SOCKET int #endif #define TCP_PORT 27015 #define IP_ADDRESS "127.0.0.1" #include <process.h> #define EXECV _wexecv extern wchar_t * CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execv_68_badData; extern wchar_t * CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execv_68_goodG2BData; /* all the sinks are the same, we just want to know where the hit originated if a tool flags one */ #ifndef OMITBAD void CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execv_68b_badSink() { wchar_t * data = CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execv_68_badData; { wchar_t *args[] = {COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG3, NULL}; /* wexecv - specify the path where the command is located */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ EXECV(COMMAND_INT_PATH, args); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execv_68b_goodG2BSink() { wchar_t * data = CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execv_68_goodG2BData; { wchar_t *args[] = {COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG3, NULL}; /* wexecv - specify the path where the command is located */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ EXECV(COMMAND_INT_PATH, args); } } #endif /* OMITGOOD */
/*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef mitkXmlSceneIO_h_included #define mitkXmlSceneIO_h_included #include "mitkDataStorage.h" class TiXmlElement; namespace mitk { class PropertyListsXmlFileReaderAndWriter; class PropertyListsXmlFileReaderAndWriter : public itk::Object { public: static const char *GetPropertyListIdElementName(); mitkClassMacroItkParent(PropertyListsXmlFileReaderAndWriter, itk::Object); itkFactorylessNewMacro(Self) itkCloneMacro(Self) bool WriteLists(const std::string &fileName, const std::map<std::string, mitk::PropertyList::Pointer> &_PropertyLists) const; bool ReadLists(const std::string &fileName, std::map<std::string, mitk::PropertyList::Pointer> &_PropertyLists) const; protected: PropertyListsXmlFileReaderAndWriter(); ~PropertyListsXmlFileReaderAndWriter() override; bool PropertyFromXmlElem(std::string &name, mitk::BaseProperty::Pointer &prop, TiXmlElement *elem) const; bool PropertyToXmlElem(const std::string &name, const mitk::BaseProperty *prop, TiXmlElement *elem) const; }; } #endif
/* * Copyright (C) 2011 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef HTMLContentElement_h #define HTMLContentElement_h #include "CSSSelectorList.h" #include "InsertionPoint.h" namespace WebCore { #if ENABLE(SHADOW_DOM) class HTMLContentElement FINAL : public InsertionPoint { public: static const QualifiedName& contentTagName(Document&); static PassRefPtr<HTMLContentElement> create(const QualifiedName&, Document&); static PassRefPtr<HTMLContentElement> create(Document&); virtual ~HTMLContentElement(); void setSelect(const AtomicString&); const AtomicString& select() const; virtual MatchType matchTypeFor(Node*) OVERRIDE; virtual const CSSSelectorList& selectorList() OVERRIDE; virtual Type insertionPointType() const OVERRIDE { return HTMLContentElementType; } virtual bool canAffectSelector() const OVERRIDE { return true; } virtual bool isSelectValid(); protected: HTMLContentElement(const QualifiedName&, Document&); private: virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; void ensureSelectParsed(); bool validateSelect() const; bool m_shouldParseSelectorList; bool m_isValidSelector; CSSSelectorList m_selectorList; }; inline void HTMLContentElement::setSelect(const AtomicString& selectValue) { setAttribute(HTMLNames::selectAttr, selectValue); m_shouldParseSelectorList = true; } inline const CSSSelectorList& HTMLContentElement::selectorList() { ensureSelectParsed(); return m_selectorList; } #endif // if ENABLE(SHADOW_DOM) } #endif
/***************************** Include Files *******************************/ #include "Video_PR.h" /************************** Function Definitions ***************************/
/* $FreeBSD: releng/9.3/sys/dev/bktr/bktr_core.h 139749 2005-01-06 01:43:34Z imp $ */ /* * This is part of the Driver for Video Capture Cards (Frame grabbers) * and TV Tuner cards using the Brooktree Bt848, Bt848A, Bt849A, Bt878, Bt879 * chipset. * Copyright Roger Hardiman and Amancio Hasty. * * bktr_core : This deals with the Bt848/849/878/879 PCI Frame Grabber, * Handles all the open, close, ioctl and read userland calls. * Sets the Bt848 registers and generates RISC pograms. * Controls the i2c bus and GPIO interface. * Contains the interface to the kernel. * (eg probe/attach and open/close/ioctl) * */ /*- * 1. Redistributions of source code must retain the * Copyright (c) 1997 Amancio Hasty, 1999 Roger Hardiman * 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 Amancio Hasty and * Roger Hardiman * 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. */ int i2cWrite( bktr_ptr_t bktr, int addr, int byte1, int byte2 ); int i2cRead( bktr_ptr_t bktr, int addr ); void msp_dpl_reset( bktr_ptr_t bktr, int i2d_addr ); unsigned int msp_dpl_read( bktr_ptr_t bktr, int i2c_addr, unsigned char dev, unsigned int addr ); void msp_dpl_write( bktr_ptr_t bktr, int i2c_addr, unsigned char dev, unsigned int addr, unsigned int data ); /* * Defines for userland processes blocked in this driver * For /dev/bktr[n] use memory address of bktr structure * For /dev/vbi[n] use memory address of bktr structure + 1 * this is ok as the bktr structure is > 1 byte */ #define BKTR_SLEEP ((caddr_t)bktr ) #define VBI_SLEEP ((caddr_t)bktr + 1) /* device name for printf */ const char *bktr_name(bktr_ptr_t bktr); /* Prototypes for attatch and interrupt functions */ void common_bktr_attach( bktr_ptr_t bktr, int unit, u_long pci_id, u_int rev ); int common_bktr_intr( void *arg ); /* Prototypes for open, close, read, mmap and ioctl calls */ int video_open( bktr_ptr_t bktr ); int video_close( bktr_ptr_t bktr ); int video_read( bktr_ptr_t bktr, int unit, struct cdev *dev, struct uio *uio ); int video_ioctl( bktr_ptr_t bktr, int unit, ioctl_cmd_t cmd, caddr_t arg, struct thread* pr ); int tuner_open( bktr_ptr_t bktr ); int tuner_close( bktr_ptr_t bktr ); int tuner_ioctl( bktr_ptr_t bktr, int unit, ioctl_cmd_t cmd, caddr_t arg, struct thread* pr ); int vbi_open( bktr_ptr_t bktr ); int vbi_close( bktr_ptr_t bktr ); int vbi_read( bktr_ptr_t bktr, struct uio *uio, int ioflag );
// Copyright (c) 2011 The LevelDB Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. // // Log format information shared by reader and writer. // See ../doc/log_format.txt for more detail. #ifndef STORAGE_LEVELDB_DB_LOG_FORMAT_H_ #define STORAGE_LEVELDB_DB_LOG_FORMAT_H_ namespace leveldb { namespace log { /** * 记录类型 */ enum RecordType { // Zero is reserved for preallocated files /** * 0类型 */ kZeroType = 0, /** * 全类型 */ kFullType = 1, // For fragments /** * 开头类型 */ kFirstType = 2, /** * 中间类型 */ kMiddleType = 3, /** * 结尾类型 */ kLastType = 4 }; /** * 最大记录类型 */ static const int kMaxRecordType = kLastType; /** * 块大小32k */ static const int kBlockSize = 32768; // Header is checksum (4 bytes), length (2 bytes), type (1 byte). /** * 头部的大小 */ static const int kHeaderSize = 4 + 2 + 1; } // namespace log } // namespace leveldb #endif // STORAGE_LEVELDB_DB_LOG_FORMAT_H_
/* * Copyright (c) 2005 Endace Technology Ltd, Hamilton, New Zealand. * All rights reserved. * * This source code is proprietary to Endace Technology Limited and no part * of it may be redistributed, published or disclosed except as outlined in * the written contract supplied with this product. * */ #ifndef DAG6_CONSTANTS_H #define DAG6_CONSTANTS_H typedef enum s19205cbi { S19205_RX_TO_TX_SONET_LOOPBACK = 0x000F, S19205_RX_TO_TX_SYS_LOOPBACK = 0x0022, /* Also TX_PYLD_SCR_INH */ S19205_TX_MAP = 0x0023, S19205_TX_C2INS = 0x02C1, S19205_TX_SYS_PRTY_ERR_E = 0x0340, S19205_TX_SIZE_MODE = 0x0344, /* Also TX_SYS_PRTY_CTL_INH */ S19205_TX_FIFOERR_CNT = 0x034C, S19205_TX_XMIT_HOLDOFF = 0x034E, S19205_TX_POS_PMIN = 0x0381, S19205_TX_POS_PMAX1 = 0x0382, S19205_TX_POS_PMAX2 = 0x0383, S19205_TX_POS_ADRCTL_INS = 0x038A, S19205_XG_CTR_CLR = 0x03C6, /* Also XG_CTR_SNAPSHOT */ S19205_XG_MAC_ADDR = 0x03C0, S19205_TX_ETH_INH1 = 0x0401, S19205_TX_ETH_PMAX1 = 0x0402, S19205_TX_ETH_PMAX2 = 0x0403, S19205_LATCH_CNT = 0x0800, S19205_TX_TO_RX_SONET_LOOPBACK = 0x0825, S19205_RX_MAP = 0x0848, /* Also TX_TO_RX_SYS_LOOPBACK & RX_PYLD_DSCR_INH*/ S19205_RX_LOSEXT_LEVEL = 0x0909, S19205_RX_LOS = 0x090D, S19205_RX_B1_ERRCNT1 = 0x0940, S19205_RX_B1_ERRCNT2 = 0x0941, S19205_RX_B2_ERRCNT1 = 0x0943, S19205_RX_B2_ERRCNT2 = 0x0944, S19205_RX_B2_ERRCNT3 = 0x0945, S19205_RX_PI_LOP = 0x0C08, S19205_RX_C2EXP = 0x0D12, S19205_RX_C2MON = 0x0D15, S19205_RX_B3_ERRCNT1 = 0x0D16, S19205_RX_B3_ERRCNT2 = 0x0D17, S19205_RX_POS_PMIN = 0x0E00, S19205_RX_POS_PMAX1 = 0x0E01, S19205_RX_POS_PMAX2 = 0x0E02, S19205_RX_POS_PMIN_ENB = 0x0E08, /* Also RX_POS_PMAX_ENB & RX_POS_ADRCTL_DROP_INH & RX_POS_FCS_INH*/ S19205_RX_POS_FCS_ERRCNT1 = 0x0E11, S19205_RX_POS_FCS_ERRCNT2 = 0x0E12, S19205_RX_POS_FCS_ERRCNT3 = 0x0E13, S19205_RX_POS_PKT_CNT1 = 0x0E14, S19205_RX_POS_PKT_CNT2 = 0x0E15, S19205_RX_POS_PKT_CNT3 = 0x0E16, S19205_RX_POS_PKT_CNT4 = 0x0E17, S19205_RX_FIFOERR_CNT = 0x1008, S19205_RX_ETH_INH1 = 0x1204, S19205_RX_ETH_INH2 = 0x1205, S19205_RX_ETH_PMAX1 = 0x1206, S19205_RX_ETH_PMAX2 = 0x1207, S19205_RX_ETH_PHY = 0x1214, S19205_RX_ETH_GOODCNT1 = 0x1258, S19205_RX_ETH_OCTETS_OK = 0x1260, S19205_RX_ETH_FCSCNT1 = 0x12B0, S19205_RX_ETH_OVERRUNCNT1 = 0x12B8, S19205_RX_ETH_DROPCNT1 = 0x12C0, S19205_RX_ETH_BADCNT1 = 0x12E8, S19205_RX_ETH_OCTETS_BAD = 0x12F0, S19205_DEV_VER = 0x1FFD, S19205_DEV_ID = 0x1FFF } s19205cbi_t; #endif
/** * Copyright (c) 2015-present, Facebook, 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. */ #import "RCTShadowView.h" #import "RCTTextDecorationLineType.h" extern NSString *const RCTIsHighlightedAttributeName; extern NSString *const RCTReactTagAttributeName; @interface RCTShadowText : RCTShadowView @property (nonatomic, strong) UIColor *color; @property (nonatomic, copy) NSString *fontFamily; @property (nonatomic, assign) CGFloat fontSize; @property (nonatomic, copy) NSString *fontWeight; @property (nonatomic, copy) NSString *fontStyle; @property (nonatomic, assign) BOOL isHighlighted; @property (nonatomic, assign) CGFloat letterSpacing; @property (nonatomic, assign) CGFloat lineHeight; @property (nonatomic, assign) NSLineBreakMode lineBreakMode; @property (nonatomic, assign) NSUInteger numberOfLines; @property (nonatomic, assign) CGSize shadowOffset; @property (nonatomic, assign) NSTextAlignment textAlign; @property (nonatomic, assign) NSWritingDirection writingDirection; @property (nonatomic, strong) UIColor *textDecorationColor; @property (nonatomic, assign) NSUnderlineStyle textDecorationStyle; @property (nonatomic, assign) RCTTextDecorationLineType textDecorationLine; @property (nonatomic, assign) CGFloat fontSizeMultiplier; @property (nonatomic, assign) BOOL allowFontScaling; @property (nonatomic, assign) CGFloat opacity; @property (nonatomic, assign) CGSize textShadowOffset; @property (nonatomic, assign) CGFloat textShadowRadius; @property (nonatomic, strong) UIColor *textShadowColor; - (void)recomputeText; @end
/* * Copyright (c) 2013 Gerard Green * All rights reserved * * Please see the file 'LICENSE' for further information */ #include <anvil/ipc.h> #include <anvil/ace_msgs.h> #include <anvil/ace.h> int ace_win_show(ace_window_t *win) { struct ace_win_show_msg showmsg; int status; int err; showmsg.win_handle = win->handle; err = msg_rpc_port_status(win->connection->port, ACE_WIN_SHOW, &showmsg, sizeof(showmsg), &status, NULL, 0); if (err != 0) { return -1; } else if (status != 0) { return -1; } return 0; }
/* BLIS An object-based framework for developing high-performance BLAS-like libraries. Copyright (C) 2014, The University of Texas 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 University of Texas 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. */ void bli_addsc_unb_var1( obj_t* chi, obj_t* psi ); #undef GENTPROT2 #define GENTPROT2( ctype_x, ctype_y, chx, chy, opname ) \ \ void PASTEMAC2(chx,chy,opname)( \ conj_t conjchi, \ void* chi, \ void* psi \ ); INSERT_GENTPROT2_BASIC( addsc_unb_var1 ) #ifdef BLIS_ENABLE_MIXED_DOMAIN_SUPPORT INSERT_GENTPROT2_MIX_D( addsc_unb_var1 ) #endif #ifdef BLIS_ENABLE_MIXED_PRECISION_SUPPORT INSERT_GENTPROT2_MIX_P( addsc_unb_var1 ) #endif
/* $OpenBSD: midivar.h,v 1.1 1999/01/02 00:02:38 niklas Exp $ */ /* $NetBSD: midivar.h,v 1.6 1998/11/25 22:17:07 augustss Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Lennart Augustsson (augustss@netbsd.org). * * 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 the NetBSD * Foundation, Inc. and its contributors. * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef _SYS_DEV_MIDIVAR_H_ #define _SYS_DEV_MIDIVAR_H_ #define MIDI_BUFSIZE 1024 #include "sequencer.h" struct midi_buffer { u_char *inp; u_char *outp; u_char *end; int used; int usedhigh; u_char start[MIDI_BUFSIZE]; }; #define MIDI_MAX_WRITE 32 /* max bytes written with busy wait */ #define MIDI_WAIT 10000 /* microseconds to wait after busy wait */ struct midi_softc { struct device dev; void *hw_hdl; /* Hardware driver handle */ struct midi_hw_if *hw_if; /* Hardware interface */ struct device *sc_dev; /* Hardware device struct */ int isopen; /* Open indicator */ int flags; /* Open flags */ struct midi_buffer outbuf; struct midi_buffer inbuf; int props; int rchan, wchan; int pbus; struct selinfo wsel; /* write selector */ struct selinfo rsel; /* read selector */ struct proc *async; /* process who wants audio SIGIO */ /* MIDI input state machine */ int in_state; #define MIDI_IN_START 0 #define MIDI_IN_DATA 1 #define MIDI_IN_SYSEX 2 u_char in_msg[3]; u_char in_status; u_int in_left; u_int in_pos; #if NSEQUENCER > 0 /* Synthesizer emulation stuff */ int seqopen; struct midi_dev *seq_md; /* structure that links us with the seq. */ #endif }; #define MIDIUNIT(d) ((d) & 0xff) #endif /* _SYS_DEV_MIDIVAR_H_ */
#include <lib.h> #include <sgtty.h> int stty(fd, argp) int fd; struct sgttyb *argp; { return ioctl(fd, TIOCSETP, argp); }
#include "utils.h" #include "inttypes.h" #include "criticalSection.h" #include <stdlib.h> extern _PTR memalign(size_t, size_t); /* * These functions are equivalent to the standard lib functions, except that * they disable all interrupts before executing the function. */ void *safe_malloc(size_t size) { DECLARE_CRITICAL_SECTION(); void *retVal; CRITICAL_SECTION_BEGIN(); retVal = malloc(size); CRITICAL_SECTION_END(); return retVal; } void *safe_calloc(size_t nelem, size_t elsize) { DECLARE_CRITICAL_SECTION(); void *retVal; CRITICAL_SECTION_BEGIN(); retVal = calloc(nelem, elsize); CRITICAL_SECTION_END(); return retVal; } void *safe_memalign(size_t alignment, size_t length){ DECLARE_CRITICAL_SECTION(); void *retVal; CRITICAL_SECTION_BEGIN(); retVal = memalign(alignment, length); CRITICAL_SECTION_END(); return retVal; } void *safe_realloc(void *ptr, size_t size) { DECLARE_CRITICAL_SECTION(); void *retVal; CRITICAL_SECTION_BEGIN(); retVal = realloc(ptr, size); CRITICAL_SECTION_END(); return retVal; } void safe_free(void *ptr) { DECLARE_CRITICAL_SECTION(); CRITICAL_SECTION_BEGIN(); free(ptr); CRITICAL_SECTION_END(); return; }
/* * Copyright (C) 2007, 2008, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_KEYFRAMES_RULE_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_KEYFRAMES_RULE_H_ #include "third_party/blink/renderer/core/css/css_rule.h" #include "third_party/blink/renderer/core/css/style_rule.h" #include "third_party/blink/renderer/platform/wtf/casting.h" #include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" namespace blink { class CSSRuleList; class CSSKeyframeRule; class StyleRuleKeyframe; class StyleRuleKeyframes final : public StyleRuleBase { public: StyleRuleKeyframes(); explicit StyleRuleKeyframes(const StyleRuleKeyframes&); ~StyleRuleKeyframes(); const HeapVector<Member<StyleRuleKeyframe>>& Keyframes() const { return keyframes_; } void ParserAppendKeyframe(StyleRuleKeyframe*); void WrapperAppendKeyframe(StyleRuleKeyframe*); void WrapperRemoveKeyframe(unsigned); String GetName() const { return name_; } void SetName(const String& name) { name_ = AtomicString(name); } bool IsVendorPrefixed() const { return is_prefixed_; } void SetVendorPrefixed(bool is_prefixed) { is_prefixed_ = is_prefixed; } int FindKeyframeIndex(const String& key) const; StyleRuleKeyframes* Copy() const { return MakeGarbageCollected<StyleRuleKeyframes>(*this); } void TraceAfterDispatch(blink::Visitor*) const; void StyleChanged() { version_++; } unsigned Version() const { return version_; } private: HeapVector<Member<StyleRuleKeyframe>> keyframes_; AtomicString name_; unsigned version_ : 31; unsigned is_prefixed_ : 1; }; template <> struct DowncastTraits<StyleRuleKeyframes> { static bool AllowFrom(const StyleRuleBase& rule) { return rule.IsKeyframesRule(); } }; class CSSKeyframesRule final : public CSSRule { DEFINE_WRAPPERTYPEINFO(); public: CSSKeyframesRule(StyleRuleKeyframes*, CSSStyleSheet* parent); ~CSSKeyframesRule() override; StyleRuleKeyframes* Keyframes() { return keyframes_rule_.Get(); } String cssText() const override; void Reattach(StyleRuleBase*) override; String name() const { return keyframes_rule_->GetName(); } void setName(const String&); CSSRuleList* cssRules() const override; void appendRule(const ExecutionContext*, const String& rule); void deleteRule(const String& key); CSSKeyframeRule* findRule(const String& key); // For IndexedGetter and CSSRuleList. unsigned length() const; CSSKeyframeRule* Item(unsigned index) const; CSSKeyframeRule* AnonymousIndexedGetter(unsigned index) const; bool IsVendorPrefixed() const { return is_prefixed_; } void SetVendorPrefixed(bool is_prefixed) { is_prefixed_ = is_prefixed; } void StyleChanged() { keyframes_rule_->StyleChanged(); } void Trace(Visitor*) override; private: CSSRule::Type type() const override { return kKeyframesRule; } Member<StyleRuleKeyframes> keyframes_rule_; mutable HeapVector<Member<CSSKeyframeRule>> child_rule_cssom_wrappers_; mutable Member<CSSRuleList> rule_list_cssom_wrapper_; bool is_prefixed_; }; template <> struct DowncastTraits<CSSKeyframesRule> { static bool AllowFrom(const CSSRule& rule) { return rule.type() == CSSRule::kKeyframesRule; } }; } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_KEYFRAMES_RULE_H_
#ifndef ELECTRON_H #define ELECTRON_H #include "Particle.h" class Electron : public Particle { public: Electron(double energy, double position, Particle* parent, ResultStore* results); virtual ~Electron(); protected: virtual Particle::DecayType TerminalDecay() const; virtual Particle::DecayType Decay(); virtual void CountResult(); static const double ELECTRON_RAD_LENGTH; static const double ELECTRON_TERM_DECAY_LENGTH; static const double ELECTRON_TERM_DECAY_ENERGY; }; #endif
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_STORAGE_CREATE_METADATA_TASK_H_ #define CONTENT_BROWSER_BACKGROUND_FETCH_STORAGE_CREATE_METADATA_TASK_H_ #include <memory> #include <string> #include <vector> #include "content/browser/background_fetch/background_fetch.pb.h" #include "content/browser/background_fetch/storage/database_task.h" #include "content/browser/cache_storage/cache_storage_cache_handle.h" #include "third_party/blink/public/common/service_worker/service_worker_status_code.h" #include "third_party/blink/public/mojom/background_fetch/background_fetch.mojom.h" #include "third_party/skia/include/core/SkBitmap.h" namespace content { namespace background_fetch { // Checks if the registration can be created, then writes the Background // Fetch metadata in the SW database with corresponding entries in the cache. class CreateMetadataTask : public DatabaseTask { public: using CreateMetadataCallback = base::OnceCallback<void( blink::mojom::BackgroundFetchError, blink::mojom::BackgroundFetchRegistrationDataPtr)>; CreateMetadataTask(DatabaseTaskHost* host, const BackgroundFetchRegistrationId& registration_id, std::vector<blink::mojom::FetchAPIRequestPtr> requests, blink::mojom::BackgroundFetchOptionsPtr options, const SkBitmap& icon, bool start_paused, CreateMetadataCallback callback); ~CreateMetadataTask() override; void Start() override; private: void DidGetCanCreateRegistration(blink::mojom::BackgroundFetchError error, bool can_create); void DidGetIsQuotaAvailable(bool is_available); void GetRegistrationUniqueId(); void DidGetUniqueId(const std::vector<std::string>& data, blink::ServiceWorkerStatusCode status); void DidSerializeIcon(std::string serialized_icon); void StoreMetadata(); void DidStoreMetadata( blink::ServiceWorkerStatusCode status); void InitializeMetadataProto(); void DidOpenCache(int64_t trace_id, CacheStorageCacheHandle handle, blink::mojom::CacheStorageError error); void DidStoreRequests(CacheStorageCacheHandle handle, blink::mojom::CacheStorageVerboseErrorPtr error); void FinishWithError(blink::mojom::BackgroundFetchError error) override; std::string HistogramName() const override; BackgroundFetchRegistrationId registration_id_; std::vector<blink::mojom::FetchAPIRequestPtr> requests_; blink::mojom::BackgroundFetchOptionsPtr options_; SkBitmap icon_; bool start_paused_; CreateMetadataCallback callback_; std::unique_ptr<proto::BackgroundFetchMetadata> metadata_proto_; std::string serialized_icon_; base::WeakPtrFactory<CreateMetadataTask> weak_factory_{ this}; // Keep as last. DISALLOW_COPY_AND_ASSIGN(CreateMetadataTask); }; } // namespace background_fetch } // namespace content #endif // CONTENT_BROWSER_BACKGROUND_FETCH_STORAGE_CREATE_METADATA_TASK_H_
/* * This file is part of the optimized implementation of the Picnic signature scheme. * See the accompanying documentation for complete details. * * The code is provided under the MIT license, see LICENSE for * more details. * SPDX-License-Identifier: MIT */ #ifndef IO_H #define IO_H #include <stdint.h> #include <stdio.h> #include "mzd_additional.h" #define PICNIC_EXPORT void mzd_to_char_array(uint8_t* dst, const mzd_local_t* data, unsigned numbytes); void mzd_from_char_array(mzd_local_t* result, const uint8_t* data, unsigned len); void print_hex(FILE* out, const uint8_t* data, size_t len) PICNIC_EXPORT; #endif
/* $NetBSD: iomd_io.c,v 1.1 2001/10/05 22:27:41 reinoud Exp $ */ /* * Copyright (c) 1997 Mark Brinicombe. * Copyright (c) 1997 Causality Limited. * 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 Mark Brinicombe. * 4. The name of the company nor the name of the author may 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 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. */ /* * bus_space I/O functions for iomd */ #include <sys/param.h> #include <sys/systm.h> #include <machine/bus.h> /* Proto types for all the bus_space structure functions */ bs_protos(iomd); bs_protos(bs_notimpl); /* Declare the iomd bus space tag */ struct bus_space iomd_bs_tag = { /* cookie */ NULL, /* mapping/unmapping */ iomd_bs_map, iomd_bs_unmap, iomd_bs_subregion, /* allocation/deallocation */ iomd_bs_alloc, iomd_bs_free, /* get kernel virtual address */ 0, /* there is no linear mapping */ /* mmap bus space for userland */ bs_notimpl_bs_mmap, /* XXX correct? XXX */ /* barrier */ iomd_bs_barrier, /* read (single) */ iomd_bs_r_1, iomd_bs_r_2, iomd_bs_r_4, bs_notimpl_bs_r_8, /* read multiple */ bs_notimpl_bs_rm_1, iomd_bs_rm_2, bs_notimpl_bs_rm_4, bs_notimpl_bs_rm_8, /* read region */ bs_notimpl_bs_rr_1, bs_notimpl_bs_rr_2, bs_notimpl_bs_rr_4, bs_notimpl_bs_rr_8, /* write (single) */ iomd_bs_w_1, iomd_bs_w_2, iomd_bs_w_4, bs_notimpl_bs_w_8, /* write multiple */ bs_notimpl_bs_wm_1, iomd_bs_wm_2, bs_notimpl_bs_wm_4, bs_notimpl_bs_wm_8, /* write region */ bs_notimpl_bs_wr_1, bs_notimpl_bs_wr_2, bs_notimpl_bs_wr_4, bs_notimpl_bs_wr_8, /* set multiple */ bs_notimpl_bs_sm_1, bs_notimpl_bs_sm_2, bs_notimpl_bs_sm_4, bs_notimpl_bs_sm_8, /* set region */ bs_notimpl_bs_sr_1, bs_notimpl_bs_sr_2, bs_notimpl_bs_sr_4, bs_notimpl_bs_sr_8, /* copy */ bs_notimpl_bs_c_1, bs_notimpl_bs_c_2, bs_notimpl_bs_c_4, bs_notimpl_bs_c_8, }; /* bus space functions */ int iomd_bs_map(t, bpa, size, cacheable, bshp) void *t; bus_addr_t bpa; bus_size_t size; int cacheable; bus_space_handle_t *bshp; { /* * Temporary implementation as all I/O is already mapped etc. * * Eventually this function will do the mapping check for multiple maps */ *bshp = bpa; return(0); } int iomd_bs_alloc(t, rstart, rend, size, alignment, boundary, cacheable, bpap, bshp) void *t; bus_addr_t rstart, rend; bus_size_t size, alignment, boundary; int cacheable; bus_addr_t *bpap; bus_space_handle_t *bshp; { panic("iomd_alloc(): Help!\n"); } void iomd_bs_unmap(t, bsh, size) void *t; bus_space_handle_t bsh; bus_size_t size; { /* * Temporary implementation */ } void iomd_bs_free(t, bsh, size) void *t; bus_space_handle_t bsh; bus_size_t size; { panic("iomd_free(): Help!\n"); /* iomd_unmap() does all that we need to do. */ /* iomd_unmap(t, bsh, size);*/ } int iomd_bs_subregion(t, bsh, offset, size, nbshp) void *t; bus_space_handle_t bsh; bus_size_t offset, size; bus_space_handle_t *nbshp; { *nbshp = bsh + (offset << 2); return (0); } void iomd_bs_barrier(t, bsh, offset, len, flags) void *t; bus_space_handle_t bsh; bus_size_t offset, len; int flags; { } /* End of iomd_io.c */
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE476_NULL_Pointer_Dereference__int_18.c Label Definition File: CWE476_NULL_Pointer_Dereference.label.xml Template File: sources-sinks-18.tmpl.c */ /* * @description * CWE: 476 NULL Pointer Dereference * BadSource: Set data to NULL * GoodSource: Initialize data * Sinks: * GoodSink: Check for NULL before attempting to print data * BadSink : Print data * Flow Variant: 18 Control flow: goto statements * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD void CWE476_NULL_Pointer_Dereference__int_18_bad() { int * data; goto source; source: /* POTENTIAL FLAW: Set data to NULL */ data = NULL; goto sink; sink: /* POTENTIAL FLAW: Attempt to use data, which may be NULL */ printIntLine(*data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodB2G() - use badsource and goodsink by reversing the blocks on the second goto statement */ static void goodB2G() { int * data; goto source; source: /* POTENTIAL FLAW: Set data to NULL */ data = NULL; goto sink; sink: /* FIX: Check for NULL before attempting to print data */ if (data != NULL) { printIntLine(*data); } else { printLine("data is NULL"); } } /* goodG2B() - use goodsource and badsink by reversing the blocks on the first goto statement */ static void goodG2B() { int * data; int tmpData = 5; goto source; source: /* FIX: Initialize data */ { data = &tmpData; } goto sink; sink: /* POTENTIAL FLAW: Attempt to use data, which may be NULL */ printIntLine(*data); } void CWE476_NULL_Pointer_Dereference__int_18_good() { goodB2G(); goodG2B(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE476_NULL_Pointer_Dereference__int_18_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE476_NULL_Pointer_Dereference__int_18_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/* Copyright (c) 2011, Heath Borders 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 Heath Borders 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. */ #import <Foundation/Foundation.h> #import "HBCollection.h" @interface NSSet(HBCollections)<HBCollection> @end
/* * Copyright (c) 2004-07 Applied Micro Circuits Corporation. * Copyright (c) 2004-05 Vinod Kashyap. * 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 AUTHOR 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 OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD: releng/9.3/sys/dev/twa/tw_osl_ioctl.h 169400 2007-05-09 04:16:32Z scottl $ */ /* * AMCC'S 3ware driver for 9000 series storage controllers. * * Author: Vinod Kashyap * Modifications by: Adam Radford */ #ifndef TW_OSL_IOCTL_H #define TW_OSL_IOCTL_H /* * Macros and structures for OS Layer/Common Layer handled ioctls. */ #include <dev/twa/tw_cl_fwif.h> #include <dev/twa/tw_cl_ioctl.h> #pragma pack(1) /* * We need the structure below to ensure that the first byte of * data_buf is not overwritten by the kernel, after we return * from the ioctl call. Note that cmd_pkt has been reduced * to an array of 1024 bytes even though it's actually 2048 bytes * in size. This is because, we don't expect requests from user * land requiring 2048 (273 sg elements) byte cmd pkts. */ typedef struct tw_osli_ioctl_no_data_buf { struct tw_cl_driver_packet driver_pkt; TW_VOID *pdata; /* points to data_buf */ TW_INT8 padding[488 - sizeof(TW_VOID *)]; struct tw_cl_command_packet cmd_pkt; } TW_OSLI_IOCTL_NO_DATA_BUF; #pragma pack() /* ioctl cmds handled by the OS Layer */ #define TW_OSL_IOCTL_SCAN_BUS \ _IO('T', 200) #define TW_OSL_IOCTL_FIRMWARE_PASS_THROUGH \ _IOWR('T', 202, TW_OSLI_IOCTL_NO_DATA_BUF) #include <sys/ioccom.h> #pragma pack(1) typedef struct tw_osli_ioctl_with_payload { struct tw_cl_driver_packet driver_pkt; TW_INT8 padding[488]; struct tw_cl_command_packet cmd_pkt; union { struct tw_cl_event_packet event_pkt; struct tw_cl_lock_packet lock_pkt; struct tw_cl_compatibility_packet compat_pkt; TW_INT8 data_buf[1]; } payload; } TW_OSLI_IOCTL_WITH_PAYLOAD; #pragma pack() /* ioctl cmds handled by the Common Layer */ #define TW_CL_IOCTL_GET_FIRST_EVENT \ _IOWR('T', 203, TW_OSLI_IOCTL_WITH_PAYLOAD) #define TW_CL_IOCTL_GET_LAST_EVENT \ _IOWR('T', 204, TW_OSLI_IOCTL_WITH_PAYLOAD) #define TW_CL_IOCTL_GET_NEXT_EVENT \ _IOWR('T', 205, TW_OSLI_IOCTL_WITH_PAYLOAD) #define TW_CL_IOCTL_GET_PREVIOUS_EVENT \ _IOWR('T', 206, TW_OSLI_IOCTL_WITH_PAYLOAD) #define TW_CL_IOCTL_GET_LOCK \ _IOWR('T', 207, TW_OSLI_IOCTL_WITH_PAYLOAD) #define TW_CL_IOCTL_RELEASE_LOCK \ _IOWR('T', 208, TW_OSLI_IOCTL_WITH_PAYLOAD) #define TW_CL_IOCTL_GET_COMPATIBILITY_INFO \ _IOWR('T', 209, TW_OSLI_IOCTL_WITH_PAYLOAD) #endif /* TW_OSL_IOCTL_H */
/*************************************************************************** * * Copyright (c) 2014 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. Neither the name PX4 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. * ****************************************************************************/ /** * @file loiter.h * * Helper class to loiter * * @author Julian Oes <julian@oes.ch> */ #ifndef NAVIGATOR_LOITER_H #define NAVIGATOR_LOITER_H #include "navigator_mode.h" #include "mission_block.h" class Loiter final : public MissionBlock { public: Loiter(Navigator *navigator, const char *name); ~Loiter() = default; void on_inactive() override; void on_activation() override; void on_active() override; // TODO: share this with mission enum mission_yaw_mode { MISSION_YAWMODE_NONE = 0, MISSION_YAWMODE_FRONT_TO_WAYPOINT = 1, MISSION_YAWMODE_FRONT_TO_HOME = 2, MISSION_YAWMODE_BACK_TO_HOME = 3, MISSION_YAWMODE_MAX = 4 }; private: /** * Use the stored reposition location of the navigator * to move to a new location. */ void reposition(); /** * Set the position to hold based on the current local position */ void set_loiter_position(); control::BlockParamInt _param_yawmode; bool _loiter_pos_set{false}; }; #endif