text
stringlengths
4
6.14k
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/lookoutequipment/LookoutEquipment_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <utility> namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace LookoutEquipment { namespace Model { /** * <p> Specifies configuration information for the input data for the inference, * including input data S3 location. </p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/lookoutequipment-2020-12-15/InferenceS3InputConfiguration">AWS * API Reference</a></p> */ class AWS_LOOKOUTEQUIPMENT_API InferenceS3InputConfiguration { public: InferenceS3InputConfiguration(); InferenceS3InputConfiguration(Aws::Utils::Json::JsonView jsonValue); InferenceS3InputConfiguration& operator=(Aws::Utils::Json::JsonView jsonValue); Aws::Utils::Json::JsonValue Jsonize() const; /** * <p>The bucket containing the input dataset for the inference. </p> */ inline const Aws::String& GetBucket() const{ return m_bucket; } /** * <p>The bucket containing the input dataset for the inference. </p> */ inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } /** * <p>The bucket containing the input dataset for the inference. </p> */ inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } /** * <p>The bucket containing the input dataset for the inference. </p> */ inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } /** * <p>The bucket containing the input dataset for the inference. </p> */ inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } /** * <p>The bucket containing the input dataset for the inference. </p> */ inline InferenceS3InputConfiguration& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} /** * <p>The bucket containing the input dataset for the inference. </p> */ inline InferenceS3InputConfiguration& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} /** * <p>The bucket containing the input dataset for the inference. </p> */ inline InferenceS3InputConfiguration& WithBucket(const char* value) { SetBucket(value); return *this;} /** * <p>The prefix for the S3 bucket used for the input data for the inference. </p> */ inline const Aws::String& GetPrefix() const{ return m_prefix; } /** * <p>The prefix for the S3 bucket used for the input data for the inference. </p> */ inline bool PrefixHasBeenSet() const { return m_prefixHasBeenSet; } /** * <p>The prefix for the S3 bucket used for the input data for the inference. </p> */ inline void SetPrefix(const Aws::String& value) { m_prefixHasBeenSet = true; m_prefix = value; } /** * <p>The prefix for the S3 bucket used for the input data for the inference. </p> */ inline void SetPrefix(Aws::String&& value) { m_prefixHasBeenSet = true; m_prefix = std::move(value); } /** * <p>The prefix for the S3 bucket used for the input data for the inference. </p> */ inline void SetPrefix(const char* value) { m_prefixHasBeenSet = true; m_prefix.assign(value); } /** * <p>The prefix for the S3 bucket used for the input data for the inference. </p> */ inline InferenceS3InputConfiguration& WithPrefix(const Aws::String& value) { SetPrefix(value); return *this;} /** * <p>The prefix for the S3 bucket used for the input data for the inference. </p> */ inline InferenceS3InputConfiguration& WithPrefix(Aws::String&& value) { SetPrefix(std::move(value)); return *this;} /** * <p>The prefix for the S3 bucket used for the input data for the inference. </p> */ inline InferenceS3InputConfiguration& WithPrefix(const char* value) { SetPrefix(value); return *this;} private: Aws::String m_bucket; bool m_bucketHasBeenSet; Aws::String m_prefix; bool m_prefixHasBeenSet; }; } // namespace Model } // namespace LookoutEquipment } // namespace Aws
//////////////////////////////////////////////////////////////////////////////// /// DISCLAIMER /// /// Copyright 2014-2021 ArangoDB GmbH, Cologne, Germany /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany /// /// Licensed under the Apache License, Version 2.0 (the "License"); /// you may not use this file except in compliance with the License. /// You may obtain a copy of the License at /// /// http://www.apache.org/licenses/LICENSE-2.0 /// /// Unless required by applicable law or agreed to in writing, software /// distributed under the License is distributed on an "AS IS" BASIS, /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. /// See the License for the specific language governing permissions and /// limitations under the License. /// /// Copyright holder is ArangoDB GmbH, Cologne, Germany /// /// @author Simon Grätzer //////////////////////////////////////////////////////////////////////////////// #pragma once #include <set> #include <map> #include <velocypack/velocypack-aliases.h> #include <algorithm> #include "Basics/Common.h" #include "Cluster/ClusterInfo.h" #include "Pregel/Graph.h" struct TRI_vocbase_t; namespace arangodb { namespace pregel { template <typename V, typename E, typename M> class Worker; //////////////////////////////////////////////////////////////////////////////// /// @brief carry common parameters //////////////////////////////////////////////////////////////////////////////// class WorkerConfig { template <typename V, typename E, typename M> friend class Worker; public: WorkerConfig(TRI_vocbase_t* vocbase, VPackSlice params); void updateConfig(VPackSlice updated); inline uint64_t executionNumber() const { return _executionNumber; } inline uint64_t globalSuperstep() const { return _globalSuperstep; } inline uint64_t localSuperstep() const { return _localSuperstep; } inline bool asynchronousMode() const { return _asynchronousMode; } inline bool useMemoryMaps() const { return _useMemoryMaps; } inline uint64_t parallelism() const { return _parallelism; } inline std::string const& coordinatorId() const { return _coordinatorId; } inline TRI_vocbase_t* vocbase() const { return _vocbase; } inline std::string const& database() const { return _vocbase->name(); } // collection shards on this worker inline std::map<CollectionID, std::vector<ShardID>> const& vertexCollectionShards() const { return _vertexCollectionShards; } // collection shards on this worker inline std::map<CollectionID, std::vector<ShardID>> const& edgeCollectionShards() const { return _edgeCollectionShards; } inline std::unordered_map<CollectionID, std::string> const& collectionPlanIdMap() const { return _collectionPlanIdMap; } std::string const& shardIDToCollectionName(ShardID const& shard) const { auto const& it = _shardToCollectionName.find(shard); if (it != _shardToCollectionName.end()) { return it->second; } return StaticStrings::Empty; } // same content on every worker, has to stay equal!!!! inline std::vector<ShardID> const& globalShardIDs() const { return _globalShardIDs; } // convenvience access without guaranteed order, same values as in // vertexCollectionShards inline std::vector<ShardID> const& localVertexShardIDs() const { return _localVertexShardIDs; } // convenvience access without guaranteed order, same values as in // edgeCollectionShards inline std::vector<ShardID> const& localEdgeShardIDs() const { return _localEdgeShardIDs; } /// Actual set of pregel shard id's located here inline std::set<PregelShard> const& localPregelShardIDs() const { return _localPregelShardIDs; } inline PregelShard shardId(ShardID const& responsibleShard) const { auto const& it = _pregelShardIDs.find(responsibleShard); return it != _pregelShardIDs.end() ? it->second : InvalidPregelShard; } // index in globalShardIDs inline bool isLocalVertexShard(PregelShard shardIndex) const { // TODO cache this? prob small return _localPShardIDs_hash.find(shardIndex) != _localPShardIDs_hash.end(); } std::vector<ShardID> const& edgeCollectionRestrictions(ShardID const& shard) const; // convert an arangodb document id to a pregel id PregelID documentIdToPregel(std::string const& documentID) const; private: uint64_t _executionNumber = 0; uint64_t _globalSuperstep = 0; uint64_t _localSuperstep = 0; /// Let async bool _asynchronousMode = false; bool _useMemoryMaps = false; /// always use mmaps size_t _parallelism = 1; std::string _coordinatorId; TRI_vocbase_t* _vocbase; std::vector<ShardID> _globalShardIDs; std::vector<ShardID> _localVertexShardIDs, _localEdgeShardIDs; std::unordered_map<std::string, std::string> _collectionPlanIdMap; std::map<ShardID, std::string> _shardToCollectionName; // Map from edge collection to their shards, only iterated over keep sorted std::map<CollectionID, std::vector<ShardID>> _vertexCollectionShards, _edgeCollectionShards; std::unordered_map<CollectionID, std::vector<ShardID>> _edgeCollectionRestrictions; /// cache these ids as much as possible, since we access them often std::unordered_map<std::string, PregelShard> _pregelShardIDs; std::set<PregelShard> _localPregelShardIDs; std::unordered_set<PregelShard> _localPShardIDs_hash; }; } // namespace pregel } // namespace arangodb
/* * $Id$ * Copyright (C) 2008 AIST, National Institute of Advanced Industrial Science and Technology */ /* * took from Ruby. Thank you, Ruby! */ int endian() { static int init = 0; static int endian = 0; char *p; if (init) return endian; init = 1; p = &init; return endian = p[0]?1:0; }
#pragma once #include <string> #include "envoy/server/filter_config.h" #include "common/protobuf/protobuf.h" namespace Envoy { namespace Extensions { namespace HttpFilters { namespace Common { /** * Config registration for http filters that have empty configuration blocks. * The boiler plate instantiation functions (createFilterFactory, createFilterFactoryFromProto, * and createEmptyConfigProto) are implemented here. Users of this class have to implement * the createFilter function that instantiates the actual filter. */ class EmptyHttpFilterConfig : public Server::Configuration::NamedHttpFilterConfigFactory { public: virtual Http::FilterFactoryCb createFilter(const std::string& stat_prefix, Server::Configuration::FactoryContext& context) PURE; Http::FilterFactoryCb createFilterFactoryFromProto(const Protobuf::Message&, const std::string& stat_prefix, Server::Configuration::FactoryContext& context) override { return createFilter(stat_prefix, context); } ProtobufTypes::MessagePtr createEmptyConfigProto() override { // Using Struct instead of a custom filter config proto. This is only allowed in tests. return ProtobufTypes::MessagePtr{new Envoy::ProtobufWkt::Struct()}; } std::string configType() override { // Prevent registration of filters by type. This is only allowed in tests. return ""; } std::string name() const override { return name_; } protected: EmptyHttpFilterConfig(const std::string& name) : name_(name) {} private: const std::string name_; }; } // namespace Common } // namespace HttpFilters } // namespace Extensions } // namespace Envoy
/* * Copyright (c) 2017 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT plantower_pms7003 /* sensor pms7003.c - Driver for plantower PMS7003 sensor * PMS7003 product: http://www.plantower.com/en/content/?110.html * PMS7003 spec: http://aqicn.org/air/view/sensor/spec/pms7003.pdf */ #include <errno.h> #include <arch/cpu.h> #include <init.h> #include <kernel.h> #include <drivers/sensor.h> #include <stdlib.h> #include <string.h> #include <drivers/uart.h> #include <logging/log.h> LOG_MODULE_REGISTER(PMS7003, CONFIG_SENSOR_LOG_LEVEL); /* wait serial output with 1000ms timeout */ #define CFG_PMS7003_SERIAL_TIMEOUT 1000 struct pms7003_data { const struct device *uart_dev; uint16_t pm_1_0; uint16_t pm_2_5; uint16_t pm_10; }; /** * @brief wait for an array data from uart device with a timeout * * @param dev the uart device * @param data the data array to be matched * @param len the data array len * @param timeout the timeout in milliseconds * @return 0 if success; -ETIME if timeout */ static int uart_wait_for(const struct device *dev, uint8_t *data, int len, int timeout) { int matched_size = 0; int64_t timeout_time = k_uptime_get() + K_MSEC(timeout); while (1) { uint8_t c; if (k_uptime_get() > timeout_time) { return -ETIME; } if (uart_poll_in(dev, &c) == 0) { if (c == data[matched_size]) { matched_size++; if (matched_size == len) { break; } } else if (c == data[0]) { matched_size = 1; } else { matched_size = 0; } } } return 0; } /** * @brief read bytes from uart * * @param data the data buffer * @param len the data len * @param timeout the timeout in milliseconds * @return 0 if success; -ETIME if timeout */ static int uart_read_bytes(const struct device *dev, uint8_t *data, int len, int timeout) { int read_size = 0; int64_t timeout_time = k_uptime_get() + K_MSEC(timeout); while (1) { uint8_t c; if (k_uptime_get() > timeout_time) { return -ETIME; } if (uart_poll_in(dev, &c) == 0) { data[read_size++] = c; if (read_size == len) { break; } } } return 0; } static int pms7003_sample_fetch(const struct device *dev, enum sensor_channel chan) { struct pms7003_data *drv_data = dev->data; /* sample output */ /* 42 4D 00 1C 00 01 00 01 00 01 00 01 00 01 00 01 01 92 * 00 4E 00 03 00 00 00 00 00 00 71 00 02 06 */ uint8_t pms7003_start_bytes[] = {0x42, 0x4d}; uint8_t pms7003_receive_buffer[30]; if (uart_wait_for(drv_data->uart_dev, pms7003_start_bytes, sizeof(pms7003_start_bytes), CFG_PMS7003_SERIAL_TIMEOUT) < 0) { LOG_WRN("waiting for start bytes is timeout"); return -ETIME; } if (uart_read_bytes(drv_data->uart_dev, pms7003_receive_buffer, 30, CFG_PMS7003_SERIAL_TIMEOUT) < 0) { return -ETIME; } drv_data->pm_1_0 = (pms7003_receive_buffer[8] << 8) + pms7003_receive_buffer[9]; drv_data->pm_2_5 = (pms7003_receive_buffer[10] << 8) + pms7003_receive_buffer[11]; drv_data->pm_10 = (pms7003_receive_buffer[12] << 8) + pms7003_receive_buffer[13]; LOG_DBG("pm1.0 = %d", drv_data->pm_1_0); LOG_DBG("pm2.5 = %d", drv_data->pm_2_5); LOG_DBG("pm10 = %d", drv_data->pm_10); return 0; } static int pms7003_channel_get(const struct device *dev, enum sensor_channel chan, struct sensor_value *val) { struct pms7003_data *drv_data = dev->data; if (chan == SENSOR_CHAN_PM_1_0) { val->val1 = drv_data->pm_1_0; val->val2 = 0; } else if (chan == SENSOR_CHAN_PM_2_5) { val->val1 = drv_data->pm_2_5; val->val2 = 0; } else if (chan == SENSOR_CHAN_PM_10) { val->val1 = drv_data->pm_10; val->val2 = 0; } else { return -EINVAL; } return 0; } static const struct sensor_driver_api pms7003_api = { .sample_fetch = &pms7003_sample_fetch, .channel_get = &pms7003_channel_get, }; static int pms7003_init(const struct device *dev) { struct pms7003_data *drv_data = dev->data; drv_data->uart_dev = device_get_binding(DT_INST_BUS_LABEL(0)); if (!drv_data->uart_dev) { LOG_DBG("uart device is not found: %s", DT_INST_BUS_LABEL(0)); return -EINVAL; } return 0; } static struct pms7003_data pms7003_data; DEVICE_DT_INST_DEFINE(0, &pms7003_init, device_pm_control_nop, &pms7003_data, NULL, POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &pms7003_api);
#ifndef _DICTIONARY_H_ #define _DICTIONARY_H_ #include <string> #include <unordered_map> #include <cinttypes> // This class represents a dictionary that maps integer values to strings. class Dictionary { public: typedef int32_t DiffType; // return value of compare function typedef uint32_t IntType; // int is enough, no need for int64 typedef std::string StringType; typedef std::unordered_map<IntType, IntType> TranslationTable; private: typedef std::unordered_map<IntType, StringType> IndexMap; typedef std::unordered_map<StringType, IntType> ReverseMap; public: typedef IndexMap::const_iterator const_iterator; private: // Mapping from ID to String IndexMap indexMap; // Mapping from String to ID ReverseMap reverseMap; // Mapping from ID to index in sorted order TranslationTable orderMap; // Next ID to be given IntType nextID; // Whether or not the dictionary has been modified since loading. bool modified; // Whether or not orderMap is valid bool orderValid; public: // Constructor Dictionary( void ); // Construct from dictionary name Dictionary( const std::string name ); // Destructor ~Dictionary( void ); // Look up an ID and get the String const char * Dereference( const IntType id ) const; // Look up a String and get the ID // Return invalid if not found IntType Lookup( const char * str, const IntType invalid ) const; // Insert a value into the Dictionary and return the ID. // Throw an error if the new ID is larger than maxID IntType Insert( const char * str, const IntType maxID ); // Integrate another dictionary into this one, and produce a translation // table for any values whose ID has changed. void Integrate( Dictionary& other, TranslationTable& trans ); // load/save dictionary from SQL // name specifies which dictionary to load/save void Load(const char* name); void Save(const char* name); // Compare two factors lexicographically. // The return value will be as follows: // first > second : retVal > 0 // first = second : retVal = 0 // first < second : retVal < 0 DiffType Compare( IntType firstID, IntType secondID ) const; const_iterator begin( void) const; const_iterator cbegin( void ) const; const_iterator end( void ) const; const_iterator cend( void ) const; private: // Helper method for reverse lookups IntType Lookup( const StringType& str, const IntType invalid ) const; // Helper method for inserting strings IntType Insert( StringType& str ); // Helper method to compute the sorted order. void ComputeOrder( void ); /* ***** Static Members ***** */ private: typedef std::unordered_map<std::string, Dictionary> DictionaryMap; // Storage for global dictionaries static DictionaryMap dicts; /* ***** Static Methods ***** */ public: static Dictionary & GetDictionary( const std::string name ); }; #endif //_DICTIONARY_H_
/* * Copyright (c) 2020 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ /* Performs initialization of Direction Finding in Host */ int le_df_init(void); void hci_df_prepare_connectionless_iq_report(struct net_buf *buf, struct bt_df_per_adv_sync_iq_samples_report *report, struct bt_le_per_adv_sync **per_adv_sync_to_report);
/* socket.c Created: Feb 2001 by Philip Homburg <philip@f-mnx.phicoh.com> Open a TCP connection */ #define _POSIX_C_SOURCE 2 #include <errno.h> #include <fcntl.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <signal.h> #include <string.h> #include <unistd.h> #include <sys/ioctl.h> #include <sys/wait.h> #include <net/hton.h> #include <net/netlib.h> #include <net/gen/in.h> #include <net/gen/inet.h> #include <netdb.h> #include <net/gen/socket.h> #include <net/gen/tcp.h> #include <net/gen/tcp_io.h> #define BUF_SIZE 10240 char *progname; int tcpfd= -1; char buf[BUF_SIZE]; static int bulk= 0; static int push= 0; static int stdout_issocket= 0; static int timeout; static void do_conn(char *hostname, char *portname); static void alrm_conn(int sig); static void alrm_io(int sig); static void fullduplex(void); static void fatal(char *msg, ...); static void usage(void); int main(int argc, char *argv[]) { int c; char *hostname; char *portname; char *check; int B_flag, P_flag, s_flag; char *t_arg; (progname=strrchr(argv[0],'/')) ? progname++ : (progname=argv[0]); B_flag= 0; P_flag= 0; s_flag= 0; t_arg= NULL; while (c= getopt(argc, argv, "BPst:?"), c != -1) { switch(c) { case 'B': B_flag= 1; break; case 'P': P_flag= 1; break; case 's': s_flag= 1; break; case 't': t_arg= optarg; break; case '?': usage(); default: fatal("getopt failed: '%c'", c); } } if (t_arg) { timeout= strtol(t_arg, &check, 0); if (check[0] != '\0') fatal("unable to parse timeout '%s'\n", t_arg); if (timeout <= 0) fatal("bad timeout '%d'\n", timeout); } else timeout= 0; if (optind+2 != argc) usage(); hostname= argv[optind++]; portname= argv[optind++]; bulk= B_flag; push= P_flag; stdout_issocket= s_flag; do_conn(hostname, portname); /* XXX */ if (timeout) { signal(SIGALRM, alrm_io); alarm(timeout); } fullduplex(); exit(0); } static void do_conn(char *hostname, char *portname) { ipaddr_t addr; tcpport_t port; struct hostent *he; struct servent *se; char *tcp_device, *check; nwio_tcpconf_t tcpconf; nwio_tcpcl_t tcpcl; nwio_tcpopt_t tcpopt; if (!inet_aton(hostname, &addr)) { he= gethostbyname(hostname); if (he == NULL) fatal("unknown hostname '%s'", hostname); if (he->h_addrtype != AF_INET || he->h_length != sizeof(addr)) fatal("bad address for '%s'", hostname); memcpy(&addr, he->h_addr, sizeof(addr)); } port= strtol(portname, &check, 0); if (check[0] != 0) { se= getservbyname(portname, "tcp"); if (se == NULL) fatal("unkown port '%s'", portname); port= ntohs(se->s_port); } tcp_device= getenv("TCP_DEVICE"); if (tcp_device == NULL) tcp_device= TCP_DEVICE; tcpfd= open(tcp_device, O_RDWR); if (tcpfd == -1) fatal("unable to open '%s': %s", tcp_device, strerror(errno)); tcpconf.nwtc_flags= NWTC_EXCL | NWTC_LP_SEL | NWTC_SET_RA | NWTC_SET_RP; tcpconf.nwtc_remaddr= addr; tcpconf.nwtc_remport= htons(port);; if (ioctl(tcpfd, NWIOSTCPCONF, &tcpconf) == -1) fatal("NWIOSTCPCONF failed: %s", strerror(errno)); if (timeout) { signal(SIGALRM, alrm_conn); alarm(timeout); } tcpcl.nwtcl_flags= 0; if (ioctl(tcpfd, NWIOTCPCONN, &tcpcl) == -1) { fatal("unable to connect to %s:%u: %s", inet_ntoa(addr), ntohs(tcpconf.nwtc_remport), strerror(errno)); } alarm(0); if (bulk) { tcpopt.nwto_flags= NWTO_BULK; if (ioctl(tcpfd, NWIOSTCPOPT, &tcpopt) == -1) fatal("NWIOSTCPOPT failed: %s", strerror(errno)); } } static void alrm_conn(int sig) { fatal("timeout during connect"); } static void alrm_io(int sig) { fatal("timeout during io"); } static void fullduplex(void) { pid_t cpid; int o, r, s, s_errno, loc; cpid= fork(); switch(cpid) { case -1: fatal("fork failed: %s", strerror(errno)); case 0: /* Read from TCP, write to stdout. */ for (;;) { r= read(tcpfd, buf, BUF_SIZE); if (r == 0) break; if (r == -1) { r= errno; if (stdout_issocket) ioctl(1, NWIOTCPSHUTDOWN, NULL); fatal("error reading from TCP conn.: %s", strerror(errno)); } s= r; for (o= 0; o<s; o += r) { r= write(1, buf+o, s-o); if (r <= 0) { fatal("error writing to stdout: %s", r == 0 ? "EOF" : strerror(errno)); } } } if (stdout_issocket) { r= ioctl(1, NWIOTCPSHUTDOWN, NULL); if (r == -1) { fatal("NWIOTCPSHUTDOWN failed on stdout: %s", strerror(errno)); } } exit(0); default: break; } /* Read from stdin, write to TCP. */ for (;;) { r= read(0, buf, BUF_SIZE); if (r == 0) break; if (r == -1) { s_errno= errno; kill(cpid, SIGTERM); fatal("error reading from stdin: %s", strerror(s_errno)); } s= r; for (o= 0; o<s; o += r) { r= write(tcpfd, buf+o, s-o); if (r <= 0) { s_errno= errno; kill(cpid, SIGTERM); fatal("error writing to TCP conn.: %s", r == 0 ? "EOF" : strerror(s_errno)); } } if (push) ioctl(tcpfd, NWIOTCPPUSH, NULL); } if (ioctl(tcpfd, NWIOTCPSHUTDOWN, NULL) == -1) { s_errno= errno; kill(cpid, SIGTERM); fatal("unable to shut down TCP conn.: %s", strerror(s_errno)); } r= waitpid(cpid, &loc, 0); if (r == -1) { s_errno= errno; kill(cpid, SIGTERM); fatal("waitpid failed: %s", strerror(s_errno)); } if (WIFEXITED(loc)) exit(WEXITSTATUS(loc)); kill(getpid(), WTERMSIG(loc)); exit(1); } static void fatal(char *fmt, ...) { va_list ap; va_start(ap, fmt); fprintf(stderr, "%s: ", progname); vfprintf(stderr, fmt, ap); fprintf(stderr, "\n"); va_end(ap); exit(1); } static void usage(void) { fprintf(stderr, "Usage: %s [-BPs] [-t timeout] hostname portname\n", progname); exit(1); } /* * $PchId: socket.c,v 1.3 2005/01/31 22:33:20 philip Exp $ */
/* Public domain */ typedef struct vg_point { struct vg_node _inherit; float size; /* Size in pixels (0.0 = invisible) */ } VG_Point; #define VGPOINT(p) ((VG_Point *)(p)) /* Begin generated block */ __BEGIN_DECLS extern DECLSPEC VG_NodeOps vgPointOps; static __inline__ VG_Point * VG_PointNew(void *pNode, VG_Vector pos) { VG_Point *vp; vp = (VG_Point *)AG_Malloc(sizeof(VG_Point)); VG_NodeInit(vp, &vgPointOps); VG_Translate(vp, pos); VG_NodeAttach(pNode, vp); return (vp); } static __inline__ void VG_PointSize(VG_Point *vp, float r) { VG_Lock(VGNODE(vp)->vg); vp->size = r; VG_Unlock(VGNODE(vp)->vg); } __END_DECLS /* Close generated block */
require_extension('D'); require_rv64; require_fp; softfloat_roundingMode = RM; WRITE_FRD(i64_to_f64(RS1)); set_fp_exceptions;
/* Copyright 2017 The TensorFlow 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 TENSORFLOW_COMPILER_XLA_SERVICE_GPU_COPY_THUNK_H_ #define TENSORFLOW_COMPILER_XLA_SERVICE_GPU_COPY_THUNK_H_ #include "tensorflow/compiler/xla/service/buffer_assignment.h" #include "tensorflow/compiler/xla/service/gpu/buffer_allocations.h" #include "tensorflow/compiler/xla/service/gpu/thunk.h" #include "tensorflow/compiler/xla/service/hlo_instruction.h" #include "tensorflow/core/platform/stream_executor_no_cuda.h" #include "tensorflow/core/platform/types.h" namespace xla { namespace gpu { // A thunk that copies data from a host buffer to a device buffer. class HostToDeviceCopyThunk : public Thunk { public: // Constructs a CopyThunk that copies host data from `source_address` to the // device buffer `destination_buffer`. `mem_size` is the size of the data in // bytes. HostToDeviceCopyThunk(ThunkInfo thunk_info, const void* source_address, const BufferAllocation::Slice& destination_buffer, uint64 mem_size); HostToDeviceCopyThunk(const HostToDeviceCopyThunk&) = delete; HostToDeviceCopyThunk& operator=(const HostToDeviceCopyThunk&) = delete; Status ExecuteOnStream(const ExecuteParams& params) override; private: const void* source_address_; const BufferAllocation::Slice destination_buffer_; const uint64 mem_size_; }; // A thunk that copies data from a device buffer to another device buffer. class DeviceToDeviceCopyThunk : public Thunk { public: // Constructs a CopyThunk that copies host data from `source_buffer` to the // device buffer `destination_buffer`. `mem_size` is the size of the data in // bytes. DeviceToDeviceCopyThunk(ThunkInfo thunk_info, const BufferAllocation::Slice& source_buffer, const BufferAllocation::Slice& destination_buffer, uint64 mem_size); DeviceToDeviceCopyThunk(const DeviceToDeviceCopyThunk&) = delete; DeviceToDeviceCopyThunk& operator=(const DeviceToDeviceCopyThunk&) = delete; Status ExecuteOnStream(const ExecuteParams& params) override; private: const BufferAllocation::Slice source_buffer_; const BufferAllocation::Slice destination_buffer_; const uint64 mem_size_; }; } // namespace gpu } // namespace xla #endif // TENSORFLOW_COMPILER_XLA_SERVICE_GPU_COPY_THUNK_H_
/* * Copyright (c) 2018 Makaio GmbH * * SPDX-License-Identifier: Apache-2.0 */ #include <shell/shell_rtt.h> #include <init.h> #include <SEGGER_RTT.h> #include <logging/log.h> BUILD_ASSERT_MSG(!(IS_ENABLED(CONFIG_LOG_BACKEND_RTT) && COND_CODE_0(CONFIG_LOG_BACKEND_RTT_BUFFER, (1), (0))), "Conflicting log RTT backend enabled on the same channel"); SHELL_RTT_DEFINE(shell_transport_rtt); SHELL_DEFINE(shell_rtt, CONFIG_SHELL_PROMPT_RTT, &shell_transport_rtt, CONFIG_SHELL_BACKEND_RTT_LOG_MESSAGE_QUEUE_SIZE, CONFIG_SHELL_BACKEND_RTT_LOG_MESSAGE_QUEUE_TIMEOUT, SHELL_FLAG_OLF_CRLF); LOG_MODULE_REGISTER(shell_rtt, CONFIG_SHELL_RTT_LOG_LEVEL); static bool rtt_blocking; static void timer_handler(struct k_timer *timer) { const struct shell_rtt *sh_rtt = k_timer_user_data_get(timer); if (SEGGER_RTT_HasData(0)) { sh_rtt->handler(SHELL_TRANSPORT_EVT_RX_RDY, sh_rtt->context); } } static int init(const struct shell_transport *transport, const void *config, shell_transport_handler_t evt_handler, void *context) { struct shell_rtt *sh_rtt = (struct shell_rtt *)transport->ctx; sh_rtt->handler = evt_handler; sh_rtt->context = context; k_timer_init(&sh_rtt->timer, timer_handler, NULL); k_timer_user_data_set(&sh_rtt->timer, (void *)sh_rtt); k_timer_start(&sh_rtt->timer, CONFIG_SHELL_RTT_RX_POLL_PERIOD, CONFIG_SHELL_RTT_RX_POLL_PERIOD); return 0; } static int uninit(const struct shell_transport *transport) { return 0; } static int enable(const struct shell_transport *transport, bool blocking) { struct shell_rtt *sh_rtt = (struct shell_rtt *)transport->ctx; if (blocking) { rtt_blocking = true; k_timer_stop(&sh_rtt->timer); } return 0; } static int write(const struct shell_transport *transport, const void *data, size_t length, size_t *cnt) { struct shell_rtt *sh_rtt = (struct shell_rtt *)transport->ctx; const u8_t *data8 = (const u8_t *)data; if (rtt_blocking) { *cnt = SEGGER_RTT_WriteNoLock(0, data8, length); while (SEGGER_RTT_HasDataUp(0)) { /* empty */ } } else { *cnt = SEGGER_RTT_Write(0, data8, length); } sh_rtt->handler(SHELL_TRANSPORT_EVT_TX_RDY, sh_rtt->context); return 0; } static int read(const struct shell_transport *transport, void *data, size_t length, size_t *cnt) { *cnt = SEGGER_RTT_Read(0, data, length); return 0; } const struct shell_transport_api shell_rtt_transport_api = { .init = init, .uninit = uninit, .enable = enable, .write = write, .read = read }; static int enable_shell_rtt(struct device *arg) { ARG_UNUSED(arg); bool log_backend = CONFIG_SHELL_RTT_INIT_LOG_LEVEL > 0; u32_t level = (CONFIG_SHELL_RTT_INIT_LOG_LEVEL > LOG_LEVEL_DBG) ? CONFIG_LOG_MAX_LEVEL : CONFIG_SHELL_RTT_INIT_LOG_LEVEL; shell_init(&shell_rtt, NULL, true, log_backend, level); return 0; } /* Function is used for testing purposes */ const struct shell *shell_backend_rtt_get_ptr(void) { return &shell_rtt; } SYS_INIT(enable_shell_rtt, POST_KERNEL, 0);
/* * 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/appstream/AppStream_EXPORTS.h> namespace Aws { template<typename RESULT_TYPE> class AmazonWebServiceResult; namespace Utils { namespace Json { class JsonValue; } // namespace Json } // namespace Utils namespace AppStream { namespace Model { class AWS_APPSTREAM_API DisassociateFleetResult { public: DisassociateFleetResult(); DisassociateFleetResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); DisassociateFleetResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); }; } // namespace Model } // namespace AppStream } // namespace Aws
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/proton/Proton_EXPORTS.h> #include <aws/proton/ProtonRequest.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <utility> namespace Aws { namespace Proton { namespace Model { /** */ class AWS_PROTON_API DeleteEnvironmentTemplateVersionRequest : public ProtonRequest { public: DeleteEnvironmentTemplateVersionRequest(); // Service request name is the Operation name which will send this request out, // each operation should has unique request name, so that we can get operation's name from this request. // Note: this is not true for response, multiple operations may have the same response name, // so we can not get operation's name from response. inline virtual const char* GetServiceRequestName() const override { return "DeleteEnvironmentTemplateVersion"; } Aws::String SerializePayload() const override; Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; /** * <p>The environment template major version to delete.</p> */ inline const Aws::String& GetMajorVersion() const{ return m_majorVersion; } /** * <p>The environment template major version to delete.</p> */ inline bool MajorVersionHasBeenSet() const { return m_majorVersionHasBeenSet; } /** * <p>The environment template major version to delete.</p> */ inline void SetMajorVersion(const Aws::String& value) { m_majorVersionHasBeenSet = true; m_majorVersion = value; } /** * <p>The environment template major version to delete.</p> */ inline void SetMajorVersion(Aws::String&& value) { m_majorVersionHasBeenSet = true; m_majorVersion = std::move(value); } /** * <p>The environment template major version to delete.</p> */ inline void SetMajorVersion(const char* value) { m_majorVersionHasBeenSet = true; m_majorVersion.assign(value); } /** * <p>The environment template major version to delete.</p> */ inline DeleteEnvironmentTemplateVersionRequest& WithMajorVersion(const Aws::String& value) { SetMajorVersion(value); return *this;} /** * <p>The environment template major version to delete.</p> */ inline DeleteEnvironmentTemplateVersionRequest& WithMajorVersion(Aws::String&& value) { SetMajorVersion(std::move(value)); return *this;} /** * <p>The environment template major version to delete.</p> */ inline DeleteEnvironmentTemplateVersionRequest& WithMajorVersion(const char* value) { SetMajorVersion(value); return *this;} /** * <p>The environment template minor version to delete.</p> */ inline const Aws::String& GetMinorVersion() const{ return m_minorVersion; } /** * <p>The environment template minor version to delete.</p> */ inline bool MinorVersionHasBeenSet() const { return m_minorVersionHasBeenSet; } /** * <p>The environment template minor version to delete.</p> */ inline void SetMinorVersion(const Aws::String& value) { m_minorVersionHasBeenSet = true; m_minorVersion = value; } /** * <p>The environment template minor version to delete.</p> */ inline void SetMinorVersion(Aws::String&& value) { m_minorVersionHasBeenSet = true; m_minorVersion = std::move(value); } /** * <p>The environment template minor version to delete.</p> */ inline void SetMinorVersion(const char* value) { m_minorVersionHasBeenSet = true; m_minorVersion.assign(value); } /** * <p>The environment template minor version to delete.</p> */ inline DeleteEnvironmentTemplateVersionRequest& WithMinorVersion(const Aws::String& value) { SetMinorVersion(value); return *this;} /** * <p>The environment template minor version to delete.</p> */ inline DeleteEnvironmentTemplateVersionRequest& WithMinorVersion(Aws::String&& value) { SetMinorVersion(std::move(value)); return *this;} /** * <p>The environment template minor version to delete.</p> */ inline DeleteEnvironmentTemplateVersionRequest& WithMinorVersion(const char* value) { SetMinorVersion(value); return *this;} /** * <p>The name of the environment template.</p> */ inline const Aws::String& GetTemplateName() const{ return m_templateName; } /** * <p>The name of the environment template.</p> */ inline bool TemplateNameHasBeenSet() const { return m_templateNameHasBeenSet; } /** * <p>The name of the environment template.</p> */ inline void SetTemplateName(const Aws::String& value) { m_templateNameHasBeenSet = true; m_templateName = value; } /** * <p>The name of the environment template.</p> */ inline void SetTemplateName(Aws::String&& value) { m_templateNameHasBeenSet = true; m_templateName = std::move(value); } /** * <p>The name of the environment template.</p> */ inline void SetTemplateName(const char* value) { m_templateNameHasBeenSet = true; m_templateName.assign(value); } /** * <p>The name of the environment template.</p> */ inline DeleteEnvironmentTemplateVersionRequest& WithTemplateName(const Aws::String& value) { SetTemplateName(value); return *this;} /** * <p>The name of the environment template.</p> */ inline DeleteEnvironmentTemplateVersionRequest& WithTemplateName(Aws::String&& value) { SetTemplateName(std::move(value)); return *this;} /** * <p>The name of the environment template.</p> */ inline DeleteEnvironmentTemplateVersionRequest& WithTemplateName(const char* value) { SetTemplateName(value); return *this;} private: Aws::String m_majorVersion; bool m_majorVersionHasBeenSet; Aws::String m_minorVersion; bool m_minorVersionHasBeenSet; Aws::String m_templateName; bool m_templateNameHasBeenSet; }; } // namespace Model } // namespace Proton } // namespace Aws
// I would prefer this to be delete.lua and load it using NSBundle // But I failed. I don't know why. static const char * deletelua = "" "-- This script receives three parameters, all encoded with\n" "-- MessagePack. The decoded values are used for deleting a model\n" "-- instance in Redis and removing any reference to it in sets\n" "-- (indices) and hashes (unique indices).\n" "--\n" "-- # model\n" "--\n" "-- Table with three attributes:\n" "-- id (model instance id)\n" "-- key (hash where the attributes will be saved)\n" "-- name (model name)\n" "--\n" "-- # uniques\n" "--\n" "-- Fields and values to be removed from the unique indices.\n" "--\n" "-- # tracked\n" "--\n" "-- Keys that share the lifecycle of this model instance, that\n" "-- should be removed as this object is deleted.\n" "--\n" "local model = cmsgpack.unpack(ARGV[1])\n" "local uniques = cmsgpack.unpack(ARGV[2])\n" "local tracked = cmsgpack.unpack(ARGV[3])\n" "\n" "local function remove_indices(model)\n" " local memo = model.key .. \":_indices\"\n" " local existing = redis.call(\"SMEMBERS\", memo)\n" "\n" " for _, key in ipairs(existing) do\n" " redis.call(\"SREM\", key, model.id)\n" " redis.call(\"SREM\", memo, key)\n" " end\n" "end\n" "\n" "local function remove_uniques(model, uniques)\n" " local memo = model.key .. \":_uniques\"\n" "\n" " for field, _ in pairs(uniques) do\n" " local key = model.name .. \":uniques:\" .. field\n" "\n" " local field = redis.call(\"HGET\", memo, key)\n" " if field then\n" " redis.call(\"HDEL\", key, field)\n" " end\n" " redis.call(\"HDEL\", memo, key)\n" " end\n" "end\n" "\n" "local function remove_tracked(model, tracked)\n" " for _, tracked_key in ipairs(tracked) do\n" " local key = model.key .. \":\" .. tracked_key\n" "\n" " redis.call(\"DEL\", key)\n" " end\n" "end\n" "\n" "local function delete(model)\n" " local keys = {\n" " model.key .. \":counters\",\n" " model.key .. \":_indices\",\n" " model.key .. \":_uniques\",\n" " model.key\n" " }\n" "\n" " redis.call(\"SREM\", model.name .. \":all\", model.id)\n" " redis.call(\"DEL\", unpack(keys))\n" "end\n" "\n" "remove_indices(model)\n" "remove_uniques(model, uniques)\n" "remove_tracked(model, tracked)\n" "delete(model)\n" "\n" "return model.id\n";
/* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2000 Dirk Mueller (mueller@kde.org) * Copyright (C) 2004, 2005, 2006, 2007, 2010 Apple Inc. 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 HTMLButtonElement_h #define HTMLButtonElement_h #include "HTMLFormControlElement.h" namespace WebCore { class HTMLButtonElement : public HTMLFormControlElement { public: static PassRefPtr<HTMLButtonElement> create(const QualifiedName&, Document*, HTMLFormElement*); void setType(const AtomicString&); String value() const; virtual bool willRespondToMouseClickEvents() OVERRIDE; private: HTMLButtonElement(const QualifiedName& tagName, Document*, HTMLFormElement*); enum Type { SUBMIT, RESET, BUTTON }; virtual const AtomicString& formControlType() const; virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); virtual void willAddAuthorShadowRoot() OVERRIDE; virtual void parseAttribute(const Attribute&) OVERRIDE; virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE; virtual void defaultEventHandler(Event*); virtual bool appendFormData(FormDataList&, bool); virtual bool isEnumeratable() const { return true; } virtual bool supportLabels() const OVERRIDE { return true; } virtual bool isSuccessfulSubmitButton() const; virtual bool isActivatedSubmit() const; virtual void setActivatedSubmit(bool flag); virtual void accessKeyAction(bool sendMouseEvents); virtual bool isURLAttribute(const Attribute&) const OVERRIDE; virtual bool canStartSelection() const { return false; } virtual bool isOptionalFormControl() const { return true; } virtual bool recalcWillValidate() const; Type m_type; bool m_isActivatedSubmit; }; } // namespace #endif
/* * This software is distributed under BSD 3-clause license (see LICENSE file). * * Authors: Soeren Sonnenburg, Heiko Strathmann, Yuyu Zhang, Viktor Gal, * Thoralf Klein, Fernando Iglesias, Sergey Lisitsyn */ #ifndef __STREAMING_ASCIIFILE_H__ #define __STREAMING_ASCIIFILE_H__ #include <shogun/lib/config.h> #include <shogun/io/streaming/StreamingFile.h> #include <shogun/lib/v_array.h> namespace shogun { struct substring; template <class ST> struct SGSparseVectorEntry; /** @brief Class StreamingAsciiFile to read vector-by-vector from ASCII files. * * The object must be initialized like a CSVFile. */ class StreamingAsciiFile: public StreamingFile { public: /** * Default constructor * */ StreamingAsciiFile(); /** * Constructor taking file name argument * * @param fname file name * @param rw read/write mode */ StreamingAsciiFile(const char* fname, char rw='r'); /** * Destructor */ ~StreamingAsciiFile() override; /** set delimiting character * * @param delimiter the character used as delimiter */ void set_delimiter(char delimiter); #ifndef SWIG // SWIG should skip this /** * Utility function to convert a string to a boolean value * * @param str string to convert * * @return boolean value */ inline bool str_to_bool(char *str) { return (atoi(str)!=0); } #define GET_VECTOR_DECL(sg_type) \ void get_vector \ (sg_type*& vector, int32_t& len) override; \ \ void get_vector_and_label \ (sg_type*& vector, int32_t& len, float64_t& label) override; \ \ void get_string \ (sg_type*& vector, int32_t& len) override; \ \ void get_string_and_label \ (sg_type*& vector, int32_t& len, float64_t& label) override; \ \ void get_sparse_vector \ (SGSparseVectorEntry<sg_type>*& vector, int32_t& len) override; \ \ void get_sparse_vector_and_label \ (SGSparseVectorEntry<sg_type>*& vector, int32_t& len, float64_t& label) override; GET_VECTOR_DECL(bool) GET_VECTOR_DECL(uint8_t) GET_VECTOR_DECL(char) GET_VECTOR_DECL(int32_t) GET_VECTOR_DECL(float32_t) GET_VECTOR_DECL(float64_t) GET_VECTOR_DECL(int16_t) GET_VECTOR_DECL(uint16_t) GET_VECTOR_DECL(int8_t) GET_VECTOR_DECL(uint32_t) GET_VECTOR_DECL(int64_t) GET_VECTOR_DECL(uint64_t) GET_VECTOR_DECL(floatmax_t) #undef GET_VECTOR_DECL #endif // #ifndef SWIG // SWIG should skip this /** @return object name */ const char* get_name() const override { return "StreamingAsciiFile"; } private: /** helper function to read vectors / matrices * * @param items dynamic array of values * @param ptr_data * @param ptr_item */ template <class T> void append_item(std::vector<T>& items, char* ptr_data, char* ptr_item); /** * Split a given substring into an array of substrings * based on a specified delimiter * * @param delim delimiter to use * @param s substring to tokenize * @param ret array of substrings, returned */ void tokenize(char delim, substring s, v_array<substring> &ret); private: /// Helper for parsing v_array<substring> words; /** delimiter */ char m_delimiter; }; } #endif //__STREAMING_ASCIIFILE_H__
/* * Copyright (c) 2014, Ford Motor Company * 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 Ford Motor Company 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. */ #ifndef TEST_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_MOCK_H_ #define TEST_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_MOCK_H_ #include <gmock/gmock.h> #include <string> #include "transport_manager/transport_manager.h" #include "transport_manager/transport_adapter/transport_adapter_event.h" namespace test { namespace components { namespace transport_manager_test { using ::transport_manager::DeviceHandle; using ::transport_manager::ConnectionUID; using ::transport_manager::transport_adapter::TransportAdapter; using ::transport_manager::TransportAdapterEvent; using ::transport_manager::TransportManagerListener; /* * MOCK implementation of ::transport_manager::TransportManager interface */ class TransportManagerMock: public ::transport_manager::TransportManager { public: MOCK_METHOD0(Init, int()); MOCK_METHOD0(Reinit, int()); MOCK_METHOD0(SearchDevices, int()); MOCK_METHOD1(ConnectDevice, int(const DeviceHandle &)); MOCK_METHOD1(DisconnectDevice, int(const DeviceHandle &)); MOCK_METHOD1(Disconnect, int(const ConnectionUID &)); MOCK_METHOD1(DisconnectForce, int(const ConnectionUID &)); MOCK_METHOD1(SendMessageToDevice, int(const ::protocol_handler::RawMessagePtr)); MOCK_METHOD1(ReceiveEventFromDevice, int(const TransportAdapterEvent&)); MOCK_METHOD1(AddTransportAdapter, int(TransportAdapter *)); MOCK_METHOD1(AddEventListener, int(TransportManagerListener *)); MOCK_METHOD0(Stop, int()); MOCK_METHOD1(RemoveDevice, int(const DeviceHandle &)); MOCK_CONST_METHOD1(Visibility, int(const bool &)); }; } // namespace transport_manager_test } // namespace components } // namespace test #endif // TEST_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_MOCK_H_
/*============================================================================* * * * This file is part of the Zoto Software suite. * * * * Copyright (C) 2004 Zoto, Inc. 123 South Hudson, OKC, OK 73102 * * * * Original algorithms taken from RFC 1321 * * Copyright (C) 1990-2, RSA Data Security, Inc. * * * *============================================================================*/ #include <Python.h> #include "ZTypes.h" #include "ZGlobals.h" extern void initialize_zsp_header(PyObject *m); extern void initialize_zsp_auth(PyObject *m); extern void initialize_zsp_auth_resp(PyObject *m); extern void initialize_zsp_version(PyObject *m); extern void initialize_zsp_version_resp(PyObject *m); extern void initialize_zsp_flag(PyObject *m); extern void initialize_zsp_flag_resp(PyObject *m); extern void initialize_zsp_file(PyObject *m); extern void initialize_zsp_file_resp(PyObject *m); extern void initialize_zsp_done(PyObject *m); extern void initialize_zsp_done_resp(PyObject *m); extern void initialize_zsp_error(PyObject *m); #ifndef PyMODINIT_FUNC #define PyMODINIT_FUNC void #endif static PyMethodDef module_methods[] = { {NULL} /* Sentinel */ }; PyMODINIT_FUNC initzsp_packets(void) { PyObject *m; m = Py_InitModule3("zsp_packets", module_methods, "Authorization packet."); if (m == NULL) return; PyModule_AddIntConstant(m, "ZSP_NONE", ZSP_NONE); PyModule_AddIntConstant(m, "ZSP_QUIT", ZSP_QUIT); PyModule_AddIntConstant(m, "ZSP_AUTH", ZSP_AUTH); PyModule_AddIntConstant(m, "ZSP_VERSION", ZSP_VERSION); PyModule_AddIntConstant(m, "ZSP_FLAG", ZSP_FLAG); PyModule_AddIntConstant(m, "ZSP_FILE", ZSP_FILE); PyModule_AddIntConstant(m, "ZSP_DONE", ZSP_DONE); PyModule_AddIntConstant(m, "ZSP_QUIT_RESP", ZSP_QUIT_RESP); PyModule_AddIntConstant(m, "ZSP_AUTH_RESP", ZSP_AUTH_RESP); PyModule_AddIntConstant(m, "ZSP_VERSION_RESP", ZSP_VERSION_RESP); PyModule_AddIntConstant(m, "ZSP_FLAG_RESP", ZSP_FLAG_RESP); PyModule_AddIntConstant(m, "ZSP_FILE_RESP", ZSP_FILE_RESP); PyModule_AddIntConstant(m, "ZSP_DONE_RESP", ZSP_DONE_RESP); PyModule_AddIntConstant(m, "ZSP_ERROR", ZSP_ERROR); PyModule_AddIntConstant(m, "ZSP_JPEG", ZSP_JPEG); PyModule_AddIntConstant(m, "ZSP_PNG", ZSP_PNG); PyModule_AddIntConstant(m, "ZSP_GIF", ZSP_GIF); PyModule_AddIntConstant(m, "ZSP_BMP", ZSP_BMP); PyModule_AddIntConstant(m, "ZSP_TIFF", ZSP_TIFF); PyModule_AddIntConstant(m, "ZSP_TARGA", ZSP_TARGA); // Return codes PyModule_AddIntConstant(m, "ZSP_AUTH_OK", ZSP_AUTH_OK); PyModule_AddIntConstant(m, "ZSP_AUTH_BAD", ZSP_AUTH_BAD); PyModule_AddIntConstant(m, "ZSP_VERS_GOOD", ZSP_VERS_GOOD); PyModule_AddIntConstant(m, "ZSP_VERS_OLD", ZSP_VERS_OLD); PyModule_AddIntConstant(m, "ZSP_VERS_BAD", ZSP_VERS_BAD); PyModule_AddIntConstant(m, "ZSP_FILE_OK", ZSP_FILE_OK); PyModule_AddIntConstant(m, "ZSP_FILE_NO_FLAG", ZSP_FILE_NO_FLAG); PyModule_AddIntConstant(m, "ZSP_FILE_BAD", ZSP_FILE_BAD); PyModule_AddIntConstant(m, "ZSP_DONE_OK", ZSP_DONE_OK); PyModule_AddIntConstant(m, "ZSP_DONE_BAD_SUM", ZSP_DONE_BAD_SUM); PyModule_AddIntConstant(m, "ZSP_DONE_BAD_SYNC", ZSP_DONE_BAD_SYNC); PyModule_AddIntConstant(m, "ZSP_DONE_BAD_SYNC2", ZSP_DONE_BAD_SYNC2); PyModule_AddIntConstant(m, "ZSP_DONE_CORRUPT", ZSP_DONE_CORRUPT); PyModule_AddIntConstant(m, "ZSP_DONE_BAD_WRITE", ZSP_DONE_BAD_WRITE); initialize_zsp_header(m); initialize_zsp_auth(m); initialize_zsp_auth_resp(m); initialize_zsp_version(m); initialize_zsp_version_resp(m); initialize_zsp_flag(m); initialize_zsp_flag_resp(m); initialize_zsp_file(m); initialize_zsp_file_resp(m); initialize_zsp_done(m); initialize_zsp_done_resp(m); initialize_zsp_error(m); }
/* MobileRobots Advanced Robotics Interface for Applications (ARIA) Copyright (C) 2004, 2005 ActivMedia Robotics LLC Copyright (C) 2006, 2007 MobileRobots Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA If you wish to redistribute ARIA under different terms, contact MobileRobots for information about a commercial version of ARIA at robots@mobilerobots.com or MobileRobots Inc, 19 Columbia Drive, Amherst, NH 03031; 800-639-9481 */ #ifndef ARACTIONGOTOSTRAIGHT_H #define ARACTIONGOTOSTRAIGHT_H #include "ariaTypedefs.h" #include "ariaUtil.h" #include "ArAction.h" /// This action goes to a given ArPose very naively /** This action naively drives straight towards a given ArPose. The action stops the robot when it has travelled the distance that that pose is away. It travels at 'speed' mm/sec. You can give it a new goal pose with setGoal(), cancel its movement with cancelGoal(), and see if it got there with haveAchievedGoal(). For arguments to the goals and encoder goals you can tell it to go backwards by calling them with the backwards parameter true. If you set the justDistance to true it will only really care about having driven the distance, if false it'll try to get to the spot you wanted within close distance. This doesn't avoid obstacles or anything, you could add have an obstacle avoidance ArAction at a higher priority to try to do this. (For truly intelligent navigation, see ActivMedia's ARNL software.) **/ class ArActionGotoStraight : public ArAction { public: AREXPORT ArActionGotoStraight(const char *name = "goto", double speed = 400); AREXPORT virtual ~ArActionGotoStraight(); /// Sees if the goal has been achieved AREXPORT bool haveAchievedGoal(void); /// Cancels the goal the robot has AREXPORT void cancelGoal(void); /// Sets a new goal and sets the action to go there AREXPORT void setGoal(ArPose goal, bool backwards = false, bool justDistance = true); /// Sets the goal in a relative way AREXPORT void setGoalRel(double dist, double deltaHeading, bool backwards = false, bool justDistance = true); /// Gets the goal the action has ArPose getGoal(void) { return myGoal; } /// Gets whether we're using the encoder goal or the normal goal bool usingEncoderGoal(void) { return myUseEncoderGoal; } /// Sets a new goal and sets the action to go there AREXPORT void setEncoderGoal(ArPose encoderGoal, bool backwards = false, bool justDistance = true); /// Sets the goal in a relative way AREXPORT void setEncoderGoalRel(double dist, double deltaHeading, bool backwards = false, bool justDistance = true); /// Gets the goal the action has ArPose getEncoderGoal(void) { return myEncoderGoal; } /// Sets the speed the action will travel to the goal at (mm/sec) void setSpeed(double speed) { mySpeed = speed; } /// Gets the speed the action will travel to the goal at (mm/sec) double getSpeed(void) { return mySpeed; } /// Sets how close we have to get if we're not in just distance mode void setCloseDist(double closeDist = 100) { myCloseDist = closeDist; } /// Gets how close we have to get if we're not in just distance mode double getCloseDist(void) { return myCloseDist; } /// Sets whether we're backing up there or not (set in the setGoals) bool getBacking(void) { return myBacking; } AREXPORT virtual ArActionDesired *fire(ArActionDesired currentDesired); /*AREXPORT*/ virtual ArActionDesired *getDesired(void) { return &myDesired; } #ifndef SWIG /*AREXPORT*/ virtual const ArActionDesired *getDesired(void) const { return &myDesired; } #endif protected: ArPose myGoal; bool myUseEncoderGoal; ArPose myEncoderGoal; double mySpeed; bool myBacking; ArActionDesired myDesired; bool myPrinting; double myDist; double myCloseDist; bool myJustDist; double myDistTravelled; ArPose myLastPose; enum State { STATE_NO_GOAL, STATE_ACHIEVED_GOAL, STATE_GOING_TO_GOAL }; State myState; }; #endif // ARACTIONGOTO
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_MEDIA_WEBRTC_SAME_ORIGIN_OBSERVER_H_ #define CHROME_BROWSER_MEDIA_WEBRTC_SAME_ORIGIN_OBSERVER_H_ #include "base/callback.h" #include "content/public/browser/web_contents_observer.h" #include "url/gurl.h" namespace content { class WebContents; } // This observer class will trigger the provided callback whenever the observed // WebContents's origin either now or no longer matches the provided origin. // This will not trigger the callback until the navigation has been committed, // so that WebContents::GetLastCommittedURL will return the new origin, and thus // allow for easier code re-use. Note that that Loading hasn't actually started // yet, so this is still suitable for listening to for i.e. terminating tab // capture when a site is no longer the same origin. class SameOriginObserver : public content::WebContentsObserver { public: SameOriginObserver(content::WebContents* observed_contents, const GURL& reference_origin, base::RepeatingCallback<void(content::WebContents*)> on_same_origin_state_changed); ~SameOriginObserver() override; // WebContentsObserver void DidFinishNavigation( content::NavigationHandle* navigation_handle) override; private: content::WebContents* const observed_contents_; const GURL reference_origin_; base::RepeatingCallback<void(content::WebContents*)> on_same_origin_state_changed_; bool is_same_origin_ = false; }; #endif // CHROME_BROWSER_MEDIA_WEBRTC_SAME_ORIGIN_OBSERVER_H_
#pragma once #include <deque> #include <functional> #include <pthread.h> #include "basetypes.h" #include "misc.h" #define Pthread_spin_init(l, pshared) verify(pthread_spin_init(l, (pshared)) == 0) #define Pthread_spin_lock(l) verify(pthread_spin_lock(l) == 0) #define Pthread_spin_unlock(l) verify(pthread_spin_unlock(l) == 0) #define Pthread_spin_destroy(l) verify(pthread_spin_destroy(l) == 0) #define Pthread_mutex_init(m, attr) verify(pthread_mutex_init(m, attr) == 0) #define Pthread_mutex_lock(m) verify(pthread_mutex_lock(m) == 0) #define Pthread_mutex_unlock(m) verify(pthread_mutex_unlock(m) == 0) #define Pthread_mutex_destroy(m) verify(pthread_mutex_destroy(m) == 0) #define Pthread_cond_init(c, attr) verify(pthread_cond_init(c, attr) == 0) #define Pthread_cond_destroy(c) verify(pthread_cond_destroy(c) == 0) #define Pthread_cond_signal(c) verify(pthread_cond_signal(c) == 0) #define Pthread_cond_broadcast(c) verify(pthread_cond_broadcast(c) == 0) #define Pthread_cond_wait(c, m) verify(pthread_cond_wait(c, m) == 0) #define Pthread_create(th, attr, func, arg) verify(pthread_create(th, attr, func, arg) == 0) #define Pthread_join(th, attr) verify(pthread_join(th, attr) == 0) namespace base { class Lockable: public NoCopy { public: virtual void lock() = 0; virtual void unlock() = 0; }; class SpinLock: public Lockable { public: SpinLock(): locked_(false) { } void lock(); void unlock() { __sync_lock_release(&locked_); } private: volatile bool locked_ __attribute__((aligned (64))); }; class Mutex: public Lockable { public: Mutex() { pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); Pthread_mutex_init(&m_, &attr); } ~Mutex() { Pthread_mutex_destroy(&m_); } void lock() { Pthread_mutex_lock(&m_); } void unlock() { Pthread_mutex_unlock(&m_); } private: friend class CondVar; pthread_mutex_t m_; }; // choice between spinlock & mutex: // * when n_thread > n_core, use mutex // * on virtual machines, use mutex class ScopedLock: public NoCopy { public: explicit ScopedLock(Lockable* lock): m_(lock) { m_->lock(); } explicit ScopedLock(Lockable& lock): m_(&lock) { m_->lock(); } ~ScopedLock() { m_->unlock(); } private: Lockable* m_; }; class CondVar: public NoCopy { public: CondVar() { Pthread_cond_init(&cv_, nullptr); } ~CondVar() { Pthread_cond_destroy(&cv_); } void wait(Mutex& m) { Pthread_cond_wait(&cv_, &m.m_); } void signal() { Pthread_cond_signal(&cv_); } void bcast() { Pthread_cond_broadcast(&cv_); } int timed_wait(Mutex& m, double sec); private: pthread_cond_t cv_; }; /** * Thread safe queue. */ template<class T> class Queue: public NoCopy { std::deque<T> q_; pthread_cond_t not_empty_; pthread_mutex_t m_; public: Queue() { Pthread_mutex_init(&m_, nullptr); Pthread_cond_init(&not_empty_, nullptr); } ~Queue() { Pthread_cond_destroy(&not_empty_); Pthread_mutex_destroy(&m_); } void push(const T& e) { Pthread_mutex_lock(&m_); q_.push_back(e); Pthread_cond_signal(&not_empty_); Pthread_mutex_unlock(&m_); } bool try_pop(T* t) { bool ret = false; Pthread_mutex_lock(&m_); if (!q_.empty()) { ret = true; *t = q_.front(); q_.pop_front(); } Pthread_mutex_unlock(&m_); return ret; } bool try_pop_but_ignore(T* t, const T& ignore) { bool ret = false; Pthread_mutex_lock(&m_); if (!q_.empty() && q_.front() != ignore) { ret = true; *t = q_.front(); q_.pop_front(); } Pthread_mutex_unlock(&m_); return ret; } T pop() { Pthread_mutex_lock(&m_); while (q_.empty()) { Pthread_cond_wait(&not_empty_, &m_); } T e = q_.front(); q_.pop_front(); Pthread_mutex_unlock(&m_); return e; } }; class ThreadPool: public RefCounted { int n_; Counter round_robin_; pthread_t* th_; Queue<std::function<void()>*>* q_; bool should_stop_; static void* start_thread_pool(void*); void run_thread(int id_in_pool); protected: ~ThreadPool(); public: ThreadPool(int n = get_ncpu() * 2); // return 0 when queuing ok, otherwise EPERM int run_async(const std::function<void()>&, int queuing_channel = -1); }; class RunLater: public RefCounted { typedef std::pair<double, std::function<void()>*> job_t; pthread_t th_; pthread_mutex_t m_; pthread_cond_t cv_; bool should_stop_; SpinLock latest_l_; double latest_; std::priority_queue<job_t, std::vector<job_t>, std::greater<job_t>> jobs_; static void* start_run_later(void*); void run_later_loop(); void try_one_job(); public: RunLater(); // return 0 when queuing ok, otherwise EPERM int run_later(double sec, const std::function<void()>&); double max_wait() const; protected: ~RunLater(); }; } // namespace base
//===-- Status.h - Renders a 96x32 Status Display ------------------ c++ --===// // // UWH Timer // // This file is distributed under the BSD 3-Clause License. // See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef STATUS_H #define STATUS_H class UWHDCanvas; void renderStatus(UWHDCanvas *C); #endif
//===-- HostThreadMacOSX.h --------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef lldb_Host_macosx_HostThreadMacOSX_h_ #define lldb_Host_macosx_HostThreadMacOSX_h_ #include "lldb/Host/posix/HostThreadPosix.h" namespace lldb_private { class HostThreadMacOSX : public HostThreadPosix { friend class ThreadLauncher; public: HostThreadMacOSX(); HostThreadMacOSX(lldb::thread_t thread); protected: static lldb::thread_result_t ThreadCreateTrampoline(lldb::thread_arg_t arg); }; } #endif
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_DANGER_TYPE_H_ #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_DANGER_TYPE_H_ #pragma once namespace content { // This enum is also used by histograms. Do not change the ordering or remove // items. enum DownloadDangerType { // The download is safe. DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS = 0, // A dangerous file to the system (e.g.: a pdf or extension from // places other than gallery). DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE, // Safebrowsing download service shows this URL leads to malicious file // download. DOWNLOAD_DANGER_TYPE_DANGEROUS_URL, // SafeBrowsing download service shows this file content as being malicious. DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT, // The content of this download may be malicious (e.g., extension is exe but // SafeBrowsing has not finished checking the content). DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, // Memory space for histograms is determined by the max. // ALWAYS ADD NEW VALUES BEFORE THIS ONE. DOWNLOAD_DANGER_TYPE_MAX }; } #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_DANGER_TYPE_H_
/* Copyright 2021 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ /* MT SCP RV32i configuration */ #include "cache.h" #include "csr.h" #include "hooks.h" #include "registers.h" #define SCP_SRAM_END (CONFIG_IPC_SHARED_OBJ_ADDR & (~(0x400 - 1))) struct mpu_entry mpu_entries[NR_MPU_ENTRIES] = { /* SRAM (for most code, data) */ {0, SCP_SRAM_END, MPU_ATTR_C | MPU_ATTR_W | MPU_ATTR_R}, /* SRAM (for IPI shared buffer) */ {SCP_SRAM_END, SCP_FW_END, MPU_ATTR_W | MPU_ATTR_R}, /* For AP domain */ #ifdef CHIP_VARIANT_MT8195 {0x60000000, 0x70000000, MPU_ATTR_W | MPU_ATTR_R | MPU_ATTR_P}, #else {0x60000000, 0x70000000, MPU_ATTR_W | MPU_ATTR_R}, #endif /* For SCP sys */ {0x70000000, 0x80000000, MPU_ATTR_W | MPU_ATTR_R}, #ifdef CHIP_VARIANT_MT8195 {0x10000000, 0x11400000, MPU_ATTR_C | MPU_ATTR_W | MPU_ATTR_R}, {CONFIG_PANIC_DRAM_BASE, CONFIG_PANIC_DRAM_BASE + CONFIG_PANIC_DRAM_SIZE, MPU_ATTR_W | MPU_ATTR_R}, #else {0x10000000, 0x11400000, MPU_ATTR_W | MPU_ATTR_R}, #endif }; #include "gpio_list.h" #ifdef CONFIG_PANIC_CONSOLE_OUTPUT static void report_previous_panic(void) { struct panic_data * panic = panic_get_data(); if (panic == NULL && SCP_CORE0_MON_PC_LATCH == 0) return; ccprintf("[Previous Panic]\n"); if (panic) { panic_data_ccprint(panic); } else { ccprintf("No panic data\n"); } ccprintf("Latch PC:%x LR:%x SP:%x\n", SCP_CORE0_MON_PC_LATCH, SCP_CORE0_MON_LR_LATCH, SCP_CORE0_MON_SP_LATCH); } DECLARE_HOOK(HOOK_INIT, report_previous_panic, HOOK_PRIO_DEFAULT); #endif
/* Copyright (C) 2012 Motorola Mobility 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. * 3. Neither the name of Motorola Mobility 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 CSSSupportsRule_h #define CSSSupportsRule_h #include "core/css/CSSGroupingRule.h" namespace blink { class CSSRule; class StyleRuleSupports; class CSSSupportsRule FINAL : public CSSGroupingRule { public: static PassRefPtrWillBeRawPtr<CSSSupportsRule> create(StyleRuleSupports* rule, CSSStyleSheet* sheet) { return adoptRefWillBeNoop(new CSSSupportsRule(rule, sheet)); } virtual ~CSSSupportsRule() { } virtual CSSRule::Type type() const OVERRIDE { return SUPPORTS_RULE; } virtual String cssText() const OVERRIDE; String conditionText() const; virtual void trace(Visitor* visitor) OVERRIDE { CSSGroupingRule::trace(visitor); } private: CSSSupportsRule(StyleRuleSupports*, CSSStyleSheet*); }; DEFINE_CSS_RULE_TYPE_CASTS(CSSSupportsRule, SUPPORTS_RULE); } // namespace blink #endif // CSSSupportsRule_h
/* this ALWAYS GENERATED file contains the IIDs and CLSIDs */ /* link this file in with the server and any clients */ /* File created by MIDL compiler version 7.00.0499 */ /* at Mon Dec 01 09:02:10 2008 */ /* Compiler settings for e:/builds/tinderbox/XR-Trunk/WINNT_5.2_Depend/mozilla/other-licenses/ia2/Accessible2.idl: Oicf, W1, Zp8, env=Win32 (32b run) protocol : dce , ms_ext, app_config, c_ext error checks: allocation ref bounds_check enum stub_data VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) DECLSPEC_UUID(), MIDL_INTERFACE() */ //@@MIDL_FILE_HEADING( ) #pragma warning( disable: 4049 ) /* more than 64k source lines */ #ifdef __cplusplus extern "C"{ #endif #include <rpc.h> #include <rpcndr.h> #ifdef _MIDL_USE_GUIDDEF_ #ifndef INITGUID #define INITGUID #include <guiddef.h> #undef INITGUID #else #include <guiddef.h> #endif #define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) #else // !_MIDL_USE_GUIDDEF_ #ifndef __IID_DEFINED__ #define __IID_DEFINED__ typedef struct _IID { unsigned long x; unsigned short s1; unsigned short s2; unsigned char c[8]; } IID; #endif // __IID_DEFINED__ #ifndef CLSID_DEFINED #define CLSID_DEFINED typedef IID CLSID; #endif // CLSID_DEFINED #define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} #endif !_MIDL_USE_GUIDDEF_ MIDL_DEFINE_GUID(IID, IID_IAccessible2,0xE89F726E,0xC4F4,0x4c19,0xBB,0x19,0xB6,0x47,0xD7,0xFA,0x84,0x78); #undef MIDL_DEFINE_GUID #ifdef __cplusplus } #endif
/* * @description Expression is always true via if (unsigned int >= 0) * * */ #include "std_testcase.h" #ifndef OMITBAD void CWE571_Expression_Always_True__unsigned_int_01_bad() { /* Ensure (0 <= intBad < UINT_MAX) and that uIntBad is pseudo-random */ unsigned int uIntBad = (unsigned int)(rand() * 2); /* FLAW: This expression is always true */ if (uIntBad >= 0) { printLine("Always prints"); } } #endif /* OMITBAD */ #ifndef OMITGOOD static void good1() { int intGood = rand(); /* FIX: Possibly evaluate to true */ if (intGood > (RAND_MAX / 2)) { printLine("Sometimes prints"); } } void CWE571_Expression_Always_True__unsigned_int_01_good() { good1(); } #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()..."); CWE571_Expression_Always_True__unsigned_int_01_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE571_Expression_Always_True__unsigned_int_01_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
// Copyright (c) 2011 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_OPTIONS_CHROMEOS_STATS_OPTIONS_HANDLER_H_ #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_STATS_OPTIONS_HANDLER_H_ #pragma once #include "base/compiler_specific.h" #include "chrome/browser/ui/webui/options/options_ui.h" namespace chromeos { // ChromeOS handler for "Stats/crash reporting to Google" option of the Advanced // settings page. This handler does only ChromeOS-specific actions while default // code is in Chrome's AdvancedOptionsHandler // (chrome/browser/webui/advanced_options_handler.cc). class StatsOptionsHandler : public OptionsPageUIHandler { public: StatsOptionsHandler(); // OptionsPageUIHandler implementation. virtual void GetLocalizedValues( base::DictionaryValue* localized_strings) OVERRIDE; virtual void Initialize() OVERRIDE; // WebUIMessageHandler implementation. virtual void RegisterMessages() OVERRIDE; private: void HandleMetricsReportingCheckbox(const base::ListValue* args); DISALLOW_COPY_AND_ASSIGN(StatsOptionsHandler); }; } // namespace chromeos #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_STATS_OPTIONS_HANDLER_H_
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_POPUP_CONTENTS_VIEW_H_ #define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_POPUP_CONTENTS_VIEW_H_ #include <stddef.h> #include "base/memory/weak_ptr.h" #include "components/omnibox/browser/omnibox_popup_selection.h" #include "components/omnibox/browser/omnibox_popup_view.h" #include "components/prefs/pref_change_registrar.h" #include "ui/base/metadata/metadata_header_macros.h" #include "ui/base/window_open_disposition.h" #include "ui/gfx/font_list.h" #include "ui/gfx/image/image.h" #include "ui/views/view.h" #include "ui/views/widget/widget_observer.h" struct AutocompleteMatch; class LocationBarView; class OmniboxEditModel; class OmniboxResultView; class OmniboxViewViews; class WebUIOmniboxPopupView; // A view representing the contents of the autocomplete popup. class OmniboxPopupContentsView : public views::View, public OmniboxPopupView, public views::WidgetObserver { public: METADATA_HEADER(OmniboxPopupContentsView); OmniboxPopupContentsView(OmniboxViewViews* omnibox_view, OmniboxEditModel* edit_model, LocationBarView* location_bar_view); OmniboxPopupContentsView(const OmniboxPopupContentsView&) = delete; OmniboxPopupContentsView& operator=(const OmniboxPopupContentsView&) = delete; ~OmniboxPopupContentsView() override; // Opens a match from the list specified by |index| with the type of tab or // window specified by |disposition|. void OpenMatch(WindowOpenDisposition disposition, base::TimeTicks match_selection_timestamp); void OpenMatch(size_t index, WindowOpenDisposition disposition, base::TimeTicks match_selection_timestamp); // Returns the icon that should be displayed next to |match|. If the icon is // available as a vector icon, it will be |vector_icon_color|. gfx::Image GetMatchIcon(const AutocompleteMatch& match, SkColor vector_icon_color) const; // Sets the line specified by |index| as selected and, if |index| is // different than the previous index, sets the line state to NORMAL. virtual void SetSelectedIndex(size_t index); // Returns the selected line. // Note: This and `SetSelectedIndex` above are used by property // metadata and must follow the metadata conventions. virtual size_t GetSelectedIndex() const; // Returns current popup selection (includes line index). virtual OmniboxPopupSelection GetSelection() const; // Called by the active result view to inform model (due to mouse event). void UnselectButton(); // Gets the OmniboxResultView for match |i|. OmniboxResultView* result_view_at(size_t i); // Currently selected OmniboxResultView, or nullptr if nothing is selected. OmniboxResultView* GetSelectedResultView(); // Returns whether we're in experimental keyword mode and the input gives // sufficient confidence that the user wants keyword mode. bool InExplicitExperimentalKeywordMode(); // OmniboxPopupView: bool IsOpen() const override; void InvalidateLine(size_t line) override; void OnSelectionChanged(OmniboxPopupSelection old_selection, OmniboxPopupSelection new_selection) override; void UpdatePopupAppearance() override; void ProvideButtonFocusHint(size_t line) override; void OnMatchIconUpdated(size_t match_index) override; void OnDragCanceled() override; // views::View: bool OnMouseDragged(const ui::MouseEvent& event) override; void OnGestureEvent(ui::GestureEvent* event) override; void GetAccessibleNodeData(ui::AXNodeData* node_data) override; // views::WidgetObserver: void OnWidgetBoundsChanged(views::Widget* widget, const gfx::Rect& new_bounds) override; void FireAXEventsForNewActiveDescendant(View* descendant_view); private: friend class OmniboxPopupContentsViewTest; friend class OmniboxSuggestionButtonRowBrowserTest; class AutocompletePopupWidget; // Returns the target popup bounds in screen coordinates based on the bounds // of |location_bar_view_|. gfx::Rect GetTargetBounds() const; // Returns true if the model has a match at the specified index. bool HasMatchAt(size_t index) const; // Returns the match at the specified index within the model. const AutocompleteMatch& GetMatchAtIndex(size_t index) const; // Find the index of the match under the given |point|, specified in window // coordinates. Returns OmniboxPopupSelection::kNoMatch if there isn't a match // at the specified point. size_t GetIndexForPoint(const gfx::Point& point); // Update which result views are visible when the group visibility changes. void OnSuggestionGroupVisibilityUpdate(); // Gets the pref service for this view. May return nullptr in tests. PrefService* GetPrefService() const; // The popup that contains this view. We create this, but it deletes itself // when its window is destroyed. This is a WeakPtr because it's possible for // the OS to destroy the window and thus delete this object before we're // deleted, or without our knowledge. base::WeakPtr<AutocompletePopupWidget> popup_; // The edit view that invokes us. OmniboxViewViews* omnibox_view_; // The location bar view that owns |omnibox_view_|. May be nullptr in tests. LocationBarView* location_bar_view_; // The child WebView for the suggestions. This only exists if the // omnibox::kWebUIOmniboxPopup flag is on. WebUIOmniboxPopupView* webui_view_ = nullptr; // A pref change registrar for toggling result view visibility. PrefChangeRegistrar pref_change_registrar_; OmniboxEditModel* edit_model_; }; #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_POPUP_CONTENTS_VIEW_H_
#include "Stencil1D.h" int cncMain(int argc, char *argv[]) { CNC_REQUIRE(argc == 4, "Usage: %s NUM_TILES TILE_SIZE NUM_TIMESTEPS\n", argv[0]); // Create a new graph context Stencil1DCtx *context = Stencil1D_create(); // initialize graph context parameters context->numTiles = atoi(argv[1]); context->tileSize = atoi(argv[2]); context->lastTimestep = atoi(argv[3]); // Launch the graph for execution Stencil1D_launch(NULL, context); // Exit when the graph execution completes CNC_SHUTDOWN_ON_FINISH(context); return 0; }
/* Copyright (C) 2009-2010 Electronic Arts, 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. 3. Neither the name of Electronic Arts, Inc. ("EA") 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 ELECTRONIC ARTS AND ITS 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 ELECTRONIC ARTS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /////////////////////////////////////////////////////////////////////////////// // FnEncode.h // // Copyright (c) 2007, Electronic Arts Inc. All rights reserved. // Created by Alex Liberman and Talin. // // Character transcoding functions for filenames /////////////////////////////////////////////////////////////////////////////// #ifndef EAIO_FNENCODE_H #define EAIO_FNENCODE_H #ifndef INCLUDED_eabase_H #include <EABase/eabase.h> #endif #include <EAIO/internal/Config.h> #ifndef EAIO_EASTREAM_H #include <EAIO/EAStream.h> // for kLengthNull #endif #ifndef EAIO_PATHSTRING_H #include <EAIO/PathString.h> // for ConvertPathUTF{8,16}ToUTF{8,16} #endif namespace EA { namespace IO { /// StrlcpyUTF16ToUTF8 /// Copies a UTF16 string to a UTF8 string, but otherwise acts similar to strlcpy except for the /// return value. /// Returns the strlen of the destination string. If destination pointer is NULL, returns the /// strlen of the would-be string. /// Specifying a source length of kLengthNull copies from the source string up to the first NULL /// character. EAIO_API size_t StrlcpyUTF16ToUTF8(char8_t* pDest, size_t nDestLength, const char16_t* pSrc, size_t nSrcLength = kLengthNull); /// StrlcpyUTF8ToUTF16 /// Copies a UTF8 string to a UTF16 string, but otherwise acts similar to strlcpy except for the /// return value. /// Returns the strlen of the destination string. If destination pointer is NULL, returns the /// strlen of the would-be string. /// Specifying a source length of kLengthNull copies from the source string up to the first NULL /// character. EAIO_API size_t StrlcpyUTF8ToUTF16(char16_t* pDest, size_t nDestLength, const char8_t* pSrc, size_t nSrcLength = kLengthNull); /////////////////////////////////////////////////////////////////////////////// /// Convenient conversion functions used by EAFileUtil and EAFileNotification /////////////////////////////////////////////////////////////////////////////// /// ConvertPathUTF8ToUTF16 /// Expands the destination to the desired size and then performs a Strlcpy /// with UTF8->UTF16 conversion. /// Returns the number of characters written. EAIO_API uint32_t ConvertPathUTF8ToUTF16(Path::PathString16& dstPath16, const char8_t* pSrcPath8); /// ConvertPathUTF16ToUTF8 /// Expands the destination to the desired size and then performs a Strlcpy with /// UTF16->UTF8 conversion. /// Returns the number of characters written. EAIO_API uint32_t ConvertPathUTF16ToUTF8(Path::PathString8& dstPath8, const char16_t* pSrcPath16); /////////////////////////////////////////////////////////////////////////////// // String comparison, strlen, and strlcpy for this module, since we don't have // access to EACRT. /////////////////////////////////////////////////////////////////////////////// EAIO_API bool StrEq16(const char16_t* str1, const char16_t* str2); EAIO_API size_t EAIOStrlen8(const char8_t* str); EAIO_API size_t EAIOStrlen16(const char16_t* str); EAIO_API size_t EAIOStrlcpy8(char8_t* pDestination, const char8_t* pSource, size_t nDestCapacity); EAIO_API size_t EAIOStrlcpy16(char16_t* pDestination, const char16_t* pSource, size_t nDestCapacity); } // namespace IO } // namespace EA #endif // EAIO_FNENCODE_H
// 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_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_GTK_H_ #define CHROME_BROWSER_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_GTK_H_ #include "chrome/browser/views/tabs/native_view_photobooth.h" class NativeViewPhotoboothGtk : public NativeViewPhotobooth { public: explicit NativeViewPhotoboothGtk(gfx::NativeView new_view); // Destroys the photo booth window. virtual ~NativeViewPhotoboothGtk(); // Replaces the view in the photo booth with the specified one. virtual void Replace(gfx::NativeView new_view); // Paints the current display image of the window into |canvas|, clipped to // |target_bounds|. virtual void PaintScreenshotIntoCanvas(gfx::Canvas* canvas, const gfx::Rect& target_bounds); private: DISALLOW_COPY_AND_ASSIGN(NativeViewPhotoboothGtk); }; #endif // #ifndef CHROME_BROWSER_VIEWS_TABS_NATIVE_VIEW_PHOTOBOOTH_GTK_H_
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE415_Double_Free__new_delete_wchar_t_83.h Label Definition File: CWE415_Double_Free__new_delete.label.xml Template File: sources-sinks-83.tmpl.h */ /* * @description * CWE: 415 Double Free * BadSource: Allocate data using new and Deallocae data using delete * GoodSource: Allocate data using new * Sinks: * GoodSink: do nothing * BadSink : Deallocate data using delete * Flow Variant: 83 Data flow: data passed to class constructor and destructor by declaring the class object on the stack * * */ #include "std_testcase.h" #include <wchar.h> namespace CWE415_Double_Free__new_delete_wchar_t_83 { #ifndef OMITBAD class CWE415_Double_Free__new_delete_wchar_t_83_bad { public: CWE415_Double_Free__new_delete_wchar_t_83_bad(wchar_t * dataCopy); ~CWE415_Double_Free__new_delete_wchar_t_83_bad(); private: wchar_t * data; }; #endif /* OMITBAD */ #ifndef OMITGOOD class CWE415_Double_Free__new_delete_wchar_t_83_goodG2B { public: CWE415_Double_Free__new_delete_wchar_t_83_goodG2B(wchar_t * dataCopy); ~CWE415_Double_Free__new_delete_wchar_t_83_goodG2B(); private: wchar_t * data; }; class CWE415_Double_Free__new_delete_wchar_t_83_goodB2G { public: CWE415_Double_Free__new_delete_wchar_t_83_goodB2G(wchar_t * dataCopy); ~CWE415_Double_Free__new_delete_wchar_t_83_goodB2G(); private: wchar_t * data; }; #endif /* OMITGOOD */ }
/* The <sys/stat.h> header defines a struct that is used in the stat() and * fstat functions. The information in this struct comes from the i-node of * some file. These calls are the only approved way to inspect i-nodes. */ #ifndef _STAT_H #define _STAT_H struct stat { dev_t st_dev; /* major/minor device number */ ino_t st_ino; /* i-node number */ mode_t st_mode; /* file mode, protection bits, etc. */ short int st_nlink; /* # links; TEMPORARY HACK: should be nlink_t*/ uid_t st_uid; /* uid of the file's owner */ short int st_gid; /* gid; TEMPORARY HACK: should be gid_t */ dev_t st_rdev; off_t st_size; /* file size */ time_t st_atime; /* time of last access */ time_t st_mtime; /* time of last data modification */ time_t st_ctime; /* time of last file status change */ }; /* Traditional mask definitions for st_mode. */ /* The ugly casts on only some of the definitions are to avoid suprising sign * extensions such as S_IFREG != (mode_t) S_IFREG when ints are 32 bits. */ #define S_IFMT ((mode_t) 0170000) /* type of file */ #define S_IFREG ((mode_t) 0100000) /* regular */ #define S_IFBLK 0060000 /* block special */ #define S_IFDIR 0040000 /* directory */ #define S_IFCHR 0020000 /* character special */ #define S_IFIFO 0010000 /* this is a FIFO */ #define S_ISUID 0004000 /* set user id on execution */ #define S_ISGID 0002000 /* set group id on execution */ /* next is reserved for future use */ #define S_ISVTX 01000 /* save swapped text even after use */ /* POSIX masks for st_mode. */ #define S_IRWXU 00700 /* owner: rwx------ */ #define S_IRUSR 00400 /* owner: r-------- */ #define S_IWUSR 00200 /* owner: -w------- */ #define S_IXUSR 00100 /* owner: --x------ */ #define S_IRWXG 00070 /* group: ---rwx--- */ #define S_IRGRP 00040 /* group: ---r----- */ #define S_IWGRP 00020 /* group: ----w---- */ #define S_IXGRP 00010 /* group: -----x--- */ #define S_IRWXO 00007 /* others: ------rwx */ #define S_IROTH 00004 /* others: ------r-- */ #define S_IWOTH 00002 /* others: -------w- */ #define S_IXOTH 00001 /* others: --------x */ /* The following macros test st_mode (from POSIX Sec. 5.6.1.1). */ #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) /* is a reg file */ #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) /* is a directory */ #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) /* is a char spec */ #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) /* is a block spec */ #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) /* is a pipe/FIFO */ /* Function Prototypes. */ #ifndef _ANSI_H #include <ansi.h> #endif _PROTOTYPE( int chmod, (const char *_path, Mode_t _mode) ); _PROTOTYPE( int fstat, (int _fildes, struct stat *_buf) ); _PROTOTYPE( int mkdir, (const char *_path, int _mode) ); _PROTOTYPE( int mkfifo, (const char *_path, int _mode) ); _PROTOTYPE( int stat , (const char *_path, struct stat *_buf) ); _PROTOTYPE( mode_t umask, (int _cmask) ); #endif /* _STAT_H */
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef MOJO_SERVICES_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ #define MOJO_SERVICES_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/threading/thread_local_storage.h" #include "base/timer/timer.h" #include "cc/blink/web_compositor_support_impl.h" #include "mojo/services/html_viewer/blink_resource_map.h" #include "mojo/services/html_viewer/webmimeregistry_impl.h" #include "mojo/services/html_viewer/webthemeengine_impl.h" #include "third_party/WebKit/public/platform/Platform.h" #include "third_party/WebKit/public/platform/WebScrollbarBehavior.h" namespace html_viewer { class BlinkPlatformImpl : public blink::Platform { public: explicit BlinkPlatformImpl(); virtual ~BlinkPlatformImpl(); // blink::Platform methods: virtual blink::WebMimeRegistry* mimeRegistry(); virtual blink::WebThemeEngine* themeEngine(); virtual blink::WebString defaultLocale(); virtual double currentTime(); virtual double monotonicallyIncreasingTime(); virtual void cryptographicallyRandomValues( unsigned char* buffer, size_t length); virtual void setSharedTimerFiredFunction(void (*func)()); virtual void setSharedTimerFireInterval(double interval_seconds); virtual void stopSharedTimer(); virtual void callOnMainThread(void (*func)(void*), void* context); virtual bool isThreadedCompositingEnabled(); virtual blink::WebCompositorSupport* compositorSupport(); virtual blink::WebURLLoader* createURLLoader(); virtual blink::WebSocketHandle* createWebSocketHandle(); virtual blink::WebString userAgent(); virtual blink::WebData parseDataURL( const blink::WebURL& url, blink::WebString& mime_type, blink::WebString& charset); virtual blink::WebURLError cancelledError(const blink::WebURL& url) const; virtual blink::WebThread* createThread(const char* name); virtual blink::WebThread* currentThread(); virtual void yieldCurrentThread(); virtual blink::WebWaitableEvent* createWaitableEvent(); virtual blink::WebWaitableEvent* waitMultipleEvents( const blink::WebVector<blink::WebWaitableEvent*>& events); virtual blink::WebScrollbarBehavior* scrollbarBehavior(); virtual const unsigned char* getTraceCategoryEnabledFlag( const char* category_name); virtual blink::WebData loadResource(const char* name); private: void SuspendSharedTimer(); void ResumeSharedTimer(); void DoTimeout() { if (shared_timer_func_ && !shared_timer_suspended_) shared_timer_func_(); } static void DestroyCurrentThread(void*); base::MessageLoop* main_loop_; base::OneShotTimer<BlinkPlatformImpl> shared_timer_; void (*shared_timer_func_)(); double shared_timer_fire_time_; bool shared_timer_fire_time_was_set_while_suspended_; int shared_timer_suspended_; // counter base::ThreadLocalStorage::Slot current_thread_slot_; cc_blink::WebCompositorSupportImpl compositor_support_; WebThemeEngineImpl theme_engine_; WebMimeRegistryImpl mime_registry_; blink::WebScrollbarBehavior scrollbar_behavior_; BlinkResourceMap blink_resource_map_; DISALLOW_COPY_AND_ASSIGN(BlinkPlatformImpl); }; } // namespace html_viewer #endif // MOJO_SERVICES_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_
// Copyright (c) 2011 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_COMMON_CHROME_CONTENT_CLIENT_H_ #define CHROME_COMMON_CHROME_CONTENT_CLIENT_H_ #pragma once #include "base/compiler_specific.h" #include "content/public/common/content_client.h" namespace chrome { class ChromeContentClient : public content::ContentClient { public: static const char* const kPDFPluginName; static const char* const kNaClPluginName; static const char* const kNaClOldPluginName; virtual void SetActiveURL(const GURL& url) OVERRIDE; virtual void SetGpuInfo(const content::GPUInfo& gpu_info) OVERRIDE; virtual void AddPepperPlugins( std::vector<content::PepperPluginInfo>* plugins) OVERRIDE; virtual void AddNPAPIPlugins( webkit::npapi::PluginList* plugin_list) OVERRIDE; virtual bool CanSendWhileSwappedOut(const IPC::Message* msg) OVERRIDE; virtual bool CanHandleWhileSwappedOut(const IPC::Message& msg) OVERRIDE; virtual std::string GetUserAgent(bool* overriding) const OVERRIDE; virtual string16 GetLocalizedString(int message_id) const OVERRIDE; virtual base::StringPiece GetDataResource(int resource_id) const OVERRIDE; #if defined(OS_WIN) virtual bool SandboxPlugin(CommandLine* command_line, sandbox::TargetPolicy* policy) OVERRIDE; #endif #if defined(OS_MACOSX) virtual bool GetSandboxProfileForSandboxType( int sandbox_type, int* sandbox_profile_resource_id) const OVERRIDE; #endif }; } // namespace chrome #endif // CHROME_COMMON_CHROME_CONTENT_CLIENT_H_
/* * Copyright (C) 2007, 2008, 2013 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. * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS 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 APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_WEBDATABASE_DATABASE_TRACKER_H_ #define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBDATABASE_DATABASE_TRACKER_H_ #include <memory> #include "base/callback.h" #include "base/macros.h" #include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/modules/webdatabase/database_error.h" #include "third_party/blink/renderer/platform/heap/persistent.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" #include "third_party/blink/renderer/platform/wtf/hash_set.h" #include "third_party/blink/renderer/platform/wtf/text/string_hash.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/threading_primitives.h" namespace blink { class Database; class DatabaseContext; class Page; class SecurityOrigin; class MODULES_EXPORT DatabaseTracker { USING_FAST_MALLOC(DatabaseTracker); public: static DatabaseTracker& Tracker(); DatabaseTracker(const DatabaseTracker&) = delete; DatabaseTracker& operator=(const DatabaseTracker&) = delete; // This singleton will potentially be used from multiple worker threads and // the page's context thread simultaneously. To keep this safe, it's // currently using 4 locks. In order to avoid deadlock when taking multiple // locks, you must take them in the correct order: // m_databaseGuard before quotaManager if both locks are needed. // m_openDatabaseMapGuard before quotaManager if both locks are needed. // m_databaseGuard and m_openDatabaseMapGuard currently don't overlap. // notificationMutex() is currently independent of the other locks. bool CanEstablishDatabase(DatabaseContext*, DatabaseError&); String FullPathForDatabase(const SecurityOrigin*, const String& name, bool create_if_does_not_exist = true); void AddOpenDatabase(Database*); void RemoveOpenDatabase(Database*); uint64_t GetMaxSizeForDatabase(const Database*); void CloseDatabasesImmediately(const SecurityOrigin*, const String& name); using DatabaseCallback = base::RepeatingCallback<void(Database*)>; void ForEachOpenDatabaseInPage(Page*, DatabaseCallback); void PrepareToOpenDatabase(Database*); void FailedToOpenDatabase(Database*); private: using DatabaseSet = HashSet<CrossThreadPersistent<Database>>; using DatabaseNameMap = HashMap<String, DatabaseSet*>; using DatabaseOriginMap = HashMap<String, DatabaseNameMap*>; DatabaseTracker(); void CloseOneDatabaseImmediately(const String& origin_identifier, const String& name, Database*); Mutex open_database_map_guard_; mutable std::unique_ptr<DatabaseOriginMap> open_database_map_; }; } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_MODULES_WEBDATABASE_DATABASE_TRACKER_H_
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE457_Use_of_Uninitialized_Variable__char_pointer_64b.c Label Definition File: CWE457_Use_of_Uninitialized_Variable.c.label.xml Template File: sources-sinks-64b.tmpl.c */ /* * @description * CWE: 457 Use of Uninitialized Variable * BadSource: no_init Don't initialize data * GoodSource: Initialize data * Sinks: use * GoodSink: Initialize then use data * BadSink : Use data * Flow Variant: 64 Data flow: void pointer to data passed from one function to another in different source files * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD void CWE457_Use_of_Uninitialized_Variable__char_pointer_64b_badSink(void * dataVoidPtr) { /* cast void pointer to a pointer of the appropriate type */ char * * dataPtr = (char * *)dataVoidPtr; /* dereference dataPtr into data */ char * data = (*dataPtr); /* POTENTIAL FLAW: Use data without initializing it */ printLine(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE457_Use_of_Uninitialized_Variable__char_pointer_64b_goodG2BSink(void * dataVoidPtr) { /* cast void pointer to a pointer of the appropriate type */ char * * dataPtr = (char * *)dataVoidPtr; /* dereference dataPtr into data */ char * data = (*dataPtr); /* POTENTIAL FLAW: Use data without initializing it */ printLine(data); } /* goodB2G uses the BadSource with the GoodSink */ void CWE457_Use_of_Uninitialized_Variable__char_pointer_64b_goodB2GSink(void * dataVoidPtr) { /* cast void pointer to a pointer of the appropriate type */ char * * dataPtr = (char * *)dataVoidPtr; /* dereference dataPtr into data */ char * data = (*dataPtr); /* FIX: Ensure data is initialized before use */ data = "string"; printLine(data); } #endif /* OMITGOOD */
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE805_struct_memcpy_22a.c Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE805.label.xml Template File: sources-sink-22a.tmpl.c */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: Allocate using malloc() and set data pointer to a small buffer * GoodSource: Allocate using malloc() and set data pointer to a large buffer * Sink: memcpy * BadSink : Copy twoIntsStruct array to data using memcpy * Flow Variant: 22 Control flow: Flow controlled by value of a global variable. Sink functions are in a separate file from sources. * * */ #include "std_testcase.h" #ifndef OMITBAD /* The global variable below is used to drive control flow in the source function */ int CWE122_Heap_Based_Buffer_Overflow__c_CWE805_struct_memcpy_22_badGlobal = 0; twoIntsStruct * CWE122_Heap_Based_Buffer_Overflow__c_CWE805_struct_memcpy_22_badSource(twoIntsStruct * data); void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_struct_memcpy_22_bad() { twoIntsStruct * data; data = NULL; CWE122_Heap_Based_Buffer_Overflow__c_CWE805_struct_memcpy_22_badGlobal = 1; /* true */ data = CWE122_Heap_Based_Buffer_Overflow__c_CWE805_struct_memcpy_22_badSource(data); { twoIntsStruct source[100]; { size_t i; /* Initialize array */ for (i = 0; i < 100; i++) { source[i].intOne = 0; source[i].intTwo = 0; } } /* POTENTIAL FLAW: Possible buffer overflow if data < 100 */ memcpy(data, source, 100*sizeof(twoIntsStruct)); printStructLine(&data[0]); free(data); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* The global variables below are used to drive control flow in the source functions. */ int CWE122_Heap_Based_Buffer_Overflow__c_CWE805_struct_memcpy_22_goodG2B1Global = 0; int CWE122_Heap_Based_Buffer_Overflow__c_CWE805_struct_memcpy_22_goodG2B2Global = 0; /* goodG2B1() - use goodsource and badsink by setting the static variable to false instead of true */ twoIntsStruct * CWE122_Heap_Based_Buffer_Overflow__c_CWE805_struct_memcpy_22_goodG2B1Source(twoIntsStruct * data); static void goodG2B1() { twoIntsStruct * data; data = NULL; CWE122_Heap_Based_Buffer_Overflow__c_CWE805_struct_memcpy_22_goodG2B1Global = 0; /* false */ data = CWE122_Heap_Based_Buffer_Overflow__c_CWE805_struct_memcpy_22_goodG2B1Source(data); { twoIntsStruct source[100]; { size_t i; /* Initialize array */ for (i = 0; i < 100; i++) { source[i].intOne = 0; source[i].intTwo = 0; } } /* POTENTIAL FLAW: Possible buffer overflow if data < 100 */ memcpy(data, source, 100*sizeof(twoIntsStruct)); printStructLine(&data[0]); free(data); } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the if in the source function */ twoIntsStruct * CWE122_Heap_Based_Buffer_Overflow__c_CWE805_struct_memcpy_22_goodG2B2Source(twoIntsStruct * data); static void goodG2B2() { twoIntsStruct * data; data = NULL; CWE122_Heap_Based_Buffer_Overflow__c_CWE805_struct_memcpy_22_goodG2B2Global = 1; /* true */ data = CWE122_Heap_Based_Buffer_Overflow__c_CWE805_struct_memcpy_22_goodG2B2Source(data); { twoIntsStruct source[100]; { size_t i; /* Initialize array */ for (i = 0; i < 100; i++) { source[i].intOne = 0; source[i].intTwo = 0; } } /* POTENTIAL FLAW: Possible buffer overflow if data < 100 */ memcpy(data, source, 100*sizeof(twoIntsStruct)); printStructLine(&data[0]); free(data); } } void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_struct_memcpy_22_good() { goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE122_Heap_Based_Buffer_Overflow__c_CWE805_struct_memcpy_22_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE122_Heap_Based_Buffer_Overflow__c_CWE805_struct_memcpy_22_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_METRICS_CHROMEOS_METRICS_PROVIDER_H_ #define CHROME_BROWSER_METRICS_CHROMEOS_METRICS_PROVIDER_H_ #include "base/memory/weak_ptr.h" #include "chrome/browser/metrics/perf_provider_chromeos.h" #include "components/metrics/metrics_provider.h" namespace device { class BluetoothAdapter; } namespace metrics { class ChromeUserMetricsExtension; } class PrefRegistrySimple; class PrefService; // Performs ChromeOS specific metrics logging. class ChromeOSMetricsProvider : public metrics::MetricsProvider { public: ChromeOSMetricsProvider(); ~ChromeOSMetricsProvider() override; static void RegisterPrefs(PrefRegistrySimple* registry); // Records a crash. static void LogCrash(const std::string& crash_type); // Loads hardware class information. When this task is complete, |callback| // is run. void InitTaskGetHardwareClass(const base::Closure& callback); // metrics::MetricsProvider: void OnDidCreateMetricsLog() override; void ProvideSystemProfileMetrics( metrics::SystemProfileProto* system_profile_proto) override; void ProvideStabilityMetrics( metrics::SystemProfileProto* system_profile_proto) override; void ProvideGeneralMetrics( metrics::ChromeUserMetricsExtension* uma_proto) override; private: // Called on the FILE thread to load hardware class information. void InitTaskGetHardwareClassOnFileThread(); // Update the number of users logged into a multi-profile session. // If the number of users change while the log is open, the call invalidates // the user count value. void UpdateMultiProfileUserCount( metrics::SystemProfileProto* system_profile_proto); // Sets the Bluetooth Adapter instance used for the WriteBluetoothProto() // call. void SetBluetoothAdapter(scoped_refptr<device::BluetoothAdapter> adapter); // Writes info about paired Bluetooth devices on this system. void WriteBluetoothProto(metrics::SystemProfileProto* system_profile_proto); metrics::PerfProvider perf_provider_; // Bluetooth Adapter instance for collecting information about paired devices. scoped_refptr<device::BluetoothAdapter> adapter_; // Whether the user count was registered at the last log initialization. bool registered_user_count_at_log_initialization_; // The user count at the time that a log was last initialized. Contains a // valid value only if |registered_user_count_at_log_initialization_| is // true. uint64 user_count_at_log_initialization_; // Hardware class (e.g., hardware qualification ID). This class identifies // the configured system components such as CPU, WiFi adapter, etc. std::string hardware_class_; base::WeakPtrFactory<ChromeOSMetricsProvider> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(ChromeOSMetricsProvider); }; #endif // CHROME_BROWSER_METRICS_CHROMEOS_METRICS_PROVIDER_H_
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef MEDIA_GPU_VAAPI_VAAPI_JPEG_DECODER_H_ #define MEDIA_GPU_VAAPI_VAAPI_JPEG_DECODER_H_ #include <stdint.h> #include <memory> #include "base/macros.h" #include "media/gpu/vaapi/vaapi_image_decoder.h" namespace media { namespace fuzzing { class VaapiJpegDecoderWrapper; } // namespace fuzzing struct JpegFrameHeader; struct JpegParseResult; class ScopedVAImage; // Returns the internal format required for a JPEG image given its parsed // |frame_header|. If the image's subsampling format is not one of 4:2:0, 4:2:2, // or 4:4:4, returns kInvalidVaRtFormat. unsigned int VaSurfaceFormatForJpeg(const JpegFrameHeader& frame_header); class VaapiJpegDecoder : public VaapiImageDecoder { public: VaapiJpegDecoder(); VaapiJpegDecoder(const VaapiJpegDecoder&) = delete; VaapiJpegDecoder& operator=(const VaapiJpegDecoder&) = delete; ~VaapiJpegDecoder() override; // VaapiImageDecoder implementation. gpu::ImageDecodeAcceleratorType GetType() const override; SkYUVColorSpace GetYUVColorSpace() const override; // Get the decoded data from the last Decode() call as a ScopedVAImage. The // VAImage's format will be either |preferred_image_fourcc| if the conversion // from the internal format is supported or a fallback FOURCC (see // VaapiWrapper::GetJpegDecodeSuitableImageFourCC() for details). Returns // nullptr on failure and sets *|status| to the reason for failure. std::unique_ptr<ScopedVAImage> GetImage(uint32_t preferred_image_fourcc, VaapiImageDecodeStatus* status); private: friend class fuzzing::VaapiJpegDecoderWrapper; // VaapiImageDecoder implementation. VaapiImageDecodeStatus AllocateVASurfaceAndSubmitVABuffers( base::span<const uint8_t> encoded_image) override; // AllocateVASurfaceAndSubmitVABuffers() is implemented by calling the // following methods. They are here so that a fuzzer can inject (almost) // arbitrary data into libva by skipping the parsing and image support checks // in AllocateVASurfaceAndSubmitVABuffers(). bool MaybeCreateSurface(unsigned int picture_va_rt_format, const gfx::Size& new_coded_size, const gfx::Size& new_visible_size); bool SubmitBuffers(const JpegParseResult& parse_result); }; } // namespace media #endif // MEDIA_GPU_VAAPI_VAAPI_JPEG_DECODER_H_
// Copyright 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef NET_THIRD_PARTY_QUIC_TEST_TOOLS_QUIC_STREAM_SEQUENCER_BUFFER_PEER_H_ #define NET_THIRD_PARTY_QUIC_TEST_TOOLS_QUIC_STREAM_SEQUENCER_BUFFER_PEER_H_ #include "net/third_party/quic/core/quic_stream_sequencer_buffer.h" namespace quic { namespace test { class QuicStreamSequencerBufferPeer { public: explicit QuicStreamSequencerBufferPeer(QuicStreamSequencerBuffer* buffer); QuicStreamSequencerBufferPeer(const QuicStreamSequencerBufferPeer&) = delete; QuicStreamSequencerBufferPeer& operator=( const QuicStreamSequencerBufferPeer&) = delete; // Read from this buffer_ into the given destination buffer_ up to the // size of the destination. Returns the number of bytes read. Reading from // an empty buffer_->returns 0. size_t Read(char* dest_buffer, size_t size); // If buffer is empty, the blocks_ array must be empty, which means all // blocks are deallocated. bool CheckEmptyInvariants(); bool IsBlockArrayEmpty(); bool CheckInitialState(); bool CheckBufferInvariants(); size_t GetInBlockOffset(QuicStreamOffset offset); QuicStreamSequencerBuffer::BufferBlock* GetBlock(size_t index); int IntervalSize(); size_t max_buffer_capacity(); size_t ReadableBytes(); void set_total_bytes_read(QuicStreamOffset total_bytes_read); void AddBytesReceived(QuicStreamOffset offset, QuicByteCount length); bool IsBufferAllocated(); size_t block_count(); const QuicIntervalSet<QuicStreamOffset>& bytes_received(); private: QuicStreamSequencerBuffer* buffer_; }; } // namespace test } // namespace quic #endif // NET_THIRD_PARTY_QUIC_TEST_TOOLS_QUIC_STREAM_SEQUENCER_BUFFER_PEER_H_
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_ERROR_PAGE_COMMON_LOCALIZED_ERROR_H_ #define COMPONENTS_ERROR_PAGE_COMMON_LOCALIZED_ERROR_H_ #include <memory> #include <string> #include "base/values.h" #include "url/gurl.h" namespace base { class DictionaryValue; } namespace error_page { class LocalizedError { public: // Information about elements shown on the error page. struct PageState { PageState(); ~PageState(); PageState(const PageState& other) = delete; PageState(PageState&& other); PageState& operator=(PageState&& other); // Strings used within the error page HTML/JS. base::DictionaryValue strings; bool is_offline_error = false; bool reload_button_shown = false; bool download_button_shown = false; bool offline_content_feature_enabled = false; bool auto_fetch_allowed = false; }; LocalizedError() = delete; LocalizedError(const LocalizedError&) = delete; LocalizedError& operator=(const LocalizedError&) = delete; // Returns a |PageState| that describes the elements that should be shown on // on HTTP errors, like 404 or connection reset. static PageState GetPageState( int error_code, const std::string& error_domain, const GURL& failed_url, bool is_post, bool is_secure_dns_network_error, bool stale_copy_in_cache, bool can_show_network_diagnostics_dialog, bool is_incognito, bool offline_content_feature_enabled, bool auto_fetch_feature_enabled, bool is_kiosk_mode, // whether device is currently in single app (kiosk) // mode const std::string& locale, bool is_blocked_by_extension); // Returns a description of the encountered error. static std::u16string GetErrorDetails(const std::string& error_domain, int error_code, bool is_secure_dns_network_error, bool is_post); // Returns true if an error page exists for the specified parameters. static bool HasStrings(const std::string& error_domain, int error_code); }; } // namespace error_page #endif // COMPONENTS_ERROR_PAGE_COMMON_LOCALIZED_ERROR_H_
/* * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) * Copyright (C) 2009 Google Inc. All rights reserved. * Copyright (C) 2011 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. * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS 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 APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef HTTPParsers_h #define HTTPParsers_h #include "platform/PlatformExport.h" #include "wtf/Allocator.h" #include "wtf/Forward.h" #include "wtf/HashSet.h" #include "wtf/Vector.h" #include "wtf/text/StringHash.h" namespace blink { typedef enum { ContentDispositionNone, ContentDispositionInline, ContentDispositionAttachment, ContentDispositionOther } ContentDispositionType; enum ContentTypeOptionsDisposition { ContentTypeOptionsNone, ContentTypeOptionsNosniff }; enum XFrameOptionsDisposition { XFrameOptionsInvalid, XFrameOptionsDeny, XFrameOptionsSameOrigin, XFrameOptionsAllowAll, XFrameOptionsConflict }; // Be sure to update the behavior of XSSAuditor::combineXSSProtectionHeaderAndCSP whenever you change this enum's content or ordering. enum ReflectedXSSDisposition { ReflectedXSSUnset = 0, AllowReflectedXSS, ReflectedXSSInvalid, FilterReflectedXSS, BlockReflectedXSS }; using CommaDelimitedHeaderSet = HashSet<String, CaseFoldingHash>; struct CacheControlHeader { DISALLOW_NEW(); bool parsed : 1; bool containsNoCache : 1; bool containsNoStore : 1; bool containsMustRevalidate : 1; double maxAge; double staleWhileRevalidate; CacheControlHeader() : parsed(false) , containsNoCache(false) , containsNoStore(false) , containsMustRevalidate(false) , maxAge(0.0) , staleWhileRevalidate(0.0) { } }; PLATFORM_EXPORT ContentDispositionType contentDispositionType(const String&); PLATFORM_EXPORT bool isValidHTTPHeaderValue(const String&); PLATFORM_EXPORT bool isValidHTTPFieldContentRFC7230(const String&); PLATFORM_EXPORT bool isValidHTTPToken(const String&); PLATFORM_EXPORT bool parseHTTPRefresh(const String& refresh, bool fromHttpEquivMeta, double& delay, String& url); PLATFORM_EXPORT double parseDate(const String&); // Given a Media Type (like "foo/bar; baz=gazonk" - usually from the // 'Content-Type' HTTP header), extract and return the "type/subtype" portion // ("foo/bar"). // Note: This function does not in any way check that the "type/subtype" pair // is well-formed. PLATFORM_EXPORT AtomicString extractMIMETypeFromMediaType(const AtomicString&); PLATFORM_EXPORT String extractCharsetFromMediaType(const String&); PLATFORM_EXPORT void findCharsetInMediaType(const String& mediaType, unsigned& charsetPos, unsigned& charsetLen, unsigned start = 0); PLATFORM_EXPORT ReflectedXSSDisposition parseXSSProtectionHeader(const String& header, String& failureReason, unsigned& failurePosition, String& reportURL); PLATFORM_EXPORT XFrameOptionsDisposition parseXFrameOptionsHeader(const String&); PLATFORM_EXPORT CacheControlHeader parseCacheControlDirectives(const AtomicString& cacheControlHeader, const AtomicString& pragmaHeader); PLATFORM_EXPORT void parseCommaDelimitedHeader(const String& headerValue, CommaDelimitedHeaderSet&); PLATFORM_EXPORT ContentTypeOptionsDisposition parseContentTypeOptionsHeader(const String& header); } // namespace blink #endif
/* $NetBSD: ecoff_machdep.h,v 1.1 2002/03/13 05:03:18 simonb Exp $ */ #include <mips/ecoff_machdep.h>
#ifndef fl_gl_cyclic_color_wheel_h #define fl_gl_cyclic_color_wheel_h #include <FL/gl.h> /* GLfloat GLubyte GLuint GLenum */ #include <FL/Fl.H> #include <FL/Fl_Gl_Window.H> #include <FL/Fl_Value_Input.H> #include <FL/Fl_Check_Button.H> class fl_gl_cyclic_color_wheel : public Fl_Gl_Window { public: fl_gl_cyclic_color_wheel(int x,int y ,int w,int h ,const char*l=0); void init_widget_set( const int number ,Fl_Value_Input* valinp_hue_min ,Fl_Value_Input* valinp_hue_max ,Fl_Check_Button* chebut_enable_sw ,Fl_Check_Button* chebut_rotate360_sw ); void init_number_and_is_max( const int number ,const bool is_max); void set_min_or_max(const bool is_max ); void set_reset(void); private: /* マウスドラッグ開始位置 */ int mouse_x_when_push_ ,mouse_y_when_push_; /* Hue Color Wheel表示開始位置 */ double x_offset_; double hue_offset_; /* 各Hue min,maxの範囲を参考表示 */ class guide_widget_set_ { public: Fl_Value_Input* valinp_hue_min; Fl_Value_Input* valinp_hue_max; Fl_Check_Button* chebut_enable_sw; Fl_Check_Button* chebut_rotate360_sw; }; std::vector< guide_widget_set_ > guide_widget_sets_; int hue_range_number_; bool hue_range_is_max_; //---------- void draw(); void draw_object_(); int handle(int event); void handle_push_( const int mx ,const int my ); void handle_updownleftright_( const int mx ,const int my ); void handle_keyboard_( const int key , const char* text ); double xpos_from_hue_(const double hue); double hue_from_xpos_(const double xpos); double limit_new_hue_( double hue_o_new ,bool& rotate360_sw ); void set_min_or_max_to_gui_( const bool rot360_sw ); }; #endif /* !fl_gl_cyclic_color_wheel_h */
// // NSDictionary+Enumerable.h // MRCEnumerable // // Created by Marcus Crafter on 17/11/10. // Copyright 2010 Red Artisan. All rights reserved. // #import <Foundation/Foundation.h> @interface NSDictionary (Enumerable) - (void)each:(void (^)(id key, id obj))block; - (id)inject:(id)m :(id (^)(id m, id key, id obj))block; - (NSDictionary *)select:(BOOL (^)(id key, id obj))block; - (NSDictionary *)reject:(BOOL (^)(id key, id obj))block; - (id)detect:(BOOL (^)(id key, id obj))block; @end
#define MICROPY_HW_BOARD_NAME "CustomPCB" #define MICROPY_HW_MCU_NAME "STM32F439" #define MICROPY_HW_HAS_FLASH (1) #define MICROPY_HW_ENABLE_RNG (1) #define MICROPY_HW_ENABLE_RTC (1) #define MICROPY_HW_ENABLE_DAC (1) #define MICROPY_HW_ENABLE_USB (1) #define MICROPY_HW_ENABLE_SDCARD (1) // works with no SD card too // SD card detect switch #if MICROPY_HW_ENABLE_SDCARD #define MICROPY_HW_SDCARD_DETECT_PIN (pin_A8) #define MICROPY_HW_SDCARD_DETECT_PULL (GPIO_PULLUP) #define MICROPY_HW_SDCARD_DETECT_PRESENT (1) #endif // HSE is 8MHz #define MICROPY_HW_CLK_PLLM (8) //divide external clock by this to get 1MHz #define MICROPY_HW_CLK_PLLN (384) //this number is the PLL clock in MHz #define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV2) //divide PLL clock by this to get core clock #define MICROPY_HW_CLK_PLLQ (8) //divide core clock by this to get 48MHz // USB config #define MICROPY_HW_USB_FS (1) // UART config #define MICROPY_HW_UART1_TX (pin_A9) #define MICROPY_HW_UART1_RX (pin_A10) #define MICROPY_HW_UART2_TX (pin_D5) #define MICROPY_HW_UART2_RX (pin_D6) #define MICROPY_HW_UART2_RTS (pin_D1) #define MICROPY_HW_UART2_CTS (pin_D0) #define MICROPY_HW_UART3_TX (pin_D8) #define MICROPY_HW_UART3_RX (pin_D9) #define MICROPY_HW_UART3_RTS (pin_D12) #define MICROPY_HW_UART3_CTS (pin_D11) #define MICROPY_HW_UART4_TX (pin_A0) #define MICROPY_HW_UART4_RX (pin_A1) #define MICROPY_HW_UART6_TX (pin_C6) #define MICROPY_HW_UART6_RX (pin_C7) // I2C buses #define MICROPY_HW_I2C1_SCL (pin_A8) #define MICROPY_HW_I2C1_SDA (pin_C9) // SPI buses #define MICROPY_HW_SPI1_NSS (pin_A4) #define MICROPY_HW_SPI1_SCK (pin_A5) #define MICROPY_HW_SPI1_MISO (pin_A6) #define MICROPY_HW_SPI1_MOSI (pin_A7) #if MICROPY_HW_USB_HS_IN_FS // The HS USB uses B14 & B15 for D- and D+ #else #define MICROPY_HW_SPI2_NSS (pin_B12) #define MICROPY_HW_SPI2_SCK (pin_B13) #define MICROPY_HW_SPI2_MISO (pin_B14) #define MICROPY_HW_SPI2_MOSI (pin_B15) #endif #define MICROPY_HW_SPI3_NSS (pin_E11) #define MICROPY_HW_SPI3_SCK (pin_E12) #define MICROPY_HW_SPI3_MISO (pin_E13) #define MICROPY_HW_SPI3_MOSI (pin_E14) //#define MICROPY_HW_SPI4_NSS (pin_E11) //#define MICROPY_HW_SPI4_SCK (pin_E12) //#define MICROPY_HW_SPI4_MISO (pin_E13) //#define MICROPY_HW_SPI4_MOSI (pin_E14) //#define MICROPY_HW_SPI5_NSS (pin_F6) //#define MICROPY_HW_SPI5_SCK (pin_F7) //#define MICROPY_HW_SPI5_MISO (pin_F8) //#define MICROPY_HW_SPI5_MOSI (pin_F9) //#define MICROPY_HW_SPI6_NSS (pin_G8) //#define MICROPY_HW_SPI6_SCK (pin_G13) //#define MICROPY_HW_SPI6_MISO (pin_G12) //#define MICROPY_HW_SPI6_MOSI (pin_G14) // CAN buses #define MICROPY_HW_CAN1_TX (pin_B9) #define MICROPY_HW_CAN1_RX (pin_B8) #define MICROPY_HW_CAN2_TX (pin_B13) #define MICROPY_HW_CAN2_RX (pin_B12) // USRSW is pulled low. Pressing the button makes the input go high. #define MICROPY_HW_USRSW_PIN (pin_A0) #define MICROPY_HW_USRSW_PULL (GPIO_NOPULL) #define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_RISING) #define MICROPY_HW_USRSW_PRESSED (1)
#ifndef LEON_RTEMS_CONFIG_H_ #define LEON_RTEMS_CONFIG_H_ #ifndef _RTEMS_CONFIG_H_ #define _RTEMS_CONFIG_H_ #include <OsDrvCpr.h> #if defined(__RTEMS__) #if !defined (__CONFIG__) #define __CONFIG__ /* ask the system to generate a configuration table */ #define CONFIGURE_INIT #ifndef RTEMS_POSIX_API #define RTEMS_POSIX_API #endif #define CONFIGURE_MICROSECONDS_PER_TICK 1000 /* 1 millisecond */ #define CONFIGURE_TICKS_PER_TIMESLICE 50 /* 50 milliseconds */ #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_POSIX_INIT_THREAD_TABLE #define CONFIGURE_MINIMUM_TASK_STACK_SIZE (8192) #define CONFIGURE_MAXIMUM_TASKS 20 #define CONFIGURE_MAXIMUM_POSIX_THREADS 5 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 8 #define CONFIGURE_MAXIMUM_POSIX_KEYS 8 #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 8 #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 8 #define CONFIGURE_MAXIMUM_POSIX_TIMERS 4 #define CONFIGURE_MAXIMUM_TIMERS 4 void POSIX_Init( void *args ); static void Fatal_extension( Internal_errors_Source the_source, bool is_internal, uint32_t the_error ); #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1 #define CONFIGURE_INITIAL_EXTENSIONS { .fatal = Fatal_extension } #include <SDCardIORTEMSConfig.h> #include <rtems/confdefs.h> #endif // __CONFIG__ #endif // __RTEMS__ // Set the system clocks BSP_SET_CLOCK( DEFAULT_REFCLOCK, 200000, 1, 1, DEFAULT_RTEMS_CSS_LOS_CLOCKS, DEFAULT_RTEMS_MSS_LRT_CLOCKS, 0, 0, 0 ); // Set L2 cache behaviour BSP_SET_L2C_CONFIG( 1, DEFAULT_RTEMS_L2C_REPLACEMENT_POLICY, DEFAULT_RTEMS_L2C_WAYS, DEFAULT_RTEMS_L2C_MODE, 0, 0 ); #endif // _RTEMS_CONFIG_H_ #endif // LEON_RTEMS_CONFIG_H_
// This file was generated based on 'C:\ProgramData\Uno\Packages\UnoCore\0.19.6\Source\Uno\UX\Attributes\$.uno'. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Uno.Attribute.h> namespace g{namespace Uno{namespace UX{struct UXSourceFileNameAttribute;}}} namespace g{ namespace Uno{ namespace UX{ // public sealed class UXSourceFileNameAttribute :234 // { uType* UXSourceFileNameAttribute_typeof(); void UXSourceFileNameAttribute__ctor_1_fn(UXSourceFileNameAttribute* __this); void UXSourceFileNameAttribute__New1_fn(UXSourceFileNameAttribute** __retval); struct UXSourceFileNameAttribute : ::g::Uno::Attribute { void ctor_1(); static UXSourceFileNameAttribute* New1(); }; // } }}} // ::g::Uno::UX
// This file was generated based on 'C:\ProgramData\Uno\Packages\Fuse.Controls\0.18.8\$.uno'. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Fuse.Animations.IResize.h> #include <Fuse.Controls.TextBlock.h> #include <Fuse.IActualPlacement.h> #include <Fuse.Navigation.INavigationPanel.h> #include <Fuse.Node.h> #include <Fuse.Scripting.INameScope.h> #include <Fuse.Triggers.Actions.ICollapse.h> #include <Fuse.Triggers.Actions.IHide.h> #include <Fuse.Triggers.Actions.IShow.h> #include <Fuse.Triggers.IAddRemove-1.h> #include <Fuse.Triggers.IValue-1.h> #include <Uno.String.h> namespace g{namespace Fuse{namespace Controls{struct Text;}}} namespace g{ namespace Fuse{ namespace Controls{ // public sealed class Text :4254 // { ::g::Fuse::Controls::TextControl_type* Text_typeof(); void Text__ctor_6_fn(Text* __this); void Text__New2_fn(Text** __retval); void Text__OnRooted_fn(Text* __this); void Text__OnUnrooted_fn(Text* __this); struct Text : ::g::Fuse::Controls::TextBlock { void ctor_6(); static Text* New2(); }; // } }}} // ::g::Fuse::Controls
/*************************************************************************/ /* skeleton_modification_stack_3d.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ /* "Software"), to deal in the Software without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of the Software, and to */ /* permit persons to whom the Software is furnished to do so, subject to */ /* the following conditions: */ /* */ /* The above copyright notice and this permission notice shall be */ /* included in all copies or substantial portions of the Software. */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #ifndef SKELETONMODIFICATIONSTACK3D_H #define SKELETONMODIFICATIONSTACK3D_H #include "core/templates/local_vector.h" #include "scene/3d/skeleton_3d.h" class Skeleton3D; class SkeletonModification3D; class SkeletonModificationStack3D : public Resource { GDCLASS(SkeletonModificationStack3D, Resource); friend class Skeleton3D; friend class SkeletonModification3D; protected: static void _bind_methods(); virtual void _get_property_list(List<PropertyInfo> *p_list) const; virtual bool _set(const StringName &p_path, const Variant &p_value); virtual bool _get(const StringName &p_path, Variant &r_ret) const; public: Skeleton3D *skeleton = nullptr; bool is_setup = false; bool enabled = false; real_t strength = 1.0; enum EXECUTION_MODE { execution_mode_process, execution_mode_physics_process, }; LocalVector<Ref<SkeletonModification3D>> modifications = LocalVector<Ref<SkeletonModification3D>>(); int modifications_count = 0; virtual void setup(); virtual void execute(real_t p_delta, int p_execution_mode); void enable_all_modifications(bool p_enable); Ref<SkeletonModification3D> get_modification(int p_mod_idx) const; void add_modification(Ref<SkeletonModification3D> p_mod); void delete_modification(int p_mod_idx); void set_modification(int p_mod_idx, Ref<SkeletonModification3D> p_mod); void set_modification_count(int p_count); int get_modification_count() const; void set_skeleton(Skeleton3D *p_skeleton); Skeleton3D *get_skeleton() const; bool get_is_setup() const; void set_enabled(bool p_enabled); bool get_enabled() const; void set_strength(real_t p_strength); real_t get_strength() const; SkeletonModificationStack3D(); }; #endif // SKELETONMODIFICATIONSTACK3D_H
#ifndef __ABSPRITE_H #define __ABSPRITE_H #include <Arduino.h> #include <Adafruit_GFX.h> #include <Adafruit_ST7735.h> #include <SPI.h> #include "ab_lcd_image.h" #include "abImage.h" #define AB_SPRITE_SIZE 15 #define DEFAULT_MOVE_DIST 20 #define MAX_SCREEN_WIDTH 128 #define MAX_SCREEN_HEIGHT 160 class abSprite { private: int width; int height; abImage image; public: abSprite(); int x_old; int x; int y_old; int y; int current_sheet; int max_sheet; void setImage(abImage image); abImage getImage(); void setCoordinates(int x, int y); void setSize(int width, int height); void moveRight(); void moveLeft(); void moveUp(); void moveDown(); void moveRight(int dist); void moveLeft(int dist); void moveUp(int dist); void moveDown(int dist); void undraw_old(Adafruit_ST7735 *tft, lcd_image_t *bg); void draw(Adafruit_ST7735 *tft); }; #endif
/* swdp-m0sub.c * * Copyright 2015 Brian Swetland <swetland@frotz.net> * * 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 <app.h> #include <debug.h> #include <string.h> #include <stdlib.h> #include <printf.h> #include <platform.h> #include <arch/arm.h> #include <kernel/thread.h> #include <platform/lpc43xx-gpio.h> #include <platform/lpc43xx-sgpio.h> #include <platform/lpc43xx-clocks.h> #include "rswdp.h" #define PIN_LED PIN(1,1) #define PIN_RESET PIN(2,5) #define PIN_RESET_TXEN PIN(2,6) #define PIN_SWDIO_TXEN PIN(1,5) // SGPIO15=6 #define PIN_SWDIO PIN(1,6) // SGPIO14=6 #define PIN_SWO PIN(1,14) // U1_RXD=1 #define PIN_SWCLK PIN(1,17) // SGPIO11=6 #define GPIO_LED GPIO(0,8) #define GPIO_RESET GPIO(5,5) #define GPIO_RESET_TXEN GPIO(5,6) #define GPIO_SWDIO_TXEN GPIO(1,8) #define GPIO_SWDIO GPIO(1,9) #define GPIO_SWCLK GPIO(0,12) static void gpio_init(void) { pin_config(PIN_LED, PIN_MODE(0) | PIN_PLAIN); pin_config(PIN_RESET, PIN_MODE(4) | PIN_PLAIN); pin_config(PIN_RESET_TXEN, PIN_MODE(4) | PIN_PLAIN); pin_config(PIN_SWDIO_TXEN, PIN_MODE(6) | PIN_PLAIN | PIN_FAST); pin_config(PIN_SWDIO, PIN_MODE(6) | PIN_PLAIN | PIN_INPUT | PIN_FAST); pin_config(PIN_SWCLK, PIN_MODE(6) | PIN_PLAIN | PIN_FAST); pin_config(PIN_SWO, PIN_MODE(1) | PIN_PLAIN | PIN_INPUT | PIN_FAST); gpio_set(GPIO_LED, 0); gpio_set(GPIO_RESET, 1); gpio_set(GPIO_RESET_TXEN, 0); gpio_config(GPIO_LED, GPIO_OUTPUT); gpio_config(GPIO_RESET, GPIO_OUTPUT); gpio_config(GPIO_RESET_TXEN, GPIO_OUTPUT); } /* returns 1 if the number of bits set in n is odd */ static unsigned parity(unsigned n) { n = (n & 0x55555555) + ((n & 0xaaaaaaaa) >> 1); n = (n & 0x33333333) + ((n & 0xcccccccc) >> 2); n = (n & 0x0f0f0f0f) + ((n & 0xf0f0f0f0) >> 4); n = (n & 0x00ff00ff) + ((n & 0xff00ff00) >> 8); n = (n & 0x0000ffff) + ((n & 0xffff0000) >> 16); return n & 1; } #include "fw-m0sub.h" #define M0SUB_ZEROMAP 0x40043308 #define M0SUB_TXEV 0x40043314 // write 0 to clear #define M4_TXEV 0x40043130 // write 0 to clear #define RESET_CTRL0 0x40053100 #define M0_SUB_RST (1 << 12) #define COMM_CMD 0x18004000 #define COMM_ARG1 0x18004004 #define COMM_ARG2 0x18004008 #define COMM_RESP 0x1800400C #define CMD_ERR 0 #define CMD_NOP 1 #define CMD_READ 2 #define CMD_WRITE 3 #define CMD_RESET 4 #define CMD_SETCLOCK 5 #define RSP_BUSY 0xFFFFFFFF void swd_init(void) { gpio_init(); writel(BASE_CLK_SEL(CLK_PLL1), BASE_PERIPH_CLK); spin(1000); // SGPIO15 SWDIO_TXEN writel(CFG_OUT_GPIO | CFG_OE_GPIO, SGPIO_OUT_CFG(15)); // SGPIO14 SWDIO writel(CFG_OUT_GPIO | CFG_OE_GPIO, SGPIO_OUT_CFG(14)); // SGPIO11 SWCLK writel(CFG_OUT_GPIO | CFG_OE_GPIO, SGPIO_OUT_CFG(11)); // all outputs enabled and high writel((1 << 11) | (1 << 14) | (1 << 15), SGPIO_OUT); writel((1 << 11) | (1 << 14) | (1 << 15), SGPIO_OEN); writel(0, M4_TXEV); writel(M0_SUB_RST, RESET_CTRL0); writel(0x18000000, M0SUB_ZEROMAP); writel(0xffffffff, 0x18004000); memcpy((void*) 0x18000000, zero_bin, sizeof(zero_bin)); DSB; writel(0, RESET_CTRL0); } int swd_write(unsigned hdr, unsigned data) { unsigned n; unsigned p = parity(data); writel(CMD_WRITE, COMM_CMD); writel((hdr << 8) | (p << 16), COMM_ARG1); writel(data, COMM_ARG2); writel(RSP_BUSY, COMM_RESP); DSB; asm("sev"); while ((n = readl(COMM_RESP)) == RSP_BUSY) ; //printf("wr s=%d\n", n); return n; } int swd_read(unsigned hdr, unsigned *val) { unsigned n, data, p; writel(CMD_READ, COMM_CMD); writel(hdr << 8, COMM_ARG1); writel(RSP_BUSY, COMM_RESP); DSB; asm("sev"); while ((n = readl(COMM_RESP)) == RSP_BUSY) ; if (n) { return n; } data = readl(COMM_ARG1); p = readl(COMM_ARG2); if (p != parity(data)) { return ERR_PARITY; } //printf("rd s=%d p=%d d=%08x\n", n, p, data); *val = data; return 0; } void swd_reset(void) { unsigned n; writel(CMD_RESET, COMM_CMD); writel(RSP_BUSY, COMM_RESP); DSB; asm("sev"); while ((n = readl(COMM_RESP)) == RSP_BUSY) ; } unsigned swd_set_clock(unsigned khz) { unsigned n; if (khz > 8000) { khz = 8000; } writel(CMD_SETCLOCK, COMM_CMD); writel(khz/1000, COMM_ARG1); writel(RSP_BUSY, COMM_RESP); DSB; asm("sev"); while ((n = readl(COMM_RESP)) == RSP_BUSY) ; // todo: accurate value return khz; } void swd_hw_reset(int assert) { if (assert) { gpio_set(GPIO_RESET, 0); gpio_set(GPIO_RESET_TXEN, 1); } else { gpio_set(GPIO_RESET, 1); gpio_set(GPIO_RESET_TXEN, 0); } }
/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2015 Scientific Computing and Imaging Institute, University of Utah. License for the specific language governing rights and limitations under Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef MODULES_BASIC_PORTFEEDBACKTESTMODULES_H #define MODULES_BASIC_PORTFEEDBACKTESTMODULES_H #include <Dataflow/Network/Module.h> #include <Modules/Basic/share.h> namespace SCIRun { namespace Modules { namespace Basic { class SCISHARE PortFeedbackSender : public SCIRun::Dataflow::Networks::Module, public Has1InputPort<StringPortTag>, public HasNoOutputPorts { public: PortFeedbackSender(); virtual void execute() override; virtual void setStateDefaults() override; INPUT_PORT(0, Input, String); MODULE_TRAITS_AND_INFO(NoAlgoOrUI) }; class SCISHARE PortFeedbackReceiver : public SCIRun::Dataflow::Networks::Module, public Has1OutputPort<StringPortTag>, public HasNoInputPorts { public: void processFeedback(const Core::Datatypes::ModuleFeedback& var); PortFeedbackReceiver(); virtual void execute() override; virtual void setStateDefaults() override; OUTPUT_PORT(0, Output, String); MODULE_TRAITS_AND_INFO(NoAlgoOrUI) }; }}} #endif
// This file was generated based on 'C:\ProgramData\Uno\Packages\Experimental.Physics\0.18.8\$.uno'. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Uno.Int.h> namespace g{ namespace Experimental{ namespace Physics{ // private enum BasicBoundedRegion2D.MoveMode :37 uEnumType* BasicBoundedRegion2D__MoveMode_typeof(); }}} // ::g::Experimental::Physics
/* * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ /* $Header$ */ #include <ctype.h> #include <stdlib.h> /* We do not use strtol here for backwards compatibility in behaviour on overflow. */ long atol(register const char *nptr) { long total = 0; int minus = 0; while (isspace(*nptr)) nptr++; if (*nptr == '+') nptr++; else if (*nptr == '-') { minus = 1; nptr++; } while (isdigit(*nptr)) { total *= 10; total += (*nptr++ - '0'); } return minus ? -total : total; }
/* adddma.c */ #include <lib.h> #define adddma _adddma #include <unistd.h> #include <stdarg.h> int adddma(proc_e, start, size) endpoint_t proc_e; phys_bytes start; phys_bytes size; { message m; m.m2_i1= proc_e; m.m2_l1= start; m.m2_l2= size; return _syscall(MM, ADDDMA, &m); }
// // QNFormUpload.h // QiniuSDK // // Created by bailong on 15/1/4. // Copyright (c) 2015年 Qiniu. All rights reserved. // #import "QNHttpDelegate.h" #import "QNUpToken.h" #import "QNUploadManager.h" #import <Foundation/Foundation.h> @interface QNFormUpload : NSObject - (instancetype)initWithData:(NSData *)data withKey:(NSString *)key withFileName:(NSString *)fileName withToken:(QNUpToken *)token withCompletionHandler:(QNUpCompletionHandler)block withOption:(QNUploadOption *)option withHttpManager:(id<QNHttpDelegate>)http withConfiguration:(QNConfiguration *)config; - (void)put; @end
// // RMMultipleViewsController.h // RMMultipleViewsController-Demo // // Created by Roland Moers on 29.08.13. // Copyright (c) 2013 Roland Moers // // Fade animation and arrow navigation strategy are based on: // AAMultiViewController.h // AAMultiViewController.m // Created by Richard Aurbach on 11/21/2013. // Copyright (c) 2013 Aurbach & Associates, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import <UIKit/UIKit.h> @class RMMultipleViewsController; /** * `UIViewController(RMMultipleViewsController)` is a category of `UIViewController` for providing mandatory properties and implementations so that a UIViewController can be used as a child view of `RMMultipleViewsController`. */ @interface UIViewController (RMMultipleViewsController) /** * When contained as a child in a `RMMultipleViewsController` this property contains a reference to the parent `RMMultipleViewsController`. If the `UIViewController` is not a child of any `RMMultipleViewsController` this property is nil. */ @property (nonatomic, weak) RMMultipleViewsController *multipleViewsController; /** * This method is called when a `RMMultipleViewsController` is about to show the called instance of `UIViewController`. The called `UIViewController` can use the parameters to update it's content such that no content will disappear below a toolbar. * * @param newInsets The new edge insets. */ - (void)adaptToEdgeInsets:(UIEdgeInsets)newInsets; @end /** * This is an enumeration of the supported animation types. */ typedef enum { RMMultipleViewsControllerAnimationSlideIn, RMMultipleViewsControllerAnimationFlip, RMMultipleViewsControllerAnimationFade, RMMultipleViewsControllerAnimationNone } RMMultipleViewsControllerAnimation; /** * This is an enumeration of the supported automated navigation strategies */ typedef enum { RMMultipleViewsControllerNavigationStrategySegmentedControl, RMMultipleViewsControllerNavigationStrategyArrows, RMMultipleViewsControllerNavigationStrategyNone } RMMultipleViewsControllerNavigationStrategy; /** * `RMMultipleViewsController` is an iOS control for showing multiple view controller in one view controller and selecting one with a segmented control. Every `RMMultipleViewsController` should be pushed into a `UINavigationController`. */ @interface RMMultipleViewsController : UIViewController /** * Provides access to the child view controllers. */ @property (nonatomic, strong) NSArray *viewController; /** * Used to change the animation type when switching from one view controller to another. */ @property (nonatomic, assign) RMMultipleViewsControllerAnimation animationStyle; /** * Used to control whether or not the `RMMultipleViewsController` will also show the left and right navigation bar button item of the currently shown child view controller. */ @property (nonatomic, assign) BOOL useNavigationBarButtonItemsOfCurrentViewController; /** * Used to control whether or not the `RMMultipleViewsController` will also show the toolbar items of the currently shown child view controller. */ @property (nonatomic, assign) BOOL useToolbarItemsOfCurrentViewController; /** * Used to control whether AAMultiViewController will auto-create, auto-display, and use a segmented control for navigation. */ @property (nonatomic, assign) RMMultipleViewsControllerNavigationStrategy navigationStrategy; /** * Used to initialize a new `RMMultipleViewsController`. * * @param someViewControllers An array of child view controllers. * * @return A new `RMMultipleViewsController`. */ - (instancetype)initWithViewControllers:(NSArray *)someViewControllers; /** * Call this method if you want to display a certain child view controller. * * @param aViewController The view controller you want to show. This view controller must be an element of the viewController array. * @param animated Used to enable or disable animations for this change. */ - (void)showViewController:(UIViewController *)aViewController animated:(BOOL)animated; @end
// // FKFlickrAuthOauthGetAccessToken.h // FlickrKit // // Generated by FKAPIBuilder on 19 Sep, 2014 at 10:49. // Copyright (c) 2013 DevedUp Ltd. All rights reserved. http://www.devedup.com // // DO NOT MODIFY THIS FILE - IT IS MACHINE GENERATED #import "FKFlickrAPIMethod.h" typedef enum { FKFlickrAuthOauthGetAccessTokenError_InvalidSignature = 96, /* The passed signature was invalid. */ FKFlickrAuthOauthGetAccessTokenError_MissingSignature = 97, /* The call required signing but no signature was sent. */ FKFlickrAuthOauthGetAccessTokenError_InvalidAPIKey = 100, /* The API key passed was not valid or has expired. */ FKFlickrAuthOauthGetAccessTokenError_ServiceCurrentlyUnavailable = 105, /* The requested service is temporarily unavailable. */ FKFlickrAuthOauthGetAccessTokenError_WriteOperationFailed = 106, /* The requested operation failed due to a temporary issue. */ FKFlickrAuthOauthGetAccessTokenError_FormatXXXNotFound = 111, /* The requested response format was not found. */ FKFlickrAuthOauthGetAccessTokenError_MethodXXXNotFound = 112, /* The requested method was not found. */ FKFlickrAuthOauthGetAccessTokenError_InvalidSOAPEnvelope = 114, /* The SOAP envelope send in the request could not be parsed. */ FKFlickrAuthOauthGetAccessTokenError_InvalidXMLRPCMethodCall = 115, /* The XML-RPC request document could not be parsed. */ FKFlickrAuthOauthGetAccessTokenError_BadURLFound = 116, /* One or more arguments contained a URL that has been used for abuse on Flickr. */ } FKFlickrAuthOauthGetAccessTokenError; /* Exchange an auth token from the old Authentication API, to an OAuth access token. Calling this method will delete the auth token used to make the request. Response: <auth> <access_token oauth_token="72157607082540144-8d5d7ea7696629bf" oauth_token_secret="f38bf58b2d95bc8b" /> </auth> */ @interface FKFlickrAuthOauthGetAccessToken : NSObject <FKFlickrAPIMethod> @end
/** * * \file * * \brief This module contains NMC1000 SPI protocol bus APIs implementation. * * Copyright (c) 2016-2018 Microchip Technology Inc. and its subsidiaries. * * \asf_license_start * * \page License * * Subject to your compliance with these terms, you may use Microchip * software and any derivatives exclusively with Microchip products. * It is your responsibility to comply with third party license terms applicable * to your use of third party software (including open source software) that * may accompany Microchip software. * * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. * * \asf_license_stop * */ #ifndef _NMSPI_H_ #define _NMSPI_H_ #include "common/include/nm_common.h" #ifdef __cplusplus extern "C" { #endif /** * @fn nm_spi_init * @brief Initialize the SPI * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure */ sint8 nm_spi_init(void); /** * @fn nm_spi_reset * @brief reset the SPI * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure */ sint8 nm_spi_reset(void); /** * @fn nm_spi_deinit * @brief DeInitialize the SPI * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure */ sint8 nm_spi_deinit(void); /** * @fn nm_spi_read_reg * @brief Read register * @param [in] u32Addr * Register address * @return Register value */ uint32 nm_spi_read_reg(uint32 u32Addr); /** * @fn nm_spi_read_reg_with_ret * @brief Read register with error code return * @param [in] u32Addr * Register address * @param [out] pu32RetVal * Pointer to u32 variable used to return the read value * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure */ sint8 nm_spi_read_reg_with_ret(uint32 u32Addr, uint32* pu32RetVal); /** * @fn nm_spi_write_reg * @brief write register * @param [in] u32Addr * Register address * @param [in] u32Val * Value to be written to the register * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure */ sint8 nm_spi_write_reg(uint32 u32Addr, uint32 u32Val); /** * @fn nm_spi_read_block * @brief Read block of data * @param [in] u32Addr * Start address * @param [out] puBuf * Pointer to a buffer used to return the read data * @param [in] u16Sz * Number of bytes to read. The buffer size must be >= u16Sz * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure */ sint8 nm_spi_read_block(uint32 u32Addr, uint8 *puBuf, uint16 u16Sz); /** * @fn nm_spi_write_block * @brief Write block of data * @param [in] u32Addr * Start address * @param [in] puBuf * Pointer to the buffer holding the data to be written * @param [in] u16Sz * Number of bytes to write. The buffer size must be >= u16Sz * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure */ sint8 nm_spi_write_block(uint32 u32Addr, uint8 *puBuf, uint16 u16Sz); #ifdef __cplusplus } #endif #endif /* _NMSPI_H_ */
/********************************************************************** *< FILE: RealWorldMapUtils.h DESCRIPTION: Utilities for supporting real-world maps size parameters CREATED BY: Scott Morrison HISTORY: created Feb. 1, 2005 *> Copyright (c) 2005, All Rights Reserved. **********************************************************************/ #pragma once //! Class for creating undo record for any class with a "Real-World Map Size" property. //! //! This is a template class where the template parameter T is the type //! which supports the real-world map size property. This class must have //! a method called SetUsePhysicalScaleUVs(BOOL state). template <class T> class RealWorldScaleRecord: public RestoreObj { public: //! Create a real-world map size undo record //! \param[in] pObj - the object which supports the undo/redo toggle //! \param[in] oldState - the state of the real-world map size toggle to restore to. RealWorldScaleRecord(T* pObj, BOOL oldState) { mpObj = pObj; mOldState = oldState; } //! \see RestoreObj::Restore void Restore(int isUndo) { if (isUndo) mpObj->SetUsePhysicalScaleUVs(mOldState); } //! \see RestoreObj::Redo void Redo() { mpObj->SetUsePhysicalScaleUVs(!mOldState); } private: T* mpObj; BOOL mOldState; }; //! The class ID of the real-world scale interface RealWorldMapSizeInterface. #define RWS_INTERFACE Interface_ID(0x9ff44ef, 0x6c050704) //! The unique instance of the real worls map size interface extern CoreExport FPInterfaceDesc gRealWorldMapSizeDesc; //! \brief The commong mix-in interface for setting realWorldMapSize properties on //! objects and modifiers //! //! Details follow here. //! This class is used with multiple inheritence from a class //! which exports a "real-world map size" toggle. The class must //! implement two abstract methods for setting and getting this value. //! The class must implement the following method: //! BaseInterface* GetInterface(Interface_ID id) //! { //! if (id == RWS_INTERFACE) //! return this; //! else //! return FPMixinInterface::GetInterface(id); //! } //! The client class must add this interface the first time ClassDesc::Create() //! is called on the class's class descriptor. //! See maxsdk/samples/objects/boxobj.cpp for an example of the use of this class. class RealWorldMapSizeInterface: public FPMixinInterface { public: //! Gets the state of the real-world map size toggle //! \return the current state of the toggle virtual BOOL GetUsePhysicalScaleUVs() = 0; //! Set the real-world map size toggle //! \param[in] flag - the new value of the toggle virtual void SetUsePhysicalScaleUVs(BOOL flag) = 0; //From FPMixinInterface //! \see FPMixinInterface::GetDesc FPInterfaceDesc* GetDesc() { return &gRealWorldMapSizeDesc; } //! Function published properties for real-world map size enum{ rws_getRealWorldMapSize, rws_setRealWorldMapSize}; // Function Map for Function Publishing System //*********************************** BEGIN_FUNCTION_MAP PROP_FNS (rws_getRealWorldMapSize, GetUsePhysicalScaleUVs, rws_setRealWorldMapSize, SetUsePhysicalScaleUVs, TYPE_BOOL ); END_FUNCTION_MAP }; //@{ //! These methods are used by many objects and modifiers to handle //! the app data required to tag an object as using phyically scaled UVs. //! \param[in] pAnim - The object to query for the real-world app data. //! \return the current value of the flag stored in the app date. CoreExport BOOL GetUsePhysicalScaleUVs(Animatable* pAnim); //! \param[in] pAnim - The object to set for the real-world app data on. //! \param[in] flag - the new value of the toggle to set in the app data. CoreExport void SetUsePhysicalScaleUVs(Animatable* pAnim, BOOL flag); //@} //@{ //! Set/Get the property which says we should use real-world map size by default. //! This value is stored in the market defaults INI file. //! \return the current value of the flag from the market defaults file. CoreExport BOOL GetPhysicalScaleUVsDisabled(); //! Set the value of this flag. //! \param[in] disable - the new value of the flag to store in the market defaults file. CoreExport void SetPhysicalScaleUVsDisabled(BOOL disable); //@}
#ifndef _BMP_IO_H #define _BMP_IO_H #include <stdio.h> #include "dot_matrix_font_to_bmp.h" int read_and_alloc_one_bmp(FILE *fp, bmp_file_t *ptrbmp); void free_bmp(bmp_file_t *ptrbmp); int output_bmp(FILE *fp, bmp_file_t *ptrbmp); #endif
// This file was generated based on 'C:\ProgramData\Uno\Packages\Fuse.Reactive\0.18.8\$.uno'. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Fuse.Behavior.h> namespace g{namespace Fuse{namespace Reactive{struct Binding;}}} namespace g{namespace Fuse{struct Node;}} namespace g{ namespace Fuse{ namespace Reactive{ // public abstract class Binding :450 // { struct Binding_type : ::g::Fuse::Behavior_type { void(*fp_NewValue)(::g::Fuse::Reactive::Binding*, uObject*); }; Binding_type* Binding_typeof(); void Binding__ctor_1_fn(Binding* __this, uString* key); void Binding__get_Key_fn(Binding* __this, uString** __retval); void Binding__set_Key_fn(Binding* __this, uString* value); void Binding__get_Node_fn(Binding* __this, ::g::Fuse::Node** __retval); void Binding__OnRooted_fn(Binding* __this, ::g::Fuse::Node* n); void Binding__OnUnrooted_fn(Binding* __this, ::g::Fuse::Node* n); struct Binding : ::g::Fuse::Behavior { uStrong<uObject*> _pathSubscription; uStrong<uString*> _Key; void ctor_1(uString* key); uString* Key(); void Key(uString* value); void NewValue(uObject* obj) { (((Binding_type*)__type)->fp_NewValue)(this, obj); } ::g::Fuse::Node* Node(); }; // } }}} // ::g::Fuse::Reactive
#pragma once #include <GLUL/Config.h> #include <GLUL/Input/Event.h> #include <GLUL/Input/Types.h> #include <glm/vec2.hpp> namespace GLUL { namespace Input { class GLUL_API MouseButtonEvent : public Event { public: MouseButtonEvent(); MouseButtonEvent(MouseButton button, Action action, float x, float y); MouseButtonEvent(MouseButton button, Action action, const glm::vec2& position); float getX() const; float getY() const; const glm::vec2& getPosition() const; MouseButton getMouseButton() const; Action getAction() const; void setX(float x); void setY(float y); void setPosition(const glm::vec2& position); void setMouseButton(MouseButton button); void setAction(Action action); public: MouseButtonEvent* asMouseButtonEvent(); const MouseButtonEvent* asMouseButtonEvent() const; private: void _abstract() { } MouseButton _button; Action _action; glm::vec2 _position; }; } }
// Copyright (c) 2016 IBM Corporation. #ifndef LANGUAGE_EXTERN_H #define LANGUAGE_EXTERN_H #include "language-extern_sigs.h" #include <stdexcept> #include <fstream> #include <sstream> #include "termprinter.h" #include "termreader.h" template <typename a> tosca::StringTerm& PrintTerm(tosca::Context& ctx, tosca::StringTerm& category, a& term) { tosca::Term& t = dynamic_cast<tosca::Term&>(term); return newStringTerm(ctx, tosca::PrintToString(t, true)); } template <typename a> a& ParseResource(tosca::Context& ctx, tosca::StringTerm& category, tosca::StringTerm& filename) { // TODO: user-defined category std::fstream input(filename.Unbox().c_str(), std::ios_base::in); tosca::TermParser parser(&input); tosca::Term& term = parser.ParseTerm(ctx); a& result = dynamic_cast<a&>(term); category.Release(); filename.Release(); return result; } template <typename a, typename b> b& Save(tosca::Context& ctx, tosca::StringTerm& category, tosca::StringTerm& filename, a& term, tosca::MapTerm<tosca::StringTerm, tosca::StringTerm>& props, b& result) { // TODO: user-defined category. //const std::string& ucat = category.Unbox(); //if (ucat == "" || ucat == "term") { std::fstream output(filename.Unbox().c_str(), std::ios_base::out); tosca::Print(static_cast<tosca::Term&>(term), output, false); } category.Release(); filename.Release(); props.Release(); return result; } template <typename a> a& ParseText(tosca::Context& ctx, tosca::StringTerm& category, tosca::StringTerm& content) { std::stringstream input(content.Unbox().c_str(), std::ios_base::in); tosca::TermParser parser(&input); tosca::Term& term = parser.ParseTerm(ctx); a& result = dynamic_cast<a&>(term); category.Release(); content.Release(); return result; } #endif
/* Copyright (c) 2007 Scott Lembcke * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /// @defgroup cpPinJoint cpPinJoint /// @{ const cpConstraintClass *cpPinJointGetClass(void); /// @private typedef struct cpPinJoint { cpConstraint constraint; cpVect anchr1, anchr2; cpFloat dist; cpVect r1, r2; cpVect n; cpFloat nMass; cpFloat jnAcc; cpFloat bias; } cpPinJoint; /// Allocate a pin joint. cpPinJoint* cpPinJointAlloc(void); /// Initialize a pin joint. cpPinJoint* cpPinJointInit(cpPinJoint *joint, cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2); /// Allocate and initialize a pin joint. cpConstraint* cpPinJointNew(cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2); CP_DefineConstraintProperty(cpPinJoint, cpVect, anchr1, Anchr1) CP_DefineConstraintProperty(cpPinJoint, cpVect, anchr2, Anchr2) CP_DefineConstraintProperty(cpPinJoint, cpFloat, dist, Dist) ///@}
/********************************************************************** * * * Voreen - The Volume Rendering Engine * * * * Created between 2005 and 2012 by The Voreen Team * * as listed in CREDITS.TXT <http://www.voreen.org> * * * * This file is part of the Voreen software package. Voreen is free * * software: you can redistribute it and/or modify it under the terms * * of the GNU General Public License version 2 as published by the * * Free Software Foundation. * * * * Voreen is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * in the file "LICENSE.txt" along with this program. * * If not, see <http://www.gnu.org/licenses/>. * * * * The authors reserve all rights not expressly granted herein. For * * non-commercial academic use see the license exception specified in * * the file "LICENSE-academic.txt". To get information about * * commercial licensing please contact the authors. * * * **********************************************************************/ #ifndef VRN_EVENTPROPERTYWIDGET_H #define VRN_EVENTPROPERTYWIDGET_H class QBoxLayout; #include "voreen/core/properties/propertywidget.h" #include <QWidget> class QCheckBox; class QComboBox; class QCheckBox; namespace voreen { class EventPropertyBase; class ModifierDetectorWidget; class KeyDetectorWidget; class EventPropertyWidget : public QWidget, public PropertyWidget { Q_OBJECT public: EventPropertyWidget(EventPropertyBase* property, QWidget* parent = 0); ~EventPropertyWidget(); virtual void setEnabled(bool enabled); virtual void setVisible(bool state); virtual void disconnect(); virtual void updateFromProperty(); public slots: void modifierChanged(Qt::KeyboardModifiers modifier); void keyChanged(int key); void buttonChanged(int button); void enabledChanged(bool enabled); void sharingChanged(bool shared); protected: void createEnabledBox(); void createSharingBox(); void createMouseWidgets(); void createKeyWidgets(); void adjustWidgetState(); QBoxLayout* layout_; EventPropertyBase* property_; QCheckBox* checkEnabled_; ModifierDetectorWidget* modifierWidget_; KeyDetectorWidget* keyWidget_; QComboBox* buttonBox_; QCheckBox* checkSharing_; bool disconnected_; }; } // namespace #endif // VRN_EVENTPROPERTYWIDGET_H
/****************************************************************** iLBC Speech Coder ANSI-C Source Code LPC_decode.h Copyright (C) The Internet Society (2004). All Rights Reserved. ******************************************************************/ #ifndef __iLBC_LPC_DECODE_H #define __iLBC_LPC_DECODE_H void LSFinterpolate2a_dec( float *a, /* (o) lpc coefficients for a sub-frame */ float *lsf1, /* (i) first lsf coefficient vector */ float *lsf2, /* (i) second lsf coefficient vector */ float coef, /* (i) interpolation weight */ int length /* (i) length of lsf vectors */ ); void SimplelsfDEQ( float *lsfdeq, /* (o) dequantized lsf coefficients */ int *index, /* (i) quantization index */ int lpc_n /* (i) number of LPCs */ ); void DecoderInterpolateLSF( float *syntdenum, /* (o) synthesis filter coefficients */ float *weightdenum, /* (o) weighting denumerator coefficients */ float *lsfdeq, /* (i) dequantized lsf coefficients */ int length, /* (i) length of lsf coefficient vector */ iLBC_Dec_Inst_t *iLBCdec_inst /* (i) the decoder state structure */ ); #endif
/* Delay between tap_code register and unregister to fix flaky media keys. */ #undef TAP_CODE_DELAY #define TAP_CODE_DELAY 10 /* Turn off RGB lighting when the host goes to sleep. */ #define RGBLIGHT_SLEEP /* Keep backlight and RGB level increments consistent across keyboards. */ #undef BACKLIGHT_LEVELS #undef RGBLIGHT_HUE_STEP #undef RGBLIGHT_SAT_STEP #undef RGBLIGHT_VAL_STEP #define BACKLIGHT_LEVELS 7 #define RGBLIGHT_HUE_STEP 8 #define RGBLIGHT_SAT_STEP 17 #define RGBLIGHT_VAL_STEP 17 /* Make mouse operation smoother. */ #undef MOUSEKEY_DELAY #undef MOUSEKEY_INTERVAL #define MOUSEKEY_DELAY 0 #define MOUSEKEY_INTERVAL 16 /* Lower mouse speed to adjust for reduced MOUSEKEY_INTERVAL. */ #undef MOUSEKEY_MAX_SPEED #undef MOUSEKEY_TIME_TO_MAX #undef MOUSEKEY_WHEEL_MAX_SPEED #undef MOUSEKEY_WHEEL_TIME_TO_MAX #define MOUSEKEY_MAX_SPEED 7 #define MOUSEKEY_TIME_TO_MAX 150 #define MOUSEKEY_WHEEL_MAX_SPEED 3 #define MOUSEKEY_WHEEL_TIME_TO_MAX 150
/******************************************************************************************* Copyright 2010 Broadcom Corporation. All rights reserved. Unless you and Broadcom execute a separate written software license agreement governing use of this software, this software is licensed to you under the terms of the GNU General Public License version 2, available at http://www.gnu.org/copyleft/gpl.html (the "GPL"). Notwithstanding the above, under no circumstances may you combine this software in any way with any other Broadcom software provided under a license other than the GPL, without Broadcom's express prior written consent. *******************************************************************************************/ /** * * @file capi2_cc_ds.h * * @brief This file defines the capi2 Call Control related data types * ****************************************************************************/ #ifndef _CAPI2_CC_DS_H_ #define _CAPI2_CC_DS_H_ /** * @addtogroup CAPI2_CCAPIGroup * @{ */ // Data Definitions used by CAPI2 only #define PHONE_NUMBER_LEN 82 /** Phone number dial string **/ typedef struct { char phone_number[PHONE_NUMBER_LEN]; ///< NULL terminated dial string } PHONE_NUMBER_STR_t; /** States for all non-idle calls **/ typedef struct { CCallStateList_t stateList; ///< Call state array UInt8 listSz; ///< Number of call states } ALL_CALL_STATE_t; /** Indices for all non-idle calls **/ typedef struct { CCallIndexList_t indexList; ///< Call index array UInt8 listSz; ///< Number of call indices } ALL_CALL_INDEX_t; /** @} */ #endif
/* $Id: fileaio.h $ */ /** @file * IPRT - Internal RTFileAio header. */ /* * Copyright (C) 2009-2015 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; * you can redistribute it and/or modify it under the terms of the GNU * General Public License (GPL) as published by the Free Software * Foundation, in version 2 as it comes in the "COPYING" file of the * VirtualBox OSE distribution. VirtualBox OSE is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. * * The contents of this file may alternatively be used under the terms * of the Common Development and Distribution License Version 1.0 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the * VirtualBox OSE distribution, in which case the provisions of the * CDDL are applicable instead of those of the GPL. * * You may elect to license modified versions of this file under the * terms and conditions of either the GPL or the CDDL or both. */ #ifndef ___internal_fileaio_h #define ___internal_fileaio_h #include <iprt/file.h> #include "internal/magics.h" /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** * Defined request states. */ typedef enum RTFILEAIOREQSTATE { /** Prepared. */ RTFILEAIOREQSTATE_PREPARED = 0, /** Submitted. */ RTFILEAIOREQSTATE_SUBMITTED, /** Completed. */ RTFILEAIOREQSTATE_COMPLETED, /** Omni present 32bit hack. */ RTFILEAIOREQSTATE_32BIT_HACK = 0x7fffffff } RTFILEAIOREQSTATE; /******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ /** Return true if the specified request is not valid, false otherwise. */ #define RTFILEAIOREQ_IS_NOT_VALID(pReq) \ (RT_UNLIKELY(!VALID_PTR(pReq) || (pReq->u32Magic != RTFILEAIOREQ_MAGIC))) /** Validates a context handle and returns VERR_INVALID_HANDLE if not valid. */ #define RTFILEAIOREQ_VALID_RETURN_RC(pReq, rc) \ do { \ AssertPtrReturn((pReq), (rc)); \ AssertReturn((pReq)->u32Magic == RTFILEAIOREQ_MAGIC, (rc)); \ } while (0) /** Validates a context handle and returns VERR_INVALID_HANDLE if not valid. */ #define RTFILEAIOREQ_VALID_RETURN(pReq) RTFILEAIOREQ_VALID_RETURN_RC((pReq), VERR_INVALID_HANDLE) /** Validates a context handle and returns (void) if not valid. */ #define RTFILEAIOREQ_VALID_RETURN_VOID(pReq) \ do { \ AssertPtrReturnVoid(pReq); \ AssertReturnVoid((pReq)->u32Magic == RTFILEAIOREQ_MAGIC); \ } while (0) /** Validates a context handle and returns the specified rc if not valid. */ #define RTFILEAIOCTX_VALID_RETURN_RC(pCtx, rc) \ do { \ AssertPtrReturn((pCtx), (rc)); \ AssertReturn((pCtx)->u32Magic == RTFILEAIOCTX_MAGIC, (rc)); \ } while (0) /** Validates a context handle and returns VERR_INVALID_HANDLE if not valid. */ #define RTFILEAIOCTX_VALID_RETURN(pCtx) RTFILEAIOCTX_VALID_RETURN_RC((pCtx), VERR_INVALID_HANDLE) /** Checks if a request is in the specified state and returns the specified rc if not. */ #define RTFILEAIOREQ_STATE_RETURN_RC(pReq, State, rc) \ do { \ if (RT_UNLIKELY(pReq->enmState != RTFILEAIOREQSTATE_##State)) \ return rc; \ } while (0) /** Checks if a request is not in the specified state and returns the specified rc if it is. */ #define RTFILEAIOREQ_NOT_STATE_RETURN_RC(pReq, State, rc) \ do { \ if (RT_UNLIKELY(pReq->enmState == RTFILEAIOREQSTATE_##State)) \ return rc; \ } while (0) /** Checks if a request in the given states and sserts if not. */ #define RTFIELAIOREQ_ASSERT_STATE(pReq, State) \ do { \ AssertPtr((pReq)); \ Assert((pReq)->u32Magic == RTFILEAIOREQ_MAGIC); \ Assert((pReq)->enmState == RTFILEAIOREQSTATE_##State); \ } while (0) /** Sets the request into a specific state. */ #define RTFILEAIOREQ_SET_STATE(pReq, State) \ do { \ pReq->enmState = RTFILEAIOREQSTATE_##State; \ } while (0) RT_C_DECLS_BEGIN RT_C_DECLS_END #endif
/* * COM1 NS16550 support * originally from linux source (arch/ppc/boot/ns16550.c) * modified to use CONFIG_SYS_ISA_MEM and new defines */ #include <config.h> #include <ns16550.h> #define LCRVAL LCR_8N1 /* 8 data, 1 stop, no parity */ #define MCRVAL (MCR_DTR | MCR_RTS) /* RTS/DTR */ #define FCRVAL (FCR_FIFO_EN | FCR_RXSR | FCR_TXSR) /* Clear & enable FIFOs */ void NS16550_init (NS16550_t com_port, int baud_divisor) { com_port->ier = 0x00; #ifdef CONFIG_OMAP com_port->mdr1 = 0x7; /* mode select reset TL16C750*/ #endif com_port->lcr = LCR_BKSE | LCRVAL; com_port->dll = 0; com_port->dlm = 0; com_port->lcr = LCRVAL; com_port->mcr = MCRVAL; com_port->fcr = FCRVAL; com_port->lcr = LCR_BKSE | LCRVAL; com_port->dll = baud_divisor & 0xff; com_port->dlm = (baud_divisor >> 8) & 0xff; com_port->lcr = LCRVAL; #if defined(CONFIG_OMAP) #if defined(CONFIG_APTIX) com_port->mdr1 = 3; /* /13 mode so Aptix 6MHz can hit 115200 */ #else com_port->mdr1 = 0; /* /16 is proper to hit 115200 with 48MHz */ #endif #endif /* CONFIG_OMAP */ } #ifndef CONFIG_NS16550_MIN_FUNCTIONS void NS16550_reinit (NS16550_t com_port, int baud_divisor) { com_port->ier = 0x00; com_port->lcr = LCR_BKSE | LCRVAL; com_port->dll = 0; com_port->dlm = 0; com_port->lcr = LCRVAL; com_port->mcr = MCRVAL; com_port->fcr = FCRVAL; com_port->lcr = LCR_BKSE; com_port->dll = baud_divisor & 0xff; com_port->dlm = (baud_divisor >> 8) & 0xff; com_port->lcr = LCRVAL; } #endif /* CONFIG_NS16550_MIN_FUNCTIONS */ void NS16550_putc (NS16550_t com_port, char c) { while ((com_port->lsr & LSR_THRE) == 0); com_port->thr = c; } #ifndef CONFIG_NS16550_MIN_FUNCTIONS char NS16550_getc (NS16550_t com_port) { while ((com_port->lsr & LSR_DR) == 0) { #ifdef CONFIG_USB_TTY extern void usbtty_poll(void); usbtty_poll(); #endif } return (com_port->rbr); } int NS16550_tstc (NS16550_t com_port) { return ((com_port->lsr & LSR_DR) != 0); } #endif /* CONFIG_NS16550_MIN_FUNCTIONS */
/* * xplus4-main.c - Watcom main.c for xplus4 wrapper. * * Written by * Marco van den Heuvel <blackystardust68@yahoo.com> * * This file is part of VICE, the Versatile Commodore Emulator. * See README for copyright notice. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA. * */ #include "main.c"
/* SPDX-License-Identifier: GPL-2.0-only */ #include <delay.h> #include <device/mmio.h> #include <console/console.h> #include <console/uart.h> #include <soc/addressmap.h> #include <soc/otp.h> /* * This is a driver for the eMemory EG004K32TQ028XW01 NeoFuse * One-Time-Programmable (OTP) memory used within the SiFive FU540. * It is documented in the FU540 manual here: * https://www.sifive.com/documentation/chips/freedom-u540-c000-manual/ */ struct sifive_otp_registers { u32 pa; /* Address input */ u32 paio; /* Program address input */ u32 pas; /* Program redundancy cell selection input */ u32 pce; /* OTP Macro enable input */ u32 pclk; /* Clock input */ u32 pdin; /* Write data input */ u32 pdout; /* Read data output */ u32 pdstb; /* Deep standby mode enable input (active low) */ u32 pprog; /* Program mode enable input */ u32 ptc; /* Test column enable input */ u32 ptm; /* Test mode enable input */ u32 ptm_rep;/* Repair function test mode enable input */ u32 ptr; /* Test row enable input */ u32 ptrim; /* Repair function enable input */ u32 pwe; /* Write enable input (defines program cycle) */ } __packed; /* * Read a 32 bit value addressed by its index from the OTP. * The FU540 stores 4096x32 bit (16KiB) values. * Index 0x00-0xff are reserved for SiFive internal use. (first 1KiB) */ u32 otp_read_word(u16 idx) { u32 w; if (idx >= 0x1000) die("otp: idx out of bounds"); struct sifive_otp_registers *regs = (void *)(FU540_OTP); // wake up from stand-by write32(&regs->pdstb, 0x01); // enable repair function write32(&regs->ptrim, 0x01); // enable input write32(&regs->pce, 0x01); // address to read write32(&regs->pa, idx); // cycle clock to read write32(&regs->pclk, 0x01); mdelay(1); write32(&regs->pclk, 0x00); mdelay(1); w = read32(&regs->pdout); // shut down write32(&regs->pce, 0x00); write32(&regs->ptrim, 0x00); write32(&regs->pdstb, 0x00); return w; } u32 otp_read_serial(void) { u32 serial = 0; u32 serial_n = 0; for (int i = 0xfe; i > 0; i -= 2) { serial = otp_read_word(i); serial_n = otp_read_word(i+1); if (serial == ~serial_n) break; } return serial; }
/* ** Copyright (C) 1998-2007 George Tzanetakis <gtzan@cs.uvic.ca> ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef MARSYAS_STEREOSPECTRUMSOURCES_H #define MARSYAS_STEREOSPECTRUMSOURCES_H #include "MarSystem.h" namespace Marsyas { /** \class StereoSpectrumSources \ingroup Analysis \brief StereoSpectrumSources estimates the number of sources placed into different stereo positions. After computing the Stereo Spectrum we can try to estimate the number of sources playing in different stereo positions. */ class Peaker; class StereoSpectrumSources: public MarSystem { private: realvec orderedPans_; realvec panChanges_; realvec panPeaks_; Peaker* panPeaker_; void myUpdate(MarControlPtr sender); public: StereoSpectrumSources(std::string name); StereoSpectrumSources(const StereoSpectrumSources& a); ~StereoSpectrumSources(); MarSystem* clone() const; void myProcess(realvec& in, realvec& out); }; }//namespace Marsyas #endif
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* NetworkManager -- Network link manager * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Copyright 2011 Red Hat, Inc. */ #ifndef __NETWORKMANAGER_DEVICE_INFINIBAND_H__ #define __NETWORKMANAGER_DEVICE_INFINIBAND_H__ #include "nm-device.h" #define NM_TYPE_DEVICE_INFINIBAND (nm_device_infiniband_get_type ()) #define NM_DEVICE_INFINIBAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_INFINIBAND, NMDeviceInfiniband)) #define NM_DEVICE_INFINIBAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_INFINIBAND, NMDeviceInfinibandClass)) #define NM_IS_DEVICE_INFINIBAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_INFINIBAND)) #define NM_IS_DEVICE_INFINIBAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_INFINIBAND)) #define NM_DEVICE_INFINIBAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_INFINIBAND, NMDeviceInfinibandClass)) typedef struct _NMDeviceInfiniband NMDeviceInfiniband; typedef struct _NMDeviceInfinibandClass NMDeviceInfinibandClass; GType nm_device_infiniband_get_type (void); #endif /* __NETWORKMANAGER_DEVICE_INFINIBAND_H__ */
/******************************************************************** KWin - the KDE window manager This file is part of the KDE project. Copyright (C) 2010 Thomas Lübking <thomas.luebking@web.de> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. *********************************************************************/ #ifndef WINDOWGEOMETRY_CONFIG_H #define WINDOWGEOMETRY_CONFIG_H #include <kcmodule.h> #include "ui_windowgeometry_config.h" namespace KWin { class WindowGeometryConfigForm : public QWidget, public Ui::WindowGeometryConfigForm { Q_OBJECT public: explicit WindowGeometryConfigForm(QWidget* parent); }; class WindowGeometryConfig : public KCModule { Q_OBJECT public: explicit WindowGeometryConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); ~WindowGeometryConfig(); public Q_SLOTS: void save(); void defaults(); private: WindowGeometryConfigForm* myUi; KActionCollection* myActionCollection; }; } // namespace #endif
/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*- * * This file is part of PRoot. * * Copyright (C) 2014 STMicroelectronics * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301 USA. */ #ifndef AOXP_H #define AOXP_H #include <stdbool.h> #include "tracee/reg.h" #include "arch.h" typedef struct array_of_xpointers ArrayOfXPointers; typedef int (*read_xpointee_t)(ArrayOfXPointers *array, size_t index, void **object); typedef int (*write_xpointee_t)(ArrayOfXPointers *array, size_t index, const void *object); typedef int (*compare_xpointee_t)(ArrayOfXPointers *array, size_t index, const void *reference); typedef int (*sizeof_xpointee_t)(ArrayOfXPointers *array, size_t index); typedef struct mixed_pointer XPointer; struct array_of_xpointers { XPointer *_xpointers; size_t length; read_xpointee_t read_xpointee; write_xpointee_t write_xpointee; compare_xpointee_t compare_xpointee; sizeof_xpointee_t sizeof_xpointee; }; static inline int read_xpointee(ArrayOfXPointers *array, size_t index, void **object) { return array->read_xpointee(array, index, object); } static inline int write_xpointee(ArrayOfXPointers *array, size_t index, const void *object) { return array->write_xpointee(array, index, object); } static inline int compare_xpointee(ArrayOfXPointers *array, size_t index, const void *reference) { return array->compare_xpointee(array, index, reference); } static inline int sizeof_xpointee(ArrayOfXPointers *array, size_t index) { return array->sizeof_xpointee(array, index); } extern int find_xpointee(ArrayOfXPointers *array, const void *reference); extern int resize_array_of_xpointers(ArrayOfXPointers *array, size_t index, ssize_t nb_delta_entries); extern int fetch_array_of_xpointers(Tracee *tracee, ArrayOfXPointers **array, Reg reg, size_t nb_entries); extern int push_array_of_xpointers(ArrayOfXPointers *array, Reg reg); extern int read_xpointee_as_object(ArrayOfXPointers *array, size_t index, void **object); extern int read_xpointee_as_string(ArrayOfXPointers *array, size_t index, char **string); extern int write_xpointee_as_string(ArrayOfXPointers *array, size_t index, const char *string); extern int write_xpointees(ArrayOfXPointers *array, size_t index, size_t nb_xpointees, ...); extern int compare_xpointee_generic(ArrayOfXPointers *array, size_t index, const void *reference); extern int sizeof_xpointee_as_string(ArrayOfXPointers *array, size_t index); #endif /* AOXP_H */
/* * This file is part of the coreboot project. * * Copyright 2014 Google Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <arch/io.h> #include <gpio.h> #include <reset.h> #include "board.h" void hard_reset(void) { gpio_output(GPIO_RESET, 1); while (1) ; }
/* Duplicate handle for selection of locales. Copyright (C) 1997, 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #include <locale.h> #include <bits/libc-lock.h> #include <stdlib.h> #include <localeinfo.h> /* Lock for protecting global data. */ __libc_lock_define (extern , __libc_setlocale_lock) __locale_t __duplocale (__locale_t dataset) { __locale_t result; /* We modify global data. */ __libc_lock_lock (__libc_setlocale_lock); /* Get memory. */ result = (__locale_t) malloc (sizeof (struct __locale_struct)); if (result != NULL) { int cnt; for (cnt = 0; cnt < __LC_LAST; ++cnt) if (cnt != LC_ALL) { result->__locales[cnt] = dataset->__locales[cnt]; if (result->__locales[cnt]->usage_count < MAX_USAGE_COUNT) ++result->__locales[cnt]->usage_count; } } /* Update the special members. */ result->__ctype_b = dataset->__ctype_b; result->__ctype_tolower = dataset->__ctype_tolower; result->__ctype_toupper = dataset->__ctype_toupper; /* It's done. */ __libc_lock_unlock (__libc_setlocale_lock); return result; }
/* packet-bpkmreq.c * Routines for Baseline Privacy Key Management Request dissection * Copyright 2002, Anand V. Narwani <anand[AT]narwani.org> * * $Id: packet-bpkmreq.c 45015 2012-09-20 01:29:52Z morriss $ * * Wireshark - Network traffic analyzer * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include <epan/packet.h> /* Initialize the protocol and registered fields */ static int proto_docsis_bpkmreq = -1; static int hf_docsis_bpkmreq_code = -1; static int hf_docsis_bpkmreq_length = -1; static int hf_docsis_bpkmreq_ident = -1; static const value_string code_field_vals[] = { {0, "Reserved"}, {1, "Reserved"}, {2, "Reserved"}, {3, "Reserved"}, {4, "Auth Request"}, {5, "Auth Reply"}, {6, "Auth Reject"}, {7, "Key Request"}, {8, "Key Reply"}, {9, "Key Reject"}, {10, "Auth Invalid"}, {11, "TEK Invalid"}, {12, "Authent Info"}, {13, "Map Request"}, {14, "Map Reply"}, {15, "Map Reject"}, {0, NULL}, }; /* Initialize the subtree pointers */ static gint ett_docsis_bpkmreq = -1; static dissector_handle_t attrs_handle; /* Code to actually dissect the packets */ static void dissect_bpkmreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { proto_item *it; proto_tree *bpkmreq_tree; guint8 code; tvbuff_t *attrs_tvb; code = tvb_get_guint8 (tvb, 0); col_add_fstr (pinfo->cinfo, COL_INFO, "BPKM Request (%s)", val_to_str (code, code_field_vals, "%d")); if (tree) { it = proto_tree_add_protocol_format (tree, proto_docsis_bpkmreq, tvb, 0, -1, "BPKM Request Message"); bpkmreq_tree = proto_item_add_subtree (it, ett_docsis_bpkmreq); proto_tree_add_item (bpkmreq_tree, hf_docsis_bpkmreq_code, tvb, 0, 1, ENC_BIG_ENDIAN); proto_tree_add_item (bpkmreq_tree, hf_docsis_bpkmreq_ident, tvb, 1, 1, ENC_BIG_ENDIAN); proto_tree_add_item (bpkmreq_tree, hf_docsis_bpkmreq_length, tvb, 2, 2, ENC_BIG_ENDIAN); } /* Code to Call subdissector */ attrs_tvb = tvb_new_subset_remaining (tvb, 4); call_dissector (attrs_handle, attrs_tvb, pinfo, tree); } /* Register the protocol with Wireshark */ /* this format is require because a script is used to build the C function that calls all the protocol registration. */ void proto_register_docsis_bpkmreq (void) { /* Setup list of header fields See Section 1.6.1 for details*/ static hf_register_info hf[] = { {&hf_docsis_bpkmreq_code, {"BPKM Code", "docsis_bpkmreq.code", FT_UINT8, BASE_DEC, VALS (code_field_vals), 0x0, "BPKM Request Message", HFILL} }, {&hf_docsis_bpkmreq_ident, {"BPKM Identifier", "docsis_bpkmreq.ident", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL} }, {&hf_docsis_bpkmreq_length, {"BPKM Length", "docsis_bpkmreq.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL} }, }; /* Setup protocol subtree array */ static gint *ett[] = { &ett_docsis_bpkmreq, }; /* Register the protocol name and description */ proto_docsis_bpkmreq = proto_register_protocol ("DOCSIS Baseline Privacy Key Management Request", "DOCSIS BPKM-REQ", "docsis_bpkmreq"); /* Required function calls to register the header fields and subtrees used */ proto_register_field_array (proto_docsis_bpkmreq, hf, array_length (hf)); proto_register_subtree_array (ett, array_length (ett)); register_dissector ("docsis_bpkmreq", dissect_bpkmreq, proto_docsis_bpkmreq); } /* If this dissector uses sub-dissector registration add a registration routine. This format is required because a script is used to find these routines and create the code that calls these routines. */ void proto_reg_handoff_docsis_bpkmreq (void) { dissector_handle_t docsis_bpkmreq_handle; docsis_bpkmreq_handle = find_dissector ("docsis_bpkmreq"); attrs_handle = find_dissector ("docsis_bpkmattr"); dissector_add_uint ("docsis_mgmt", 0x0C, docsis_bpkmreq_handle); }
/* hostlist_sctp.c 2008 Stig Bjorlykke * * Wireshark - Network traffic analyzer * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include <string.h> #include <gtk/gtk.h> #include "epan/packet.h" #include <epan/stat_cmd_args.h> #include <epan/tap.h> #include <epan/dissectors/packet-sctp.h> #include "../stat_menu.h" #include "ui/gtk/gui_stat_menu.h" #include "ui/gtk/hostlist_table.h" void register_tap_listener_sctp_hostlist(void); static int sctp_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) { hostlist_table *hosts=(hostlist_table *)pit; const struct _sctp_info *sctphdr=(const struct _sctp_info *)vip; /* Take two "add" passes per packet, adding for each direction, ensures that all packets are counted properly (even if address is sending to itself) XXX - this could probably be done more efficiently inside hostlist_table */ add_hostlist_table_data(hosts, &sctphdr->ip_src, sctphdr->sport, TRUE, 1, pinfo->fd->pkt_len, SAT_NONE, PT_SCTP); add_hostlist_table_data(hosts, &sctphdr->ip_dst, sctphdr->dport, FALSE, 1, pinfo->fd->pkt_len, SAT_NONE, PT_SCTP); return 1; } static void gtk_sctp_hostlist_init(const char *opt_arg, void* userdata _U_) { const char *filter=NULL; if(!strncmp(opt_arg,"hosts,sctp,",11)){ filter=opt_arg+11; } else { filter=NULL; } init_hostlist_table(FALSE, "SCTP", "sctp", filter, sctp_hostlist_packet); } void gtk_sctp_hostlist_cb(GtkAction *action _U_, gpointer user_data _U_) { gtk_sctp_hostlist_init("hosts,sctp",NULL); } void register_tap_listener_sctp_hostlist(void) { register_stat_cmd_arg("hosts,sctp", gtk_sctp_hostlist_init,NULL); register_hostlist_table(FALSE, "SCTP", "sctp", NULL /*filter*/, sctp_hostlist_packet); }
/* SPDX-License-Identifier: LGPL-2.1+ */ #pragma once #define VERB_ANY ((unsigned) -1) typedef enum VerbFlags { VERB_DEFAULT = 1 << 0, VERB_ONLINE_ONLY = 1 << 1, VERB_MUST_BE_ROOT = 1 << 2, } VerbFlags; typedef struct { const char *verb; unsigned min_args, max_args; VerbFlags flags; int (* const dispatch)(int argc, char *argv[], void *userdata); } Verb; bool running_in_chroot_or_offline(void); int dispatch_verb(int argc, char *argv[], const Verb verbs[], void *userdata);
/* SPDX-License-Identifier: LGPL-2.1+ */ /*** This file is part of systemd. Copyright 2010 Lennart Poettering systemd 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. systemd 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 systemd; If not, see <http://www.gnu.org/licenses/>. ***/ #include "hostname-setup.h" #include "util.h" int main(int argc, char* argv[]) { int r; r = hostname_setup(); if (r < 0) log_error_errno(r, "hostname: %m"); return 0; }
/* NSDate+MAPIStore.h - this file is part of SOGo * * Copyright (C) 2010-2012 Inverse inc. * * Author: Wolfgang Sourdeau <wsourdeau@inverse.ca> * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This file is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef NSCALENDARDATE_MAPISTORE_H #define NSCALENDARDATE_MAPISTORE_H #import <Foundation/NSDate.h> @class NSCalendarDate; @interface NSDate (MAPIStoreDataTypes) + (NSCalendarDate *) dateFromMinutesSince1601: (uint32_t) minutes; - (uint32_t) asMinutesSince1601; + (id) dateFromFileTime: (const struct FILETIME *) timeValue; - (struct FILETIME *) asFileTimeInMemCtx: (void *) memCtx; - (BOOL) isNever; /* occurs on 4500-12-31 */ + (NSCalendarDate *) dateFromSystemTime: (struct SYSTEMTIME) date andRuleYear: (uint16_t) rYear; @end NSComparisonResult NSDateCompare (id date1, id date2, void *); #endif /* NSCALENDARDATE+MAPISTORE_H */
/* * Altera SoCFPGA PinMux configuration * * SPDX-License-Identifier: BSD-3-Clause */ #ifndef __SOCFPGA_PINMUX_CONFIG_H__ #define __SOCFPGA_PINMUX_CONFIG_H__ const u8 sys_mgr_init_table[] = { 3, /* EMACIO0 */ 2, /* EMACIO1 */ 2, /* EMACIO2 */ 2, /* EMACIO3 */ 2, /* EMACIO4 */ 2, /* EMACIO5 */ 2, /* EMACIO6 */ 2, /* EMACIO7 */ 2, /* EMACIO8 */ 3, /* EMACIO9 */ 2, /* EMACIO10 */ 2, /* EMACIO11 */ 2, /* EMACIO12 */ 2, /* EMACIO13 */ 0, /* EMACIO14 */ 0, /* EMACIO15 */ 0, /* EMACIO16 */ 0, /* EMACIO17 */ 0, /* EMACIO18 */ 0, /* EMACIO19 */ 3, /* FLASHIO0 */ 0, /* FLASHIO1 */ 3, /* FLASHIO2 */ 3, /* FLASHIO3 */ 3, /* FLASHIO4 */ 3, /* FLASHIO5 */ 3, /* FLASHIO6 */ 3, /* FLASHIO7 */ 0, /* FLASHIO8 */ 3, /* FLASHIO9 */ 3, /* FLASHIO10 */ 3, /* FLASHIO11 */ 0, /* GENERALIO0 */ 1, /* GENERALIO1 */ 1, /* GENERALIO2 */ 0, /* GENERALIO3 */ 0, /* GENERALIO4 */ 1, /* GENERALIO5 */ 1, /* GENERALIO6 */ 1, /* GENERALIO7 */ 1, /* GENERALIO8 */ 0, /* GENERALIO9 */ 0, /* GENERALIO10 */ 0, /* GENERALIO11 */ 0, /* GENERALIO12 */ 2, /* GENERALIO13 */ 2, /* GENERALIO14 */ 3, /* GENERALIO15 */ 3, /* GENERALIO16 */ 2, /* GENERALIO17 */ 2, /* GENERALIO18 */ 0, /* GENERALIO19 */ 0, /* GENERALIO20 */ 0, /* GENERALIO21 */ 0, /* GENERALIO22 */ 0, /* GENERALIO23 */ 0, /* GENERALIO24 */ 0, /* GENERALIO25 */ 0, /* GENERALIO26 */ 0, /* GENERALIO27 */ 0, /* GENERALIO28 */ 0, /* GENERALIO29 */ 0, /* GENERALIO30 */ 0, /* GENERALIO31 */ 2, /* MIXED1IO0 */ 2, /* MIXED1IO1 */ 2, /* MIXED1IO2 */ 2, /* MIXED1IO3 */ 2, /* MIXED1IO4 */ 2, /* MIXED1IO5 */ 2, /* MIXED1IO6 */ 2, /* MIXED1IO7 */ 2, /* MIXED1IO8 */ 2, /* MIXED1IO9 */ 2, /* MIXED1IO10 */ 2, /* MIXED1IO11 */ 2, /* MIXED1IO12 */ 2, /* MIXED1IO13 */ 0, /* MIXED1IO14 */ 3, /* MIXED1IO15 */ 3, /* MIXED1IO16 */ 3, /* MIXED1IO17 */ 3, /* MIXED1IO18 */ 3, /* MIXED1IO19 */ 3, /* MIXED1IO20 */ 0, /* MIXED1IO21 */ 0, /* MIXED2IO0 */ 0, /* MIXED2IO1 */ 0, /* MIXED2IO2 */ 0, /* MIXED2IO3 */ 0, /* MIXED2IO4 */ 0, /* MIXED2IO5 */ 0, /* MIXED2IO6 */ 0, /* MIXED2IO7 */ 0, /* GPLINMUX48 */ 0, /* GPLINMUX49 */ 0, /* GPLINMUX50 */ 0, /* GPLINMUX51 */ 0, /* GPLINMUX52 */ 0, /* GPLINMUX53 */ 0, /* GPLINMUX54 */ 0, /* GPLINMUX55 */ 0, /* GPLINMUX56 */ 0, /* GPLINMUX57 */ 0, /* GPLINMUX58 */ 0, /* GPLINMUX59 */ 0, /* GPLINMUX60 */ 0, /* GPLINMUX61 */ 0, /* GPLINMUX62 */ 0, /* GPLINMUX63 */ 0, /* GPLINMUX64 */ 0, /* GPLINMUX65 */ 0, /* GPLINMUX66 */ 0, /* GPLINMUX67 */ 0, /* GPLINMUX68 */ 0, /* GPLINMUX69 */ 0, /* GPLINMUX70 */ 1, /* GPLMUX0 */ 1, /* GPLMUX1 */ 1, /* GPLMUX2 */ 1, /* GPLMUX3 */ 1, /* GPLMUX4 */ 1, /* GPLMUX5 */ 1, /* GPLMUX6 */ 1, /* GPLMUX7 */ 1, /* GPLMUX8 */ 1, /* GPLMUX9 */ 1, /* GPLMUX10 */ 1, /* GPLMUX11 */ 1, /* GPLMUX12 */ 1, /* GPLMUX13 */ 1, /* GPLMUX14 */ 1, /* GPLMUX15 */ 1, /* GPLMUX16 */ 1, /* GPLMUX17 */ 1, /* GPLMUX18 */ 1, /* GPLMUX19 */ 1, /* GPLMUX20 */ 1, /* GPLMUX21 */ 1, /* GPLMUX22 */ 1, /* GPLMUX23 */ 1, /* GPLMUX24 */ 1, /* GPLMUX25 */ 1, /* GPLMUX26 */ 1, /* GPLMUX27 */ 1, /* GPLMUX28 */ 1, /* GPLMUX29 */ 1, /* GPLMUX30 */ 1, /* GPLMUX31 */ 1, /* GPLMUX32 */ 1, /* GPLMUX33 */ 1, /* GPLMUX34 */ 1, /* GPLMUX35 */ 1, /* GPLMUX36 */ 1, /* GPLMUX37 */ 1, /* GPLMUX38 */ 1, /* GPLMUX39 */ 1, /* GPLMUX40 */ 1, /* GPLMUX41 */ 1, /* GPLMUX42 */ 1, /* GPLMUX43 */ 1, /* GPLMUX44 */ 1, /* GPLMUX45 */ 1, /* GPLMUX46 */ 1, /* GPLMUX47 */ 1, /* GPLMUX48 */ 1, /* GPLMUX49 */ 1, /* GPLMUX50 */ 1, /* GPLMUX51 */ 1, /* GPLMUX52 */ 1, /* GPLMUX53 */ 1, /* GPLMUX54 */ 1, /* GPLMUX55 */ 1, /* GPLMUX56 */ 1, /* GPLMUX57 */ 1, /* GPLMUX58 */ 1, /* GPLMUX59 */ 1, /* GPLMUX60 */ 1, /* GPLMUX61 */ 1, /* GPLMUX62 */ 1, /* GPLMUX63 */ 1, /* GPLMUX64 */ 1, /* GPLMUX65 */ 1, /* GPLMUX66 */ 1, /* GPLMUX67 */ 1, /* GPLMUX68 */ 1, /* GPLMUX69 */ 1, /* GPLMUX70 */ 0, /* NANDUSEFPGA */ 0, /* UART0USEFPGA */ 0, /* RGMII1USEFPGA */ 0, /* SPIS0USEFPGA */ 0, /* CAN0USEFPGA */ 0, /* I2C0USEFPGA */ 0, /* SDMMCUSEFPGA */ 0, /* QSPIUSEFPGA */ 0, /* SPIS1USEFPGA */ 0, /* RGMII0USEFPGA */ 0, /* UART1USEFPGA */ 0, /* CAN1USEFPGA */ 0, /* USB1USEFPGA */ 0, /* I2C3USEFPGA */ 0, /* I2C2USEFPGA */ 0, /* I2C1USEFPGA */ 0, /* SPIM1USEFPGA */ 0, /* USB0USEFPGA */ 0 /* SPIM0USEFPGA */ }; #endif /* __SOCFPGA_PINMUX_CONFIG_H__ */
/* Copyright (C) 1991, 1993, 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #include <errno.h> #include <stdlib.h> /* Execute LINE as a shell command. */ int __libc_system (line) const char *line; { if (line == NULL) return 0; /* This indicates no command processor. */ __sys_errno (ENOSYS); return -1; } weak_alias (__libc_system, system) stub_warning (system) #include <stub-tag.h>
/* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CRYPT_HASHGEN_IMPL_H #define CRYPT_HASHGEN_IMPL_H #define ROUNDS_DEFAULT 5000 #define ROUNDS_MIN 1000 #define ROUNDS_MAX ROUNDS_DEFAULT #define MIXCHARS 32 #define CRYPT_SALT_LENGTH 20 #define CRYPT_MAGIC_LENGTH 3 #define CRYPT_PARAM_LENGTH 13 #define SHA256_HASH_LENGTH 43 #define CRYPT_MAX_PASSWORD_SIZE (CRYPT_SALT_LENGTH + \ SHA256_HASH_LENGTH + \ CRYPT_MAGIC_LENGTH + \ CRYPT_PARAM_LENGTH) #define MAX_PLAINTEXT_LENGTH 256 #include <stddef.h> #include <my_global.h> int extract_user_salt(char **salt_begin, char **salt_end); C_MODE_START char * my_crypt_genhash(char *ctbuffer, size_t ctbufflen, const char *plaintext, int plaintext_len, const char *switchsalt, const char **params); void generate_user_salt(char *buffer, int buffer_len); void xor_string(char *to, int to_len, char *pattern, int pattern_len); C_MODE_END #endif
#ifndef __GEDIT_FILE_BROWER_MESSAGES_MESSAGES_H__ #define __GEDIT_FILE_BROWER_MESSAGES_MESSAGES_H__ #include "gedit-file-browser-message-activation.h" #include "gedit-file-browser-message-add-context-item.h" #include "gedit-file-browser-message-add-filter.h" #include "gedit-file-browser-message-get-root.h" #include "gedit-file-browser-message-get-view.h" #include "gedit-file-browser-message-id.h" #include "gedit-file-browser-message-id-location.h" #include "gedit-file-browser-message-set-emblem.h" #include "gedit-file-browser-message-set-root.h" #endif /* __GEDIT_FILE_BROWER_MESSAGES_MESSAGES_H__ */
/* * arch/arm/mach-tegra/board-smba1002.c * * Copyright (C) 2011 Eduardo José Tagle <ejtagle@tutopia.com> * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #include <linux/console.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/version.h> #include <linux/platform_device.h> #include <linux/serial_8250.h> #include <linux/clk.h> #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> #include <linux/dma-mapping.h> #include <linux/fsl_devices.h> #include <linux/platform_data/tegra_usb.h> #include <linux/pda_power.h> #include <linux/gpio.h> #include <linux/delay.h> #include <linux/reboot.h> #include <linux/i2c-tegra.h> #include <linux/memblock.h> #include <linux/antares_dock.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> #include <asm/mach/time.h> #include <asm/setup.h> #include <mach/io.h> #include <mach/w1.h> #include <mach/iomap.h> #include <mach/irqs.h> #include <mach/nand.h> #include <mach/iomap.h> #include <mach/sdhci.h> #include <mach/gpio.h> #include <mach/clk.h> #include <mach/usb_phy.h> #include <mach/i2s.h> #include <mach/system.h> #include <linux/nvmap.h> #include "board.h" #include "board-smba1002.h" #include "clock.h" #include "gpio-names.h" #include "devices.h" #include "pm.h" #include "wakeups-t2.h" #include "wdt-recovery.h" #include <linux/rfkill-gpio.h> #define PMC_CTRL 0x0 #define PMC_CTRL_INTR_LOW (1 << 17) static struct rfkill_gpio_platform_data bluetooth_rfkill = { .name = "bluetooth_rfkill", .shutdown_gpio = -1, .reset_gpio = SMBA1002_BT_RESET, .type = RFKILL_TYPE_BLUETOOTH, }; static struct platform_device bluetooth_rfkill_device = { .name = "rfkill_gpio", .id = -1, .dev = { .platform_data = &bluetooth_rfkill, }, }; #ifdef CONFIG_BT_BLUEDROID extern void bluesleep_setup_uart_port(struct platform_device *uart_dev); #endif void __init smba_setup_bluesleep(void) { /*Add Clock Resource*/ clk_add_alias("bcm4329_32k_clk", bluetooth_rfkill_device.name, \ "blink", NULL); #ifdef CONFIG_BT_BLUEDROID bluesleep_setup_uart_port(&tegra_uartc_device); #endif return; } static struct resource smba_bluesleep_resources[] = { [0] = { .name = "gpio_host_wake", .start = SMBA1002_BT_IRQ, .end = SMBA1002_BT_IRQ, .flags = IORESOURCE_IO, }, [1] = { .name = "gpio_ext_wake", .start = SMBA1002_BT_WAKEUP, .end = SMBA1002_BT_WAKEUP, .flags = IORESOURCE_IO, }, [2] = { .name = "host_wake", .start = TEGRA_GPIO_TO_IRQ(SMBA1002_BT_IRQ), .end = TEGRA_GPIO_TO_IRQ(SMBA1002_BT_IRQ), .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE, }, }; static struct platform_device smba_bluesleep_device = { .name = "bluesleep", .id = -1, .num_resources = ARRAY_SIZE(smba_bluesleep_resources), .resource = smba_bluesleep_resources, }; static struct dock_platform_data dock_on_platform_data = { .irq = TEGRA_GPIO_TO_IRQ(SMBA1002_DOCK), .gpio_num = SMBA1002_DOCK, }; static struct platform_device tegra_dock_device = { .name = "tegra_dock", .id = -1, .dev = { .platform_data = &dock_on_platform_data, }, }; static struct platform_device *smba_devices[] __initdata = { &tegra_pmu_device, &tegra_gart_device, &tegra_aes_device, &bluetooth_rfkill_device, &smba_bluesleep_device, &tegra_wdt_device, &tegra_avp_device, &tegra_dock_device }; static void __init tegra_smba_init(void) { /* Initialize the pinmux */ smba_pinmux_init(); /* Initialize the clocks - clocks require the pinmux to be initialized first */ smba_clks_init(); platform_add_devices(smba_devices,ARRAY_SIZE(smba_devices)); /* Register i2c devices - required for Power management and MUST be done before the power register */ smba_i2c_register_devices(); /* Register the power subsystem - Including the poweroff handler - Required by all the others */ smba_charge_init(); smba_regulator_init(); /* Register the USB device */ smba_usb_register_devices(); /* Register UART devices */ smba_uart_register_devices(); /* Register RAM Console */ tegra_ram_console_debug_init(); /* Register GPU devices */ smba_panel_init(); /* Register Audio devices */ smba_audio_register_devices(); /* Register all the keyboard devices */ smba_keys_init(); /* Register touchscreen devices */ smba_touch_register_devices(); /* Register accelerometer device */ smba_sensors_register_devices(); /* Register Camera powermanagement devices */ smba_camera_register_devices(); /* Register NAND flash devices */ smba_nand_register_devices(); /* Register SDHCI devices */ smba_sdhci_init(); /* Register Bluetooth powermanagement devices */ smba_setup_bluesleep(); /* Release the tegra bootloader framebuffer */ tegra_release_bootloader_fb(); } static void __init tegra_smba_reserve(void) { if (memblock_reserve(0x0, 4096) < 0) pr_warn("Cannot reserve first 4K of memory for safety\n"); /* Reserve the graphics memory */ tegra_reserve(SMBA1002_GPU_MEM_SIZE, SMBA1002_FB1_MEM_SIZE, SMBA1002_FB2_MEM_SIZE); tegra_ram_console_debug_reserve(SZ_1M); } static void __init tegra_smba_fixup(struct machine_desc *desc, struct tag *tags, char **cmdline, struct meminfo *mi) { mi->nr_banks = SMBA1002_MEM_BANKS; mi->bank[0].start = PHYS_OFFSET; mi->bank[0].size = SMBA1002_MEM_SIZE - SMBA1002_TOTAL_GPU_MEM_SIZE; } MACHINE_START(HARMONY, "harmony") .boot_params = 0x00000100, .fixup = tegra_smba_fixup, .map_io = tegra_map_common_io, .reserve = tegra_smba_reserve, .init_early = tegra_init_early, .init_irq = tegra_init_irq, .timer = &tegra_timer, .init_machine = tegra_smba_init, MACHINE_END
/***************************************************************************** * Copyright (c) 2014-2018 OpenRCT2 developers * * For a complete list of all authors, please refer to contributors.md * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 * * OpenRCT2 is licensed under the GNU General Public License version 3. *****************************************************************************/ #pragma once #include "../scenario/Scenario.h" #include "Object.h" class StexObject final : public Object { private: rct_stex_entry _legacyType = {}; public: explicit StexObject(const rct_object_entry& entry) : Object(entry) { } void* GetLegacyData() override { return &_legacyType; } void ReadLegacy(IReadObjectContext* context, IStream* stream) override; void Load() override; void Unload() override; void DrawPreview(rct_drawpixelinfo* dpi, int32_t width, int32_t height) const override; std::string GetName() const override; std::string GetScenarioName() const; std::string GetScenarioDetails() const; std::string GetParkName() const; };
#ifndef MANTID_CURVEFITTING_SEQDOMAIN_H_ #define MANTID_CURVEFITTING_SEQDOMAIN_H_ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- #include "MantidCurveFitting/DllConfig.h" #include "MantidAPI/FunctionDomain.h" #include "MantidAPI/FunctionValues.h" #include "MantidAPI/IDomainCreator.h" #include "MantidCurveFitting/CostFunctions/CostFuncLeastSquares.h" #include "MantidCurveFitting/CostFunctions/CostFuncRwp.h" #include <stdexcept> #include <vector> #include <algorithm> namespace Mantid { namespace CurveFitting { /** An implementation of CompositeDomain. @author Roman Tolchenov, Tessella plc @date 15/11/2011 Copyright &copy; 2009 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source This file is part of Mantid. Mantid is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. Mantid is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. File change history is stored at: <https://github.com/mantidproject/mantid>. Code Documentation is available at: <http://doxygen.mantidproject.org> */ class MANTID_CURVEFITTING_DLL SeqDomain : public API::FunctionDomain { public: SeqDomain() : API::FunctionDomain(), m_currentIndex(0) {} /// Return the number of points in the domain size_t size() const override; /// Return the number of parts in the domain virtual size_t getNDomains() const; /// Create and return i-th domain and i-th values, (i-1)th domain is released. virtual void getDomainAndValues(size_t i, API::FunctionDomain_sptr &domain, API::FunctionValues_sptr &values) const; /// Add new domain creator void addCreator(API::IDomainCreator_sptr creator); /// Calculate the value of a least squares cost function virtual void leastSquaresVal(const CostFunctions::CostFuncLeastSquares &leastSquares); /// Calculate the value, first and second derivatives of a least squares cost /// function virtual void leastSquaresValDerivHessian( const CostFunctions::CostFuncLeastSquares &leastSquares, bool evalDeriv, bool evalHessian); /// Calculate the value of a Rwp cost function void rwpVal(const CostFunctions::CostFuncRwp &rwp); /// Calculate the value, first and second derivatives of a RWP cost function void rwpValDerivHessian(const CostFunctions::CostFuncRwp &rwp, bool evalDeriv, bool evalHessian); /// Create an instance of SeqDomain in one of two forms: either SeqDomain for /// sequential domain creation /// or ParDomain for parallel calculations static SeqDomain *create(API::IDomainCreator::DomainType type); protected: /// Current index mutable size_t m_currentIndex; /// Currently active domain. mutable std::vector<API::FunctionDomain_sptr> m_domain; /// Currently active values. mutable std::vector<API::FunctionValues_sptr> m_values; /// Domain creators. std::vector<boost::shared_ptr<API::IDomainCreator>> m_creators; }; } // namespace CurveFitting } // namespace Mantid #endif /*MANTID_CURVEFITTING_SEQDOMAIN_H_*/
/* XGGState - Implements graphic state drawing for Xlib Copyright (C) 1995 Free Software Foundation, Inc. Written by: Adam Fedor <fedor@boulder.colorado.edu> Date: Nov 1995 This file is part of the GNU Objective C User Interface Library. 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 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; see the file COPYING.LIB. If not, see <http://www.gnu.org/licenses/> or write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _XGGState_h_INCLUDE #define _XGGState_h_INCLUDE #include <Foundation/NSArray.h> #include <Foundation/NSObject.h> #include "gsc/GSGState.h" #include <X11/Xlib.h> #include <X11/Xutil.h> #include "x11/XGServer.h" #ifdef HAVE_XFT #define id xwindowsid #include <X11/Xft/Xft.h> #undef id #endif @class NSBezierPath; @class NSFont; @interface XGGState : GSGState { @public void *context; void *windevice; XGDrawMechanism drawMechanism; GC xgcntxt; GC agcntxt; XGCValues gcv; Drawable draw; Drawable alpha_buffer; Region clipregion; #ifdef HAVE_XFT XftDraw *xft_draw; XftDraw *xft_alpha_draw; XftColor xft_color; #endif BOOL drawingAlpha; BOOL sharedGC; /* Do we own the GC or share it? */ } - (void) setWindowDevice: (void *)device; - (void) setGraphicContext: (GC)xGraphicContext; - (void) setGCValues: (XGCValues)values withMask: (int)mask; - (void) setClipMask; - (Region) xClipRegion; - (BOOL) hasDrawable; - (BOOL) hasGraphicContext; - (void *) windevice; - (Drawable) drawable; - (GC) graphicContext; - (NSRect) clipRect; #ifdef HAVE_XFT - (XftDraw *)xftDrawForDrawable: (Drawable)d; - (XftColor)xftColor; #endif - (XPoint) viewPointToX: (NSPoint)aPoint; - (XRectangle) viewRectToX: (NSRect)aRect; - (XPoint) windowPointToX: (NSPoint)aPoint; - (XRectangle) windowRectToX: (NSRect)aRect; @end @interface XGGState (Ops) - (NSDictionary *) GSReadRect: (NSRect)rect; @end #endif /* _XGGState_h_INCLUDE */
#ifndef CA_USERTOOLS_H #define CA_USERTOOLS_H #include <vector> namespace ca { std::vector<int> range(int from, int upto); } #endif // CA_USERTOOLS_H
/* * This file is part of Cleanflight. * * Cleanflight is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Cleanflight is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>. */ #include <stdint.h> #include <platform.h> #include "drivers/io.h" #include "drivers/pwm_mapping.h" const uint16_t multiPPM[] = { PWM1 | (MAP_TO_PPM_INPUT << 8), // PPM input PWM9 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed PWM10 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed PWM11 | (MAP_TO_MOTOR_OUTPUT << 8), PWM12 | (MAP_TO_MOTOR_OUTPUT << 8), PWM13 | (MAP_TO_MOTOR_OUTPUT << 8), PWM14 | (MAP_TO_MOTOR_OUTPUT << 8), PWM5 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed PWM6 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed PWM7 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed PWM8 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed 0xFFFF }; const uint16_t multiPWM[] = { PWM1 | (MAP_TO_PWM_INPUT << 8), // input #1 PWM2 | (MAP_TO_PWM_INPUT << 8), PWM3 | (MAP_TO_PWM_INPUT << 8), PWM4 | (MAP_TO_PWM_INPUT << 8), PWM5 | (MAP_TO_PWM_INPUT << 8), PWM6 | (MAP_TO_PWM_INPUT << 8), PWM7 | (MAP_TO_PWM_INPUT << 8), PWM8 | (MAP_TO_PWM_INPUT << 8), // input #8 PWM9 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #1 or servo #1 (swap to servo if needed) PWM10 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #2 or servo #2 (swap to servo if needed) PWM11 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #1 or #3 PWM12 | (MAP_TO_MOTOR_OUTPUT << 8), PWM13 | (MAP_TO_MOTOR_OUTPUT << 8), PWM14 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #4 or #6 0xFFFF }; const uint16_t airPPM[] = { PWM1 | (MAP_TO_PPM_INPUT << 8), // PPM input PWM9 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #1 PWM10 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #2 PWM11 | (MAP_TO_SERVO_OUTPUT << 8), // servo #1 PWM12 | (MAP_TO_SERVO_OUTPUT << 8), PWM13 | (MAP_TO_SERVO_OUTPUT << 8), PWM14 | (MAP_TO_SERVO_OUTPUT << 8), // servo #4 PWM5 | (MAP_TO_SERVO_OUTPUT << 8), // servo #5 PWM6 | (MAP_TO_SERVO_OUTPUT << 8), PWM7 | (MAP_TO_SERVO_OUTPUT << 8), PWM8 | (MAP_TO_SERVO_OUTPUT << 8), // servo #8 0xFFFF }; const uint16_t airPWM[] = { PWM1 | (MAP_TO_PWM_INPUT << 8), // input #1 PWM2 | (MAP_TO_PWM_INPUT << 8), PWM3 | (MAP_TO_PWM_INPUT << 8), PWM4 | (MAP_TO_PWM_INPUT << 8), PWM5 | (MAP_TO_PWM_INPUT << 8), PWM6 | (MAP_TO_PWM_INPUT << 8), PWM7 | (MAP_TO_PWM_INPUT << 8), PWM8 | (MAP_TO_PWM_INPUT << 8), // input #8 PWM9 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #1 PWM10 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #2 PWM11 | (MAP_TO_SERVO_OUTPUT << 8), // servo #1 PWM12 | (MAP_TO_SERVO_OUTPUT << 8), PWM13 | (MAP_TO_SERVO_OUTPUT << 8), PWM14 | (MAP_TO_SERVO_OUTPUT << 8), // servo #4 0xFFFF }; const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = { { TIM1, IO_TAG(PA8), TIM_Channel_1, TIM1_CC_IRQn, 1, IOCFG_AF_PP_PD, GPIO_AF_6 }, // PWM1 - PA8 { TIM16, IO_TAG(PB8), TIM_Channel_1, TIM1_UP_TIM16_IRQn, 0, IOCFG_AF_PP_PD, GPIO_AF_1 }, // PWM2 - PB8 { TIM17, IO_TAG(PB9), TIM_Channel_1, TIM1_TRG_COM_TIM17_IRQn, 0, IOCFG_AF_PP_PD, GPIO_AF_1 }, // PWM3 - PB9 { TIM8, IO_TAG(PC6), TIM_Channel_1, TIM8_CC_IRQn, 1, IOCFG_AF_PP_PD, GPIO_AF_4 }, // PWM4 - PC6 { TIM8, IO_TAG(PC7), TIM_Channel_2, TIM8_CC_IRQn, 1, IOCFG_AF_PP_PD, GPIO_AF_4 }, // PWM5 - PC7 { TIM8, IO_TAG(PC8), TIM_Channel_3, TIM8_CC_IRQn, 1, IOCFG_AF_PP_PD, GPIO_AF_4 }, // PWM6 - PC8 { TIM3, IO_TAG(PB1), TIM_Channel_4, TIM3_IRQn, 0, IOCFG_AF_PP_PD, GPIO_AF_2 }, // PWM7 - PB1 { TIM3, IO_TAG(PA4), TIM_Channel_2, TIM3_IRQn, 0, IOCFG_AF_PP_PD, GPIO_AF_2 }, // PWM8 - PA2 { TIM4, IO_TAG(PD12), TIM_Channel_1, TIM4_IRQn, 0, IOCFG_AF_PP, GPIO_AF_2 }, // PWM9 - PD12 { TIM4, IO_TAG(PD13), TIM_Channel_2, TIM4_IRQn, 0, IOCFG_AF_PP, GPIO_AF_2 }, // PWM10 - PD13 { TIM4, IO_TAG(PD14), TIM_Channel_3, TIM4_IRQn, 0, IOCFG_AF_PP, GPIO_AF_2 }, // PWM11 - PD14 { TIM4, IO_TAG(PD15), TIM_Channel_4, TIM4_IRQn, 0, IOCFG_AF_PP, GPIO_AF_2 }, // PWM12 - PD15 { TIM2, IO_TAG(PA1), TIM_Channel_2, TIM2_IRQn, 0, IOCFG_AF_PP, GPIO_AF_1 }, // PWM13 - PA1 { TIM2, IO_TAG(PA2), TIM_Channel_3, TIM2_IRQn, 0, IOCFG_AF_PP, GPIO_AF_1 } // PWM14 - PA2 };
/* Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public License as published by the Free Software Foundation. This program is distributed in the hope that it would be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Further, this software is distributed without any warranty that it is free of the rightful claim of any third person regarding infringement or the like. Any license provided herein, whether implied or otherwise, applies only to this software file. Patent licenses, if any, provided herein do not apply to combinations of this program with other software, or any other product whatsoever. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, Mountain View, CA 94043, or: http://www.sgi.com For further information regarding this notice, see: http://oss.sgi.com/projects/GenInfo/NoticeExplan */ #pragma ident "@(#) libfi/mpp_scan/scanmax_sp_6.c 92.1 07/13/99 10:21:33" #include <stdlib.h> #include <liberrno.h> #include <fmath.h> #include <cray/dopevec.h> #include "f90_macros.h" #define RANK 6 /* * Compiler generated call: CALL _SCANMAX_SP6(RES, SRC, STOP, DIM, MASK) * * Purpose: Determine the maximum value of the elements of SRC * along dimension DIM corresponding to the true elements * of MASK. This particular routine handles source arrays * of rank 6 with a data type of 64-bit floating point. * * Arguments: * RES - Dope vector for temporary result array * SRC - Dope vector for user source array * STOP - Dope vector for stop array * DIM - Dimension to operate along * MASK - Dope vector for logical mask array * * Description: * This is the MPP version of SCANMAX. This particular * file contains the the intermediate type-specific * routines. These routines parse and update the dope * vectors, allocate either shared or private space for * the result temporary, and possibly update the shared * data desriptor (sdd) for the result temporary. Once * this set-up work is complete, a Fortran subroutine * is called which uses features from the Fortran * Programming Model to distribute the word across all * processors. * * Include file segmented_scan_p.h contains the rank independent * source code for this routine. */ void _SCANMAX_SP6 ( DopeVectorType *result, DopeVectorType *source, DopeVectorType *stop, long *dim, DopeVectorType *mask) { #include "segmented_scan_p.h" if (stop_flag > 0) { if (mask_flag == 1) { SCANMAX_MASK_SP6@ (result_sdd_ptr, source_sdd_ptr, stop_sdd_ptr, &dim_val, mask_sdd_ptr, src_extents, blkcnts); } else { SCANMAX_NOMASK_SP6@ (result_sdd_ptr, source_sdd_ptr, stop_sdd_ptr, &dim_val, src_extents, blkcnts); } } }