text
stringlengths
4
6.14k
/******************************************************************************** * * * R e g i s t r y C l a s s * * * ********************************************************************************* * Copyright (C) 1998,2002 by Jeroen van der Zijp. All Rights Reserved. * ********************************************************************************* * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public * * License as published by the Free Software Foundation; either * * version 2.1 of the License, or (at your option) any later version. * * * * This library is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * * Lesser General Public License for more details. * * * * You should have received a copy of the GNU Lesser General Public * * License along with this library; if not, write to the Free Software * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * ********************************************************************************* * $Id: FXRegistry.h,v 1.21 2002/01/23 18:53:57 jeroen Exp $ * ********************************************************************************/ #ifndef FXREGISTRY_H #define FXREGISTRY_H #ifndef FXSETTINGS_H #include "FXSettings.h" #endif /** * The registry maintains a database of persistent settings for an application, * or suite of applications. */ class FXAPI FXRegistry : public FXSettings { FXDECLARE(FXRegistry) protected: FXString applicationkey; // Application key FXString vendorkey; // Vendor key FXbool ascii; // ASCII file-based registry protected: FXbool readFromDir(const FXString& dirname,FXbool mark); #ifdef WIN32 FXbool readFromRegistry(void* hRootKey,FXbool mark); FXbool writeToRegistry(void* hRootKey); FXbool readFromRegistryGroup(void* org,const char* groupname,FXbool mark=FALSE); FXbool writeToRegistryGroup(void* org,const char* groupname); #endif private: FXRegistry(const FXRegistry&); FXRegistry &operator=(const FXRegistry&); public: /** * Construct registry object; akey and vkey must be string constants. * Regular applications SHOULD set a vendor key! */ FXRegistry(const FXString& akey=FXString::null,const FXString& vkey=FXString::null); /// Read registry FXbool read(); /// Write registry FXbool write(); /// Return application key const FXString& getAppKey() const { return applicationkey; } /// Return vendor key const FXString& getVendorKey() const { return vendorkey; } /** * Set ASCII mode; under MS-Windows, this will switch the system to a * file-based registry system, instead of using the System Registry API. */ void setAsciiMode(FXbool asciiMode){ ascii=asciiMode; } /// Get ASCII mode FXbool getAsciiMode() const { return ascii; } }; #endif
/* * File: euid_config.h * Author: Panda * * Created on Streda, 2015, júl 22, 15:50 */ #ifndef EDID_CONFIG_H #define EDID_CONFIG_H #include <stdint.h> #include "global.h" #include "spieeprom.h" #include <stdio.h> #include "log.h" #include "hw.h" #define NID_ADRESS 0 #define NID_ADRESS_LEN 5 #define EUID_ADRESS 5 #define EUID_ADRESS_LEN 4 void load_euid_eeprom(); void save_refresh_eeprom(uint16_t val); #endif /* EDID_CONFIG */
// ============================================================================= // PROJECT CHRONO - http://projectchrono.org // // Copyright (c) 2020 projectchrono.org // All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found // in the LICENSE file at the top level of the distribution and at // http://projectchrono.org/license-chrono.txt. // // ============================================================================= #ifndef CH_APICSHARP #define CH_APICSHARP /** @defgroup csharp_module C# module @brief Parsing of Python commands This module generates the C# interface to selected Chrono functionality. This allows using Chrono in a C# program and facilitates interfacing to Unity3D. Currently, this module wraps the multibody functionality in the Chrono core module and the Chrono::Vehicle module. For additional information, see: - the [installation guide](@ref module_csharp_installation) */ #endif
/* Copyright (c) 2012, Movidius Ltd. Released under the BSD 3-clause license. Author: Purdea Andrei <andrei -at- purdea.ro> <andrei.purdea -at- movidius.com> */ /* this file contains stuff used to read an mxml memory structure from an xml file. this is mainly useful because of the special cases involved with binary data.*/ #include "xmlfile2xmlmem.h" #include "common.h" static int count_lines(char *s) { int i = 0; while (*s!=0) { if (*s=='\n') i++; s++; } return i; } static void parse_hexdump_line(char *line, char *eol, char *data, size_t *size) { while (*line!=':' && *line!=0) line++; if (*line==0) return; line ++; // make sure we don't accidentally read part of the text: if (line + 3*16<eol) *(line + 3*16) = 0; unsigned int val; int chars, i; for (i=0;i<16;i++) { if (1==sscanf(line, "%x%n", &val, &chars)) { line += chars; data[*size] = val; (*size) ++; } else break; } } static char *parse_hexdump(char *hex, size_t *size, unsigned int *offset) { *size = 0; int alloc = (count_lines(hex)+1) * 16; char *data = malloc(alloc); sscanf(hex, "%x", offset); while (*hex!=0) { char *eol = hex; while (*eol!='\n' && *eol!=0) eol++; if (*eol==0) { parse_hexdump_line(hex, eol, data, size); break; } else { *eol = 0; parse_hexdump_line(hex, eol, data, size); hex = eol + 1; } } return data; } static void delete_all_children(mxml_node_t *node) { mxml_node_t *n = node->child; while (n!=NULL) { mxml_node_t *next = n->next; mxmlDelete(n); n = next; } } mxml_node_t *xf2xm_load_filename(char *filename) { FILE *fp = fopen(filename, "r"); if (fp==NULL) { printf("ERROR: can't open file: %s\n", filename); return NULL; } mxml_node_t *tree = mxmlLoadFile(NULL, fp, MXML_OPAQUE_CALLBACK); fclose(fp); /* First let's remove all whitespace-only opaque nodes */ mxml_node_t *node; for (node = tree; NULL!=node; node = mxmlWalkNext(node, tree, MXML_DESCEND)) { int exitloop = 0; while (exitloop == 0) { exitloop = 1; if (node->type==MXML_OPAQUE) { char *t = node->value.opaque; while (*t!=0) { if (*t!=' ' && *t!='\t' && *t!='\n' && *t!='\r') break; t++; } if (*t==0) { mxml_node_t *oldnode = node; node = mxmlWalkNext(node, tree, MXML_DESCEND); mxmlDelete(oldnode); if (node!=NULL) exitloop = 0; } } } if (node == NULL) break; } /* Now let's handle <include> nodes and turn them into custom <binary> nodes */ for (node = tree; NULL!=node; node = mxmlWalkNext(node, tree, MXML_DESCEND)) { if (node->type == MXML_ELEMENT && 0==strcmp(node->value.element.name, "include")) { const char *path = mxmlElementGetAttr(node, "path"); FILE *f = fopen(path, "rb"); if (f==NULL) { printf("ERROR: can't open included file: %s\n", path); return NULL; } size_t size; char *data = read_entire_file(f, 102400, &size); fclose(f); mxmlElementDeleteAttr(node, "path"); mxmlSetElement(node, "binary"); binary_t *piece = (binary_t *) malloc(size + 2 * sizeof(size_t)); piece->size = size; piece->offset = 0; // offset information unavailable, but we don't use it anyway memcpy(piece->data, data, size); mxmlNewCustom(node, piece, free); free(data); } } /* Now let's handle <hexdump> nodes and turn them into custom <binary> nodes */ for (node = tree; NULL!=node; node = mxmlWalkNext(node, tree, MXML_DESCEND)) { if (node->type == MXML_OPAQUE && 0==strcmp(node->parent->value.element.name, "hexdump")) { size_t size; unsigned int offset; char *data = parse_hexdump(node->value.opaque, &size, &offset); node = node -> parent; // so that mxmlWalkNext can easily continue. mxmlSetElement(node, "binary"); delete_all_children(node); binary_t *piece = (binary_t *) malloc(size + 2 * sizeof(size_t)); piece->size = size; piece->offset = offset; memcpy(piece->data, data, size); mxmlNewCustom(node, piece, free); free(data); } } return tree; }
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * * THE BSD LICENSE * * 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 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 FRAME_HTTPDIR_H #define FRAME_HTTPDIR_H /* * NSAPIPhase defines the indices of the dt array in an httpd_object. * Each dtable corresponds to a particular phase of NSAPI processing. */ enum NSAPIPhase { NSAPIAuthTrans = 0, NSAPINameTrans, NSAPIPathCheck, NSAPIObjectType, NSAPIService, NSAPIError, NSAPIAddLog, NSAPIRoute, NSAPIDNS, NSAPIConnect, NSAPIFilter, NSAPIInput, NSAPIOutput, NSAPIMaxPhase }; typedef enum NSAPIPhase NSAPIPhase; #define NUM_DIRECTIVES NSAPIMaxPhase PR_BEGIN_EXTERN_C /* * directive_name2num will return the position of the abbreviated directive * dir in the directive table. * * If dir does not exist in the table, it will return -1. */ NSAPI_PUBLIC int directive_name2num(const char *dir); /* * directive_num2name returns a string describing directive number num. */ NSAPI_PUBLIC const char *directive_num2name(int num); PR_END_EXTERN_C #endif /* FRAME_HTTPDIR_H */
/*- * Copyright (c) 2008, Jeffrey Roberson <jeff@freebsd.org> * All rights reserved. * * Copyright (c) 2008 Nokia Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice unmodified, this list of conditions, and the following * disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SYS_CPUSET_H_ #define _SYS_CPUSET_H_ #include <sys/_cpuset.h> #include <sys/bitset.h> #define CPUSETBUFSIZ ((2 + sizeof(long) * 2) * _NCPUWORDS) #define CPU_CLR(n, p) BIT_CLR(CPU_SETSIZE, n, p) #define CPU_COPY(f, t) BIT_COPY(CPU_SETSIZE, f, t) #define CPU_ISSET(n, p) BIT_ISSET(CPU_SETSIZE, n, p) #define CPU_SET(n, p) BIT_SET(CPU_SETSIZE, n, p) #define CPU_ZERO(p) BIT_ZERO(CPU_SETSIZE, p) #define CPU_FILL(p) BIT_FILL(CPU_SETSIZE, p) #define CPU_SETOF(n, p) BIT_SETOF(CPU_SETSIZE, n, p) #define CPU_EMPTY(p) BIT_EMPTY(CPU_SETSIZE, p) #define CPU_ISFULLSET(p) BIT_ISFULLSET(CPU_SETSIZE, p) #define CPU_SUBSET(p, c) BIT_SUBSET(CPU_SETSIZE, p, c) #define CPU_OVERLAP(p, c) BIT_OVERLAP(CPU_SETSIZE, p, c) #define CPU_CMP(p, c) BIT_CMP(CPU_SETSIZE, p, c) #define CPU_OR(d, s) BIT_OR(CPU_SETSIZE, d, s) #define CPU_AND(d, s) BIT_AND(CPU_SETSIZE, d, s) #define CPU_NAND(d, s) BIT_NAND(CPU_SETSIZE, d, s) #define CPU_CLR_ATOMIC(n, p) BIT_CLR_ATOMIC(CPU_SETSIZE, n, p) #define CPU_SET_ATOMIC(n, p) BIT_SET_ATOMIC(CPU_SETSIZE, n, p) #define CPU_AND_ATOMIC(n, p) BIT_AND_ATOMIC(CPU_SETSIZE, n, p) #define CPU_OR_ATOMIC(d, s) BIT_OR_ATOMIC(CPU_SETSIZE, d, s) #define CPU_COPY_STORE_REL(f, t) BIT_COPY_STORE_REL(CPU_SETSIZE, f, t) #define CPU_FFS(p) BIT_FFS(CPU_SETSIZE, p) /* * Valid cpulevel_t values. */ #define CPU_LEVEL_ROOT 1 /* All system cpus. */ #define CPU_LEVEL_CPUSET 2 /* Available cpus for which. */ #define CPU_LEVEL_WHICH 3 /* Actual mask/id for which. */ /* * Valid cpuwhich_t values. */ #define CPU_WHICH_TID 1 /* Specifies a thread id. */ #define CPU_WHICH_PID 2 /* Specifies a process id. */ #define CPU_WHICH_CPUSET 3 /* Specifies a set id. */ #define CPU_WHICH_IRQ 4 /* Specifies an irq #. */ #define CPU_WHICH_JAIL 5 /* Specifies a jail id. */ /* * Reserved cpuset identifiers. */ #define CPUSET_INVALID -1 #define CPUSET_DEFAULT 0 #ifdef _KERNEL LIST_HEAD(setlist, cpuset); /* * cpusets encapsulate cpu binding information for one or more threads. * * a - Accessed with atomics. * s - Set at creation, never modified. Only a ref required to read. * c - Locked internally by a cpuset lock. * * The bitmask is only modified while holding the cpuset lock. It may be * read while only a reference is held but the consumer must be prepared * to deal with inconsistent results. */ struct cpuset { cpuset_t cs_mask; /* bitmask of valid cpus. */ volatile u_int cs_ref; /* (a) Reference count. */ int cs_flags; /* (s) Flags from below. */ cpusetid_t cs_id; /* (s) Id or INVALID. */ struct cpuset *cs_parent; /* (s) Pointer to our parent. */ LIST_ENTRY(cpuset) cs_link; /* (c) All identified sets. */ LIST_ENTRY(cpuset) cs_siblings; /* (c) Sibling set link. */ struct setlist cs_children; /* (c) List of children. */ }; #define CPU_SET_ROOT 0x0001 /* Set is a root set. */ #define CPU_SET_RDONLY 0x0002 /* No modification allowed. */ extern cpuset_t *cpuset_root; struct prison; struct proc; struct cpuset *cpuset_thread0(void); struct cpuset *cpuset_ref(struct cpuset *); void cpuset_rel(struct cpuset *); int cpuset_setthread(lwpid_t id, cpuset_t *); int cpuset_create_root(struct prison *, struct cpuset **); int cpuset_setproc_update_set(struct proc *, struct cpuset *); char *cpusetobj_strprint(char *, const cpuset_t *); int cpusetobj_strscan(cpuset_t *, const char *); #ifdef DDB void ddb_display_cpuset(const cpuset_t *); #endif #else __BEGIN_DECLS int cpuset(cpusetid_t *); int cpuset_setid(cpuwhich_t, id_t, cpusetid_t); int cpuset_getid(cpulevel_t, cpuwhich_t, id_t, cpusetid_t *); int cpuset_getaffinity(cpulevel_t, cpuwhich_t, id_t, size_t, cpuset_t *); int cpuset_setaffinity(cpulevel_t, cpuwhich_t, id_t, size_t, const cpuset_t *); __END_DECLS #endif #endif /* !_SYS_CPUSET_H_ */
#pragma once #include <cmath> #include <memory> namespace megamol { namespace remote { template<int DIM> struct vec { static_assert(DIM > 0, "Zero dimensional vector not allowed"); std::unique_ptr<float[]> coord_; vec(void) : coord_{new float[DIM]} {}; vec(float coord[DIM]) : vec{} { std::copy(coord, coord + DIM, coord_.get()); } vec(vec const& rhs) : vec{} { std::copy(rhs.coord_.get(), rhs.coord_.get() + DIM, coord_.get()); } vec& operator=(vec const& rhs) { std::copy(rhs.coord_.get(), rhs.coord_.get() + DIM, coord_.get()); return *this; } vec& operator=(float coord[DIM]) { std::copy(coord, coord + DIM, coord_.get()); return *this; } float& operator[](size_t idx) { return coord_[idx]; } }; template<int DIM> using vec_t = vec<DIM>; template<int DIM> struct box { vec_t<DIM> lower_; vec_t<DIM> upper_; box(void) : lower_{}, upper_{} {}; box(float lower[DIM], float upper[DIM]) : lower_{}, upper_{} { lower_ = lower; upper_ = upper; } box& operator=(float rhs[2 * DIM]) { for (int d = 0; d < DIM; ++d) { lower_[d] = rhs[d]; } for (int d = 0; d < DIM; ++d) { upper_[d] = rhs[d + DIM]; } return *this; } float volume() { float ret{0.0f}; for (int i = 0; i < DIM; ++i) { ret *= upper_[i] - lower_[i]; } return ret; } box& unite(box& rhs) { for (int d = 0; d < DIM; ++d) { lower_[d] = fmin(lower_[d], rhs.lower_[d]); upper_[d] = fmax(upper_[d], rhs.upper_[d]); } return *this; } float& operator[](int idx) { if (idx < DIM) { return lower_[idx]; } else { return upper_[idx - DIM]; } } }; using bbox_t = box<3>; using viewp_t = box<2>; enum fbo_color_type : unsigned int { RGBAf, RGBAu8, RGBf, RGBu8 }; enum fbo_depth_type : unsigned int { Df, Du16, Du24, Du32 }; using data_ptr = char*; using id_t = unsigned int; struct fbo_msg_header { // node id id_t node_id; // frame id id_t frame_id; // obbox float os_bbox[6]; // cbbox float cs_bbox[6]; // frame_times float frame_times[2]; /// [0] requested time, [1] time frames count // cam_params float cam_params[9]; /// [0]-[2] position, [3]-[5] up, [6]-[8] lookat // viewport int screen_area[4]; // updated viewport int updated_area[4]; // fbo color type fbo_color_type color_type; // fbo depth type fbo_depth_type depth_type; // color buf size size_t color_buf_size; // depth buf size size_t depth_buf_size; }; using fbo_msg_header_t = fbo_msg_header; struct fbo_msg { fbo_msg() = default; explicit fbo_msg(fbo_msg_header_t&& header, std::vector<char>&& col, std::vector<char>&& depth) : fbo_msg_header{std::forward<fbo_msg_header_t>(header)} , color_buf{std::forward<std::vector<char>>(col)} , depth_buf{std::forward<std::vector<char>>(depth)} {} fbo_msg_header_t fbo_msg_header; std::vector<char> color_buf; std::vector<char> depth_buf; }; using fbo_msg_t = fbo_msg; } // end namespace remote } // end namespace megamol
#ifndef SIMULATION_GUI_H #define SIMULATION_GUI_H #include <Klampt/Simulation/Simulator.h> #include "WorldGUI.h" #include <set> namespace Klampt { /** @brief Generic simulation program. * * To set up the world and simulation from a command line, call LoadAndInitSim(). * To set up the simulation from a world, just InitSim(). * To change the default controller, override the InitController(int i) method. * * Messages are defined as follows. * * command: * - simulate(active): turns simulation on or off * - toggle_simulate(): toggles simulation activity value * - reset(): resets the simulation * - load_file(file): loads an entity (object,robot,mesh,path,state) into * the simulation. * - load_path(file): loads a path (.path,.xml,.milestones). * - load_state(file): loads a simulation state from file * - save_state(file): saves a simulation state to file * - load_view(file): loads a previously saved view (inherited from GLNavigationProgram) * - save_view(file): saves a view to a file (inherited from GLNavigationProgram) * - connect_serial_controller(robot,port,rate): connects a robot (index) to a SerialController on the given * port (listens for open TCP connections on localhost:port). The controller will write at the indicated * rate (in Hz). * - output_ros([prefix]): outputs the simulation information to ROS with the given prefix under the tf * module, and the robot's commanded / sensed JointState under [prefix]/[robot name]/commanded_joint_state * / sensed_joint_state. * * In the current format, elements in the world should not be added/deleted after initialization. */ class SimGUIBackend : public WorldGUIBackend { public: typedef GLNavigationBackend BaseT; int simulate; Simulator sim; string initialState; ///the contact state on the last DoContactStateLogging call set<pair<int,int> > inContact; SimGUIBackend(WorldModel* world) :WorldGUIBackend(world),simulate(0) {} virtual bool OnCommand(const string& cmd,const string& args); ///Loads from a world XML file bool LoadAndInitSim(const char* xmlFile); ///Loads from a command line bool LoadAndInitSim(int argc,const char** argv); ///Loads some file, figuring out the type from the extension bool LoadFile(const char* fn); ///Loads some file, figuring out the type from the extension bool LoadPath(const char* fn); ///Initializes simulation default controllers, sensors, and contact feedback virtual void InitSim(); ///Initializes default controllers and sensors for the indicated robot virtual void InitController(int robot); ///Initializes all contact feedback virtual void InitContactFeedbackAll(); ///Connects a robot to a SerialController listening for new connections on the given port void ConnectSerialController(int robot,int port=3456,Real writeRate=10); ///Returns the simulation to its initial state void ResetSim(); ///Renders the state of the simulation virtual void RenderWorld(); ///Sets the colors of robots to indicate force magnitudes void SetForceColors(); ///Sets the colors of robots to indicate torque magnitudes void SetTorqueColors(); ///Renders the simulation clock (when in screen mode) void DrawClock(int x,int y); ///Draws sensor readings on the world visualization. ///If robot < 0, draws all the robots/sensors. ///If sensor < 0, draws all the sensors on the given robot. void DrawSensor(int robot=-1,int sensor=-1); ///Draws contact points void DrawContacts(Real pointSize = 5.0, Real fscale = 0.01, Real nscale=0.05); ///Draws wrenches void DrawWrenches(Real fscale=-1); ///Loads and sends a milestone path file bool LoadMilestones(const char* fn); ///Loads and sends a linear path file bool LoadLinearPath(const char* fn); ///Loads a simulation state file bool LoadState(const char* fn); ///Loads a multipath file and possibly discretizes it into a fine-grained linear path before sending bool LoadMultiPath(const char* fn,bool constrainedInterpolate=true,Real interpolateTolerance=1e-2,Real durationScale=1.0); ///Sends a linear path to the controller. The path starts pathDelay ///seconds after the current time bool SendLinearPath(const vector<Real>& times,const vector<Config>& milestones,Real pathDelay=0.1); ///Outputs simulation data to ROS with the given prefix bool OutputROS(const char* prefix="klampt"); ///Logs the state of all objects in the world to the given CSV file void DoLogging(const char* fn="simtest_log.csv"); ///Logs the robot's commands to the given linear path file void DoCommandLogging_LinearPath(int robot,const char* fn="simtest_command_log.path"); ///Logs the robot's sensed configuration to the given linear path file void DoSensorLogging_LinearPath(int robot,const char* fn="simtest_sensed_log.path"); ///Logs the robot's simulation state to the given linear path file void DoStateLogging_LinearPath(int robot,const char* fn="simtest_state_log.path"); ///Logs contact changes to the given CSV file void DoContactStateLogging(const char* fn="simtest_contact_log.csv"); ///Logs contact wrenches to the given CSV file void DoContactWrenchLogging(const char* fn="simtest_wrench_log.csv"); }; } // namespace Klampt #endif
#ifndef TOOLBOX_H_ #define TOOLBOX_H_ #include <glui.h> #include <string> namespace view { class Toolbox { public: struct Parameter { float *angle1; float *angle2; float *angle3; int *torque1; int *torque2; int *torque3; float *rotationMatrix; }; Toolbox(int windowId, void (*idle)(void), Parameter parameter); virtual ~Toolbox(); void sync(); private: GLUI *glui; GLUI_EditText *angle1; GLUI_EditText *angle2; GLUI_EditText *angle3; GLUI_Spinner *torque1; GLUI_Spinner *torque2; GLUI_Spinner *torque3; GLUI_Rotation *forceDirection; }; } #endif /*TOOLBOX_H_*/
/*********************************************************************** filename: CEGUIFalXMLEnumHelper.h created: Mon Jul 18 2005 author: Paul D Turner <paul@cegui.org.uk> *************************************************************************/ /*************************************************************************** * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team * * 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 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 _CEGUIFalXMLEnumHelper_h_ #define _CEGUIFalXMLEnumHelper_h_ #include "CEGUIString.h" #include "CEGUIWindow.h" #include "falagard/CEGUIFalEnums.h" // Start of CEGUI namespace section namespace CEGUI { /*! \brief Utility helper class primarily intended for use by the falagard xml parser. */ class CEGUIEXPORT FalagardXMLHelper { public: static VerticalFormatting stringToVertFormat(const String& str); static HorizontalFormatting stringToHorzFormat(const String& str); static VerticalAlignment stringToVertAlignment(const String& str); static HorizontalAlignment stringToHorzAlignment(const String& str); static DimensionType stringToDimensionType(const String& str); static VerticalTextFormatting stringToVertTextFormat(const String& str); static HorizontalTextFormatting stringToHorzTextFormat(const String& str); static FontMetricType stringToFontMetricType(const String& str); static DimensionOperator stringToDimensionOperator(const String& str); static FrameImageComponent stringToFrameImageComponent(const String& str); static String vertFormatToString(VerticalFormatting format); static String horzFormatToString(HorizontalFormatting format); static String vertAlignmentToString(VerticalAlignment alignment); static String horzAlignmentToString(HorizontalAlignment alignment); static String dimensionTypeToString(DimensionType dim); static String vertTextFormatToString(VerticalTextFormatting format); static String horzTextFormatToString(HorizontalTextFormatting format); static String fontMetricTypeToString(FontMetricType metric); static String dimensionOperatorToString(DimensionOperator op); static String frameImageComponentToString(FrameImageComponent imageComp); }; } // End of CEGUI namespace section #endif // end of guard _CEGUIFalXMLEnumHelper_h_
/* * calibrateCameraHelpers.h * * function: classes and functions for calibrateCamera module * * author: Jannik Beyerstedt * modified from: http://docs.opencv.org/2.4/doc/tutorials/calib3d/camera_calibration/camera_calibration.html */ #ifndef SRC_CALIBRATECAMERA_HELPERS_H_ #define SRC_CALIBRATECAMERA_HELPERS_H_ #include "DataFormats.h" //#include "Logger.h" #include "calibrateCamera_Settings.h" #include <opencv2/core/core.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/calib3d/calib3d.hpp> #include <opencv2/highgui/highgui.hpp> using namespace cv; #include <iostream> #include <sstream> #include <time.h> #include <stdio.h> static void read(const FileNode& node, DistCalibSettings& x, const DistCalibSettings& default_value = DistCalibSettings()) { if (node.empty()) { x = default_value; } else { x.read(node); } } static double computeReprojectionErrors(const std::vector<std::vector<Point3f> >& objectPoints, const std::vector<std::vector<Point2f> >& imagePoints, const std::vector<Mat>& rvecs, const std::vector<Mat>& tvecs, const Mat& cameraMatrix, const Mat& distCoeffs, std::vector<float>& perViewErrors) { std::vector<Point2f> imagePoints2; int i, totalPoints = 0; double totalErr = 0, err; perViewErrors.resize(objectPoints.size()); for (i = 0; i < (int) objectPoints.size(); ++i) { projectPoints(Mat(objectPoints[i]), rvecs[i], tvecs[i], cameraMatrix, distCoeffs, imagePoints2); err = norm(Mat(imagePoints[i]), Mat(imagePoints2), CV_L2); int n = (int) objectPoints[i].size(); perViewErrors[i] = (float) std::sqrt(err * err / n); totalErr += err * err; totalPoints += n; } return std::sqrt(totalErr / totalPoints); } static void calcBoardCornerPositions(Size boardSize, float squareSize, std::vector<Point3f>& corners, DistCalibSettings::Pattern patternType /*= Settings::CHESSBOARD*/) { corners.clear(); switch (patternType) { case DistCalibSettings::CHESSBOARD: case DistCalibSettings::CIRCLES_GRID: for (int i = 0; i < boardSize.height; ++i) { for (int j = 0; j < boardSize.width; ++j) { corners.push_back(Point3f(float(j * squareSize), float(i * squareSize), 0)); } } break; case DistCalibSettings::ASYMMETRIC_CIRCLES_GRID: for (int i = 0; i < boardSize.height; i++) { for (int j = 0; j < boardSize.width; j++) { corners.push_back(Point3f(float((2 * j + i % 2) * squareSize), float(i * squareSize), 0)); } } break; default: break; } } bool runCalibration(DistCalibSettings& s, Size imageSize, Mat& cameraMatrix, Mat& distCoeffs, std::vector<std::vector<Point2f> > imagePoints) { std::vector<Mat> rvecs, tvecs; std::vector<float> reprojErrs; double totalAvgErr = 0; // --> compute cameraMatrix = Mat::eye(3, 3, CV_64F); if (s.flag & CV_CALIB_FIX_ASPECT_RATIO) { cameraMatrix.at<double>(0, 0) = 1.0; } distCoeffs = Mat::zeros(8, 1, CV_64F); std::vector<std::vector<Point3f> > objectPoints(1); calcBoardCornerPositions(s.boardSize, s.squareSize, objectPoints[0], s.calibrationPattern); objectPoints.resize(imagePoints.size(), objectPoints[0]); //Find intrinsic and extrinsic camera parameters double rms = calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs, rvecs, tvecs, s.flag | CV_CALIB_FIX_K4 | CV_CALIB_FIX_K5); std::cout << "Re-projection error reported by calibrateCamera: " << rms << std::endl; bool ok = checkRange(cameraMatrix) && checkRange(distCoeffs); totalAvgErr = computeReprojectionErrors(objectPoints, imagePoints, rvecs, tvecs, cameraMatrix, distCoeffs, reprojErrs); // <-- end compute std::cout << (ok ? "Calibration succeeded" : "Calibration failed") << ". avg re projection error = " << totalAvgErr << std::endl; return ok; } #endif /* SRC_CALIBRATECAMERA_HELPERS_H_ */
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #import "ABI43_0_0RCTBaseTextInputViewManager.h" NS_ASSUME_NONNULL_BEGIN @interface ABI43_0_0RCTMultilineTextInputViewManager : ABI43_0_0RCTBaseTextInputViewManager @end NS_ASSUME_NONNULL_END
// #include <stdio.h> #include <math.h> int main(void) { int a, b, c, d; printf("Please enter 4 numbers separated by spaces > "); scanf("%d%d%d%d", &a, &b, &c, &d); if (a>b) if (b>c) if (c>d) printf("%d is the smallest\n", d); else printf("%d is the smallest\n", c); else if (b>d) printf("%d is the smallest\n", d); else printf("%d is the smallest\n", b); else if (a>c) if (d>c) printf("%d is the smallest\n", c); else printf("%d is the smallest\n", d); else if (a>d) printf("%d is the smallest\n", d); else printf("%d is the smallest\n", a); return(0); }
// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_H_ #define CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_H_ #include "base/memory/scoped_vector.h" #include "base/threading/non_thread_safe.h" #include "cc/output/software_output_device.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/surface/transport_dib.h" namespace content { // This class can be created only on the main thread, but then becomes pinned // to a fixed thread when BindToClient is called. class CompositorSoftwareOutputDevice : NON_EXPORTED_BASE(public cc::SoftwareOutputDevice), NON_EXPORTED_BASE(public base::NonThreadSafe) { public: CompositorSoftwareOutputDevice(); virtual ~CompositorSoftwareOutputDevice(); virtual void Resize(gfx::Size size) OVERRIDE; virtual SkCanvas* BeginPaint(gfx::Rect damage_rect) OVERRIDE; virtual void EndPaint(cc::SoftwareFrameData* frame_data) OVERRIDE; virtual void ReclaimDIB(const TransportDIB::Id& id) OVERRIDE; private: TransportDIB* CreateDIB(); int front_buffer_; int num_free_buffers_; ScopedVector<TransportDIB> dibs_; ScopedVector<TransportDIB> awaiting_ack_; SkBitmap bitmap_; uint32 sequence_num_; }; } // namespace content #endif // CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_H_
/* Copyright (c) 2011, The Mineserver Project All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the The Mineserver Project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef MINESERVER_NETWORK_PACKET_0x47_H #define MINESERVER_NETWORK_PACKET_0x47_H #include <mineserver/byteorder.h> #include <mineserver/network/message.h> namespace Mineserver { struct Network_Message_0x47 : public Mineserver::Network_Message { int32_t entityId; bool unknown; int32_t x; int32_t y; int32_t z; }; } #endif
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_PERMISSIONS_FAKE_BLUETOOTH_CHOOSER_CONTROLLER_H_ #define COMPONENTS_PERMISSIONS_FAKE_BLUETOOTH_CHOOSER_CONTROLLER_H_ #include <string> #include "base/macros.h" #include "components/permissions/chooser_controller.h" #include "testing/gmock/include/gmock/gmock.h" namespace permissions { // A subclass of ChooserController that pretends to be a Bluetooth device // chooser for testing. The result should be visually similar to the real // version of the dialog for interactive tests. class FakeBluetoothChooserController : public ChooserController { public: enum class BluetoothStatus { UNAVAILABLE, IDLE, SCANNING, }; enum ConnectionStatus { NOT_CONNECTED = false, CONNECTED = true, }; enum PairStatus { NOT_PAIRED = false, PAIRED = true, }; static constexpr int kSignalStrengthUnknown = -1; static constexpr int kSignalStrengthLevel0 = 0; static constexpr int kSignalStrengthLevel1 = 1; static constexpr int kSignalStrengthLevel2 = 2; static constexpr int kSignalStrengthLevel3 = 3; static constexpr int kSignalStrengthLevel4 = 4; struct FakeDevice { std::string name; bool connected; bool paired; int signal_strength; }; explicit FakeBluetoothChooserController(std::vector<FakeDevice> devices = {}); FakeBluetoothChooserController(const FakeBluetoothChooserController&) = delete; FakeBluetoothChooserController& operator=( const FakeBluetoothChooserController&) = delete; ~FakeBluetoothChooserController() override; // ChooserController: bool ShouldShowIconBeforeText() const override; bool ShouldShowReScanButton() const override; std::u16string GetNoOptionsText() const override; std::u16string GetOkButtonLabel() const override; std::pair<std::u16string, std::u16string> GetThrobberLabelAndTooltip() const override; bool TableViewAlwaysDisabled() const override; size_t NumOptions() const override; int GetSignalStrengthLevel(size_t index) const override; std::u16string GetOption(size_t index) const override; bool IsConnected(size_t index) const override; bool IsPaired(size_t index) const override; MOCK_METHOD0(RefreshOptions, void()); MOCK_METHOD1(Select, void(const std::vector<size_t>& indices)); MOCK_METHOD0(Cancel, void()); MOCK_METHOD0(Close, void()); MOCK_CONST_METHOD0(OpenHelpCenterUrl, void()); MOCK_CONST_METHOD0(OpenAdapterOffHelpUrl, void()); void SetBluetoothStatus(BluetoothStatus status); void SetBluetoothPermission(bool has_permission); void AddDevice(FakeDevice device); void RemoveDevice(size_t index); void UpdateDevice(size_t index, FakeDevice new_device); void set_table_view_always_disabled(bool table_view_always_disabled) { table_view_always_disabled_ = table_view_always_disabled; } private: std::vector<FakeDevice> devices_; bool table_view_always_disabled_ = false; }; } // namespace permissions #endif // COMPONENTS_PERMISSIONS_FAKE_BLUETOOTH_CHOOSER_CONTROLLER_H_
// // HttpConnection.h // MobileWeather // // Copyright (c) 2013-2015 Ford Motor Company. All rights reserved. // #import <Foundation/Foundation.h> typedef enum : NSUInteger { HttpConnectionRequestMethodGET, HttpConnectionRequestMethodPUT, HttpConnectionRequestMethodPOST, HttpConnectionRequestMethodDELETE, } HttpConnectionRequestMethod; @interface HttpConnection : NSObject /** * Returns the result of a HTTP request. * * @param url The request URL. * @param method The type of HTTP request to perform. * @param data The data to send to the server. * @param contentType The content type describing the data. * @return The result of the request. */ - (NSData *)sendRequestForURL:(NSURL *)url withMethod:(HttpConnectionRequestMethod)requestMethod withData:(NSData *)contentData ofType:(NSString *)contentType; /** * Checks for a HTTP error message from the requesting method. * * @param statusString The results of the request. * @return The HTTP error message, if any occurred. */ - (NSString *)getErrorMessageFromStatusString:(NSString *)statusString; /** * Converts an HTTP error message from the requesting method into the HTTP status code. * * @param statusString The results from the request. * @return The HTTP status code. */ - (NSInteger)getStatusCodeFromStatusString:(NSString *)statusString; @end
/** * @author Dominic Eschweiler <dominic@eschweiler.at> * * @section LICENSE * * Copyright (c) 2015, Dominic Eschweiler * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * */ #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <string.h> #include <unistd.h> #include <errno.h> #include <inttypes.h> #include <sys/mman.h> #include <time.h> #include <pda.h> #define DMA_BUFFER_SIZE 1024 * 1024 #define NUMBER_BUFFERS 6 #define REMOVE_INDEX 3 size_t get_mb ( char *string ) { uint64_t amount; sscanf(string, "%" PRIu64, &amount); printf("MB = %s\n", string); return(1024 * 1024 * amount); } uint64_t timediff_ms(struct timespec start, struct timespec end) { uint64_t elapsed = (end.tv_sec - start.tv_sec) * 1000000000; elapsed += (end.tv_nsec - start.tv_nsec); return elapsed / 1000000; } int main ( int argc, char *argv[] ) { if(PDAInit() != PDA_SUCCESS) { printf("Error while initialization!\n"); abort(); } /** A list of PCI ID to which PDA has to attach */ const char *pci_ids[] = { "10dc 01a0", /* CRORC as registered at CERN */ NULL /* Delimiter*/ }; /** The device operator manages all devices with the given IDs. */ DeviceOperator *dop = DeviceOperator_new(pci_ids, PDA_ENUMERATE_DEVICES); if(dop == NULL) { printf("Unable to get device-operator!\n"); return -1; } /** Get a device object for the first found device in the list. */ PciDevice *device = NULL; if(PDA_SUCCESS != DeviceOperator_getPciDevice(dop, &device, 0) ) { if(PDA_SUCCESS != DeviceOperator_delete( dop, PDA_DELETE ) ) { printf("Device generation totally failed!\n"); return -1; } printf("Can't get device!\n"); return -1; } /** Get a dma buffer */ DMABuffer *buffer_pointer = NULL; for(uint64_t i = 0; i < NUMBER_BUFFERS; i++) { buffer_pointer = NULL; if(PDA_SUCCESS != PciDevice_getDMABuffer(device, i, &buffer_pointer) ) { printf("TEST FAILED (getDMABuffer)!\n"); return -1; } } printf("PDA BUFFER RECONNECT TEST SUCCESSFUL!\n"); return DeviceOperator_delete( dop, PDA_DELETE_PERSISTANT ); }
/*========================================================================= Program: Visualization Toolkit Module: vtkUnstructuredGridVolumeMapper.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkUnstructuredGridVolumeMapper - Abstract class for a unstructured grid volume mapper // .SECTION Description // vtkUnstructuredGridVolumeMapper is the abstract definition of a volume mapper for // unstructured data (vtkUnstructuredGrid). Several basic types of volume mappers // are supported as subclasses // .SECTION see also // vtkUnstructuredGridVolumeRayCastMapper #ifndef __vtkUnstructuredGridVolumeMapper_h #define __vtkUnstructuredGridVolumeMapper_h #include "vtkRenderingVolumeModule.h" // For export macro #include "vtkAbstractVolumeMapper.h" class vtkRenderer; class vtkVolume; class vtkUnstructuredGridBase; class vtkWindow; class VTKRENDERINGVOLUME_EXPORT vtkUnstructuredGridVolumeMapper : public vtkAbstractVolumeMapper { public: vtkTypeMacro(vtkUnstructuredGridVolumeMapper,vtkAbstractVolumeMapper); void PrintSelf( ostream& os, vtkIndent indent ); // Description: // Set/Get the input data virtual void SetInputData( vtkUnstructuredGridBase * ); virtual void SetInputData( vtkDataSet * ); vtkUnstructuredGridBase *GetInput(); vtkSetMacro( BlendMode, int ); void SetBlendModeToComposite() { this->SetBlendMode( vtkUnstructuredGridVolumeMapper::COMPOSITE_BLEND ); } void SetBlendModeToMaximumIntensity() { this->SetBlendMode( vtkUnstructuredGridVolumeMapper::MAXIMUM_INTENSITY_BLEND ); } vtkGetMacro( BlendMode, int ); //BTX // Description: // WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE // DO NOT USE THIS METHOD OUTSIDE OF THE RENDERING PROCESS // Render the volume virtual void Render(vtkRenderer *ren, vtkVolume *vol)=0; // Description: // WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE // Release any graphics resources that are being consumed by this mapper. // The parameter window could be used to determine which graphic // resources to release. virtual void ReleaseGraphicsResources(vtkWindow *) {}; enum { COMPOSITE_BLEND, MAXIMUM_INTENSITY_BLEND }; //ETX protected: vtkUnstructuredGridVolumeMapper(); ~vtkUnstructuredGridVolumeMapper(); int BlendMode; virtual int FillInputPortInformation(int, vtkInformation*); private: vtkUnstructuredGridVolumeMapper(const vtkUnstructuredGridVolumeMapper&); // Not implemented. void operator=(const vtkUnstructuredGridVolumeMapper&); // Not implemented. }; #endif
#include "../../../build_defs.h" #include <stdint.h> uint16_t crc16_update(uint16_t crc, uint8_t a) { int i; crc ^= a; for (i = 0; i < 8; ++i) { if (crc & 1) crc = (crc >> 1) ^ 0xA001; else crc = (crc >> 1); } return crc; }
/* * Copyright (c) 2016, The OpenThread Authors. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /** * @file * This file includes the platform-specific initializers. */ #include <assert.h> #include <stdint.h> #include <openthread/openthread.h> #include <openthread/platform/alarm-milli.h> #include <openthread/platform/uart.h> #include "platform-da15000.h" #include "sdk_defs.h" #include "ftdf.h" #include "hw_cpm.h" #include "hw_gpio.h" #include "hw_qspi.h" #include "hw_otpc.h" #include "hw_watchdog.h" static bool sBlink = false; static int sMsCounterInit; static int sMsCounter; #define ALIVE_LED_PERIOD (50000) #define ALIVE_LED_DUTY (500) #define LEADER_BLINK_TIME (200) #define ROUTER_BLINK_TIME (500) #define CHILD_BLINK_TIME (2000) #define SET_CLOCK_TO_96MHZ otInstance *sInstance; void ClkInit(void) { NVIC_ClearPendingIRQ(XTAL16RDY_IRQn); NVIC_EnableIRQ(XTAL16RDY_IRQn); // Activate XTAL16 Ready IRQ hw_cpm_set_divn(false); // External crystal is 16MHz hw_cpm_enable_rc32k(); hw_cpm_lp_set_rc32k(); hw_cpm_set_xtal16m_settling_time(dg_configXTAL16_SETTLE_TIME_RC32K); hw_cpm_enable_xtal16m(); // Enable XTAL16M hw_cpm_configure_xtal32k_pins(); // Configure XTAL32K pins hw_cpm_configure_xtal32k(); // Configure XTAL32K hw_cpm_enable_xtal32k(); // Enable XTAL32K hw_watchdog_unfreeze(); // Start watchdog while (!hw_cpm_is_xtal16m_started()); // Block until XTAL16M starts hw_watchdog_freeze(); // Stop watchdog hw_cpm_set_recharge_period((uint16_t)dg_configSET_RECHARGE_PERIOD); hw_watchdog_unfreeze(); // Start watchdog hw_cpm_pll_sys_on(); // Turn on PLL hw_watchdog_freeze(); // Stop watchdog hw_qspi_set_div(HW_QSPI_DIV_2); // Set QSPI div by 2 hw_cpm_disable_pll_divider(); // Disable divider (div by 2) hw_cpm_set_sysclk(SYS_CLK_IS_PLL); hw_cpm_set_hclk_div(ahb_div2); hw_cpm_set_pclk_div(0); hw_otpc_init(); hw_otpc_set_speed(HW_OTPC_SYS_CLK_FREQ_48); } /* * Example function. Blink LED according to node state * Leader - 5Hz * Router - 2Hz * Child - 0.5Hz */ void ExampleProcess(otInstance *aInstance) { static int aliveLEDcounter = 0; otDeviceRole devRole; static int thrValue; devRole = otThreadGetDeviceRole(aInstance); if (sBlink == false && otPlatAlarmMilliGetNow() != 0) { sMsCounterInit = otPlatAlarmMilliGetNow(); sBlink = true; } sMsCounter = otPlatAlarmMilliGetNow() - sMsCounterInit; switch (devRole) { case OT_DEVICE_ROLE_LEADER: thrValue = LEADER_BLINK_TIME; break; case OT_DEVICE_ROLE_ROUTER: thrValue = ROUTER_BLINK_TIME; break; case OT_DEVICE_ROLE_CHILD: thrValue = CHILD_BLINK_TIME; break; default: thrValue = 0x00; } if ((thrValue != 0x00) && (sMsCounter >= thrValue)) { hw_gpio_toggle(HW_GPIO_PORT_1, HW_GPIO_PIN_5); sMsCounterInit = otPlatAlarmMilliGetNow(); } if (thrValue == 0) { // No specific role, let's generate 'alive blink' // to inform that we are running. // Loop counter is used to run even if timers // are not initialized yet. aliveLEDcounter++; if (aliveLEDcounter > ALIVE_LED_PERIOD) { aliveLEDcounter = 0; hw_gpio_set_active(HW_GPIO_PORT_1, HW_GPIO_PIN_5); } if (aliveLEDcounter > ALIVE_LED_DUTY) { hw_gpio_set_inactive(HW_GPIO_PORT_1, HW_GPIO_PIN_5); } } } void PlatformInit(int argc, char *argv[]) { // Initialize System Clock ClkInit(); // Initialize Random number generator da15000RandomInit(); // Initialize Alarm da15000AlarmInit(); // Initialize Radio da15000RadioInit(); // enable interrupts portENABLE_INTERRUPTS(); (void)argc; (void)argv; } void PlatformProcessDrivers(otInstance *aInstance) { sInstance = aInstance; da15000UartProcess(); da15000RadioProcess(aInstance); da15000AlarmProcess(aInstance); ExampleProcess(aInstance); }
#ifndef _OUTPUTPROBES_H_ #define _OUTPUTPROBES_H_ #include "Output.h" #include "Grid.h" #include "Array.h" #include <vector> #include <string> using std::string; using std::vector; namespace ibpm { /*! \file OutputProbes.h \class OutputProbes \brief Write velocities, fluxes, and vorticity, at given probe locations, to files. Each probe has a corresponding output file. All probes are supposed to be located at the interior nodes at the finest grid level (level 0). Probes are labelled as Probe 1, 2, ... . Probe information (probe #, position) is stored in a separate file. \author Clancy Rowley \author Zhanhua Ma \date 11 May 2009 */ class OutputProbes : public Output { public: /// \brief Constructor /// \param[in] filename, to which probe data will be written. /// For instance, if filename = "out/probe%02.dat" /// then the following files will be created: /// out/probe00.dat (description of probe locations) /// out/probe01.dat (first probe) /// out/probe02.dat (second probe) /// ... OutputProbes(string filename, Grid& grid); /// Write a file with description of probe locations /// (this file has index 0) /// Also, open a file for each probe /// If a file with the same name is already present, it is overwritten. /// Returns true if successful. bool init(); /// \brief Close all the files. /// Returns true if successful bool cleanup(); /// Write velocities u, v, fluxes q.x, q,y and vorticity omega for each probe, /// to the correpsonding file with name (filename + probe#). bool doOutput( const State& x ); /// Write velocities u, v, fluxes q.x, q,y and vorticity omega for each probe, /// to the correpsonding file with name (filename + probe#), making use of the baseflow too. bool doOutput( const BaseFlow& q, const State& x ); /// \brief Add a probe by specifying its gridpoint indices void addProbeByIndex( int i, int j ); /// \brief Add a probe by specifying its absolute coordinates void addProbeByPosition( double xcord, double ycord ); // TODO: Write up this member function. /// \brief Add a probe by specifying its gridpoint indices void addProbe( int i, int j ); /// \brief Add a probe by specifying its absolute coordinates void addProbe( double xcord, double ycord ); /// Print out probe locations (by grid indices), for debugging void print(); /// Return the number of probes inline int getNumProbes(){ return _probes.size(); } /// Return the gridpoint index i of the corresponding probe inline int getProbeIndexX( unsigned int index ){ assert( index <= _probes.size() && index >= 1 ); return _probes[index-1].i; } /// Return the gridpoint index j of the corresponding probe inline int getProbeIndexY( unsigned int index ){ assert( index <= _probes.size() ); assert( index >= 1 ); return _probes[index-1].j; } /// Return the gridpoint x coordinate of the corresponding probe inline double getProbeCoordX( unsigned int index ){ assert( index <= _probes.size() && index >= 1 ); return _grid.getXEdge( _lev, _probes[index-1].i ); } /// Return the gridpoint y coordinate of the corresponding probe inline double getProbeCoordY( unsigned int index ){ assert( index <= _probes.size() && index >= 1 ); return _grid.getYEdge( _lev, _probes[index-1].j ); } private: class Probe { public: Probe(int ii, int jj) : i(ii), j(jj), fp(NULL) {} int i,j; FILE *fp; }; bool writeSummaryFile(void); // Private data string _filename; Grid _grid; bool _hasBeenInitialized; vector<Probe> _probes; static const int _lev; static const int _dimen; }; } // namespace ibpm #endif /* _OUTPUTPROBES_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 ScriptPromiseResolver_h #define ScriptPromiseResolver_h #include "bindings/core/v8/ScopedPersistent.h" #include "bindings/core/v8/ScriptPromise.h" #include "bindings/core/v8/ScriptState.h" #include "bindings/core/v8/ToV8.h" #include "core/dom/ActiveDOMObject.h" #include "core/dom/ExecutionContext.h" #include "platform/Timer.h" #include "wtf/RefCounted.h" #include <v8.h> namespace blink { // This class wraps v8::Promise::Resolver and provides the following // functionalities. // - A ScriptPromiseResolver retains a ScriptState. A caller // can call resolve or reject from outside of a V8 context. // - This class is an ActiveDOMObject and keeps track of the associated // ExecutionContext state. When the ExecutionContext is suspended, // resolve or reject will be delayed. When it is stopped, resolve or reject // will be ignored. class ScriptPromiseResolver : public RefCountedWillBeRefCountedGarbageCollected<ScriptPromiseResolver>, public ActiveDOMObject { WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScriptPromiseResolver); #if ENABLE(ASSERT) WILL_BE_USING_PRE_FINALIZER(ScriptPromiseResolver, assertNotPending); #endif WTF_MAKE_NONCOPYABLE(ScriptPromiseResolver); public: static PassRefPtrWillBeRawPtr<ScriptPromiseResolver> create(ScriptState* scriptState) { RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = adoptRefWillBeNoop(new ScriptPromiseResolver(scriptState)); resolver->suspendIfNeeded(); return resolver.release(); } #if !ENABLE(OILPAN) && ENABLE(ASSERT) ~ScriptPromiseResolver() override { assertNotPending(); } #endif // Anything that can be passed to toV8 can be passed to this function. template<typename T> void resolve(T value) { resolveOrReject(value, Resolving); } // Anything that can be passed to toV8 can be passed to this function. template<typename T> void reject(T value) { resolveOrReject(value, Rejecting); } void resolve() { resolve(ToV8UndefinedGenerator()); } void reject() { reject(ToV8UndefinedGenerator()); } ScriptState* scriptState() { return m_scriptState.get(); } // Note that an empty ScriptPromise will be returned after resolve or // reject is called. ScriptPromise promise() { #if ENABLE(ASSERT) m_isPromiseCalled = true; #endif return m_resolver.promise(); } ScriptState* scriptState() const { return m_scriptState.get(); } // ActiveDOMObject implementation. virtual void suspend() override; virtual void resume() override; virtual void stop() override; // Once this function is called this resolver stays alive while the // promise is pending and the associated ExecutionContext isn't stopped. void keepAliveWhilePending(); virtual void trace(Visitor*) override; protected: // You need to call suspendIfNeeded after the construction because // this is an ActiveDOMObject. explicit ScriptPromiseResolver(ScriptState*); private: typedef ScriptPromise::InternalResolver Resolver; enum ResolutionState { Pending, Resolving, Rejecting, ResolvedOrRejected, }; enum LifetimeMode { Default, KeepAliveWhilePending, }; #if ENABLE(ASSERT) void assertNotPending() { // This assertion fails if: // - promise() is called at least once and // - this resolver is destructed before it is resolved, rejected or // the associated ExecutionContext is stopped. // This function cannot be run in the destructor if // ScriptPromiseResolver is on-heap. ASSERT(m_state == ResolvedOrRejected || !m_isPromiseCalled || !executionContext() || executionContext()->activeDOMObjectsAreStopped()); #if ENABLE(OILPAN) // Delegate to LifecycleObserver's prefinalizer. LifecycleObserver::dispose(); #endif } #endif template<typename T> void resolveOrReject(T value, ResolutionState newState) { if (m_state != Pending || !executionContext() || executionContext()->activeDOMObjectsAreStopped()) return; ASSERT(newState == Resolving || newState == Rejecting); m_state = newState; // Retain this object until it is actually resolved or rejected. // |deref| will be called in |clear|. ref(); ScriptState::Scope scope(m_scriptState.get()); m_value.set( m_scriptState->isolate(), toV8(value, m_scriptState->context()->Global(), m_scriptState->isolate())); if (!executionContext()->activeDOMObjectsAreSuspended()) resolveOrRejectImmediately(); } void resolveOrRejectImmediately(); void onTimerFired(Timer<ScriptPromiseResolver>*); void clear(); ResolutionState m_state; const RefPtr<ScriptState> m_scriptState; LifetimeMode m_mode; Timer<ScriptPromiseResolver> m_timer; Resolver m_resolver; ScopedPersistent<v8::Value> m_value; #if ENABLE(ASSERT) // True if promise() is called. bool m_isPromiseCalled; #endif }; } // namespace blink #endif // ScriptPromiseResolver_h
#ifndef BASICQUERY_H #define BASICQUERY_H #include "Query.h" class Post; class BasicQuery : public Query { public: BasicQuery(SocialNet* n):Query(n){} virtual vector<Post*> Execute() {return receiver->BasicSearch(this);} virtual void InitQuery(User*) { cout<<"Enter the keyword you wanna search for: "<<endl<<"> "; cin>>keyword; } }; #endif
/* Generated by ./xlat/gen.sh from ./xlat/evdev_mtslots.in; do not edit. */ #ifdef IN_MPERS # error static const struct xlat evdev_mtslots in mpers mode #else static const struct xlat evdev_mtslots[] = { #if defined(ABS_MT_SLOT) || (defined(HAVE_DECL_ABS_MT_SLOT) && HAVE_DECL_ABS_MT_SLOT) XLAT(ABS_MT_SLOT), #endif #if defined(ABS_MT_TOUCH_MAJOR) || (defined(HAVE_DECL_ABS_MT_TOUCH_MAJOR) && HAVE_DECL_ABS_MT_TOUCH_MAJOR) XLAT(ABS_MT_TOUCH_MAJOR), #endif #if defined(ABS_MT_TOUCH_MINOR) || (defined(HAVE_DECL_ABS_MT_TOUCH_MINOR) && HAVE_DECL_ABS_MT_TOUCH_MINOR) XLAT(ABS_MT_TOUCH_MINOR), #endif #if defined(ABS_MT_WIDTH_MAJOR) || (defined(HAVE_DECL_ABS_MT_WIDTH_MAJOR) && HAVE_DECL_ABS_MT_WIDTH_MAJOR) XLAT(ABS_MT_WIDTH_MAJOR), #endif #if defined(ABS_MT_WIDTH_MINOR) || (defined(HAVE_DECL_ABS_MT_WIDTH_MINOR) && HAVE_DECL_ABS_MT_WIDTH_MINOR) XLAT(ABS_MT_WIDTH_MINOR), #endif #if defined(ABS_MT_ORIENTATION) || (defined(HAVE_DECL_ABS_MT_ORIENTATION) && HAVE_DECL_ABS_MT_ORIENTATION) XLAT(ABS_MT_ORIENTATION), #endif #if defined(ABS_MT_POSITION_X) || (defined(HAVE_DECL_ABS_MT_POSITION_X) && HAVE_DECL_ABS_MT_POSITION_X) XLAT(ABS_MT_POSITION_X), #endif #if defined(ABS_MT_POSITION_Y) || (defined(HAVE_DECL_ABS_MT_POSITION_Y) && HAVE_DECL_ABS_MT_POSITION_Y) XLAT(ABS_MT_POSITION_Y), #endif #if defined(ABS_MT_TOOL_TYPE) || (defined(HAVE_DECL_ABS_MT_TOOL_TYPE) && HAVE_DECL_ABS_MT_TOOL_TYPE) XLAT(ABS_MT_TOOL_TYPE), #endif #if defined(ABS_MT_BLOB_ID) || (defined(HAVE_DECL_ABS_MT_BLOB_ID) && HAVE_DECL_ABS_MT_BLOB_ID) XLAT(ABS_MT_BLOB_ID), #endif #if defined(ABS_MT_TRACKING_ID) || (defined(HAVE_DECL_ABS_MT_TRACKING_ID) && HAVE_DECL_ABS_MT_TRACKING_ID) XLAT(ABS_MT_TRACKING_ID), #endif #if defined(ABS_MT_PRESSURE) || (defined(HAVE_DECL_ABS_MT_PRESSURE) && HAVE_DECL_ABS_MT_PRESSURE) XLAT(ABS_MT_PRESSURE), #endif #if defined(ABS_MT_DISTANCE) || (defined(HAVE_DECL_ABS_MT_DISTANCE) && HAVE_DECL_ABS_MT_DISTANCE) XLAT(ABS_MT_DISTANCE), #endif #if defined(ABS_MT_TOOL_X) || (defined(HAVE_DECL_ABS_MT_TOOL_X) && HAVE_DECL_ABS_MT_TOOL_X) XLAT(ABS_MT_TOOL_X), #endif #if defined(ABS_MT_TOOL_Y) || (defined(HAVE_DECL_ABS_MT_TOOL_Y) && HAVE_DECL_ABS_MT_TOOL_Y) XLAT(ABS_MT_TOOL_Y), #endif XLAT_END }; #endif /* !IN_MPERS */
/*! \file Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 University Corporation for Atmospheric Research/Unidata. See \ref copyright file for more info. */ /* * Test more renames of vars and dims. * * Ed Hartnett */ #include "nc_tests.h" #include "err_macros.h" #define TEST_NAME "tst_rename3" #define DIM1_LEN 4 #define NDIM1 1 #define NDIM3 3 #define NUM_ENDDEF_SETTINGS 2 #define D1_NAME "d1" #define D2_NAME "d2" #define TMP_NAME "t1" int main(int argc, char **argv) { fprintf(stderr,"Test more renaming.\n"); fprintf(stderr,"*** test renaming affect on varids..."); { int ncid, varid1, varid2; int varid_in; char file_name[NC_MAX_NAME + 1]; /* Create file with two scalar vars. */ sprintf(file_name, "%s_coord_to_non_coord.nc", TEST_NAME); if (nc_create(file_name, NC_CLOBBER|NC_NETCDF4|NC_CLASSIC_MODEL, &ncid)) ERR; if (nc_def_var(ncid, D1_NAME, NC_INT, 0, NULL, &varid1)) ERR; if (nc_def_var(ncid, D2_NAME, NC_INT, 0, NULL, &varid2)) ERR; if (nc_close(ncid)) ERR; /* Open the file and rename a var. */ nc_set_log_level(4); if (nc_open(file_name, NC_WRITE, &ncid)) ERR; if (nc_rename_var(ncid, varid1, TMP_NAME)) ERR; if (nc_close(ncid)) ERR; /* Reopen file and check, */ if (nc_open(file_name, NC_WRITE, &ncid)) ERR; if (nc_inq_varid(ncid, TMP_NAME, &varid_in)) ERR; /* if (varid_in != varid1) ERR; */ if (nc_inq_varid(ncid, D1_NAME, &varid_in) != NC_ENOTVAR) ERR; if (nc_inq_varid(ncid, D2_NAME, &varid_in)) ERR; if (nc_close(ncid)) ERR; } SUMMARIZE_ERR; fprintf(stderr,"*** test renaming coord var to non-coord var..."); { int ncid, dimid1, dimid2, varid1, varid2; int dimid_in, varid_in; char file_name[NC_MAX_NAME + 1]; /* Create file with two dims and associated coordinate vars. */ sprintf(file_name, "%s_coord_to_non_coord.nc", TEST_NAME); if (nc_create(file_name, NC_CLOBBER|NC_NETCDF4|NC_CLASSIC_MODEL, &ncid)) ERR; if (nc_def_dim(ncid, D1_NAME, DIM1_LEN, &dimid1)) ERR; if (nc_def_dim(ncid, D2_NAME, DIM1_LEN, &dimid2)) ERR; if (nc_def_var(ncid, D1_NAME, NC_INT, NDIM1, &dimid1, &varid1)) ERR; if (nc_def_var(ncid, D2_NAME, NC_INT, NDIM1, &dimid2, &varid2)) ERR; if (nc_close(ncid)) ERR; /* Open the file and rename a var. */ nc_set_log_level(4); if (nc_open(file_name, NC_WRITE, &ncid)) ERR; if (nc_rename_var(ncid, varid1, TMP_NAME)) ERR; if (nc_close(ncid)) ERR; /* Reopen file and check, */ if (nc_open(file_name, NC_WRITE, &ncid)) ERR; if (nc_inq_dimid(ncid, D1_NAME, &dimid_in)) ERR; printf("dimid_in %d\n", dimid_in); if (dimid_in != dimid1) ERR; if (nc_inq_dimid(ncid, D2_NAME, &dimid_in)) ERR; if (dimid_in != dimid2) ERR; if (nc_inq_dimid(ncid, TMP_NAME, &dimid_in) != NC_EBADDIM) ERR; if (nc_inq_varid(ncid, TMP_NAME, &varid_in)) ERR; /* if (varid_in != varid1) ERR; */ if (nc_inq_varid(ncid, D1_NAME, &varid_in) != NC_ENOTVAR) ERR; if (nc_close(ncid)) ERR; /* This should work but does not (yet). */ /* if (nc_open(file_name, NC_WRITE, &ncid)) ERR; */ /* if (nc_rename_var(ncid, varid2, D1_NAME)) ERR; */ /* if (nc_close(ncid)) ERR; */ /* /\* Reopen file and check, *\/ */ /* if (nc_open(file_name, NC_WRITE, &ncid)) ERR; */ /* if (nc_inq_dimid(ncid, D1_NAME, &dimid_in)) ERR; */ /* if (dimid_in != dimid1) ERR; */ /* if (nc_inq_dimid(ncid, D2_NAME, &dimid_in)) ERR; */ /* if (dimid_in != dimid2) ERR; */ /* if (nc_inq_dimid(ncid, TMP_NAME, &dimid_in) != NC_EBADDIM) ERR; */ /* if (nc_inq_varid(ncid, TMP_NAME, &varid_in)) ERR; */ /* if (varid_in != varid1) ERR; */ /* if (nc_inq_varid(ncid, D1_NAME, &varid_in)) ERR; */ /* if (varid_in != varid2) ERR; */ /* if (nc_close(ncid)) ERR; */ } SUMMARIZE_ERR; fprintf(stderr,"*** test exchanging names of two coord vars, making them non-coord vars with names same as dims..."); { int ncid, dimid1, dimid2, varid1, varid2; /* int dimid_in; */ /* int varid_in; */ char file_name[NC_MAX_NAME + 1]; /* Create file with dim and associated coordinate var. */ sprintf(file_name, "%s_non_coord_to_dim.nc", TEST_NAME); if (nc_create(file_name, NC_CLOBBER|NC_NETCDF4|NC_CLASSIC_MODEL, &ncid)) ERR; if (nc_def_dim(ncid, D1_NAME, DIM1_LEN, &dimid1)) ERR; if (nc_def_dim(ncid, D2_NAME, DIM1_LEN, &dimid2)) ERR; if (nc_def_var(ncid, D1_NAME, NC_INT, NDIM1, &dimid1, &varid1)) ERR; if (nc_def_var(ncid, D2_NAME, NC_INT, NDIM1, &dimid2, &varid2)) ERR; if (nc_close(ncid)) ERR; /* Open the file and rename the vars. */ nc_set_log_level(4); if (nc_open(file_name, NC_WRITE, &ncid)) ERR; if (nc_rename_var(ncid, varid1, TMP_NAME)) ERR; nc_sync(ncid); /* This should work but doesn't yet. */ /* if (nc_rename_var(ncid, varid2, D1_NAME)) ERR; */ /* nc_sync(ncid); */ /* if (nc_rename_var(ncid, varid1, D2_NAME)) ERR; */ if (nc_close(ncid)) ERR; /* Reopen file and check, this should work but doesn't yet. */ if (nc_open(file_name, NC_WRITE, &ncid)) ERR; /* if (nc_inq_dimid(ncid, D1_NAME, &dimid_in)) ERR; */ /* if (dimid_in != dimid1) ERR; */ /* if (nc_inq_dimid(ncid, D2_NAME, &dimid_in)) ERR; */ /* if (dimid_in != dimid2) ERR; */ /* if (nc_inq_dimid(ncid, TMP_NAME, &dimid_in) != NC_EBADDIM) ERR; */ /* if (nc_inq_varid(ncid, TMP_NAME, &varid_in)) ERR; */ /* if (varid_in != varid1) ERR; */ /* if (nc_inq_varid(ncid, D1_NAME, &varid_in)) ERR; */ /* if (varid_in != varid2) ERR; */ if (nc_close(ncid)) ERR; } SUMMARIZE_ERR; FINAL_RESULTS; }
/* * Copyright 2013 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef GrOvalRenderer_DEFINED #define GrOvalRenderer_DEFINED #include "GrContext.h" #include "GrPaint.h" #include "GrRefCnt.h" #include "GrRect.h" class GrContext; class GrDrawTarget; class GrPaint; class SkStrokeRec; /* * This class wraps helper functions that draw ovals (filled & stroked) */ class GrOvalRenderer : public GrRefCnt { public: SK_DECLARE_INST_COUNT(GrOvalRenderer) GrOvalRenderer() {} ~GrOvalRenderer() {} bool drawOval(GrDrawTarget* target, const GrContext* context, const GrPaint& paint, const GrRect& oval, const SkStrokeRec& stroke); private: void drawEllipse(GrDrawTarget* target, const GrPaint& paint, const GrRect& ellipse, const SkStrokeRec& stroke); void drawCircle(GrDrawTarget* target, const GrPaint& paint, const GrRect& circle, const SkStrokeRec& stroke); typedef GrRefCnt INHERITED; }; #endif // GrOvalRenderer_DEFINED
// Copyright 2010-2015 Fabric Software Inc. All rights reserved. #ifndef __UI_DFG_DFGUICmd_AddBackDrop__ #define __UI_DFG_DFGUICmd_AddBackDrop__ #include <FabricUI/DFG/DFGUICmd/DFGUICmd_AddNode.h> FABRIC_UI_DFG_NAMESPACE_BEGIN class DFGUICmd_AddBackDrop : public DFGUICmd_AddNode { public: DFGUICmd_AddBackDrop( FabricCore::DFGBinding const &binding, FTL::StrRef execPath, FabricCore::DFGExec const &exec, FTL::StrRef title, QPointF pos ) : DFGUICmd_AddNode( binding, execPath, exec, title, pos ) {} static FTL::CStrRef CmdName() { return DFG_CMD_NAME("AddBackDrop"); } protected: FTL::CStrRef getText() { return getPrimaryArg(); } virtual void appendDesc( std::string &desc ); virtual FTL::CStrRef invokeAdd( unsigned &coreUndoCount ); }; FABRIC_UI_DFG_NAMESPACE_END #endif // __UI_DFG_DFGUICmd_AddBackDrop__
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE190_Integer_Overflow__int64_t_rand_postinc_68a.c Label Definition File: CWE190_Integer_Overflow.label.xml Template File: sources-sinks-68a.tmpl.c */ /* * @description * CWE: 190 Integer Overflow * BadSource: rand Set data to result of rand() * GoodSource: Set data to a small, non-zero number (two) * Sinks: increment * GoodSink: Ensure there will not be an overflow before incrementing data * BadSink : Increment data, which can cause an overflow * Flow Variant: 68 Data flow: data passed as a global variable from one function to another in different source files * * */ #include "std_testcase.h" int64_t CWE190_Integer_Overflow__int64_t_rand_postinc_68_badData; int64_t CWE190_Integer_Overflow__int64_t_rand_postinc_68_goodG2BData; int64_t CWE190_Integer_Overflow__int64_t_rand_postinc_68_goodB2GData; #ifndef OMITBAD /* bad function declaration */ void CWE190_Integer_Overflow__int64_t_rand_postinc_68b_badSink(); void CWE190_Integer_Overflow__int64_t_rand_postinc_68_bad() { int64_t data; data = 0LL; /* POTENTIAL FLAW: Use a random value */ data = (int64_t)RAND64(); CWE190_Integer_Overflow__int64_t_rand_postinc_68_badData = data; CWE190_Integer_Overflow__int64_t_rand_postinc_68b_badSink(); } #endif /* OMITBAD */ #ifndef OMITGOOD /* good function declarations */ void CWE190_Integer_Overflow__int64_t_rand_postinc_68b_goodG2BSink(); void CWE190_Integer_Overflow__int64_t_rand_postinc_68b_goodB2GSink(); /* goodG2B uses the GoodSource with the BadSink */ static void goodG2B() { int64_t data; data = 0LL; /* FIX: Use a small, non-zero value that will not cause an overflow in the sinks */ data = 2; CWE190_Integer_Overflow__int64_t_rand_postinc_68_goodG2BData = data; CWE190_Integer_Overflow__int64_t_rand_postinc_68b_goodG2BSink(); } /* goodB2G uses the BadSource with the GoodSink */ static void goodB2G() { int64_t data; data = 0LL; /* POTENTIAL FLAW: Use a random value */ data = (int64_t)RAND64(); CWE190_Integer_Overflow__int64_t_rand_postinc_68_goodB2GData = data; CWE190_Integer_Overflow__int64_t_rand_postinc_68b_goodB2GSink(); } void CWE190_Integer_Overflow__int64_t_rand_postinc_68_good() { goodG2B(); goodB2G(); } #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()..."); CWE190_Integer_Overflow__int64_t_rand_postinc_68_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE190_Integer_Overflow__int64_t_rand_postinc_68_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
// Copyright (c) 2013, Thomas L. Falch // For conditions of distribution and use, see the accompanying LICENSE and README files // This file is a part of the Scattered Point Visualization application // developed at the Norwegian University of Science and Technology #ifndef KRIGING #define KRIGING #include "point.h" #include "node.h" #include "real.h" //LAPACK double extern void dgetrf_(int*,int*,double*,int*,int*,int*); extern void dgetri_(int*,double*,int*,int*,double*,int*,int*); extern void dgesv_(int*,int*,double*,int*,int*,double*,int*,int*); //LAPACK float extern void sgetrf_(int*,int*,float*,int*,int*,int*); extern void sgetri_(int*,float*,int*,int*,float*,int*,int*); extern void sgesv_(int*,int*,float*,int*,int*,float*,int*,int*); real_t krige(PointList* neighbours, int num_neighbours, Coord pos); real_t variogram(Point* a, Point* b); real_t anisotropic_distance(Point* a, Point* b); #endif
/* Copyright (c) 2015 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. * * DMA based USART TX driver for STM32 */ #ifndef __CROS_EC_USART_TX_DMA_H #define __CROS_EC_USART_TX_DMA_H #include "consumer.h" #include "dma.h" #include "queue.h" #include "usart.h" /* * Construct a USART TX instance for DMA using the given DMA channel. * * This macro creates a new usart_tx_dma struct, complete with in RAM state, * the contained usart_tx struct can be used in initializing a usart_config * struct. * * CHANNEL is the DMA channel to be used for transmission. This must be a * valid DMA channel for the USART peripheral and any alternate channel * mappings must be handled by the board specific code. * * MAX_BYTES is the maximum size in bytes of a single DMA transfer. This * allows the board to tune how often the TX engine updates the queue state. * A larger number here could cause the queue to appear full for longer than * required because the queue isn't notified that it has been read from until * after the DMA transfer completes. */ #define USART_TX_DMA(CHANNEL, MAX_BYTES) \ ((struct usart_tx_dma const) { \ .usart_tx = { \ .consumer_ops = { \ .written = usart_tx_dma_written,\ .flush = usart_tx_dma_flush, \ }, \ \ .init = usart_tx_dma_init, \ .interrupt = usart_tx_dma_interrupt, \ }, \ \ .state = &((struct usart_tx_dma_state){}), \ .channel = CHANNEL, \ .max_bytes = MAX_BYTES, \ }) /* * In RAM state required to manage DMA based transmission. */ struct usart_tx_dma_state { /* * The current chunk of queue buffer being used for transmission. Once * the transfer is complete, this is used to update the TX queue head * pointer as well. */ struct queue_chunk chunk; /* * Flag indicating whether a DMA transfer is currently active. */ int dma_active; }; /* * Extension of the usart_tx struct to include required configuration for * DMA based transmission. */ struct usart_tx_dma { struct usart_tx usart_tx; struct usart_tx_dma_state volatile *state; enum dma_channel channel; size_t max_bytes; }; /* * Function pointers needed to intialize a usart_tx struct. These shouldn't * be called in any other context as they assume that the consumer or config * that they are passed was initialized with a complete usart_tx_dma struct. */ void usart_tx_dma_written(struct consumer const *consumer, size_t count); void usart_tx_dma_flush(struct consumer const *consumer); void usart_tx_dma_init(struct usart_config const *config); void usart_tx_dma_interrupt(struct usart_config const *config); #endif /* __CROS_EC_USART_TX_DMA_H */
/* * Copyright (c) 2005-2017 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * * 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 NTESS 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. * */ /* Normalizes a double n-vector over range. */ double ch_normalize(double *vec, int beg, int end) { int i; double scale; double ch_norm(double *vec, int beg, int end); scale = ch_norm(vec, beg, end); vec = vec + beg; for (i = end - beg + 1; i; i--) { *vec = *vec / scale; vec++; } return (scale); } /* Normalizes such that element k is positive */ double sign_normalize(double *vec, int beg, int end, int k) { int i; double scale, scale2; double ch_norm(double *vec, int beg, int end); scale = ch_norm(vec, beg, end); if (vec[k] < 0) { scale2 = -scale; } else { scale2 = scale; } vec = vec + beg; for (i = end - beg + 1; i; i--) { *vec = *vec / scale2; vec++; } return (scale); } /* Normalizes a float n-vector over range. */ double normalize_float(float *vec, int beg, int end) { int i; float scale; double norm_float(float *vec, int beg, int end); scale = norm_float(vec, beg, end); vec = vec + beg; for (i = end - beg + 1; i; i--) { *vec = *vec / scale; vec++; } return ((double)scale); }
/*************************************************************************************************** * Copyright (c) 2017-2021, NVIDIA CORPORATION. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted * provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used * to endorse or promote products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 NVIDIA CORPORATION BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * **************************************************************************************************/ /* \file \brief Performs comparison between two elements with support for floating-point comparisons. */ #pragma once #include "numeric_types.h" namespace cutlass { ///////////////////////////////////////////////////////////////////////////////////////////////// template <typename T> CUTLASS_HOST_DEVICE bool relatively_equal(T a, T b, T epsilon, T nonzero_floor); ///////////////////////////////////////////////////////////////////////////////////////////////// namespace detail { // This floating-point comparison function implements the method described in // // https://floating-point-gui.de/errors/comparison/ // template <typename T> CUTLASS_HOST_DEVICE bool relatively_equal_float(T a, T b, T epsilon, T nonzero_floor) { using std::abs; T abs_A = abs(a); T abs_B = abs(b); T diff = abs(a - b); T zero = T(0); if (a == b) { return true; } else if (a == zero || b == zero || diff < nonzero_floor) { return diff < epsilon * nonzero_floor; } return diff < epsilon * (abs_A + abs_B); } } // namespace detail ///////////////////////////////////////////////////////////////////////////////////////////////// template <> CUTLASS_HOST_DEVICE bool relatively_equal<uint1b_t>(uint1b_t a, uint1b_t b, uint1b_t, uint1b_t) { return (a == b); } template <> CUTLASS_HOST_DEVICE bool relatively_equal<int2b_t>(int2b_t a, int2b_t b, int2b_t, int2b_t) { return (a == b); } template <> CUTLASS_HOST_DEVICE bool relatively_equal<uint2b_t>(uint2b_t a, uint2b_t b, uint2b_t, uint2b_t) { return (a == b); } template <> CUTLASS_HOST_DEVICE bool relatively_equal<int4b_t>(int4b_t a, int4b_t b, int4b_t, int4b_t) { return (a == b); } template <> CUTLASS_HOST_DEVICE bool relatively_equal<uint4b_t>(uint4b_t a, uint4b_t b, uint4b_t, uint4b_t) { return (a == b); } template <> CUTLASS_HOST_DEVICE bool relatively_equal<int8_t>(int8_t a, int8_t b, int8_t, int8_t) { return (a == b); } template <> CUTLASS_HOST_DEVICE bool relatively_equal<uint8_t>(uint8_t a, uint8_t b, uint8_t, uint8_t) { return (a == b); } template <> CUTLASS_HOST_DEVICE bool relatively_equal<int16_t>(int16_t a, int16_t b, int16_t, int16_t) { return (a == b); } template <> CUTLASS_HOST_DEVICE bool relatively_equal<uint16_t>(uint16_t a, uint16_t b, uint16_t, uint16_t) { return (a == b); } template <> CUTLASS_HOST_DEVICE bool relatively_equal<int32_t>(int32_t a, int32_t b, int32_t, int32_t) { return (a == b); } template <> CUTLASS_HOST_DEVICE bool relatively_equal<uint32_t>(uint32_t a, uint32_t b, uint32_t, uint32_t) { return (a == b); } template <> CUTLASS_HOST_DEVICE bool relatively_equal<int64_t>(int64_t a, int64_t b, int64_t, int64_t) { return (a == b); } template <> CUTLASS_HOST_DEVICE bool relatively_equal<uint64_t>(uint64_t a, uint64_t b, uint64_t, uint64_t) { return (a == b); } ///////////////////////////////////////////////////////////////////////////////////////////////// template <> CUTLASS_HOST_DEVICE bool relatively_equal<half_t>(half_t a, half_t b, half_t epsilon, half_t nonzero_floor) { return detail::relatively_equal_float(a, b, epsilon, nonzero_floor); } template <> CUTLASS_HOST_DEVICE bool relatively_equal<bfloat16_t>( bfloat16_t a, bfloat16_t b, bfloat16_t epsilon, bfloat16_t nonzero_floor) { return detail::relatively_equal_float(a, b, epsilon, nonzero_floor); } template <> CUTLASS_HOST_DEVICE bool relatively_equal<tfloat32_t>( tfloat32_t a, tfloat32_t b, tfloat32_t epsilon, tfloat32_t nonzero_floor) { return detail::relatively_equal_float(a, b, epsilon, nonzero_floor); } template <> CUTLASS_HOST_DEVICE bool relatively_equal<float>(float a, float b, float epsilon, float nonzero_floor) { return detail::relatively_equal_float(a, b, epsilon, nonzero_floor); } template <> CUTLASS_HOST_DEVICE bool relatively_equal<double>(double a, double b, double epsilon, double nonzero_floor) { return detail::relatively_equal_float(a, b, epsilon, nonzero_floor); } ///////////////////////////////////////////////////////////////////////////////////////////////// } // namespace cutlass
/*--------------------------------------------------------------------------- rpng - simple PNG display program readpng.h --------------------------------------------------------------------------- Copyright (c) 1998-2007 Greg Roelofs. All rights reserved. This software is provided "as is," without warranty of any kind, express or implied. In no event shall the author or contributors be held liable for any damages arising in any way from the use of this software. The contents of this file are DUAL-LICENSED. You may modify and/or redistribute this software according to the terms of one of the following two licenses (at your option): LICENSE 1 ("BSD-like with advertising clause"): Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. Redistributions of source code must retain the above copyright notice, disclaimer, and this list of conditions. 2. Redistributions in binary form must reproduce the above copyright notice, disclaimer, and this list of conditions in the documenta- tion and/or other materials provided with the distribution. 3. All advertising materials mentioning features or use of this software must display the following acknowledgment: This product includes software developed by Greg Roelofs and contributors for the book, "PNG: The Definitive Guide," published by O'Reilly and Associates. LICENSE 2 (GNU GPL v2 or later): 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 "png.h" /* libpng header; includes zlib.h */ #include "zlib.h" #ifndef TRUE # define TRUE 1 # define FALSE 0 #endif #ifndef MAX # define MAX(a,b) ((a) > (b)? (a) : (b)) # define MIN(a,b) ((a) < (b)? (a) : (b)) #endif #ifdef DEBUG # define Trace(x) {fprintf x ; fflush(stderr); fflush(stdout);} #else # define Trace(x) ; #endif typedef unsigned char uch; typedef unsigned short ush; typedef unsigned long ulg; /* prototypes for public functions in readpng.c */ void readpng_version_info(void); int readpng_init(FILE *infile, ulg *pWidth, ulg *pHeight); int readpng_get_bgcolor(uch *bg_red, uch *bg_green, uch *bg_blue); uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes); void readpng_cleanup(int free_image_data);
/* * Copyright (c) 1996, 1997 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms are permitted * provided that the above copyright notice and this paragraph are * duplicated in all such forms and that any documentation, * advertising materials, and other materials related to such * distribution and use acknowledge that the software was developed * by the University of California, Lawrence Berkeley Laboratory, * Berkeley, CA. The name of the University may not be used to * endorse or promote products derived from this software without * specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ #define TOK_NUM 256 #define TOK_NA 257 #define TOK_COMMENT 258 extern double lex_num;
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_SHELL_BROWSER_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_ #define CONTENT_SHELL_BROWSER_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_ #include <stdint.h> #include "base/callback_forward.h" #include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" #include "content/public/browser/download_manager_delegate.h" namespace content { class DownloadManager; class ShellDownloadManagerDelegate : public DownloadManagerDelegate { public: ShellDownloadManagerDelegate(); ShellDownloadManagerDelegate(const ShellDownloadManagerDelegate&) = delete; ShellDownloadManagerDelegate& operator=(const ShellDownloadManagerDelegate&) = delete; ~ShellDownloadManagerDelegate() override; void SetDownloadManager(DownloadManager* manager); void Shutdown() override; bool DetermineDownloadTarget(download::DownloadItem* download, DownloadTargetCallback* callback) override; bool ShouldOpenDownload(download::DownloadItem* item, DownloadOpenDelayedCallback callback) override; void GetNextId(DownloadIdCallback callback) override; // Inhibits prompting and sets the default download path. void SetDownloadBehaviorForTesting( const base::FilePath& default_download_path); private: friend class base::RefCountedThreadSafe<ShellDownloadManagerDelegate>; using FilenameDeterminedCallback = base::OnceCallback<void(const base::FilePath&)>; static void GenerateFilename(const GURL& url, const std::string& content_disposition, const std::string& suggested_filename, const std::string& mime_type, const base::FilePath& suggested_directory, FilenameDeterminedCallback callback); void OnDownloadPathGenerated(uint32_t download_id, DownloadTargetCallback callback, const base::FilePath& suggested_path); void ChooseDownloadPath(uint32_t download_id, DownloadTargetCallback callback, const base::FilePath& suggested_path); DownloadManager* download_manager_; base::FilePath default_download_path_; bool suppress_prompting_; base::WeakPtrFactory<ShellDownloadManagerDelegate> weak_ptr_factory_{this}; }; } // namespace content #endif // CONTENT_SHELL_BROWSER_SHELL_DOWNLOAD_MANAGER_DELEGATE_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 MOJO_PUBLIC_CPP_BINDINGS_LIB_TRACING_HELPER_H_ #define MOJO_PUBLIC_CPP_BINDINGS_LIB_TRACING_HELPER_H_ #define MANGLE_MESSAGE_ID(id) (id ^ ::mojo::internal::kMojoMessageMangleMask) namespace mojo { namespace internal { // Mojo message id is 32-bit, but for tracing we ensure that mojo messages // don't collide with other trace events. constexpr uint64_t kMojoMessageMangleMask = 0x655b2a8e8efdf27f; } // namespace internal } // namespace mojo #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_TRACING_HELPER_H_
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_POLICY_SCHEMA_REGISTRY_SERVICE_H_ #define CHROME_BROWSER_POLICY_SCHEMA_REGISTRY_SERVICE_H_ #include <memory> #include "base/macros.h" namespace policy { class CombinedSchemaRegistry; class Schema; class SchemaRegistry; // A KeyedService associated with a Profile that contains a SchemaRegistry. class SchemaRegistryService { public: // This |registry| will initially contain only the |chrome_schema|, if // it's valid. The optional |global_registry| must outlive this, and will // track |registry|. SchemaRegistryService(std::unique_ptr<SchemaRegistry> registry, const Schema& chrome_schema, CombinedSchemaRegistry* global_registry); ~SchemaRegistryService(); SchemaRegistry* registry() const { return registry_.get(); } private: std::unique_ptr<SchemaRegistry> registry_; DISALLOW_COPY_AND_ASSIGN(SchemaRegistryService); }; } // namespace policy #endif // CHROME_BROWSER_POLICY_SCHEMA_REGISTRY_SERVICE_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 CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_INTEGRATION_TEST_UTIL_H_ #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_INTEGRATION_TEST_UTIL_H_ #include <string> #include "chrome/browser/sync/test/integration/fake_server_match_status_checker.h" #include "chrome/browser/sync/test/integration/single_client_status_change_checker.h" #include "components/sync/base/model_type.h" class Profile; namespace syncer { class ProfileSyncService; } // namespace syncer // Sets a custom theme and wait until the asynchronous process is done. void SetCustomTheme(Profile* profile, int theme_index = 0); // Checker to block until the server has a given number of entities. class ServerCountMatchStatusChecker : public fake_server::FakeServerMatchStatusChecker { public: ServerCountMatchStatusChecker(syncer::ModelType type, size_t count); // StatusChangeChecker implementation. bool IsExitConditionSatisfied(std::ostream* os) override; private: const syncer::ModelType type_; const size_t count_; }; // Checker to block until service is waiting for a passphrase. class PassphraseRequiredChecker : public SingleClientStatusChangeChecker { public: explicit PassphraseRequiredChecker(syncer::ProfileSyncService* service); // StatusChangeChecker implementation. bool IsExitConditionSatisfied(std::ostream* os) override; }; // Checker to block until service has accepted a new passphrase. class PassphraseAcceptedChecker : public SingleClientStatusChangeChecker { public: explicit PassphraseAcceptedChecker(syncer::ProfileSyncService* service); // StatusChangeChecker implementation. bool IsExitConditionSatisfied(std::ostream* os) override; }; #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_INTEGRATION_TEST_UTIL_H_
/* * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ #define WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ #include <string> #include "webrtc/common_types.h" #include "webrtc/video_engine/include/vie_codec.h" #include "webrtc/video_engine/include/vie_capture.h" #include "webrtc/video_send_stream.h" #include "webrtc/system_wrappers/interface/scoped_ptr.h" #include "webrtc/system_wrappers/interface/thread_annotations.h" namespace webrtc { class CriticalSectionWrapper; class SendStatisticsProxy : public RtcpStatisticsCallback, public StreamDataCountersCallback, public BitrateStatisticsObserver, public FrameCountObserver, public ViEEncoderObserver, public ViECaptureObserver { public: class StatsProvider { protected: StatsProvider() {} virtual ~StatsProvider() {} public: virtual bool GetSendSideDelay(VideoSendStream::Stats* stats) = 0; virtual std::string GetCName() = 0; }; SendStatisticsProxy(const VideoSendStream::Config& config, StatsProvider* stats_provider); virtual ~SendStatisticsProxy(); VideoSendStream::Stats GetStats() const; protected: // From RtcpStatisticsCallback. virtual void StatisticsUpdated(const RtcpStatistics& statistics, uint32_t ssrc) OVERRIDE; // From StreamDataCountersCallback. virtual void DataCountersUpdated(const StreamDataCounters& counters, uint32_t ssrc) OVERRIDE; // From BitrateStatisticsObserver. virtual void Notify(const BitrateStatistics& stats, uint32_t ssrc) OVERRIDE; // From FrameCountObserver. virtual void FrameCountUpdated(FrameType frame_type, uint32_t frame_count, const unsigned int ssrc) OVERRIDE; // From ViEEncoderObserver. virtual void OutgoingRate(const int video_channel, const unsigned int framerate, const unsigned int bitrate) OVERRIDE; virtual void SuspendChange(int video_channel, bool is_suspended) OVERRIDE; // From ViECaptureObserver. virtual void BrightnessAlarm(const int capture_id, const Brightness brightness) OVERRIDE {} virtual void CapturedFrameRate(const int capture_id, const unsigned char frame_rate) OVERRIDE; virtual void NoPictureAlarm(const int capture_id, const CaptureAlarm alarm) OVERRIDE {} private: StreamStats* GetStatsEntry(uint32_t ssrc) EXCLUSIVE_LOCKS_REQUIRED(lock_); const VideoSendStream::Config config_; scoped_ptr<CriticalSectionWrapper> lock_; VideoSendStream::Stats stats_ GUARDED_BY(lock_); StatsProvider* const stats_provider_; }; } // namespace webrtc #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_
/* * Copyright (C) 2012, 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. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_ELEMENT_DATA_CACHE_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_ELEMENT_DATA_CACHE_H_ #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" #include "third_party/blink/renderer/platform/wtf/text/string_hash.h" #include "third_party/blink/renderer/platform/wtf/vector.h" namespace blink { class Attribute; class ShareableElementData; class ElementDataCache final : public GarbageCollected<ElementDataCache> { public: ElementDataCache(); ShareableElementData* CachedShareableElementDataWithAttributes( const Vector<Attribute>&); void Trace(Visitor*); private: typedef HeapHashMap<unsigned, Member<ShareableElementData>, AlreadyHashed> ShareableElementDataCache; ShareableElementDataCache shareable_element_data_cache_; }; } // namespace blink #endif
//------------------------------------------------------------------------------ // GxB_Semiring_fprint: print and check a GrB_Semiring object //------------------------------------------------------------------------------ // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2018, All Rights Reserved. // http://suitesparse.com See GraphBLAS/Doc/License.txt for license. //------------------------------------------------------------------------------ #include "GB.h" GrB_Info GxB_Semiring_fprint // print and check a GrB_Semiring ( GrB_Semiring semiring, // object to print and check const char *name, // name of the object GxB_Print_Level pr, // print level FILE *f // file for output ) { //-------------------------------------------------------------------------- // check inputs //-------------------------------------------------------------------------- GB_WHERE ("GxB_Semiring_fprint (semiring, name, pr, f)") ; //-------------------------------------------------------------------------- // print and check the object //-------------------------------------------------------------------------- return (GB_Semiring_check (semiring, name, pr, f, Context)) ; }
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_DOWNLOAD_CLIENT_H_ #define CHROME_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_DOWNLOAD_CLIENT_H_ #include <string> #include <vector> #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "components/download/public/background_service/client.h" class BackgroundFetchDelegateImpl; namespace content { class BrowserContext; } // namespace content // A DownloadService client used by BackgroundFetch. Mostly this just forwards // calls to BackgroundFetchDelegateImpl. class BackgroundFetchDownloadClient : public download::Client { public: explicit BackgroundFetchDownloadClient(content::BrowserContext* context); ~BackgroundFetchDownloadClient() override; private: // Lazily initializes and returns |delegate_| as a raw pointer. BackgroundFetchDelegateImpl* GetDelegate(); // download::Client implementation void OnServiceInitialized( bool state_lost, const std::vector<download::DownloadMetaData>& downloads) override; void OnServiceUnavailable() override; void OnDownloadStarted( const std::string& guid, const std::vector<GURL>& url_chain, const scoped_refptr<const net::HttpResponseHeaders>& headers) override; void OnDownloadUpdated(const std::string& guid, uint64_t bytes_uploaded, uint64_t bytes_downloaded) override; void OnDownloadFailed(const std::string& guid, const download::CompletionInfo& info, download::Client::FailureReason reason) override; void OnDownloadSucceeded(const std::string& guid, const download::CompletionInfo& info) override; bool CanServiceRemoveDownloadedFile(const std::string& guid, bool force_delete) override; void GetUploadData(const std::string& guid, download::GetUploadDataCallback callback) override; content::BrowserContext* browser_context_; base::WeakPtr<BackgroundFetchDelegateImpl> delegate_; DISALLOW_COPY_AND_ASSIGN(BackgroundFetchDownloadClient); }; #endif // CHROME_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_DOWNLOAD_CLIENT_H_
/****************************************************************************** ** ** Copyright (C) 2009-2011 Kyle Lutz <kyle.r.lutz@gmail.com> ** All rights reserved. ** ** This file is a part of the chemkit project. For more information ** see <http://www.chemkit.org>. ** ** 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 chemkit project nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** 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 MMFFPARAMETERSDATA_H #define MMFFPARAMETERSDATA_H #include <map> #include <vector> #include "mmffparameters.h" class MmffParametersData { public: // construction and destruction MmffParametersData(); std::map<int, MmffBondStrechParameters> bondStrechParameters; std::map<int, MmffAngleBendParameters> angleBendParameters; std::map<int, MmffStrechBendParameters> strechBendParameters; std::vector<MmffDefaultStrechBendParameters> defaultStrechBendParameters; std::map<int, MmffOutOfPlaneBendingParameters> outOfPlaneBendingParameters; std::map<int, MmffTorsionParameters> torsionParameters; std::vector<MmffVanDerWaalsParameters> vanDerWaalsParameters; std::vector<MmffChargeParameters> chargeParameters; std::vector<MmffPartialChargeParameters> partialChargeParameters; }; #endif // MMFFPARAMETERSDATA_H
/* * Copyright (c) 2016-2020, Facebook, Inc. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the * LICENSE file in the root directory of this source tree) and the GPLv2 (found * in the COPYING file in the root directory of this source tree). * You may select, at your option, one of the above-listed licenses. */ /** * This fuzz target round trips the FSE normalized count with FSE_writeNCount() * and FSE_readNcount() to ensure that it can always round trip correctly. */ #define FSE_STATIC_LINKING_ONLY #define ZSTD_STATIC_LINKING_ONLY #include <stddef.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include "fuzz_helpers.h" #include "zstd_helpers.h" #include "fuzz_data_producer.h" #include "fse.h" int LLVMFuzzerTestOneInput(const uint8_t *src, size_t size) { FUZZ_dataProducer_t *producer = FUZZ_dataProducer_create(src, size); /* Pick a random tableLog and maxSymbolValue */ unsigned const tableLog = FUZZ_dataProducer_uint32Range(producer, FSE_MIN_TABLELOG, FSE_MAX_TABLELOG); unsigned const maxSymbolValue = FUZZ_dataProducer_uint32Range(producer, 0, 255); unsigned remainingWeight = (1u << tableLog) - 1; size_t dataSize; BYTE data[512]; short ncount[256]; /* Randomly fill the normalized count */ memset(ncount, 0, sizeof(ncount)); { unsigned s; for (s = 0; s < maxSymbolValue && remainingWeight > 0; ++s) { short n = (short)FUZZ_dataProducer_int32Range(producer, -1, remainingWeight); ncount[s] = n; if (n < 0) { remainingWeight -= 1; } else { assert((unsigned)n <= remainingWeight); remainingWeight -= n; } } /* Ensure ncount[maxSymbolValue] != 0 and the sum is (1<<tableLog) */ ncount[maxSymbolValue] = remainingWeight + 1; if (ncount[maxSymbolValue] == 1 && FUZZ_dataProducer_uint32Range(producer, 0, 1) == 1) { ncount[maxSymbolValue] = -1; } } /* Write the normalized count */ { FUZZ_ASSERT(sizeof(data) >= FSE_NCountWriteBound(maxSymbolValue, tableLog)); dataSize = FSE_writeNCount(data, sizeof(data), ncount, maxSymbolValue, tableLog); FUZZ_ZASSERT(dataSize); } /* Read & validate the normalized count */ { short rtNcount[256]; unsigned rtMaxSymbolValue = 255; unsigned rtTableLog; /* Copy into a buffer with a random amount of random data at the end */ size_t const buffSize = (size_t)FUZZ_dataProducer_uint32Range(producer, dataSize, sizeof(data)); BYTE* const buff = FUZZ_malloc(buffSize); size_t rtDataSize; memcpy(buff, data, dataSize); { size_t b; for (b = dataSize; b < buffSize; ++b) { buff[b] = (BYTE)FUZZ_dataProducer_uint32Range(producer, 0, 255); } } rtDataSize = FSE_readNCount(rtNcount, &rtMaxSymbolValue, &rtTableLog, buff, buffSize); FUZZ_ZASSERT(rtDataSize); FUZZ_ASSERT(rtDataSize == dataSize); FUZZ_ASSERT(rtMaxSymbolValue == maxSymbolValue); FUZZ_ASSERT(rtTableLog == tableLog); { unsigned s; for (s = 0; s <= maxSymbolValue; ++s) { FUZZ_ASSERT(ncount[s] == rtNcount[s]); } } free(buff); } FUZZ_dataProducer_free(producer); return 0; }
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef ASH_WM_WINDOW_DIMMER_H_ #define ASH_WM_WINDOW_DIMMER_H_ #include "ash/ash_export.h" #include "base/callback_helpers.h" #include "base/macros.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/aura/window_observer.h" namespace ash { // WindowDimmer creates a window whose opacity is optionally animated by way of // SetDimOpacity() and whose size matches that of its parent. WindowDimmer is // intended to be used in cases where a certain set of windows need to appear // partially obscured. This is achieved by creating WindowDimmer, setting the // opacity, and then stacking window() above the windows that are to appear // obscured. // // WindowDimmer owns the window it creates, but supports having that window // deleted out from under it (this generally happens if the parent of the // window is deleted). If WindowDimmer is deleted and the window it created is // still valid, then WindowDimmer deletes the window. class ASH_EXPORT WindowDimmer : public aura::WindowObserver { public: // Defines an interface for an optional delegate to the WindowDimmer, which // will be notified with certain events happening to the window being dimmed. class Delegate { public: // Called when the window being dimmed |dimmed_window| is about to be // destroyed. // This can be used by the owner of the WindowDimmer to know when it's no // longer needed and can be destroyed since the window being dimmed itself // is destroying. virtual void OnDimmedWindowDestroying(aura::Window* dimmed_window) = 0; // Called when the window being dimmed |dimmed_window| changes its parent. virtual void OnDimmedWindowParentChanged(aura::Window* dimmed_window) = 0; protected: virtual ~Delegate() = default; }; // Creates a new WindowDimmer. The window() created by WindowDimmer is added // to |parent| and stacked above all other child windows. If |animate| is set // to false, the dimming |window_| created by |this| will not animate on its // visibility changing, otherwise it'll have a fade animation of a 200-ms // duration. |delegate| can be optionally specified to observe some events // happening to the window being dimmed (|parent|). explicit WindowDimmer(aura::Window* parent, bool animate = true, Delegate* delegate = nullptr); WindowDimmer(const WindowDimmer&) = delete; WindowDimmer& operator=(const WindowDimmer&) = delete; ~WindowDimmer() override; aura::Window* parent() { return parent_; } aura::Window* window() { return window_; } // Set the opacity value of the default dimming color which is Black. If it's // desired to specify a certain color with its alpha value, then use the below // SetDimColor(). void SetDimOpacity(float target_opacity); // Sets the color of the dimming |window_|'s layer. This color must not be // opaque. void SetDimColor(SkColor dimming_color); // NOTE: WindowDimmer is an observer for both |parent_| and |window_|. // aura::WindowObserver: void OnWindowBoundsChanged(aura::Window* window, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds, ui::PropertyChangeReason reason) override; void OnWindowDestroying(aura::Window* window) override; void OnWindowHierarchyChanging(const HierarchyChangeParams& params) override; void OnWindowParentChanged(aura::Window* window, aura::Window* parent) override; private: aura::Window* parent_; // See class description for details on ownership. aura::Window* window_; Delegate* delegate_; // Not owned. }; } // namespace ash #endif // ASH_WM_WINDOW_DIMMER_H_
/**ARGS: source -DFOO1 -UFOO2 */ /**SYSCODE: = 1 | 16 */ #if defined(FOO1) KEEP ME #endif
/* ============================================================================ * Name : CDmdCaptureEngineMac.h * Author : weizhenwei, <weizhenwei1988@gmail.com> * Date : 2015.07.14 * * Copyright (c) 2015, weizhenwei * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * * Neither the name of the {organization} nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Description : header file of capture engine on mac platform. ============================================================================ */ #ifndef SRC_CAPTURE_MAC_CDMDCAPTUREENGINEMAC_H #define SRC_CAPTURE_MAC_CDMDCAPTUREENGINEMAC_H #import <Foundation/Foundation.h> #import <AVFoundation/AVFoundation.h> #import "IDmdCaptureEngine.h" #import "CDmdCaptureSessionMac.h" class IDmdCaptureEngine; class IDmdCaptureEngineSink; namespace opendmd { class CDmdCaptureEngineMac : public IDmdCaptureEngine, public IDmdMacAVVideoCapSessionSink { public: CDmdCaptureEngineMac(); ~CDmdCaptureEngineMac(); // IDmdCaptureEngine interface; DMD_RESULT Init(const DmdCaptureVideoFormat &capVideoFormat); DMD_RESULT Uninit(); DMD_RESULT StartCapture(); DMD_BOOL IsCapturing(); DMD_RESULT RunCaptureLoop(); DMD_RESULT StopCapture(); // IDmdMacAVVideoCapSessionSink interface; DMD_RESULT DeliverVideoData(CMSampleBufferRef sampleBuffer); private: // setup AVCapSession paramters; DMD_RESULT setupAVCaptureDevice(); DMD_RESULT setupAVCaptureDeviceFormat(); DMD_RESULT setupAVCaptureSessionPreset(); DMD_RESULT setupAVCaptureSessionFPS(); DMD_RESULT setupAVCaptureSession(); CDmdAVVideoCapSession *m_pVideoCapSession; DmdCaptureVideoFormat m_capVideoFormat; MacCaptureSessionFormat m_capSessionFormat; DmdVideoRawData *m_pVideoRawData; }; DMD_RESULT CVImageBuffer2VideoRawPacket( CVImageBufferRef imageBuffer, DmdVideoRawData& packet); } // namespace opendmd #endif // SRC_CAPTURE_MAC_CDMDCAPTUREENGINEMAC_H
// This file is part of Hermes3D // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). // Email: hpfem-group@unr.edu, home page: http://hpfem.org/. // // This file was written by: // - David Andrs // // Hermes3D 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. // // Hermes3D 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 Hermes3D; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #ifndef _ERROR_H_ #define _ERROR_H_ #include "compat-util.h" // // Error handling // // It is important to handle as much errors as possible (it will help to debug the code). // When something bad happened, you will know were. Use at least EXIT and ERROR macros. // // error codes #define ERR_FAILURE -1 #define ERR_SUCCESS 0 // error handling functions /// Report unrecoverable errors where you need to report the location of the error /// It also reports call stack #define EXIT(...) h_exit(__LINE__, __PRETTY_FUNCTION__, __FILE__, ## __VA_ARGS__) void h_exit(int line, const char *func, const char *file, char const *fmt, ...) NORETURN; /// Report unrecoverable error (no call stack or location dumped) void error(char const *fmt, ...) NORETURN; /// Notify the user about warning (the execution continues), neither location or call stack /// is dumped void warning(const char *warn, ...); /// Check that memory allocation was ok, it not, report an error (also dump call stack) and /// terminate #define MEM_CHECK(var) h_mem_check(__LINE__, __PRETTY_FUNCTION__, __FILE__, var) void h_mem_check(int line, const char *func, const char *file, void *var); #endif
/* * Copyright (c) 2012-2015, Brian Watling and other contributors * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "fiber_barrier.h" #include "fiber_manager.h" #include "test_helper.h" #define PER_FIBER_COUNT 100000 #define NUM_FIBERS 1000 #define NUM_THREADS 4 int volatile counter[NUM_FIBERS] = {}; int volatile winner = 0; fiber_barrier_t barrier; void* run_function(void* param) { intptr_t index = (intptr_t)param; int i; for(i = 0; i < PER_FIBER_COUNT; ++i) { test_assert(counter[index] == i); ++counter[index]; } if(FIBER_BARRIER_SERIAL_FIBER == fiber_barrier_wait(&barrier)) { test_assert(__sync_bool_compare_and_swap(&winner, 0, 1)); } for(i = 0; i < NUM_FIBERS; ++i) { test_assert(counter[i] == PER_FIBER_COUNT); } return NULL; } int main() { fiber_manager_init(NUM_THREADS); fiber_barrier_init(&barrier, NUM_FIBERS); fiber_t* fibers[NUM_FIBERS]; intptr_t i; for(i = 1; i < NUM_FIBERS; ++i) { fibers[i] = fiber_create(20000, &run_function, (void*)i); } run_function(NULL); for(i = 1; i < NUM_FIBERS; ++i) { fiber_join(fibers[i], NULL); } test_assert(winner == 1); //do it all again - the barrier should be reusable winner = 0; memset((void*)counter, 0, sizeof(counter)); for(i = 1; i < NUM_FIBERS; ++i) { fibers[i] = fiber_create(20000, &run_function, (void*)i); } run_function(NULL); for(i = 1; i < NUM_FIBERS; ++i) { fiber_join(fibers[i], NULL); } fiber_barrier_destroy(&barrier); fiber_manager_print_stats(); return 0; }
/*- * Copyright (c) 2013 Robert N. M. Watson * All rights reserved. * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) * ("CTSRD"), as part of the DARPA CRASH research programme. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <bootstrap.h> #include <cons.h> static void c_probe(struct console *); static int c_init(int); static void c_out(int); static int c_in(void); static int c_ready(void); struct console altera_jtag_uart_console = { .c_name = "comconsole", .c_desc = "altera jtag uart", .c_flags = 0, .c_probe = c_probe, .c_init = c_init, .c_out = c_out, .c_in = c_in, .c_ready = c_ready, }; static void c_probe(struct console *cp) { cp->c_flags |= C_PRESENTIN|C_PRESENTOUT; } static int c_init(int arg) { return (0); } static void c_out(int c) { putc(c); } static int c_in(void) { return (getc()); } static int c_ready(void) { return (keyhit(0)); }
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* ******** *** SparseLib++ */ /* ******* ** *** *** *** v. 1.5c */ /* ***** *** ******** ******** */ /* ***** *** ******** ******** R. Pozo */ /* ** ******* *** ** *** *** K. Remington */ /* ******** ******** A. Lumsdaine */ /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* */ /* */ /* SparseLib++ : Sparse Matrix Library */ /* */ /* National Institute of Standards and Technology */ /* University of Notre Dame */ /* Authors: R. Pozo, K. Remington, A. Lumsdaine */ /* */ /* NOTICE */ /* */ /* Permission to use, copy, modify, and distribute this software and */ /* its documentation for any purpose and without fee is hereby granted */ /* provided that the above notice appear in all copies and supporting */ /* documentation. */ /* */ /* Neither the Institutions (National Institute of Standards and Technology, */ /* University of Notre Dame) nor the Authors make any representations about */ /* the suitability of this software for any purpose. This software is */ /* provided ``as is'' without expressed or implied warranty. */ /* */ /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* Coordinate Sparse Matrix (0-based, Fortran) */ /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ // Note A.(i,j) will return 0.0 if not in A, but A.set(i,j) will throw // an exception, because A's size cannot grow... #ifndef Coord_Mat_double_H #define Coord_Mat_double_H #include "vecdefs.h" #include VECTOR_H class CompCol_Mat_double; class CompRow_Mat_double; class Coord_Mat_double { private: VECTOR_double val_; // data values (nz_ elements) VECTOR_int rowind_; // row_ind (nz_ elements) VECTOR_int colind_; // col_ind (nz_ elements) int base_; // index base: not used.... int nz_; // number of nonzeros int dim_[2]; // number of rows, cols public: Coord_Mat_double(void); Coord_Mat_double(const Coord_Mat_double &S); Coord_Mat_double(int M, int N, int nz, double *val, int *r, int *c, int base=0); Coord_Mat_double(const CompCol_Mat_double &C); Coord_Mat_double(const CompRow_Mat_double &R); ~Coord_Mat_double() {}; /*******************************/ /* Access and info functions */ /*******************************/ double& val(int i) { return val_(i); } int& row_ind(int i) { return rowind_(i); } int& col_ind(int i) { return colind_(i);} const double& val(int i) const { return val_(i); } const int& row_ind(int i) const { return rowind_(i); } const int& col_ind(int i) const { return colind_(i);} int dim(int i) const {return dim_[i];}; int size(int i) const {return dim_[i];}; int NumNonzeros() const {return nz_;}; int base() const {return base_;} /*******************************/ /* Assignment operator */ /*******************************/ Coord_Mat_double& operator=(const Coord_Mat_double &C); Coord_Mat_double& newsize(int M, int N, int nz); /***********************************/ /* General access function (slow) */ /***********************************/ double operator() (int i, int j) const; double& set(int i, int j); /***********************************/ /* Matrix/Vector multiply */ /***********************************/ VECTOR_double operator*(const VECTOR_double &x) const; VECTOR_double trans_mult(const VECTOR_double &x) const; }; #endif /* Coord_Mat_double_H */ ostream& operator << (ostream & os, const Coord_Mat_double & mat);
#pragma once bool ProcessConnection(SOCKET pSocket, char *pWelcomeInfo); int ListenForOneConnection(int pPort, SOCKET *pSocket, int *pWsaError); int ConnectTo(char *pIpAddress, int pPort, SOCKET *pSocket, int *pWsaError); bool InitNetworking(int *pWsaError); bool ShutDownNetworking();
/*** *stdexcpt.h - User include file for standard exception classes * * Copyright (c) Microsoft Corporation. All rights reserved. * *Purpose: * This file is the previous location of the standard exception class * definitions, now found in the standard header <exception>. * * [Public] * ****/ #if _MSC_VER > 1000 #pragma once #endif #include <crtdefs.h> #ifndef _INC_STDEXCPT #define _INC_STDEXCPT #ifdef __cplusplus #include <exception> #endif /* __cplusplus */ #endif /* _INC_STDEXCPT */
/* Project : Wolf Engine. Copyright(c) Pooya Eimandar (http://PooyaEimandar.com) . All rights reserved. Source : Please direct any bug to https://github.com/PooyaEimandar/Wolf.Engine/issues Website : http://WolfSource.io Name : py_std.h Description : The python exporter for w_std structs Comment : */ #ifdef __PYTHON__ #ifndef __PY_STD_H__ #define __PY_STD_H__ #include "python_exporter/w_boost_python_helper.h" #include <boost/python/suite/indexing/vector_indexing_suite.hpp> namespace pyWolf { //static std::wstring py_sprintf(_In_z_ std::wstring pStr, _In_ boost::python::list pList) //{ // const wchar_t* _delimiter = L"<%>"; // for (size_t i = 0; i < len(pList); ++i) // { // boost::python::extract<double> _data(pList[i]); // if (_data.check()) // { // auto _found = pStr.find(_delimiter); // if (_found == std::wstring::npos) break; // // pStr.replace(_found, 3, std::to_wstring(_data())); // } // } // return pStr; //} static void py_std_export() { using namespace boost::python; //define W_RESULT enum enum_<W_RESULT>("W_RESULT") .value("W_PASSED", W_RESULT::W_PASSED) .value("W_FAILED", W_RESULT::W_FAILED) .value("W_INVALIDARG", W_RESULT::W_INVALIDARG) .value("W_OUTOFMEMORY", W_RESULT::W_OUTOFMEMORY) .value("W_INVALID_FILE_ATTRIBUTES", W_RESULT::W_INVALID_FILE_ATTRIBUTES) .export_values() ; //export vector of uint8_t class_<w_vector_uint8_t>("w_vector_uint8_t") .def(vector_indexing_suite<w_vector_uint8_t>()); //export vector of float class_<w_vector_float>("w_vector_float") .def(vector_indexing_suite<w_vector_float>()); } } #endif//__PY_STD_H__ #endif//__PYTHON__
// // ActivityTableViewCell.h // FRDStravaClient // // Created by Sebastien Windal on 4/30/14. // Copyright (c) 2014 Sebastien Windal. All rights reserved. // #import <UIKit/UIKit.h> #import <Mapkit/MapKit.h> @interface ActivityTableViewCell : UITableViewCell @property (weak, nonatomic) IBOutlet UILabel *nameLabel; @property (weak, nonatomic) IBOutlet UILabel *locationLabel; @property (weak, nonatomic) IBOutlet UILabel *dateLabel; @property (weak, nonatomic) IBOutlet UILabel *durationLabel; @property (weak, nonatomic) IBOutlet UILabel *distanceLabel; @property (weak, nonatomic) IBOutlet UILabel *activityIconLabel; @property (weak, nonatomic) IBOutlet UILabel *chevronIconLabel; @property (weak, nonatomic) IBOutlet UILabel *usernameLabel; @property (weak, nonatomic) IBOutlet UIImageView *userImageView; @property (weak, nonatomic) IBOutlet UIView *typeColorView; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *detailViewHeightConstraint; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *userWidthConstraint; @end
// // FWTPopoverHintView.h // FWTPopoverHintView // // Created by Marco Meschini on 7/12/12. // Copyright (c) 2012 Futureworkshops. All rights reserved. // #import <UIKit/UIKit.h> #import "FWTPopoverArrow.h" #import "FWTPopoverBackgroundHelper.h" #import "FWTPopoverAnimationHelper.h" @class FWTPopoverView; typedef void (^FWTPopoverViewDidPresentBlock)(FWTPopoverView *); typedef void (^FWTPopoverViewDidDismissBlock)(FWTPopoverView *); @interface FWTPopoverView : UIView @property (nonatomic, readonly, retain) UIView *contentView; @property (nonatomic, assign) CGSize contentSize; @property (nonatomic, assign) BOOL adjustPositionInSuperviewEnabled; @property (nonatomic, retain) FWTPopoverBackgroundHelper *backgroundHelper; @property (nonatomic, retain) FWTPopoverArrow *arrow; @property (nonatomic, retain) FWTPopoverAnimationHelper *animationHelper; @property (nonatomic, copy) FWTPopoverViewDidPresentBlock didPresentBlock; @property (nonatomic, copy) FWTPopoverViewDidDismissBlock didDismissBlock; // - (void)presentFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirection:(FWTPopoverArrowDirection)arrowDirection animated:(BOOL)animated; // - (void)adjustPositionToRect:(CGRect)rect; - (void)adjustPositionToRect:(CGRect)rect animated:(BOOL)animated; // - (void)dismissPopoverAnimated:(BOOL)animated; // - (CGRect)arrowRect; @end
// // Tactile // // The MIT License (MIT) // // Copyright (c) 2015 Damien D. // // 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> //! Project version number for Tactile. FOUNDATION_EXPORT double TactileVersionNumber; //! Project version string for Tactile. FOUNDATION_EXPORT const unsigned char TactileVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <Tactile/PublicHeader.h>
/* SoLoud audio engine Copyright (c) 2013-2015 Jari Komppa This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef SOLOUD_FFTFILTER_H #define SOLOUD_FFTFILTER_H #include "soloud.h" namespace SoLoud { class FFTFilter; class FFTFilterInstance : public FilterInstance { float *mTemp; float *mInputBuffer; float *mMixBuffer; float *mLastPhase; float *mSumPhase; unsigned int mInputOffset[MAX_CHANNELS]; unsigned int mMixOffset[MAX_CHANNELS]; unsigned int mReadOffset[MAX_CHANNELS]; FFTFilter *mParent; public: virtual void fftFilterChannel(float *aFFTBuffer, unsigned int aSamples, float aSamplerate, time aTime, unsigned int aChannel, unsigned int aChannels); virtual void filterChannel(float *aBuffer, unsigned int aSamples, float aSamplerate, time aTime, unsigned int aChannel, unsigned int aChannels); virtual ~FFTFilterInstance(); FFTFilterInstance(FFTFilter *aParent); FFTFilterInstance(); void comp2MagPhase(float* aFFTBuffer, unsigned int aSamples); void magPhase2MagFreq(float* aFFTBuffer, unsigned int aSamples, float aSamplerate, unsigned int aChannel); void magFreq2MagPhase(float* aFFTBuffer, unsigned int aSamples, float aSamplerate, unsigned int aChannel); void magPhase2Comp(float* aFFTBuffer, unsigned int aSamples); void init(); }; class FFTFilter : public Filter { public: virtual FilterInstance *createInstance(); FFTFilter(); }; } #endif
// // CoreDataFetchDataSource.h // ContentfulSDK // // Created by Boris Bügling on 25/04/14. // // @import CoreData; @import UIKit; /** * Block which is responsible for configuring the given cell. * * @param cell A cell to configure. * @param indexPath Index path of the given cell. */ typedef void(^CDAConfigureCellAtIndexPath)(id cell, NSIndexPath* indexPath); /** * A flexible data source which works in conjunction with `CoreDataManager`. It can be used for both * collection, as well as table views. */ @interface CoreDataFetchDataSource : NSObject <UICollectionViewDataSource, UITableViewDataSource> /** Block responsible for configuring cells. */ @property (nonatomic, copy) CDAConfigureCellAtIndexPath cellConfigurator; /** * Initializes a fetch data source. * * @param fetchedResultsController The fetch results controller to use as source for data. * @param collectionView The collection view in which the data will be displayed. * @param cellIdentifier The reuse identifier used for cells in the table view. * * @return An initialized fetch data source. */ -(id)initWithFetchedResultsController:(NSFetchedResultsController*)fetchedResultsController collectionView:(UICollectionView*)collectionView cellIdentifier:(NSString*)cellIdentifier; /** * Initializes a fetch data source. * * @param fetchedResultsController The fetch results controller to use as source for data. * @param tableView The table view in which the data will be displayed. * @param cellIdentifier The reuse identifier used for cells in the table view. * * @return An initialized fetch data source. */ -(id)initWithFetchedResultsController:(NSFetchedResultsController*)fetchedResultsController tableView:(UITableView*)tableView cellIdentifier:(NSString*)cellIdentifier; /** * Retrieve the object at a given index path. * * @param indexPath The index path location of the object to retrieve. * * @return An object or nil if none exists. */ -(id)objectAtIndexPath:(NSIndexPath*)indexPath; /** Perform a fetch request from the database. */ -(void)performFetch; @end
// This code contains NVIDIA Confidential Information and is disclosed to you // under a form of NVIDIA software license agreement provided separately to you. // // Notice // NVIDIA Corporation and its licensors retain all intellectual property and // proprietary rights in and to this software and related documentation and // any modifications thereto. Any use, reproduction, disclosure, or // distribution of this software and related documentation without an express // license agreement from NVIDIA Corporation is strictly prohibited. // // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. // // Information and code furnished is believed to be accurate and reliable. // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such // information or for any infringement of patents or other rights of third parties that may // result from its use. No license is granted by implication or otherwise under any patent // or patent rights of NVIDIA Corporation. Details are subject to change without notice. // This code supersedes and replaces all information previously supplied. // NVIDIA Corporation products are not authorized for use as critical // components in life support devices or systems without express written approval of // NVIDIA Corporation. // // Copyright (c) 2008-2018 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. #ifndef PX_PHYSICS_NX_BOX_GEOMETRY #define PX_PHYSICS_NX_BOX_GEOMETRY /** \addtogroup geomutils @{ */ #include "geometry/PxGeometry.h" #include "foundation/PxVec3.h" #if !PX_DOXYGEN namespace physx { #endif /** \brief Class representing the geometry of a box. The geometry of a box can be fully specified by its half extents. This is the half of its width, height, and depth. \note The scaling of the box is expected to be baked into these values, there is no additional scaling parameter. */ class PxBoxGeometry : public PxGeometry { public: /** \brief Default constructor, initializes to a box with zero dimensions. */ PX_INLINE PxBoxGeometry() : PxGeometry(PxGeometryType::eBOX), halfExtents(0,0,0) {} /** \brief Constructor to initialize half extents from scalar parameters. \param hx Initial half extents' x component. \param hy Initial half extents' y component. \param hz Initial half extents' z component. */ PX_INLINE PxBoxGeometry(PxReal hx, PxReal hy, PxReal hz) : PxGeometry(PxGeometryType::eBOX), halfExtents(hx, hy, hz) {} /** \brief Constructor to initialize half extents from vector parameter. \param halfExtents_ Initial half extents. */ PX_INLINE PxBoxGeometry(PxVec3 halfExtents_) : PxGeometry(PxGeometryType::eBOX), halfExtents(halfExtents_) {} /** \brief Returns true if the geometry is valid. \return True if the current settings are valid \note A valid box has a positive extent in each direction (halfExtents.x > 0, halfExtents.y > 0, halfExtents.z > 0). It is illegal to call PxRigidActor::createShape and PxPhysics::createShape with a box that has zero extent in any direction. @see PxRigidActor::createShape, PxPhysics::createShape */ PX_INLINE bool isValid() const; public: /** \brief Half of the width, height, and depth of the box. */ PxVec3 halfExtents; }; PX_INLINE bool PxBoxGeometry::isValid() const { if (mType != PxGeometryType::eBOX) return false; if (!halfExtents.isFinite()) return false; if (halfExtents.x <= 0.0f || halfExtents.y <= 0.0f || halfExtents.z <= 0.0f) return false; return true; } #if !PX_DOXYGEN } // namespace physx #endif /** @} */ #endif
#pragma once #include <string> // undefine glibc macros #ifdef major #undef major #endif #ifdef minor #undef minor #endif namespace Lib830 { struct VersionInfo { int major; int minor; int patch; VersionInfo(int major, int minor = 0, int patch = 0): major(major), minor(minor), patch(patch) {} bool operator==(const VersionInfo& other); bool operator<(const VersionInfo& other); inline bool operator<=(const VersionInfo& other) { return operator==(other) || operator<(other); } inline bool operator!=(const VersionInfo &other) { return !operator==(other); } inline bool operator>(const VersionInfo &other) { return !operator<=(other); } inline bool operator>=(const VersionInfo &other) { return !operator<(other); } }; std::string GetWPILibVersionString(); VersionInfo GetWPILibVersion(std::string raw); inline VersionInfo GetWPILibVersion() { return GetWPILibVersion(GetWPILibVersionString()); } }
// // code for unification. the algorithm is from the book Artificial Intelligence // by E. Rich and K. Knight (2nd edition) on pages 152, 153. // // headers #include "unification.h" // unify two term, if possible int unify(Terms &t1, Terms &t2, Substitutions &s) { // check if a variable or constant if (t1.type != Terms::Function || t2.type != Terms::Function) { // type better be known MustBeTrue((t1.type != Terms::Unknown) && (t2.type != Terms::Unknown)); // check if they are identical if (t1.eq(t2)) { // no substitutions required s.clear(); } else if (t1.type == Terms::Variable) { // t1 is a variable, check if t1 occurs in t2 if (t2.occurs(t1)) { // not unifiable s.clear(); return(NOMATCH); } // return { t2 / t1 } s.insert(Substitution(t2, t1.value)); } else if (t2.type == Terms::Variable) { // t2 is a variable, check if t2 occurs in t1 if (t1.occurs(t2)) { // not unifiable s.clear(); return(NOMATCH); } // return { t1 / t2 } s.insert(Substitution(t1, t2.value)); } else { // not unifiable s.clear(); return(NOMATCH); } return(OK); } // symbol name must the same if (t1.ne(t2)) { // not unifiable s.clear(); return(NOMATCH); } // check number arguments MustBeTrue(t1.argnum > 0 && t2.argnum > 0); if (t1.argnum != t2.argnum) { // not unifiable s.clear(); return(NOMATCH); } // unify function arguments ListIterator<Terms * > t1ai(*t1.pargs); ListIterator<Terms * > t2ai(*t2.pargs); // cycle through the arguments Substitutions s2; for ( ; !t1ai.done() && !t2ai.done(); t1ai++, t2ai++) { int status; // clear old substitutions s2.clear(); // apply current list of substitutions to // the next term. if ((status = s.applyTo(*t1ai())) != OK) { s.clear(); return(status); } if ((status = s.applyTo(*t2ai())) != OK) { s.clear(); return(status); } // attempt to unify the terms if ((status = unify(*t1ai(), *t2ai(), s2)) != OK) { // no match or an error. s.clear(); return(status); } // compose the new substitutions with the old s = s*s2; } // both iterators should be done if (!t1ai.done() || !t2ai.done()) { // not unifiable s.clear(); return(NOMATCH); } // unified return(OK); } int unify(Literal &l1, Literal &l2, Substitutions &s) { // check if the literals are equivalent, at least. if (l1.ne(l2)) return(NOMATCH); // clear substitutions s.clear(); // check if a not a function if ((l1.type != Literal::Function) && (l1.type != Literal::Equal)) { // a literal constant. return(OK); } // the number of arguments must be the same. it's suppose // to be the same predicate function. // MustBeTrue(l1.argnum > 0 && l2.argnum > 0); if (l1.argnum != l2.argnum) { // not unifiable s.clear(); return(NOMATCH); } // new substitutions Substitutions s2; // we have a function. unify term-by-term, if possible. ListIterator<Terms * > l1args(*l1.pargs); ListIterator<Terms * > l2args(*l2.pargs); for ( ; !l1args.done() && !l2args.done(); l1args++, l2args++) { int status; // clear old substitutions s2.clear(); // apply current list of substitutions to // the next term. if ((status = s.applyTo(*l1args())) != OK) { s.clear(); return(status); } if ((status = s.applyTo(*l2args())) != OK) { s.clear(); return(status); } // attempt to unify the terms if ((status = unify(*l1args(), *l2args(), s2)) != OK) { // no match or an error. s.clear(); return(status); } // compose the new substitutions with the old s = s*s2; } // both iterators should be done if (!l1args.done() || !l2args.done()) { // not unifiable s.clear(); return(NOMATCH); } // all done return(OK); } // unify lists of literals, if possible int unify(List<Literal> &ls, Substitutions &s) { // clear all substitutions s.clear(); // attempt to unify all the literals. if (ls.getCount() <= 1) return(NOMATCH); // attempt to unify all the terms Substitutions s2; ListIterator<Literal> lsi(ls); if (lsi.done()) { ERROR("unexpected end-of-iterator.", EINVAL); return(NOTOK); } Literal l0save = lsi(); for (lsi++; !lsi.done(); lsi++) { int status; // next literal to try to unify Literal l0 = l0save; Literal li = lsi(); // clear old substitutions s2.clear(); // apply current list of substitutions to // the next term. if ((status = s.applyTo(li)) != OK) { s.clear(); return(status); } // attempt to unify the terms if ((status = unify(l0, li, s2)) != OK) { // no match or an error. s.clear(); return(status); } // apply current list of substitutions to // the current unified term. if ((status = s2.applyTo(l0save)) != OK) { s.clear(); return(status); } // compose the new substitutions with the old s = s*s2; } // all done return(OK); }
//------------------------------------------------------------------------------------------------------- // Copyright (C) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. //------------------------------------------------------------------------------------------------------- #pragma once namespace Js { enum class JavascriptArrayIteratorKind { Key, Value, KeyAndValue, }; class JavascriptArrayIterator : public DynamicObject { private: Field(Var) m_iterableObject; Field(int64) m_nextIndex; Field(JavascriptArrayIteratorKind) m_kind; protected: DEFINE_VTABLE_CTOR(JavascriptArrayIterator, DynamicObject); DEFINE_MARSHAL_OBJECT_TO_SCRIPT_CONTEXT(JavascriptArrayIterator); public: JavascriptArrayIterator(DynamicType* type, Var iterable, JavascriptArrayIteratorKind kind); class EntryInfo { public: static FunctionInfo Next; }; static Var EntryNext(RecyclableObject* function, CallInfo callInfo, ...); public: Var GetIteratorObjectForHeapEnum() { return m_iterableObject; } }; template <> inline bool VarIsImpl<JavascriptArrayIterator>(RecyclableObject* obj) { return JavascriptOperators::GetTypeId(obj) == TypeIds_ArrayIterator; } } // namespace Js
// // PXGraphics.h // Pixate // // Copyright (c) 2012 Pixate, Inc. All rights reserved. // // categories #import "UIColor+PXColors.h" // math #import "PXDimension.h" #import "PXMath.h" #import "PXVector.h" // paints #import "PXGradient.h" #import "PXLinearGradient.h" #import "PXPaint.h" #import "PXPaintGroup.h" #import "PXRadialGradient.h" #import "PXSolidPaint.h" // parsing #import "PXSVGLoader.h" // shadows #import "PXShadow.h" #import "PXShadowGroup.h" #import "PXShadowPaint.h" // shapes #import "PXArc.h" #import "PXBoundable.h" #import "PXCircle.h" #import "PXEllipse.h" #import "PXLine.h" #import "PXPaintable.h" #import "PXPath.h" #import "PXPie.h" #import "PXPolygon.h" #import "PXRectangle.h" #import "PXRenderable.h" #import "PXShapeDocument.h" #import "PXShape.h" #import "PXShapeGroup.h" #ifdef PXTEXT_SUPPORT #import "PXText.h" #endif // strokes #import "PXNonScalingStroke.h" #import "PXStroke.h" #import "PXStrokeGroup.h" #import "PXStrokeRenderer.h" #import "PXStrokeStroke.h" // views #import "PXShapeView.h"
/* ----------------------------------------------------------------- */ /* The Japanese TTS System "Open JTalk" */ /* developed by HTS Working Group */ /* http://open-jtalk.sourceforge.net/ */ /* ----------------------------------------------------------------- */ /* */ /* Copyright (c) 2008-2014 Nagoya Institute of Technology */ /* Department of Computer Science */ /* */ /* All rights reserved. */ /* */ /* Redistribution and use in source and binary forms, with or */ /* without modification, are permitted provided that the following */ /* conditions are met: */ /* */ /* - 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 HTS working group 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 NJD_SET_LONG_VOWEL_RULE_H #define NJD_SET_LONG_VOWEL_RULE_H #ifdef __cplusplus #define NJD_SET_LONG_VOWEL_RULE_H_START extern "C" { #define NJD_SET_LONG_VOWEL_RULE_H_END } #else #define NJD_SET_LONG_VOWEL_RULE_H_START #define NJD_SET_LONG_VOWEL_RULE_H_END #endif /* __CPLUSPLUS */ NJD_SET_LONG_VOWEL_RULE_H_START; static const char njd_set_long_vowel_kanji_range[] = { #ifdef CHARSET_EUC_JP 2, 0xA1, 0xFE, 3, 0x8F, 0x8F, #endif /* CHARSET_EUC_JP */ #ifdef CHARSET_SHIFT_JIS 2, 0x81, 0xFC, #endif /* CHARSET_SHIFT_JIS */ #ifdef CHARSET_UTF_8 2, 0xC0, 0xDF, 3, 0xE0, 0xEF, 4, 0xF0, 0xF7, #endif /* CHARSET_UTF_8 */ -1, -1, -1 }; static const char *njd_set_long_vowel_table[] = { "エイ", "エー", "ケイ", "ケー", "セイ", "セー", "テイ", "テー", "ネイ", "ネー", "ヘイ", "ヘー", "メイ", "メー", "レイ", "レー", "ゲイ", "ゲー", "ゼイ", "ゼー", "デイ", "デー", "ベイ", "ベー", "ペイ", "ペー", "ヱイ", "ヱー", NULL, NULL }; NJD_SET_LONG_VOWEL_RULE_H_END; #endif /* !NJD_SET_LONG_VOWEL_RULE_H */
#ifndef __InputParticle_h__ #define __InputParticle_h__ #include "Input.h" #include <HAPI/HAPI.h> class InputParticle : public Input { public: InputParticle(int assetId, int inputIdx); virtual ~InputParticle(); virtual AssetInputType assetInputType() const; virtual void setInputTransform(MDataHandle &dataHandle); virtual void setInputGeo( MDataBlock &dataBlock, const MPlug &plug ); protected: void setAttributePointData( const char* attributeName, HAPI_StorageType storage, int count, int tupleSize, void* data ); protected: int myInputAssetId; int myInputObjectId; int myInputGeoId; }; #endif
#include <stdlib.h> #include <stdio.h> // VETORES E MATRIZES // LISTA C04 /* //1. int main(){ int A[6] = {1,0,5,-2,-5,7}; int soma = A[0] + A[1] + A[5]; printf("Soma: %d\n", soma); A[3] = 100; int i; for(i=0;i<6;i++){ printf("A[%d]: %d\n", i, A[i]); } return 0; } */ /* //2.Crie um programa que le 6 valores inteiros e, em seguida, mostre na tela os valores lidos int main(){ int i; int x[6]; for(i=0; i<6; i++){ scanf("%d",&x[i]); } for(i=0; i<6; i++){ printf("x[%d]: %d\n",i,x[i]); } return 0; } */ /* //3. int main(){ float x[10], k[10]; int i; for(i=0;i<10;i++){ scanf("%f", &x[i]); k[i] = x[i] * x[i]; } int j; for(j=0; j<10; j++){ printf("x[%d]: %f \tk[%d]: %f\n", j, x[j], j, k[j]); } return 0; } */ /* //4. int main(){ int i,A[8]; for(i=0; i<8; i++){ printf("Insira A[%d]: ",i); scanf("%d", &A[i]); } int x,y; printf("Insira valor de X: "); scanf("%d",&x); printf("Insira valor de Y: "); scanf("%d", &y); int soma = A[x] + A[y]; printf("Soma de A[%d]: %d + A[%d]: %d = %d", x, A[x], y, A[y], soma); return 0; } */ /* int main(){ //5 int i,count=0,vet[10]; for(i=0; i<10;i++){ printf("vet[%d]: ",i); scanf("%d",&vet[i]); if(vet[i] % 2 == 0) count += 1; } printf("There are %d even numbers\n",count); return 0; } */ /* int main(){ //6. int i,highest=0,lowest=0,vet[10]; vet[0] = 0; for(i=0;i<10;i++){ printf("vet[%d]:",i); scanf("%d",&vet[i]); if(i==0) continue; if(vet[i]<vet[i-1]) lowest = vet[i]; if(vet[i]>vet[i-1]) highest = vet[i]; } printf("lowest: %d\n",lowest); printf("highest: %d\n", highest); return 0; } */ //7 int main(){ int i, vet[10], maior =0 , maior_p; for(i=0;i<10;i++){ printf("vet[%d]: ", i); scanf("%d", &vet[i]); if(vet[i]>maior){ maior = vet[i]; maior_p = i; } } printf("maior: %d\nmaior_p: %d\n", maior, maior_p); return 0; } /* int main(){ //25 int vet[100]; vet[0]=0; int c=0, i=0; while(c<100){ if(i%7==0){ vet[c]=i; c++; } i++; } printf("%f\n", sizeof(vet)/4.0); for(i=0;i<100;i++){ printf("vet[%d]: %d\n", i,vet[i]); } return 0; } */ /* IMPRIMINDO MATRIZ 3x3 int main(){ int matriz[3][3] = { {1,2,3}, {4,5,6}, {7,8,9}}; int i = 0,j=0; for(i=0;i<3;i++){ printf("\n"); for(j=0;j<3;j++) printf("%d", matriz[i][j]); } return 0; } */ //27 /* int main(){ int i,j,count=0,pos[10],k=0,flag=0; int vet[10]; for(i=0; i<10; i++){ printf("vet[%d]: ",i); scanf("%d",&vet[i]); } for(i=0; i<10; i++){ flag = 0; count = 0; for(j=2; j<=(vet[i]/2); j++){ if(vet[i] % j == 0){ flag = 1; } } if(vet[i] == 0 || vet[i] == 1) flag = 1; if(flag == 0){ printf("\nvet[%d]: %d\n", i, vet[i]); } } return 0; } */ //34 /* int main(){ int i,j,k,n[10], flag=0; n[0]=0; for(i=0;i<10;i++){ if(flag==1){ flag = 0; i--; }else{ printf("Ni[%d]: ", i); scanf("%d",&n[i]); } for(j=0;j<i;j++){ if(n[j] == n[i]){ printf("Ni[%d] == Ni[%d] insira outro valor\nNovo Ni[%d]: ",j,i,i); setbuf(stdin, NULL); scanf("%d", &n[i]); flag = 1; } } } return 0; } */ //2. MATRIZES //1. /* int main(){ int A[4][4]; int i,j; j=0; for(i=0;i<4;i++){ for(j=0;j<4;j++){ printf("Insira valor de A[%d][%d]: ", i, j); scanf("%d", &A[i][j]); } return 0; } } */ /* int i,j, qtd= 0; float A[4][4]; for(i=0; i<4; i++) for(j=0; j<4;j++){ printf("Digite a pos %d,%d: ",i,j); scanf("%f",&A[i][j]); if(A[i][j] > 10) qtd++; } } */
/* realft.c */ #define SWAP(a,b) tempr=(a); (a)=(b);(b)=tempr /* warning: programmed assuming data starts at a[1]; with zero offset array, call with &a[-1] */ void four1(data,nn,isign) double data[]; unsigned int nn; int isign; { unsigned int n,mmax,m,j,istep,i; double wtemp,wr,wpr,wpi,wi,theta; double tempr,tempi; n = nn<<1; j = 1; for( i=1; i<n ; i+=2){ if( j > i){ SWAP(data[j],data[i]); SWAP(data[j+1],data[i+1]); } m = n>>1; while( m>=2 && j>m ){ j -= m; m >>= 1; } j += m; } mmax =2; while(n > mmax){ istep = mmax<<1; theta = isign*(6.28318530717959/mmax); wtemp = sin(0.5*theta); wpr = -2.0*wtemp*wtemp; wpi = sin(theta); wr = 1.0; wi = 0.0; for( m=1; m<mmax; m +=2){ for( i=m; i<= n; i += istep){ j = i+mmax; tempr = wr*data[j] - wi*data[j+1]; tempi = wr*data[j+1] + wi*data[j]; data[j] = data[i] - tempr; data[j+1] = data[i+1] - tempi; data[i] += tempr; data[i+1] += tempi; } wr = (wtemp=wr)*wpr - wi*wpi + wr; wi = wi*wpr + wtemp*wpi + wi; } mmax = istep; } } void realft(data, n, isign) double data[]; unsigned int n; int isign; { int i,i1,i2,i3,i4,np3; double c1=.5,c2,h1r,h1i,h2r,h2i; double wr,wi,wpr,wpi,wtemp,theta; theta = 3.141592653589793/ (double) (n/2); if(isign == 1){ c2 = -0.5; four1(data,n/2,1); } else { c2 = 0.5; theta = -theta; } wtemp = sin(.5 * theta); wpr = -2.0 * wtemp*wtemp; wpi = sin(theta); wr = 1.0 + wpr; wi = wpi; np3 = n+3; for( i=2; i<= (n/4); i++){ i4 = 1 + (i3 = np3 - (i2 = 1 + (i1 = i+i-1))); h1r = c1 * (data[i1] + data[i3]); h1i = c1 * (data[i2] - data[i4]); h2r = -c2 * (data[i2] + data[i4]); h2i = c2 * (data[i1] - data[i3]); data[i1] = h1r + wr*h2r - wi*h2i; data[i2] = h1i + wr*h2i + wi*h2r; data[i3] = h1r - wr*h2r + wi*h2i; data[i4] = -h1i + wr*h2i + wi*h2r; wr = (wtemp =wr)*wpr - wi*wpi + wr; wi = wi*wpr + wtemp*wpi + wi; } if(isign == 1) { data[1] = (h1r=data[1]) + data[2]; data[2] = h1r-data[2]; } else { data[1] = c1 * ( (h1r=data[1]) + data[2]); data[2] = c1 * (h1r - data[2]); four1(data,n>>1,-1); } }
// RUN: %ucc -c %s typedef int bool; static bool f(a, b) struct A *a; struct B *b; { }
// // xtea.c // ProtocolLib // // Created by pengyunchou on 14-7-21. // Copyright (c) 2014年 kyx. All rights reserved. // #include <stdio.h> #include "xtea.h" void xtea_encrypt(unsigned int num_rounds, uint32_t v[2], uint32_t const key[4]) { unsigned int i; uint32_t v0=v[0], v1=v[1], sum=0, delta=0x9E3779B9; for (i=0; i < num_rounds; i++) { v0 += (((v1 << 4) ^ (v1 >> 5)) + v1) ^ (sum + key[sum & 3]); sum += delta; v1 += (((v0 << 4) ^ (v0 >> 5)) + v0) ^ (sum + key[(sum>>11) & 3]); } v[0]=v0; v[1]=v1; } void xtea_decrypt(unsigned int num_rounds, uint32_t v[2], uint32_t const key[4]) { unsigned int i; uint32_t v0=v[0], v1=v[1], delta=0x9E3779B9, sum=delta*num_rounds; for (i=0; i < num_rounds; i++) { v1 -= (((v0 << 4) ^ (v0 >> 5)) + v0) ^ (sum + key[(sum>>11) & 3]); sum -= delta; v0 -= (((v1 << 4) ^ (v1 >> 5)) + v1) ^ (sum + key[sum & 3]); } v[0]=v0; v[1]=v1; }
// // Copyright (c) 2014-2015 Pantazis Deligiannis (p.deligiannis@imperial.ac.uk) // This file is distributed under the MIT License. See LICENSE for details. // #ifndef TESTDRIVERREWRITEVISITOR_H #define TESTDRIVERREWRITEVISITOR_H #include "chauffeur/DriverInfo.h" #include "chauffeur/AbstractDriverRewriteVisitor.h" #include "clang/AST/ASTContext.h" #include "clang/AST/RecursiveASTVisitor.h" #include "clang/Frontend/CompilerInstance.h" #include "clang/Rewrite/Core/Rewriter.h" namespace chauffeur { using namespace clang; class TestDriverRewriteVisitor : public AbstractDriverRewriteVisitor { protected: virtual void InstrumentEntryPoints(FunctionDecl* FD, string fdFile); virtual void CreateCheckerFunction(FunctionDecl* FD, string fdFile); virtual string GetSharedStructStr(CallExpr *callExpr); public: explicit TestDriverRewriteVisitor(CompilerInstance *CI, bool doInline) : AbstractDriverRewriteVisitor(CI, doInline) { } virtual ~TestDriverRewriteVisitor() {} }; } #endif // TESTDRIVERREWRITEVISITOR_H
// // Copyright (c) .NET Foundation and Contributors // See LICENSE file in the project root for full license information. // #include <hal.h> #include <hal_nf_community.h> int mbedtls_hardware_poll(void *data, unsigned char *output, size_t len, size_t *olen); // Get len bytes of entropy from the hardware RNG. int mbedtls_hardware_poll(void *data, unsigned char *output, size_t len, size_t *olen) { (void)data; // start random generator rngStart(); for (size_t i = 0; i < len; i++) { // our generator returns 32bits numbers *output = rngGenerateRandomNumber(); output++; } // callers require this to be set *olen = len; // stop random generator rngStop(); return 0; }
#ifndef _HT_CUCKOO_H_ #define _HT_CUCKOO_H_ 1 #include <stdint.h> #define ht_cuckoo_code(hash_t,entry_t,gethash1,gethash2,eq,defined,init,unset) \ typedef struct { \ int size; \ int used; \ entry_t *data; \ } hash_t;\ void static inline hash_t ## _init(hash_t *ht) { \ ht->size=0; \ ht->used=0; \ ht->data=NULL; \ } \ int static inline hash_t ## _count(hash_t *ht) { \ return (ht->used); \ } \ entry_t static inline *hash_t ## _find(hash_t *ht, entry_t *entry) { \ if (ht->size) { \ uint32_t h1=gethash1((entry)),h2=gethash2((entry)); \ h1 = (h1 >> (32-ht->size)); \ h2 = (h2 >> (32-ht->size)) | (1 << ht->size); \ if (defined((ht->data)+h1) && eq((entry),(ht->data)+h1)) return (&(ht->data[h1])); \ if (defined((ht->data)+h2) && eq((entry),(ht->data)+h2)) return (&(ht->data[h2])); \ } \ return NULL; \ } \ int static inline hash_t ## _have(hash_t *ht, entry_t *entry) { \ return ((hash_t ## _find(ht,entry)) != NULL); \ } \ int static inline hash_t ## _size(hash_t *ht) { \ return (ht->size); \ } \ int static inline hash_t ## _mem(hash_t *ht) { \ return (ht->size > 0); \ } \ void static inline hash_t ## _double(hash_t *ht) { \ entry_t *nw=malloc(sizeof(entry_t)*(4 << (ht->size))); \ for (int i=0; i<(2 << ht->size); i++) { \ if (ht->size && defined((ht->data)+i)) { \ uint32_t h=(i < (1 << ht->size)) ? gethash1((ht->data)+i) : gethash2((ht->data)+i); \ h = (h >> (31-ht->size)) & 1; \ nw[i<<1 | h]=ht->data[i]; \ init(nw+(i<<1 | (h^1))); \ } else { \ init(nw+(i<<1)); \ init(nw+(i<<1 | 1)); \ } \ } \ ht->size++; \ if (ht->data==NULL) { \ /*fprintf(stderr,"[alloc " #hash_t " hashtable %p]\n",ht);*/ \ } else { \ free(ht->data); \ } \ ht->data=nw; \ } \ void static inline hash_t ## _set(hash_t *ht, entry_t *entry) { \ entry_t *r=hash_t ## _find(ht,entry); \ entry_t bak; \ if (r) { \ (*r)=(*entry); \ return; \ } \ /*fprintf(stderr,"[adding element to %i-element " #hash_t " hash %p (size %i)]\n",ht->used,ht,ht->size);*/ \ ht->used++; \ if (ht->used>(5*(1<< (ht->size)))/6) { \ hash_t ## _double(ht); \ } \ while (1) { \ int maxiter=(23*ht->size+11)/2; \ while (maxiter--) { \ uint32_t h1=gethash1((entry)); \ h1 = (h1 >> (32-ht->size)); \ if (!(defined((ht->data)+h1))) { \ ht->data[h1]=(*entry); \ return; \ } else { \ bak=ht->data[h1]; \ ht->data[h1]=(*entry); \ } \ uint32_t h2=gethash2(&bak); \ h2 = (h2 >> (32-ht->size)) | (1 << ht->size); \ if (!(defined((ht->data)+h2))) { \ ht->data[h2]=bak; \ return; \ } else { \ (*entry)=ht->data[h2]; \ ht->data[h2]=bak; \ } \ } \ hash_t ## _double(ht); \ } \ } \ void static inline hash_t ## _unset(hash_t *ht, entry_t *entry) { \ entry_t *r=hash_t ## _find(ht,entry); \ if (r) { \ /*fprintf(stderr,"[unsetting element in %i-element " #hash_t " hash %p (size %i)]\n",ht->used,ht,ht->size);*/ \ ht->used--; \ unset(r); \ } else {\ /*fprintf(stderr,"[not unsetting element in %i-element " #hash_t " hash %p (size %i)]\n",ht->used,ht,ht->size);*/ \ } \ } \ void static inline hash_t ## _free(hash_t *ht) { \ if (ht->data) { \ /*fprintf(stderr,"[removing %i-element " #hash_t " hash %p (size %i)]\n",ht->used,ht,ht->size);*/ \ for (int j=0; j<(2<<ht->size); j++) { \ if (defined(ht->data+j)) { \ unset((ht->data+j)); \ } \ } \ ht->size=0; \ ht->used=0; \ free(ht->data); \ ht->data=NULL; \ } \ } \ void static inline hash_t ## _freecopy(hash_t *ht) { \ if (ht->data) { \ /*fprintf(stderr,"[removing %i-element " #hash_t " hash %p (size %i)]\n",ht->used,ht,ht->size);*/ \ ht->size=0; \ ht->used=0; \ free(ht->data); \ ht->data=NULL; \ } \ } \ void static inline hash_t ## _copy(hash_t *from, hash_t *to) { \ to->size=from->size; \ to->used=from->used; \ if (from->data) { \ to->data=malloc(sizeof(entry_t)*(2<<(from->size))); \ memcpy(to->data,from->data,sizeof(entry_t)*(2<<(from->size))); \ } else { \ to->data=NULL; \ } \ } \ entry_t static inline * hash_t ## _first(hash_t *ht) { \ if (ht->data) { \ for (int j=0; j<(2<<(ht->size)); j++) { \ if (defined(&(ht->data[j]))) { \ return (&(ht->data[j])); \ } \ } \ } \ return NULL; \ } \ entry_t static inline * hash_t ## _next(hash_t *ht, entry_t *entry) { \ if (ht->data) { \ for (int j=entry-ht->data+1; j<(2<<(ht->size)); j++) { \ if (defined(&(ht->data[j]))) { \ return (&(ht->data[j])); \ } \ } \ } \ return NULL; \ } \ void static hash_t ## _addall(hash_t *to, hash_t *from) { \ entry_t *ent=hash_t##_first(from); \ while (ent) { \ entry_t ent2=(*ent); \ hash_t##_set(to,(&ent2)); \ ent=hash_t##_next(from,ent); \ } \ } \ #endif
#pragma once #include "Action.h" class GameRoom; struct ActionComparator { bool operator()( const Action* lhs, const Action* rhs ) const { return ( lhs->GetTime() > rhs->GetTime() ); } }; class ActionScheduler { public: ActionScheduler( GameRoom* gameRoom ); ~ActionScheduler(); void AddActionToScheduler( Action* addedAction, ULONGLONG remainTime ); void DoScheduledAction(); private: ULONGLONG GetCurrentTick() const; private: ULONGLONG m_BeginTime; ULONGLONG m_CurrentTime = 0; std::priority_queue<Action*, std::vector<Action*>, ActionComparator> m_ActionQueue; GameRoom* m_GameRoom = nullptr; // 임시 코드 std::set<Action*> m_UsedActions; };
/**************************************************************************** Copyright (c) 2014 Lijunlin - Jason lee Created by Lijunlin - Jason lee on 2014 jason.lee.c@foxmail.com http://www.cocos2d-x.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ #ifndef __CCWIDGET_LABEL_H__ #define __CCWIDGET_LABEL_H__ #include "cocos2d.h" #include "WidgetMacros.h" #include "Widget.h" #include "WidgetProtocol.h" NS_CC_WIDGET_BEGIN /** * class : CLabel * author : Jason lee * email : jason.lee.c@foxmail.com * descpt : label define */ class CLabel : public CCLabelTTF, public CWidget, public CClickableProtocol, public CLongClickableProtocol { public: CLabel(); virtual ~CLabel(); virtual bool init(); static CLabel* create(); static CLabel* create(const char *pString, const char *pFontName, float fFontSize); static CLabel* create(const char *pString, const char *pFontName, float fFontSize, const CCSize& tDimensions, CCTextAlignment hAlignment); static CLabel* create(const char *pString, const char *pFontName, float fFontSize, const CCSize& tDimensions, CCTextAlignment hAlignment, CCVerticalTextAlignment vAlignment); public: virtual CWidgetTouchModel onTouchBegan(CCTouch* pTouch); virtual void onTouchMoved(CCTouch* pTouch, float fDuration); virtual void onTouchEnded(CCTouch* pTouch, float fDuration); virtual void onTouchCancelled(CCTouch* pTouch, float fDuration); CC_WIDGET_LONGCLICK_SCHEDULE(CLabel); }; NS_CC_WIDGET_END #endif //__CCWIDGET_LABEL_H__
/* * audio encoder psychoacoustic model * Copyright (C) 2008 Konstantin Shishkov * * This file is part of Libav. * * Libav 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. * * Libav 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 Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avcodec.h" #include "psymodel.h" #include "iirfilter.h" extern const FFPsyModel ff_aac_psy_model; av_cold int ff_psy_init(FFPsyContext *ctx, AVCodecContext *avctx, int num_lens, const uint8_t **bands, const int* num_bands, int num_groups, const uint8_t *group_map) { int i, j, k = 0; ctx->avctx = avctx; ctx->ch = av_mallocz(sizeof(ctx->ch[0]) * avctx->channels * 2); ctx->group = av_mallocz(sizeof(ctx->group[0]) * num_groups); ctx->bands = av_malloc (sizeof(ctx->bands[0]) * num_lens); ctx->num_bands = av_malloc (sizeof(ctx->num_bands[0]) * num_lens); memcpy(ctx->bands, bands, sizeof(ctx->bands[0]) * num_lens); memcpy(ctx->num_bands, num_bands, sizeof(ctx->num_bands[0]) * num_lens); /* assign channels to groups (with virtual channels for coupling) */ for (i = 0; i < num_groups; i++) { /* NOTE: Add 1 to handle the AAC chan_config without modification. * This has the side effect of allowing an array of 0s to map * to one channel per group. */ ctx->group[i].num_ch = group_map[i] + 1; for (j = 0; j < ctx->group[i].num_ch * 2; j++) ctx->group[i].ch[j] = &ctx->ch[k++]; } switch (ctx->avctx->codec_id) { case CODEC_ID_AAC: ctx->model = &ff_aac_psy_model; break; } if (ctx->model->init) return ctx->model->init(ctx); return 0; } FFPsyChannelGroup *ff_psy_find_group(FFPsyContext *ctx, int channel) { int i = 0, ch = 0; while (ch <= channel) ch += ctx->group[i++].num_ch; return &ctx->group[i-1]; } av_cold void ff_psy_end(FFPsyContext *ctx) { if (ctx->model->end) ctx->model->end(ctx); av_freep(&ctx->bands); av_freep(&ctx->num_bands); av_freep(&ctx->group); av_freep(&ctx->ch); } typedef struct FFPsyPreprocessContext{ AVCodecContext *avctx; float stereo_att; struct FFIIRFilterCoeffs *fcoeffs; struct FFIIRFilterState **fstate; }FFPsyPreprocessContext; #define FILT_ORDER 4 av_cold struct FFPsyPreprocessContext* ff_psy_preprocess_init(AVCodecContext *avctx) { FFPsyPreprocessContext *ctx; int i; float cutoff_coeff = 0; ctx = av_mallocz(sizeof(FFPsyPreprocessContext)); ctx->avctx = avctx; if (avctx->cutoff > 0) cutoff_coeff = 2.0 * avctx->cutoff / avctx->sample_rate; if (cutoff_coeff) ctx->fcoeffs = ff_iir_filter_init_coeffs(avctx, FF_FILTER_TYPE_BUTTERWORTH, FF_FILTER_MODE_LOWPASS, FILT_ORDER, cutoff_coeff, 0.0, 0.0); if (ctx->fcoeffs) { ctx->fstate = av_mallocz(sizeof(ctx->fstate[0]) * avctx->channels); for (i = 0; i < avctx->channels; i++) ctx->fstate[i] = ff_iir_filter_init_state(FILT_ORDER); } return ctx; } void ff_psy_preprocess(struct FFPsyPreprocessContext *ctx, const int16_t *audio, int16_t *dest, int tag, int channels) { int ch, i; if (ctx->fstate) { for (ch = 0; ch < channels; ch++) ff_iir_filter(ctx->fcoeffs, ctx->fstate[tag+ch], ctx->avctx->frame_size, audio + ch, ctx->avctx->channels, dest + ch, ctx->avctx->channels); } else { for (ch = 0; ch < channels; ch++) for (i = 0; i < ctx->avctx->frame_size; i++) dest[i*ctx->avctx->channels + ch] = audio[i*ctx->avctx->channels + ch]; } } av_cold void ff_psy_preprocess_end(struct FFPsyPreprocessContext *ctx) { int i; ff_iir_filter_free_coeffs(ctx->fcoeffs); if (ctx->fstate) for (i = 0; i < ctx->avctx->channels; i++) ff_iir_filter_free_state(ctx->fstate[i]); av_freep(&ctx->fstate); av_free(ctx); }
/* http://www.jera.com/techinfo/jtns/jtn002.html */ #define mu_assert(message, test) do { if (!(test)) return message; } while (0) #define mu_run_test(test) do { char *message = test(); tests_run++; \ if (message) return message; } while (0) extern int tests_run;
/* Copyright (c) 2008-2009 NetAllied Systems GmbH This file is part of COLLADASaxFrameworkLoader. Licensed under the MIT Open Source License, for details please see LICENSE file or the website http://www.opensource.org/licenses/mit-license.php */ #ifndef __COLLADASAXFWL_NODELOADER15_H__ #define __COLLADASAXFWL_NODELOADER15_H__ #include "COLLADASaxFWLPrerequisites.h" #include "COLLADASaxFWLNodeLoader.h" #include "COLLADASaxFWLIParserImpl15.h" namespace COLLADASaxFWL { class IFilePartLoader; class NodeLoader15 : public IParserImpl15 { private: NodeLoader* mLoader; public: NodeLoader15(NodeLoader* loader) : mLoader(loader) {} virtual bool begin__node( const COLLADASaxFWL15::node__AttributeData& attributeData ); virtual bool end__node(); virtual bool begin__translate( const COLLADASaxFWL15::translate__AttributeData& attributeData ); virtual bool end__translate(); virtual bool data__translate( const float* data, size_t length ); virtual bool begin__rotate( const COLLADASaxFWL15::rotate__AttributeData& attributeData ); virtual bool end__rotate(); virtual bool data__rotate( const float* data, size_t length ); virtual bool begin__matrix____matrix_type( const COLLADASaxFWL15::matrix____matrix_type__AttributeData& attributeData ); virtual bool end__matrix____matrix_type(); virtual bool data__matrix____matrix_type( const float* data, size_t length ); virtual bool begin__scale( const COLLADASaxFWL15::scale__AttributeData& attributeData ); virtual bool end__scale(); virtual bool data__scale( const float* data, size_t length ); virtual bool begin__skew( const COLLADASaxFWL15::skew__AttributeData& attributeData ); virtual bool end__skew(); virtual bool data__skew( const float* data, size_t length ); virtual bool begin__lookat( const COLLADASaxFWL15::lookat__AttributeData& attributeData ); virtual bool end__lookat(); virtual bool data__lookat( const float* data, size_t length ); virtual bool begin__instance_geometry( const COLLADASaxFWL15::instance_geometry__AttributeData& attributeData ); virtual bool end__instance_geometry(); virtual bool begin__bind_material(); virtual bool end__bind_material(); virtual bool begin__bind_material_type____technique_common(); virtual bool end__bind_material_type____technique_common(); virtual bool begin__instance_material____instance_material_type( const COLLADASaxFWL15::instance_material____instance_material_type__AttributeData& attributeData ); virtual bool end__instance_material____instance_material_type(); virtual bool begin__bind_vertex_input( const COLLADASaxFWL15::bind_vertex_input__AttributeData& attributeData ); virtual bool end__bind_vertex_input(); virtual bool begin__instance_node( const COLLADASaxFWL15::instance_node__AttributeData& attributeData ); virtual bool end__instance_node(); virtual bool begin__instance_camera( const COLLADASaxFWL15::instance_camera__AttributeData& attributeData ); virtual bool end__instance_camera(); virtual bool begin__instance_light( const COLLADASaxFWL15::instance_light__AttributeData& attributeData ); virtual bool end__instance_light(); virtual bool begin__instance_controller( const COLLADASaxFWL15::instance_controller__AttributeData& attributeData ); virtual bool end__instance_controller(); virtual bool begin__skeleton(); virtual bool end__skeleton(); virtual bool data__skeleton( COLLADABU::URI value ); private: /** Disable default copy ctor. */ NodeLoader15(const NodeLoader15&); /** Disable default assignment operator. */ const NodeLoader15& operator=(const NodeLoader15&); }; } #endif // __COLLADASAXFWL_NODELOADER15_H__
// To check if a library is compiled with CocoaPods you // can use the `COCOAPODS` macro definition which is // defined in the xcconfigs so it is available in // headers also when they are imported in the client // project. // TTQRCodeScanner #define COCOAPODS_POD_AVAILABLE_TTQRCodeScanner #define COCOAPODS_VERSION_MAJOR_TTQRCodeScanner 1 #define COCOAPODS_VERSION_MINOR_TTQRCodeScanner 0 #define COCOAPODS_VERSION_PATCH_TTQRCodeScanner 1
#if defined(PEGASUS_OS_HPUX) # include "UNIX_LimitedAccessPortDeps_HPUX.h" #elif defined(PEGASUS_OS_LINUX) # include "UNIX_LimitedAccessPortDeps_LINUX.h" #elif defined(PEGASUS_OS_DARWIN) # include "UNIX_LimitedAccessPortDeps_DARWIN.h" #elif defined(PEGASUS_OS_AIX) # include "UNIX_LimitedAccessPortDeps_AIX.h" #elif defined(PEGASUS_OS_FREEBSD) # include "UNIX_LimitedAccessPortDeps_FREEBSD.h" #elif defined(PEGASUS_OS_SOLARIS) # include "UNIX_LimitedAccessPortDeps_SOLARIS.h" #elif defined(PEGASUS_OS_ZOS) # include "UNIX_LimitedAccessPortDeps_ZOS.h" #elif defined(PEGASUS_OS_VMS) # include "UNIX_LimitedAccessPortDeps_VMS.h" #elif defined(PEGASUS_OS_TRU64) # include "UNIX_LimitedAccessPortDeps_TRU64.h" #else # include "UNIX_LimitedAccessPortDeps_STUB.h" #endif
void bm_init(); void bm_report(char *msg); void bm_read_keys(void (*cb)(char **key, int m));
/** * Copyright (c) 2016-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ #import <UIKit/UIKit.h> @class IGListCollectionViewLayout; NS_ASSUME_NONNULL_BEGIN /** This `UICollectionView` subclass allows for partial layout invalidation using `IGListCollectionViewLayout`. @note When updating a collection view (ex: calling `-insertSections`), `-invalidateLayoutWithContext` gets called on the layout object. However, the invalidation context doesn't provide details on which index paths are being modified, which typically forces a full layout re-calculation. `IGListCollectionView` gives `IGListCollectionViewLayout` the missing information to re-calculate only the modified layout attributes. */ NS_SWIFT_NAME(ListCollectionView) @interface IGListCollectionView : UICollectionView /** Create a new view with an `IGListcollectionViewLayout` class or subclass. @param frame The frame to initialize with. @param collectionViewLayout The layout to use with the collection view. @note You can initialize a new view with a base layout by simply calling `-[IGListCollectionView initWithFrame:]`. */ - (instancetype)initWithFrame:(CGRect)frame listCollectionViewLayout:(IGListCollectionViewLayout *)collectionViewLayout NS_DESIGNATED_INITIALIZER; /** :nodoc: */ - (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)collectionViewLayout NS_UNAVAILABLE; /** :nodoc: */ - (instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE; @end NS_ASSUME_NONNULL_END
/*===================================================================== z80.c -> Header file related to the Z80 emulation code. Please read documentation files to know how this works :) Thanks to Marat Fayzullin for writing the "How to write a Computer Eemulator" HOWTO. This emulator is based on his tutorials and the code organization (very readable!) of his "Z80 Portable Emulator". I've learnt a lot from it, and I've taken some ideas of his code to write this emulator.I think that almost all of the undocumented Z80 opcodes are covered on this emulator. I also asked Marat Fayzullin (by email) about ideas and so on (his Z80 emulator is quite good, so go check it :-). Of course, I can't forget Raúl Gomez (he answered me thousands of email questions) and Philip Kendall. Whitout his ___kind___ people surely you won't be reading this file now... "Programming the Z80" (from Rodnay Zaks) and the comp.sys.sinclair FAQ were another excelent sources of info! 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., 675 Mass Ave, Cambridge, MA 02139, USA. Copyright (c) 2000 Santiago Romero Iglesias. Email: sromero@escomposlinux.org ======================================================================*/ #ifndef Z80_H #define Z80_H #define USING_ALLEGRO #define DEBUG #define _DEV_DEBUG_ /* development debugging */ #define LOW_ENDIAN /*#define HI_ENDIAN */ /* Used by the Z80Debug() function */ #define DEBUG_OK 1 #define DEBUG_QUIT 0 #define video vscreen /*=== Some common standard data types: ==============================*/ typedef unsigned char byte; typedef unsigned short word; typedef unsigned long dword; typedef signed char offset; /*--- Thanks to Philip Kendall for it's help using the flags --------*/ extern byte halfcarry_add_table[]; extern byte halfcarry_sub_table[]; extern byte overflow_add_table[]; extern byte overflow_sub_table[]; extern byte sz53_table[]; extern byte sz53p_table[]; extern byte parity_table[]; extern byte ioblock_inc1_table[]; extern byte ioblock_dec1_table[]; extern byte ioblock_2_table[]; /*===================================================================== Z80 Flag Register: --------------------------------- | 7 6 5 4 3 2 1 0 | --------------------------------- | S Z x H x O/P N C | --------------------------------- If (1) means that: S = Negative result. Z = Zero result. x = special cases (by opcode) H = Halfcarry/borrow. O/P = Overflow/Parity Flag. N = Substraction. C = Carry/borrow. ====================================================================*/ #define S_FLAG 0x80 #define Z_FLAG 0x40 #define H_FLAG 0x10 #define P_FLAG 0x04 #define O_FLAG 0x04 #define N_FLAG 0x02 #define C_FLAG 0x01 /* Defines for interrupts and special Z80Hardware() codes: ======================================================================= INT_QUIT = Exit the emulation (for Z80Run()) INT_NOINT = No interrupt required INT_IRQ = Standard RST 38h interrupt INT_NMI = Non-maskerable interrupt */ #define INT_QUIT 0xFFFE #define INT_NOINT 0xFFFF #define INT_IRQ 0x0038 #define INT_NMI 0x0066 /*=== A register is defined as follows: =============================*/ typedef union { #ifdef LOW_ENDIAN struct { byte l,h; } B; #else struct { byte h,l; } B; #endif word W; } eword; #define WE_ARE_ON_DD 1 #define WE_ARE_ON_FD 2 /*=== Now we define the Z80 registers using the previous definition =*/ typedef struct { char machine_type; byte *RAM; int we_are_on_ddfd; /* general and shadow z80 registers */ eword AF, BC, DE, HL, IX, IY, PC, SP, R, AFs, BCs, DEs, HLs; /* IFF and I registers, used on interrupts. */ byte IFF1, IFF2, I, halted; char IM; word IRequest; /* the following is to take care of cycle counting */ int IPeriod, ICount, IBackup; /* DecodingErrors = set this to 1 for debugging purposes in order to trap undocumented or non implemented opcodes. Trace = set this to 1 to start tracing. It's also set when PC reaches TrapAddress value. */ byte DecodingErrors; word TrapAddress; byte Trace, dobreak; byte BorderColor; } Z80Regs; /*==================================================================== Function declarations, read the .c file to know what they do. ===================================================================*/ void Z80Reset( register Z80Regs *regs, int ); void Z80Interrupt( register Z80Regs *, register word ); word Z80Run( register Z80Regs *, int ); byte Z80MemRead( register word, Z80Regs * ); void Z80MemWrite( register word, register byte, Z80Regs * ); byte Z80InPort( register word ); void Z80OutPort( register Z80Regs *regs, register word, register byte ); void Z80Patch( register Z80Regs * ); byte Z80Debug( register Z80Regs * ); word Z80Hardware( register Z80Regs * ); void Z80FlagTables(void); word ParseOpcode( char *, char *, char *, word, Z80Regs * ); word Z80Dissasembler ( Z80Regs *, char *, char * ); #endif
#include "RASDemo.h" #include <RASLib/inc/common.h> #include <RASLib/inc/motor.h> static tMotor *Motors[4]; static tBoolean initialized = false; void initMotors(void) { if (!initialized) { initialized = true; Motors[0] = InitializeServoMotor(PIN_B6, false); Motors[1] = InitializeServoMotor(PIN_B7, false); Motors[2] = InitializeServoMotor(PIN_C4, false); Motors[3] = InitializeServoMotor(PIN_C5, false); } } void motorDemo(void) { float left = 0, right = 0, speed = 0.75f, accel = 0.01f; char ch; int i; Printf("Press:\n" " w-forward\n" " s-backward\n" " a-left\n" " d-right\n" " i-slowly forward\n" " k-slowly backward\n" " j-slowly left\n" " l-slowly right\n" " space-stop\n" " enter-quit\n"); // wait for the user to enter a character ch = ' '; while (ch != '\n') { switch (ch) { case 'w': left = speed; right = speed; break; case 's': left = -speed; right = -speed; break; case 'a': left = -speed; right = speed; break; case 'd': left = speed; right = -speed; break; case 'i': right += accel; left += accel; break; case 'k': right -= accel; left -= accel; break; case 'j': right -= accel; left += accel; break; case 'l': right += accel; left -= accel; break; default: left = 0; right = 0; break; } SetMotor(Motors[0], left); SetMotor(Motors[1], left); SetMotor(Motors[2], right); SetMotor(Motors[3], right); Printf(" set motor to %1.2f %1.2f \r", left, right); ch = Getc(); } // make sure the motors are off before exiting the demo for (i = 0; i < 4; ++i) SetMotor(Motors[i], 0); Printf("\n"); }
// // REDLibraryDatasourceFactory.h // ReadingList // // Created by Banco Santander Brasil on 6/10/16. // Copyright © 2016 Rafael Gonzalves. All rights reserved. // #import <Foundation/Foundation.h> #import "REDLibraryDatasourceFactory.h" @interface REDLibraryDatasourceFactoryImpl : NSObject <REDLibraryDatasourceFactory> @end
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_UINT256_H #define BITCOIN_UINT256_H #include <assert.h> #include <cstring> #include <stdexcept> #include <stdint.h> #include <string> #include <vector> #ifdef _MSC_VER # define _ALIGN(x) __declspec(align(x)) #else # define _ALIGN(x) __attribute__ ((aligned(x))) #endif /** Template base class for fixed-sized opaque blobs. */ template<unsigned int BITS> class base_blob { protected: enum { WIDTH=BITS/8 }; uint8_t _ALIGN(4) data[WIDTH]; public: base_blob() { memset(data, 0, sizeof(data)); } explicit base_blob(const std::vector<unsigned char>& vch); bool IsNull() const { for (int i = 0; i < WIDTH; i++) if (data[i] != 0) return false; return true; } void SetNull() { memset(data, 0, sizeof(data)); } friend inline bool operator==(const base_blob& a, const base_blob& b) { return memcmp(a.data, b.data, sizeof(a.data)) == 0; } friend inline bool operator!=(const base_blob& a, const base_blob& b) { return memcmp(a.data, b.data, sizeof(a.data)) != 0; } friend inline bool operator<(const base_blob& a, const base_blob& b) { return memcmp(a.data, b.data, sizeof(a.data)) < 0; } std::string GetHex() const; void SetHex(const char* psz); void SetHex(const std::string& str); std::string ToString() const; unsigned char* begin() { return &data[0]; } unsigned char* end() { return &data[WIDTH]; } const unsigned char* begin() const { return &data[0]; } const unsigned char* end() const { return &data[WIDTH]; } unsigned int size() const { return sizeof(data); } unsigned int GetSerializeSize(int nType, int nVersion) const { return sizeof(data); } template<typename Stream> void Serialize(Stream& s, int nType, int nVersion) const { s.write((char*)data, sizeof(data)); } template<typename Stream> void Unserialize(Stream& s, int nType, int nVersion) { s.read((char*)data, sizeof(data)); } }; /** 160-bit opaque blob. * @note This type is called uint160 for historical reasons only. It is an opaque * blob of 160 bits and has no integer operations. */ class uint160 : public base_blob<160> { public: uint160() {} uint160(const base_blob<160>& b) : base_blob<160>(b) {} explicit uint160(const std::vector<unsigned char>& vch) : base_blob<160>(vch) {} }; /** 256-bit opaque blob. * @note This type is called uint256 for historical reasons only. It is an * opaque blob of 256 bits and has no integer operations. Use arith_uint256 if * those are required. */ class uint256 : public base_blob<256> { public: uint256() {} uint256(const base_blob<256>& b) : base_blob<256>(b) {} explicit uint256(const std::vector<unsigned char>& vch) : base_blob<256>(vch) {} /** A cheap hash function that just returns 64 bits from the result, it can be * used when the contents are considered uniformly random. It is not appropriate * when the value can easily be influenced from outside as e.g. a network adversary could * provide values to trigger worst-case behavior. * @note The result of this function is not stable between little and big endian. */ uint64_t GetCheapHash() const { uint64_t result; memcpy((void*)&result, (void*)data, 8); return result; } /** A more secure, salted hash function. * @note This hash is not stable between little and big endian. */ uint64_t GetHash(const uint256& salt) const; }; /* uint256 from const char *. * This is a separate function because the constructor uint256(const char*) can result * in dangerously catching uint256(0). */ inline uint256 uint256S(const char *str) { uint256 rv; rv.SetHex(str); return rv; } /* uint256 from std::string. * This is a separate function because the constructor uint256(const std::string &str) can result * in dangerously catching uint256(0) via std::string(const char*). */ inline uint256 uint256S(const std::string& str) { uint256 rv; rv.SetHex(str); return rv; } #endif // BITCOIN_UINT256_H
// // WMPageController.h // WMPageController // // Created by Mark on 15/6/11. // Copyright (c) 2015年 yq. All rights reserved. // #import <UIKit/UIKit.h> #import "WMMenuView.h" /************************************************************************************************************** * WMPageController 的缓存设置,默认缓存为无限制,当收到 memoryWarning 时,会自动切换到低缓存模式 (WMPageControllerCachePolicyLowMemory),并在一段时间后切换回默认模式. 收到多次警告后,会停留在到 WMPageControllerCachePolicyLowMemory 不再增长 ************************************************************************************************************** * The Default cache policy is No Limit, when recieved memory warning, page controller will switch mode to 'LowMemory' and continue to grow back after a while. If recieved too much times, the cache policy will stay at 'LowMemory' and don't grow back any more. */ typedef NS_ENUM(NSUInteger, WMPageControllerCachePolicy){ WMPageControllerCachePolicyNoLimit = 0, // No limit WMPageControllerCachePolicyLowMemory = 1, // Low Memory but may block when scroll WMPageControllerCachePolicyBalanced = 3, // Balanced ↑ and ↓ WMPageControllerCachePolicyHigh = 5 // High }; @interface WMPageController : UIViewController /** * 各个控制器的 class, 例如:[UITableViewController class] * Each controller's class, example:[UITableViewController class] */ @property (nonatomic, strong) NSArray *viewControllerClasses; /** * 各个控制器标题, NSString * Titles of view controllers in page controller. Use `NSString`. */ @property (nonatomic, strong) NSArray *titles; @property (nonatomic, strong, readonly) UIViewController *currentViewController; /** * 设置选中几号 item * To select item at index */ @property (nonatomic, assign) int selectIndex; /** * 点击相邻的 MenuItem 是否触发翻页动画(当当前选中与点击Item相差大于1是不触发) * Whether to animate when press the MenuItem, if distant between the selected and the pressed is larger than 1,never animate. */ @property (nonatomic, assign) BOOL pageAnimatable; /** * 选中时的标题尺寸 * The title size when selected (animatable) */ @property (nonatomic, assign) CGFloat titleSizeSelected; /** * 非选中时的标题尺寸 * The normal title size (animatable) */ @property (nonatomic, assign) CGFloat titleSizeNormal; /** * 标题选中时的颜色, 颜色是可动画的. * The title color when selected, the color is animatable. */ @property (nonatomic, strong) UIColor *titleColorSelected; /** * 标题非选择时的颜色, 颜色是可动画的. * The title's normal color, the color is animatable. */ @property (nonatomic, strong) UIColor *titleColorNormal; /** * 标题的字体名字 * The name of title's font */ @property (nonatomic, copy) NSString *titleFontName; /** * 导航栏高度 * The menu view's height */ @property (nonatomic, assign) CGFloat menuHeight; // ************************************************************************************** // 当所有item的宽度加起来小于屏幕宽时,PageController会自动帮助排版,添加每个item之间的间隙以填充整个宽度 // When the sum of all the item's width is smaller than the screen's width, pageController will add gap to each item automatically, in order to fill the width. /** * 每个 MenuItem 的宽度 * The item width,when all are same,use this property */ @property (nonatomic, assign) CGFloat menuItemWidth; /** * 各个 MenuItem 的宽度,可不等,数组内为 NSNumber. * Each item's width, when they are not all the same, use this property, Put `NSNumber` in this array. */ @property (nonatomic, strong) NSArray *itemsWidths; /** * 导航栏背景色 * The background color of menu view */ @property (nonatomic, strong) UIColor *menuBGColor; /** * Menu view 的样式,默认为无下划线 * Menu view's style, now has two different styles, 'Line','default' */ @property (nonatomic, assign) WMMenuViewStyle menuViewStyle; /** * 进度条的颜色,默认和选中颜色一致(如果 style 为 Default,则该属性无用) * The progress's color,the default color is same with `titleColorSelected`.If you want to have a different color, set this property. */ @property (nonatomic, strong) UIColor *progressColor; /** * 是否发送在创建控制器或者视图完全展现在用户眼前时通知观察者,默认为不开启,如需利用通知请开启 * Whether notify observer when finish init or fully displayed to user, the default is NO. */ @property (nonatomic, assign) BOOL postNotification; /** * 是否记录 Controller 的位置,并在下次回来的时候回到相应位置,默认为 NO (若当前缓存中存在不会触发) * Whether to remember controller's positon if it's a kind of scrollView controller,like UITableViewController,The default value is NO. * 比如 `UITabelViewController`, 当然你也可以在自己的控制器中自行设置, 如果将 Controller.view 替换为 scrollView 或者在Controller.view 上添加了一个和自身 bounds 一样的 scrollView 也是OK的 */ @property (nonatomic, assign) BOOL rememberLocation __deprecated_msg("Because of the cache policy,this property can abondon now."); /** * 缓存的机制,默认为无限制(如果收到内存警告) */ @property (nonatomic, assign) WMPageControllerCachePolicy cachePolicy; /** * 构造方法,请使用该方法创建控制器. * Init method,recommend to use this instead of `-init`. * * @param classes 子控制器的 class,确保数量与 titles 的数量相等 * @param titles 各个子控制器的标题,用 NSString 描述 * * @return instancetype */ - (instancetype)initWithViewControllerClasses:(NSArray *)classes andTheirTitles:(NSArray *)titles; @end
/* * Copyright (c) 2012 cocos2d-x.org * http://www.cocos2d-x.org * * Copyright 2012 Yannick Loriot. All rights reserved. * http://yannickloriot.com * * 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 __CCCONTROLSWITCH_H__ #define __CCCONTROLSWITCH_H__ #include "CCControl.h" namespace cocos2d { class Sprite; } namespace cocos2d { class LabelTTF; } NS_CC_EXT_BEGIN class ControlSwitchSprite; /** * @addtogroup GUI * @{ * @addtogroup control_extension * @{ */ /** @class ControlSwitch Switch control for Cocos2D. */ class ControlSwitch : public Control { public: /** Creates a switch with a mask sprite, on/off sprites for on/off states, a thumb sprite and an on/off labels. */ static ControlSwitch* create(Sprite *maskSprite, Sprite * onSprite, Sprite * offSprite, Sprite * thumbSprite, LabelTTF* onLabel, LabelTTF* offLabel); /** Creates a switch with a mask sprite, on/off sprites for on/off states and a thumb sprite. */ static ControlSwitch* create(Sprite *maskSprite, Sprite * onSprite, Sprite * offSprite, Sprite * thumbSprite); ControlSwitch(); virtual ~ControlSwitch(); /** Initializes a switch with a mask sprite, on/off sprites for on/off states and a thumb sprite. */ bool initWithMaskSprite(Sprite *maskSprite, Sprite * onSprite, Sprite * offSprite, Sprite * thumbSprite); /** Initializes a switch with a mask sprite, on/off sprites for on/off states, a thumb sprite and an on/off labels. */ bool initWithMaskSprite(Sprite *maskSprite, Sprite * onSprite, Sprite * offSprite, Sprite * thumbSprite, LabelTTF* onLabel, LabelTTF* offLabel); /** * Set the state of the switch to On or Off, optionally animating the transition. * * @param isOn YES if the switch should be turned to the On position; NO if it * should be turned to the Off position. If the switch is already in the * designated position, nothing happens. * @param animated YES to animate the "flipping" of the switch; otherwise NO. */ void setOn(bool isOn, bool animated); void setOn(bool isOn); bool isOn(void) const { return _on; } bool hasMoved() const { return _moved; } virtual void setEnabled(bool enabled); Point locationFromTouch(Touch* touch); // Overrides virtual bool ccTouchBegan(Touch *pTouch, Event *pEvent) override; virtual void ccTouchMoved(Touch *pTouch, Event *pEvent) override; virtual void ccTouchEnded(Touch *pTouch, Event *pEvent) override; virtual void ccTouchCancelled(Touch *pTouch, Event *pEvent) override; protected: /** Sprite which represents the view. */ ControlSwitchSprite* _switchSprite; float _initialTouchXPosition; bool _moved; /** A Boolean value that determines the off/on state of the switch. */ bool _on; }; // end of GUI group /// @} /// @} NS_CC_EXT_END #endif /* __CCCONTROLSWITCH_H__ */
/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QDECLARATIVEBINDINGOPTIMIZATIONS_P_H #define QDECLARATIVEBINDINGOPTIMIZATIONS_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // #include "private/qdeclarativeexpression_p.h" #include "private/qdeclarativebinding_p.h" QT_BEGIN_HEADER QT_BEGIN_NAMESPACE struct QDeclarativeBindingCompilerPrivate; class QDeclarativeBindingCompiler { public: QDeclarativeBindingCompiler(); ~QDeclarativeBindingCompiler(); // Returns true if bindings were compiled bool isValid() const; struct Expression { QDeclarativeParser::Object *component; QDeclarativeParser::Object *context; QDeclarativeParser::Property *property; QDeclarativeParser::Variant expression; QHash<QString, QDeclarativeParser::Object *> ids; QDeclarativeImports imports; }; // -1 on failure, otherwise the binding index to use int compile(const Expression &, QDeclarativeEnginePrivate *); // Returns the compiled program QByteArray program() const; static void dump(const QByteArray &); private: QDeclarativeBindingCompilerPrivate *d; }; class QDeclarativeCompiledBindingsPrivate; class QDeclarativeCompiledBindings : public QObject, public QDeclarativeAbstractExpression, public QDeclarativeRefCount { public: QDeclarativeCompiledBindings(const char *program, QDeclarativeContextData *context, QDeclarativeRefCount *); virtual ~QDeclarativeCompiledBindings(); QDeclarativeAbstractBinding *configBinding(int index, QObject *target, QObject *scope, int property); protected: int qt_metacall(QMetaObject::Call, int, void **); private: Q_DISABLE_COPY(QDeclarativeCompiledBindings) Q_DECLARE_PRIVATE(QDeclarativeCompiledBindings) }; QT_END_NAMESPACE QT_END_HEADER #endif // QDECLARATIVEBINDINGOPTIMIZATIONS_P_H
// RUN: %check -e %s typedef unsigned long size_t; g() { size_t a; typedef int a; // CHECK: /error: mismatching definitions of "a"/ }
/** * @file counter.c * * \copyright Copyright 2013 /Dev. All rights reserved. * \license This project is released under MIT license. * * @author Ferdi van der Werf <efcm@slashdev.nl> * @since 0.1.0 */ #include "counter.h" // Do we want to use the counter? #ifdef UTILS_COUNTER // Check if a timer is selected #if !defined(UTILS_COUNTER_TIMER0) && !defined(UTILS_COUNTER_TIMER1) && !defined(UTILS_COUNTER_TIMER2) #error No timer selected for counter, it should be configured with a single timer #endif // Check if multiple timers have been selected #if (defined(UTILS_COUNTER_TIMER0) && (defined(UTILS_COUNTER_TIMER1) || defined(UTILS_COUNTER_TIMER2))) || (defined(UTILS_COUNTER_TIMER1) && defined(UTILS_COUNTER_TIMER2)) #error Multiple timers selected for counter, it should be configured with only a single timer #endif // Counter which shows how far in a second we are volatile uint8_t sub_seconds; volatile uint8_t is_running; void tick(void) { #ifdef NET_DHCP // Update dhcp counter dhcp_seconds++; #endif #ifdef UTILS_UPTIME // Update uptime counter uptime_tick(); #endif #if defined(UTILS_WERKTI) || defined(UTILS_WERKTI_MORE) // Update werkti timer werkti_tick(); #endif // UTILS_WERKTI || UTILS_WERKTI_MORE } uint8_t counter_is_running(void) { return is_running; } // For each timer selection cntInit() and overflow interrupt will be created #if defined(UTILS_COUNTER_TIMER0) void counter_init(void) { // 8 bit timer // 20 Mhz, prescaler 1024, compare match on 0xD9 // Count to 11 for a second // In 2 minutes, it is ~4 seconds too fast // CTC operation, OC0A and OC0B disconnected TCCR0A = (1 << WGM01); // Prescaler 1024 TCCR0B = (1 << CS00) | (1 << CS02); // Compare match value OCR0A = 0xD9; // Set compare interrupt TIMSK0 = (1 << OCIE0A); // Set timer is running is_running = 1; } ISR(TIMER0_COMPA_vect) { sub_seconds++; if (sub_seconds >= 89) { // A second passed tick(); sub_seconds = 0; } } #elif defined(UTILS_COUNTER_TIMER1) void counter_init(void) { // 16 bit timer // 20 Mhz, prescaler 1024, compare match on 0x4C4A // CTC operation, OC1A and OC1B disconnected, prescaler 1024 TCCR1A = 0x00; TCCR1B = (1 << WGM12) | (1 << CS10) | (1 << CS12); // Compare match value OCR1A = 0x4C48; // Set compare interrupt TIMSK1 = (1 << OCIE1A); // Set timer is running is_running = 1; } ISR(TIMER1_COMPA_vect) { tick(); } #elif defined(UTILS_COUNTER_TIMER2) void counter_init(void) { // 8 bit timer // 20 Mhz, prescaler 1024, compare match on 0xD9 // Count to 11 for a second // In 2 minutes, it is ~4 seconds too fast // CTC operation, OC2A and OC2B disconnected TCCR2A = (1 << WGM21); // Prescaler 1024 TCCR2B = (1 << CS20) | (1 << CS21) | (1 << CS22); // Compare match value OCR2A = 0xD9; // Set compare interrupt TIMSK2 = (1 << OCIE2A); // Set timer is running is_running = 1; } ISR(TIMER2_COMPA_vect) { sub_seconds++; if (sub_seconds >= 89) { // A second passed tick(); sub_seconds = 0; } } #endif #endif // UTIL_COUNTER
/* * Generated by class-dump 3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2012 by Steve Nygard. */ #import "NSObject.h" #import "DVTInvalidation.h" @class DVTFilePath, DVTPerformanceMetric, DVTStackBacktrace, IDESnapshotsManager, IDEWorkspace, NSDictionary, NSObject<OS_dispatch_queue>, NSString; @interface IDEWorkspaceSnapshotManager : NSObject <DVTInvalidation> { IDESnapshotsManager *_snapshotsManager; DVTPerformanceMetric *_metric; IDEWorkspace *_workspace; DVTFilePath *_repositoryPath; BOOL _userIntentToSnapshot; NSString *_currentOperationName; id <IDESnapshotConfirmationDelegate> _confirmationDelegate; NSObject<OS_dispatch_queue> *_snapshotManagerQueue; NSDictionary *_localizedStrings; } + (void)initialize; - (void).cxx_destruct; - (void)_generateLocalizedStrings; - (id)_localizedStringForKey:(id)arg1; - (BOOL)_shouldCreateSnapshotWithType:(int)arg1 error:(id *)arg2; - (void)_snapshotsSettingsDidChange:(id)arg1; @property(retain) id <IDESnapshotConfirmationDelegate> confirmationDelegate; // @synthesize confirmationDelegate=_confirmationDelegate; - (void)createAutomaticSnapshotBefore:(id)arg1 generatedBy:(id)arg2 type:(int)arg3 completionBlock:(id)arg4; - (void)createSnapshotWithType:(int)arg1 name:(id)arg2 description:(id)arg3 origin:(id)arg4 completionBlock:(id)arg5; @property(copy) NSString *currentOperationName; // @synthesize currentOperationName=_currentOperationName; - (id)initWithWorkspace:(id)arg1; - (void)primitiveInvalidate; @property(retain) DVTFilePath *repositoryPath; // @synthesize repositoryPath=_repositoryPath; @property(readonly) IDEWorkspace *workspace; // @synthesize workspace=_workspace; // Remaining properties @property(retain) DVTStackBacktrace *creationBacktrace; @property(readonly, copy) NSString *debugDescription; @property(readonly, copy) NSString *description; @property(readonly) unsigned long long hash; @property(readonly) DVTStackBacktrace *invalidationBacktrace; @property(readonly) Class superclass; @property(readonly, nonatomic, getter=isValid) BOOL valid; @end
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ /* Copyright 2010 litl, LLC. * * 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 __CAIRO_MODULE_H__ #define __CAIRO_MODULE_H__ JSBool gjs_js_define_cairo_stuff (JSContext *context, JSObject **module_out); #endif /* __CAIRO_MODULE_H__ */
// // ALDAppDelegate.h // ALDBlurImageProcessorDemo // // Created by Daniel L. Alves on 15/05/14. // Copyright (c) 2014 Daniel L. Alves. All rights reserved. // #import <UIKit/UIKit.h> @interface ALDAppDelegate : UIResponder< UIApplicationDelegate > @property( strong, nonatomic )UIWindow *window; @end
#include <stdio.h> #define SIZE 3 float avrArr(int[]); int main(){ int nums[SIZE],i; float avr; printf("Please insert %d numbers:\n",SIZE); for(i=0;i<SIZE;i++){ scanf("%d",&nums[i]); } avr=avrArr(nums); printf("\nThe average of nums[] is: %.2f\n",avr); printf("\n[Press any key to close]"); getchar(); getchar(); return 0; } float avrArr(int arr[]){ int i; float mean=0.0; for(i=0; i<SIZE; i++){ mean+=arr[i]; } mean=(mean/SIZE); return mean; }
#include <gtk/gtk.h> static void destroy(GtkWidget *widget, gpointer data) { gtk_main_quit(); } static void entry_activated(GtkWidget *entry, gpointer data) { g_print("Entry text: '%s'\n", gtk_entry_get_text(GTK_ENTRY(entry))); } int main(int argc, char *argv[]) { gtk_init(&argc, &argv); GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(window, "destroy", G_CALLBACK(destroy), NULL); GtkWidget *entry = gtk_entry_new(); gtk_entry_set_text(GTK_ENTRY(entry), "A Text Entry Widget"); gtk_entry_set_placeholder_text(GTK_ENTRY(entry), "Placeholder Text"); g_signal_connect(GTK_ENTRY(entry), "activate", G_CALLBACK(entry_activated), NULL); gtk_container_add(GTK_CONTAINER(window), entry); gtk_widget_show_all(window); gtk_main(); return 0; }
/* * Copyright (C) 2007 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 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. */ #pragma once namespace JSC { class ExecState; class JSValue; } namespace WebCore { class HTMLSelectElement; void selectElementIndexSetter(JSC::ExecState&, HTMLSelectElement&, unsigned index, JSC::JSValue); }
/* * This file is part of the CMaNGOS Project. See AUTHORS file for Copyright information * * 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 DEF_GAMEOBJECT_AI_H #define DEF_GAMEOBJECT_AI_H #include "Platform/Define.h" class GameObject; class GameObjectAI { public: explicit GameObjectAI(GameObject* go); virtual ~GameObjectAI(); virtual void UpdateAI(const uint32 /*diff*/) {} virtual void OnEventHappened(uint16 /*eventId*/, bool /*activate*/, bool /*resume*/) {} protected: GameObject* m_go; }; #endif
/* * Copyright 2001 Niels Provos <provos@citi.umich.edu> * All rights reserved. * * This header file contains definitions for dealing with HTTP requests * that are internal to libevent. As user of the library, you should not * need to know about these. */ #ifndef _HTTP_H_ #define _HTTP_H_ #define HTTP_CONNECT_TIMEOUT 45 #define HTTP_WRITE_TIMEOUT 50 #define HTTP_READ_TIMEOUT 50 #define HTTP_PREFIX "http://" #define HTTP_DEFAULTPORT 80 enum evhttp_connection_error { EVCON_HTTP_TIMEOUT, EVCON_HTTP_EOF, EVCON_HTTP_INVALID_HEADER }; struct evbuffer; struct addrinfo; struct evhttp_request; /* A stupid connection object - maybe make this a bufferevent later */ enum evhttp_connection_state { EVCON_DISCONNECTED, /* not currently connected not trying either */ EVCON_CONNECTING, /* tries to currently connect */ EVCON_CONNECTED /* connection is established */ }; struct event_base; struct evhttp_connection { /* we use tailq only if they were created for an http server */ TAILQ_ENTRY(evhttp_connection) (next); int fd; struct event ev; struct event close_ev; struct evbuffer *input_buffer; struct evbuffer *output_buffer; char *bind_address; /* address to use for binding the src */ char *address; /* address to connect to */ u_short port; int flags; #define EVHTTP_CON_INCOMING 0x0001 /* only one request on it ever */ #define EVHTTP_CON_OUTGOING 0x0002 /* multiple requests possible */ #define EVHTTP_CON_CLOSEDETECT 0x0004 /* detecting if persistent close */ int timeout; /* timeout in seconds for events */ int retry_cnt; /* retry count */ int retry_max; /* maximum number of retries */ enum evhttp_connection_state state; /* for server connections, the http server they are connected with */ struct evhttp *http_server; TAILQ_HEAD(evcon_requestq, evhttp_request) requests; void (*cb)(struct evhttp_connection *, void *); void *cb_arg; void (*closecb)(struct evhttp_connection *, void *); void *closecb_arg; struct event_base *base; }; struct evhttp_cb { TAILQ_ENTRY(evhttp_cb) next; char *what; void (*cb)(struct evhttp_request *req, void *); void *cbarg; }; /* both the http server as well as the rpc system need to queue connections */ TAILQ_HEAD(evconq, evhttp_connection); struct evhttp { struct event bind_ev; TAILQ_HEAD(httpcbq, evhttp_cb) callbacks; struct evconq connections; int timeout; void (*gencb)(struct evhttp_request *req, void *); void *gencbarg; struct event_base *base; }; /* resets the connection; can be reused for more requests */ void evhttp_connection_reset(struct evhttp_connection *); /* connects if necessary */ int evhttp_connection_connect(struct evhttp_connection *); /* notifies the current request that it failed; resets connection */ void evhttp_connection_fail(struct evhttp_connection *, enum evhttp_connection_error error); void evhttp_get_request(struct evhttp *, int, struct sockaddr *, socklen_t); int evhttp_hostportfile(char *, char **, u_short *, char **); int evhttp_parse_lines(struct evhttp_request *, struct evbuffer*); void evhttp_start_read(struct evhttp_connection *); void evhttp_read_header(int, short, void *); void evhttp_make_header(struct evhttp_connection *, struct evhttp_request *); void evhttp_write_buffer(struct evhttp_connection *, void (*)(struct evhttp_connection *, void *), void *); /* response sending HTML the data in the buffer */ void evhttp_response_code(struct evhttp_request *, int, const char *); void evhttp_send_page(struct evhttp_request *, struct evbuffer *); #endif /* _HTTP_H */